Skip to content

Add MAGIC instrument: detector views and cylinder-Y projection#970

Draft
SimonHeybrock wants to merge 6 commits into
mainfrom
968-magic-instrument
Draft

Add MAGIC instrument: detector views and cylinder-Y projection#970
SimonHeybrock wants to merge 6 commits into
mainfrom
968-magic-instrument

Conversation

@SimonHeybrock

@SimonHeybrock SimonHeybrock commented Jun 10, 2026

Copy link
Copy Markdown
Member

Adds dashboard support for the MAGIC instrument (#968): its two detector banks, the geometry-free wire and strip logical views, and the cylinder-Y mantle projection for each bank. The banks are vertical (Y-axis) cylinders resembling the DREAM mantle rotated onto Y.

Geometry

The MAGIC NeXus files carry only a per-voxel NXoff_geometry pixel_shape and no [xyz]_pixel_offset, which essreduce's position calculation requires. Rather than add a runtime path that reads OFF geometry, make-geometry-nexus gains an --off-active-face option that derives the pixel offsets from the voxel vertex centroids (only one radial face is the active surface, so a single face is used) and drops the bulky mesh. The derived geometry file is uploaded to the geometry release and registered, so the projection loads through the standard geometry path with no instrument-specific runtime code.

Event routing

event_id is assumed to lie within the detector_number range, as the fake detector source and corrected real data do. The reference file (coda_magic_999999_00006299.hdf) numbers event_id differently; that is a producer-side bug to fix upstream and is intentionally not worked around here, so replaying that specific file leaves the polarization bank empty.

Status / draft

Draft because the cylinder-mantle projector now takes an axis and depends on the essreduce generalize-cylinder-projection change being released. The logical voxel layout (fold dimension names and order) is provisional pending the hardware numbering convention, and monitors are deferred since the reference file contains none.

Test plan

  • Unit tests for the OFF→offset geometry derivation, the logical views, and the projection roundtrip.
  • Run the dashboard against the fake and confirm both banks show counts in the projection and the wire/strip views.

SimonHeybrock and others added 6 commits June 18, 2026 11:39
Register a new `magic` instrument with its two detector banks and the two
geometry-free logical detector views (wire and strip), mirroring DREAM. The
views fold the raw per-voxel data into the logical structure and reduce over
the strip / remaining dimensions respectively; no physical geometry is needed,
so detector_number arrays are supplied directly and no NeXus geometry file is
required.

The logical voxel layout (dimension names and nesting order) is provisional:
only the per-bank voxel counts are confirmed (491520 and 131072). The fold
order can be adjusted once the hardware numbering convention is known.

Monitors and the cylinder-Y projection are deferred; the latter requires an
upstream essreduce addition (the existing cylinder projection is hardcoded to
the z axis).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Register the cylinder-mantle projection for the two MAGIC banks, which are
vertical (Y-axis) cylinders resembling the DREAM mantle rotated onto Y.

Pixel positions come from a geometry file. The MAGIC NeXus files carry only a
per-voxel NXoff_geometry pixel_shape and no [xyz]_pixel_offset, which the
essreduce position calculation requires. Rather than teach the runtime to read
OFF geometry, make-geometry-nexus gains an --off-active-face option that derives
[xyz]_pixel_offset from the voxel vertex centroids (only one radial face is the
active surface, so a single face is used) and drops the bulky mesh. The result
loads through the standard geometry path with no instrument-specific workaround.

The cylinder-mantle projector now accepts the axis ('y' or 'z'), so this depends
on the essreduce generalize-cylinder-projection change.

Event routing needs a temporary fix: the current event producer numbers
event_id in a global active-channel space that does not line up with
detector_number (bank B is offset by 245760, and bank A's active channels are
half its voxels). A per-detector event_id offset, applied before pixel grouping,
brings the ids into range; it is marked for removal once the producer is fixed.

The geometry file still has to be generated, uploaded to the geometry release,
and added to the registry; until then the projection roundtrip test is skipped.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Upload the derived MAGIC geometry artifact to the geometry release and add it to
the registry, so the cylinder-Y projection resolves its pixel positions. The
projection roundtrip test no longer needs to be skipped.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The per-bank event_id offset only matched the buggy event_id numbering in the
CODA reference file. It broke the fake detector source, whose event_id is drawn
from the detector_number range (so the +245760 offset pushed bank B out of range
and dropped all its events), and it would likewise break real data once the
producer is fixed.

Assume event_id lies within the detector_number range, as the fake and corrected
real data do. The reference file's mismatched event_id is a producer bug to be
fixed upstream, not worked around here. Remove the now-unused event_id offset
plumbing from GroupByPixel and the instrument configuration.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The coda_magic geometry file describes detector_a as 245760 voxels, a
segment of a vertical cylinder: 32 depth wires, 128 vertical strips, 60
azimuthal segments, with detector_number running C-order (segment
fastest, wire slowest). The logical view configured a counter:2 axis
(product 491520, double the voxel count) and the reverse nesting order.

Drop the counter axis and reorder the fold sizes to reproduce the
geometry layout. The polarization bank (detector_b) has no geometry file
and is left as a provisional placeholder.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@SimonHeybrock SimonHeybrock force-pushed the 968-magic-instrument branch from bee6280 to 42ec338 Compare June 18, 2026 11:41
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