pisces.particles.gadget.GadgetLikeParticleDataset.generate_file_skeleton#

classmethod GadgetLikeParticleDataset.generate_file_skeleton(path: Path, number_of_particles: ndarray, box_size: unyt_quantity, unit_system: UnitSystem, **kwargs)[source]#

Generate the basic file skeleton for a Gadget-like particle dataset.

This method creates the HDF5 file and populates it with the necessary groups and datasets to conform to the Gadget-like format. It handles writing the required metadata, file header, and particle type groups.

Parameters:
  • path (Path) – The file path where the HDF5 file will be created. There is no overwrite safety in this method, so the caller must ensure that the path is valid. If it already exists, then the data will be overwritten.

  • number_of_particles (numpy.ndarray) –

    The number of particles of each type to include in the file. This should be an array of length equal to the number of particle types (default is 6 for Gadget-like files).

    If a particle type has zero particles, its group will not be created.

  • box_size (unyt.unyt_quantity) – The size of the simulation box. This should be a unyt quantity with units of length.

  • unit_system (unyt.unit_systems.UnitSystem) – The unit system in which to write the particle fields. This is used to set up the units of each of the fields in the file.

  • kwargs – Additional keyword arguments to pass to the header and particle field generation methods. This can include any parameters that are needed to customize the file header or particle fields, such as cosmological parameters, time information, etc.

Notes

This is a 3 step process:

  1. Create the HDF5 file and write the Pisces metadata.

  2. Write the Gadget-like file header.

  3. Create the particle type groups and populate them with the required fields.