
    HR-e)                         d dl mZ d dlmZ d dlmZ d dlmZ ddl	m
Z
 ddlmZmZ dd	gZd
dgiZ G d de          Z G d d	ee          ZdS )    )expN)	Parameter)aszarr   )scalar_inv_efuncs)FLRWFlatFLRWMixinw0wzCDMFlatw0wzCDM*scipyc                        e Zd ZdZ edd          Z edd          Zdddej        z  ddej	        z  d	fd	d	d
 fdZ
d Zd Z xZS )r
   a	  
    FLRW cosmology with a variable dark energy equation of state and curvature.

    The equation for the dark energy equation of state uses the simple form:
    :math:`w(z) = w_0 + w_z z`.

    This form is not recommended for z > 1.

    Parameters
    ----------
    H0 : float or scalar quantity-like ['frequency']
        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].

    Om0 : float
        Omega matter: density of non-relativistic matter in units of the
        critical density at z=0.

    Ode0 : float
        Omega dark energy: density of dark energy in units of the critical
        density at z=0.

    w0 : float, optional
        Dark energy equation of state at z=0. This is pressure/density for
        dark energy in units where c=1.

    wz : float, optional
        Derivative of the dark energy equation of state with respect to z.
        A cosmological constant has w0=-1.0 and wz=0.0.

    Tcmb0 : float or scalar quantity-like ['temperature'], optional
        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].
        Setting this to zero will turn off both photons and neutrinos
        (even massive ones).

    Neff : float, optional
        Effective number of Neutrino species. Default 3.04.

    m_nu : quantity-like ['energy', 'mass'] or array-like, optional
        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).
        If this is a scalar Quantity, then all neutrino species are assumed to
        have that mass. Otherwise, the mass of each species. The actual number
        of neutrino species (and hence the number of elements of m_nu if it is
        not scalar) must be the floor of Neff. Typically this means you should
        provide three neutrino masses unless you are considering something like
        a sterile neutrino.

    Ob0 : float or None, optional
        Omega baryons: density of baryonic matter in units of the critical
        density at z=0.  If this is set to None (the default), any computation
        that requires its value will raise an exception.

    name : str or None (optional, keyword-only)
        Name for this cosmological object.

    meta : mapping or None (optional, keyword-only)
        Metadata for the cosmology, e.g., a reference.

    Examples
    --------
    >>> from astropy.cosmology import w0wzCDM
    >>> cosmo = w0wzCDM(H0=70, Om0=0.3, Ode0=0.7, w0=-0.9, wz=0.2)

    The comoving distance in Mpc at redshift z:

    >>> z = 0.5
    >>> dc = cosmo.comoving_distance(z)
    z%Dark energy equation of state at z=0.float)doc	fvalidatez9Derivative of the dark energy equation of state w.r.t. z.              RQ@Nnamemetac
                >   t                                          |||||||	|
|	  	         || _        || _        | j        j        dk    r8t          j        | _        | j	        | j
        | j        | j        | j        f| _        d S | j        sFt          j        | _        | j	        | j
        | j        | j        | j        z   | j        | j        f| _        d S t          j        | _        | j	        | j
        | j        | j        | j        | j        | j        | j        | j        f	| _        d S )N)	H0Om0Ode0Tcmb0Neffm_nuOb0r   r   r   )super__init__w0wz_Tcmb0valuer   w0wzcdm_inv_efunc_norel_inv_efunc_scalar_Om0_Ode0_Ok0_w0_wz_inv_efunc_scalar_args
_massivenuw0wzcdm_inv_efunc_nomnu_Ogamma0_Onu0w0wzcdm_inv_efunc_neff_per_nu_nmasslessnu
_nu_y_list)selfr   r   r   r"   r#   r   r   r   r   r   r   	__class__s               >lib/python3.11/site-packages/astropy/cosmology/flrw/w0wzcdm.pyr!   zw0wzCDM.__init__\   s/    	 	 
	
 
	
 
	
  ;!!%6%ND"	
	+D'''  	%6%ND"	
	
*+D''' &7%HD"	
	!!
