+
    ùª¨jO  ã                   ó(  € R t ^ RIt^RIHt R.t/ ^^.b^^.b^^.b^^.b^^.b^^.b^. ROb^	^.b^
^.b^^	.b^. ROb^. ROb^. ROb^^.b^. R	Ob^^.b^^.b^. R
O^^.^^.^^.^^.^. RO^^.^. RO^. RO^^.^^.^. RO^^.^ . RO/CtRR ltR# )zTools for MLS generationN)Ú_max_len_seq_innerÚmax_len_seqc                óB  € \         P                  ! 4       P                  ^8X  d   \         P                  M\         P                  pVfŽ   V \
        9  d`   \         P                  ! \        \
        P                  4       4      4      p\        RVP                  4        RVP                  4        R24      h\         P                  ! \
        V ,          V4      pM£\         P                  ! \         P                  ! W44      4      RRR1,          p\         P                  ! V^ 8  4      '       g0   \         P                  ! W08„  4      '       g   VP                  ^8  d   \        R4      h\         P                  ! V4      p^V ,          ^,
          pVf   TpM\        V4      pV^ 8  d   \        R4      hVf)   \         P                   ! V \         P"                  RR7      pM:\         P                  ! V\$        RR7      P'                  \         P"                  4      pVP(                  ^8w  g   VP                  V 8w  d   \        R	4      h\         P*                  ! V^ 8H  4      '       d   \        R
4      h\         P,                  ! V\         P"                  RR7      p\/        W1WV4      pWq3# )ay	  
Maximum length sequence (MLS) generator.

Parameters
----------
nbits : int
    Number of bits to use. Length of the resulting sequence will
    be ``(2**nbits) - 1``. Note that generating long sequences
    (e.g., greater than ``nbits == 16``) can take a long time.
state : array_like, optional
    If array, must be of length ``nbits``, and will be cast to binary
    (bool) representation. If None, a seed of ones will be used,
    producing a repeatable representation. If ``state`` is all
    zeros, an error is raised as this is invalid. Default: None.
length : int, optional
    Number of samples to compute. If None, the entire length
    ``(2**nbits) - 1`` is computed.
taps : array_like, optional
    Polynomial taps to use (e.g., ``[7, 6, 1]`` for an 8-bit sequence).
    If None, taps will be automatically selected (for up to
    ``nbits == 32``).

Returns
-------
seq : array
    Resulting MLS sequence of 0's and 1's.
state : array
    The final state of the shift register.

Notes
-----
The algorithm for MLS generation is generically described in:

    https://en.wikipedia.org/wiki/Maximum_length_sequence

The default values for taps are specifically taken from the first
option listed for each value of ``nbits`` in:

    https://web.archive.org/web/20181001062252/http://www.newwaveinstruments.com/resources/articles/m_sequence_linear_feedback_shift_register_lfsr.htm

.. versionadded:: 0.15.0

Examples
--------
MLS uses binary convention:

>>> from scipy.signal import max_len_seq
>>> max_len_seq(4)[0]
array([1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0], dtype=int8)

MLS has a white spectrum (except for DC):

>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from numpy.fft import fft, ifft, fftshift, fftfreq
>>> seq = max_len_seq(6)[0]*2-1  # +1 and -1
>>> spec = fft(seq)
>>> N = len(seq)
>>> plt.plot(fftshift(fftfreq(N)), fftshift(np.abs(spec)), '.-')
>>> plt.margins(0.1, 0.1)
>>> plt.grid(True)
>>> plt.show()

Circular autocorrelation of MLS is an impulse:

>>> acorrcirc = ifft(spec * np.conj(spec)).real
>>> plt.figure()
>>> plt.plot(np.arange(-N/2+1, N/2+1), fftshift(acorrcirc), '.-')
>>> plt.margins(0.1, 0.1)
>>> plt.grid(True)
>>> plt.show()

Linear autocorrelation of MLS is approximately an impulse:

>>> acorr = np.correlate(seq, seq, 'full')
>>> plt.figure()
>>> plt.plot(np.arange(-N+1, N), acorr, '.-')
>>> plt.margins(0.1, 0.1)
>>> plt.grid(True)
>>> plt.show()

Nznbits must be between z and z if taps is NonezEtaps must be non-empty with values between zero and nbits (inclusive)z)length must be greater than or equal to 0Úc)ÚdtypeÚorderz'state must be a 1-D array of size nbitszstate must not be all zeroséÿÿÿÿ)ÚnpÚintpÚitemsizeÚint32Úint64Ú	_mls_tapsÚarrayÚlistÚkeysÚ
ValueErrorÚminÚmaxÚuniqueÚanyÚsizeÚintÚonesÚint8ÚboolÚastypeÚndimÚallÚemptyr   )ÚnbitsÚstateÚlengthÚtapsÚ
taps_dtypeÚ
known_tapsÚn_maxÚseqs   &&&&    ÚUC:\Ai_Coding\apps\studio\ComfyUI\.venv\Lib\site-packages\scipy\signal\_max_len_seq.pyr   r      så  € ôf  ŸWšW›Y×/Ñ/°1Ô4”—’¼"¿(¹(€JØ‚|Øœ	Ô!ÜŸš¤$¤y§~¡~Ó'7Ó"8Ó9ˆJÜÐ5°j·n±nÓ6FÐ5GÀuØ *§¡Ó 0Ð1Ð1AðCó Dð Dä�xŠxœ	 %Õ(¨*Ó5‰ä�yŠyœŸš $Ó3Ó4±T°r°TÕ:ˆÜ�6Š6�$˜‘(×ÒœrŸvšv d¡l×3Ò3°t·y±yÀ1´}Üð :ó ;ð ;ä�xŠx˜‹~ˆØ��X˜�N€EØ‚~Ø‰ä�V“ˆØ�AŒ:ÜÐHÓIÐIð ‚}Ü—’˜¤R§W¡W°CÔ8‰ô —’˜¤d°#Ô6×=Ñ=¼b¿g¹gÓFˆØ‡z�z�Q„˜%Ÿ*™*¨Ô-ÜÐBÓCÐCÜ	‡v‚vˆe�q‰j×ÒÜÐ6Ó7Ð7ä
�(Š(�6¤§¡°Ô
4€CÜ˜t¨E¸3Ó?€EØˆ:Ðó    )é   é   é   )é   é
   é   )é   r-   é   )é   r0   é   )é   r2   r/   )é   é   é   )é   é   r6   )é   é   é   )é   r:   r9   )é   é   r*   )é   é   r.   )NNN)Ú__doc__Únumpyr	   r   Ú__all__r   r   © r)   r(   Ú<module>rF      s4  ðñ ã å 2àˆ/€ð)ˆQ��ð )�Q˜˜ð )˜Q  ð ) Q¨¨ð )¨Q°°ð )°Q¸¸ð )¸QÂ	ð )Ø��ð)Ø˜!˜ð)Ø  1 #ð)Ø')ª;ð)Ø8:ºKð)à’ð)à  2 $ð)à(*ªKð)à9;¸b¸Tð)ð �"�ð)ð š<¨¨b¨T°2¸°t¸RÀ"ÀØ�"��rš<¨¨b¨T°2²|Ø’˜r B 4¨¨b¨T°2²{Ø�"��rš<ñ)€	öur)   