Refactor TimeSeries.q_transform() to support eventgrams
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 ofQGram
along with the estimated false alarm rate from white Gaussian noise. - Include a method,
QGram.table()
, which converts a populatedQGram
object to anEventTable
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 equalsnrthresh**2/2
. - Introduce a
TimeSeries.q_gram
method to wrap aroundQGram.table
. - Add a
mismatch
argument forq_scan()
andTimeSeries.q_transform()
. - Add a unit test for the
QGram
object undergwpy/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 ofTimeSeries.q_transform()
to a level acceptable to CodeClimate.
This fixes #922 (closed) and fixes #995 (closed).
cc @duncanmmacleod, @areeda, @scottcoughlin2014