gstlal-inspiral  1.9.2
 All Classes Namespaces Files Functions
gstlal_inspiral_plot_extrinsic_params
1 #!/usr/bin/env python3
2 
3 import time
4 import numpy
5 import matplotlib
6 matplotlib.rcParams['text.usetex'] = True
7 matplotlib.rcParams['lines.markersize'] = 2
8 matplotlib.rcParams['lines.linewidth'] = 1
9 matplotlib.rcParams['font.size'] = 10
10 matplotlib.rcParams['savefig.dpi'] = 300
11 matplotlib.rcParams['text.latex.preamble'].append(r'\usepackage{amsmath}')
12 matplotlib.rcParams['legend.fontsize'] = 10
13 matplotlib.use("agg")
14 from matplotlib import pyplot
15 from gstlal.stats import inspiral_extrinsics
16 
17 TPDPDF = inspiral_extrinsics.InspiralExtrinsics()
18 
19 num = 300
20 dts = numpy.linspace(-0.030, 0.030, num)
21 dphis = numpy.linspace(-numpy.pi*1.99, numpy.pi*1.99, num)
22 jointpdf = numpy.zeros((num,num))
23 tpdf = numpy.zeros((num))
24 phipdf = numpy.zeros((num))
25 
26 for detector in ("H1", "L1"):
27  s = time.time()
28  for i, dt in enumerate(dts):
29  for j, dphi in enumerate(dphis):
30  t = {detector: 0, "V1": dt}
31  phi = {detector: 0, "V1": dphi}
32  snr = {detector: 10., "V1": 10.}
33  horizon = {detector: 200., "V1": 200.}
34  # signature is (time, phase, snr, horizon)
35  prob = TPDPDF.time_phase_snr(t, phi, snr, horizon)
36  tpdf[i] += prob
37  phipdf[j] += prob
38  jointpdf[i,j] = prob
39  print("evaluated %d probabilities in %f seconds" % (num**2, time.time()-s))
40  f = pyplot.figure(figsize=(10,10))
41  pyplot.subplot(222)
42  pyplot.plot(dts, tpdf)#, drawstyle="steps-mid")
43  pyplot.subplot(223)
44  pyplot.plot(phipdf, dphis)#, drawstyle="steps-mid")
45  pyplot.gca().invert_xaxis()
46  pyplot.subplot(224)
47  pyplot.pcolor(dts, dphis, jointpdf.T)
48  pyplot.xlabel(r"$t_V -t_H$")
49  pyplot.ylabel(r"$\phi_V-\phi_H$")
50  pyplot.savefig("%sV1dtdphdeff.png" % detector)
51