Home > functions > device > active_check > vb_plot_channel_trial.m

vb_plot_channel_trial

PURPOSE ^

Plot several statics for 'Threshold' selection

SYNOPSIS ^

function vb_plot_channel_trial(ratio1,ratio2,thred_val1,thred_val2,prob_val,thred_num)

DESCRIPTION ^

 Plot several statics for 'Threshold' selection

 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    vb_plot_channel_trial(ratio1,ratio2, ...
0002                 thred_val1,thred_val2,prob_val,thred_num)
0003 % Plot several statics for 'Threshold' selection
0004 %
0005 % Copyright (C) 2011, ATR All Rights Reserved.
0006 % License : New BSD License(see VBMEG_LICENSE.txt)
0007 
0008 [Nch, Ntry] = size(ratio1);
0009 
0010 % candidate of threshold value
0011 if ~exist('thred_val1','var'), thred_val1 = [8:11]; end;
0012 % max of threshold value
0013 if ~exist('thred_val2','var'), thred_val2 = [8:11]; end; 
0014 % probability for bad trials to select bad channel
0015 if ~exist('prob_val','var'), prob_val = [0.02:0.01:0.05]; end;
0016 if ~exist('thred_num','var'), thred_num = ceil(Nch/4); end;
0017 
0018 thred_std = 9; % standard threshold value
0019 
0020 Nthre = length(thred_val1);
0021 Nnum  = length(prob_val);
0022 
0023 % limit max value for image plot
0024 ratio1 = min(ratio1,max(thred_val1)+1);
0025 ratio2 = min(ratio2,max(thred_val2)+1);
0026 
0027 NXfig=Nnum; NYfig=2; 
0028 nfig = 1;
0029 figure;
0030 
0031 % # of Bad Channel
0032 Mbad = zeros(Nthre,Nnum);
0033 % # of Bad Trials
0034 Mtry = zeros(Nthre,Nnum);
0035 
0036 for n=1:Nthre
0037     for m=1:Nnum
0038         thred  = [thred_val1(n), thred_val2(n)];
0039         % 1. Find noisy trials with multiple bad channels
0040         ch_act  = [1:Nch];
0041         try_err = vb_find_bad_trial(ratio1,ratio2,ch_act,thred,thred_num);
0042         try_act = vb_setdiff2([1:Ntry],try_err);
0043     
0044         % 2. Find Bad Channel after removing noisy trials
0045         ix_ch = vb_find_bad_channel(ratio1(:,try_act),ratio2(:,try_act), ...
0046                                     thred,prob_val(m));
0047         ix_act = vb_setdiff2([1:Nch],ix_ch);
0048         ix_try = vb_find_bad_trial(ratio1,ratio2, ix_act, thred);
0049         
0050         Mch(n,m)  = length(ix_ch);
0051         Mtry(n,m) = length(ix_try);
0052     end
0053 end
0054 
0055 for m=1:Nnum
0056     subplot(NYfig,NXfig,nfig); nfig = nfig + 1;
0057     plot(thred_val1(:),Mch(:,m))
0058     hold on
0059     plot([thred_std thred_std], [0 max(Mch(:,m))],'--')
0060     xlim([thred_val1(1) thred_val1(end)])
0061     title(sprintf('Bad ch [p=%4.2f]',prob_val(m)))
0062 end
0063     
0064 for m=1:Nnum
0065     subplot(NYfig,NXfig,nfig); nfig = nfig + 1;
0066     plot(thred_val1(:),Mtry(:,m))
0067     hold on
0068     plot([thred_std thred_std], [0 max(Mtry(:,m))],'--')
0069     xlim([thred_val1(1) thred_val1(end)])
0070     title(sprintf('Bad Trial [p=%4.2f]',prob_val(m)))
0071 end

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005