yt.frontends.stream.data_structures.load_particles

yt.frontends.stream.data_structures.load_particles(data, length_unit=None, bbox=None, sim_time=0.0, mass_unit=None, time_unit=None, velocity_unit=None, magnetic_unit=None, periodicity=(True, True, True), n_ref=64, over_refine_factor=1, geometry='cartesian')[source]

Load a set of particles into yt as a StreamParticleHandler.

This should allow a collection of particle data to be loaded directly into yt and analyzed as would any others. This comes with several caveats:

  • Units will be incorrect unless the data has already been converted to cgs.
  • Some functions may behave oddly, and parallelism will be disappointing or non-existent in most cases.

This will initialize an Octree of data. Note that fluid fields will not work yet, or possibly ever.

Parameters:

data : dict

This is a dict of numpy arrays, where the keys are the field names. Particles positions must be named “particle_position_x”, “particle_position_y”, “particle_position_z”.

length_unit : float

Conversion factor from simulation length units to centimeters

mass_unit : float

Conversion factor from simulation mass units to grams

time_unit : float

Conversion factor from simulation time units to seconds

velocity_unit : float

Conversion factor from simulation velocity units to cm/s

magnetic_unit : float

Conversion factor from simulation magnetic units to gauss

bbox : array_like (xdim:zdim, LE:RE), optional

Size of computational domain in units of the length_unit

sim_time : float, optional

The simulation time in seconds

periodicity : tuple of booleans

Determines whether the data will be treated as periodic along each axis

n_ref : int

The number of particles that result in refining an oct used for indexing the particles.

Examples

>>> pos = [np.random.random(128*128*128) for i in range(3)]
>>> data = dict(particle_position_x = pos[0],
...             particle_position_y = pos[1],
...             particle_position_z = pos[2])
>>> bbox = np.array([[0., 1.0], [0.0, 1.0], [0.0, 1.0]])
>>> ds = load_particles(data, 3.08e24, bbox=bbox)