silx-kit / silx

silx toolkit
http://www.silx.org/doc/silx/latest/
MIT License
129 stars 73 forks source link

Mask convention: 0 or 1 for masked value #3217

Closed t20100 closed 3 years ago

t20100 commented 3 years ago

Not sure we can do anything in silx, but I still open it for discussion. Apparently bliss is using the opposite convention that is used in silx regarding masks. This forces users to invert the silx mask to be used.

kif commented 3 years ago

numpy.logical_not is their friend then. We can need multiple||overlapping masks

vallsv commented 3 years ago

That's about GUI and file. In fact people dont know anything about the way it is stored, nor read.

And Lima uses the reverse of silx.

Is that normalized in Nexus?

vallsv commented 3 years ago

BTW, thinking out loud, as it's about EDF mask, we could write the way the mask have to be read in the header.

So what Lima could read silx files properly. I can take care of it.

What do you think?

vasole commented 3 years ago

If an array denotes a mask, typically 0 is not masked and any other value allows to specify different levels of masks.

vasole commented 3 years ago

If 0 is masked, then you are not in a good situation.

vasole commented 3 years ago

Are you confusing mask with pixel_mask_applied?

https://manual.nexusformat.org/classes/base_classes/NXdetector.html#nxdetector

vasole commented 3 years ago

To me is crystal clear that 0 is a non-masked value. Dectris is following NeXus too. That should settle the question.

vallsv commented 3 years ago

You remember me this pixel_mask specification.

My proposal when we save mask as EDF is only to write something like source=silx or source=silx-mask in the header (or application= whatever). To me it is enough to know how to deal with the file data when it have to be read again. We don't have to change our workflow.

vallsv commented 3 years ago

I let you close it if you think #3310 is enough.

vallsv commented 3 years ago

Here is a MR on Lima to be able to properly read silx 0.14 masks without doing anything more: https://gitlab.esrf.fr/limagroup/Lima-tango-python/-/merge_requests/58

t20100 commented 3 years ago

closed by PR #3310 on branch 0.14