mtcross module

Module that contains all multivariate-multitaper codes.

Contains:
  • mt_cohe

  • mt_deconv

  • To do: wv_spec

Module with routines for bi-variate multitaper spectrum estimation. Contains the main MTCross and SineCross classes where the estimates are made and stored.

It takes univariate classes MTSpec and MTSine for estimating coherence tranfer functions, etc.

See module mtspec for univariate problems

Classes

  • MTCross - A class to represent Thomson’s multitaper cross-spectra

  • SineCross - A class to represent Sine Multitaper cross-spectra

Functions

None


class mtcross.MTCross(x, y, nw=4, kspec=0, dt=1.0, nfft=0, iadapt=0, wl=0.0)

Bases: object

A class for bi-variate Thomson multitaper estimates. It performs main steps in bi-variate multitaper estimation, including cross-spectrum, coherency and transfer function.

Attributes

Parameters

nptsint

number of points of time series

nfftint

number of points of FFT. Dafault adds padding.

nwflaot

time-bandwidth product

kspecint

number of tapers to use

Time series

xndarray [npts]

time series

xvarfloat

variance of time series

dtfloat

sampling interval

Frequency vector

nfint

number of unique frequency points of spectral estimate, assuming real time series

freqndarray [nfft]

frequency vector in Hz

dffloat

frequncy sampling interval

Method

iadaptint

defines methos to use 0 - adaptive multitaper 1 - unweighted, wt =1 for all tapers 2 - wt by the eigenvalue of DPSS

wlfloat, optional

water-level for stabilizing deconvolution (transfer function). defined as proportion of mean power of Syy

Spectral estimates

Sxxndarray [nfft]

Power spectrum of x time series

Syyndarray [nfft]

Power spectrum of y time series

Sxyndarray, complex [nfft]

Coss-spectrum of x, y series

cohendarray [nfft]

MSC, freq coherence. Normalized (0.0,1.0)

phasendarray [nfft]

the phase of the cross-spectrum

cohyndarray, complex [nfft]

the complex coherency, normalized cross-spectrum

trfndarray, compolex [nfft]

the transfer function Sxy/(Syy_wl), with water-level optional

sendarray [nfft,1]

degrees of freedom of estimate

wtndarray [nfft,kspec]

weights for each eigencoefficient at each frequency

Methods

  • init : Constructor of the MTCross class

  • mt_deconv : Perform the deconvolution from the self.trf, by iFFT

  • mt_corrcompute time-domain via iFFT of cross-spectrum,

    coherency, and transfer function

Modified

German Prieto January 2022


mt_corr()

Compute time-domain via iFFT of cross-spectrum, coherency, and transfer function

Cross spectrum, coherency and transfer function already pre-computed in MTCross.

Returns

xcorrndarray [nfft]

time domain of the transfer function.

dcohyndarray [nfft]

time domain of the transfer function.

dfunndarray [nfft]

time domain of the transfer function.

Delay time t=0 in centered in the middle.

Notes

The three correlation-based estimates in the time domain
  • correlation (cross-spectrum)

  • deconvolution (transfer function)

  • norm correlation (coherency)

Correlation:
  • Sxy = Sx*conj(Sy)

Deconvolution:
  • Sxy/Sy = Sx*conj(Sy)/Sy^2

Coherency
  • Sxy/sqrt(Sx*Sy)


mt_deconv()

Generate a deconvolution between two time series, returning the time-domain signal.

MTCross has already pre-computed the cross-spectrum and the transfer function.

Returns

dfunndarray [nfft]

time domain of the transfer function. delay time t=0 in centered in the middle.

References

The code more or less follows the paper Receiver Functions from multiple-taper spectral corre- lation estimates. J. Park and V. Levin., BSSA 90#6 1507-1520

It also uses the code based on dual frequency I created in GA Prieto, Vernon, FL , Masters, G, and Thomson, DJ (2005), Multitaper Wigner-Ville Spectrum for Detecting Dispersive Signals from Earthquake Records, Proceedings of the Thirty-Ninth Asilomar Conference on Signals, Systems, and Computers, Pacific Grove, CA., pp 938-941.


class mtcross.SineCross(x, y, ntap=0, ntimes=0, fact=1.0, dt=1.0, p=0.95)

Bases: object

A class for bi-variate Sine multitaper estimates. Performs the coherence and cross-spectrum estimation using the sine multitaper method.

Attributes

Parameters
nptsint

number of points of time series

nfftint

number of points of FFT. nfft = 2*npts

Time series
xndarray [npts]

time series x

xvarfloat

variance of x time series

yndarray [npts]

time series y

yvarfloat

variance of y time series

dtfloat

sampling interval

Frequency vector
nfint

number of unique frequency points of spectral estimate, assuming real time series

freqndarray [nfft]

frequency vector in Hz

dffloat

frequncy sampling interval

Method
ntapint

fixed number of tapers if ntap<0, use kopt

koptndarray [nfft,1]

number of tapers at each frequency

ntimesint

number of max iterations to perform

irealint

0 - real time series 1 - complex time series

Spectral estimates
cspecndarray, complex [nfft]

Coss-spectrum of x, y series

sxyndarray, complex [nfft]

Coss-spectrum of x, y series

cohendarray [nfft]

MSC, freq coherence. Normalized (0.0,1.0)

phasendarray [nfft]

the phase of the cross-spectrum

gainndarray [nfft]

the gain for the two spectra

cohyndarray, complex [nfft]

the complex coherency, normalized cross-spectrum

trfndarray, compolex [nfft]

the transfer function Sxy/(Syy_wl), with water-level optional

sendarray [nfft,1]

degrees of freedom of estimate

confndarray [nfft,]

confidence in cross-spectrum at each frequency

Methods

  • init : Constructor of the SineCross class

  • mt_deconv : Perform the deconvolution from the self.trf, by iFFT

  • mt_corrcompute time-domain via iFFT of cross-spectrum,

    coherency, and transfer function

References

Riedel and Sidorenko, IEEE Tr. Sig. Pr, 43, 188, 1995

Based on Bob Parker psd.f and cross.f codes. Most of the comments come from his documentation as well.

Modified

January 2022, German A. Prieto


mt_corr()

Compute time-domain via iFFT of cross-spectrum, coherency, and transfer function

Cross spectrum, coherency and transfer function already pre-computed in SineCross class.

Returns

xcorrndarray [nfft]

time domain of the transfer function.

dcohyndarray [nfft]

time domain of the transfer function.

dfunndarray [nfft]

time domain of the transfer function.

Delay time t=0 in centered in the middle.

Notes

The three correlation-based estimates in the time domain
  • correlation (cross-spectrum)

  • deconvolution (transfer function)

  • norm correlation (coherency)

Correlation:
  • Sxy = Sx*conj(Sy)

Deconvolution:
  • Sxy/Sy = Sx*conj(Sy)/Sy^2

Coherency
  • Sxy/sqrt(Sx*Sy)


mt_deconv()

Generate a deconvolution between two time series, returning the time-domain signal.

SineCross has already pre-computed the cross-spectrum and the transfer function.

Returns

dfunndarray [nfft]

time domain of the transfer function. delay time t=0 in centered in the middle.