
    IR-e
                     &    d dl Zg dZddZddZdS )    N)standardpsdmodellogTc                     |d}t          j        | |          \  } }|dz  }|s|r+t          j        ||           |                                z  }nd}| |z
  |z  }t          j        ||          S )a  Compute the reference chi-square for a particular dataset.

    Note: this is not valid center_data=False and fit_mean=False.

    Parameters
    ----------
    y : array-like
        data values
    dy : float, array, or None, optional
        data uncertainties
    center_data : bool
        specify whether data should be pre-centered
    fit_mean : bool
        specify whether model should fit the mean of the data

    Returns
    -------
    chi2_ref : float
        The reference chi-square for the periodogram of this data
    N   g       r   )npbroadcast_arraysdotsum)ydycenter_datafit_meanwmuyws          Qlib/python3.11/site-packages/astropy/timeseries/periodograms/lombscargle/utils.pycompute_chi2_refr      s|    * 
z2&&EAr
DA h VAq\\AEEGG#
b&BB6"b>>    c                 |   t          j        |           } ||f}|D ]}|t          vrt          | d          ||k    r| S d|v r|t          d          |dk    rdt          j        |            z
  S |dk    rt          j        d| z
             S |dk    rt          j        |           dz
  S |d	k    rt          j        | dz             S |d
k    r| d| z   z  S |dk    r| d| z
  z  S |dk    rt          d|z  | z  |d|          S |dk    rt          | ||d          }d|z  |z  S t          d| d| d          )ah  Convert power from one normalization to another.

    This currently only works for standard & floating-mean models.

    Parameters
    ----------
    Z : array-like
        the periodogram output
    N : int
        the number of data points
    from_normalization, to_normalization : str
        the normalization to convert from and to. Options are
        ['standard', 'model', 'log', 'psd']
    chi2_ref : float
        The reference chi-square, required for converting to or from the
        psd normalization.

    Returns
    -------
    Z_out : ndarray
        The periodogram in the new normalization
    z is not a valid normalizationr   NzHmust supply reference chi^2 when converting to or from psd normalization)r   r   r   )r   r   )r   r   )r   r   )r   r   )r   r      r   )from_normalizationto_normalizationg      ?zconversion from 'z' to '')r	   asarrayNORMALIZATIONS
ValueErrorexpr   convert_normalizationNotImplementedError)ZNr   r   chi2_reffrom_tonorm
Z_standards           r   r    r    '   s   . 	
1A!#34G S S~%% 2QQQRRR & ---H,V
 
 	
 %%%261"::~	'	'	'q1u~	$	$	$vayy1}	$	$	$va!e}}	)	)	)AE{	)	)	)AE{	u	$	$$L1)-	
 
 
 	
 
U	"	"*q%7*
 
 

 X~
**!M 2MM:JMMM
 
 	
r   )NTT)N)numpyr	   r   r   r     r   r   <module>r*      sU       444   BA
 A
 A
 A
 A
 A
r   