-
Notifications
You must be signed in to change notification settings - Fork 280
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
Particle IDs of Gadget HDF5-style data are converted from integers to floats #4995
Comments
Hi, and welcome to yt! Thanks for opening your first issue. We have an issue template that helps us to gather relevant information to help diagnosing and fixing the issue. |
I commented over in the unyt issue, but I do think that this is more of a yt issue than a unyt issue. IMO it'd make sense to handle integer, dimensionless quantities (like |
The issue goes much deeper than this: many Cython routines in yt expect |
I don't think it'd be too bad to preserve types just for read/selection operations though. Was just playing around with a possible implementation and it seems to work (can push up a draft in a bit) -- any operations beyond read/selection operations have implicit or explicit type conversions on the call to the cython routines. |
I had a look into the draft and at least from a user perspective, this seems like what I was expecting. Maybe I can add a bit more context how/why I encountered this issue and answering
My simulation contains tracer particles and I was thinking about how to writing routines for/extending yt to work with them. The tracer particles are a separate particle type in the hdf5 file. The group has two datasets In this context, the matching operations on floats that represent integers would probably work because the number of digits in the largest particle id is less than the accuracy limit of floats. Additionally, there are no other mathematical operations on the ids, so rounding should not occur and an equality test of two float ids probably works, too. However, this is not guaranteed. |
Indeed it's not.
I missed that. Then I agree it makes sense to at least explore a simple patch such as #4996. Let us know when it's ready for review ! |
added a bunch of tests and I'm not seeing any issues over in #4996 , just marked it as ready to review |
I'd like to add a thanks to @arkordt for such a detailed dig in to this issue! |
Bug report
Bug summary
An arepo snapshot whose on-disk ParticleIDs data type is uint32 or uint64 is converted to float32 or float64, respectively.
The conversion can be traced back to two locations. The first conversion is in yt/utilities/io_handler.py:209, the second conversion occurs in unyt/array.py:712 that is called from yt/data_objects/selection_objects/data_selection_objects.py:217. If both conversions are commented out, the expected output is produced.
I also submitted an issue to unyt because I am not sure where it would be better to avoid the type conversion.
Code for reproduction
yt-test-data
should be the path where the YT test data is stored.Actual outcome
Expected outcome
Version Information
yt was installed via conda (version 4.3.1) or from source (main branch) for testing and bug tracing purposes.
The text was updated successfully, but these errors were encountered: