pisces.particles.utils.inspect_particle_count#

pisces.particles.utils.inspect_particle_count(path: str | Path) dict[str, int][source]#

Inspect the number of particles in each species group of a particle dataset without fully loading the file.

This function:

  1. Opens the HDF5 particle file at the top level.

  2. Iterates over all top-level groups (each representing a particle species).

  3. Skips any group with the attribute NOT_PARTICLE_GROUP set to a truthy value.

  4. Reads the NUMBER_OF_PARTICLES attribute from each valid particle group.

Parameters:

path (str or Path) – Path to the HDF5 particle file.

Returns:

Mapping of particle group names to integer particle counts.

Return type:

dict

Raises:
  • FileNotFoundError – If the file does not exist or is not a regular file.

  • ValueError – If a valid particle group is missing the required NUMBER_OF_PARTICLES attribute.