Skip to content

Expose detector bank totals to NICOS as derived devices - #1243

Merged
SimonHeybrock merged 1 commit into
mainfrom
nicos-detector-counts-devices
Aug 20, 2026
Merged

Expose detector bank totals to NICOS as derived devices#1243
SimonHeybrock merged 1 commit into
mainfrom
nicos-detector-counts-devices

Conversation

@SimonHeybrock

Copy link
Copy Markdown
Member

NICOS asked for detector counts in the derived-device lists of all instruments, alongside the monitor counts they already read. Each detector bank now exposes its cumulative total as {source_name}_counts_total on {instrument}_livedata_nicos_data, under the same naming convention and the same start_time generation marker as the monitor devices (ADR 0006).

No backend or wire changes were needed: DeviceExtractor runs in every service's OrchestratingProcessor and the topic routing already exists, so the detector_data service starts publishing the moment the contract designates one of its outputs. The change is a registry declaration plus the regenerated exports.

Designation. Monitors have a single monitor_histogram spec per instrument, so their device is unambiguous. A detector bank is typically covered by several views — a projection, a strip view, a tube view — that all produce counts_total_cumulative, and device names must be unique across an instrument. Each instrument therefore designates exactly one view per bank, generally the primary geometric or whole-bank image. Designating a second one for the same source fails loud at contract construction. The shared COUNTS_TOTAL_DEVICE constant keeps the naming convention in one place for monitors and detectors alike, and its docstring carries the uniqueness rule.

Consequence worth knowing. The designated view becomes device-bearing, so the dashboard's confirmation gate now intercepts reset/stop/reconfigure on the primary detector view of every instrument while a job is running, naming the affected devices. Previously only monitor_histogram was gated.

Not fixed here: counts_total is the sum of the accumulated histogram, so events outside the view's TOA or wavelength edges are excluded. This is pre-existing and already applies to the monitor devices; in the default TOA configuration the edges span a full pulse period and nothing is dropped, but a narrowed range or wavelength mode truncates. Raised as #1242 for ESSlivedata and NICOS to settle.

Test plan

  • A new test asserts every monitor and detector bank of every instrument has a counts device, so a new bank or a new instrument cannot silently miss one. Verified it fails when a designation is removed.
  • A new service-level test asserts a running detector view publishes its bank total on the NICOS stream under the contracted device name, carrying start_time and end_time.
  • Existing detector service tests now filter to the result stream, matching what the monitor service tests already do.
  • The committed device_contract.yaml exports are regenerated; the existing drift test guards them.

NICOS asked for detector counts in the device lists alongside the monitor
counts it already reads. The extraction machinery is generic -- DeviceExtractor
runs in every service's OrchestratingProcessor -- so this is a registry
declaration only: no backend or wire changes.

Unlike monitors, which have a single monitor_histogram spec per instrument, a
detector bank is typically covered by several views that all produce
counts_total_cumulative. Device names must be unique, so each instrument
designates exactly one view per bank; the shared COUNTS_TOTAL_DEVICE constant
keeps the {source_name}_counts_total naming convention in one place for both
monitors and detectors.

A new test asserts every monitor and detector bank of every instrument has a
counts device, so a new bank or instrument cannot silently miss one.

Note that counts_total is the sum of the accumulated histogram and so depends
on the view's TOA/wavelength edges; that pre-existing behaviour is #1242.

@SimonHeybrock SimonHeybrock left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SimonHeybrock
SimonHeybrock merged commit a64b9e0 into main Aug 20, 2026
16 checks passed
@SimonHeybrock
SimonHeybrock deleted the nicos-detector-counts-devices branch August 20, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant