[Mne_analysis] Inputting bad channels through raw.plot() while applying a CAR reference.

Dan McCloy dan at mccloy.info
Fri Dec 18 11:37:32 EST 2020
Search archives:

        External Email - Use Caution        

Hi Mathieu,
I cannot replicate the problem. Using the current master version, when I do the following:

import os
import mne
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample',
'sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file)
raw.pick_types(meg=False, eeg=True).crop(tmax=60.)
raw.set_eeg_reference(projection=True)
fig = raw.plot()

and then mark some channels as bad, I can see the good EEG channels changing slightly. It may be easier to see if you increase the scaling py pressing `+` a few times, and/or if you reduce the number of channels shown in the plot by pressing `page down` several times.

Can you confirm that this works for you too? If so, then probably there is something about your specific code that is making it hard to see the changes (probably the scaling?).
-- dan
Daniel McCloy
https://secure-web.cisco.com/1Ds7h567AtHkt6nADy1PlK7X5m2SZjLn5DYOG4oIDx5MT12XLw5NEKoBtEXeOr_Q1VaY3W-utEEkKvwHF4LMbw6MzFMg1s63zzhJXMSUpTwsRG1LuzjGYy8UWobUM2WoVQEX_YDT0JoBD3F7DqALRqVXw6iRbbBYsDFtlH_cXKlbV6mF0a546On3_KPQgKup53uHk19Ak389xIxSHtm5UaEnWdt4THEXg-6c_Xx0vK51AoneeDgqFsLJDQaoAj6EsKYlLyOHyc7Fp2zvoIm-LWQ/https%3A%2F%2Fdan.mccloy.info
Research Scientist
Institute for Learning and Brain Sciences
University of Washington

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday, December 16, 2020 2:48 AM, Scheltienne Mathieu <mathieu.scheltienne at epfl.ch> wrote:

> External Email - Use Caution
>
> Hi Eric,
>
> Thank you for the reply.
>
> I do not apply the projectors to the data, the code is:
>
> # Load
>
> raw = mne.io.read_raw_fif(fname, preload=True)
>
> raw.set_channel_types(mapping={'ECG':'ecg', 'EOG':'eog'})
>
> raw.set_montage('standard_1020')
>
> raw.info['bads'] = list()
>
> # Conversion
>
> raw.apply_function(conversion_uVolt2Volt, picks=['ecg', 'eog', 'eeg'], dtype=None,
>
> n_jobs=1, channel_wise=True, verbose=None)
>
> raw.apply_function(brainvisionMarkersCh2StimCh, picks=['stim'], dtype=None,
>
> n_jobs=1, channel_wise=True, verbose=None)
>
> # Car and filters
>
> raw.set_eeg_reference(ref_channels='average', ch_type='eeg', projection=True)
>
> mne.io.Raw.filter(raw, l_freq=1., h_freq=100., picks=['ecg', 'eog', 'eeg'], method='iir',
>
> iir_params=dict(order=4, ftype='butter', output='sos'))
>
> raw.notch_filter(np.arange(50, 151, 50), picks=['ecg', 'eog'], filter_length='auto', phase='zero')
>
> # Plot
>
> raw.plot(scalings=dict(eeg=20e-6, eog=4e-2, ecg=5e-2, stim=2))
>
> In the plot interface, the CAR projector is selected in the bottom right projector panel.
>
> When in the plot I click on a channel to mark it as bad (changing its color to light grey), the others do not change at all, thus I don’t think the projector is updated on my setup.
>
> Best,
>
> Mathieu
>
> From: <mne_analysis-bounces at nmr.mgh.harvard.edu> on behalf of Eric Larson <larson.eric.d at gmail.com>
> Reply to: Discussion and support forum for the users of MNE Software <Mne_analysis at nmr.mgh.harvard.edu>
> Date: Tuesday, 15 December 2020 at 18:59
> To: Discussion and support forum for the users of MNE Software <Mne_analysis at nmr.mgh.harvard.edu>
> Subject: Re: [Mne_analysis] Inputting bad channels through raw.plot() while applying a CAR reference. {Disarmed}
>
> External Email - Use Caution
>
>> When applying a CAR (as a projector), MNE removes the already set [MailScanner has detected a possible fraud attempt from "secure-web.cisco.com" claiming to be raw.info](http://secure-web.cisco.com/1Z5R3lf4_Yhc3f-8tcRLDANtB_KwN4pLGbSuFpRLxU1AF4atIofcrktKaEDvZRxIf17jXo8CjVhq_M1Ag-hLXAPQorOED0O3y6sqtUKhUSxYmno8YfvJn7WWLUF_vNNv78K9vXpLNzY0EmEYTYJzvl1qljUaKQ6JzVdZATHuiVjdXfh0iLr52ifZm_FwLBPTfnU6e9v86Fe90V-JNAOCf0epQZs3lRAmJyVKKdy9LZAp21URuxEa7X2mWki9UY6nfH1En5Q7Gi1J9yUn8SrfXLg/http%3A%2F%2Fraw.info)[‘bads’] from the average. However, when adding or removing bad channels through the plot interface, I guess the CAR projector is not updated.
>
> As long as you don't `raw.apply_proj()`, then in `raw.plot` or `mne browse_raw` the CAR projector should be updated. If it's not, there is a bug -- feel free to open one on GitHub.
>
> Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20201218/bea51a5f/attachment.html 


More information about the Mne_analysis mailing list