[ESSSANS] LoKI beam-stop mask: NeXus information needed

Abierto
#847 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@SimonHeybrock ya está trabajando en esto.

Desde el 3/11/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

esssans

Split out of #767 (section "1. Beam stop"). This issue tracks what the LoKI NeXus files provide for computing a beam-stop mask, and what is still missing. Update the "Current file" section whenever a new file is checked.

Goal

Mask every detector pixel that is in the shadow of a beam stop, seen from the sample:

s = sample position, p = pixel position, c = beam-stop position (from depends_on chain)
# flat beam stop perpendicular to the beam:
t = (c.z - s.z) / (p.z - s.z)
hit = s + t * (p - s)                 # where the ray sample -> pixel crosses the beam-stop plane
masked = inside(hit - c, beam_stop_outline)

For this we need, per beam stop: its position (time-dependent, from motors) and its shape. Possibly the mask needs to be enlarged for parasitic scattering, but that is a separate concern.

Current file

Checked: coda_loki_999999_00028010.hdf (2026-11-03, ess_nexus_build_info/config_version 0.4.0, config_commit 595996a).

There are five NXbeam_stop groups, beamstop_1 to beamstop_5. Each contains only depends_on. The chain, e.g. for beamstop_1:

/entry/instrument/beamstop_1                                NXbeam_stop
    depends_on -> /entry/instrument/beamstop_y1/value
beamstop_y1/value              NXlog  translation (0,1,0) mm  LOKI-DtBS1:MC-LinZ-01:Mtr.RBV
beamstop_x/value               NXlog  translation (1,0,0) mm  LOKI-DtBS1:MC-LinY-01:Mtr.RBV
beamstop_z/value               NXlog  translation (0,0,1) mm  LOKI-DtBS1:MC-LinX-01:Mtr.RBV
beamstop_z_stage/transformations/offset  translation (0,0,1)  -0.31039 m
detector_carriage/value        NXlog  translation (0,0,1) mm  LOKI-DtCar1:MC-LinX-01:Mtr.RBV
carriage/transformations/distance        translation (0,0,1)   5.05189 m
.

beamstop_<i> uses beamstop_y<i> (LinZ-0<i>), so which motor moves which beam stop is now defined. beamstop_x and beamstop_z are shared by all five.

Notes:

  • EPICS motor names use the engineering convention (z up), NeXus uses the neutron-scattering convention (z along the beam, y up): LinX moves along the beam (NeXus z), LinY horizontally (NeXus x), LinZ vertically (NeXus y). The stream list in #767 uses EPICS names; the NeXus groups for the vertical motors are beamstop_y1..5.
  • The rear bank (loki_detector_0) and the beam stops share the step detector_carriage/value. The duplicated-step problem from #833 does not occur here.
  • scippnexus resolves the chain. With all motors at 0 (as in this file) every beam stop resolves to (0, 0, 4.7415) m.

Missing

  1. Shape. No beam stop has any geometry. Earlier information (#767): one beam stop is chosen per run; most are square, possibly one is circular. Proposal: an NXoff_geometry group in each beamstop_<i>, in the beam stop's local frame (origin = the point the depends_on chain resolves to). If the support arm or wire blocks neutrons, it should be part of the shape (beam_center_finder.py already models an arm for this reason). The NXbeam_stop fields description (circular/rectangular) + size would be a minimal alternative, but cannot describe the arm or a non-square rectangle.
  2. Per-beam-stop offset. All five beam stops resolve to the same point for equal motor positions. If they are mounted at different x or z, each beamstop_<i> needs a static transformation before the motor, e.g.
    beamstop_<i>/depends_on -> beamstop_<i>/transformations/offset -> beamstop_y<i>/value -> ...
    
    If the offsets are really zero, we need confirmation.
  3. Motor zero points and directions. The chain implies: all motors at 0 means the beam-stop center is on the nominal beam axis, 0.31039 m upstream of the carriage reference point. Is that true for LinX-01, LinY-01, and each LinZ-0<i>? Does positive LinZ move up (+y)?
  4. Which beam stop is in the beam. Not needed if (1)-(3) are available: we can project all five and mask the union, which is correct if parked beam stops still shadow the rear bank. Open question: are parked beam stops outside the sample-to-detector cone, or behind shielding? NXbeam_stop also has a status field (in/out) if the file producers prefer to write it.

Open questions for reduction

  • Can a beam stop move during a run? If not, we can use a single position and raise if the motor readback changes.
  • SKADI: not checked yet, no file available.
Lenguaje dominante
Python
Estrellas
3
Forks
6
Merge medio
2 d 13 h
PR fusionados (30 d)
35

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de scipp/ess

Todos los issues de scipp/ess

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.