Python scipy.signal 模块,periodogram() 实例源码

我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用scipy.signal.periodogram()

项目:triflow    作者:locie    | 项目源码 | 文件源码
def fourrier_spectrum(self, *args, **kwargs):
        """
          Parameters
          ----------
          *args, **kwargs
              extra arguments provided to the periodogram function.

          Returns
          -------
          tuple of numpy.ndarray: fourrier modes and power density obtained with the scipy.signal.periodogram function.
          """  # noqa
        freq, ampl = periodogram(self._template, fs=1 / self._dt)
        return freq, ampl
项目:signal_subspace    作者:scivision    | 项目源码 | 文件源码
def plotperiodogram(t,x,fs,ax,ttxt):
    fax,Pxx = periodogram(x,fs,'hanning')
    ax[0].plot(fax,10*np.log10(abs(Pxx)))
    ax[0].set_title(ttxt)

    ax[1].plot(t,x)
    ax[1].set_ylim(-1,1)
    ax[1].set_xlabel('time [sec.]')
项目:orange3-timeseries    作者:biolab    | 项目源码 | 文件源码
def periodogram(x, *args, detrend='diff', **kwargs):
    """
    Return periodogram of signal `x`.

    Parameters
    ----------
    x: array_like
        A 1D signal.
    detrend: 'diff' or False or int
        Remove trend from x. If int, fit and subtract a polynomial of this
        order. See also: `statsmodels.tsa.detrend`.
    args, kwargs:
        As accepted by `scipy.signal.periodogram`.

    Returns
    -------
    periods: array_like
        The periods at which the spectral density is calculated.
    pgram: array_like
        Power spectral density of x.
    """
    from scipy.signal import periodogram
    x = _detrend(x, detrend)
    freqs, pgram = periodogram(x, *args, detrend=False, **kwargs)

    SKIP = len(x) // 1000  # HACK: For long series, the first few frequency/period values are "unstable".
    freqs, pgram = freqs[SKIP:], pgram[SKIP:]

    periods = 1 / freqs
    periods, pgram = _significant_periods(periods, pgram)
    return periods, pgram
项目:NetPower_TestBed    作者:Vignesh2208    | 项目源码 | 文件源码
def getPowerSpectralDensity(X,fs=1.0):
    assert fs > 0
    f, Pxx_den = signal.periodogram(X, fs,scaling='density',window=None,detrend=False)
    return (f,Pxx_den)