python类periodogram()的实例源码

signals.py 文件源码 项目:triflow 作者: locie 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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
BasicEspritExample.py 文件源码 项目:signal_subspace 作者: scivision 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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.]')
functions.py 文件源码 项目:orange3-timeseries 作者: biolab 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
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
autoperiod.py 文件源码 项目:NetPower_TestBed 作者: Vignesh2208 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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)


问题


面经


文章

微信
公众号

扫码关注公众号