API

The central class

pybic.BicAn(inData, **kwargs)

Main class of pybic module, i.e., Bicoherence Analyzer.

Demonstration

pybic.RunDemo()

Demonstration of BicAn.

Signal generation

pybic.SignalGen([fS, tend, Ax, fx, Afx, Ay, ...])

3-oscillator FM signal generator.

pybic.TestSignal(whatsig[, tend, noisy, fS, ...])

Provides various signals for bispectral analysis.

Instantaneous frequency analysis

pybic.WhittakerShannon(x, Ninterp[, fS, T0, ...])

Whittaker-Shannon interpolation.

pybic.InstFreqZeroCross(x[, dt, crossType, ...])

Calculates instantaneous frequency from zero crossings.

Pre-processing

pybic.ApplyDetrend(y)

Remove linear trend from data.

pybic.ApplyBandpass(x[, fS, f0, fband])

Quick and dirty brickwall bandpass filter.

pybic.ApplyRealBandpass(D, fS, flim, fband)

Butterworth bandpass filter.

Time-frequency representations

pybic.HannWindow(N[, q])

Hann window (and all powers of sine).

pybic.FlatTopWindow(N)

Flat-top window.

pybic.ApplyCWT(sig[, samprate, sigma, ...])

Calculate continuous wavelet transform (CWT) of time-series.

pybic.ApplySTFT(sig[, samprate, subint, ...])

Calculate short-time Fourier transform (STFT) of time-series.

pybic.CalcHistVsT(sig[, samprate, subint, ...])

Calculate amplitude histogram vs. time of time-series.

Full polyspectra

pybic.SpecToCoherence(spec[, lilguy])

Estimate cross-spectrum/-coherence from spectrogram.

pybic.SpecToBispec(spec[, v, lilguy])

Estimate auto-bispectrum/-bicoherence spectrum from spectrogram(s).

pybic.SpecToCrossBispec(spec[, v, lilguy])

Estimate cross-bispectrum/-bicoherence spectrum from spectrogram(s).

pybic.SpecToTrispec(spec[, v, lilguy])

Estimate auto-trispectrum/-tricoherence spectrum from spectrogram(s).

Local polyspectra

pybic.GetBispec(spec[, v, lilguy, j, k, rando])

Estimate local bispectrum and bicoherence of a single (f1,f2) value.

pybic.GetBispecBootstrap(spec[, v, lilguy, ...])

Estimate mean and std dev of bicoherence for single (f1,f2) value.

pybic.GetPolySpec(spec, f[, lilguy, rando, v])

Estimate the nth-order polyspectrum/polycoherence spectrum of a given (f1,f2,...,fn) value

Plot aides

pybic.Plot(dats[, strings, color, alpha, ...])

All purpose plotting tool!

pybic.PlotLabels(fig, ax[, strings, fsize, ...])

General purpose plot labels.

pybic.PlotRHS(x, y, ax[, r_col, ylab, ylim, ...])

Add plot and right-hand side (RHS) label to existing plot.

pybic.PlotTop(x, y, ax[, col, xlab, xlim, ...])

Add plot and top label to existing plot.

pybic.PlotTimeline(x, y[, t, fig, ax, lw, ...])

Plot line with color.

pybic.DrawSimplex(flim)

Draws simplex for trispectrum.

pybic.ScaleToString(scale)

Converts order of magnitude to `metric prefix`_.

Helpers

pybic.LoadBar(m, M[, bar_length])

Loading bar animation.

pybic.FileDialog()

Simple file picker dialog.

pybic.nRandSumLessThanUnity(n)

Outputs n numbers whose sum is < 1.

Extras

pybic.arrmin(arr)

Matlab-esque min().

pybic.bin_mat(n)

Creates array of all combinations of [+/-1, +/-1, ...].

pybic.boxcar_ave(x, N)

Smooths data, attempts to return correct amplitudes.

pybic.dphase_dt(z)

Returns gradient of unwrapped phase.