calculate_sensitivity

pyirf.sensitivity.calculate_sensitivity(signal_hist, background_hist, alpha, min_significance=5, min_signal_events=10, min_excess_over_background=0.05, significance_function=<function li_ma_significance>)[source]

Calculate sensitivity for DL2 event lists in bins of reconstructed energy.

Sensitivity is defined as the minimum flux detectable with target_significance sigma significance in a certain time.

This time must be incorporated into the event weights.

Two conditions are required for the sensitivity: - At least ten weighted signal events - The weighted signal must be larger than 5 % of the weighted background - At least 5 sigma (so relative_sensitivity > 1)

If the conditions are not met, the sensitivity will be set to nan.

Parameters:
signal_hist: astropy.table.QTable

Histogram of detected signal events as a table. Required columns: n and n_weighted. See pyirf.binning.create_histogram_table

background_hist: astropy.table.QTable

Histogram of detected events as a table. Required columns: n and n_weighted. See pyirf.binning.create_histogram_table

alpha: float

Size ratio of signal region to background region

min_significance: float

Significance necessary for a detection

min_signal_events: int

Minimum number of signal events required. The relative flux will be scaled up from the one yielding min_significance if this condition is violated.

min_excess_over_background: float

Minimum number of signal events expressed as the proportion of the background. So the required number of signal events will be min_excess_over_background * alpha * n_off. The relative flux will be scaled up from the one yielding min_significance if this condition is violated.

significance_function: callable

A function with signature (n_on, n_off, alpha) -> significance. Default is the Li & Ma likelihood ratio test.

Returns:
sensitivity_table: astropy.table.QTable

Table with sensitivity information. Contains weighted and unweighted number of signal and background events and the relative_sensitivity, the scaling applied to the signal events that yields target_significance sigma of significance according to the significance_function