Skip to content
Snippets Groups Projects
Commit 5a07ead6 authored by Kipp Cannon's avatar Kipp Cannon
Browse files

gstlal-inspiral: "fix" a long-standing off-by-one mystery

- there was a mysterious off-by-one hack included in the firbank latency
  in lloidparts that had been found to be required in order to get the
  impulse response from the different template fragments to line up
  properly.  this patch doesn't really explain the mystery, but moves
  the logic from the firbank into the template slicing logic so that it
  all lives in one place, and corrects an overall off-by-one latency
  error while at it.
parent 7cca20f8
No related branches found
No related tags found
No related merge requests found
......@@ -178,7 +178,7 @@ def generate_template(template_bank_row, approximant, sample_rate, duration, f_l
sampleUnits = laltypes.LALUnit("strain"),
data = data
)
lalfft.XLALREAL8TimeFreqFFT(fworkspace, tseries, fwdplan)
z = numpy.copy(fworkspace.data)
......@@ -509,10 +509,14 @@ def generate_templates(template_table, approximant, psd, f_low, time_slices, aut
# start and end times are measured *backwards* from
# template end; subtract from n to convert to
# start and end index; end:start is the slice to
# extract (argh! Chad!)
begin_index = length_max - int(round(time_slice['begin'] * sample_rate_max))
end_index = length_max - int(round(time_slice['end'] * sample_rate_max))
# extract, but there's also an amount added equal
# to 1 less than the stride that I can't explain
# but probaby has something to do with the reversal
# of the open/closed boundary conditions through
# all of this (argh! Chad!)
stride = int(round(sample_rate_max / time_slice['rate']))
begin_index = length_max - int(round(time_slice['begin'] * sample_rate_max)) + stride - 1
end_index = length_max - int(round(time_slice['end'] * sample_rate_max)) + stride - 1
# make sure the rates are commensurate
assert stride * time_slice['rate'] == sample_rate_max
......
......@@ -565,14 +565,10 @@ def mkLLOIDbranch(pipeline, src, bank, bank_fragment, (control_snk, control_src)
# convolution, high-frequency branches use FFT convolution with a
# block stride given by fir_stride.
#
# FIXME: why the -1? without it the pieces don't match but I
# don't understand where this offset comes from. it might really
# need to be here, or it might be a symptom of a bug elsewhere.
# figure this out.
latency = -int(round(bank_fragment.start * bank_fragment.rate)) - 1
latency = -int(round(bank_fragment.start * bank_fragment.rate))
block_stride = fir_stride * bank_fragment.rate
# we figure an fft costs ~5 logN flops where N is duration + block
# stride. For each chunk you have to do a forward and a reverse fft.
# Time domain costs N * block_stride. So if block stride is less than
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment