File tree 4 files changed +16
-1
lines changed
4 files changed +16
-1
lines changed Original file line number Diff line number Diff line change
1
+ Return events when requested even when current matches the desired sfreq in :meth: `mne.io.Raw.resample ` by :newcontrib: `Roy Eric Wieske `.
Original file line number Diff line number Diff line change 258
258
.. _Roman Goj : https ://romanmne . blogspot . co . uk
259
259
.. _Ross Maddox : https ://www . urmc . rochester . edu /labs /maddox -lab . aspx
260
260
.. _Rotem Falach : https ://github . com /Falach
261
+ .. _Roy Eric Wieske : https ://github . com /Randomidous
261
262
.. _Sammi Chekroud : https ://github . com /schekroud
262
263
.. _Samu Taulu : https ://phys . washington . edu /people /samu -taulu
263
264
.. _Samuel Deslauriers -Gauthier : https ://github . com /sdeslauriers
Original file line number Diff line number Diff line change @@ -1386,7 +1386,10 @@ def resample(
1386
1386
sfreq = float (sfreq )
1387
1387
o_sfreq = float (self .info ["sfreq" ])
1388
1388
if _check_resamp_noop (sfreq , o_sfreq ):
1389
- return self
1389
+ if events is not None :
1390
+ return self , events .copy ()
1391
+ else :
1392
+ return self
1390
1393
1391
1394
# When no event object is supplied, some basic detection of dropped
1392
1395
# events is performed to generate a warning. Finding events can fail
Original file line number Diff line number Diff line change 23
23
concatenate_events ,
24
24
create_info ,
25
25
equalize_channels ,
26
+ events_from_annotations ,
26
27
find_events ,
27
28
make_fixed_length_epochs ,
28
29
pick_channels ,
@@ -1318,6 +1319,15 @@ def test_crop():
1318
1319
assert raw .n_times - 1 == raw3 .n_times
1319
1320
1320
1321
1322
+ @testing .requires_testing_data
1323
+ def test_resample_with_events ():
1324
+ """Test resampling raws with events."""
1325
+ raw = read_raw_fif (fif_fname )
1326
+ raw .resample (250 ) # pretend raw is recorded at 250 Hz
1327
+ events , _ = events_from_annotations (raw )
1328
+ raw , events = raw .resample (250 , events = events )
1329
+
1330
+
1321
1331
@testing .requires_testing_data
1322
1332
def test_resample_equiv ():
1323
1333
"""Test resample (with I/O and multiple files)."""
You can’t perform that action at this time.
0 commit comments