correction

remove_tilt(response, source, dt, fmin=None, fmax=None, parallel=True, threshold=0.5, smooth=1.0, g=9.81, method='coh', trans_coh=None)[source]

Remove tilt noise from translational accelerometer recordings.

See the method argument for different correction options. The correction can optionally be applied only in a selected frequency band.

The method is described in [BernauerEtAl2020] and is based on the work of [CrawfordAndWebb2000].

Parameters
  • response (numpy.ndarray) – Data samples of the accelerometer signal [m/s**2].

  • source (numpy.ndarray) – Data samples of the tilt signal [rad].

  • dt (float) – Sampling interval [s].

  • fmin (float or None) – Minimum frequency for band-limited correction [Hz]. Only applicable in 'coh' and 'freq' methods.

  • fmax (float or None) – Maximum frequency for band-limited correction [Hz]. Only applicable in 'coh' and 'freq' methods.

  • parallel (bool) – Flag to indicate if tilt and acceleration axes are parallel (True) or antiparallel (False).

  • threshold (float) – Correction is applied only where abs(coherence) >= threshold. Only applicable in 'coh' method.

  • smooth (float) – Size of the Blackman window [Hz] used for smoothing when calculating the coherence with tilt_utils.transfer_function(). Only applicable in 'coh' and 'freq' methods.

  • g (float) – Gravitational acceleration [m/s**2].

  • method (str) – Correction method to use. 'coh': apply theoretical transfer function where coherence is significant (via frequency domain), 'freq': use empirical transfer function estimate (via frequency domain), 'direct': apply theoretical transfer function directly (in time domain).

  • trans_coh ((numpy.ndarray, numpy.ndarray) or None) – If given, previously calculated transfer function and complex coherence between the tilt and accelerometer signals, used to decide where to apply the correction. The size of the given arrays must match the size of the spectra of source and response (the same zero-padding has to be applied). If set to None, it is computed from response and source using tilt_utils.transfer_function().

Returns

Data samples of corrected accelerometer signal [m/s**2].

Return type

numpy.ndarray

transfer_function(response, source, dt, smooth)[source]

Calculate transfer function and complex coherence between two signals.

The transfer function is calculated from smoothed cross- and non-smoothed autospectral densities of source and response signal. Smoothing is done by convolution with a Blackman window.

The complex transfer function, the autospectral densities, and a corresponding frequency vector are returned.

Parameters
  • response (numpy.ndarray) – Sample data of the response signal.

  • source – Sample data of the source signal.

  • dt (float) – Sampling interval [s].

  • smooth (float) – Size of the Blackman window used for smoothing [Hz].

Returns

(freq, XX, YY, Ars, coh) freq: array of frequencies Grr: autospectral density of response signal, Gss: autospectral density of source signal, Ars: source to response transfer function, coh: smoothed complex coherence between source and response signal

Return type

5-tuple of numpy.ndarray