arista.preprocess.align
Frame-align a sensor record against a Fiji ΔF/F trace.
Stages from [[Preprocessing Pipeline]]:
A —
collapse_to_frames: group continuous sensor log rows by their imaging frame number and take the per-frame meanB —
arista.preprocess.interpolate.interpolate_missing_frames(): fill any frames the DAQ droppedC —
assemble_recording: cut the sensor record down to the imaged window, merge with the Fiji ΔF/F trace, convert MATLAB datenums to elapsed seconds
The implementation matches the legacy _legacy/aristaSingleCellData.py
behaviour: per-frame mean (not median), pandas interpolate
(not scipy interp1d), so byte-level regression against legacy
outputs holds within float tolerance.
Functions
|
Run stages A + B + C and return a frame-aligned |
|
Group the continuous sensor log by frame, take the per-frame mean. |
- arista.preprocess.align.assemble_recording(fiji, sensor)[source]
Run stages A + B + C and return a frame-aligned
Recording.Drift correction is not applied here — that is
arista.preprocess.drift’s job. The returned recording hasdfbf_drift_corrected = Noneanddrift_method = "none".The output length is the intersection of the Fiji frame range and the (post-collapse, post-interp) sensor frame range. Any Fiji frames without a matching sensor frame are dropped silently — this matches legacy behaviour and only ever clips a handful of trailing frames in well-formed recordings.
- Parameters:
fiji (FijiRecording) – Fiji ΔF/F₀ trace.
sensor (SensorRecord) – Raw sensor record.
- Returns:
A
Recordingaligned to Fiji’s frame numbers.- Return type:
- arista.preprocess.align.collapse_to_frames(sensor)[source]
Group the continuous sensor log by frame, take the per-frame mean.
Sensor rows where
frame == 0are pre-stimulus calibration data and dropped (matches theframe > 0cut in the legacy pipeline). Frame numbers are decremented by 1 so the result is 0-indexed, aligning with Fiji’s frame numbering.- Parameters:
sensor (SensorRecord) – Raw
SensorRecordstraight fromarista.preprocess.io.read_sensor_mat().- Returns:
A DataFrame indexed by integer 0-based frame number, with columns
epoch_time,sensor_t_c,target_t_c,drive_t_c. NaN-padded over any missing intermediate frames sointerpolate_missing_frames()can fill them.- Return type: