remove coil artifacts

  • MNE version: 1.3.0_0
  • operating system: windows 10

Hi all!
I’m performing tsss on a raw data.
when visualizing the data, I get pretty serious coils’ signal contamination (im using all coil frequecies < 100 Hz). is there a function to remove the coils’ contamination?
I didn’t find this option, but im sure there is such an option.
Thanks!


import os
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
import mne
from mne.preprocessing import find_bad_channels_maxwell


data_recording = <<path.fif>>
raw = mne.io.read_raw_fif(data_recording, verbose=False)

chpi_freqs, ch_idx, chpi_codes = mne.chpi.get_chpi_info(info=raw.info)
print(f'cHPI coil frequencies extracted from raw: {chpi_freqs} Hz')

chpi_amplitudes = mne.chpi.compute_chpi_amplitudes(raw)
chpi_locs = mne.chpi.compute_chpi_locs(raw.info, chpi_amplitudes)
head_posi = mne.chpi.compute_head_pos(raw.info, chpi_locs, verbose=True)

fine_cal_file = <<path.dat>>
crosstalk_file = <<path.fif>>


raw.info['bads'] = []
raw_check = raw.copy()
auto_noisy_chs, auto_flat_chs, auto_scores = find_bad_channels_maxwell(
    raw_check, cross_talk=crosstalk_file, calibration=fine_cal_file,
    return_scores=True, verbose=True,head_pos=head_posi)
print(auto_noisy_chs)  # we should find them!
print(auto_flat_chs)  # none for this dataset

bads = raw.info['bads'] + auto_noisy_chs + auto_flat_chs
raw.info['bads'] = bads

raw_tsss = mne.preprocessing.maxwell_filter(
    raw, cross_talk=crosstalk_file, calibration=fine_cal_file,verbose=True,head_pos=head_posi)

raw.save('temp_raw.fif')

Hello,

I think you should look at this tutorial.
For cHPI: mne.chpi.filter_chpi — MNE 1.4.0.dev107+ga458622f4 documentation
For full maxwell filter: mne.preprocessing.maxwell_filter — MNE 1.4.0.dev107+ga458622f4 documentation

Mathieu