Skip to content

Commit

Permalink
MAINT: Fix for latest PyVista
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner committed Dec 7, 2023
1 parent 432249e commit 6782767
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
5 changes: 3 additions & 2 deletions mne/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1978,7 +1978,8 @@ def resample(
)
half_len = len(window) // 2
logger.info(
f"Polyphase resampling locality: ±{half_len} input sample{_pl(half_len)}"
f"Polyphase resampling neighborhood: ±{half_len} "
f"input sample{_pl(half_len)}"
)
y = _resample_polyphase(x, up=up, down=down, **kwargs)
assert y.shape[-1] == final_len
Expand All @@ -1997,7 +1998,7 @@ def _prep_polyphase(ratio, x_len, final_len, window):
g_ = gcd(up, down)
up = up // g_
down = down // g_
# Figure out our signal locality and design window (adapted from SciPy)
# Figure out our signal neighborhood and design window (adapted from SciPy)
if not isinstance(window, (list, np.ndarray)):
# Design a linear-phase low-pass FIR filter
max_rate = max(up, down)
Expand Down
4 changes: 2 additions & 2 deletions mne/io/fiff/tests/test_raw_fiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -1325,9 +1325,9 @@ def test_resample(tmp_path, preload, n, npad, method):
raw_resamp.resample(sfreq, n_jobs=None, verbose=True, **kwargs)
log = log.getvalue()
if method == "fft":
assert "locality" not in log
assert "neighborhood" not in log
else:
assert "locality" in log
assert "neighborhood" in log
assert raw_resamp.info["sfreq"] == sfreq
assert raw.get_data().shape == raw_resamp._data.shape
assert raw.first_samp == raw_resamp.first_samp
Expand Down
8 changes: 4 additions & 4 deletions mne/tests/test_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,9 @@ def test_resample(method):
x_rs = resample(x, 1, 2, npad=10, method=method, verbose=True)
log = log.getvalue()
if method == "fft":
assert "locality" not in log
assert "neighborhood" not in log
else:
assert "locality" in log
assert "neighborhood" in log
assert x.shape == (10, 10, 10)
assert x_rs.shape == (10, 10, 5)

Expand Down Expand Up @@ -502,9 +502,9 @@ def test_resample_below_1_sample(method):
epochs.resample(1, method=method, verbose=True)
log = log.getvalue()
if method == "fft":
assert "locality" not in log
assert "neighborhood" not in log
else:
assert "locality" in log
assert "neighborhood" in log
assert len(epochs.times) == 1
assert epochs.get_data(copy=False).shape[2] == 1

Expand Down
9 changes: 5 additions & 4 deletions mne/viz/backends/_pyvista.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ def _init(
off_screen=False,
notebook=False,
splash=False,
multi_samples=None,
):
self._plotter = plotter
self.display = None
Expand All @@ -123,7 +122,6 @@ def _init(
self.store["shape"] = shape
self.store["off_screen"] = off_screen
self.store["border"] = False
self.store["multi_samples"] = multi_samples
self.store["line_smoothing"] = True
self.store["polygon_smoothing"] = True
self.store["point_smoothing"] = True
Expand Down Expand Up @@ -234,12 +232,12 @@ def __init__(
notebook=notebook,
smooth_shading=smooth_shading,
splash=splash,
multi_samples=multi_samples,
)
self.font_family = "arial"
self.tube_n_sides = 20
self.antialias = _get_3d_option("antialias")
self.depth_peeling = _get_3d_option("depth_peeling")
self.multi_samples = multi_samples
self.smooth_shading = smooth_shading
if isinstance(fig, int):
saved_fig = _FIGURES.get(fig)
Expand Down Expand Up @@ -880,7 +878,10 @@ def _toggle_antialias(self):
plotter.disable_anti_aliasing()
else:
if not bad_system:
plotter.enable_anti_aliasing(aa_type="msaa")
plotter.enable_anti_aliasing(
aa_type="msaa",
multi_samples=self.multi_samples,
)

def remove_mesh(self, mesh_data):
actor, _ = mesh_data
Expand Down

0 comments on commit 6782767

Please sign in to comment.