caustics.cosmology package#

Submodules#

caustics.cosmology.FlatLambdaCDM module#

class caustics.cosmology.FlatLambdaCDM.FlatLambdaCDM(h0: Annotated[ArrayLike | None, 'Hubble constant over 100', True] = 0.6766, critical_density_0: Annotated[ArrayLike | None, 'Critical density at z=0', True] = 127052815397.49832, Om0: Annotated[ArrayLike | None, 'Matter density parameter at z=0', True] = 0.30966, name: Annotated[str | None, 'Name of the cosmology'] = None)[source]#

Bases: Cosmology

Subclass of Cosmology representing a Flat Lambda Cold Dark Matter (LCDM) cosmology with no radiation.

comoving_distance(z: ArrayLike, h0: Annotated[ArrayLike, 'Param'], Om0: Annotated[ArrayLike, 'Param']) ArrayLike[source]#

Calculate the comoving distance to redshift z.

Parameters:

z (ArrayLike) – Redshift.

Returns:

Comoving distance to redshift z.

Return type:

ArrayLike

critical_density(z: ArrayLike, critical_density_0: Annotated[ArrayLike, 'Param'], Om0: Annotated[ArrayLike, 'Param']) ArrayLike[source]#

Calculate the critical density at redshift z.

Parameters:

z (ArrayLike) – Redshift.

Returns:

Critical density at redshift z.

Return type:

ArrayLike

hubble_distance(h0: Annotated[ArrayLike, 'Param'])[source]#

Calculate the Hubble distance.

Parameters:

h0 (ArrayLike) – Hubble constant.

Returns:

Hubble distance.

Return type:

ArrayLike

to(device=None, dtype=None)[source]#

Moves and/or casts the values of the Node to a particular device and/or dtype.

Parameters:
  • device ((optional)) – The device to move the values to. Defaults to None.

  • dtype ((optional)) – The desired data type. Defaults to None.

transverse_comoving_distance(z: ArrayLike) ArrayLike[source]#

Compute the transverse comoving distance to redshift z (Mpc).

Parameters:

z (ArrayLike) –

The redshift.

Unit: unitless

Returns:

The transverse comoving distance to each redshift in Mpc.

Unit: Mpc

Return type:

ArrayLike

caustics.cosmology.base module#

class caustics.cosmology.base.Cosmology(name: Annotated[str | None, 'Name of the cosmology'] = None)[source]#

Bases: Module

Abstract base class for cosmological models.

This class provides an interface for cosmological computations used in lensing such as comoving distance and critical surface density.

Distance

Unit: Mpc

Mass

Unit: Msun

name#

Name of the cosmological model.

Type:

str

angular_diameter_distance(z: ArrayLike) ArrayLike[source]#

Compute the angular diameter distance to redshift z.

Parameters:

z (ArrayLike) –

The redshift.

Unit: unitless

Returns:

The angular diameter distance to each redshift.

Unit: Mpc

Return type:

ArrayLike

angular_diameter_distance_z1z2(z1: ArrayLike, z2: ArrayLike) ArrayLike[source]#

Compute the angular diameter distance between two redshifts.

Parameters:
  • z1 (ArrayLike) –

    The starting redshift.

    Unit: unitless

  • z2 (ArrayLike) –

    The ending redshift.

    Unit: unitless

Returns:

The angular diameter distance between each pair of redshifts.

Unit: Mpc

Return type:

ArrayLike

abstract comoving_distance(z: ArrayLike, *args, **kwargs) ArrayLike[source]#

Compute the comoving distance to redshift z.

Parameters:

z (ArrayLike) –

The redshift.

Unit: unitless

Returns:

The comoving distance to each redshift.

Unit: Mpc

Return type:

ArrayLike

comoving_distance_z1z2(z1: ArrayLike, z2: ArrayLike) ArrayLike[source]#

Compute the comoving distance between two redshifts.

Parameters:
  • z1 (ArrayLike) –

    The starting redshift.

    Unit: unitless

  • z2 (ArrayLike) –

    The ending redshift.

    Unit: unitless

Returns:

The comoving distance between each pair of redshifts.

