Skip to content

[essreduce] Fix order of detector name vs mask name when saving to nexus files - #874

Open
nvaytet wants to merge 1 commit into
mainfrom
fix-detector-mask-name-order
Open

nvaytet wants to merge 1 commit into
mainfrom
fix-detector-mask-name-order

Conversation

@nvaytet

@nvaytet nvaytet commented Nov 13, 2026

Copy link
Copy Markdown
Member

The order in which masks are saved in the nexus files is backwards: https://github.com/scipp/ess/blob/main/packages/essreduce/src/ess/reduce/masking.py#L172

It’s getting name from the top level, which should be 'loki_detector_0', but then creates the NXdetector using bank which is actually 'bad_tubes' in my case.

Masks should have this structure to start with:
masks = {'loki_detector_0': {'bad_tubes': sc.array()}}
Screenshot_20261113_141942

This is how the ADR reads:

/                                  attributes file_time, creator and creator_version
/entry                             NXentry
    valid_from                     "2026-11-01T00:00:00Z", not read by workflows
    instrument                     NXinstrument
        name                       "LOKI"
        loki_detector_0            NXdetector
            masks                  NXcollection
                broken_tubes       uint8, HDF5 dimension labels ("tube",)
                beamstop           uint8, HDF5 dimension labels ("layer", "tube", "straw")
        loki_detector_1            NXdetector
            masks                  NXcollection
                broken_tubes       ...

The result in the nexus file is that the NXdetector is called bad_tubes.
Screenshot_20261113_142110

In this PR we invert the logic and save the masks as intended.

@nvaytet nvaytet added the bug Something isn't working label Nov 13, 2026
@github-actions github-actions Bot added essreduce Issues for essreduce. esssans Issues for esssans. labels Nov 13, 2026
@nvaytet
nvaytet requested a review from jl-wynen November 13, 2026 13:57
@nvaytet nvaytet assigned jl-wynen and unassigned jl-wynen Nov 13, 2026

@jl-wynen jl-wynen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems like we need to not approve code that we didn't read thoroughly

@nvaytet
nvaytet added this pull request to the merge queue Nov 13, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 13, 2026

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

bug Something isn't working essreduce Issues for essreduce. esssans Issues for esssans.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants