allensdk.brain_observatory.behavior.data_objects.timestamps.stimulus_timestamps.timestamps_processing module

allensdk.brain_observatory.behavior.data_objects.timestamps.stimulus_timestamps.timestamps_processing.get_behavior_stimulus_timestamps(stimulus_pkl: dict) ndarray[source]

Obtain visual behavior stimuli timing information from a behavior stimulus *.pkl file.

Parameters:
stimulus_pkldict

A dictionary containing stimulus presentation timing information during a behavior session. Presentation timing info is stored as an array of times between frames (frame time intervals) in milliseconds.

Returns:
np.ndarray

Timestamps (in seconds) for presented stimulus frames during a session.

allensdk.brain_observatory.behavior.data_objects.timestamps.stimulus_timestamps.timestamps_processing.get_frame_indices(frame_timestamps: ndarray, event_timestamps: ndarray) ndarray[source]

Given an array of timestamps corresponding to stimulus frames and an array of timestamps corresponding to some event (i.e. licks), return an array of indexes indicating which frame each event occured on. Indexes will be chosen to be the first index satisfying

frame_timestamps[event_indices] >= event_timestamps event_timestamps < frame_timestamps[event_indices+1]

Parameters:
frame_timestamps: np.ndarray

must be in ascending order

event_timetamps: np.ndarray
Returns:
event_indices: np.ndarray

integers that are all >= 0 and < len(frame_timestamps)

allensdk.brain_observatory.behavior.data_objects.timestamps.stimulus_timestamps.timestamps_processing.get_ophys_stimulus_timestamps(sync_path: str | Path) ndarray[source]

Obtain visual behavior stimuli timing information from a sync *.h5 file.

Parameters:
sync_pathUnion[str, Path]

The path to a sync *.h5 file that contains global timing information about multiple data streams (e.g. behavior, ophys, eye_tracking) during a session.

Returns:
np.ndarray

Timestamps (in seconds) for presented stimulus frames during a behavior + ophys session.