-
Couldn't load subscription status.
- Fork 3
Save detector masks #180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save detector masks #180
Conversation
| import scipp as sc | ||
|
|
||
|
|
||
| def save_detector_masks( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So is saving masks on detector pixels the main application for this?
I guess you usually don't have a semi-permanent and re-usable mask on a time log because that is most often very run-dependent.
Could you have a wavelength mask that is always the same on some intrument? (e.g. masking some Bragg peaks from the guide or sample environment?)
I'm just asking if we need a different function name, or additional functions to mask other things than detector pixels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function should work fine for saving tof (or wavelength) masks of detectors. One thing that people may want to do is saving monitor masks, which would work in the same way (but set NX_class='NXmonitor'). If we had attrs we could even do that automatically. Until then we will need to make a separate function.
| with h5py.File(filename, "w-") as f: | ||
| entry = f.require_group("entry") | ||
| entry.attrs["NX_class"] = "NXentry" | ||
| if entry_metadata: | ||
| for key, value in entry_metadata.items(): | ||
| entry[key] = value | ||
| instrument = entry.require_group("instrument") | ||
| instrument.attrs["NX_class"] = "NXinstrument" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use scippnexus to do some of the work for us instead of using h5py directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, no. In such simple cases it would actually be more code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it still true that the required scippnexus features are not released yet? CI appears to be passing now.
It has been released last week. |
Related to https://confluence.esss.lu.se/display/DAM/DREAM+-+Save+mask+to+file. #176 will later use this to save masks created by users.
Note that this depends on ScippNexus features that have not been released yet, expect tests to fail on CI for now.