Home > vbmeg > functions > device > trigger_timing > vb_get_trigger_event.m

vb_get_trigger_event

PURPOSE ^

Find time points for event onset

SYNOPSIS ^

function [ix , status_val, status_out] =vb_get_trigger_event(status,status_level,parm)

DESCRIPTION ^

 Find time points for event onset
   [ix , status_val] = vb_get_trigger_event(status, status_level, parm)
 --- Input
 status : status signal
 status_level : status level for onset
 parm.trig_type = 'integer' or 'analog' or 'voice' or 'emg'
 parm.slope = 'const_start' or 'const_end'    if trig_type = 'integer'
              'low_to_high' or 'high_to_low'  if trig_type = 'analog'
               No meaning                     if trig_type = 'voice','emg'
 parm.t_stay : minimum length to stay 'status_level' [default = 10]
               'status' should be stay at the value 'status_level' 
               for more than 't_stay'
 --- Output
 ix : time index corresponding to the event onset
 status_val = status value used for thresholding
 status_out = (smoothed) status signal used for onset search
 --- Optional parm
 parm.abs
 parm.normalize
 parm.freq_ave : low pass frequency of moving average [Hz] for 'voice'
 
 2009-6-11 Masa-aki Sato
 2011-12-11 Masa-aki Sato added 'status_out'
 2012-1-8  Masa-aki Sato  added 't_stay'

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    [ix , status_val, status_out] = ...
0002             vb_get_trigger_event(status,status_level,parm)
0003 % Find time points for event onset
0004 %   [ix , status_val] = vb_get_trigger_event(status, status_level, parm)
0005 % --- Input
0006 % status : status signal
0007 % status_level : status level for onset
0008 % parm.trig_type = 'integer' or 'analog' or 'voice' or 'emg'
0009 % parm.slope = 'const_start' or 'const_end'    if trig_type = 'integer'
0010 %              'low_to_high' or 'high_to_low'  if trig_type = 'analog'
0011 %               No meaning                     if trig_type = 'voice','emg'
0012 % parm.t_stay : minimum length to stay 'status_level' [default = 10]
0013 %               'status' should be stay at the value 'status_level'
0014 %               for more than 't_stay'
0015 % --- Output
0016 % ix : time index corresponding to the event onset
0017 % status_val = status value used for thresholding
0018 % status_out = (smoothed) status signal used for onset search
0019 % --- Optional parm
0020 % parm.abs
0021 % parm.normalize
0022 % parm.freq_ave : low pass frequency of moving average [Hz] for 'voice'
0023 %
0024 % 2009-6-11 Masa-aki Sato
0025 % 2011-12-11 Masa-aki Sato added 'status_out'
0026 % 2012-1-8  Masa-aki Sato  added 't_stay'
0027 %
0028 % Copyright (C) 2011, ATR All Rights Reserved.
0029 % License : New BSD License(see VBMEG_LICENSE.txt)
0030 
0031 ix = [];
0032 
0033 if isfield(parm,'abs') && parm.abs == 1,
0034     status = abs(status);
0035 end
0036 
0037 if isfield(parm,'t_stay')
0038     t_stay = parm.t_stay;
0039 else
0040     t_stay = 10;
0041 end
0042 
0043 switch    lower(parm.trig_type)
0044 case    'bit'
0045 %    status_val = 2.^status_level;
0046     status_val = status_level;
0047     status_out = status;
0048     switch    lower(parm.slope)
0049     case    'low_to_high'
0050         ix = vb_bit_ptn_start(status,status_val,t_stay);
0051     case    'high_to_low'
0052         ix = vb_bit_ptn_end(status,status_val,t_stay);
0053     end
0054 case    'integer'
0055     switch    lower(parm.slope)
0056     case    'const_start'
0057         ix = vb_event_start(status,status_level,t_stay);
0058     case    'const_end'
0059         ix = vb_event_end(status,status_level,t_stay);
0060     end
0061     
0062     status_val = status_level;
0063     status_out = status;
0064 case    'analog'
0065     if ~isfield(parm,'normalize') || parm.normalize == 1,
0066         status_val = status_level * max(status);
0067     else
0068         status_val = status_level;
0069     end
0070     status_out = status;
0071     
0072     switch    lower(parm.slope)
0073     case    'low_to_high'
0074         ix = vb_trigger_start(status,status_val);
0075     case    'high_to_low'
0076         ix = vb_trigger_end(status,status_val);
0077     end
0078 case    'voice'
0079     [ix ,status_val, status_out] = ...
0080         vb_get_voice_onset(status,status_level,parm);
0081 case    'emg'
0082     [ix ,status_val, status_out] = vb_get_emg_onset(status,parm);
0083 end

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005