Home > vbmeg > 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

 2022-4-27 k_suzuki

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

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