not understanding use of pick_types

External Email - Use Caution

Hi all,
I'm reading in some already created epoch objects for some further
processing. If I try pick_types(meg=True), it works. If I want to create
separate epoch objects for mag and grad channels, I get errors. Trying
pick_types(meg='grad') or pick_types(meg='mag'). Weirdly, I get a
different error if I"m trying 'mag' or 'grad'. Next step would be to use
get_data() on epochs to work with the different data types.

Using an older version of mne at the moment:
In [94]: mne.__version__
Out[94]: '0.15.2'

See below for lines and errors. Thanks for any help!
Megan

These two lines work fine
    epochs = mne.read_epochs(fname_epochs, proj=True, preload=True)
    epochs = epochs.pick_types(meg=True)
However, if I try:
    mag_epochs = epochs.pick_types(meg='mag')

External Email - Use Caution

hi Megan

your version of MNE python is too old to pick with a string.

you need to update or use the old documentation:

https://mne.tools/0.15/index.html

we are now at version 0.19.1

Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20191030/88b63dbb/attachment.html

External Email - Use Caution

Thank you for your help!
Megan
MEG Technician
The Mind Research Network
1101 Yale Blvd. NE
Albuquerque, New Mexico 87106

External Email - Use Caution

Hello again,
I'm having trouble trying to update my version of mne.
I'm following instructions from
https://mne.tools/stable/install/mne_python.html and I'm trying to use a
new anaconda environment so I don't disturb other users who have working
scripts with older versions. I didn't get an error with the curl command,
but when I try
conda env create --name mne19 --file environment.yml
I get
Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata ...........
Solving package specifications: .
glib-2.63.1-h5 100%

###########################################################################################|

Time: 0:00:00 7.00 MB/s
pillow-6.2.1-p 100%

###########################################################################################|

Time: 0:00:00 6.81 MB/s
jupyter_core-4 100%

###########################################################################################|

Time: 0:00:00 9.71 MB/s
nbconvert-5.6. 100%

###########################################################################################|

Time: 0:00:00 9.09 MB/s
ERROR: Invalid requirement: 'dipy --only-binary dipy'

CondaValueError: pip returned an error.

I know you don't support anaconda, but any insights you could give to this
error would be helpful! Or another way to just update the mne install and
not the whole anaconda one.

Thanks,
Megan

MEG Technician
The Mind Research Network
1101 Yale Blvd. NE
Albuquerque, New Mexico 87106

External Email - Use Caution

I don't know why --only-binary is failing there, but something you could
try to get going quickly is to clone one of the existing conda
environments, activate the cloned environment, and then do `pip install
--upgrade mne` in the new cloned env.
-- dan

Daniel McCloy
http://dan.mccloy.info/
Research Scientist
Institute for Learning and Brain Sciences
University of Washington

External Email - Use Caution

Thanks, Dan! That worked and will keep me moving!
Megan
MEG Technician
The Mind Research Network
1101 Yale Blvd. NE
Albuquerque, New Mexico 87106

External Email - Use Caution

Hi all,
Now I'm using mne version 0.19, but I'm still getting pick errors using
.pick_types(meg='mag') and (meg='grad').
See below for commands and errors. Any help would be appreciated!
Thanks,
Megan

In [26]: mne.__version__
Out[26]: '0.19.1'

In [27]: mag_epochs = epochs.pick_types(meg='mag')
    ...:

External Email - Use Caution

could you show us how you created the `epochs` variable, and anything you
did to it before this failing line? I'm not sure, but it looks like maybe
you've got an earlier step in which you needed to include an
`epochs.copy()` before doing a pick... many (all?) of the picking methods
operate in-place, so if you do first do something like
epochs.pick_types(meg=False, eeg=True) then subsequent calls to
epochs.pick_types(meg='mag') will fail because after the EEG picking,
`epochs` now only contains EEG channels.

External Email - Use Caution

Hi Dan,
I was just coming around to that conclusion, too.

I read the epochs from a pre-existing file, first.
Then I've been using a .pick_types(meg=True) to get just the meg channels,
then the two subsequent pick_types(meg='mag') and pick_types(meg='grad')
were failing.

However, if I use the read epochs function and follow it immediately by the
pick_types(meg='mag') it seems to work. Then I can do the read epochs
function again and follow that by the pick_types(meg='grad') it works.
However something about the sequence of my commands seems to be altering
the epochs object so it doesn't have all the channels which is causing the
later pick_types functions to fail.

Could you give me a quick example of how to use the epochs.copy() line to
make this work for me?

Thanks!
Megan
MEG Technician
The Mind Research Network
1101 Yale Blvd. NE
Albuquerque, New Mexico 87106

External Email - Use Caution

Hi again,
Never mind! I see how to use the epochs.copy() and it works!
Thanks very much for your help!

Megan
MEG Technician
The Mind Research Network
1101 Yale Blvd. NE
Albuquerque, New Mexico 87106