Noise covariance from epmty room issue

  • MNE version: 1.1.1
  • operating system: Windows 10

Dear all,

I am trying to create LCMV beamformer using the empty room recording to create noise covariance matrix. However, the ranks of noise and data covariance matrices do not coinside.

The empty room file was filtered using Max filtering script from Elekta Neuromag (as for the data covariance), but different channels were marked as bad. After that the empty room recording was resampled and filtered as the file for data covariance.

I get the error only when I use [rank=None] when creating an LCMV filter (see the code snippets below). The script works with [rank=‘info’, reduce_rank=True]. But it is not clear for me from the documentation why.

How exactly [rank=‘info’] affects the data? Is this a feasible approach? Are there other ways to allign the ranks somehow? (I would like to use one empty room recording for all participants).

Best,
Katya

CODE

# create noise covariance matrix from empty room recording
empty_room_file =  mne.io.read_raw_fif('filename.fif', preload=True)
empty_room_file = empty_room_file.resample(200)

empty_room_filt = empty_room_file.copy()\
    .filter(l_freq=.5, h_freq=90)\
    .notch_filter(50) # filter data

noise_cov = mne.compute_raw_covariance(
    empty_room_filt, tmin=0, tmax=None)
# create LCMV filter
filters = mne.beamformer.make_lcmv(info, fwd, data_cov, reg=0.05,
                    noise_cov=noise_cov, pick_ori='max-power',
                    weight_norm='unit-noise-gain', rank=None)

ERROR

ValueError: meg data rank (80) did not match the noise rank (68)

hi

I suggest you have a look at this paper

https://www.sciencedirect.com/science/article/pii/S1053811921010612

basically you must make sure that the same head position is used for
empty room and subject data

it’s complicated code but you can read

https://github.com/mne-tools/mne-bids-pipeline/blob/main/mne_bids_pipeline/steps/preprocessing/_02_maxfilter.py

to see how we do it for the mne bids pipeline

Alex

2 Likes