
    IR-e                     F    d dgZ ddlmZ ddlZddlmZ d Zd Zd	 Z	d
 Z
dS )bls_fastbls_slow    )partialN   bls_implc           	      V    t          t          | |||||          }t          ||          S )aK  Compute the periodogram using a brute force reference method.

    t : array-like
        Sequence of observation times.
    y : array-like
        Sequence of observations associated with times t.
    ivar : array-like
        The inverse variance of ``y``.
    period : array-like
        The trial periods where the periodogram should be computed.
    duration : array-like
        The durations that should be tested.
    oversample :
        The resolution of the phase grid in units of durations.
    use_likeliood : bool
        If true, maximize the log likelihood over phase, duration, and depth.

    Returns
    -------
    power : array-like
        The periodogram evaluated at the periods in ``period``.
    depth : array-like
        The estimated depth of the maximum power model at each period.
    depth_err : array-like
        The 1-sigma uncertainty on ``depth``.
    duration : array-like
        The maximum power duration at each period.
    transit_time : array-like
        The maximum power phase of the transit in units of time. This
        indicates the mid-transit time and it will always be in the range
        (0, period).
    depth_snr : array-like
        The signal-to-noise with which the depth is measured at maximum power.
    log_likelihood : array-like
        The log likelihood of the maximum power model.

    )r   _bls_slow_one_apply)tyivarperiodduration
oversampleuse_likelihoodfs           Klib/python3.11/site-packages/astropy/timeseries/periodograms/bls/methods.pyr   r      s.    L 	q!T8ZPPA!V    c           	      ,    t          | ||||||          S )aO  Compute the periodogram using an optimized Cython implementation.

    t : array-like
        Sequence of observation times.
    y : array-like
        Sequence of observations associated with times t.
    ivar : array-like
        The inverse variance of ``y``.
    period : array-like
        The trial periods where the periodogram should be computed.
    duration : array-like
        The durations that should be tested.
    oversample :
        The resolution of the phase grid in units of durations.
    use_likeliood : bool
        If true, maximize the log likelihood over phase, duration, and depth.

    Returns
    -------
    power : array-like
        The periodogram evaluated at the periods in ``period``.
    depth : array-like
        The estimated depth of the maximum power model at each period.
    depth_err : array-like
        The 1-sigma uncertainty on ``depth``.
    duration : array-like
        The maximum power duration at each period.
    transit_time : array-like
        The maximum power phase of the transit in units of time. This
        indicates the mid-transit time and it will always be in the range
        (0, period).
    depth_snr : array-like
        The signal-to-noise with which the depth is measured at maximum power.
    log_likelihood : array-like
        The log likelihood of the maximum power model.

    r   )r   r   r   r   r   r   r   s          r   r   r   6   s    L Aq$*nMMMr   c           
      l   t           j         df}d|z  }t          j        |           }	|D ]}
|
|z  }t          j        d||z   |          }|D ]\}t          j        | |	z
  |z
  |z   |z  |z
            d|
z  k     }| }t          j        ||                   }t          j        ||                   }t          j        ||         ||         z            |z  }t          j        ||         ||         z            |z  }||z
  }t          j        d|z  d|z  z             }||z  }dt          j        |||         z
  dz  ||         z            z  }|dt          j        |||         z
  dz  ||         z            z  z  }|r|}n|}|dk    r||d         k    r|||||
||	z   |z  ||ff}^|d         S )zAA private function to compute the brute force periodogram result.Ng      ?r   g      ?g         r   )npinfminarangeabssumsqrt)r   r   r   r   r   r   r   besthpmin_tdurd_phasephaset0m_inm_outivar_inivar_outy_iny_outdepth	depth_errsnrloglike	objectives                            r   r
   r
   _   s   VGT?D	vBF1IIE , ,
"	!Vg-w77 '	 '	B61u9r>B.&82=>>sJDEE fT$Z((Gvd5k**H6!D'DJ.//'9DF1U8d5k122X=E DLEgh >??I)#C RVTAdG^$9DJ$FGGGGsRVUQtW_$:T$Z$GHHHHG   #			 qyyYa00!!ev-9'	R 7Nr   c                 z    t          t          t          j        t	          t          | |                               S )N)tuplemapr   arrayzip)r   r   s     r   r   r      s)    RXsC6NN344555r   )__all__	functoolsr   numpyr   _implr   r   r   r
   r    r   r   <module>r<      s    z
"                ' ' 'T&N &N &NR3 3 3l6 6 6 6 6r   