Comments (4)
We have a couple of choices:
- refuse to consume any data where VDS data type != underlying data type
- define a hierarchy of trustworthiness which is well documented
The first is the most correct, the latter is probably the most useful. Personally I would trust the bit_depth_readout
in preference to the VDS since the former is actually created by the detector. We could also look for a majority / minority opinion by checking the underlying data type of the actual data files.
If it claims (u)int64_t
and there is nothing in the file to indicate that this is wrong we should refuse to process.
from dxtbx.
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.
e, i.e. we declare that we trust the value of bit_depth_readout (which typically comes directly from the detector metadata)
since the former is actually created by the detector.
"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:
- Explicitly scan the entire data array to verify that it is a safe conversion
- Not be in a function called "get_raw_data" in which you are now adding a second implicit copy and now three scans of the data (in order to guarantee safety)
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.
from dxtbx.
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.
e, i.e. we declare that we trust the value of bit_depth_readout (which typically comes directly from the detector metadata)
since the former is actually created by the detector.
"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:
- Explicitly scan the entire data array to verify that it is a safe conversion
- Not be in a function called "get_raw_data" in which you are now adding a second implicit copy and now three scans of the data (in order to guarantee safety)
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.
from dxtbx.
- refuse to consume any data where VDS data type != underlying data type
FWIW even with data from last run collected in 16-bit mode the VDS data type is inconsistent with the underyling data type and bit_depth_readout
:
>>> import hdf5plugin
>>> import h5py
>>> f = h5py.File("/dls/i03/data/2023/cm33866-1/TestProteinaseK/protk_16/protk_16_94.nxs")
>>> f["/entry/data/data"].dtype
dtype('int32')
>>> f["/entry/instrument/detector/bit_depth_readout"][()]
array([16])
>>> f["/entry/data/data_000001"].dtype
dtype('uint16')
from dxtbx.
Related Issues (20)
- `dxtbx.serialize.filename.resolve_path` fails on Windows for data collected on a POSIX platform HOT 4
- Rigaku Saturn format assumes single-axis diffractometer even when that is false HOT 3
- `FormatCBFMiniPilatus` agrees to process but fails on Stoe lab-based data
- Imageset slicing is broken by batch offset HOT 12
- Wrong geometry from FullCBFs from Bruker D8 Venture HOT 2
- Reporting a vulnerability HOT 1
- Handling image templates that don't use zero-padding HOT 15
- Loading large experiment lists has become >> 10x slower in recent versions.
- Problem with Registry.py HOT 4
- Imageset slicing issue following scan changes.
- Invalid polygon geometry (21) in ... dynamically masked I03 data
- Use module_offset in multi-panel nexus
- EIGER X 16M at SPring-8 BL41XU HOT 9
- [3.17] seems incompatible with Python 3.12 HOT 5
- [3.17] error: βuint32_tβ does not name a type HOT 2
- [3.17] : DeprecationWarning: SelectableGroups dict interface is deprecated.
- [3.17] PytestUnknownMarkWarning: Unknown pytest.mark.regression
- Support for Rigaku Arc detectors HOT 5
- Generalise support for dynamic shadowing in dxtbx HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dxtbx.