zapline-plus icon indicating copy to clipboard operation
zapline-plus copied to clipboard

nt_zapline_plus: nremove checked on wrong dimension

Open 0xlevel opened this issue 2 years ago • 4 comments

In v1.2.1 nt_zapline_plus, line 54, if nremove>=size(x,1); error('!'); end checks the wrong dimension. I think, it should be size(x,2).

I encountered this when trying to use zapline plus to clean two channels, only. An exception will be thrown later (in line 146), but I thought, you might want to know. The error can be bypassed by using fixed error components (= 1), but can perhaps be addressed, when set to adaptive. It is also possible, that I missed something and in that case I would be glad for advice. Cheers!

0xlevel avatar Sep 18 '22 17:09 0xlevel

I can confirm this, I think you are right. I recommend setting this to the second dimension and using adaptive cleaning instead of fixed cleaning with 1 dimension.

Although I do think that using zapline-plus for two channels only will likely to be problematic as spatial filtering requires at least some precision there. Where does your EEG data come from?

MariusKlug avatar Sep 19 '22 14:09 MariusKlug

Hi, thank you for your reply. I agree, that the 2 ch setup was indeed a very special case (see below). ;) I wanted to quickly pass on my observation, though, as adaptive cleaning also failed in my case. My use case was somewhat abductive, to put it mildly: I was briefly looking into methods to remove power line interference from EMG(!) data. A notch around 50 Hz (in my case) would already destroy too much information.

0xlevel avatar Sep 19 '22 14:09 0xlevel

Yeah it is a valid bug report, so thanks :)

I see. Hmm, maybe in your case the cleanline function of EEGLAB might be more useful, or did zapline in the end work for you?

MariusKlug avatar Sep 19 '22 14:09 MariusKlug

You are welcome. :) Yes, cleanline works fine, but has trouble working with non-stationary noise. I also looked into PREP’s cleanLineNoise, which seems a bit excessive and the implementation of the Regression-Subtraction method (Mewett, 2001) by Eiber & Pietersen, which also works, but would require some additional effort. So, yeah, Zapline plus is still tempting, but perhaps later™. Cheers!

0xlevel avatar Sep 19 '22 14:09 0xlevel