help > Possible bug in hmrMotionCorrectPCA
Showing 1-1 of 1 posts
Display:
Results per page:
Jul 10, 2018  08:07 PM | Frank Fishburn
Possible bug in hmrMotionCorrectPCA
Hello,

I am testing tPCA on some simulated data and am finding that nSV sometimes gets set to 0 when the first singular value is greater than nSV, resulting in no correction being applied.  I don't think this is a common scenario, so it's probably not a major problem.  However, it looks to me like the issue is on lines 67-70:

if nSV<1 & nSV>0
    ev = diag(svsc < nSV);
    nSV = find(diag(ev)==0,1)-1;
end

It looks to me like it can be fixed with this change:

if nSV<1 & nSV>0
    nSV = find(svsc>=nSV,1,'first');
end

Hope this helps. Apologies if I missed something.

Best,
Frank