arista.preprocess.template_rescue
Detect a broken / truncated sensor MAT file.
In Robert’s original pytci pipeline a temperature_data_*.mat with
fewer than 1000 rows was treated as corrupt; the sensor trace was
then substituted from a pre-computed median template stored in
_legacy/pytci/brokenTempFile_adap.pkl (only the adaptation
protocol template was ever generated).
For v0.1 we only ship the detection half — actual substitution
needs the per-protocol templates regenerated against the corpus, which
is a sprint-7 task once the DB exists. Calling load_template()
today raises NotImplementedError and points the user at the
issue tracker.
Functions
|
Return True if a sensor MAT file looks truncated. |
|
Substitute a median-template sensor trace for a broken MAT. |
- arista.preprocess.template_rescue.is_broken_sensor(sensor, min_rows=1000)[source]
Return True if a sensor MAT file looks truncated.
The heuristic mirrors pytci: a full recording logs the sensor at a much higher rate than the imaging frame rate, so an honest MAT file has thousands of rows. Anything substantially smaller is almost certainly a partially-written file from a crashed acquisition.
- Parameters:
sensor (SensorRecord) – Sensor record from
arista.preprocess.io.read_sensor_mat().min_rows (int) – Threshold below which we declare the file broken (default 1000, matching pytci).
- Return type:
- arista.preprocess.template_rescue.load_template(stimulus_name)[source]
Substitute a median-template sensor trace for a broken MAT.
Not yet implemented in v0.1; raises with a clear pointer to the sprint plan rather than silently returning bogus data.
- Parameters:
stimulus_name (str) – Canonical stimulus name (e.g.
"adaptation").- Return type: