Signal objects

class periodicity.core.FSeries(frequency=None, values=None, assume_sorted=False)

Bases: periodicity.core.Signal

curvefit(fun, use_period=False, **kwargs)
property df
downsample(df=None, dp=None, func=<function nanmean>)
property dp
dropna()
fmax()
property frequency
from_xray(xray)
ifft(nfft=None)
property median_df
property median_dp
property period
property period_at_highest_peak
property period_at_highest_prominence
periods_at_half_max(peak_order=1, use_prominence=False)
plot(*args, **kwargs)
pmax()
polyfit(degree, use_period=False)
psort_by_peak()
psort_by_prominence()
class periodicity.core.TFSeries(time=None, frequency=None, values=None)

Bases: periodicity.core.Signal

contour(*args, **kwargs)
contourf(*args, **kwargs)
property df
downsample(dt=None, df=None, dp=None, func=<function nanmean>)
property dp
property dt
property frequency
from_xray(xray)
imshow(*args, **kwargs)
property median_df
property median_dp
property median_dt
pcolormesh(*args, **kwargs)
property period
surface(*args, **kwargs)
property time
class periodicity.core.TSeries(time=None, values=None, assume_sorted=False)

Bases: periodicity.core.Signal

property TEO

Teager Energy Operator (TEO)

J. F. Kaiser, “On Teager’s energy algorithm and its generalization to continuous signals”, Proc. 4th IEEE Signal Processing Workshop, 1990.

acf(max_lag=None, unbias=False)

Auto-Correlation Function implemented using IFFT of the power spectrum.

Parameters
  • max_lag (int or float, optional) – Maximum lag to compute ACF. If given as a float, will be assumed to be a measure of time and the ACF will be computed for lags lower than or equal to max_lag.

  • unbias (bool, optional) – Whether to correct for the “mask effect” (dividing Ryy by the ACF of a signal equal to 1 on the original domain of y and equal to 0 on the padding’s domain).

Returns

acf – ACF of input signal.

Return type

TSeries

acf_period_quality(p_min, p_max)

Calculates the ACF quality of a band-pass filtered version of the signal.

Parameters
  • p_min (float, optional) – Lower cutoff period to filter signal.

  • p_max (float, optional) – Higher cutoff period to filter signal. Must be between p_min and half the baseline.

Returns

  • best_per (float) – Highest peak (best period) for the ACF of the filtered signal.

  • height (float) – Maximum height for the ACF of the filtered signal.

  • quality (float) – Quality factor of the best period.

property baseline
butterworth(fmin=None, fmax=None, order=5)

Implements a IIR butterworth filter.

Parameters
  • fmin (float) – Lower cutoff frequency.

  • fmax (float) – Higher cutoff frequency.

  • order (int, optional) – Order of the butterworth filter. Default is 5.

Returns

filt_signal – Filtered signal.

Return type

TSeries

corr(other)
cov(other)
curvefit(fun, **kwargs)
property derivative
downsample(dt, func=<function nanmean>)
drop(index=None)
dropna()
property dt
fft(oversample=1.0, dt=None)
fill_gaps(dt=None, **kwargs)
fold(period, t0=0)
from_xray(xray, assume_sorted=False)
get_envelope(pad_width=0, **peak_kwargs)

Interpolates maxima/minima with cubic splines into upper/lower envelopes.

Parameters
  • peak_kwargs (float, optional) – Keyword arguments to use in find_extrema.

  • pad_width (int, optional) – Number of extrema to repeat on either side of the signal.

Returns

  • upper (Signal) – Upper envelope.

  • lower (Signal) – Lower envelope.

interp(new_time=None, method='linear', **kwargs)

Interpolation onto a new time grid.

Parameters
  • new_time (ndarray, optional) – Sampling grid. If omitted, it will be uniform with period median_dt.

  • method ({'linear', 'spline', 'nearest', 'zero', 'slinear', 'quadratic', 'cubic'}) – Interpolation method to be used.

  • s (float, optional) – Smoothing condition for the spline. Ignored unless method == “spline”.

Returns

uniform_signal – Interpolated signal.

Return type

Signal

interpolate_na(method='linear', **kwargs)
join(other, **kwargs)
property median_dt
pad(pad_width, **kwargs)
plot(*args, **kwargs)
polyfit(degree)
psd(*args, **kwargs)
split(max_gap=None)
property time
timescale(alpha)
timeshift(t0)
tmax()