digger.analyze.wavelet

Module Contents

Functions

wavelet

This function takes the same positional arguments as digger.analyze.spectrogram.spectrogram(): minimum width, maximum width, and number of widths for wavelet analysis can be modified if desired. Wavelet coefficients are output and can optionally be plotted on a scalogram.

API

digger.analyze.wavelet.wavelet(t0, simlength, eta, samprate, gauge, minwidth=30, maxwidth=2000, nwidths=20, waterlevel=0, plot=False, plotname='wavelet', plotform='png', dpi=210, outdir=None)

This function takes the same positional arguments as digger.analyze.spectrogram.spectrogram(): minimum width, maximum width, and number of widths for wavelet analysis can be modified if desired. Wavelet coefficients are output and can optionally be plotted on a scalogram.

Uses wave arrival time (t0) and amplitude array (eta) to perform a continuous wavelet transform and generate a scalogram for wave data. The Ricker (“Mexican hat”) wavelet is used. A detrended (simple) time series is also output. The default values are tailored toward analysis of water wave data, but can be adapted for any wave type.

This analysis requires that input data be equally-spaced in time corresponding to the provided sample rate. The accompanying function, gauge2ts, can perform this task.

Any time between the start of the simulation (t=0) and the time of wave arrival (it is assumed that t[0] != 0) is padded with zeros at the defined sample rate. This enables an accurate depiction of the frequency domain from the start of the simulation.

Inputs:
t:

numpy 1-D array containing sampling times in seconds

eta:

numpy 1-D array containing wave amplitudes

samprate:

sample rate (Hz) of input data

gauge:

number or name of source gage, used only for labels in plotting

minwidth:

minimum scale in number of samples to use for analysis, e.g., if the sample rate is 2 Hz and the desired minimum scale is 15 seconds, minwidth = 30 (default: 30)

maxwidth:

maximum scale in number of samples (default: 2000)

nwidths:

number of scales to apply to the waveform (default: 20)

waterlevel:

baseline amplitude, e.g., sea level (default: 0)

plot:

boolean, whether to output plots (default: False)

plotname:

name for output plot (without extension), required if plot=True

plotform:

format for output plot, required if plot=True

dpi:

dots per inch resolution of the output plot

outdir:

directory for output plot, if desired (default: None); if left as default, figures will output to current working directory

Output:
times:

numpy 1-D array containing sampling times (in seconds)

amps:

numpy 1-D array containing wave amplitudes for each instance of times

cwt:

numpy 2-D array with dimensions nwidths x len(data) containing wavelet coefficients used in creating the scalogram