@@ -54,28 +54,28 @@ ax = fig.add_subplot(111)
54
54
55
55
ifar_calc_points = np .linspace (- 10 , 30 , 200 )
56
56
57
- singles = []
57
+ fitted = [] # List of combos for which a fit is used
58
58
for f in opts .trigger_files :
59
59
logging .info (f"Opening { f } " )
60
60
with h5py .File (f , 'r' ) as exc_zlag_f :
61
- event_ifos = exc_zlag_f .attrs ['ifos' ].split ()
62
- coinc_key = '' .join (event_ifos ).replace ('1' , '' )
61
+ logging .info (f"Ifos { exc_zlag_f .attrs ['ifos' ]} " ) # eg 'H1 L1'
62
+ sig_key = exc_zlag_f .attrs ['ifos' ].replace (' ' , '' ) # eg 'H1L1'
63
+ coinc_key = sig_key .replace ('1' , '' ) # eg 'HL'
63
64
stat_exc = exc_zlag_f ['background_exc' ]['stat' ][:]
64
65
dec_fac_exc = exc_zlag_f ['background_exc' ]['decimation_factor' ][:]
65
66
bg_time = convert_s_to_y (exc_zlag_f .attrs ['background_time_exc' ])
66
67
ifar_file = exc_zlag_f ['background_exc' ]['ifar' ][:]
67
-
68
- logging .info (f"Min { coinc_key } IFAR: { min (ifar_file )} " )
69
68
logging .info (f"{ coinc_key } background time (y): { bg_time } " )
70
- if len (event_ifos ) == 1 :
71
- ifo = event_ifos [0 ]
72
- singles .append (ifo )
73
- fit_thresh = sig_dict [ifo ]['fit_threshold' ]
69
+
70
+ # If fitting / extrapolation is done
71
+ if sig_dict [sig_key ]['method' ] == 'trigger_fit' :
72
+ fitted .append (sig_key )
73
+ fit_thresh = sig_dict [sig_key ]['fit_threshold' ]
74
74
far_tuple = significance .get_far (stat_exc ,
75
75
ifar_calc_points ,
76
76
dec_fac_exc ,
77
77
bg_time ,
78
- ** sig_dict [ifo ])
78
+ ** sig_dict [sig_key ])
79
79
far = far_tuple [1 ] # Version-proof: get_far returns 2 or 3 values
80
80
81
81
# Plot n-louder points with a solid line and sngl fits with dashed
@@ -86,7 +86,7 @@ for f in opts.trigger_files:
86
86
far [ifar_calc_points > fit_thresh ],
87
87
coinc_line_map [coinc_key ],
88
88
c = coinc_color_map [coinc_key ], label = coinc_key , zorder = - 5 )
89
- del ifo , fit_thresh , far # avoid variables hanging around
89
+ del fit_thresh # avoid variable hanging around
90
90
91
91
else :
92
92
far_tuple = significance .get_far (stat_exc ,
@@ -98,12 +98,12 @@ for f in opts.trigger_files:
98
98
ax .plot (ifar_calc_points , far_tuple [1 ], '-' ,
99
99
c = coinc_color_map [coinc_key ], label = coinc_key , zorder = - 5 )
100
100
101
- del far_tuple # avoid variable hanging around
101
+ del sig_key , coinc_key , far_tuple # avoid variables hanging around
102
102
103
103
# Plot the thresholds
104
- for ifo in singles :
105
- ax .axvline (sig_dict [ifo ]['fit_threshold' ], ls = '-- ' , zorder = - 10 ,
106
- c = coinc_color_map [ifo . rstrip ('1' )])
104
+ for combo in fitted :
105
+ ax .axvline (sig_dict [combo ]['fit_threshold' ], ls = '-. ' , zorder = - 10 ,
106
+ c = coinc_color_map [combo . replace ('1' , ' ' )])
107
107
108
108
ax .semilogy ()
109
109
ax .legend (ncol = 2 , fontsize = 12 )
@@ -120,8 +120,8 @@ ax.set_ylabel('Cumulative Event Rate [y$^{-1}$]', fontsize=16)
120
120
# Save
121
121
caption = 'Cumulative rates of noise events for separate event types. Solid ' \
122
122
'lines represent estimates from counts of louder (zerolag or time ' \
123
- 'shifted) events. Dashed lines represent estimates from fit ' \
124
- 'extrapolation for single-detector events .'
123
+ 'shifted) events. Dashed lines represent estimates from fitting / ' \
124
+ 'extrapolation.'
125
125
126
126
results .save_fig_with_metadata (fig , opts .output_file ,
127
127
fig_kwds = {'bbox_inches' : 'tight' },
0 commit comments