mne.preprocessing.realign_raw¶
-
mne.preprocessing.
realign_raw
(raw, other, t_raw, t_other, verbose=None)[source]¶ Realign two simultaneous recordings.
Due to clock drift, recordings at a given same sample rate made by two separate devices simultaneously can become out of sync over time. This function uses event times captured by both acquisition devices to resample
other
to matchraw
.- Parameters
- rawinstance of
Raw
The first raw instance.
- otherinstance of
Raw
The second raw instance. It will be resampled to match
raw
.- t_rawarray_like, shape (n_events,)
The times of shared events in
raw
relative toraw.times[0]
(0). Typically these could be events on some TTL channel likefind_events(raw)[:, 0] - raw.first_event
.- t_otherarray_like, shape (n_events,)
The times of shared events in
other
relative toother.times[0]
.- verbosebool,
str
,int
, orNone
If not None, override default verbose level (see
mne.verbose()
and Logging documentation for more). If used, it should be passed as a keyword-argument only.
- rawinstance of
Notes
This function operates inplace. It will:
Estimate the zero-order (start offset) and first-order (clock drift) correction.
Crop the start of
raw
orother
, depending on which started recording first.Resample
other
to matchraw
based on the clock drift.Crop the end of
raw
orother
, depending on which stopped recording first (and the clock drift rate).
This function is primarily designed to work on recordings made at the same sample rate, but it can also operate on recordings made at different sample rates to resample and deal with clock drift simultaneously.
New in version 0.22.