neurotools.signal.multitaper module

Routines for multi-taper spectral analysis

neurotools.signal.multitaper.dpss_cached(length, half_bandwidth_parameter)[source]

Get a collection of DPSS tapers. The number of tapers equals the half bandwidth parameter times two. For legacy reasons the tapers are returned transposed such that the first dimension indexes tapers rather than time.

The advantage of using this function is that computing DPSS is expensive. This function caches the results in RAM.

Parameters:
  • length (integer) – length of the domain for which to compute the DPSS

  • half_bandwidth_parameter (number) – The number of is the half_bandwidth_parameter*2

Returns:

  • ndarray – tapers.T a transposed list of DPSS tapers

  • ndarray – taper eigenvalues ( weights )

neurotools.signal.multitaper.spectrum(x, k, Fs=1000.0, nodc=True, return_negative=False)[source]
Parameters:
  • x (ndarray) – Signal to use; spectrum taken over last dimension

  • k (int (positive)) – number of tapers (positive)

  • Fs (int) – sample rate in Hz (default 1000)

Returns:

  • ndarray – frequencies,

  • ndarray – average squared power over tapers.

neurotools.signal.multitaper.population_coherence(x, y, FS, lowf=0, highf=None, k=None)[source]

Computes coherence spectrum between two collections of signals. Uses multitaper averaging. For each frequency, computes a pairwise matrix of coherence between both collections of signals. Returns the sum of the singular values of this coherence matrix as a summary of population coherence.

neurotools.signal.multitaper.population_eigencoherence(x, y, FS, lowf=0, highf=None, k=None, use_parallel=False)[source]

Computes coherence spectrum between two collections of signals. Uses multitaper averaging. For each frequency, computes a pairwise matrix of coherence between both collections of signals. Returns the sum of the singular values of this coherence matrix as a summary of population coherence.