scipp / scippnexus

h5py-like utility for NeXus files with seamless scipp integration
https://scipp.github.io/scippnexus/
BSD 3-Clause "New" or "Revised" License
3 stars 3 forks source link

Read `pixel_masks` from NXdetector #166

Closed jokasimr closed 9 months ago

jokasimr commented 10 months ago

Fixes #157.

~This is still a very rough draft.~ ~I need a nexus file with a pixel mask to experiment with.~

The transformation from bitmask to dictionary of masks is tested. But actually reading masks from a nexus file is still untested.

SimonHeybrock commented 10 months ago

We should also decide how to behave when one of the "undefined" bits is set? Should it raise? Save to mask an an integer dtype-mask (which won't work in operations)? Use the bit offset as mask name?

SimonHeybrock commented 10 months ago

How do we determine which bits are in use? If it is set to 0 in the entire array?

There is a number of ways to do this. One could use min and max and test all the values in between. Or use group with some fake values and the mask as a grouping coord. Or some NumPy function. Would need to test which is most performant for up to about 10 million pixels (though we should also try up to 100 million, I think).