vb_test_extract_voice ----- Trial onset extraction parameters for voise ----- parm.data_file : Data file name [string] parm.trig_file : Trial onset file name [string] parm.trig_type = 'voice' parm.slope = [] No meaning if trig_type = 'voice' or 'emg' parm.condition : string describing condition parm.Pretrigger_ms : Pretrigger period [msec] parm.Posttrigger_ms: Posttrigger period [msec] --- Optional parameter for voice onset [Default] parm.status_level : status level [] parm.t_period : minimum period length that smoothed amplitude exceeds the threshold [100 ms] --- Usually following parameters need not be changed parm.p_val : P-value corresponding to the threshold [0.0001] parm.t_smooth : moving average window length [10 ms] ---- Voice onset extraction 1. Smoothed amplitude (SA) is calculated by moving average of abs(signal) with time window length of t_smooth (10ms : 100Hz) 2. Gamma distribution is fitted to the SA histgram 3. Threshold value is determined from estimated gamma distribution 4. If 'status_level' is not empty, threshold value is set to max(SA) * status_level 5. Voice onsets are extracted where SA exceed the threshold --- Condition for voice onset (vb_get_voice_onset.m) Period length that SA exceed the threshold is larger than 't_period' --- Save variables for '.trig.mat' status : voise signal status_out = smoothed signal for abs(status) status_val = status value for threshold trig(n) : Onset time index for n-th trial cond_id(n) : Condition ID for n-th trial if there are multi condition ix_trial(:,n) : Time index for n-th trial [Tperiod x Ntrial] Tperiod : # of time sample in one trial Ntrial : # of trials parm : parameter setting parm.fsamp : Sample Frequency [Hz] (4500 Hz) 2011-12-18 Masa-aki Sato Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 % vb_test_extract_voice 0002 % ----- Trial onset extraction parameters for voise ----- 0003 % parm.data_file : Data file name [string] 0004 % parm.trig_file : Trial onset file name [string] 0005 % parm.trig_type = 'voice' 0006 % parm.slope = [] 0007 % No meaning if trig_type = 'voice' or 'emg' 0008 % parm.condition : string describing condition 0009 % parm.Pretrigger_ms : Pretrigger period [msec] 0010 % parm.Posttrigger_ms: Posttrigger period [msec] 0011 % 0012 % --- Optional parameter for voice onset [Default] 0013 % parm.status_level : status level [] 0014 % parm.t_period : minimum period length that 0015 % smoothed amplitude exceeds the threshold [100 ms] 0016 % 0017 % --- Usually following parameters need not be changed 0018 % parm.p_val : P-value corresponding to the threshold [0.0001] 0019 % parm.t_smooth : moving average window length [10 ms] 0020 % 0021 % ---- Voice onset extraction 0022 % 1. Smoothed amplitude (SA) is calculated by moving average of abs(signal) 0023 % with time window length of t_smooth (10ms : 100Hz) 0024 % 2. Gamma distribution is fitted to the SA histgram 0025 % 3. Threshold value is determined from estimated gamma distribution 0026 % 4. If 'status_level' is not empty, 0027 % threshold value is set to max(SA) * status_level 0028 % 5. Voice onsets are extracted where SA exceed the threshold 0029 % 0030 % --- Condition for voice onset (vb_get_voice_onset.m) 0031 % Period length that SA exceed the threshold is larger than 't_period' 0032 % 0033 % --- Save variables for '.trig.mat' 0034 % status : voise signal 0035 % status_out = smoothed signal for abs(status) 0036 % status_val = status value for threshold 0037 % trig(n) : Onset time index for n-th trial 0038 % cond_id(n) : Condition ID for n-th trial if there are multi condition 0039 % ix_trial(:,n) : Time index for n-th trial [Tperiod x Ntrial] 0040 % Tperiod : # of time sample in one trial 0041 % Ntrial : # of trials 0042 % parm : parameter setting 0043 % parm.fsamp : Sample Frequency [Hz] (4500 Hz) 0044 % 0045 % 2011-12-18 Masa-aki Sato 0046 % 0047 % Copyright (C) 2011, ATR All Rights Reserved. 0048 % License : New BSD License(see VBMEG_LICENSE.txt) 0049 0050 clear all 0051 0052 % --- root directry 0053 %root_dir = [getenv('MATDATA') '/Sekiyama']; 0054 0055 % --- data file names (base name without extension) 0056 data_id = 'AM090311a'; 0057 data_file = [data_id '.mat']; 0058 0059 parm.data_file = [data_id '.meg.mat']; 0060 % Trial onset file 0061 parm.trig_file = [data_id '.trig.mat']; 0062 0063 parm.condition = 'voice'; 0064 parm.status_ch = '442'; % 442; ²»À¼ 0065 parm.trig_type = 'voice'; 0066 parm.slope = ''; 0067 0068 parm.Pretrigger_ms = [ 50 ]; % [msec] 0069 parm.Posttrigger_ms = [ 200 ]; % [msec] 0070 0071 % --- Critical parameter (this value may be changed) 0072 parm.status_level = []; 0073 % If 'status_level' is not empty, 0074 % threshold = max(SA) * status_level 0075 parm.t_period = 100; % [msec] 0076 0077 % --- Default parameter 0078 % Usually these parameters need not be changed 0079 parm.t_smooth = 10; 0080 0081 % --- Trial onset extraction 0082 if exist('root_dir') && ~isempty(root_dir) 0083 vb_job_trial_onset(root_dir,parm); 0084 else 0085 vb_test_job_trial_onset(data_file ,parm); 0086 end 0087 0088 % --- Plot status signal and estimated onset 0089 plot_parm.mode = 1; % = 1: plot all trial 0090 % = 2: subplot for each trial 0091 % = 3: multiple trials in one subplot 0092 plot_parm.NXmax = 5; % # of trial in X-axis 0093 plot_parm.NYmax = 4; % # of subplot in Y-axis 0094 plot_parm.Ymax = 1; 0095 plot_parm.Ymin = 0; 0096 plot_parm.status= 1; 0097 0098 plot_parm.Ntrial = [1:20]; % trials for plot 0099 plot_parm.Ntrial = []; % plot all trials 0100 0101 if exist('root_dir') && ~isempty(root_dir) 0102 fname = [root_dir '/' parm.trig_file ]; 0103 else 0104 fname = [parm.trig_file ]; 0105 end 0106 0107 vb_plot_status(fname, plot_parm);