Skip to content

Commit

Permalink
Update mne.pick_channels() to mne.pick() (#154)
Browse files Browse the repository at this point in the history
* Updated MNE pick function

Updated mne.pick_channels() to mne.pick()

* Fix

* Fix

* Update staging.py

Fixed ```ordered=True``` issue with mne.pick()
  • Loading branch information
sjg2203 committed Jan 17, 2024
1 parent 6b37c63 commit ae9ccc7
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ If you have sleep EEG data in standard formats (e.g. EDF or BrainVision), you ca
# Apply a bandpass filter from 0.1 to 40 Hz
raw.filter(0.1, 40)
# Select a subset of EEG channels
raw.pick_channels(['C4-A1', 'C3-A2'])
raw.pick(['C4-A1', 'C3-A2'])
How do I get started with YASA?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ If you have polysomnography data in European Data Format (.edf), you can use the
# Apply a bandpass filter from 0.1 to 40 Hz
raw.filter(0.1, 40)
# Select a subset of EEG channels
raw.pick_channels(['C4-A1', 'C3-A2'])
raw.pick(['C4-A1', 'C3-A2'])
.. ----------------------------- VISUALIZE -----------------------------
.. raw:: html
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ If you have sleep EEG data in standard formats (e.g. EDF or BrainVision), you ca
# Apply a bandpass filter from 0.1 to 40 Hz
raw.filter(0.1, 40)
# Select a subset of EEG channels
raw.pick_channels(['C4-A1', 'C3-A2'])
raw.pick(['C4-A1', 'C3-A2'])
**********

Expand Down
2 changes: 1 addition & 1 deletion notebooks/08_bandpower.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1881,7 +1881,7 @@
],
"source": [
"# Single channel bandpower\n",
"yasa.bandpower(raw.copy().pick_channels(['F3']), hypno=hypno_up, include=(2, 3), bandpass=True)"
"yasa.bandpower(raw.copy().pick(['F3']), hypno=hypno_up, include=(2, 3), bandpass=True)"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/16_EEG-HRV_coupling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"# Use MNE to load the EDF file\n",
"raw = mne.io.read_raw_edf(path_edf, preload=True, verbose=False)\n",
"# Keep only one EEG channel (C4-A1) and one ECG\n",
"raw.pick_channels(['C4-A1', 'EKG-R-EKG-L'], ordered=True)\n",
"raw.pick(['C4-A1', 'EKG-R-EKG-L'], ordered=True)\n",
"raw"
]
},
Expand Down
2 changes: 1 addition & 1 deletion yasa/staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def __init__(self, raw, eeg_name, *, eog_name=None, emg_name=None, metadata=None
ch_names = ch_names[keep_chan].tolist()
ch_types = ch_types[keep_chan].tolist()
# Keep only selected channels (creating a copy of Raw)
raw_pick = raw.copy().pick_channels(ch_names, ordered=True)
raw_pick = raw.copy().pick(ch_names)

# Downsample if sf != 100
assert sf > 80, "Sampling frequency must be at least 80 Hz."
Expand Down
2 changes: 1 addition & 1 deletion yasa/tests/test_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# MNE Raw
data_mne = mne.io.read_raw_fif("notebooks/sub-02_mne_raw.fif", preload=True, verbose=0)
data_mne.pick_types(eeg=True)
data_mne_single = data_mne.copy().pick_channels(["F3"])
data_mne_single = data_mne.copy().pick(["F3"])
hypno_mne = np.loadtxt("notebooks/sub-02_hypno_30s.txt", dtype=str)
hypno_mne = hypno_str_to_int(hypno_mne)
hypno_mne = hypno_upsample_to_data(hypno=hypno_mne, sf_hypno=(1 / 30), data=data_mne)
Expand Down
2 changes: 1 addition & 1 deletion yasa/tests/test_others.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# Using MNE
data_mne = mne.io.read_raw_fif("notebooks/sub-02_mne_raw.fif", preload=True, verbose=0)
data_mne.pick_types(eeg=True)
data_mne_single = data_mne.copy().pick_channels(["F3"])
data_mne_single = data_mne.copy().pick(["F3"])
hypno_mne = np.loadtxt("notebooks/sub-02_hypno_30s.txt", dtype=str)
hypno_mne = hypno_str_to_int(hypno_mne)
hypno_mne = hypno_upsample_to_data(hypno=hypno_mne, sf_hypno=(1 / 30), data=data_mne)
Expand Down

0 comments on commit ae9ccc7

Please sign in to comment.