50Hz artefact for time frequency analysis {Disarmed}

Hi all,

I am trying to deal with line noise that may have come from HPI or and outside line ( 60HZ) I saw this thread from Wed Oct 8 08:03:00 EDT 2014: cited below (https://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/2014-October/002627.html):

I have used both the notch filter and cHPI_filter approach provided by MNE but as you can see in the figures attached it does result in some distortions. I would like to try the approach Donald Kreiger suggests below and deal with the noise by (1) performing a Fourier transform, (2) attenuating the coefficients of the two frequencies, and (3) reconstructing the modified signal with an inverse Fourier transform. I have attached the results

My question is as follows: 1)is there a good reason not to try this approach 2) Is there a way to implement it natively and easily within men python?

Many thanks in advance for your kind attention

//david

P.s.
attachments of PSD plots of meg channels raw, filtered with notch filter and with cHPI filter function
code to generate filters:
for cHPI_filter:
raw_cHPI=mne.chpi.filter_chpi(raw,include_line=True)
for notch_filter:
notches = np.arange(60, 181, 60),
raw_notch=raw.notch_filter(notches)

[Mne_analysis] 50Hz artefact for time frequency analysis

Krieger, Donald N. kriegerd at upmc.edu? <mailto:mne_analysis%40nmr.mgh.harvard.edu?Subject=Re:%20%5BMne_analysis%5D%2050Hz%20artefact%20for%20time%20frequency%20analysis&In-Reply-To=%3C7FC4F062F840C344B5028EE833EEEADD131E2928%40MSXMBXNSPRD12.acct.upmchs.net%3E>
Wed Oct 8 08:03:00 EDT 2014
Previous message: [Mne_analysis] 50Hz artefact for time frequency analysis <https://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/2014-October/002626.html>
Next message: [Mne_analysis] 50Hz artefact for time frequency analysis <https://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/2014-October/002628.html>
Messages sorted by: [ date ] <https://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/2014-October/date.html#2627> [ thread ] <https://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/2014-October/thread.html#2627> [ subject ] <https://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/2014-October/subject.html#2627> [ author ] <https://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/2014-October/author.html#2627> Search archives:
Hi Elisabeth,

As someone else pointed out, your 50 Hz is almost certainly from the mains power.
That is almost surely the source of the 150 Hz also.
Noise from this source have the properties that (1) the frequency is very stable and (2) the amplitude is almost always also very stable.
Because of these properties, this type of noise it typically best removed by measuring its amplitude and phase over a fairly long period, say a second or more, and then subtracting it off. This approach is typically very precise at remove the line noise while leaving any 50 and 150 Hz activity which is not constant in the signal.
One way it can be done is by (1) performing a Fourier transform, (2) attenuating the coefficients of the two frequencies, and (3) reconstructing the modified signal with an inverse Fourier transform.
This is likely a better approach than convolution with a notch filter since it explicitly uses the "constant amplitude" property of this noise.
If the tools are readily available in mne-python, it might be worthwhile to try before chasing the low frequency noise you mentioned.

One other thing to consider is whether it is actually necessary to remove the noise at all.
If the method you plan to use to explore the gamma band activity has high spectral resolution, the line noise may just show up as sharp peaks which you can ignore.
On the other hand, if your method has low spectral resolution, it definitely is worthwhile and likely it will make sense to use some high resolution spectral method to assess whether the spectrum is adequately smooth across the two line noise peaks.

Finally it might be worthwhile to check a few data samples from other runs to see if line noise is consistently showing up on those same channels. If so, it's likely that the noise pickup is due to loss of proper "balance" by the amplifiers or to degradation in the connections which run to those amplifiers.

Regards,

Don

Hi David,

Did you happen to record a powerline signal with a separate electrode?

In that case you can very cleanly regress the powerline noise out of the other electrodes in the time domain without it affecting the signal in any other way. That'd be better then applying filters or attenuating fourier coefficients.

Best,

Kris

My question is as follows: 1)is there a good reason not to try this approach

The reason for not to try this approach is that what your are
proposing is equivalent to applying a brick wall filter. This will
cause a lot of ringing.

See this link for more details:

Alejandro

HI Alejandro,

Thank you for responding, and please forgive my signal processing ignorance in my following reply.

I read the comment below realize that this would be true for zeroing out this frequency but could I not replace the existing 60HZ coefficient with lets say the average power values of the59hz and 61Hz and reconstitute the wave without a heaving ringing?

Also say the data is decomposed using 1Hz frequency bins , but in the end I will only need to conduct time-frequncy analysis and 2Hz resolution, can i not spectral decompose the data at 1Hz and reconstitute it just using a 2Hz bin resolution?

thanks david
David I. Leitman PhD

Visiting Scientist,
PSYR2 - Psychiatric disorders: from Resistance to Response
Centre de Recherche en Neurosciences de Lyon (CRNL) INSERM-CNRS

E. david.leitman at ext.inserm.fr
Web. davidileitman.com

Hi Kris, I do not think so but I will check. I fear however, that this noise may becoming from the Elekta HPI coils :slight_smile:

David I. Leitman PhD

Visiting Scientist,
PSYR2 - Psychiatric disorders: from Resistance to Response
Centre de Recherche en Neurosciences de Lyon (CRNL) INSERM-CNRS

E. david.leitman at ext.inserm.fr
Web. davidileitman.com

I read the comment below realize that this would be true for zeroing out
this frequency but could I not replace the existing 60HZ coefficient with
lets say the average power values of the59hz and 61Hz and reconstitute the
wave without a heaving ringing?

Any nonzero coeficient at the 60Hz will translate in a 60Hz component
in the time domain. So I thing that will not work.

Also say the data is decomposed using 1Hz frequency bins , but in the end I
will only need to conduct time-frequncy analysis and 2Hz resolution, can i
not spectral decompose the data at 1Hz and reconstitute it just using a 2Hz
bin resolution?

I don't quite understand what you're saying. But I don't think that
changing the frequency resolution will help you to reduce the 60Hz
component.

However, I think you may get less distortion if you try with a smaller
order filter. You can control that with the `filter_length` parameter.
You can also try to see what happens with `method='spectrum_fit'` .

Alejandro