... | ... | @@ -13,21 +13,25 @@ with logger.Reader(basename, use_cache=False) as f: |
|
|
# to quickly access the records next time.
|
|
|
|
|
|
# Read some fields for some particles.
|
|
|
positions, velocities = f.getParticleData(
|
|
|
positions, velocities = f.get_particle_data(
|
|
|
fields=["Coordinates", "Velocities"], time=time, ids=particle_ids)
|
|
|
|
|
|
# Same as before, but we use all the ids from the index file.
|
|
|
positions, velocities = logger.getParticleData(
|
|
|
positions, velocities = logger.get_particle_data(
|
|
|
fields=["Coordinates", "Velocities"], time=time, ids=None)
|
|
|
|
|
|
# Same as before, but we read all the fields.
|
|
|
# here we should be fast thanks to the cache.
|
|
|
parts = logger.loadSnapshotAtTime(time)
|
|
|
parts = logger.load_snapshot_at_time(time)
|
|
|
|
|
|
# Easy solution
|
|
|
print(parts["Coordinates"])
|
|
|
# Josh's solution
|
|
|
print(parts.gas.coordinates)
|
|
|
|
|
|
# Move a set of particles forward in time.
|
|
|
# here we should be fast thanks to the cache.
|
|
|
positions = f.getParticleData(fields=["Coordinates"],
|
|
|
positions = f.get_particle_data(fields=["Coordinates"],
|
|
|
time=time + 1, ids=None)
|
|
|
|
|
|
# here we close the logfile and cleanup everything
|
... | ... | |