velociraptor.units module

All classes that are involved in the handling of the units, including the master VelociraptorUnits class.

class velociraptor.units.VelociraptorUnits(filename: str, disregard_units: bool = False)[source]

Bases: object

Generates a unyt system that can then be used with the velociraptor data.

You are probably looking for the following attributes:

  • VelociraptorUnits.length
  • VelociraptorUnits.mass
  • VelociraptorUnits.metallicity (relative to solar)
  • VelociraptorUnits.age
  • VelociraptorUnits.velocity
  • VelociraptorUnits.star_formation_rate

This will allow you to extract variables in the correct units. This object also holds the current scale factor and redshift through the a and z variables. Finally, it contains whether or not the current unit system is comoving (VelociraptorUnits.comoving) and whether or not the underlying simulation was cosmological (VelociraptorUnits.cosmological).

get_unit_dictionary()[source]

Gets the unit library from the header information in the file. These are a mix of units, so we just read them all – and allow the people who define the registration functions to figure out how to use them.

load_cosmology(handle: h5py._hl.files.File) → astropy.cosmology.core.Cosmology[source]

Save the (astropy) cosmology to a HDF5 dataset.

Parameters:handle (h5py.File) – h5py file handle for the catalogue file.
Returns:Astropy cosmology instance extracted from the HDF5 file. Also sets self.cosmology.
Return type:astropy.cosmology.Cosmology