Unit: Mpc

Return type:

ArrayLike

abstract critical_density(z: ArrayLike) ArrayLike[source]#

Compute the critical density at redshift z.

Parameters:

z (ArrayLike) –

The redshift.

Unit: unitless

Returns:

The critical density at each redshift.

Unit: Msun/Mpc^3

Return type:

ArrayLike

critical_surface_density(z_l: ArrayLike, z_s: ArrayLike) ArrayLike[source]#

Compute the critical surface density between lens and source planes.

Parameters:
  • z_l (ArrayLike) –

    The lens redshift.

    Unit: unitless

  • z_s (ArrayLike) –

    The source redshift.

    Unit: unitless

Returns:

The critical surface density for each pair of lens and source redshifts.

Unit: Msun/Mpc^2

Return type:

ArrayLike

time_delay_distance(z_l: ArrayLike, z_s: ArrayLike) ArrayLike[source]#

Compute the time delay distance between lens and source planes.

Parameters:
  • z_l (ArrayLike) –

    The lens redshift.

    Unit: unitless

  • z_s (ArrayLike) –

    The source redshift.

    Unit: unitless

Returns:

The time delay distance for each pair of lens and source redshifts.

Unit: Mpc

Return type:

ArrayLike

abstract transverse_comoving_distance(z: ArrayLike, *args, **kwargs) ArrayLike[source]#

Compute the transverse comoving distance to redshift z (Mpc).

Parameters:

z (ArrayLike) –

The redshift.

Unit: unitless

Returns:

The transverse comoving distance to each redshift in Mpc.

Unit: Mpc

Return type:

ArrayLike

transverse_comoving_distance_z1z2(z1: ArrayLike, z2: ArrayLike) ArrayLike[source]#

Compute the transverse comoving distance between two redshifts (Mpc).

Parameters:
  • z1 (ArrayLike) –

    The starting redshift.

    Unit: unitless

  • z2 (ArrayLike) –

    The ending redshift.

    Unit: unitless

Returns:

The transverse comoving distance between each pair of redshifts in Mpc.

Unit: Mpc

Return type:

ArrayLike

Module contents#

class caustics.cosmology.Cosmology(name: Annotated[str | None, 'Name of the cosmology'] = None)[source]#

Bases: Module

Abstract base class for cosmological models.

This class provides an interface for cosmological computations used in lensing such as comoving distance and critical surface density.

Distance

Unit: Mpc

Mass

Unit: Msun

name#

Name of the cosmological model.

Type:

str

angular_diameter_distance(z: ArrayLike) ArrayLike[source]#

Compute the angular diameter distance to redshift z.

Parameters:

z (ArrayLike) –

The redshift.

Unit: unitless

Returns:

The angular diameter distance to each redshift.

Unit: Mpc

Return type:

ArrayLike

angular_diameter_distance_z1z2(z1: ArrayLike, z2: ArrayLike) ArrayLike[source]#

Compute the angular diameter distance between two redshifts.

Parameters:
  • z1 (ArrayLike) –

    The starting redshift.

    Unit: unitless

  • z2 (ArrayLike) –

    The ending redshift.

    Unit: unitless

Returns:

The angular diameter distance between each pair of redshifts.

Unit: Mpc

Return type:

ArrayLike

abstract comoving_distance(z: ArrayLike, *args, **kwargs) ArrayLike[source]#

Compute the comoving distance to redshift z.

Parameters:

z (ArrayLike) –

The redshift.

Unit: unitless

Returns:

The comoving distance to each redshift.

Unit: Mpc

Return type:

ArrayLike

comoving_distance_z1z2(z1: ArrayLike, z2: ArrayLike) ArrayLike[source]#

Compute the comoving distance between two redshifts.

Parameters:
  • z1 (ArrayLike) –

    The starting redshift.

    Unit: unitless

  • z2 (ArrayLike) –

    The ending redshift.

    Unit: unitless

Returns:

The comoving distance between each pair of redshifts.

Unit: Mpc

Return type:

ArrayLike

abstract critical_density(z: ArrayLike) ArrayLike[source]#

