gstlal-inspiral  1.9.3
 All Classes Namespaces Files Functions
gstlal_inspiral_summary_page
1 #!/usr/bin/env python3
2 #
3 # Copyright (C) 2011 Chad Hanna
4 # Copyright (C) 2019 Patrick Godwin
5 #
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by the
8 # Free Software Foundation; either version 2 of the License, or (at your
9 # option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14 # Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License along
17 # with this program; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20 ## @file
21 # This program makes a summary web page of a gstlal inspiral analysis.
22 
23 import sys, os, glob, shutil, time
24 import re
25 import subprocess
26 import json
27 
28 from optparse import OptionParser
29 from ligo.scald import report
30 
31 ABOUT_URL = 'https://docs.google.com/document/d/12wJjCz8L1UczqRm86q3-EFnpnIZ2FHPSwKR_kym2L5g/pub?embedded=true'
32 SCHEDULE_URL = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vR1XwazhZYoVbMXFZCq_s2rlzyNwcF0xC4kyhnKrCeXFSWte-2jRodL590RU3PsoX4OVypYyAZ7Nl_8/pubhtml?widget=true&headers=false'
33 IMAGE_URL = 'https://results.ligo.uwm.edu/~gstlalcbc/share/vis/gstlal.png'
34 
35 
36 def load_json(path):
37  with open(path, 'r') as f:
38  return json.loads(f.read())
39 
40 
41 def parse_command_line():
42  parser = OptionParser(usage = "%prog [options] [file ...]", description = "%prog summary web page")
43  parser.add_option("--webserver-dir", help = "Set the directory for the webserver. Required. Example /archive/home/channa/public_html/highmass_months_23-24_summary_page")
44  parser.add_option("--open-box", action = "store_true", help = "Produce open box page")
45  parser.add_option("--output-user-tag", action = "append", metavar = "name", help = "Set the basename for image search")
46  parser.add_option("--title", default="gstlal_inspiral offline analysis")
47  parser.add_option("--glob-path", help = "This is the path to search for images")
48 
49  opts, filenames = parser.parse_args()
50  return opts, filenames
51 
52 
53 #
54 # Setup
55 #
56 
57 opts, files = parse_command_line()
58 
59 thisreport = report.Report('gstlal analysis', image=IMAGE_URL)
60 
61 try:
62  os.makedirs(opts.webserver_dir)
63 except OSError:
64  pass
65 try:
66  os.makedirs(opts.webserver_dir+'_lite')
67 except OSError:
68  pass
69 
70 
71 #
72 # Add the page tabs
73 #
74 
75 
76 summary = report.Tab('Summary')
77 injparams = report.Tab('Injection Parameters')
78 injrecovery = report.Tab('Injection Recovery')
79 sens = report.Tab('Search Sensitivity')
80 back = report.Tab('Background')
81 money = report.Tab('Money Plots')
82 about_doc = report.Tab('About', url=ABOUT_URL)
83 sched_doc = report.Tab('Schedule', url=SCHEDULE_URL)
84 
85 
86 #
87 # Add summary page content to the summary page tab
88 #
89 
90 summary += report.Header('Summary')
91 
92 tabledata = load_json(os.path.join(opts.glob_path, '%s_plot_summary.json' % opts.output_user_tag[0]))
93 summary += report.Table('Search Summary').save(tabledata, opts.webserver_dir)
94 
95 tabledata = load_json(os.path.join(opts.glob_path, '%s_segment_table.json' % opts.output_user_tag[0]))
96 summary += report.Table('Segments').save(tabledata, opts.webserver_dir)
97 
98 summary += report.Description("This page was generated on %s by %s in the working directory: %s" % (time.strftime("%Y-%m-%d %H:%M"), os.environ["USER"], os.environ["PWD"]))
99 
100 thisreport += summary
101 
102 #
103 # Add injection parameter content
104 #
105 
106 injparams += report.Header('Injection Parameters')
107 injparams += report.Description("Injections are the addition of simulated signals into the gravitational wave strain data. They are useful for diagnosing the pipeline and measuring the sensitivity. Care is taken to ensure that the input distribution is sensible. The remaining sections describe the input distributions for the injections. They are not necessarily what is analyzed since the analyzed segments are not used for determining the injection sets (i.e. injections may be scheduled for times when a detector is not even functioning).")
108 injparams += report.Description("The following plots are typically produced by injection waveform type. Several injection runs of the same waveform (with different random seeds) are often done. Here all runs of the same waveform type are shown together.")
109 
110 imgfooter = "Above are the injected mass parameters for the simulations done. Typically injections are done uniformally in component mass unless the waveform approximant cannot support certain mass ratios."
111 injparams += report.ImageGrid("Injected Parameters (m1 and m2)", grid_size=2, footer=imgfooter).glob(os.path.join(opts.glob_path, '*6_sim_dist_m1_m2*.png'))
112 
113 imgfooter = "Unless doing a directed search injections are uniform in time. Although the correct distance distribution would be uniform in volume typically logarithmic injections are done"
114 injparams += report.ImageGrid("Injected Parameters time and distance", grid_size=2, footer=imgfooter).glob(os.path.join(opts.glob_path, '*6_sim_dist_time_distance*.png'))
115 
116 imgfooter = "Unless doing a directed search injections are uniform on the sky."
117 injparams += report.ImageGrid("Injected Parameters RA and DEC", grid_size=2, footer=imgfooter).glob(os.path.join(opts.glob_path, '*6_sim_dist_ra_dec*.png'))
118 
119 imgfooter = "Unless doing a directed search injections are uniform in sin(inclination) and polarizations."
120 injparams += report.ImageGrid("Injected Parameters inclination and polarization", grid_size=2, footer=imgfooter).glob(os.path.join(opts.glob_path, '*6_sim_dist_inc_pol*.png'))
121 
122 imgfooter = "The Z component spins of the injection set. Often injections are done without spin, so don't be surprised if these are zero."
123 injparams += report.ImageGrid("Injected Parameters Z component spin", grid_size=2, footer=imgfooter).glob(os.path.join(opts.glob_path, '*6_sim_dist_spin1z_spin2z*.png'))
124 
125 thisreport += injparams
126 
127 #
128 # Add injection accuracy content
129 #
130 
131 injrecovery += report.Header("Injection Accuracy")
132 injrecovery += report.Description("The accuracy of recovered parameters aids at diagnosing the performance of the pipeline as well as hinting at the possibility of measuring certain parameters. Mass parameters for the low mass search are often recovered better than mass parameters for the high mass search.")
133 
134 injrecovery += report.ImageGrid("Mchirp Parameter Accuracy", grid_size=3, footer="Accuracy of chirp mass").glob(os.path.join(opts.glob_path, '*2_mchirp_acc_frac_*.png'))
135 
136 injrecovery += report.ImageGrid("Eta Parameter Accuracy", grid_size=3, footer="Accuracy of eta").glob(os.path.join(opts.glob_path, '*2_eta_acc_frac_*.png'))
137 
138 injrecovery += report.ImageGrid("Total Mass Parameter Accuracy", grid_size=3, footer="Accuracy of total mass").glob(os.path.join(opts.glob_path, '*2_mtotal_acc_frac_*.png'))
139 
140 injrecovery += report.ImageGrid("Time Parameter Accuracy", grid_size=3, footer="Accuracy of time").glob(os.path.join(opts.glob_path, '*2_t_acc_*.png'))
141 
142 injrecovery += report.ImageGrid("Effective Spin Accuracy", grid_size=3, footer="Accuracy of mass-weighted spin").glob(os.path.join(opts.glob_path, '*2_chi_acc_scatter*.png'))
143 
144 injrecovery += report.ImageGrid("SNR Recovery", grid_size=3, footer="Injected expected SNR vs recovered SNR").glob(os.path.join(opts.glob_path, '*2_snr_*.png'))
145 
146 imgfooter = "This is the distance at which you should see a 1.4 1.4 Msun binary at SNR 8. The first panel shows the time evolution of the horizon distance and the second panel shows the same information in histogram form."
147 injrecovery += report.ImageGrid("Horizon distance", grid_size=1, footer=imgfooter).glob(os.path.join(opts.glob_path, '*HORIZON*.png'))
148 
149 #
150 # Add injection missed / found content
151 #
152 
153 injrecovery += report.Header("Injection Missed/Found")
154 injrecovery += report.Description("""Measuring the found and missed injections as a function of various parameters aids in diagnosing the pipeline as well as providing the expected sensitivity of the pipeline to real signals. The plots in this section show the missed and found injections as a for the various IFO times for coincident triggers. We allow double coincident events so some categories can have multiple types of found injections (for example H1L1 and H1H2L1 triggers in H1H2L1 time). Because of ambiguity concerning the time of an injection and the injection window it is occasionally possible to find an injection in more detectors than what the "time" refers to. For example, an injection's geocentric end time might be in H1L1 time but that might occur near a boundary where H2 was also on. Thus one could find an H1L1 injection in H1H2L1 time.""")
155 
156 injrecovery += report.Header("Found / Missed Summary Table")
157 for tag in opts.output_user_tag:
158  tabledata = load_json(os.path.join(opts.glob_path, '%s_injection_summary.json' % tag))
159  injrecovery += report.Description("Summary of missed and found injections broken up by detector time for %s" % tag)
160  injrecovery += report.Table('Injection Summary Table for %s' % tag).save(tabledata, opts.webserver_dir)
161 
162 injrecovery += report.Header('Found / Missed Plots')
163 for tag in opts.output_user_tag:
164  visible = 'ALL_LLOID_COMBINED' in tag
165 
166  plots = os.path.join(opts.glob_path, '*%s*1_d_vs_mchirp_*.png' % tag)
167  imgfooter = "Distance of found and missed injections as a function of chirp mass: %s" % tag
168  injrecovery += report.ImageGrid("Distance vs. chirp mass: %s" % tag, grid_size=2, footer=imgfooter, visible=visible).glob(plots)
169 
170  plots = os.path.join(opts.glob_path, '*%s*1_deff_vs_mchirp_*.png' % tag)
171  imgfooter = "Effective distance of found and missed injections as a function of chirp mass: %s" % tag
172  injrecovery += report.ImageGrid("Effective distance vs. chirp mass: %s" % tag, grid_size=2, footer=imgfooter, visible=visible).glob(plots)
173 
174  plots = os.path.join(opts.glob_path, '*%s*1_chirpdist_vs_mchirp_*.png' % tag)
175  imgfooter = "Chirp distance of found and missed injections as a function of chirp mass. For low mass systems the chirp mass scales out of the expected amplitude. The chirp distance utilizes this and rescales the distance to be appropriate for a NS-NS binary. At low total mass the missed/found barrier should be flat on this plot: %s" % tag
176  injrecovery += report.ImageGrid("Chirp distance vs. chirp mass: %s" % tag, grid_size=2, footer=imgfooter, visible=visible).glob(plots)
177 
178 injrecovery += report.Header("Found / Missed Total Mass")
179 for tag in opts.output_user_tag:
180  visible = 'ALL_LLOID_COMBINED' in tag
181  plots = os.path.join(opts.glob_path, '%s*1_deff_vs_mtotal_*.png' % tag)
182  imgfooter = "Effective distance of found and missed injections as a function of total mass: %s" % tag
183  injrecovery += report.ImageGrid("Effective distance vs. total mass: %s" % tag, grid_size=2, footer=imgfooter, visible=visible).glob(plots)
184 
185 injrecovery += report.Header("Found / Missed Eta")
186 for tag in opts.output_user_tag:
187  visible = 'ALL_LLOID_COMBINED' in tag
188  plots = os.path.join(opts.glob_path, '*%s*1_chirpdist_vs_eta_*.png' % tag)
189  imgfooter = "Effective distance of found and missed injections as a function of symmetric mass ratio eta: %s" % tag
190  injrecovery += report.ImageGrid("Effective distance vs. eta: %s" % tag, grid_size=2, footer=imgfooter, visible=visible).glob(plots)
191 
192 injrecovery += report.Header("Found / Missed Time")
193 for tag in opts.output_user_tag:
194  visible = 'ALL_LLOID_COMBINED' in tag
195  plots = os.path.join(opts.glob_path, '*%s*1_deff_vs_t_*.png' % tag)
196  imgfooter = "Effective distance of found and missed injections as a function of time: %s" % tag
197  injrecovery += report.ImageGrid("Effective distance vs. time: %s" % tag, grid_size=2, footer=imgfooter, visible=visible).glob(plots)
198 
199 injrecovery += report.Header("Found / Missed Spin")
200 for tag in opts.output_user_tag:
201  visible = 'ALL_LLOID_COMBINED' in tag
202  plots = os.path.join(opts.glob_path, '*%s*1_deff_vs_chi_*.png' % tag)
203  imgfooter = "Effective distance of found and missed injections as a function of mass-weighted spin: %s" % tag
204  injrecovery += report.ImageGrid("Effective distance vs. mass-weighted spin: %s" % tag, grid_size=2, footer=imgfooter, visible=visible).glob(plots)
205 
206 injrecovery += report.Header("Found / Missed Expected SNR")
207 for tag in opts.output_user_tag:
208  visible = 'ALL_LLOID_COMBINED' in tag
209 
210  plots = os.path.join(opts.glob_path, '*%s*1_dec_expsnr_vs_mchirp_*.png' % tag)
211  imgfooter = "Expected SNR of found and missed injections as a function of chirp mass: %s" % tag
212  injrecovery += report.ImageGrid("Expected SNR vs. chirp mass: %s" % tag, grid_size=2, footer=imgfooter, visible=visible).glob(plots)
213 
214  plots = os.path.join(opts.glob_path, '*%s*1_dec_expsnr_vs_mtotal_*.png' % tag)
215  imgfooter = "Expected SNR of found and missed injections as a function of total mass: %s" % tag
216  injrecovery += report.ImageGrid("Expected SNR vs. total mass: %s" % tag, grid_size=2, footer=imgfooter, visible=visible).glob(plots)
217 
218  plots = os.path.join(opts.glob_path, '*%s*1_dec_expsnr_vs_eta_*.png' % tag)
219  imgfooter = "Expected SNR of found and missed injections as a function of symmetric mass ratio eta: %s" % tag
220  injrecovery += report.ImageGrid("Expected SNR vs. eta: %s" % tag, grid_size=2, footer=imgfooter, visible=visible).glob(plots)
221 
222  plots = os.path.join(opts.glob_path, '*%s*1_dec_expsnr_vs_cgi_*.png' % tag)
223  imgfooter = "Expected SNR of found and missed injections as a function of mass-weighted spin: %s" % tag
224  injrecovery += report.ImageGrid("Expected SNR vs. mass-weighted spin: %s" % tag, grid_size=2, footer=imgfooter, visible=visible).glob(plots)
225 
226  plots = os.path.join(opts.glob_path, '*%s*1_dec_expsnr_vs_t_*.png' % tag)
227  imgfooter = "Expected SNR of found and missed injections as a function of time: %s" % tag
228  injrecovery += report.ImageGrid("Expected SNR vs. time: %s" % tag, grid_size=2, footer=imgfooter, visible=visible).glob(plots)
229 
230 injrecovery += report.Header("Missed Table")
231 for tag in opts.output_user_tag:
232  tabledata = load_json(os.path.join(opts.glob_path, '%s_missed_summary.json' % tag))
233  injrecovery += report.Table('Missed Injection Table for %s' % tag).save(tabledata, opts.webserver_dir)
234 
235 thisreport += injrecovery
236 
237 #
238 # Add sensitivity content
239 #
240 
241 sens += report.Header('Sensitivity')
242 
243 sens += report.Description("""This page shows plots that characterize the overall sensitivity of the search. The detection rate is directly proportional to the observed sensitive volume, which is a function of the significance threshold used to identify candidates. These plots are useful for determining how sensitive the search was to the input injection population. Since the search sensitivity is a strong function of the intrinsic parameters of the target source, we break down the sensitive into bins of these parameters. Here we show the sensitivity as a function of source type: BNS mchirp between 0.8 and 2, NSBH between 2 and 4.5, BBH between 4.5 and 45.0, IMBH between 45.0 and 450.0""")
244 
245 for tag in opts.output_user_tag:
246  visible = 'ALL_LLOID_COMBINED' in tag
247  plots = os.path.join(opts.glob_path, '*%s*_BINNED_BY_SOURCE_TYPE*.png' % tag)
248  imgfooter = "Binned by source type"
249  sens += report.ImageGrid("Sensitive volume (V*T) and mean sensitive distance: %s" % tag, grid_size=3, footer=imgfooter, visible=visible).glob(plots)
250 
251 thisreport += sens
252 
253 #
254 # Add background content
255 #
256 
257 back += report.Header('Background')
258 back += report.Description("This page shows the ingredients that go into ranking events and determining the False alarm probability.")
259 
260 imgfooter = "Single detector triggers coincident in time-shifted analyses."
261 back += report.ImageGrid("Background Triggers", grid_size=3, footer=imgfooter).glob(os.path.join(opts.glob_path, '*3_bgparams_*_vs_snr*.png'))
262 back += report.ImageGrid("SNR Ratios", grid_size=3, footer=imgfooter).glob(os.path.join(opts.glob_path, '*SNR_PDF*.png'))
263 back += report.ImageGrid("Rates", grid_size=3, footer=imgfooter).glob(os.path.join(opts.glob_path, '*RATES*.png'))
264 
265 back += report.Header("SNR and chi-squared")
266 back += report.ImageGrid("Single Detector Background SNR-chisq Distributions", grid_size=3).glob(os.path.join(opts.glob_path, '*BACKGROUND_PDF_SNRCHI2*.png'))
267 back += report.ImageGrid("Single Detector Signal Chisq (Conditional) Distributions", grid_size=3).glob(os.path.join(opts.glob_path, '*INJECTION_PDF_SNRCHI2*.png'))
268 back += report.ImageGrid("Single Detector Likelihood Ratios", grid_size=3).glob(os.path.join(opts.glob_path, '*LR_SNRCHI2*.png'))
269 if opts.open_box:
270  back += report.ImageGrid("Single Detector Signal Chisq (Conditional) Distributions: Zero lag", grid_size=3).glob(os.path.join(opts.glob_path, '*ZERO_LAG_PDF_SNRCHI2*.png'))
271 
272 #
273 # Add chisq content
274 #
275 
276 back += report.Description("The chi-squared test checks that the snr accumulated matches expectation.")
277 
278 imgfooter = "Chi-squared vs snr for single detectors after coincidence. Blue points are full data zero lag, red are software injections and black are time slides."
279 back += report.ImageGrid("Chi-squared Distributions", grid_size=3, footer=imgfooter).glob(os.path.join(opts.glob_path, '*3_chi2_vs_rho_*closedbox*.png'))
280 
281 imgfooter = "Comparison of SNR in pairs of detectors."
282 back += report.ImageGrid("Signal-to-Noise Ratio", grid_size=3, footer=imgfooter).glob(os.path.join(opts.glob_path, '*4_rho_*_vs_*closedbox*.png'))
283 
284 imgfooter = "Comparison of effective distance in pairs of detectors."
285 back += report.ImageGrid("Effective Distance", grid_size=3, footer=imgfooter).glob(os.path.join(opts.glob_path, '*4_deff_*_vs_*closedbox*.png'))
286 
287 if opts.open_box:
288  back += report.Header('Open Box Results')
289 
290  imgfooter = "Chi-squared vs snr for single detectors after coincidence. Blue points are full data zero lag, red are software injections and black are time slides."
291  back += report.ImageGrid("Chi-squared Distributions: Zero lag", grid_size=3, footer=imgfooter).glob(os.path.join(opts.glob_path, '*3_chi2_vs_rho_*openbox*.png'))
292 
293  imgfooter = "Comparison of SNR in pairs of detectors."
294  back += report.ImageGrid("Signal-to-Noise Ratio: Zero lag", grid_size=3, footer=imgfooter).glob(os.path.join(opts.glob_path, '*4_rho_*_vs_*openbox*.png'))
295 
296  imgfooter = "Comparison of effective distance in pairs of detectors."
297  back += report.ImageGrid("Effective Distance", grid_size=3, footer=imgfooter).glob(os.path.join(opts.glob_path, '*4_deff_*_vs_*openbox*.png'))
298 
299 thisreport += back
300 
301 #
302 # Add results content
303 #
304 
305 money += report.Header('Money Plots')
306 money += report.Description("This section provides the detection statistic plots and a summary of the loudest event.")
307 
308 money += report.Header('Closed Box Results')
309 imgfooter = "Comparison of single time slide event rate to event rate expected from background as a function of threshold."
310 money += report.ImageGrid("Rate vs. Threshold", grid_size=3, footer=imgfooter).glob(os.path.join(opts.glob_path, '*5_count_vs_*_closedbox*.png'))
311 
312 tabledata = load_json(os.path.join(opts.glob_path, '%sbgsummary_table.json' % opts.output_user_tag[0]))
313 money += report.Table('Closed Box Summary Table').save(tabledata, opts.webserver_dir)
314 
315 if opts.open_box:
316  money += report.Header('Open Box Results')
317  imgfooter = "Comparison of single time slide event rate to event rate expected from background as a function of threshold."
318  money += report.ImageGrid("Rate vs. Threshold", grid_size=3, footer=imgfooter).glob(os.path.join(opts.glob_path, '*5_count_vs_*_openbox*.png'))
319 
320  tabledata = load_json(os.path.join(opts.glob_path, '%ssummary_table.json' % opts.output_user_tag[0]))
321  money += report.Table('Open Box Summary Table').save(tabledata, opts.webserver_dir)
322 
323 thisreport += money
324 
325 #
326 # Add search documentation
327 #
328 
329 thisreport += about_doc
330 thisreport += sched_doc
331 
332 #
333 # write the result
334 #
335 
336 thisreport.save(opts.webserver_dir)
337 
338 #
339 # set up a lite version of the summary page
340 #
341 
342 reportlite = report.Report('gstlal analysis', image=IMAGE_URL)
343 
344 summary = report.Tab('Summary')
345 about_doc = report.Tab('About', url=ABOUT_URL)
346 sched_doc = report.Tab('Schedule', url=SCHEDULE_URL)
347 
348 #
349 # Summary lite setup
350 #
351 
352 summary += report.Header('Summary')
353 
354 tabledata = load_json(os.path.join(opts.glob_path, '%s_plot_summary.json' % opts.output_user_tag[0]))
355 summary += report.Table('Search Summary').save(tabledata, opts.webserver_dir+'_lite')
356 
357 ## Include horizon distance plots
358 imgfooter = "This is the distance at which you should see a 1.4 1.4 Msun binary at SNR 8. The first panel shows the time evolution of the horizon distance and the second panel shows the same information in histogram form."
359 summary += report.ImageGrid("Horizon distance", grid_size=1, footer=imgfooter).glob(os.path.join(opts.glob_path, '*HORIZON*.png'))
360 
361 ## Include found/missed as function of decisive characteristic SNR
362 summary += report.Header("Found / Missed Expected SNR")
363 summary += report.Description("""Measuring the found and missed injections as a function of various parameters aids in diagnosing the pipeline as well as providing the expected sensitivity of the pipeline to real signals. The plots in this section show the missed and found injections for the various IFO times for coincident triggers.""")
364 
365 tabledata = load_json(os.path.join(opts.glob_path, '%s_injection_summary.json' % opts.output_user_tag[0]))
366 footer = "Summary of missed and found injections broken up by detector time for %s" % opts.output_user_tag[0]
367 summary += report.Table('Injection Summary Table', footer=footer).save(tabledata, opts.webserver_dir+'_lite')
368 
369 plots = os.path.join(opts.glob_path, '*%s*1_dec_expsnr_vs_mchirp_*.png' % opts.output_user_tag[0])
370 imgfooter = "Expected SNR of found and missed injections as a function of chirp mass: %s" % opts.output_user_tag[0]
371 summary += report.ImageGrid("Expected SNR vs. chirp mass", grid_size=4, footer=imgfooter).glob(plots)
372 
373 ## Include missed injection table
374 summary += report.Header("Missed Table")
375 tabledata = load_json(os.path.join(opts.glob_path, '%s_missed_summary.json' % opts.output_user_tag[0]))
376 summary += report.Table('Missed Injection Table for %s' % opts.output_user_tag[0]).save(tabledata, opts.webserver_dir+'_lite')
377 
378 ## Include search sensitivity binned by source type
379 summary += report.Header('Search Sensitivity')
380 summary += report.Description("""These plots characterize the overall sensitivity of the search. The detection rate is directly proportional to the observed sensitive volume, which is a function of the significance threshold used to identify candidates. These plots are useful for determining how sensitive the search was to the input injection population. Here we show the sensitivity as a function of source type: BNS mchirp between 0.8 and 2, NSBH between 2 and 4.5, BBH between 4.5 and 45.0, IMBH between 45.0 and 450.0""")
381 
382 plots = os.path.join(opts.glob_path, '*%s*_BINNED_BY_SOURCE_TYPE*.png' % opts.output_user_tag[0])
383 imgfooter = "Binned by source type"
384 summary += report.ImageGrid("Sensitive volume (V*T) and mean sensitive distance: %s" % opts.output_user_tag[0], grid_size=4, footer=imgfooter, visible=False).glob(plots)
385 
386 ## Include FAP estimation plots
387 summary += report.Header("SNR and chi-squared")
388 summary += report.ImageGrid("Single Detector Background SNR-chisq Distributions", grid_size=4).glob(os.path.join(opts.glob_path, '*BACKGROUND_PDF_SNRCHI2*.png'))
389 summary += report.ImageGrid("Single Detector Signal Chisq (Conditional) Distributions", grid_size=4).glob(os.path.join(opts.glob_path, '*INJECTION_PDF_SNRCHI2*.png'))
390 if opts.open_box:
391  summary += report.ImageGrid("Single Detector Signal Chisq (Conditional) Distributions: Zero lag", grid_size=4).glob(os.path.join(opts.glob_path, '*ZERO_LAG_PDF_SNRCHI2*.png'))
392 
393 ## Include Chi-square distribution plots
394 summary += report.Header("Chi-squared Distributions")
395 summary += report.Description("The chi-squared test checks that the snr accumulated matches expectation.")
396 
397 imgfooter = "Chi-squared vs snr for single detectors after coincidence. Blue points are full data zero lag, red are software injections and black are time slides."
398 summary += report.ImageGrid("Chi-squared Distributions", grid_size=3, footer=imgfooter).glob(os.path.join(opts.glob_path, '*3_chi2_vs_rho_*closedbox*.png'))
399 if opts.open_box:
400  summary += report.ImageGrid("Chi-squared Distributions: Zero lag", grid_size=3, footer=imgfooter).glob(os.path.join(opts.glob_path, '*3_chi2_vs_rho_*openbox*.png'))
401 
402 ## Include IFAR, lnL plots + summary table
403 summary += report.Header('Money Plots')
404 summary += report.Description("This section provides the detection statistic plots and a summary of the loudest event.")
405 
406 imgfooter = "Comparison of single time slide event rate to event rate expected from background as a function of threshold."
407 summary += report.ImageGrid("Rate vs. Threshold", grid_size=3, footer=imgfooter).glob(os.path.join(opts.glob_path, '*5_count_vs_*_closedbox*.png'))
408 
409 tabledata = load_json(os.path.join(opts.glob_path, '%sbgsummary_table.json' % opts.output_user_tag[0]))
410 summary += report.Table('Closed Box Summary Table').save(tabledata, opts.webserver_dir+'_lite')
411 
412 if opts.open_box:
413  imgfooter = "Comparison of single time slide event rate to event rate expected from background as a function of threshold."
414  summary += report.ImageGrid("Rate vs. Threshold: Zero lag", grid_size=3, footer=imgfooter).glob(os.path.join(opts.glob_path, '*5_count_vs_*_openbox*.png'))
415 
416  tabledata = load_json(os.path.join(opts.glob_path, '%ssummary_table.json' % opts.output_user_tag[0]))
417  summary += report.Table('Open Box Summary Table').save(tabledata, opts.webserver_dir+'_lite')
418 
419 reportlite += summary
420 
421 #
422 # Add search documentation
423 #
424 
425 reportlite += about_doc
426 reportlite += sched_doc
427 
428 #
429 # write the result
430 #
431 
432 reportlite.save(opts.webserver_dir + "_lite", config_name='report_lite')