pynbody.analysis.cosmology.redshift

Contents

pynbody.analysis.cosmology.redshift#

pynbody.analysis.cosmology.redshift(f, time)[source]#

Calculate the redshift given a snapshot and a time since Big Bang in Gyr.

Uses scipy.optimize.newton to do the root finding if number of elements in the time array is less than 1000; otherwise uses a linear interpolation.

Parameters:
  • f (SimSnap) – The snapshot from which to obtain the cosmological parameters.

  • time (float, list, or np.ndarray) – The time(s) since the Big Bang at which to calculate the redshift.

Returns:

The redshift(s) corresponding to the input time(s).

Return type:

float or np.ndarray