py21cmfast.RectilinearLightconer

class py21cmfast.RectilinearLightconer

Bases: Lightconer

The class rectilinear lightconer.

classmethod between_redshifts(min_redshift: float, max_redshift: float, resolution: astropy.units.Quantity[_LENGTH], cosmo=Planck18, **kw)

Construct a Lightconer with regular comoving dist. slices between two z’s.

Parameters:
  • min_redshift (float)

  • max_redshift (float)

  • resolution (astropy.units.Quantity[_LENGTH])

coeval_subselect(lcd: astropy.units.Quantity[astropy.units.pixel], coeval: numpy.ndarray, coeval_res: astropy.units.Quantity[_LENGTH])

Sub-select the coeval slice corresponding to this coeval distance.

Parameters:
  • lcd (astropy.units.Quantity[astropy.units.pixel])

  • coeval (numpy.ndarray)

  • coeval_res (astropy.units.Quantity[_LENGTH])

construct_lightcone(lcd: numpy.ndarray, box: numpy.ndarray) → tuple[numpy.ndarray, numpy.ndarray]

Construct slices of the lightcone between two coevals.

Parameters:
  • lcd (numpy.ndarray)

  • box (numpy.ndarray)

Return type:

tuple[numpy.ndarray, numpy.ndarray]

construct_los_velocity_lightcone(lcd: numpy.ndarray, velocity: numpy.ndarray) → numpy.ndarray

Construct slices of the lightcone between two coevals.

Parameters:
  • lcd (numpy.ndarray)

  • velocity (numpy.ndarray)

Return type:

numpy.ndarray

find_required_lightcone_limits(classy_output: classy.Class, inputs: py21cmfast.wrapper.inputs.InputParameters) → list[astropy.units.Quantity]

Obtain the redshift limits required for the lightcone to include RSDs.

This is a crude estimation of the maximum/minimum lightcone limits that are required in order to simulate all the “mass” that enters the requested ligthcone (due to RSD shift). We use the rms of the velocity field from linear perturbation theory in order to determine the required lightcone limits. If no limit is found, it means that the limits of node_redshifts are not sufficient and an error is raised.

Parameters:
  • classy_output (classy.Class) – An object containing all the information from the CLASS calculation.

  • inputs (InputParameters) – The input parameters corresponding to the box.

Returns:

lcd_limits_rsd (list) – List that contains the limits of the required lightcone distances.

Parameters:
Return type:

list[astropy.units.Quantity]

get_lc_distances_in_pixels(resolution: astropy.units.Quantity[_LENGTH])

Get the lightcone distances in pixels, given a resolution.

Parameters:

resolution (astropy.units.Quantity[_LENGTH])

get_shape(simulation_options: py21cmfast.wrapper.inputs.SimulationOptions) → tuple[int, int, int]

Get the shape of the lightcone.

Parameters:

simulation_options (py21cmfast.wrapper.inputs.SimulationOptions)

Return type:

tuple[int, int, int]

interpolate_los_velocity_slice(lcd: astropy.units.Quantity[astropy.units.pixel], c_a: py21cmfast.drivers.coeval.Coeval, c_b: py21cmfast.drivers.coeval.Coeval, dc_a: astropy.units.Quantity[astropy.units.pixel], dc_b: astropy.units.Quantity[astropy.units.pixel]) → numpy.ndarray

Make one slice of the line-of-sight velocity from two bracketing coevals.

By default, this is the z-component of the velocity, interpolated like interpolate_slice() does, and made into a slice by construct_los_velocity_lightcone().

Parameters:
Return type:

numpy.ndarray

interpolate_slice(lcd: astropy.units.Quantity[astropy.units.pixel], coeval_a: numpy.ndarray, coeval_b: numpy.ndarray, dc_a: astropy.units.Quantity[astropy.units.pixel], dc_b: astropy.units.Quantity[astropy.units.pixel], coeval_res: astropy.units.Quantity[_LENGTH], kind: str = 'mean') → numpy.ndarray

Make one lightcone slice of a field from the two coevals that bracket it.

The coevals are first sub-selected (coeval_subselect()), then interpolated to the slice’s distance (redshift_interpolation()), then made into a slice (construct_lightcone()).

Parameters:
  • lcd – The comoving distance of the slice, in pixels.

  • coeval_a, coeval_b – The field in the two coeval boxes.

  • dc_a, dc_b – The comoving distances of the two coeval boxes, in pixels.

  • coeval_res – The cell size of the coeval boxes.

  • kind – The kind of interpolation in distance (see redshift_interpolation()).

Parameters:
  • lcd (astropy.units.Quantity[astropy.units.pixel])

  • coeval_a (numpy.ndarray)

  • coeval_b (numpy.ndarray)

  • dc_a (astropy.units.Quantity[astropy.units.pixel])

  • dc_b (astropy.units.Quantity[astropy.units.pixel])

  • coeval_res (astropy.units.Quantity[_LENGTH])

  • kind (str)

Return type:

numpy.ndarray

make_lightcone_slices(c1: py21cmfast.drivers.coeval.Coeval, c2: py21cmfast.drivers.coeval.Coeval) → tuple[dict[str, numpy.ndarray], numpy.ndarray]

Make lightcone slices out of two coeval objects.

Parameters:

c1, c2 (Coeval) – The coeval boxes to interpolate.

Returns:

  • quantity – The field names of the quantities required by the lightcone.

  • lcidx – The indices of the lightcone to which these slices belong.

  • scalar_field_slices – The scalar fields evaluated on the “lightcone” slices that exist within the redshift range spanned by c1 and c2.

Parameters:
Return type:

tuple[dict[str, numpy.ndarray], numpy.ndarray]

redshift_interpolation(dc: float, coeval_a: numpy.ndarray, coeval_b: numpy.ndarray, dc_a: float, dc_b: float, kind: str = 'mean') → numpy.ndarray

Perform redshift interpolation to a new box given two bracketing coevals.

Parameters:
  • dc (float)

  • coeval_a (numpy.ndarray)

  • coeval_b (numpy.ndarray)

  • dc_a (float)

  • dc_b (float)

  • kind (str)

Return type:

numpy.ndarray

validate_options(inputs: py21cmfast.wrapper.inputs.InputParameters, include_dvdr_in_tau21: bool, apply_rsds: bool, classy_output: classy.Class | None = None) → Lightconer

Validate 21cmFAST options.

Parameters:
Return type:

Lightconer

classmethod with_equal_cdist_slices(min_redshift: float, max_redshift: float, resolution: astropy.units.Quantity[_LENGTH], cosmo=Planck18, **kw)

Create a lightconer with equally spaced slices in comoving distance.

This method is deprecated and will be removed in future versions. Instead, use between_redshifts to create a lightconer with equally spaced slices in comoving distance.

Parameters:
  • min_redshift (float)

  • max_redshift (float)

  • resolution (astropy.units.Quantity[_LENGTH])

cosmo: astropy.cosmology.FLRW
index_offset: int
interp_kinds: dict[str, str]
lc_distances: astropy.units.Quantity[_LENGTH]
property lc_redshifts: numpy.ndarray

The redshifts of the lightcone slices.

Return type:

numpy.ndarray

line_of_sight_axis: int
quantities: tuple[str]