+D'''    c                 @    | j         | j        t          |          z  z   S )a  Returns dark energy equation of state at redshift ``z``.

        Parameters
        ----------
        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`
            Input redshift.

        Returns
        -------
        w : ndarray or float
            The dark energy equation of state.
            Returns `float` if the input is scalar.

        Notes
        -----
        The dark energy equation of state is defined as
        :math:`w(z) = P(z)/\rho(z)`, where :math:`P(z)` is the pressure at
        redshift z and :math:`\rho(z)` is the density at redshift z, both in
        units where c=1. Here this is given by :math:`w(z) = w_0 + w_z z`.
        )r+   r,   r   r6   zs     r8   wz	w0wzCDM.w   s    * x$(VAYY...r9   c                     t          |          }|dz   dd| j        z   | j        z
  z  z  t          d| j        z  |z            z  S )aV  Evaluates the redshift dependence of the dark energy density.

        Parameters
        ----------
        z : Quantity-like ['redshift'], array-like, or `~numbers.Number`
            Input redshift.

        Returns
        -------
        I : ndarray or float
            The scaling of the energy density of dark energy with redshift.
            Returns `float` if the input is scalar.

        References
        ----------
        .. [1] Linder, E. (2003). Exploring the Expansion History of the Universe.
               Physics Review Letters, 90(9), 091301.

        Notes
        -----
        The scaling factor, I, is defined by :math:`\rho(z) = \rho_0 I`,
        and in this case is given by ([1]_)

        .. math::

           I = \left(1 + z\right)^{3 \left(1 + w_0 - w_z\right)}
                     \exp \left(3 w_z z\right)
        g      ?g      @)r   r+   r,   r   r;   s     r8   de_density_scalezw0wzCDM.de_density_scale   sS    : 1IICSC$(NTX$=>?#$(NQC
 C
 
 	
r9   )__name__
__module____qualname____doc__r   r"   r#   uKeVr!   r=   r?   __classcell__r7   s   @r8   r
   r
      s        B BH 
>'	R	R	RB	G
 
 
B ACi14Z> > > > > > > >@/ / /. 
  
  
  
  
  
  
r9   c                   X     e Zd ZdZdddej        z  ddej        z  dfddd fdZ xZS )r   a	  
    FLRW cosmology with a variable dark energy equation of state and no curvature.

    The equation for the dark energy equation of state uses the simple form:
    :math:`w(z) = w_0 + w_z z`.

    This form is not recommended for z > 1.

    Parameters
    ----------
    H0 : float or scalar quantity-like ['frequency']
        Hubble constant at z = 0. If a float, must be in [km/sec/Mpc].

    Om0 : float
        Omega matter: density of non-relativistic matter in units of the
        critical density at z=0.

    w0 : float, optional
        Dark energy equation of state at z=0. This is pressure/density for
        dark energy in units where c=1.

    wz : float, optional
        Derivative of the dark energy equation of state with respect to z.
        A cosmological constant has w0=-1.0 and wz=0.0.

    Tcmb0 : float or scalar quantity-like ['temperature'], optional
        Temperature of the CMB z=0. If a float, must be in [K]. Default: 0 [K].
        Setting this to zero will turn off both photons and neutrinos
        (even massive ones).

    Neff : float, optional
        Effective number of Neutrino species. Default 3.04.

    m_nu : quantity-like ['energy', 'mass'] or array-like, optional
        Mass of each neutrino species in [eV] (mass-energy equivalency enabled).
        If this is a scalar Quantity, then all neutrino species are assumed to
        have that mass. Otherwise, the mass of each species. The actual number
        of neutrino species (and hence the number of elements of m_nu if it is
        not scalar) must be the floor of Neff. Typically this means you should
        provide three neutrino masses unless you are considering something like
        a sterile neutrino.

    Ob0 : float or None, optional
        Omega baryons: density of baryonic matter in units of the critical
        density at z=0.  If this is set to None (the default), any computation
        that requires its value will raise an exception.

    name : str or None (optional, keyword-only)
        Name for this cosmological object.

    meta : mapping or None (optional, keyword-only)
        Metadata for the cosmology, e.g., a reference.

    Examples
    --------
    >>> from astropy.cosmology import Flatw0wzCDM
    >>> cosmo = Flatw0wzCDM(H0=70, Om0=0.3, w0=-0.9, wz=0.2)

    The comoving distance in Mpc at redshift z:

    >>> cosmo.comoving_distance(0.5)
    <Quantity 1849.74726272 Mpc>
    r   r   r   Nr   c	                   t                                          ||d|||||||	|
           | j        j        dk    r2t          j        | _        | j        | j        | j	        | j
        f| _        d S | j        s@t          j        | _        | j        | j        | j        | j        z   | j	        | j
        f| _        d S t          j        | _        | j        | j        | j        | j        | j        | j        | j	        | j
        f| _        d S )Nr   )r   r   r   r"   r#   r   r   r   r   r   r   r   )r    r!   r$   r%   r   fw0wzcdm_inv_efunc_norelr'   r(   r)   r+   r,   r-   r.   fw0wzcdm_inv_efunc_nomnur0   r1   fw0wzcdm_inv_efuncr3   r4   r5   )r6   r   r   r"   r#   r   r   r   r   r   r   r7   s              r8   r!   zFlatw0wzCDM.__init__  s    	 	 	
 	
 	
  ;!!%6%OD"+/9dj$(DH*UD''' 	%6%OD"	

*+D''' &7%ID"	
!!	+D'''r9   )	r@   rA   rB   rC   rD   rE   rF   r!   rG   rH   s   @r8   r   r      sz        > >H ACi14Z5 5 5 5 5 5 5 5 5 5 5 5r9   )numpyr   astropy.unitsunitsrD   astropy.cosmology.parameterr   astropy.cosmology.utilsr    r   baser   r	   __all____doctest_requires__r
   r    r9   r8   <module>rX      s               1 1 1 1 1 1 * * * * * *       % % % % % % % %m
$gY' B
 B
 B
 B
 B
d B
 B
 B
Jv v v v v- v v v v vr9   