-
Notifications
You must be signed in to change notification settings - Fork 48
Description
Feature Request: Support for ms_delay in ScanSet.UnitInfo
Problem
In an earlier but similar version of the calcium imaging pipeline (specifically reso.py from Cajal’s pipeline), there is a variable called ms_delay defined in ScanSet.UnitInfo():
ms_delay = 0 # (ms) delay from start of frame to recording of this unit
This value is computed from delay_image, which is present in both pipelines via scan.ScanInfo.Field.
I use this value to interpolate or shift spike/trace data to align all units to the first timepoint in the frame. This is especially critical because I work with large fields of view and slow scan rates, where a full frame might take ~200 ms to complete.
Without this correction, neural responses across the field are temporally misaligned, which can impact downstream analyses.
Requirements
-
A similar
ms_delaycomputation to what exists in the older pipeline.
(If it doesn't already exist) -
It should extract per-unit or per-field delays using delay_image from
scan.ScanInfo.Field. -
Ideally, expose this in a new or existing table (e.g.,
Processing.UnitInfo) or make it queryable from the trace output.
Justification
Adding support for this feature would:
-
Ensure precise temporal alignment of traces or inferred spikes, especially for mesoscopic 2p recordings.
-
Improve accuracy in modeling and decoding from neural data.
-
Align the functionality with well-tested pipelines like the Cajal one, increasing interoperability and confidence in results.
Alternative Considerations
Currently, I compute ms_delay manually by referencing delay_image, then align traces post hoc outside of the pipeline.