synthesizer.load_data.utils¶
Utilities for data loading methods.
These utilities are used through the load_data module as helpers for loading data from different simulations sources.
Examples usage:
lengths = np.array([10, 20, 30]) begin, end = get_begin_end_pointers(lengths) print(begin) # Output: [ 0 10 30]
table = age_lookup_table(ages, redshift=0.5, delta_a=0.1) print(table) # Output: (array([0.1, 0.2, 0.3]), array([10., 20., 30.]))
ages = lookup_age(0.2, table[0], table[1])
Functions
- synthesizer.load_data.utils.age_lookup_table(cosmo, redshift=0.0, delta_a=0.001, low_lim=0.0001)[source]¶
Create a look-up table for age as a function of scale factor.
Defaults to start at the lower resolution limit (delta_a), and proceeds in steps of delta-a until the scale factor given by the input redshift minus the low_lim.
- Parameters:
cosmo (astropy.cosmology) – Astropy cosmology object.
redshift (float) – Redshift of the snapshot.
delta_a (int) – Scale factor resolution to approximate.
low_lim (float) – Lower limit of scale factor.
- Returns:
Array of scale factors. age (unyt_array of float):
Array of ages (Gyr).
- Return type:
scale_factor (np.ndarray of float)
Examples using synthesizer.load_data.utils.age_lookup_table
¶
- synthesizer.load_data.utils.get_begin_end_pointers(length)[source]¶
Find the beginning and ending indices from a length array.
- Parameters:
length (np.ndarray of int) – The number of particles in each galaxy.
- Returns:
Beginning indices. end (np.ndarray of int): Ending indices.
- Return type:
begin (np.ndarray of int)
- synthesizer.load_data.utils.lookup_age(scale_factor, scale_factors, ages)[source]¶
Look up the age given a scale factor.
- Parameters:
scale_factor (np.ndarray of float) – Scale factors to convert to ages.
scale_factors (np.ndarray of float) – Array of lookup scale factors.
ages (unyt_array of float) – Array of lookup ages.
- Returns:
Age based on the input scale factor/s.
- Return type:
age (float)