Sinusoid wave removal

Hi,

I’ve been trying to remove the 50Hz (and harmonics) artefacts on my RAW fif files. It doesn’t appear to be doing anything. The peaks in the power spectrum remain exactly the same.

Would it be a file format issue? I saw that there had been a problem with the band pass filtering with fif data.

Thanks,

Will

Hi Will,

We’ve been investigating this briefly, and we had the feeling that the sinusoid removal algorithm was not performing well for recordings processed with Neuromag MaxShield/sss.
Those tools look like they smooth the spectrum of the recordings, causing the sinusoid identification to fail (it’s really designed to capture pure frequencies). If we compared with unfiltered CTF or EEG data, the peaks we see at 50Hz or 60Hz are much better defined.
Can you try to run this sinusoid removal process on unprocessed noise recordings?
Please let us know how this goes.

Francois

Hi Francois,

I tried both on the raw data and after applying the mxfilter SSS correction. It looks about the same to me. In fact, the peaks in the power spectrum look purer after the SSS correction than before.

Cheers,

Hi Will,

I tried on some FIF files and it worked well: the reading-processing-writing operations work well for recordings in FIF format. Two possibilities:

  1. you did not select the correction options in the process: make sure that the “sensor types” option is either “MEG”, “MEG GRAD”, “MEG MAG” or “EEG” (or a combination of those modalities, separated with comas).
  2. the quality of the recordings does not match what is needed by this picky algorithm. In this case you can just run a less refined filter from the Neuromag software (they should offer notch filters, right?)

Francois

Also Will:

Can you please post a screenshot of the power spectrum of your data?

thanks!

Hi

Actually Neuromag doesn’t even have a notch, just a lpf.
Otherwise i can do this through dataHandler, i just liked the graphic interface for a student who’s not keen on command lines.

I’ve attached a screenshot of the bandpass filtered data, and bandpass+sin removal. And a zoom in to the 150hz peak. You’ll see it’s very clear.

Thx

I could reproduce it on my side, the sinusoid removal is not working well on some Neuromag recordings, I don’t know why.
I’m adding this on my to-do list, but I will not work on this anytime soon.
I’m sorry I don’t have any other easy solution to give you right now.
Hopefully you can remove those artifacts with the dataHandler.
Good luck
Francois

My initial observations of the graphs are that (1) each power harmonic is about a 10 dB sinusoid relative to the immediate background, but that the sinusoidal peaks are still 20-30 dB less than the strong frequencies below 40 Hz, and (2) I can’t tell how many seconds of data are being processed at once.

I need to review our internal code, but my in the case of (1) we may be insensitive to relatively small sinusoids: Try high pass filtering the data first, to emphasize the power harmonics, then see if the same removal routine now removes the power harmonics. But this also begs the question, why are you concerned about these small power harmonics when the primary activity of interest in these graphs appears below 40 Hz? If you’re truly interested in the higher frequencies, then high-passing should help. If it’s the lower frequencies, then a simple low-pass filter knocks out the harmonics.

In the case of (2), if you put in too many seconds, then the frequency drift of the power line distorts the power waveform from a true sinusoidal model. We’re trying to cleanly remove a sinusoid, not notch the frequency band, which causes too much distortion. Try processing shorter segments and test by octaves: 2 seconds, 4, 8, 16, 32 seconds, to see if the problem correlates with the time length.

For those interested, you can monitor power line drift world wide in real time at http://powerit.utk.edu/worldmap/, and in the US at http://fnetpublic.utk.edu/gradientmap.html. It’s interesting to see that the mains frequency can drift +/- 0.02 Hz in a relatively short time. Thus you can’t put too many seconds at a time into a strict sinusoidal removal algorithm.

Let me know what you find out about your data.

Thanks John,

The data is filtered between 1 and 300Hz. In terms of high pass filtering I don’t dare go much higher as we want to look at alpha waves amongst other things.

However, I have been processing the whole trace at once (about 100s), i’ll try breaking it up in a bins of a few seconds and tell you how it works.

Thanks

Updated links: http://fnetpublic.utk.edu/frequencymap.html, https://powerit.utk.edu/worldmap/ at
http://fnetpublic.utk.edu/