Filtering and detrending questions

Hi,

I had a couple of closely related queries.

I’m currently using PyPrep’s NoisyChannels class to autoremove bad channels, and I’ve read a couple of slightly different things about the included filtering/detrending. Originally I was applying a 1-45Hz bp filter, a 50Hz notch filter, and then using NoisyChannels and the related functions, assuming these wouldn’t include any additional filtering or detrending. In one iterative workflow I actually run NoisyChannels() twice.

However I have been getting a message about a 1Hz highpass filter being applied and I was a little confused by the docs/the code on GitHub. Obviously I don’t want to be filtering repeatedly if I don’t need to, and if any other steps are included in detrending (it’s a little hard to tell from the GitHub code), I’d want to at least know what these are.

If I run the following, will it simply find the noisy channels without any other filtering/DSP steps?

chans = NoisyChannels(eeg_fF, do_detrend=False)
chans.find_bad_by_correlation()
chans.find_bad_by_deviation()
chans.find_bad_by_ransac()

Similarly, I was also curious about what exactly linear detrending in the MNE epochs function entails(?) I currently have it set to “linear_detrend=1”.

Any help would be really appreciated.

This is for PyPrep 0.4.3/MNE-Python 1.6.1 (Win10).

@sappelhoff could tell you more than I, but here is what I found: find_bad_by_correlation starts with those 2 lines:

if self.EEGFiltered is None:
    self.EEGFiltered = self._get_filtered_data()

Which runs this method: pyprep/pyprep/find_noisy_channels.py at e4840d9c31ccd880e427448edd8317ff9f6f7909 · sappelhoff/pyprep · GitHub

Which copies the data and applies a (1, 50) Hz filter on the copy.

Mathieu

2 Likes

I can confirm that PyPREP doesn’t alter the input data.

2 Likes

My mistake- I’d actually looked at the docs and misread it as possibly meaning there was a filter on the data itself. Thanks :smile:

Thanks. :slight_smile: Do you know if the linear detrend (i.e detrend=1) method used in epoching includes filtering? Apologies if it’s a silly question.