Created on Mon May 03 14:53:54 2010
@author: a1185872
dctrend(f) will remove a dc trend from the function f.
Will decimate a function by the factor m. First an 8th order Cheybechev type I filter with a cuttoff frequency of .8/m is applied in both directions to minimize any phase distortion and remove any aliasing. Note decimation values above 10 will typically result in bad coefficients, therefore if you decimation is more than 10 just repeat the decimation until the desired decimation is reached.
Calculates the derivative of the given window
gausswin will compute a gaussian window of length winlen with a variance of alpha
will calculate the modified b distribution as defined by cosh(n)^-2 beta for a function fx.
tstep = time step between windows nfbins = number of frequencies df = sampling frequency (Hz) nh = length of time-domain smoothing window (needs to be odd) beta = smoothing coefficient
normalizeL2(f) will return the function f normalized by the L2 norm -> f/(sqrt(sum(abs(x_i)^2))).
padzeros(f) will return a function that is padded with zeros to the next power of 2 for faster processing for fft or to length npad if given.
plottf(tfarray,tlst,flst,fignum=1) will plot a calculated tfarray with limits corresponding to tlst and flst. Can have:
starttime = starttime measured in timeincrement timeincrement = ‘hrs’,’min’ or ‘sec’ vmm = [vmin,vmax] a list for min and max title = title string cmap = colormap scheme default is jet, type help on matplotlib.cm aspect = aspect of plot, default is auto, can be ‘equal’ or a scalar interpolation = type of color interpolation, type help on
matplotlib.pyplot.imshow
cbori = colorbar orientation ‘horizontal’ or ‘vertical’ cbshrink = percentage of 1 for shrinking colorbar cbaspect = aspect ratio of long to short dimensions cbpad = pad between colorbar and axis normalization = y or n, y for normalization n for none
plottf(tfarray,tlst,flst,fignum=1) will plot a calculated tfarray with limits corresponding to tlst and flst.
Inputs:
starttime = starttime measured in timeincrement tinc = ‘hrs’,’min’ or ‘sec’ vmm = [vmin,vmax] a list for min and max title = title string cmap = colormap scheme default is jet, type help on matplotlib.cm aspect = aspect of plot, default is auto, can be ‘equal’ or a scalar interpolation = type of color interpolation, type help on
matplotlib.pyplot.imshowcbori = colorbar orientation ‘horizontal’ or ‘vertical’ cbshrink = percentage of 1 for shrinking colorbar cbaspect = aspect ratio of long to short dimensions cbpad = pad between colorbar and axis powscale = linear or log for power normalize = y or n, yes for normalization, n for no yscale = linear or log plot yscale period = ‘y’ or ‘n’ to plot in period instead of frequency
will calulate the reassigned S-method as described by Djurovic[1999] by using the spectrogram to estimate the reassignment
fx = 1-d array to be processed nh = window length for each time instance tstep = step between time instances nfbins = number of frequency bins, note output will be nfbins/2 due to
symmetry of the FFT
df = sampling rate (Hz) alpha = inverse of full-width half max of gaussian window, smaller
numbers mean broader windows
reassignedstft(fx,nh=2**5-1,tstep=2**8,nfbins=2**10,df=1.0,alpha=20) will compute the reassigned spectrogram by estimating the center of gravity of the signal and condensing dispersed energy back to that location.
fx = time series to be analyzed nh = length of gaussian window, should be odd tstep = time step for each window calculation nfbins = number of frequency bins to calculate, note result will be
length nfbins/2
df = sampling frequency (Hz) alpha = reciprocal of full width half max of gaussian window threshold = threshold value for reassignment
robustSmethod(fx,L=15,nh=2**7,tstep=2**5,nfbins=2**10,df=1.0) computes the robust Smethod via the robust spectrogram.
robuststftL(fx,nh=2**8,tstep=2**5,ng=1,df=1.0) will output an array of the time-frequency robust spectrogram by estimating the vector median and summing terms estimated by alpha coefficients.
robuststftMedian(fx,nh=2**8,tstep=2**5,ng=1,df=1.0) will output an array of the time-frequency robust spectrogram calculated using the vector median simplification.
will calculate the smoothed pseudo Wigner-Ville distribution for a function fx. smoothed with Gaussians windows to get best localization.
tstep = time step between windows nfbins = number of frequencies df = sampling frequency (Hz) ng = length of time-domain smoothing window (needs to be odd) nh = length of frequency-domain smoothing window (needs to be odd) sigmanh = std of window h, ie full width half max of gaussian sigmang = std of window g, ie full width half max of gaussian
Will apply a sinc filter of width w to the function f by multipling in the frequency domain. Returns filtered function
smethod(fx,L=11,nh=2**8,tstep=2**7,ng=1,df=1.0,nfbins=2**10) will calculate the smethod by estimating the STFT first and computing the WV of window length L in the frequency domain. For larger L more of WV estimation, if L=0 get back STFT
L = window length in frequency domain nh = window length for each time step tstep = time step between short windows ng = smoothing window along frequency plane should be odd df = sampling frequency nfbins = number of frequency bins
specwv(f,tstep=2**5,nfbins=2**10,nh=2**8-1,ng=1,df=1.0) will calculate the Wigner-Ville distribution mulitplied by the STFT windowed by the common gaussian window h for a function f.
will calculate the smoothed pseudo Wigner-Ville distribution for a function fx. smoothed with Gaussians windows to get best localization.
tstep = time step between windows nfbins = number of frequencies df = sampling frequency (Hz) ng = length of time-domain smoothing window (needs to be odd) nh = length of frequency-domain smoothing window (needs to be odd) sigmat = std of window h, ie full width half max of gaussian sigmaf = std of window g, ie full width half max of gaussian
estimates sources using a blind source algorithm based on spatial time-frequency distributions. At the moment this algorithm uses the SPWVD to estimate TF distributions.
nsources = number of estimated sources ng = frequency window length nh = time window length tstep = time step increment df = sampling frequency (Hz) nfbins = number of frequencies tftol = tolerance for a time-frequency point to be estimated as a cross
term or as an auto term, the higher the number the more auto terms.
Outputs:
Se = estimated individual signals up to a permutation and scale Ae = estimated mixing matrix as X=A*S
stft(fx,nh=2**8,tstep=2**7,ng=1,df=1.0) will calculate the spectrogam of the given function by calculating the fft of a window of length nh at each time instance with an interval of tstep. The frequency resolution is nfbins Can compute the cross STFT by inputting fx as [fx1,fx2]
nh = window length for each time step tstep = time step between short windows ng = smoothing window along frequency plane should be odd df = sampling frequency nfbins = number of frequency bins
wvd(f,nh=2**8-1,tstep=2**5,nfbins=2**10,df=1.0) will calculate the Wigner-Ville distribution for a function f. Can compute the cross spectra by inputting fx as [fx1,fx2]
nh = window length, needs to be odd so centered on zero tstep = time step between windows nfbins = number of frequencies df = sampling frequency (Hz)
wvdas(fx) will compute the analytic signal for WVVD as defined by J. M. O’ Toole, M. Mesbah, and B. Boashash, (2008), “A New Discrete Analytic Signal for Reducing Aliasing in the Discrete Wigner-Ville Distribution”, IEEE Trans. on Signal Processing,