mtm (pyleoclim.utils.spectral.mtm)

pyleoclim.utils.spectral.mtm(ys, ts, NW=None, BW=None, detrend=None, sg_kwargs=None, gaussianize=False, standardize=False, adaptive=False, jackknife=True, low_bias=True, sides='default', nfft=None)[source]

Retuns spectral density using a multi-taper method.

Based on the function in the time series analysis for neuroscience toolbox: http://nipy.org/nitime/api/generated/nitime.algorithms.spectral.html

Parameters
  • ys (array) – a time series

  • ts (array) – time axis of the time series

  • NW (float) – The normalized half-bandwidth of the data tapers, indicating a multiple of the fundamental frequency of the DFT (Fs/N). Common choices are n/2, for n >= 4.

  • BW (float) – The sampling-relative bandwidth of the data tapers

  • detrend (str) –

    If None, no detrending is applied. Available detrending methods:
    • None - no detrending will be applied (default);

    • linear - a linear least-squares fit to ys is subtracted;

    • constant - the mean of ys is subtracted

    • savitzy-golay - ys is filtered using the Savitzky-Golay filters and the resulting filtered series is subtracted from y.

    • emd - Empirical mode decomposition

    sg_kwargsdict

    The parameters for the Savitzky-Golay filters. see pyleoclim.utils.filter.savitzy_golay for details.

    gaussianizebool

    If True, gaussianizes the timeseries

    standardizebool

    If True, standardizes the timeseries

    adaptive{True/False}

    Use an adaptive weighting routine to combine the PSD estimates of different tapers.

    jackknife{True/False}

    Use the jackknife method to make an estimate of the PSD variance at each point.

    low_bias{True/False}

    Rather than use 2NW tapers, only use the tapers that have better than 90% spectral concentration within the bandwidth (still using a maximum of 2NW tapers)

    sidesstr (optional) [ ‘default’ | ‘onesided’ | ‘twosided’ ]

    This determines which sides of the spectrum to return. For complex-valued inputs, the default is two-sided, for real-valued inputs, default is one-sided Indicates whether to return a one-sided or two-sided

Returns

res_dict – the result dictionary, including - freq (array): the frequency vector - psd (array): the spectral density vector

Return type

dict

See also

pyleoclim.utils.spectral.periodogram

Estimate power spectral density using a periodogram

pyleoclim.utils.spectral.welch

Retuns spectral density using the welch method

pyleoclim.utils.spectral.lomb_scargle

Return the computed periodogram using lomb-scargle algorithm

pyleoclim.utils.spectral.wwz_psd

Return the psd of a timeseries using wwz method.

pyleoclim.utils.filter.savitzy_golay

Filtering using Savitzy-Golay

pyleoclim.utils.tsutils.detrend

Detrending method