Neuronal-Oscillations / FLUX

The FLUX pipeline for analysis of MEG data using MNE Python
https://neuosc.com/flux/
BSD 3-Clause "New" or "Revised" License
48 stars 33 forks source link

Bad Channel Detection in CTF MEG Data Analysis #43

Closed colehank closed 2 months ago

colehank commented 1 year ago

Dear FLUX,

I am currently working on analyzing my CTF MEG dataset and have encountered a challenge regarding bad channel detection. Specifically, I have noticed that when using Max Filter for analysis. However, it appears that my CTF data does not include the necessary “cross_talk file” and “calibration_file.” I would greatly appreciate any guidance or advice on how to address this issue and successfully perform bad channel detection and Max Filter(SSS) with my CTF MEG data. The code snippet I’m using is as follows:

auto_noisy_chs, auto_flat_chs, auto_scores = mne.preprocessing.find_bad_channels_maxwell(
    data1_check, 
    cross_talk=crosstalk_file, 
    calibration=calibration_file,
    return_scores=True, 
    verbose=True)
Best regards,

Cole

HaiyanKong commented 1 year ago

Hi Cole,

I am also working on analyzing CTF MEG data recently. Maybe I can try to answer your questions.

Max Filter (SSS) for noise reduction is compatible with MEGIN MEG data. CTF MEG data employs a third-order gradient compensation algorithm, which relies on a reference array of gradiometers and magnetometers for noise reduction. And this had also been added in #21

This function 'apply_gradient_compensation' in MNE-Python can apply CTF gradient compensation, here is the link https://mne.tools/stable/generated/mne.io.Raw.html#mne.io.Raw.apply_gradient_compensation. Moreover, some CTF system itself inherently can perform third-order gradient compensation during data collection. Therefore, you can try to seek the assistance from a data collection engineer or a data collection experimenter for optimizing this process.

In terms of detecting bad and flat channels, I found it is ok to use the function 'mne.preprocessing.find_bad_channels_maxwell', here's an example of its usage, just set the parameters “cross_talk” and “calibration” as ‘None’:

auto_noisy_chs, auto_flat_chs, auto_scores = mne.preprocessing.find_bad_channels_maxwell(
    raw=raw_data_check, 
    return_scores=True, 
    origin=(0,0,0.04),
    cross_talk=None, 
    calibration=None,
    verbose=True)

Haiyan Kong

colehank commented 2 months ago

My goodness, I just saw this. I also figured out how to apply Maxwell to CTF data in a similar way to yours. Thank you very much, and wish you all the best!