dolfyn.VelBinner

class dolfyn.VelBinner(n_bin, fs, n_fft=None, n_fft_coh=None)[source]

This is the base binning (averaging) tool.

All DOLfYN binning tools derive from this base class.

Examples

The VelBinner class is used to compute averages and turbulence statistics from ‘raw’ (unaveraged) ADV or ADP measurements, for example:

# First read or load some data.
rawdat = dlfn.read_example('BenchFile01.ad2cp')

# Now initialize the averaging tool:
binner = dlfn.VelBinner(n_bin=600, fs=rawdat['props']['fs'])

# This computes the basic averages
avg = binner(rawdat)
__init__(self, n_bin, fs, n_fft=None, n_fft_coh=None)

Initialize an averaging object.

Parameters
n_binint

the number of data points to include in a ‘bin’ (average).

n_fftint

the number of data points to use for fft (n_fft`<=`n_bin). Default: n_fft`=`n_bin

n_fft_cohint

the number of data points to use for coherence and cross-spectra ffts (n_fft_coh`<=`n_bin). Default: n_fft_coh`=`n_bin/6

Methods

__init__(self, n_bin, fs[, n_fft, n_fft_coh])

Initialize an averaging object.

calc_acov(self, indat[, n_bin])

Calculate the auto-covariance of the raw-signal indat.

calc_lag(self[, npt, one_sided])

calc_omega(self[, fs, coh])

Calculate the radial-frequency vector for the psd’s.

calc_stress(self, veldat)

Calculate the stresses (cross-covariances of u,v,w).

calc_tke(self, veldat[, noise])

Calculate the tke (variances of u,v,w).

calc_vel_cpsd(self, veldat[, rotate_u, fs, …])

Calculate the cross-spectra of velocity components.

calc_vel_psd(self, veldat[, rotate_u, fs, …])

Calculate the psd of velocity.

calc_xcov(self, indt1, indt2[, npt, n_bin1, …])

Calculate the cross-covariance between arrays indt1 and indt2 for each bin.

cohere(self, dat1, dat2[, window, debias, …])

Calculate coherence between dat1 and dat2.

cpsd(self, dat1, dat2[, fs, window, n_fft, …])

Calculate the ‘cross power spectral density’ of dat.

demean(self, dat[, n_pad, n_bin])

Reshape the array dat and remove the mean from each ensemble.

detrend(self, dat[, n_pad, n_bin])

Reshape the array dat and remove the best-fit trend line.

do_avg(self, rawdat[, outdat, names, n_time])

Parameters

do_cross_spec(self, indat[, out, names])

do_spec(self, indat[, out, names])

do_tke(self, indat[, out])

do_var(self, rawdat[, outdat, names, suffix])

Calculate the variance of data attributes.

mean(self, dat[, axis, n_bin, mask_thresh])

Average an array object.

mean_angle(self, dat[, axis, units, n_bin, …])

Average an angle array.

phase_angle(self, dat1, dat2[, window, …])

Calculate the phase difference between two signals as a function of frequency (complimentary to coherence).

psd(self, dat[, fs, window, noise, n_bin, …])

Calculate ‘power spectral density’ of dat.

reshape(self, arr[, n_pad, n_bin])

Reshape the array arr to shape (…,n,n_bin+n_pad).

std(self, dat[, n_bin])

var(self, dat[, n_bin])