Skip to content

Commit

Permalink
DOC: Better documentation of realign_raw
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner committed Oct 25, 2023
1 parent 4518a1a commit 660203e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions mne/preprocessing/realign.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ def realign_raw(raw, other, t_raw, t_other, verbose=None):
The second raw instance. It will be resampled to match ``raw``.
t_raw : array-like, shape (n_events,)
The times of shared events in ``raw`` relative to ``raw.times[0]`` (0).
Typically these could be events on some TTL channel like
``find_events(raw)[:, 0] - raw.first_samp``.
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 ``other`` relative to ``other.times[0]``.
%(verbose)s
Expand Down Expand Up @@ -92,11 +93,11 @@ def realign_raw(raw, other, t_raw, t_other, verbose=None):
logger.info(f"Cropping {zero_ord:0.3f} s from the start of raw")
raw.crop(zero_ord, None)
t_raw -= zero_ord
else: # need to crop start of other to match raw
t_crop = zero_ord / first_ord
elif zero_ord < 0: # need to crop start of other to match raw
t_crop = -zero_ord / first_ord
logger.info(f"Cropping {t_crop:0.3f} s from the start of other")
other.crop(-t_crop, None)
t_other += t_crop
other.crop(t_crop, None)
t_other -= t_crop

# 3. Resample data using the first-order term
nan_ch_names = [
Expand Down

0 comments on commit 660203e

Please sign in to comment.