API Documentation#

API reference for the timescales module.

Table of Contents#

Model Objects#

Objects for computing timescales from PSD or ACF.

PSD#

The PSD object fits power spectra and extracts timescales.

PSD([freqs, powers, fs])

Power spectral density class.

ACF#

The ACF object fits autocorrelation functions and extracts timescales.

ACF([lags, corrs, fs])

Autocorrelation function class.

ARPSD#

The ARPSD object fits power spectra using the AR(p) form.

ARPSD(order, fs[, bounds, ar_bounds, guess, ...])

Fits AR(p) model to PSD.

Autoregressive#

Spectral#

Autoregressive functions.

compute_ar_spectrum(sig, fs, order[, ...])

Compute an autoregressive power spectrum.

burg(sig, order[, demean])

ar_to_psd(ar_coeffs, fs, nfft[, f_range])

Compute PSD from AR coefficients.

Simulations#

LFPs#

Local field potentials as AR, branching, or Ornstein-Uhlenbeck processes.

sim_ar(n_seconds, fs, phi[, init, error])

Simulate a signal given AR coefficients, phi.

sim_ou(n_seconds, fs, tau[, mean, variance])

Simulate spikes as an Ornstein-Uhlenbeck process.

sim_branching(n_seconds, fs, tau, lambda_h)

Simulate a branching Poisson process.

Spikes#

Spike simulations use exponentially decaying probability kernels, convolved with a Poisson.

sim_spikes_synaptic(n_seconds, fs, tau[, ...])

Simulate a spiking autocorrelation as a synaptic kernel.

sim_spikes_prob(n_seconds, fs, kernel[, ...])

Simulate spiking probability.

sim_poisson(n_seconds, fs, kernel[, isi, ...])

Simulate a poisson distribution.

ACF#

sim_acf_cos(xs, fs, exp_tau, osc_tau, ...)

Simulate an autocorrelation with an oscillitory component.

sim_exp_decay(xs, fs, exp_tau, exp_amp[, offset])

Simulate an exponential decay.

sim_damped_cos(xs, fs, osc_tau, osc_amp, ...)

Simulate a damped cosine.

PSD#

sim_ar_spectrum(freqs, fs, phi[, offset])

Simulate theoretical spectral form of an AR(p) model.

sim_lorentzian(freqs, knee_freq[, exponent, ...])

Simulate a Lorentzian with a timescale.

Conversions#

Conversion functions are usefull for convert PSD to/from ACF, and to convert knee frequencies to taus.

psd_to_acf(freqs, powers, fs)

Convert a PSD to ACF.

acf_to_psd(corrs, fs)

Convert ACF to PSD.

tau_to_knee(tau)

tau_to_phi(tau, fs)

phi_to_tau(phi, fs)

knee_to_tau(knee_freq)