Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 3 additions & 3 deletions mne/beamformer/_compute_beamformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ def _check_proj_match(info, filters):
filters['ch_names'])
if not np.allclose(proj_data, filters['proj'],
atol=np.finfo(float).eps, rtol=1e-13):
raise ValueError('The SSP projections present in the data '
'do not match the projections used when '
'calculating the spatial filter.')
raise ValueError('The SSP projections present in the data '
'do not match the projections used when '
'calculating the spatial filter.')


def _check_src_type(filters):
Expand Down
4 changes: 2 additions & 2 deletions mne/decoding/receptive_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ def _check_dimensions(self, X, y, predict=False):
raise ValueError('X any y do not have the same n_epochs\n'
'%s != %s' % (X.shape[1], y.shape[1]))
if predict and y.shape[-1] != len(self.estimator_.coef_):
raise ValueError('Number of outputs does not match'
' estimator coefficients dimensions')
raise ValueError('Number of outputs does not match'
' estimator coefficients dimensions')
return X, y, X_dim, y_dim


Expand Down
17 changes: 9 additions & 8 deletions mne/epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,10 +852,10 @@ def fun(data):
data = fun(self._data)
assert len(self.events) == len(self._data)
if data.shape != self._data.shape[1:]:
raise RuntimeError("You passed a function that resulted "
"in data of shape {}, but it should be "
"{}.".format(data.shape,
self._data.shape[1:]))
raise RuntimeError(
'You passed a function that resulted n data of shape {}, '
'but it should be {}.'.format(
data.shape, self._data.shape[1:]))
else:
if mode not in {"mean", "std"}:
raise ValueError("If data are not preloaded, can only compute "
Expand Down Expand Up @@ -1499,8 +1499,9 @@ def equalize_event_counts(self, event_ids, method='mintime'):
# 2a. for tags, find all the event_ids matched by the tags
# 2b. for non-tag ids, just pass them directly
# 3. do this for every input
event_ids = [[k for k in ids if all((tag in k.split("/")
for tag in id_))] # find ids matching all tags
event_ids = [[k for k in ids
if all((tag in k.split("/")
for tag in id_))] # ids matching all tags
if all(id__ not in ids for id__ in id_)
else id_ # straight pass for non-tag inputs
for id_ in event_ids]
Expand Down Expand Up @@ -2426,8 +2427,8 @@ def __init__(self, fname, proj=True, preload=True,
for i1, i2 in zip(offsets[:-1], offsets[1:]):
other_log = drop_log[i1:i2]
for k, (a, b) in enumerate(zip(drop_log, other_log)):
if a == ['IGNORED'] and b != ['IGNORED']:
drop_log[k] = b
if a == ['IGNORED'] and b != ['IGNORED']:
drop_log[k] = b
drop_log = drop_log[:step]

# call BaseEpochs constructor
Expand Down
2 changes: 1 addition & 1 deletion mne/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ def __init__(self, info): # noqa: D102
if 'ERFversion' in self.acq_dict:
self.compat = False # DACQ ver >= 3.4
elif 'ERFncateg' in self.acq_dict: # probably DACQ < 3.4
self.compat = True
self.compat = True
else:
raise ValueError('Cannot parse acquisition parameters')
dacq_vars = self._dacq_vars_compat if self.compat else self._dacq_vars
Expand Down
2 changes: 1 addition & 1 deletion mne/io/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ def _parse_get_set_params(self, item):

if start is None:
start = 0
if (step is not None) and (step is not 1):
if step is not None and step != 1:
raise ValueError('step needs to be 1 : %d given' % step)

if isinstance(sel, (int, np.integer)):
Expand Down
4 changes: 2 additions & 2 deletions mne/realtime/stim_server_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ def get_trigger(self, timeout=5.0, verbose=None):

# Raise timeout error
if current_time > (start_time + timeout):
logger.info("received nothing")
return None
logger.info("received nothing")
return None

self._sock.send("get trigger".encode('utf-8'))
trigger = self._sock.recv(1024)
Expand Down
4 changes: 2 additions & 2 deletions mne/source_estimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,12 @@ def read_source_estimate(fname, subject=None):
else:
raise RuntimeError('Unknown extension for file %s' % fname_arg)

if ftype is not 'volume':
if ftype != 'volume':
stc_exist = [op.exists(f)
for f in [fname + '-rh.stc', fname + '-lh.stc']]
w_exist = [op.exists(f)
for f in [fname + '-rh.w', fname + '-lh.w']]
if all(stc_exist) and (ftype is not 'w'):
if all(stc_exist) and ftype != 'w':
ftype = 'surface'
elif all(w_exist):
ftype = 'w'
Expand Down
2 changes: 1 addition & 1 deletion mne/source_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -2548,7 +2548,7 @@ def get_volume_labels_from_src(src, subject, subjects_dir):
raise ValueError('No vol src space in src')

if any(np.any(s['type'] != 'vol') for s in src[2:]):
raise ValueError('source spaces have to be of vol type')
raise ValueError('source spaces have to be of vol type')

labels_aseg = list()
for nr in range(2, len(src)):
Expand Down
2 changes: 1 addition & 1 deletion mne/tests/test_chpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def test_simulate_calculate_chpi_positions():

info['hpi_subsystem'] = hpi_subsystem
for l, freq in enumerate(coil_freq):
info['hpi_meas'][0]['hpi_coils'][l]['coil_freq'] = freq
info['hpi_meas'][0]['hpi_coils'][l]['coil_freq'] = freq
picks = pick_types(info, meg=True, stim=True, eeg=False, exclude=[])
info['sfreq'] = 100. # this will speed it up a lot
info = pick_info(info, picks)
Expand Down
2 changes: 1 addition & 1 deletion mne/time_frequency/csd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ def _prepare_csd_array(X, sfreq, t0, tmin, tmax, fmin=None, fmax=None):
if tmin is None:
tmin = times.min()
if tmax <= tmin:
raise ValueError('tmax must be larger than tmin')
raise ValueError('tmax must be larger than tmin')
if tmin < times[0] - tstep:
raise ValueError('tmin should be larger than the smallest data time '
'point')
Expand Down
4 changes: 2 additions & 2 deletions mne/viz/epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1961,8 +1961,8 @@ def _plot_histogram(params):
color = colors[types[idx]]
rej = None
if epochs.reject is not None and types[idx] in epochs.reject.keys():
rej = epochs.reject[types[idx]] * scalings[types[idx]]
rng = [0., rej * 1.1]
rej = epochs.reject[types[idx]] * scalings[types[idx]]
rng = [0., rej * 1.1]
else:
rng = None
plt.hist(data[idx] * scalings[types[idx]], bins=100, color=color,
Expand Down
2 changes: 1 addition & 1 deletion mne/viz/evoked.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def _plot_evoked(evoked, picks, exclude, unit, show, ylim, proj, xlim, hline,
for im in ims:
im.set_clim(min, max)
figs = [ax.get_figure() for ax in axes.values()]
if len(set(figs)) is 1:
if len(set(figs)) == 1:
return figs[0]
else:
return figs
Expand Down
4 changes: 2 additions & 2 deletions mne/viz/topo.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def _rm_cursor(event):
plt.connect('axes_leave_event', _rm_cursor)

_setup_ax_spines(ax, vline, tmin, tmax)
ax.figure.set_facecolor('k' if hvline_color is 'w' else 'w')
ax.figure.set_facecolor('k' if hvline_color == 'w' else 'w')
ax.spines['bottom'].set_color(hvline_color)
ax.spines['left'].set_color(hvline_color)
ax.tick_params(axis='x', colors=hvline_color, which='both')
Expand Down Expand Up @@ -719,7 +719,7 @@ def _plot_evoked_topo(evoked, layout=None, layout_scale=0.945, color=None,
if ylim is None:
# find maxima over all evoked data for each channel pick
ymaxes = np.array([max(np.abs(e.data[t]).max() for e in evoked)
for t in picks])
for t in picks])
ylim_ = (-ymaxes, ymaxes)
elif isinstance(ylim, dict):
ylim_ = _handle_default('ylim', ylim)
Expand Down
2 changes: 1 addition & 1 deletion mne/viz/topomap.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _prepare_topo_plot(inst, ch_type, layout):
"""Prepare topo plot."""
info = copy.deepcopy(inst if isinstance(inst, Info) else inst.info)

if layout is None and ch_type is not 'eeg':
if layout is None and ch_type != 'eeg':
from ..channels import find_layout
layout = find_layout(info) # XXX : why not passing ch_type???
elif layout == 'auto':
Expand Down
12 changes: 6 additions & 6 deletions mne/viz/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2573,7 +2573,7 @@ def _set_title_multiple_electrodes(title, combine, ch_names, max_chans=6,
combine = combine[0].upper() + combine[1:]
title = "{} of {} {}".format(
combine, len(ch_names), ch_type)
elif len(ch_names) > max_chans and combine is not "gfp":
elif len(ch_names) > max_chans and combine != "gfp":
warn("More than {} channels, truncating title ...".format(
max_chans))
title += ", ...\n({} of {} {})".format(
Expand Down Expand Up @@ -2659,7 +2659,7 @@ def _plot_masked_image(ax, data, times, mask=None, picks=None, yvals=None,
warn("With matplotlib version 2.1.0, lines may not show up in "
"`AverageTFR.plot_joint`. Upgrade to a more recent version.")

if yscale is "log": # pcolormesh for log scale
if yscale == "log": # pcolormesh for log scale
# compute bounds between time samples
time_diff = np.diff(times) / 2. if len(times) > 1 else [0.0005]
time_lims = np.concatenate([[times[0] - time_diff[0]], times[:-1] +
Expand Down Expand Up @@ -2709,10 +2709,10 @@ def _plot_masked_image(ax, data, times, mask=None, picks=None, yvals=None,
im = ax.imshow(data, cmap=cmap, **im_args)

if draw_contour and np.unique(mask).size == 2:
big_mask = np.kron(mask, np.ones((10, 10)))
ax.contour(big_mask, colors=["k"], extent=extent,
linewidths=[.75], corner_mask=False,
antialiased=False, levels=[.5])
big_mask = np.kron(mask, np.ones((10, 10)))
ax.contour(big_mask, colors=["k"], extent=extent,
linewidths=[.75], corner_mask=False,
antialiased=False, levels=[.5])
time_lims = times[[0, -1]]
ylim = yvals[0], yvals[-1] + 1

Expand Down