You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG- can no longer compute projs from CTF data #5124
PR #5083 added an assert to make sure that ref channels are retained when picking data channels. this had the side effect of breaking EOG and ECG proj computations.
File "", line 2, in compute_proj_eog
File "/mnt/isilon/meg_lab/bloyl/Programs/mne-python-devel/mne/utils.py", line 729, in verbose
return function(*args, **kwargs)
File "/mnt/isilon/meg_lab/bloyl/Programs/mne-python-devel/mne/preprocessing/ssp.py", line 406, in compute_proj_eog
iir_params=iir_params, return_drop_log=return_drop_log)
File "", line 2, in _compute_exg_proj
File "/mnt/isilon/meg_lab/bloyl/Programs/mne-python-devel/mne/utils.py", line 729, in verbose
return function(*args, **kwargs)
File "/mnt/isilon/meg_lab/bloyl/Programs/mne-python-devel/mne/preprocessing/ssp.py", line 202, in _compute_exg_proj
evoked = epochs.average()
File "/mnt/isilon/meg_lab/bloyl/Programs/mne-python-devel/mne/epochs.py", line 824, in average
return self._compute_mean_or_stderr(picks, 'ave')
File "/mnt/isilon/meg_lab/bloyl/Programs/mne-python-devel/mne/epochs.py", line 893, in _compute_mean_or_stderr
kind, self._name)
File "/mnt/isilon/meg_lab/bloyl/Programs/mne-python-devel/mne/epochs.py", line 923, in _evoked_from_epoch_data
evoked.pick_channels(ch_names)
File "/mnt/isilon/meg_lab/bloyl/Programs/mne-python-devel/mne/channels/channels.py", line 716, in pick_channels
pick_channels(self.info['ch_names'], ch_names))
File "/mnt/isilon/meg_lab/bloyl/Programs/mne-python-devel/mne/channels/channels.py", line 815, in _pick_drop_channels
assert len(comp_picks) == len(comp_names)
AssertionError
Can you see if the function can be modified to use this? In particular doing Epochs(... picks) might not be the way to go, but rather create the object, then use the private drop function with check_comps=False to do the picking.
There is a third option (that I hinted at), don't do picking with the Epochs constructor at all but immediately afterward with a call to the private epochs._pick_drop_channels(picks). This should effectively work out to be a worse version of your (1) if _compute_proj is smart enough to leave the reference channels out during its computation. If it isn't, though (if it includes the ref MEG sensors), then my proposal might be easiest, or we can make the _compute_proj smarter (up to you).
In general we should not do special cases for CTF data, it will lead to breakages if comps is ever used by another system (future compat) or for another purpose (e.g., I have thought about how you could store any arbitrary linear spatial transform in there).
Activity
larsoner commentedon Apr 11, 2018
You can pass
check_comps=Falseto the private_pick_drop_channels:https://github.com/mne-tools/mne-python/blob/master/mne/channels/channels.py#L796
Can you see if the function can be modified to use this? In particular doing
Epochs(... picks)might not be the way to go, but rather create the object, then use the private drop function withcheck_comps=Falseto do the picking.bloyl commentedon Apr 11, 2018
I see two options:
Since
_compute_projcurrently rejects theref_megchannels at computation time:https://github.com/mne-tools/mne-python/blob/master/mne/proj.py#L72-L76
we could keep the ref_meg channels in the epochs object and just let
_compute_projtake care of removing them?In
_compute_exg_projwe could test if the supplied raw is an instance of RawCTF and only keep the ref channels for those instances.larsoner commentedon Apr 11, 2018
There is a third option (that I hinted at), don't do picking with the
Epochsconstructor at all but immediately afterward with a call to the privateepochs._pick_drop_channels(picks). This should effectively work out to be a worse version of your (1) if_compute_projis smart enough to leave the reference channels out during its computation. If it isn't, though (if it includes the ref MEG sensors), then my proposal might be easiest, or we can make the_compute_projsmarter (up to you).In general we should not do special cases for CTF data, it will lead to breakages if
compsis ever used by another system (future compat) or for another purpose (e.g., I have thought about how you could store any arbitrary linear spatial transform in there).