Skip to content

Read: select the NXentry to read (entry=...), for McStas NeXus scans - #49

Draft
willend wants to merge 1 commit into
mainfrom
entry-parameter
Draft

willend wants to merge 1 commit into
mainfrom
entry-parameter

Conversation

@willend

@willend willend commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

A McStas NeXus scan writes one NXentry per step (entry1, entry2, …) into a single mccode.h5. McStasToX always read entry1, so only the first scan step was accessible.

Read() / Data() and McStasNeXus now take an entry argument. It defaults to "entry1", so existing behaviour is unchanged:

with mcstastox.Read(path, entry="entry2") as d:
    dg = d.export_scipp(source_name="source", sample_name="sample")

entry is used for file validation, the component list, the McStas version, and component lookup (every former hardcoded "entry1").

Motivation

mcplot-plopp (McCode) shows McStasToX event data and will loop over scan entries, stacking events per scan step. Related McCode fix: mccode-dev/McCode#2901, which makes MPI NeXus scans keep every step's events. Before it, only the last entry of an MPI scan was readable.

Testing

  • New tests/entry_test.py: _validate_file accepts entry2 and reports a missing entry by name.
  • On real McStas output (templateSANS_Mantid, 3-step scans over r, a non-MPI one and a 4-rank MPI one with the McCode fix), every entry loads through export_scipp. Event counts match the non-zero-weight events read directly with h5py.
  • Only entry_test.py and mcstas_config_test.py were run locally; the other tests need McStas/mcstasscript, so CI will cover those.

🤖 Generated with Claude Code

A McStas NeXus scan writes one NXentry per step (entry1, entry2, ...) into
one mccode.h5; McStasToX always read entry1. Data(), i.e. Read(), and
McStasNeXus now take entry="entry1" (default unchanged) and use it for
validation, the component list, the McStas version and component lookup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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