File tree Expand file tree Collapse file tree 4 files changed +16
-1
lines changed Expand file tree Collapse file tree 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 257
257
.. _Roman Goj : https ://romanmne . blogspot . co . uk
258
258
.. _Ross Maddox : https ://www . urmc . rochester . edu /labs /maddox -lab . aspx
259
259
.. _Rotem Falach : https ://github . com /Falach
260
+ .. _Roy Eric Wieske : https ://github . com /Randomidous
260
261
.. _Sammi Chekroud : https ://github . com /schekroud
261
262
.. _Samu Taulu : https ://phys . washington . edu /people /samu -taulu
262
263
.. _Samuel Deslauriers -Gauthier : https ://github . com /sdeslauriers
Original file line number Diff line number Diff line change @@ -1387,7 +1387,10 @@ def resample(
1387
1387
sfreq = float (sfreq )
1388
1388
o_sfreq = float (self .info ["sfreq" ])
1389
1389
if _check_resamp_noop (sfreq , o_sfreq ):
1390
- return self
1390
+ if events is not None :
1391
+ return self , events .copy ()
1392
+ else :
1393
+ return self
1391
1394
1392
1395
# When no event object is supplied, some basic detection of dropped
1393
1396
# 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 ,
@@ -1326,6 +1327,15 @@ def test_crop():
1326
1327
assert raw .n_times - 1 == raw3 .n_times
1327
1328
1328
1329
1330
+ @testing .requires_testing_data
1331
+ def test_resample_with_events ():
1332
+ """Test resampling raws with events."""
1333
+ raw = read_raw_fif (fif_fname )
1334
+ raw .resample (250 ) # pretend raw is recorded at 250 Hz
1335
+ events , _ = events_from_annotations (raw )
1336
+ raw , events = raw .resample (250 , events = events )
1337
+
1338
+
1329
1339
@testing .requires_testing_data
1330
1340
def test_resample_equiv ():
1331
1341
"""Test resample (with I/O and multiple files)."""
You can’t perform that action at this time.
0 commit comments