rubix package#

Subpackages#

Submodules#

rubix.debug module#

rubix.logger module#

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

rubix.paths module#

rubix.utils module#

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

Convert a scale factor to a stellar age in Gyr.

The lookback time is calculated as the difference between the current age of the universe and the age at redshift $z = 1/a - 1$, giving the time since the formation of a star with scale factor $a$.

Parameters:

a (float) – Scale factor

Returns:

Age in Gyr

Return type:

float

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

Convert values from cosmological simulations to physical units Source:

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

Return type:

float

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) Dict[str, Any][source]#

Get the configuration of a pipeline by name.

Parameters:

name (str) – The name of the pipeline to look up

Raises:

ValueError – If the requested pipeline is not defined

Returns:

The configuration dictionary for the pipeline

Return type:

Dict[str, Any]

rubix.utils.load_galaxy_data(path_to_file: str) Tuple[Dict[str, Any], Dict[str, Any]][source]#

Load galaxy data and unit metadata from an HDF5 file.

Parameters:

path_to_file (str) – Path to the HDF5 file to load

Raises:

FileNotFoundError – If the file cannot be found

Returns:

Galaxy data and associated units

Return type:

Tuple[Dict[str, Any], Dict[str, Any]]

Example

>>> from rubix.utils import load_galaxy_data
>>> galaxy_data, units = load_galaxy_data("path/to/file.hdf5")
rubix.utils.print_hdf5_file_structure(file_path: str) str[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

Return type:

str

rubix.utils.read_yaml(path_to_file: str) Dict[str, Any][source]#

Read a YAML file into a dictionary.

Parameters:

path_to_file (str) – Path to the YAML file to read

Raises:

RuntimeError – If the file cannot be read or parsed

Returns:

Contents of the YAML file

Return type:

Dict[str, Any]

Module contents#