particles.ClusterParticles.set_field#
- ClusterParticles.set_field(ptype, name, value, units=None, add=False, passive_scalar=False)[source]#
Add or update a particle field using a unyt_array. The array will be checked to make sure that it has the appropriate size.
- Parameters:
ptype (
string
) – The particle type of the field to add or update.name (
string
) – The name of the field to add or update.value (
unyt_array
) – The particle field itself–an array with the same shape as the number of particles.units (
string
, optional) – The units to convert the field to. Default: None, indicating the units will be preserved.add (
boolean
, optional) – If True and the field already exists, the values in the array will be added to the already existing field array.passive_scalar (
boolean
, optional) – If set, the field to be added is a passive scalar. Default: False