o
    e                     @   s   d Z ddlZdd ZdS )z9Tools for spectral analysis of unequally sampled signals.    Nc                 C   s  | j |j kr
tdt|}t| }t| }t|j d D ]}d}d}d}	d}
d}t|| |  |dd< t|| |  |dd< t| j d D ]4}||| ||  7 }||| ||  7 }|	|| ||  7 }	|
|| ||  7 }
||| ||  7 }qM|| dkrt td| |	|
 d||   }t|| | }t|| | }|| }|| }d| | }d|| ||  d ||	 ||  ||
   || ||  d ||
 ||  ||	     ||< q |S )a"  
    _lombscargle(x, y, freqs)

    Computes the Lomb-Scargle periodogram.

    Parameters
    ----------
    x : array_like
        Sample times.
    y : array_like
        Measurement values (must be registered so the mean is zero).
    freqs : array_like
        Angular frequencies for output periodogram.

    Returns
    -------
    pgram : array_like
        Lomb-Scargle periodogram.

    Raises
    ------
    ValueError
        If the input arrays `x` and `y` do not have the same shape.

    See also
    --------
    lombscargle

    z'Input arrays do not have the same size.r   g        N   g      ?)	shape
ValueErrornp
empty_likerangecossinZeroDivisionErrorarctan2)xyfreqspgramcsixcxsccsscsjtauc_taus_tauc_tau2s_tau2cs_tau r   E/var/www/myenv/lib/python3.10/site-packages/scipy/signal/_spectral.py_lombscargle	   sF    


 r!   )__doc__numpyr   r!   r   r   r   r    <module>   s   