Hey All,
I am having a problem running rockstar with yt. I am updating a python 2 code that was used to run the same simulations I am running, but am getting 2 errors when running it. The first error occurs in this section of code:
if MPI.COMM_WORLD.Get_rank()==0:
print()
print('Beginning Rockstar analysis in ', sim_dir)
print('Placing output in ', out_dir)
# Generate data series
snap_base = sim_dir+ '/' + snap_base + '*'
ts = yt.DatasetSeries(snap_base)
if len(ts) > 1:
first_snap = ts[0]
last_snap = ts[-1]
if MPI.COMM_WORLD.Get_rank()==0:
print('first snapshot: ', first_snap.basename)
print('last snapshot: ', last_snap.basename)
else:
last_snap = ts[0]
if MPI.COMM_WORLD.Get_rank()==0:
print('snapshot: ', last_snap.basename)
# Create particle union if needed
particle_type = particle_types[0]
ad = last_snap.all_data()
particle_masses = yt.np.unique(ad[(particle_type, 'particle_mass')].in_units('Msun/h'))
total_particles = ad.quantities.total_quantity((particle_type, "particle_ones"))
if MPI.COMM_WORLD.Get_rank()==0:
print('Using particle(s) ', particle_types, ' with mass(es) ', particle_masses)
print()
When the script gets to the total_particles = ad.quantities...., I get this error:
File "./runrockstar.py", line 269, in <module>
num_readers=args['num_readers'])
File "./runrockstar.py", line 149, in run_rockstar
particle_masses = yt.np.unique(ad[(particle_type, 'particle_mass')].in_units('Msun/h'))
File "/home1/sflarkin/build/yt-conda/src/yt-git/yt/data_objects/data_containers.py", line 282, in __getitem__
self.get_data(f)
File "/home1/sflarkin/build/yt-conda/src/yt-git/yt/data_objects/data_containers.py", line 1334, in get_data
particles, self, self._current_chunk)
File "/home1/sflarkin/build/yt-conda/src/yt-git/yt/geometry/geometry_handler.py", line 227, in _read_particle_fields
fields_to_read)
File "/home1/sflarkin/build/yt-conda/src/yt-git/yt/utilities/io_handler.py", line 199, in _read_particle_selection
psize = self._count_particles_chunks(chunks, ptf, selector)
File "/home1/sflarkin/build/yt-conda/src/yt-git/yt/utilities/io_handler.py", line 170, in _count_particles_chunks
for ptype, (x, y, z) in self._read_particle_coords(chunks, ptf):
File "/home1/sflarkin/build/yt-conda/src/yt-git/yt/frontends/art/io.py", line 102, in _read_particle_coords
x = self._get_field((ptype, "particle_position_x"))
File "/home1/sflarkin/build/yt-conda/src/yt-git/yt/frontends/art/io.py", line 139, in _get_field
tr[field] = rp([ax])[0]/dd - off
File "/home1/sflarkin/build/yt-conda/src/yt-git/yt/frontends/art/io.py", line 134, in <lambda>
idxb=idxb, fields=ax)
File "/home1/sflarkin/build/yt-conda/src/yt-git/yt/frontends/art/io.py", line 458, in read_particles
ranges = get_ranges(skip, count, field, **kwargs)
File "/home1/sflarkin/build/yt-conda/src/yt-git/yt/frontends/art/io.py", line 425, in get_ranges
for page in range(num_pages):
P001 yt : [ERROR ] 2018-07-17 15:24:08,955 TypeError: 'float' object cannot be interpreted as an integer
P001 yt : [ERROR ] 2018-07-17 15:24:08,955 Error occured on rank 1.
I am not sure why this is occuring, and if I am missing something obvious.
The other error occurs when attempting to clear the cache, done as follows:
if len(ts) > 1 : del first_snap
del last_snap
_cached_datasets.clear()
but _cached_datasets is said as not defined, despite being called by an earlier call of:
from yt.data_objects.static_output import _cached_datasets
I am wondering if this is the correct way to go about that?
Thanks