Home > NoiseTools > nt_dss0.m

nt_dss0

PURPOSE ^

[todss,pwr1,pwr2]=nt_dss0(c0,c1,keep1,keep2) - dss from covariance

SYNOPSIS ^

function [todss,pwr0,pwr1]=nt_dss0(c0,c1,keep1,keep2)

DESCRIPTION ^

[todss,pwr1,pwr2]=nt_dss0(c0,c1,keep1,keep2) - dss from covariance

 todss: matrix to convert data to normalized DSS components
 pwr0: power per component (baseline)
 pwr1: power per component (biased)

 c0: baseline covariance
 c1: biased covariance
 keep1: number of PCs to retain (default: all)
 keep2: ignore PCs smaller than keep2 (default: 10.^-10)

 Cite:
 de Cheveign\'e, A. and Simon J.Z. (2008), "Denoising 
 based on spatial filtering", J Neurosci Methods 171: 331-339.
 and:
 J. S\"arel\"a, J. and Valpola, H. (2005), Denoising source separation. 
 Journal of Machine Learning Research 6: 233-272.

 NoiseTools

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [todss,pwr0,pwr1]=nt_dss0(c0,c1,keep1,keep2)
0002 %[todss,pwr1,pwr2]=nt_dss0(c0,c1,keep1,keep2) - dss from covariance
0003 %
0004 % todss: matrix to convert data to normalized DSS components
0005 % pwr0: power per component (baseline)
0006 % pwr1: power per component (biased)
0007 %
0008 % c0: baseline covariance
0009 % c1: biased covariance
0010 % keep1: number of PCs to retain (default: all)
0011 % keep2: ignore PCs smaller than keep2 (default: 10.^-10)
0012 %
0013 % Cite:
0014 % de Cheveign\'e, A. and Simon J.Z. (2008), "Denoising
0015 % based on spatial filtering", J Neurosci Methods 171: 331-339.
0016 % and:
0017 % J. S\"arel\"a, J. and Valpola, H. (2005), Denoising source separation.
0018 % Journal of Machine Learning Research 6: 233-272.
0019 %
0020 % NoiseTools
0021 nt_greetings;
0022 
0023 
0024 if nargin<4||isempty(keep2); keep2=10.^-9; end
0025 if nargin<3; keep1=[]; end
0026 if nargin<2; error('needs at least two arguments'); end
0027 
0028 if size(c0)~=size(c1); error('C0 and C1 should have same size'); end
0029 if size(c0,1)~=size(c0,2); error('C0 should be square'); end
0030 
0031 
0032 % PCA and whitening matrix from the unbiased covariance
0033 [topcs1,evs1]=nt_pcarot(c0,keep1);
0034 evs1=abs(evs1);
0035 
0036 % truncate PCA series if needed
0037 if ~isempty(keep1); topcs1=topcs1(:,1:keep1); evs1=evs1(1:keep1); end
0038 if ~isempty(keep2); idx=find(evs1/max(evs1)>keep2); topcs1=topcs1(:,idx); evs1=evs1(idx); end
0039 
0040 
0041 
0042 % apply PCA and whitening to the biased covariance
0043 N=diag(sqrt(1./(evs1)));     
0044 c2=N'*topcs1'*c1*topcs1*N;
0045 
0046 % matrix to convert PCA-whitened data to DSS
0047 [topcs2,evs2]=nt_pcarot(c2,keep1);
0048 
0049 % DSS matrix (raw data to normalized DSS)
0050 todss=topcs1*N*topcs2;
0051 N2=diag(todss'*c0*todss);
0052 todss=todss*diag(1./sqrt(N2)); % adjust so that components are normalized
0053 
0054 % power per DSS component
0055 pwr0=sqrt(sum((c0'*todss).^2)); % unbiased
0056 pwr1=sqrt(sum((c1'*todss).^2)); % biased
0057

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