Skip to content

Refactor TimeSeries.q_transform() to support eventgrams

Duncan Macleod requested to merge github/fork/alurban/eventgram into develop

Created by: alurban

This PR substantially refactors TimeSeries.q_transform() to support eventgrams, a feature ported over from gwdetchar-omega. To simplify review, here is a summary of changes made:

New Features

  • Introduce a new object class, ~gwpy.signal.qtransform.QGram, to support eventgrams
  • Introduce a new function, ~gwpy.signal.qtransform.q_scan(), which identifies the time-frequency plane at fixed Q with the most significant tile within a given (optional) search window. This method returns an instance of QGram along with the estimated false alarm rate from white Gaussian noise.
  • Include a method, QGram.table(), which converts a populated QGram object to an EventTable so that it can be rendered with matplotlib. Table columns are 'time', 'duration', 'frequency', 'bandwidth', and 'energy'. The only argument is an SNR threshold, which selects for tiles with energy greater than or equal snrthresh**2/2.
  • Introduce a TimeSeries.q_gram method to wrap around QGram.table.
  • Add a mismatch argument for q_scan() and TimeSeries.q_transform().
  • Add a unit test for the QGram object under gwpy/signal/tests/test_qtransform.py.
  • Add an example for the docs under examples/signal/qscan.py.

Refactor Existing Features

  • Refactor spectrogram interpolation into ~gwpy.signal.qtransform.QGram.interpolate(). This reduces the cyclomatic complexity of TimeSeries.q_transform() to a level acceptable to CodeClimate.

This fixes #922 (closed) and fixes #995 (closed).

cc @duncanmmacleod, @areeda, @scottcoughlin2014

Merge request reports