braindecode.preprocessing.RealignRaw#
- class braindecode.preprocessing.RealignRaw(other, t_raw, t_other, *, verbose=None)[source]#
Braindecode preprocessor wrapper for
realign_raw().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
otherto 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
rawrelative toraw.times[0](0). Typically these could be events on some TTL channel such as:find_events(raw)[:, 0] / raw.info["sfreq"] - raw.first_time
- t_otherarray-like, shape (n_events,)
The times of shared events in
otherrelative toother.times[0].- verbosebool | str | int | None
Control verbosity of the logging output. If
None, use the default verbosity level. See the logging documentation andmne.verbose()for details. Should only be passed as a keyword argument.
Notes
This function operates inplace. It will:
Estimate the zero-order (start offset) and first-order (clock drift) correction.
Crop the start of
raworother, depending on which started recording first.Resample
otherto matchrawbased on the clock drift.Realign the onsets and durations in
other.annotations.Crop the end of
raworother, 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.
Added in version 0.22.
Methods
- fn(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
otherto matchraw.- Parameters:
raw (instance of Raw) – The first raw instance.
other (instance of Raw) – The second raw instance. It will be resampled to match
raw.t_raw (array-like, shape (n_events,)) –
The times of shared events in
rawrelative toraw.times[0](0). Typically these could be events on some TTL channel such as:find_events(raw)[:, 0] / raw.info["sfreq"] - raw.first_time
t_other (array-like, shape (n_events,)) – The times of shared events in
otherrelative toother.times[0].verbose (bool | str | int | None) – Control verbosity of the logging output. If
None, use the default verbosity level. See the logging documentation andmne.verbose()for details. Should only be passed as a keyword argument.
Notes
This function operates inplace. It will:
Estimate the zero-order (start offset) and first-order (clock drift) correction.
Crop the start of
raworother, depending on which started recording first.Resample
otherto matchrawbased on the clock drift.Realign the onsets and durations in
other.annotations.Crop the end of
raworother, 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.
Added in version 0.22.