src.spenv
Attributes
Functions
|
Apply a cosine-bell taper to a time series. |
|
Computes the spectral density estimate using a periodogram. |
|
Spectral envelope of real-valued time series. |
|
Automatically smoothes a time series using the Spectral Envelope method. |
Module Contents
- src.spenv.__version__
- src.spenv.spec_taper(x, p=0.1)
Apply a cosine-bell taper to a time series.
Computes a tapered version of x, with tapering proportion p at each end of x.
- Parameters:
x (float) – A univariate or multivariate time series
p (float) – The proportion to be tapered at each end of the series, either a scalar (giving the proportion for all series) or a vector of the length of the number of series (giving the proportion for each series).
- Returns:
A new time series.
- Return type:
x (float)
Adapted from R’s stats::spec.taper.
- src.spenv.mvspec(x, xfreq=1, spans=None, kernel=None, taper=0.1, pad=0, fast=True, demean=False, detrend=True, minimal=True, option_summary=False, **kwargs)
Computes the spectral density estimate using a periodogram.
- Parameters:
x (numpy array) – Univariate or multivariate time series.
xfreq (optional) – Number of samples per unit time. Defaults to 1.
spans (optional) – Sequence of spans for convoluted Daniell smoothers. Defaults to None.
kernel (optional) – Defines Kernel for smoothing. Defaults to None.
taper (optional) – Defines proportion for tapering start and end of series to avoud end-of-signal effects. Defaults to 0.1.
pad (optional) – Pads the provided series before computation, adding pad*(length of series) zeros at the end. Defaults to 0.
fast (optional) – [description]. Defaults to True.
demean (optional) – Demeans series. Defaults to False.
detrend (optional) – Detrends series. Defaults to True.
minimal (optional) – Returns only frequency and spectrum. Overrides option_summary. Defaults to True.
option_summary (optional) – Returns specified options alongside results. Defaults to False.
Adapted from R’s astsa::mvspec and the spec_pgram function in https://github.com/kircherlab/cfDNA.
- src.spenv.specenv(xdata, xfreq=1, spans=None, kernel=None, taper=0, pad=0, fast=True, demean=False, detrend=True, **kwargs)
Spectral envelope of real-valued time series.
Computes the Spectral Envelope as described in Time Series Analysis and Its Applications with R Examples and the R package ASTSA.
- src.spenv.spec_opt(x, *args, as_series=False)
Automatically smoothes a time series using the Spectral Envelope method.
- Parameters:
x (numpy array) – Univariate time series.
*args (optional) – Mapping functions for the Spectral Envelope.