Skip to content

Commit

Permalink
edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnitz committed Jul 1, 2024
1 parent 1bfec18 commit 95d3605
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 3 additions & 1 deletion pycbc/inference/models/relbin.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,9 @@ def _loglr(self):
# Note, this includes complex conjugation already
# as our stored inner products were hp* x data
htf = (f.real * ip + 1.0j * f.imag * ic)
sh = self.sh[ifo].at_time(dts, interpolate='quadratic')
sh = self.sh[ifo].at_time(dts,
interpolate='quadratic',
extrapolate=0.0j)
sh_total += sh * htf
hh_total += self.hh[ifo] * abs(htf) ** 2.0

Expand Down
16 changes: 9 additions & 7 deletions pycbc/inference/models/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 +364,17 @@ def draw_times(self, snrs, size=None):
starts = []
ends = []

tmin = tcmin + dt - snrs[iref].delta_t
tmax = tcmax + dt + snrs[iref].delta_t
delt = snrs[iref].delta_t
tmin = tcmin + dt - delt
tmax = tcmax + dt + delt
if hasattr(self, 'tstart'):
tmin = self.tstart[iref]
tmax = self.tend[iref]

starts.append(max(tmin, snrs[iref].start_time))
ends.append(min(tmax, snrs[iref].end_time))
# Make sure we draw from times within prior and that have enough
# SNR calculated to do later interpolation
starts.append(max(tmin, snrs[iref].start_time + delt))
ends.append(min(tmax, snrs[iref].end_time - delt * 2))

idels = {}
for ifo in ifos[1:]:
Expand Down Expand Up @@ -498,9 +501,8 @@ def make_init():
tmin = self.tstart[ifo]
tmax = self.tend[ifo]

start = max(tmin, snrs[ifo].start_time)
end = min(tmax, snrs[ifo].end_time)

start = max(tmin, snr.start_time + snr.delta_t)
end = min(tmax, snr.end_time - snr.delta_t * 2)
snr = snr.time_slice(start, end, mode='nearest')

w = snr.squared_norm().numpy() / 2.0
Expand Down

0 comments on commit 95d3605

Please sign in to comment.