Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced deprecated pick_types with raw.pick #154

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyprep/find_noisy_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(self, raw, do_detrend=True, random_state=None, matlab_strict=False)

raw.load_data()
self.raw_mne = raw.copy()
self.raw_mne.pick_types(eeg=True)
self.raw_mne.pick(picks="eeg")
self.sample_rate = raw.info["sfreq"]
if do_detrend:
self.raw_mne._data = removeTrend(
Expand Down
2 changes: 1 addition & 1 deletion pyprep/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(
raw.load_data()
self.raw = raw.copy()
self.ch_names = self.raw.ch_names
self.raw.pick_types(eeg=True, eog=False, meg=False)
self.raw.pick(picks="eeg")
self.ch_names_eeg = self.raw.ch_names
self.EEG = self.raw.get_data()
self.reference_channels = params["ref_chs"]
Expand Down
5 changes: 2 additions & 3 deletions pyprep/tests/test_prep_pipeline.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Test the full PREP pipeline."""
import matplotlib.pyplot as plt
import mne
import numpy as np
import pytest
import scipy.io as sio
Expand All @@ -13,7 +12,7 @@
@pytest.mark.usefixtures("raw", "montage")
def test_prep_pipeline(raw, montage):
"""Test prep pipeline."""
eeg_index = mne.pick_types(raw.info, eeg=True, eog=False, meg=False)
eeg_index = raw.pick(picks="eeg")
raw_copy = raw.copy()
ch_names = raw_copy.info["ch_names"]
ch_names_eeg = list(np.asarray(ch_names)[eeg_index])
Expand Down Expand Up @@ -254,7 +253,7 @@ def test_prep_pipeline_non_eeg(raw, montage):
@pytest.mark.usefixtures("raw", "montage")
def test_prep_pipeline_filter_kwargs(raw, montage):
"""Test prep pipeline with filter kwargs."""
eeg_index = mne.pick_types(raw.info, eeg=True, eog=False, meg=False)
eeg_index = raw.pick(picks="eeg")
raw_copy = raw.copy()
ch_names = raw_copy.info["ch_names"]
ch_names_eeg = list(np.asarray(ch_names)[eeg_index])
Expand Down
6 changes: 3 additions & 3 deletions pyprep/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import math
from cmath import sqrt

import mne
# import mne
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please just remove this line instead of commenting it out

import numpy as np
import scipy.interpolate
from mne.surface import _normalize_vectors
Expand Down Expand Up @@ -355,8 +355,8 @@ def _eeglab_interpolate_bads(raw):

"""
# Get the indices of good and bad EEG channels
eeg_chans = mne.pick_types(raw.info, eeg=True, exclude=[])
good_idx = mne.pick_types(raw.info, eeg=True, exclude="bads")
eeg_chans = raw.pick(picks="eeg", exclude=[])
good_idx = raw.pick(picks="eeg", exclude="bads")
bad_idx = sorted(_set_diff(eeg_chans, good_idx))

# Get the spatial coordinates of the good and bad electrodes
Expand Down
Loading