Skip to content

Commit

Permalink
in1d -> isin
Browse files Browse the repository at this point in the history
  • Loading branch information
drammock committed Sep 12, 2023
1 parent 1f4305f commit 70caa81
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions mne_qt_browser/_pg_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def toggle_bad(self, x=None):
self.mne.epoch_colors[epoch_idx]])

# Update bad channel colors
bad_idxs = np.in1d(self.mne.ch_names, self.mne.info['bads'])
bad_idxs = np.isin(self.mne.ch_names, self.mne.info['bads'])
new_epo_color[bad_idxs] = to_rgba_array(self.mne.ch_color_bad)

self.mne.epoch_color_ref[:, epoch_idx] = new_epo_color
Expand Down Expand Up @@ -1954,14 +1954,16 @@ def _chkbx_changed(self, checked=True, label=None):

def _set_custom_selection(self):
chs = self.channel_fig.lasso.selection
inds = np.in1d(self.mne.ch_names, chs)
inds = np.isin(self.mne.ch_names, chs)
self.mne.ch_selections['Custom'] = inds.nonzero()[0]
if any(inds):
self._chkbx_changed(None, 'Custom')

def _update_highlighted_sensors(self):
inds = np.in1d(self.mne.fig_selection.channel_fig.lasso.ch_names,
self.mne.ch_names[self.mne.picks]).nonzero()[0]
inds = np.isin(
self.mne.fig_selection.channel_fig.lasso.ch_names,
self.mne.ch_names[self.mne.picks],
).nonzero()[0]
self.channel_fig.lasso.select_many(inds)
self.channel_widget.draw()

Expand All @@ -1971,7 +1973,7 @@ def _update_bad_sensors(self, pick, mark_bad):
for this_type in _DATA_CH_TYPES_SPLIT:
if this_type in self.mne.ch_types:
sensor_picks.extend(ch_indices[this_type])
sensor_idx = np.in1d(sensor_picks, pick).nonzero()[0]
sensor_idx = np.isin(sensor_picks, pick).nonzero()[0]
# change the sensor color
fig = self.channel_fig
fig.lasso.ec[sensor_idx, 0] = float(mark_bad) # change R of RGBA array
Expand Down Expand Up @@ -2933,7 +2935,7 @@ def __init__(self, **kwargs):
to_rgba_array(self.mne.epoch_color_bad)

# Mark bad channels
bad_idxs = np.in1d(self.mne.ch_names, self.mne.info['bads'])
bad_idxs = np.isin(self.mne.ch_names, self.mne.info['bads'])
self.mne.epoch_color_ref[bad_idxs, :] = \
to_rgba_array(self.mne.ch_color_bad)

Expand Down Expand Up @@ -4070,7 +4072,7 @@ def _update_data(self):

# Initialize decim
self.mne.decim_data = np.ones_like(self.mne.picks)
data_picks_mask = np.in1d(self.mne.picks, self.mne.picks_data)
data_picks_mask = np.isin(self.mne.picks, self.mne.picks_data)
self.mne.decim_data[data_picks_mask] = self.mne.decim

# Apply clipping
Expand Down

0 comments on commit 70caa81

Please sign in to comment.