
    HR-e                     B   d dl Z d dlZd dlmZmZ d dlmZ d dlmZ d dl	m
Z
 ddlmZ  e j         edd	d
                    Z e ed e                    d          D                                 Zddg ee          z   ZddgiZd Zd Z G d de
          ZdS )    N)OptionalUnion)get_pkg_data_path)
deprecated)ScienceState   )	Cosmology	cosmologydataastropy)packagec              #   $   K   | ]}|j         V  d S )N)stem).0ps     >lib/python3.11/site-packages/astropy/cosmology/realizations.py	<genexpr>r      s$      LLALLLLLL    z*.ecsv	availabledefault_cosmology*scipyc                 @   | t           vrt          dt          d| d          t          j        t          t          | z            dz   d          }|  d|j        j         d|j	        d	          d
|_
        t          t          j        t                   | |           |S )zMake specific realizations from data files with lazy import from
    `PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_.

    Raises
    ------
    AttributeError
        If "name" is not in :mod:`astropy.cosmology.realizations`
    zmodule z has no attribute .z.ecsvz
ascii.ecsv)formatz instance of z cosmology
(from 	reference))r   AttributeError__name__r	   readstr_COSMOLOGY_DATA_DIR	__class____qualname__meta__doc__setattrsysmodules)namecosmos     r   __getattr__r,      s     9NxNNTNNNOOON$&'''1,  E  	7 	7eo: 	7 	7!J{3	7 	7 	7 
M CK!4///Lr   c                      t           S )z-Directory, including lazily-imported objects.)__all__ r   r   __dir__r0   4   s    Nr   c                       e Zd ZdZdZdZ edd          ed                         Zede	e
edf         d	ee
         fd
            Zeded	e
fd            ZdS )r   a  The default cosmology to use.

    To change it::

        >>> from astropy.cosmology import default_cosmology, WMAP7
        >>> with default_cosmology.set(WMAP7):
        ...     # WMAP7 cosmology in effect
        ...     pass

    Or, you may use a string::

        >>> with default_cosmology.set('WMAP7'):
        ...     # WMAP7 cosmology in effect
        ...     pass

    To get the default cosmology:

        >>> default_cosmology.get()
        FlatLambdaCDM(name="Planck18", H0=67.66 km / (Mpc s), Om0=0.30966, ...
    Planck18z5.0get)alternativec                 B    |dk    rd}n|                      |          }|S )z*Return a cosmology instance from a string.
no_defaultN)_get_from_registry)clsargvalues      r   get_cosmology_from_stringz+default_cosmology.get_cosmology_from_stringW   s.     ,EE**3//Er   r:   Nreturnc                     || j         }t          |t                    r|dk    rd}n>|                     |          }n(t          |t                    st          d| d          |S )aI  Return a Cosmology given a value.

        Parameters
        ----------
        value : None, str, or `~astropy.cosmology.Cosmology`

        Returns
        -------
        `~astropy.cosmology.Cosmology` instance

        Raises
        ------
        TypeError
            If ``value`` is not a string or |Cosmology|.
        Nr6   z>default_cosmology must be a string or Cosmology instance, not r   )_default_value
isinstancer!   r7   r	   	TypeError)r8   r:   s     r   validatezdefault_cosmology.validatea   s    $ =&E eS!! 
	$$..u55E9-- 	        
 r   r*   c                     	 t          t          j        t                   |          }n(# t          $ r t          d|dt                     w xY wt          |t                    st          d| d          |S )a  Get a registered Cosmology realization.

        Parameters
        ----------
        name : str
            The built-in |Cosmology| realization to retrieve.

        Returns
        -------
        `astropy.cosmology.Cosmology`
            The cosmology realization of `name`.

        Raises
        ------
        ValueError
            If ``name`` is a str, but not for a built-in Cosmology.
        TypeError
            If ``name`` is for a non-Cosmology object.
        zUnknown cosmology z. Valid cosmologies:
z+cannot find a Cosmology realization called r   )
getattrr(   r)   r   r   
ValueErrorr   r?   r	   r@   )r8   r*   r:   s      r   r7   z$default_cosmology._get_from_registry   s    *	CK1488EE 	 	 	NTNN9NN  	
 %++ 	SQ$QQQRRRs	   %( %A)r   
__module__r$   r&   r>   _valuer   classmethodr;   r   r	   r!   r   rA   r7   r/   r   r   r   r   >   s         *  NFZ5)))  [ *) !U9c4#78 !Xi=P ! ! ! [!F c i    [  r   )pathlibr(   typingr   r   astropy.utils.datar   astropy.utils.decoratorsr   astropy.utils.stater   corer	   Pathr"   tuplesortedglobr   listr.   __doctest_requires__r,   r0   r   r/   r   r   <module>rT      s`    



 " " " " " " " " 1 0 0 0 0 0 / / / / / / , , , , , ,      "glk69===   E&&LL)<)A)A()K)KLLLLLMM	 +
,ttI
>gY'   4  f f f f f f f f f fr   