Skip to content

Commit

Permalink
test post-decimation
Browse files Browse the repository at this point in the history
  • Loading branch information
drammock committed Feb 14, 2024
1 parent 20259e3 commit e317590
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions mne/time_frequency/tests/test_tfr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1544,6 +1544,11 @@ def test_tfr_decim(epochs, method, freqs, decim):
assert tfr.shape[-1] == want
# Check that decim changes sfreq
assert tfr.sfreq == epochs.info["sfreq"] / (decim.step or 1)
# check after-the-fact decimation. The mixin .decimate method doesn't allow slices
if isinstance(decim, int):
tfr2 = epochs.compute_tfr(method, freqs=freqs, decim=1)
tfr2.decimate(decim)
assert tfr == tfr2


def test_tfr_arithmetic(epochs):
Expand Down
6 changes: 4 additions & 2 deletions mne/utils/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,10 +680,12 @@ def decimate(self, decim, offset=0, *, verbose=None):
# appropriately filtered to avoid aliasing
from ..epochs import BaseEpochs
from ..evoked import Evoked
from ..time_frequency import AverageTFR, EpochsTFR
from ..time_frequency import AverageTFR, EpochsTFR, RawTFR

# This should be the list of classes that inherit
_validate_type(self, (BaseEpochs, Evoked, EpochsTFR, AverageTFR), "inst")
_validate_type(
self, (BaseEpochs, Evoked, RawTFR, EpochsTFR, AverageTFR), "inst"
)
decim, offset, new_sfreq = _check_decim(
self.info, decim, offset, check_filter=not hasattr(self, "freqs")
)
Expand Down

0 comments on commit e317590

Please sign in to comment.