Commit daeedd0d authored by Cody Messick's avatar Cody Messick Committed by Chad Hanna
Browse files Fix bug causing time shift in subthreshold snr time series wen zero padding

parent 6e51447b
......@@ -671,15 +671,18 @@ class GracedBWrapper(object):
idxf = snr_time_series_array.shape[0]
snr_time_series_array = snr_time_series_array[idx0:idxf]
if snr_time_series_array.shape[0] != snr_length:
if idxf - idx0 != snr_length:
if idx0 == 0:
snr_time_series_array = numpy.append(snr_time_series_array, numpy.zeros(snr_length - snr_time_series_array.shape[0], dtype=snr_time_series_array.dtype))
# We know we don't have enough samples, since we started at the beginning of the available samples the zeros must need to be prepended
snr_time_series_array = numpy.concatenate((numpy.zeros(snr_length - (idxf - idx0), dtype=snr_time_series_array.dtype), snr_time_series_array[idx0:idxf]))
elif idxf != peak_idx + autocorrelation_length + 1:
snr_time_series_array = numpy.insert(snr_time_series_array, 0, numpy.zeros(snr_length - snr_time_series_array.shape[0], dtype=snr_time_series_array.dtype))
# We dont have enough samples, we need to append zeros
snr_time_series_array = numpy.concatenate((snr_time_series_array[idx0:idxf], numpy.zeros(snr_length - (idxf - idx0), dtype=snr_time_series_array.dtype)))
print >>sys.stderr, "unexpected conditional while making sub-threshold trigger for %s, skipping. idx0 = %d, idxf = %d" % (ifo, idx0, idxf)
snr_time_series_array = snr_time_series_array[idx0:idxf]
# FIXME Ugly
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment