Skip to content

New whitening scheme based on inverse spectrum truncation

Duncan Macleod requested to merge github/fork/alurban/alt-whitening into develop

Created by: alurban

This pull request addresses a common issue with filter transients in the current whitening method by replacing it with an alternative scheme which designs and applies an FIR (finite impulse response) filter using inverse spectrum truncation.

Other new features added include:

  • A method FrequencySeries.interpolate() and functions timeseries._fft_length_default, signal.filter_design.truncate_transfer, and signal.filter_design.truncate_impulse, all used to design the FIR filter
  • New keyword arguments for filter duration (in the time domain) and highpass corner frequency
  • In TimeSeries.whiten(), a default value of fftlengthwhich causes it to be set to max(2, int(2048 // self.sample_rate.decompose().value))
  • Automatic cropping of the beginning and end of the whitened timeseries by a segment of length filter_duration
  • Updates to the documentation for TimeSeries.whiten() addressing these changes
  • Updates to q_transform() that address these recent changes, including a new default fftlength that mirrors the one for TimeSeries.whiten
  • Unit tests for new functionality, a unit test for signal.window.planck(), and a bug fix in the unit test for FrequencySeries.inject()

Note, these changes make it so that a simple call to TimeSeries.whiten() with no other arguments returns something sensible in most cases. It is also backwards compatible.

This fixes #867 (closed). It is also related to #358 (closed) and #451 (closed).

Merge request reports