API Documentation¶
This is the API reference for the neurodsp module.
Table of Contents¶
Filtering¶
Functions and utilities in the filt
module, for filtering time series.
General Filter Function¶
|
Apply a bandpass, bandstop, highpass, or lowpass filter to a neural signal. |
FIR Filters¶
|
Apply an FIR filter to a signal. |
|
Design an FIR filter. |
IIR Filters¶
|
Apply an IIR filter to a signal. |
|
Design an IIR filter. |
Check Filter Properties¶
|
Check a filter definition for validity, and get filter frequency range of the filter. |
|
Check a filters properties, including pass band and transition band. |
Filter Utilities¶
|
Compute the frequency response of a filter. |
|
Compute the pass bandwidth of a filter. |
|
Compute transition bandwidth of a filter. |
|
Compute the Nyquist frequency. |
|
Drop the edges, by making NaN, from a filtered signal, to avoid edge artifacts. |
Time-Frequency Analyses¶
Functions and utilities in the timefrequency
module, for time-frequency analyses.
Hilbert Methods¶
|
Compute the Hilbert transform, ignoring any boundaries that are NaN. |
|
Compute the instantaneous phase of a time series. |
|
Compute the instantaneous amplitude of a time series. |
|
Compute the instantaneous frequency of a time series. |
Wavelet Methods¶
|
Compute the time-frequency representation of a signal using morlet wavelets. |
|
Convolve a signal with a complex wavelet. |
Spectral Analyses¶
Functions and utilities in the spectral
module, for spectral analyses.
Spectral Power¶
|
Compute the power spectral density of a time series. |
|
Compute the power spectral density using Welch's method. |
|
Compute the power spectral density using wavelets. |
|
Compute the power spectral density as a smoothed FFT. |
Spectral Measures¶
|
Compute absolute power for a given frequency band. |
|
Compute relative power for a given frequency band. |
|
Calculate band ratio measure between two predefined frequency ranges. |
Spectral Variance¶
|
Compute the spectral coefficient of variation (SCV) at each frequency. |
|
Compute a resampled version of the spectral coefficient of variation (SCV). |
|
Compute the distribution of log10 power at each frequency from the signal spectrogram. |
Spectral Utilities¶
|
Extract a frequency range of interest from power spectra. |
|
Extract a frequency or time range of interest from a spectrogram. |
Burst Detection¶
Functions and utilities in the burst
module, for detection bursts in time series.
Burst Detection Algorithms¶
|
Detect bursts in a signal using the dual threshold algorithm. |
Burst Utilities¶
|
Compute statistics of bursts. |
Rhythm Analyses¶
Functions and utilities in the rhythm
module, for finding and analyzing rhythmic and recurring patterns in time series.
Sliding Window Matching¶
|
Find recurring patterns in a time series using the sliding window matching algorithm. |
Lagged Coherence¶
|
Compute lagged coherence, reflecting the rhythmicity across a frequency range. |
Aperiodic Analyses¶
Functions and utilities in the aperiodic
module, for analyzing aperiodic activity in time series.
Auto-correlation Analyses¶
|
Compute the signal autocorrelation (lagged correlation). |
Fluctuation Analyses¶
|
Compute a fluctuation analysis on a signal. |
|
Compute rescaled range of a given time series at a given scale. |
|
Compute detrended fluctuation of a time series at the given window length. |
Signal Decomposition¶
|
Separate aperiodic and periodic components using IRASA. |
|
Fit the IRASA derived aperiodic component of the spectrum. |
Conversions¶
|
Convert a powerlaw exponent to the expected DFA alpha value. |
|
Convert a DFA alpha value to the expected powerlaw exponent. |
|
Convert a powerlaw exponent to the expected Hurst exponent value. |
|
Convert a Hurst exponent value to the expected powerlaw exponent. |
|
Convert exponent to expected Higuchi fractal dimension value. |
|
Convert Higuchi fractal dimension value to expected 1/f exponent value. |
Simulations¶
Functions and utilities in the sim
module, for simulating time series.
Periodic Signals¶
|
Simulate an oscillation. |
|
Simulate a bursty oscillation. |
|
Simulate an oscillation that varies in frequency and cycle parameters. |
|
Simulate a damped relaxation oscillation. |
Aperiodic Signals¶
|
Simulate a power law time series, with a specified exponent. |
|
Simulate a Poisson population. |
|
Simulate a signal as a synaptic current, which has 1/f characteristics with a knee. |
|
Simulate a signal whose power spectrum has a 1/f structure with a knee. |
|
Simulate a mean-reverting random walk, as an Ornstein-Uhlenbeck process. |
|
Simulate a timeseries as fractional gaussian noise. |
|
Simulate a timeseries as fractional brownian motion. |
Transients¶
|
Simulate a synaptic kernel with specified time constants. |
|
Simulate an action potential as the sum of skewed gaussians. |
|
Simulate an ERP complex as a decaying (damped) sine wave. |
Cycles¶
|
Simulate a single cycle of a periodic pattern. |
|
Simulate a cycle of a sine wave. |
|
Simulate a cycle of an asymmetric sine wave. |
|
Simulate a cycle of a sawtooth wave. |
|
Simulate a cycle of a gaussian. |
|
Simulate a cycle of a skewed gaussian. |
|
Simulate an exponential cosine cycle. |
|
Simulate an asymmetrical cycle as a sum of harmonics. |
Combined Signals¶
|
Simulate a signal by combining multiple component signals. |
|
Simulate a signal with an aperiodic component and a specific oscillation peak. |
|
Simulate an amplitude modulated signal. |
Utilities¶
|
Rotate the power law exponent of a power spectrum. |
|
Rotate a timeseries of data, changing it's 1/f exponent. |
|
Apply amplitude modulation to a signal. |
Random Seed¶
|
Set the random seed value. |
Plots¶
Functions in the plts
module, for plotting time series and analysis outputs.
Time Series¶
|
Plot a time series. |
|
Plot an instantaneous measure, of phase, amplitude or frequency. |
|
Plot a time series, with labeled bursts. |
Spectral¶
|
Plot power spectra. |
|
Plot spectral coefficient of variation. |
|
Plot spectral coefficient of variation, from the resampling method, as lines. |
|
Plot spectral coefficient of variation, from the resampling method, as a matrix. |
|
Plot spectral histogram. |
Filter¶
|
Plot filter properties, including frequency response and filter kernel. |
|
Plot the frequency response of a filter. |
|
Plot the impulse response of a filter. |
Rhythm¶
|
Plot the resulting pattern from a sliding window matching analysis. |
|
Plot lagged coherence values across frequencies. |
Time Frequency¶
|
Plot a time-frequency representation of data. |
Utilities¶
Functions in the utils
module, providing general utilities.
Normalization¶
|
Normalize the mean and variance of a signal. |
|
Demean an array, updating to specified mean. |
|
Normalize the variance of an array, updating to specified variance. |
Data¶
|
Create an array of frequencies. |
|
Create an array of time indices. |
|
Create an array of sample indices. |
|
Calculate the number of samples for a given time definition. |
|
Compute the length, in time, of a signal. |
|
Compute the length, in seconds, for a single cycle at a particular frequency. |
|
Split a signal into non-overlapping segments. |
Outliers¶
|
Drop any NaNs on the edges of an array. |
|
Restore NaN values to the edges of an array. |
|
Discard outlier arrays with high values. |