-
Notifications
You must be signed in to change notification settings - Fork 18
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
NXmx: convert int64
to int32
if bit_depth_readout<=32
#624
Comments
We have a couple of choices:
The first is the most correct, the latter is probably the most useful. Personally I would trust the If it claims |
That change was introduced in fe5b43e explicitly stating to handle int/long issues. I agree that this is inconsistent, but if it isn't to handle int/long then we should never be doing that here and should remove the inconsistency by refusing to convert it.
"typically" = in this one specific internal case that you are looking at now. In literally every other scenario we trust the data more than a random hdf5 attribute that could have been written from fixed, known metadata data. If you want to do this then it needs to:
I would much prefer that If we have a specific error in the VDS creation/metadata then we should a) fix the beamline, and b) handle this in a Format subclass instead of planting landmines that will come back to cause errors in the future. |
For the record (a) is in progress and I have a log of sympathy for (b) as a viewpoint - but this will involve adding some tunnels to pass the corrected information down to where this is actually used. We can scan more cheaply but in a system dependent case, which does align well with your suggestion to do this locally in the format class. |
FWIW even with data from last run collected in 16-bit mode the VDS data type is inconsistent with the underyling data type and
|
When it comes to determining the bit-depth of a nexus dataset there are two sources of "truth":
dtyp
e of the numpy array returned for the VDS in/entry/data/data
/entry/instrument/detector/bit_depth_readout
The current behaviour if
dtype==int64
butbit_depth_readout=32
is to convertint64
->int32
:dxtbx/src/dxtbx/nexus/__init__.py
Lines 509 to 523 in b864c23
If however
dtype==int64
butbit_depth_readout=16
then we throw our hands up in despair and refuse to touch it. I propose that this is inconsistent and we should also convert toint32
in this case, i.e. we declare that we trust the value ofbit_depth_readout
(which typically comes directly from the detector metadata) more than thedtype
of the array (which may come from DAQ software writing the nexus file).The text was updated successfully, but these errors were encountered: