Single waveform call in ROQ for ~35% faster likelihood evaluation
In the current implementation, ROQ requires two waveform calls at a single likelihood evaluation for linear and quadratic parts of likelihood. This MR reorganizes the codes to make it a single waveform call. This makes likelihood evaluation ~1.35 faster for targeted BNS basis.
Benchmark with targeted BNS basis
Script to benchmark:
N = int(1e3)
samples = priors.sample(N)
keys = list(samples.keys())
samples = [dict((key, samples[key][i]) for key in keys) for i in range(N)]
%%time
for i in range(N):
likelihood_roq.parameters.update(samples[i])
l = likelihood_roq.log_likelihood_ratio()
Results with the current implementation:
CPU times: user 1.59 s, sys: 6.36 s, total: 7.95 s
Wall time: 7.98 s
Results with the new implementation:
CPU times: user 1.32 s, sys: 4.56 s, total: 5.88 s
Wall time: 5.87 s
Test PE runs
I did quick no-spin PE on BBH injections with the master version and the version of this MR. Here are the results: test with 8s Pv2 basis, test with multibanded + multiple .hdf5 basis. The legends also show sampling times, which shows this MR speeds up ROQ PE by 1.5 - 2 in these cases.
Edited by Soichiro Morisaki