# Unexpected behaviour Raw.pick

**URL:** <https://mne.discourse.group/t/unexpected-behaviour-raw-pick/8132>\
**Category:** Support & Discussions\
**Created:** [January 12, 2024, 9:53am UTC](https://mne.discourse.group/t/unexpected-behaviour-raw-pick/8132 "2024-01-12T09:53:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivopascal](https://avatars.discourse-cdn.com/v4/letter/i/278dde/32.png) [@ivopascal](https://mne.discourse.group/u/ivopascal)\
**Post date:** [January 12, 2024, 9:53am UTC](https://mne.discourse.group/t/unexpected-behaviour-raw-pick/8132/1 "2024-01-12T09:53:33Z")

</div>

I found 2 strange behaviours surrounding Raw and Pick.

The first is that Raw.plot() does not support a picks argument, even though both Epochs.plot() and Evoked.plot() do support it. This is not really a problem, but it makes using MNE a little bit harder than it needs to be.

The second is that Raw.pick() returns the modified instance with the picked channels (as according to documentation), but also modifies the original.

- MNE version: 1.6.0
- operating system: macOS 14

```python
from mne.channels import make_standard_montage
from mne.datasets import eegbci
from mne.io import concatenate_raws, read_raw_edf

subject = 1
runs = [6, 10, 14] 

# Fetch some arbitrary EEG data
raw_fnames = eegbci.load_data(subject, runs)
raw = concatenate_raws([read_raw_edf(f, preload=True) for f in raw_fnames])
eegbci.standardize(raw) # set channel names
raw.set_montage(montage)

print(raw.ch_names) # Raw will have 64 channels
picked_channels = raw.pick(["C3", "C4"]) # picked_channels has 2 channels
print(picked_channels.ch_names)
print(raw.ch_names) # But now raw also only has C3 and C4

```

This is not clear in the documentation, and can cause bugs. It’s probably better if the original is not modified. If the goal is in-place operations, I think it’d be clearer to not return the modified instance.

Is there a reason they work like this? If not, I’d be happy to fix these things and write a PR.

---

<div class="post-metadata">

**Author:** ![cbrnr](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/cbrnr/32/1409_2.png) [@cbrnr](https://mne.discourse.group/u/cbrnr)\
**Post date:** [January 12, 2024, 9:56am UTC](https://mne.discourse.group/t/unexpected-behaviour-raw-pick/8132/2 "2024-01-12T09:56:48Z")

</div>

MNE always modifies objects in place, and for convenience it also returns the modified object so that you can use it in a pipeline: [Design philosophy — MNE 1.6.1 documentation](https://mne.tools/stable/documentation/design_philosophy.html#in-place-operation)

---

<div class="post-metadata">

**Author:** ![ivopascal](https://avatars.discourse-cdn.com/v4/letter/i/278dde/32.png) [@ivopascal](https://mne.discourse.group/u/ivopascal)\
**Post date:** [January 12, 2024, 10:14am UTC](https://mne.discourse.group/t/unexpected-behaviour-raw-pick/8132/3 "2024-01-12T10:14:51Z")

</div>

I’m not a fan of returning as convenience, but we can agree to disagree.

How about the other behaviour that `Raw.plot()` doesn’t support a `picks` argument, even though Evoked and Epochs do?

[https://mne.tools/stable/generated/mne.io.Raw.html#mne.io.Raw.plot](https://mne.tools/stable/generated/mne.io.Raw.html#mne.io.Raw.plot)

[https://mne.tools/stable/generated/mne.Epochs.html#mne.Epochs.plot](https://mne.tools/stable/generated/mne.Epochs.html#mne.Epochs.plot)

[https://mne.tools/stable/generated/mne.Evoked.html#mne.Evoked.plot](https://mne.tools/stable/generated/mne.Evoked.html#mne.Evoked.plot)

I think adding a picks= argument to Raw.plot might help with the mostly-unified API goal ([Design philosophy — MNE 1.6.1 documentation](https://mne.tools/stable/documentation/design_philosophy.html#mostly-unified-api)).

---

<div class="post-metadata">

**Author:** ![cbrnr](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/cbrnr/32/1409_2.png) [@cbrnr](https://mne.discourse.group/u/cbrnr)\
**Post date:** [January 12, 2024, 10:43am UTC](https://mne.discourse.group/t/unexpected-behaviour-raw-pick/8132/4 "2024-01-12T10:43:20Z")

</div>

> [@ivopascal](#):
>
> I’m not a fan of returning as convenience, but we can agree to disagree.

This was not meant as an argument, but simply to point out how it is implemented.

> [@ivopascal](#):
>
> How about the other behaviour that `Raw.plot()` doesn’t support a `picks` argument, even though Evoked and Epochs do?

Yes, sure, please open an issue in our repo.

---

<div class="post-metadata">

**Author:** ![huji-hcnl](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/huji-hcnl/32/4163_2.png) [@huji-hcnl](https://mne.discourse.group/u/huji-hcnl)\
**Post date:** [March 2, 2025, 10:44am UTC](https://mne.discourse.group/t/unexpected-behaviour-raw-pick/8132/5 "2025-03-02T10:44:14Z")

</div>

This is unexpected, mostly because many other methods in the `Raw` documentation explicitly mention being performed in-place, whereas the `pick` method doesn’t.  
How would one “pick” a subset of their `raw` object without overwriting the original object?

---

<div class="post-metadata">

**Author:** ![cbrnr](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/cbrnr/32/1409_2.png) [@cbrnr](https://mne.discourse.group/u/cbrnr)\
**Post date:** [March 2, 2025, 2:14pm UTC](https://mne.discourse.group/t/unexpected-behaviour-raw-pick/8132/6 "2025-03-02T14:14:08Z")

</div>

`Raw.pick()` does work in-place. If this is not the case, please file a bug report. If you’re asking how would you pick a subset of channels without modifying the original object, you would use `Raw.copy().pick()`.

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [March 2, 2025, 8:46pm UTC](https://mne.discourse.group/t/unexpected-behaviour-raw-pick/8132/7 "2025-03-02T20:46:33Z")

</div>


