-
Notifications
You must be signed in to change notification settings - Fork 276
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
[ENH] Read Rockstar members #4661
base: main
Are you sure you want to change the base?
Conversation
ba1bea4
to
da24357
Compare
da24357
to
fe736a5
Compare
fe736a5
to
f3f7878
Compare
@yt-fido test this please |
@cphyc I think adjustments are needed to pass the new test |
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.
I'm really glad someone finally had the courage to implement this. Can you also add a section in the Rockstar frontend docs in doc/source/examining/loading_data.rst
?
f3f7878
to
dc614e1
Compare
I'm not sure where the conflicts came from, but the rest looked good to me. If they can be cleared up, I think this is ready to be merged. |
dc614e1
to
012b4c1
Compare
@yt-fido test this please |
@yt-fido test this please |
We have one failing test to deal with |
I cannot reproduce the failing test locally with a Python 3.10 install. Is there a way to get more information? |
Weird; I have tried locally and cannot reproduce the error on 3.9, 3.10 or 3.11. Here's the code I tried import yt
ds = yt.load_sample("rockstar_halos/halos_0.0.bin")
for halo_id, Npart in zip(
ds.r["halos", "particle_identifier"],
ds.r["halos", "num_p"],
):
print(halo_id)
halo = ds.halo("halos", halo_id)
assert halo is not None
# Try accessing properties
halo.position
halo.velocity
halo.mass
# Make sure we can access the member particles
assert len(halo.member_ids) == Npart This should be the code of the failing test, unless I am mistaken. |
9a0023c
to
0fce073
Compare
@yt-fido test this please. |
@cphyc the test server is dead, see discussion on Slack. |
@yt-fido test this please |
Well, I am officially puzzled. |
256 is suspiciously reminiscent of a field delimiter. I would guess that there is some location where a read is happening of 8 bytes on one and 4 bytes on the other, possibly due to some oddity in the way that dtypes are determined. I would not have thought this possible given the architectures but I'm also puzzled and grasping at things. Perhaps it would be good to catch the error, and then print out the results of tell or something, to make sure we're at the same place. |
@yt-fido test this please |
499bb71
to
78baf36
Compare
Here's the final stdout:
And here's the relevant part of the assertion:
And then it fails with 2171 != 256. So it is getting a length of 2171 for the halo member ids, but it has read that NPart is 256. NPart is read here: halos = np.fromfile(f, dtype=io._halo_dt, count=pcount)
self._member_offset = f.tell()
self._ids_halos = list(halos["particle_identifier"])
self._Npart = halos["num_p"] The location in the file for both is the same -- 78664 -- which leads me to believe that the problem isn't in the particle reading, but rather in the setting of NPart. A few other comments about this -- 2427 is exactly 256 higher than 2171, and 2171 doesn't show up anywhere in the halo sizes. This suggests to me that there's some subtraction going on somewhere ... but maybe not. |
@cached_property | ||
def ihalo(self): | ||
halo_id = self.particle_identifier | ||
halo_ids = list(self.halo_ds.r["halos", "particle_identifier"].astype(int)) |
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.
can you promote this explicitly to 'i8'?
@yt-fido test this please |
@yt-fido Test this please |
I made a bit of progress - it seems that the checksum of the data is not the same on fido as it is on my computer:
I should note that the local data was downloaded through |
cbf3a0a
to
635338c
Compare
I am quite confident is that the test data isn't the same as the one online. @Xarthisius would it be possible to make sure that the dataset on jenkins is the same as the one obtained when using I have tested locally and it works like a charm. |
@yt-fido Test this please |
3b14587
to
88425d5
Compare
adding the "enhancement" label just to make Mergeable Bot happy |
PR Summary
This allow to read member data from Rockstar catalogues.
PR Checklist