CWMakeFakeData: transient signals can be time-shifted by up to 1/2 sampling step
Service Desk request from Reinhard.Prix@aei.mpg.de :
Looking at XLALCWMakeFakeData()
, in the loop over injection signals
(simplified):
Tseries_sum = XLALCreateREAL4TimeSeries ( detPrefix, &firstGPS,
fHeterodyne, dt, &lalStrainUnit, numSteps );
for ( UINT4 iInj = 0; iInj < numPulsars; iInj ++ ) {
...
Tseries_i = XLALGenerateCWSignalTS ( pulsarParams, site,
signalStartGPS, signalDuration, fSamp, fMin ...);
...
Tseries_sum = XLALAddREAL4TimeSeries ( Tseries_sum, Tseries_i );
}
there is a problem, because XLALAddREAL4TimeSeries()
adds two
timeseries with non-aligned time steps by simply rounding each sample to
the nearest bin of the series to be added to!
In lal/src/tools/TimeSeries_source.c:150
:
REAL8 Delta_epoch = XLALGPSDiff(&arg2->epoch, &arg1->epoch);
i = floor(Delta_epoch / arg1->deltaT + 0.5);
For typical sampling steps of narrow-band timeseries dt = 1/fSamp ~ O(seconds)
, this would be many signal cycles, and therefore an
arbitrary phase shift, which generally can be different for different
detectors (if they have different start-times), and lead to non-coherent
signals.
Fortunately this is not a problem for continous CWs, which all start at the common epoch 'signalStartGPS = firstGPS', but would affect transient signals.
The fix would be simply to make sure the Tseries_i
start-times are
aligned to the timeseries bins of Tseries_sum
.
Furthermore I would actually suggest to add a failure check to
XLALAddREAL4TimeSeries()
, as this kind of leniency does not seem to be
justified ever for such a critical function.