Repository navigation
Conversation
RosettaSciIO's quantumdetector reader rejects pathlib.Path, so the rsciio readers now pass os.fspath(file_path). MIB data comes back as a big-endian view with a flipped axis, which torch cannot wrap; the selected array is now converted to native byte order without negative strides at import. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
maclariz
left a comment
There was a problem hiding this comment.
Seems good to me. The use of fspath and a couple of other features is better and more compact than the version running in my own branch on my laptop that I've been using all day with yesterday's mib files. But the core concepts are the same. I suspect it is simply that your version of Claude model is slightly higher and newer than the one I was using and knows a few extra tricks for more compact coding.
I just noted something in a test that there seemed to be a 384 byte padding in the test file. This is exactly right for a Merlin 1R - single Medipix3 chip. It is different for a Merlin 4R - quad chip arrangement, which has a 784 byte padding. I have some of these in data from E02 at ePSIC, but cannot access this data today to test since it the server that data is on went down and I need IT support to bring it back up. As such, I'd be happy to accept that it will work with single-chip 256x256 pixel data, but would have to test later with 512x512 or 515x515 data from the quad.
|
Thanks Ian. rosettasciio reads the header size from the third header field, so it handles both the 384-byte single-chip header and the 768-byte quad header. Our changes only convert the path to a string and the returned array to native byte order, so they apply to every MIB layout. I checked this branch on synthetic quad files with 768-byte headers: 512x512 at 12-bit, 515x515 at 24-bit, and 512x512 at 6-bit. All of them load from a Path and match the written frames after torch.from_numpy. A check on your E02 quad data once the server is back would still be worthwhile, since real quad headers contain more fields than my synthetic ones. |
|
Fails to install with pip due to an error with h5py installation:
|
Fixes two problems with loading Quantum Detectors
.mibfiles through RosettaSciIO.pathlib.Pathwas rejected. The quantumdetector reader only acceptsstror a bytes buffer.read_4dstem,read_2dandread_3d_spectroscopynow passos.fspath(file_path)to the RosettaSciIO reader. This change is still harmless if RosettaSciIO fixes the reader upstream.One test in
tests/core/test_file_readers.pywrites a small 16-bit MIB file, reads it with aPath, and checks thattorch.from_numpygives back the frames. Before this fix the test fails with thePath, and with astrit fails at the torch conversion.🤖 Generated with Claude Code