pisces.particles.base.ParticleDataset.reduce_group#
- ParticleDataset.reduce_group(group_name: str, mask: ndarray | unyt_array)[source]#
Reduce a particle group by applying a boolean mask.
This method filters all fields in the specified group by the given mask, retaining only those particles where the mask is True. All other particles are discarded. The group’s
NUMBER_OF_PARTICLES
attribute is updated accordingly.This is a destructive operation.
- Parameters:
- Raises:
KeyError – If the specified group does not exist.
ValueError – If the mask has an incorrect shape or is not boolean.