LALPulsar  6.1.0.1-b72065a
test_ssbtodetector.py
Go to the documentation of this file.
1 import sys
2 import subprocess as sp
3 
4 import numpy as np
5 
6 import pytest
7 
8 # from LALConstants.h
9 LAL_C_SI = 299792458e0
10 LAL_REARTH_SI = 6378136.6
11 LAL_AU_SI = 149597870700e0
12 MAX_DT_DETS_SSB = (LAL_AU_SI + LAL_REARTH_SI) / LAL_C_SI
13 
14 # compute times for a variety of telescopes and sky positions
15 GPS_SSB = 1100000000.0
16 TELESCOPES = (
17  "H1",
18  "L1",
19  "V1",
20  "G1",
21  "T1",
22  "GBT",
23  "PKS",
24  "JBO",
25  "AO",
26  "EFF",
27  "NRT",
28  "HOB",
29  "HART",
30  "VLA",
31  "WSRT",
32 )
33 
34 
35 @pytest.mark.parametrize("telescope", TELESCOPES)
36 @pytest.mark.parametrize("ra", np.arange(0, 24, 8))
37 def test_ssb(telescope, ra):
38  cmd = [
39  "lalpulsar_ssbtodetector",
40  "--gps",
41  str(GPS_SSB),
42  "--ra",
43  f"{ra}:21:34.76",
44  "--dec",
45  "-1:53:12.36",
46  "-t",
47  str(telescope),
48  ]
49  out = sp.check_output(cmd)
50  gps_det = float(out)
51  assert abs(gps_det - GPS_SSB) < MAX_DT_DETS_SSB
52 
53 
54 if __name__ == "__main__":
55  args = sys.argv[1:] or ["-v", "-rs", "--junit-xml=junit-ssbtodetector.xml"]
56  sys.exit(pytest.main(args=[__file__] + args))
def test_ssb(telescope, ra)