-
Notifications
You must be signed in to change notification settings - Fork 81
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
Adaptahop support improvement #551
Conversation
Looks good! I just had one query flagged inline... |
nose/adaptahop_test.py
Outdated
# - obtained from get_group_array masking | ||
# are the same (in term of sets) | ||
assert len(np.setdiff1d(iord[mask], h[halo_id]['iord'])) == 0 |
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.
Should you also be checking the reverse? I think setdiff1d
is asymmetric
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.
This is now done.
pynbody/halo/adaptahop.py
Outdated
for halo_id, halo in self._halos.items(): | ||
fpu.seek(halo.properties['file_offset']) | ||
fpu.skip(1) # number of particles | ||
particle_ids = fpu.read_vector('i') |
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.
After #584 is merged, this should be fixed to take into account cases where particle_ids
is not sorted and/or is not a 32bit integer.
910f512
to
4d760de
Compare
@apontzen do you think this is ready to go? |
Is there any way to test this? Happy to add a small file to the testdata tar if needed. |
I can generate one of about ~50Mio (snapshot + simulation), would that suffice? |
Sounds good, thank you! |
We can use the following halo catalog (very minimalistic, only two halos and linked to the |
Thanks! |
This PR improves the support of adaptahop in pynbody (see #546 for the original PR).
It changes the following behaviour:
np.searchsorted
function. This was used to generate anIndexedSubSnap
from a list of particle ids,iord_argsort
which is the result ofnp.argsort(sim['iord'])
,get_group_array
for adaptahop, to make it usable with https://github.com/pynbody/tangos (see TypeError error when linking tangos#112).