Iām trying to perform the most basic .compute_psd(), but I am getting an Assertion error and while checking the source code of the error I still do not understand the comments.
Actually no matter what I am trying to do with my code, there is an issue with NaN or inf values, yet at the first sight my data seems to be correct. I cannot even use any of the preprocessing functions, so a suggestion on what to do with NaN and infs and what may be the source of those would be nice. There is also a warning I am getting while loading the data, so maybe it could be useful:
/usr/local/lib/python3.10/dist-packages/mne/io/egi/egimff.py:771: RuntimeWarning: invalid value encountered in cast
one[eeg_one, disk_use_idx[s_start:s_end]] = block_data[eeg_in]
I am a complete beginner in MNE, so help would be extremely appreciated
import mne
file = "/content/drive/MyDrive/rsch2024.mff"
raw = mne.io.read_raw_egi(file, preload=True)
raw.filter(l_freq=0.5, h_freq=40)
raw.compute_psd()
the AssertionError:
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-7-7ea19dd81779> in <cell line: 6>()
4 raw = mne.io.read_raw(file, preload=True)
5 raw.filter(l_freq=0.5, h_freq=40)
----> 6 raw.compute_psd()
<decorator-gen-317> in compute_psd(self, method, fmin, fmax, tmin, tmax, picks, exclude, proj, remove_dc, reject_by_annotation, n_jobs, verbose, **method_kw)
3 frames
<decorator-gen-267> in psd_array_welch(x, sfreq, fmin, fmax, n_fft, n_overlap, n_per_seg, n_jobs, average, window, remove_dc, output, verbose)
/usr/local/lib/python3.10/dist-packages/mne/time_frequency/psd.py in psd_array_welch(x, sfreq, fmin, fmax, n_fft, n_overlap, n_per_seg, n_jobs, average, window, remove_dc, output, verbose)
231 # NaNs originate from annot, so must match for all channels. Note that we CANNOT
232 # use np.testing.assert_allclose() here; it is strict about shapes/broadcasting
--> 233 assert np.allclose(good_mask, good_mask[[0]], equal_nan=True)
234 t_onsets, t_offsets = _mask_to_onsets_offsets(good_mask[0])
235 x_splits = [x[..., t_ons:t_off] for t_ons, t_off in zip(t_onsets, t_offsets)]
AssertionError: