Skip to content

Change coherence unit to dimensionless

Created by: artem-basalaev

Coherence between time series should be a dimensionless number from 0 to 1 (in my understanding), however in GWpy a fictional unit of "coherence" is assigned. This results in UnitConversionError in any arithmetic involving coherence and unitless quantities. Such as this example code:

from gwpy.timeseries import TimeSeries
from numpy import random
ts1 = TimeSeries(random.random(1000), sample_rate=100, unit='m')
ts2 = TimeSeries(random.random(1000), sample_rate=100, unit='m')
coh = ts1.coherence(ts2)
# line below will cause UnitConversionError
print(1.0-coh)

This pull request instead forces the unit to be dimensionless_unscaled, which does not cause this error.

Merge request reports