niess¶
Neutron instruments of the European Spallation Source, described once as calibrated Python objects, and emitted as whatever a downstream tool needs.
A McStas .instr file is a flat list of numbers. It says a guide is 2 metres long and
sits 1.5 metres from the moderator, but not that the 1.5 came from a survey, nor how to
move the guide without editing three other lines. It also says nothing a NeXus file
needs. niess keeps the calibration — measured quantities with units, positions
chained rather than repeated — and derives the rest:
flowchart LR
C[calibration<br/>scipp Variables] --> N[niess objects]
N --> M[McStas .instr]
N --> X[ESS NeXus<br/>Structure JSON]
N --> S[CAD / STEP]
Install¶
Two ways in¶
-
I have an instrument to describe
Turn a McStas model into a calibration-friendly submodule, or start a new one.
-
I have an instrument and need NeXus
Convert a niess instrument to ESS NeXus Structure JSON.
In sixty seconds¶
from niess.bifrost import Primary, Tank
from niess.bifrost.parameters import primary_parameters, tank_parameters
from niess.instrument import Instrument, Mount
from niess.nexus import to_nexus_structure
from niess.nexus.bifrost import BIFROST_REGISTRY
bifrost = Instrument(name='bifrost', origin='sample_origin', parts=(
Mount(name='primary', content=Primary.from_calibration(primary_parameters())),
Mount(name='tank', content=Tank.from_calibration(tank_parameters()),
relative_to='sample_origin'),
))
structure = to_nexus_structure(bifrost, registry=BIFROST_REGISTRY)
BIFROST is the instrument that exists today; niess.teaching is a small worked example
written to be read, and is the subject of the guides.
Where to go next¶
- Install and first instrument — build and convert something end to end.
- Core concepts — components, sections, calibration and provenance, in one read.
- Components — every class, and the McStas component it emits.