# yt.utilities.particle_generator module¶

class yt.utilities.particle_generator.FromListParticleGenerator(ds, num_particles, data, ptype='io')[source]
apply_to_stream(clobber=False)

Apply the particles to a grid-based stream dataset. If particles already exist, and clobber=False, do not overwrite them, but add the new ones to them.

assign_indices(function=None, **kwargs)

Assign unique indices to the particles. The default is to just use numpy.arange, but any function may be supplied with keyword arguments.

get_for_grid(grid)

Return a dict containing all of the particle fields in the specified grid.

has_key(key)

Check to see if key is in the particle field list.

keys()

Return the list of particle fields.

map_grid_fields_to_particles(mapping_dict)

For the fields in mapping_dict, map grid fields to the particles using CIC sampling.

Examples

>>> field_map = {'density':'particle_density',
>>>              'temperature':'particle_temperature'}
>>> particles.map_grid_fields_to_particles(field_map)

class yt.utilities.particle_generator.LatticeParticleGenerator(ds, particles_dims, particles_left_edge, particles_right_edge, field_list, ptype='io')[source]
apply_to_stream(clobber=False)

Apply the particles to a grid-based stream dataset. If particles already exist, and clobber=False, do not overwrite them, but add the new ones to them.

assign_indices(function=None, **kwargs)

Assign unique indices to the particles. The default is to just use numpy.arange, but any function may be supplied with keyword arguments.

get_for_grid(grid)

Return a dict containing all of the particle fields in the specified grid.

has_key(key)

Check to see if key is in the particle field list.

keys()

Return the list of particle fields.

map_grid_fields_to_particles(mapping_dict)

For the fields in mapping_dict, map grid fields to the particles using CIC sampling.

Examples

>>> field_map = {'density':'particle_density',
>>>              'temperature':'particle_temperature'}
>>> particles.map_grid_fields_to_particles(field_map)

class yt.utilities.particle_generator.ParticleGenerator(ds, num_particles, field_list, ptype='io')[source]

Bases: object

apply_to_stream(clobber=False)[source]

Apply the particles to a grid-based stream dataset. If particles already exist, and clobber=False, do not overwrite them, but add the new ones to them.

assign_indices(function=None, **kwargs)[source]

Assign unique indices to the particles. The default is to just use numpy.arange, but any function may be supplied with keyword arguments.

get_for_grid(grid)[source]

Return a dict containing all of the particle fields in the specified grid.

has_key(key)[source]

Check to see if key is in the particle field list.

keys()[source]

Return the list of particle fields.

map_grid_fields_to_particles(mapping_dict)[source]

For the fields in mapping_dict, map grid fields to the particles using CIC sampling.

Examples

>>> field_map = {'density':'particle_density',
>>>              'temperature':'particle_temperature'}
>>> particles.map_grid_fields_to_particles(field_map)

class yt.utilities.particle_generator.WithDensityParticleGenerator(ds, data_source, num_particles, field_list, density_field='density', ptype='io')[source]
apply_to_stream(clobber=False)

Apply the particles to a grid-based stream dataset. If particles already exist, and clobber=False, do not overwrite them, but add the new ones to them.

assign_indices(function=None, **kwargs)

Assign unique indices to the particles. The default is to just use numpy.arange, but any function may be supplied with keyword arguments.

get_for_grid(grid)

Return a dict containing all of the particle fields in the specified grid.

has_key(key)

Check to see if key is in the particle field list.

keys()

Return the list of particle fields.

map_grid_fields_to_particles(mapping_dict)

For the fields in mapping_dict, map grid fields to the particles using CIC sampling.

Examples

>>> field_map = {'density':'particle_density',
>>>              'temperature':'particle_temperature'}
>>> particles.map_grid_fields_to_particles(field_map)