allensdk.internal.pipeline_modules.run_ophys_time_sync module

class allensdk.internal.pipeline_modules.run_ophys_time_sync.TimeSyncOutputs(experiment_id: int, stimulus_delay: float, ophys_delta: int, stimulus_delta: int, eye_delta: int, behavior_delta: int, ophys_times: ndarray, stimulus_times: ndarray, eye_times: ndarray, behavior_times: ndarray, stimulus_alignment: ndarray, eye_alignment: ndarray, behavior_alignment: ndarray)[source]

Bases: tuple

Schema for synchronization outputs

behavior_alignment: ndarray

Alias for field number 12

behavior_delta: int

Alias for field number 5

behavior_times: ndarray

Alias for field number 9

experiment_id: int

Alias for field number 0

eye_alignment: ndarray

Alias for field number 11

eye_delta: int

Alias for field number 4

eye_times: ndarray

Alias for field number 8

ophys_delta: int

Alias for field number 2

ophys_times: ndarray

Alias for field number 6

stimulus_alignment: ndarray

Alias for field number 10

stimulus_delay: float

Alias for field number 1

stimulus_delta: int

Alias for field number 3

stimulus_times: ndarray

Alias for field number 7

class allensdk.internal.pipeline_modules.run_ophys_time_sync.TimeSyncWriter(output_h5_path: str, output_json_path: str | None = None)[source]

Bases: object

validate_paths()[source]

Determines whether we can actually write to the specified paths, allowing for creation of intermediate directories. It is a good idea to run this beore doing any heavy calculations!

write(outputs: TimeSyncOutputs)[source]

Convenience for writing both an output h5 and (if applicable) an output json.

Parameters:
outputsthe data to be written
write_output_h5(outputs)[source]

Write (mainly) heaviweight data to an h5 file.

Parameters:
outputsthe data to be written
write_output_json(outputs)[source]

Write lightweight data to a json

Parameters:
outputsthe data to be written
allensdk.internal.pipeline_modules.run_ophys_time_sync.check_stimulus_delay(obt_delay: float, min_delay: float, max_delay: float)[source]

Raise an exception if the monitor delay is not within specified bounds

Parameters:
obt_delayobtained monitor delay (s)
min_delaylower threshold (s)
max_delayupper threshold (s)
allensdk.internal.pipeline_modules.run_ophys_time_sync.main()[source]
allensdk.internal.pipeline_modules.run_ophys_time_sync.run_ophys_time_sync(aligner: OphysTimeAligner, experiment_id: int, min_stimulus_delay: float, max_stimulus_delay: float) TimeSyncOutputs[source]

Carry out synchronization of timestamps across the data streams of an ophys experiment.

Parameters:
alignerdrives alignment. See OphysTimeAligner for details of the

attributes and properties that must be implemented.

experiment_idunique identifier for the experiment being aligned
min_stimulus_delayreject alignment run (raise a ValueError) if the

calculated monitor delay is below this value (s).

max_stimulus_delayreject alignment run (raise a ValueError) if the

calculated monitor delay is above this value (s).

Returns:
A TimeSyncOutputs (see definintion for more information) of output

parameters and arrays of aligned timestamps.