allensdk.brain_observatory.sync_stim_aligner module

allensdk.brain_observatory.sync_stim_aligner.get_stim_timestamps_from_stimulus_blocks(stimulus_files: _StimulusFile | List[_StimulusFile], sync_file: str | Path, raw_frame_time_lines: str | List[str], raw_frame_time_direction: str, frame_count_tolerance: float) Dict[str, Any][source]

Find the timestamps associated a set of stimulus blocks that have to be aligned with a single sync file

Parameters:
stimulus_files: Union[_StimulusFile, List[_StimulusFile]]

The _StimulusFile objects being registered to the sync file

sync_file: Union[str, pathlib.Path]

The path to the sync file

raw_frame_time_lines: Union[str, List[str]]

The line to be used to find raw frame times (usually ‘vsync_stim’). If a list, the code will scan the list in order until a line that is present in the sync file is found. That line will be used.

raw_frame_time_direction: str

Either ‘rising’ or ‘falling’ indicating which edge to use in finding the raw frame times

frame_count_tolerance: float

The tolerance to within two blocks of frame counts are considered equal

Returns:
A dict in which
“timestamps” -> List[np.ndarray]

The list of timestamp arrays corresponding to the provided _StimulusFiles.

“start_frames” -> List[int]

The list of starting frames for the provided _StimulusFiles

The order of stimulus_files will dictate the order of these lists.

Notes

This method operates by finding the start frames associated with each stimulus block according to _get_start_frames and then assigning the timestamps associated with stimulus_block.num_frames to each stimulus block.