I have not used Gadget, but ran into a similar problem recently and it was because of the PartType0 definition (basically).  Do you have a field "particle_type" or something like that?  I would print that as well and see if you are finding particles that are not "PartType0" within your sphere.  


Dr. Stephanie Tonnesen
Associate Research Scientist
CCA, Flatiron Institute
New York, NY


On Tue, Mar 30, 2021 at 5:10 PM <h.fathie@gmail.com> wrote:
Dear all,

I have read a Gadget snapshot as follows:
ds = yt.load('../GadgetDiskGalaxy/snapshot_200.hdf5')
partID = ad[('PartType0', 'ParticleIDs')]

I then defined a sphere around a Type0 particle using the following lines of code:
j = 9000
sp = ds.sphere([px[j],py[j],pz[j]],(20.0,'kpc'))

When I issue the following command:
I get:

[ 841624.  890649.  841457.  890473.  865599.  865772. 6258099. 5752659.
 5752660. 5777940. 6229883. 5803543.] dimensionless

This shows that there are 12 particles inside the sphere.

I checked and found that the following IDs exist in the 'partID' array:
841624.  890649.  841457.  890473.  865599.  865772.

but these IDs (see below) do NOT exist in the 'partID' array:
6258099. 5752659. 5752660. 5777940. 6229883. 5803543
So the IDs of these 6 particles inside the sphere do not exist in the 'partID' array.

How is this possible since 'partID' (as defined above) must contain the IDs of all
Type0 particles ?

I would be grateful if someone could help me with this issue.
Best regards,
yt-users mailing list -- yt-users@python.org
To unsubscribe send an email to yt-users-leave@python.org
Member address: stonnes@gmail.com