Tutorial 10: Power spectrum and frequency filters

Authors: Francois Tadel, Elizabeth Bock, John C Mosher, Richard Leahy, Sylvain Baillet

We are now going to process our continuous recordings to remove the main sources of noise. Typically, we can expect contaminations coming from the environment (power lines, stimulation equipment, building vibrations) and from the subject (movements, blinks, heartbeats, breathing, teeth clenching, muscle tension, metal in the mouth or the body). In this tutorial, we will focus first on the noise patterns that occur continuously, at specific frequencies.

We can correct for these artifacts using frequency filters. Usually we prefer to run these notch and band-pass filters before any other type of correction, on the continuous files. They can be applied to the recordings without much supervision, but they may create important artifacts at the beginning and the end of the signals. Processing the entire continuous recordings at once instead of the imported epochs avoids adding these edge effects to all the trials.

Evaluation of the noise level

Before running any type of cleaning procedure on MEG/EEG recordings, we always recommend to start with a quick evaluation of the noise level. An easy way to do this is to estimate the power spectrum of all the signals over the entire recordings.

Interpretation of the PSD

File: AEF#01

File: AEF#02

File: Noise recordings

X Log-scale

Elekta-Neuromag and EEG users

The Elekta-Neuromag MEG systems combine different types of sensors with very different amplitude ranges, therefore you would not observe the same types of figures. Same thing for EEG users, this might not look like what you observe on your recordings.

For now, keep on following these tutorials with the example dataset to learn how to use all the Brainstorm basic features. Once you're done, read additional tutorials in the section "Other analysis scenarios" to learn about the specificities related with your own acquisition system.

Notch filter

For illustration purposes, we will now run a frequency filter to remove the 60Hz+harmonics from the continuous files. Notch filters are adapted for removing well identified contaminations from systems oscillating at very stable frequencies.

Band-pass filter

Consider that we want to remove low-frequency noise (<2Hz) from a resting state MEG signal. Also, we are not interested in brain oscillations higher than 80Hz. Consequently, we need a band-pass filter in the range of (2-80Hz).

To filter the data, click on Run > Pre-process > Band-pass filter.

[ATTACH]

In the appeared window, set the lower and upper cutoff frequencies to 2 and 80, respectively.

There are two options in this process. The first one relaxes the stopband attenuation from -60db (default value) to -40db. This results to a lower order filter with a smaller edge effect, faster filtering, but with a lower accuracy.

Another option is filtering method. After building the FIR band-pass filter, we can perfrom filtering in freuqency domain(using FFTs of input signal and filter) or in time domain (by convultion). The first approach is much faster for most cases and filters, while the later might also be more practical for few cases. Anyway, both methods have a same result.

Evaluation of the filter

Some cleaning

To avoid any confusion later, delete the links to the original files:

Advanced

What filters to apply?

The frequency filters you should apply depend on the noise present in your recordings, but also on the type of analysis you are planning to use them for. This sections provides some general recommendations.

High-pass filter (HPF)

Purpose:

Remove the low frequencies from the signals. Typically used for: Removing the arbitrary DC offset and slow drifts of MEG sensors (< 0.2Hz), Removing the artifacts occurring at low frequencies (< 1Hz, e.g. breathing or eye movements). The HPF is implemented as a zero-phase (zero delay) FIR filter and based on Kaiser window design.

Limitations:

Edge effects: these are transient effects that occur at the start and end of each filtered data set because the filtering window will extend into time periods outside those for which you have data. You need long segments of data to run a high-pass filter and should discard the edge effect region at the start and end of your filtered data (we strongly recommend against using a HPF on epoched data). After filtering, the display will indicate the edge effect region.

The edge effect region lasts for a number of samples equal to half of the filter order. If the edge effect affects too much of your data, adjust the filter parameters to reduce filter order (see Advanced section below). BrainStorm will generate a warning if your choice of filter parameters results in an edge effect of two seconds or more.

You should avoid using high-pass filtering with epoched or other short data records. BrainStorm will generate a warning if the combined edge effects at the start and end of your data represents 10 percent or more of the total number of samples.

Be careful with the frequency you choose if you are studying cognitive processes that may include sustained activity in some brain regions (eg. n-back memory task).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Low-pass filter (LPF)

Purpose: Remove the high frequencies from the signals. Typically used for:

Limitations:

Edge effects: these are transient effects that occur at the start and end of each filtered data set because the filtering window will extend into time periods outside those for which you have data. After filtering, the display will indicate the edge effect region.

It is always better to filter continuous (non-epoched data) if available. You need to consider the duration of the edge effects if you are filtering imported trials or averages. If possible, import longer epochs, average them, filter, then remove the beginning and the end of the average to keep only the signals that could be filtered properly.

The edge effect region lasts for a number of samples equal to half of the filter order. If the edge effect affects too much of your data, adjust the filter parameters to reduce filter order (see Advanced section below). BrainStorm will generate a warning if your choice of filter parameters results in an edge effect of one second or more. BrainStorm will also generate a warning if the combined edge effects at the start and end of your data represents 10 percent or more of the total number of samples.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Band-pass filter (BPF)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Notch filter

Purpose: Remove a sinusoidal signal at a specific frequency (power lines noise, head tracking coils).

Alternatives: If the notch filter is not giving satisfying result, you have two other options.

Useful for removing larger segments of the spectrum, in case the power line peaks are spread over numerous frequency bins or for suppressing other types of artifacts.

Run it on the imported epochs rather than on the continuous files.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

When to apply these filters?

Always filter the empty room measurements

In principle, all the filters that are applied to the experimental data also need to be applied, with the same settings, to the noise recordings. In the source estimation process, we will need all the files to have similar levels of noise, especially for the calculation of the noise covariance matrix. This applies in particular when some channels are noisy.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Filters specifications

Notch filter

Band-stop filter

Low Pass, High Pass and Band-pass filter

Method can be one of the followings: {'bst-Hfilter-fft','bst-Hfilter-time'}

Advanced

On the hard drive

The names of the files generated by the process "Power spectrum density" start with the tag timefreq_psd, they share the same structure as all the files that include a frequency dimension.

To explore the contents of a PSD file created in this tutorial, right-click on it and use the popup menus
File > View file contents or File > Export to Matlab.

Structure of the time-frequency files: timefreq_psd_*.mat

Useful functions








Feedback: Comments, bug reports, suggestions, questions
Email address (if you expect an answer):


Tutorials/ArtifactsFilter (last edited 2016-10-03 05:03:04 by ?HosseinShahabi)