Skip to main content
`Ctrl`+`K`

# TemperatureCMB

class astropy.cosmology.traits.TemperatureCMB

  Bases: `object`

  The trait for computing the cosmological background temperature.

  Methods Summary

  `Tcmb`(z, /) | Compute the CMB temperature at redshift `z`.

  Methods Documentation

  Tcmb(z, /)

    Compute the CMB temperature at redshift `z`.

    Parameters:
      z Quantity-like [‘redshift’], numpy:array_like

        Input redshift.

        Changed in version 7.0: Passing z as a keyword argument is deprecated.

        Changed in version 8.0: z must be a positional argument.

    Returns:
      Tcmb `Quantity` [:ref: ‘temperature’]

        The temperature of the CMB.

    Examples

        >>> import astropy.units as u
        >>> from astropy.cosmology import Planck18, units as cu

        >>> Planck18.Tcmb(u.Quantity([0.5, 1.0], cu.redshift))
        <Quantity [4.08825, 5.451  ] K>

        >>> Planck18.Tcmb(u.Quantity(0.5, ''))
        <Quantity 4.08825 K>

        >>> Planck18.Tcmb(0.5)
        <Quantity 4.08825 K>

        >>> Planck18.Tcmb([0.5, 1.0])
        <Quantity [4.08825, 5.451  ] K>