Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mscheltienne committed Nov 10, 2023
1 parent 1d4e7e9 commit 9799b8c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pycrostates/segmentation/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from matplotlib.axes import Axes
from mne import BaseEpochs
from mne.io import BaseRaw
from mne.utils import check_version
from numpy.typing import NDArray

from .._typing import Segmentation
Expand Down Expand Up @@ -141,7 +142,8 @@ def compute_parameters(self, norm_gfp: bool = True, return_dist: bool = False):
assert data.ndim == 2
assert labels.size == data.shape[1]
elif isinstance(self._inst, BaseEpochs):
data = self._inst.get_data(copy=False)
kwargs = dict(copy=False) if check_version("mne", "1.6") else dict()
data = self._inst.get_data(**kwargs)
# sanity-checks
assert labels.ndim == 2
assert data.ndim == 3
Expand Down
3 changes: 2 additions & 1 deletion pycrostates/viz/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ def plot_epoch_segmentation(
_check_type(epochs, (BaseEpochs,), "epochs")
_check_type(block, (bool,), "block")

data = epochs.get_data(copy=False).swapaxes(0, 1)
kwargs = dict(copy=False) if check_version("mne", "1.6") else dict()
data = epochs.get_data(**kwargs).swapaxes(0, 1)
data = data.reshape(data.shape[0], -1)
gfp = np.std(data, axis=0)
times = np.arange(0, data.shape[-1])
Expand Down

0 comments on commit 9799b8c

Please sign in to comment.