rubix package#

Subpackages#

Submodules#

rubix.debug module#

rubix.debug.create_dummy_rubix(n_particles, output_path)[source]#
rubix.debug.random_data(n_particles, min_val, max_val, dimension, key=42)[source]#

rubix.logger module#

rubix.logger.get_logger(config=None)[source]#

rubix.paths module#

rubix.utils module#

rubix.utils.SFTtoAge(a)[source]#

Convert scale factor to age in Gyr.

The lookback time is calculated as the difference between current age of the universe and the age at redshift z=1/a - 1.

This hence gives the age of the star formed at redshift z=1/a - 1.

Parameters:

a (float) – scale factor

Returns:

Age in Gyr.

rubix.utils.convert_values_to_physical(value, a, a_scale_exponent, hubble_param, hubble_scale_exponent, CGS_conversion_factor)[source]#

Convert values from cosmological simulations to physical units Source: https://kateharborne.github.io/SimSpin/examples/generating_hdf5.html#attributes

Parameters:
  • value (float) – Value from Simulation Parameter to be converted

  • a (float) – Scale factor, given as 1/(1+z)

  • a_scale_exponent (float) – Exponent of the scale factor

  • hubble_param (float) – Hubble parameter

  • hubble_scale_exponent (float) – Exponent of the Hubble parameter

  • CGS_conversion_factor (float) – Conversion factor to CGS units

Returns:

Value in physical units

rubix.utils.get_config(config: str | Dict) Dict[source]#

Get the configuration from a file or a dictionary.

Parameters:

config (Union[str, Dict]) – The configuration as a file path or a dictionary

Returns:

The configuration as a dictionary.

rubix.utils.get_pipeline_config(name: str)[source]#

Get the configuration of the pipeline with the given name.

Parameters:

name (str) – The name of the pipeline

Returns:

The configuration of the pipeline as a dictionary.

rubix.utils.load_galaxy_data(path_to_file: str)[source]#

load_galaxy_data Load galaxy data from a file

Parameters:

path_to_file (str) – path to the file to load

Raises:

RuntimeError – When an error occurs during loading

Returns:

Either the loaded galaxy data, or an empty dictionary if an error occured.

Example

>>> from rubix.utils import load_galaxy_data
>>> galaxy_data = load_galaxy_data("path/to/file.hdf5")
rubix.utils.print_hdf5_file_structure(file_path)[source]#

Print the structure of an HDF5 file.

Parameters:

file_path (str) – path to the HDF5 file

Returns:

The structure of the HDF5 file as a string.

rubix.utils.read_yaml(path_to_file: str) dict[source]#

read_yaml Read yaml file into dictionary

Parameters:

path_to_file (str) – path to the file to read

Returns:

Either the read yaml file in dictionary form, or an empty

dictionary if an error occured.

Module contents#