Skip to content
Snippets Groups Projects
Commit f9e75963 authored by Stephen Green's avatar Stephen Green Committed by Moritz Huebner
Browse files

Fix detector orientations

parent d51d5194
No related branches found
No related tags found
1 merge request!1037Fix detector orientations
......@@ -69,6 +69,7 @@ Sharan Banagiri
Shichao Wu
Simon Stevenson
Soichiro Morisaki
Stephen R Green
Sumeet Kulkarni
Sylvia Biscoveanu
Tathagata Ghosh
......
......@@ -9,5 +9,5 @@ length = 0.6
latitude = 52 + 14. / 60 + 42.528 / 3600
longitude = 9 + 48. / 60 + 25.894 / 3600
elevation = 114.425
xarm_azimuth = 115.9431
yarm_azimuth = 21.6117
xarm_azimuth = 21.6117
yarm_azimuth = 115.9431
......@@ -15,3 +15,5 @@ longitude = 137 + 18 / 60 + 21.44171 / 3600
elevation = 414.181
xarm_azimuth = 90 - 60.39623489157727
yarm_azimuth = 90 + 29.60357629670688
xarm_tilt = 0.0031414
yarm_tilt = -0.0036270
......@@ -11,3 +11,5 @@ longitude = -(90 + 46. / 60 + 27.2654 / 3600)
elevation = -6.574
xarm_azimuth = 197.7165
yarm_azimuth = 287.7165
xarm_tilt = -3.121e-4
yarm_tilt = -6.107e-4
import sys
import unittest
import lal
import lalsimulation
import pytest
from packaging import version
from shutil import rmtree
......@@ -552,5 +555,46 @@ class TestInterferometerEquals(unittest.TestCase):
self.assertNotEqual(self.ifo_1, self.ifo_2)
class TestInterferometerAntennaPatternAgainstLAL(unittest.TestCase):
def setUp(self):
self.name = "name"
self.ifo_names = ['H1', 'L1', 'V1', 'K1', 'GEO600', 'ET']
self.lal_prefixes = {'H1': 'H1', 'L1': 'L1', 'V1': 'V1', 'K1': 'K1', 'GEO600': 'G1', 'ET': 'E1'}
self.polarizations = ['plus', 'cross', 'breathing', 'longitudinal', 'x', 'y']
self.ifos = bilby.gw.detector.InterferometerList(self.ifo_names)
self.gpstime = 1305303144
self.trial = 100
def tearDown(self):
del self.name
del self.ifo_names
del self.lal_prefixes
del self.polarizations
del self.ifos
del self.gpstime
del self.trial
def test_antenna_pattern_vs_lal(self):
gmst = lal.GreenwichMeanSiderealTime(self.gpstime)
f_bilby = np.zeros((self.trial, 6))
f_lal = np.zeros((self.trial, 6))
for n, ifo_name in enumerate(self.ifo_names):
response = lalsimulation.DetectorPrefixToLALDetector(self.lal_prefixes[ifo_name]).response
ifo = self.ifos[n]
for i in range(self.trial):
ra = 2. * np.pi * np.random.uniform()
dec = np.pi * np.random.uniform() - np.pi / 2.
psi = np.pi * np.random.uniform()
f_lal[i] = lal.ComputeDetAMResponseExtraModes(response, ra, dec, psi, gmst)
for m, pol in enumerate(self.polarizations):
f_bilby[i, m] = ifo.antenna_response(ra, dec, self.gpstime, psi, pol)
std = np.std(f_bilby - f_lal, axis=0)
for m, pol in enumerate(self.polarizations):
with self.subTest(':'.join((ifo_name, pol))):
self.assertAlmostEqual(std[m], 0.0, places=7)
if __name__ == "__main__":
unittest.main()
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