velociraptor.catalogue.velociraptor_catalogue module

Main objects for the velociraptor reading library.

This is based upon the reading routines in the SWIFTsimIO library.

class velociraptor.catalogue.velociraptor_catalogue.VelociraptorFieldMetadata(filename, path: str, registration_functions: Dict[str, Callable], units: velociraptor.units.VelociraptorUnits)[source]

Bases: object

Metadata for a velociraptor field. Pass it a field path and a filename, and it will:

  • Use the registration functions to find the correct units and “fancy name”.
  • Assign a proper snake_case_name to the dataset.
valid = False
name = ''
snake_case = ''
register_field_properties()[source]

Registers the field properties using the registration functions.

velociraptor.catalogue.velociraptor_catalogue.generate_getter(filename, name: str, field: str, full_name: str, unit)[source]

Generates a function that:

  1. If self._`name` exists, return it
  2. If not, open filename
  3. Reads filename[field]
  4. Set self._`name`
  5. Return self._`name`.

Takes:

  • filename, the filename of the hdf5 file
  • name, the snake_case name of the property
  • field, the field in the hdf5 file corresponding to this property
  • full_name, the fancy printing name for this quantity (registered to array.name)
  • unit, the unyt unit corresponding to this value
velociraptor.catalogue.velociraptor_catalogue.generate_setter(name: str)[source]

Generates a function that sets self._name to the value that is passed to it.

velociraptor.catalogue.velociraptor_catalogue.generate_deleter(name: str)[source]

Generates a function that destroys self._name (sets it back to None).

velociraptor.catalogue.velociraptor_catalogue.generate_sub_catalogue(filename, registration_name: str, registration_function: Callable, units: velociraptor.units.VelociraptorUnits, field_metadata: List[velociraptor.catalogue.velociraptor_catalogue.VelociraptorFieldMetadata], mask: slice = Ellipsis)[source]

Generates a sub-catalogue object with the correct properties set. This is required as we can add properties to a class, but _not_ to an object dynamically.

So, here, we initialise the metadata, create a _copy_ of the __VelociraptorSubCatlaogue class, and then add all of our properties to that _class_ before instantiating it with the metadata.

class velociraptor.catalogue.velociraptor_catalogue.VelociraptorCatalogue(filename: str, disregard_units: bool = False, extra_registration_functions: Union[None, Dict[str, Callable]] = None, mask: slice = Ellipsis)[source]

Bases: velociraptor.catalogue.catalogue.Catalogue

A velociraptor dataset, containing information that has correct units and are easily accessible through snake_case names.

get_units()[source]

Gets the units instance from the file properties.

extract_properties_from_units()[source]

Use the self.units object to extract interesting parameters that should be visible from the top-level.

centrals
satellites