Files
eco/tests
lemke_handClaude Sonnet 5 13d3f91b76 BsStreamCounter: auto-build and store escape Arrays at scan end
Gives BsStreamCounter the other thing it was missing compared to the
older EPICS-monitor CounterValue (which already auto-creates and
stores arrays every scan): a scan's per-channel bins used to live only
in memory (last_value(s), .grid(), the raw _channels), gone the moment
the next scan tore them down, with nothing written to disk.

_build_arrays() converts self._last_channels into real escape.Array
objects via Stream.to_array() (escape-fel, previous commit), with the
parameter axis relabeled to the scan's actual adjustable values
(scan.scan_info["scan_values"], same source
eco.acquisition.counters.parameter_from_scan uses) instead of
to_array()'s own default -- this counter's internal Scan is keyed on a
synthetic step index (see _StepIndexSource), not anything physical.
Falls back to the synthetic step_index for a channel whose bin count
doesn't match the scan's step count (a step that timed out with zero
samples never created a bin) rather than mislabeling steps.

_store_arrays() writes them to a fresh .esc.h5 via
DataSet.create_with_new_result_file/.append/.store(), mirroring
CounterValue.store_arrays's own round-trip. Both run from
_on_scan_end, gated by a new store=True constructor flag (storage_dir=
"auto" picks the directory, same contract as CounterValue's own);
any failure is printed, never raised, so it can't fail the scan.

Verified directly against a synthetic bs stream (escape.stream's
TestStream/LocalEventHandler, no real beamline) and added two
regression tests: the parameter/step_lengths values survive a full
store+reload round-trip, and store=False writes nothing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-13 11:29:31 +02:00
..
2026-08-30 22:50:56 +02:00
2026-08-21 15:10:25 +02:00
2026-09-11 15:29:43 +02:00
2026-09-07 16:54:05 +02:00
2026-09-07 16:54:05 +02:00
2026-09-06 16:34:29 +02:00
2026-08-21 15:10:25 +02:00
2026-08-21 15:10:25 +02:00
2026-09-11 16:04:34 +02:00
2026-08-28 14:25:39 +02:00
2026-08-21 15:10:25 +02:00
2026-09-06 21:05:04 +02:00
2026-09-11 16:04:34 +02:00
2026-09-06 16:34:29 +02:00
2026-08-21 15:10:25 +02:00
2026-08-21 15:10:25 +02:00
2026-08-21 15:10:25 +02:00
2026-09-07 17:11:28 +02:00
2026-08-21 15:10:25 +02:00
2026-08-21 15:10:25 +02:00
2026-08-30 22:50:56 +02:00
2026-08-21 15:10:25 +02:00
2026-09-06 16:34:29 +02:00
2026-09-11 16:04:34 +02:00
2026-09-11 16:04:34 +02:00
2026-09-06 16:34:29 +02:00