mne_videobrowser.TimestampAligner#

class mne_videobrowser.TimestampAligner(timestamps_a: ndarray[tuple[Any, ...], dtype[floating]], timestamps_b: ndarray[tuple[Any, ...], dtype[floating]], timestamp_unit: Literal['milliseconds', 'seconds'] = 'milliseconds', select_on_tie: Literal['left', 'right'] = 'left', name_a: str = 'a', name_b: str = 'b')[source]#

Bases: object

Maps indices between two arrays of timestamps bidirectionally.

Parameters:
  • timestamps_a (NDArray[np.floating]) – 1-D sorted array of timestamps.

  • timestamps_b (NDArray[np.floating]) – 1-D sorted array of timestamps.

  • timestamp_unit (Literal["milliseconds", "seconds"], optional) – The unit of the timestamps in timestamps_a and timestamps_b. By default “milliseconds”.

  • select_on_tie (Literal["left", "right"], optional) – How to select the result when a source timestamp is exactly between two target timestamps. If “left”, the index corresponding to the left target timestamp is selected. If “right”, the index corresponding to the right target timestamp is selected. By default “left”.

  • name_a (str, optional) – Name for the timestamps in timestamps_a, used in logging messages.

  • name_b (str, optional) – Name for the timestamps in timestamps_b, used in logging messages.

Methods

a_index_to_b_index(a_idx)

Map an index in timestamps_a to the closest index in timestamps_b.

b_index_to_a_index(b_idx)

Map an index in timestamps_b to the closest index in timestamps_a.

a_index_to_b_index(a_idx: int) MappingResult[source]#

Map an index in timestamps_a to the closest index in timestamps_b.

b_index_to_a_index(b_idx: int) MappingResult[source]#

Map an index in timestamps_b to the closest index in timestamps_a.