Compute the critical density at redshift z.

Parameters:

z (ArrayLike) –

The redshift.

Unit: unitless

Returns:

The critical density at each redshift.

Unit: Msun/Mpc^3

Return type:

ArrayLike

critical_surface_density(z_l: ArrayLike, z_s: ArrayLike) ArrayLike[source]#

Compute the critical surface density between lens and source planes.

Parameters:
  • z_l (ArrayLike) –

    The lens redshift.

    Unit: unitless

  • z_s (ArrayLike) –

    The source redshift.

    Unit: unitless

Returns:

The critical surface density for each pair of lens and source redshifts.

Unit: Msun/Mpc^2

Return type:

ArrayLike

time_delay_distance(z_l: ArrayLike, z_s: ArrayLike) ArrayLike[source]#

Compute the time delay distance between lens and source planes.

Parameters:
  • z_l (ArrayLike) –

    The lens redshift.

    Unit: unitless

  • z_s (ArrayLike) –

    The source redshift.

    Unit: unitless

Returns:

The time delay distance for each pair of lens and source redshifts.

Unit: Mpc

Return type:

ArrayLike

abstract transverse_comoving_distance(z: ArrayLike, *args, **kwargs) ArrayLike[source]#

Compute the transverse comoving distance to redshift z (Mpc).

Parameters:

z (ArrayLike) –

The redshift.

Unit: unitless

Returns:

The transverse comoving distance to each redshift in Mpc.

Unit: Mpc

Return type:

ArrayLike

transverse_comoving_distance_z1z2(z1: ArrayLike, z2: ArrayLike) ArrayLike[source]#

Compute the transverse comoving distance between two redshifts (Mpc).

Parameters:
  • z1 (ArrayLike) –

    The starting redshift.

    Unit: unitless

  • z2 (ArrayLike) –

    The ending redshift.

    Unit: unitless

Returns:

The transverse comoving distance between each pair of redshifts in Mpc.

Unit: Mpc

Return type:

ArrayLike

class caustics.cosmology.FlatLambdaCDM(h0: Annotated[ArrayLike | None, 'Hubble constant over 100', True] = 0.6766, critical_density_0: Annotated[ArrayLike | None, 'Critical density at z=0', True] = 127052815397.49832, Om0: Annotated[ArrayLike | None, 'Matter density parameter at z=0', True] = 0.30966, name: Annotated[str | None, 'Name of the cosmology'] = None)[source]#

Bases: Cosmology

Subclass of Cosmology representing a Flat Lambda Cold Dark Matter (LCDM) cosmology with no radiation.

comoving_distance(z: ArrayLike, h0: Annotated[ArrayLike, 'Param'], Om0: Annotated[ArrayLike, 'Param']) ArrayLike[source]#

Calculate the comoving distance to redshift z.

Parameters:

z (ArrayLike) – Redshift.

Returns:

Comoving distance to redshift z.

Return type:

ArrayLike

critical_density(z: ArrayLike, critical_density_0: Annotated[ArrayLike, 'Param'], Om0: Annotated[ArrayLike, 'Param']) ArrayLike[source]#

Calculate the critical density at redshift z.

Parameters:

z (ArrayLike) – Redshift.

Returns:

Critical density at redshift z.

Return type:

ArrayLike

hubble_distance(h0: Annotated[ArrayLike, 'Param'])[source]#

Calculate the Hubble distance.

Parameters:

h0 (ArrayLike) – Hubble constant.

Returns:

Hubble distance.

Return type:

ArrayLike

to(device=None, dtype=None)[source]#

Moves and/or casts the values of the Node to a particular device and/or dtype.

Parameters:
  • device ((optional)) – The device to move the values to. Defaults to None.

  • dtype ((optional)) – The desired data type. Defaults to None.

transverse_comoving_distance(z: ArrayLike) ArrayLike[source]#

Compute the transverse comoving distance to redshift z (Mpc).

Parameters:

z (ArrayLike) –

The redshift.

Unit: unitless

Returns:

The transverse comoving distance to each redshift in Mpc.

Unit: Mpc

Return type:

ArrayLike