Home > NoiseTools > nt_dss1.m

nt_dss1

PURPOSE ^

[todss,pwr0,pwr1]=nt_dss1(x,w,keep1,keep2,sns_flag) - evoked-biased DSS denoising

SYNOPSIS ^

function [todss,pwr0,pwr1]=nt_dss1(x,w,keep1,keep2,sns_flag)

DESCRIPTION ^

[todss,pwr0,pwr1]=nt_dss1(x,w,keep1,keep2,sns_flag) - evoked-biased DSS denoising

  todss: denoising matrix
  pwr0: power per component (raw)
  pwr1: power per component (averaged)

  x: data to denoise (time * channels * trials)
  w: weight
  keep1: (in DSS0) number of PCs to retain (default: all)
  keep2: (in DSS0) ignore PCs smaller than keep2 (default: 10.^-8)
  sns_flag: if true, apply sns to average

  The data mean is NOT removed prior to processing.

 NoiseTools

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [todss,pwr0,pwr1]=nt_dss1(x,w,keep1,keep2,sns_flag)
0002 %[todss,pwr0,pwr1]=nt_dss1(x,w,keep1,keep2,sns_flag) - evoked-biased DSS denoising
0003 %
0004 %  todss: denoising matrix
0005 %  pwr0: power per component (raw)
0006 %  pwr1: power per component (averaged)
0007 %
0008 %  x: data to denoise (time * channels * trials)
0009 %  w: weight
0010 %  keep1: (in DSS0) number of PCs to retain (default: all)
0011 %  keep2: (in DSS0) ignore PCs smaller than keep2 (default: 10.^-8)
0012 %  sns_flag: if true, apply sns to average
0013 %
0014 %  The data mean is NOT removed prior to processing.
0015 %
0016 % NoiseTools
0017 
0018 if nargin<5; sns_flag=[]; end
0019 if nargin<4; keep2=10.^-12; end
0020 if nargin<3; keep1=[]; end
0021 if nargin<2; w=[]; end
0022 if nargin<1; error('!'); end
0023 
0024 if ndims(x)<3; error('x should be 3D'); end
0025 
0026 [m,n,o]=size(x);
0027 %[x,mn]=nt_demean(x,w);                            % remove weighted mean
0028 
0029 if isempty(w)% weighted average over trials (--> bias function for DSS)
0030     [c0,nc0]=nt_cov(x);
0031     c0=c0/nc0;
0032     [c1,nc1]=nt_cov(mean(x,3)); 
0033     c1=c1/nc1;
0034 else
0035     % weighted average over trials (--> bias function for DSS)
0036     if 1
0037         [xx,ww]=nt_mean_over_trials(x,w);
0038         if ~isempty(sns_flag); xx=nt_sns(xx,10,[],w); end
0039         ww=min(ww,[],2);
0040     else
0041         xx=mean(x,3);
0042         ww=ones([m,1]);
0043     end
0044     % covariance of raw and biased data
0045     [c0,nc0]=nt_cov(x,[],w);
0046     c0=c0/nc0;
0047     [c1,nc1]=nt_cov(xx,[],ww); 
0048     c1=c1/nc1;
0049 end
0050 
0051 % derive DSS matrix
0052 [todss,pwr0,pwr1]=nt_dss0(c0,c1,keep1,keep2);
0053

Generated on Mon 10-Nov-2014 14:40:42 by m2html © 2005