Evaluating beam pattern functions is >10 times slower than LAL
Evaluating beam pattern functions is >10 times slower than LAL, which is one of the bottlenecks for low-latency analysis.
Script:
import numpy as np
import time
import bilby
import lal
import lalsimulation
ifos = bilby.gw.detector.InterferometerList(["L1"])
ifo = ifos[0]
gpstime = 1305303144
trial = 100
ts_bilby, ts_lal = [], []
for i in range(trial):
ra, dec, psi = 2. * np.pi * np.random.uniform(), np.pi * np.random.uniform() - np.pi / 2., np.pi * np.random.uniform()
# measure bilby's run time
s = time.time()
fplus, fcross = ifo.antenna_response(ra, dec, gpstime, psi, "plus"), ifo.antenna_response(ra, dec, gpstime, psi, "cross")
e = time.time()
ts_bilby.append(e - s)
# measure lal's run time
s = time.time()
gmst = lal.GreenwichMeanSiderealTime(gpstime)
fplus, fcross = lal.ComputeDetAMResponse(
lalsimulation.DetectorPrefixToLALDetector("L1").response, ra, dec, psi, gmst)
e = time.time()
ts_lal.append(e - s)
print("Bilby's method takes {} seconds.".format(np.mean(ts_bilby)))
print("LAL's method takes {} seconds.".format(np.mean(ts_lal)))
Output:
Bilby's method takes 6.371736526489258e-05 seconds.
LAL's method takes 4.072189331054687e-06 seconds.
Edited by Soichiro Morisaki