-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add vector type support #330
Conversation
Here's the relevant CI failure:
This occurs in the linking phase. @simonrw any ideas? |
Hey thanks very much for this addition! I haven't had a chance to look in detail but I will try to investigate as soon as I can. |
Is the 32/64 bit conditionals really required for this PR? Perhaps we could split out those into a separate PR since they are causing the build to break. We can then take the two conceptual changes separately? |
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.
Unfortunately I don't have much time to investigate myself at the moment why the CI is failing, but I suspect it is related to the removal of the conditional compilation for integer types. I don't fully see how they are related to this PR so it would be good to remove this change.
I also have a couple of more significant comments that I'd like addressing before I continue to review the rest if that's ok?
Thanks again for submitting this clearly very competent PR to this crate, I hope that you are finding the crate useful, and am keen to hear more from users!
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
|
Revised the patches:
And I figured out something fascinating about the test failure—the function Now performing my integer simplification (removing conditionals, referring only to Thanks for your good review. IMO, you stopped at the correct depth. Please let me know if there's anything else to address. |
At the one week mark, I send the gentlest of pings. I believe I've addressed the previous concerns and this PR is much tighter than before. Hopefully quick to review and merge, whenever you next review PRs. |
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.
Sorry for the delay in reviews, and thanks for the "gentlest of pings"! I think this is a very nice way of reminding a maintainer of a wanted review!
I only have a couple of minor points, but in general I trust that this implementation works correctly. You have created a comprehensive read/write round-trip test suite for different data types, and the implementation seems straightforward.
In the future, it might be nice to create our own wrapper type around returning these flat arrays that allows for 2d access to the resulting data, or we commit to using ndarray
under the hood. But I think it's ok to ask the user to manage fetching the correct data element on their side for now.
Speaking of ndarray
: a nice follow up would be to ensure that this implementation works with the ndarray
feature.
Since these suggestions are so minor, I will push some commits myself to clean up the changes if that's ok.
Thanks again for this contribution, and I'll try to get a release out for you ASAP
Thanks for the collaboration. I'm happy for you to do the final commits with the fixes you outlined above. I definitely opted consciously to stay 1D for now, figuring that one can easily hand the buffer to ndarray and reshape it. I would strongly advise against any multi-dimensional abstraction, lest you accidentally trip and reimplement ndarray. The complexity is neatly separable. But indeed, I didn't test for compatibility with the And if I'm honest, I am not anticipating further contributions. I actually did this patch as part of an art project—I'm mapping CMB anisotropies (don't forget the dipole subtraction) to a triangulated surface mesh for 3D printing. Anyway, thanks for providing most of the FITS support that I needed and being receptive to my small augmentation. |
Thanks again for adding this feature, and for being patient with my review.
👍
I think it's only 2D thats required for reading a repeat col, so the feature would be quite constrained, but yes I will wait for someone to ask for this feature.
Personally that's a shame. This implementation is clearly competant and I am crying out for users/collaborators! I am no longer an astronomer so I can't really drive this project well enough.
Wow sounds really cool! |
## 🤖 New release * `fitsio`: 0.21.4 -> 0.21.5 <details><summary><i><b>Changelog</b></i></summary><p> ## `fitsio` <blockquote> ## [0.21.5](fitsio-v0.21.4...fitsio-v0.21.5) - 2024-08-06 ### Added - add vector type support ([#330](#330)) ### Other - *(deps)* update ndarray requirement from 0.15.0 to 0.16.0 in /fitsio ([#347](#347)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/MarcoIeni/release-plz/).
Thanks for the kind words. I left an astrophysics postdoc in 2012 and stayed rather less involved than you seem to have! You're doing great work here. Thank you. |
Add vector type support (ex: '100E') and fix bit handling
32X
) and strings (20A
) are the most common examples, but others exist in the wild. My example is from Planck Legacy Archives → Maps → CMB Maps → Uncheck "Only legacy products" → SEVEM → Click to download the single row (full mission); this FITS file contains one row, which isTFORM1
of201326592E
, which happens to be a HEALPix map withNSIDE
of 4096.reads_col_impl
andwrites_col_impl
;int
is 32 bits andlong long
is consistently 64 bits on all machines and platforms since ~2000. Onlylong
is weird and special.Contribution checklist:
cargo test
passes on my M1 Mac and on an x86_64 Linux machine using the provided Docker environment. I'm afraid I don't have any 32-bit or Windows environments available for testing.rustfmt
changes nothing.full_example.rs
, astest_vector_datatypes.rs
shows how to use vector types, but I am happy to do so upon request.