optimize_gh_cut
- pyirf.cut_optimization.optimize_gh_cut(signal, background, reco_energy_bins, gh_cut_efficiencies, theta_cuts, op=<built-in function ge>, fov_offset_min=<Quantity 0. deg>, fov_offset_max=<Quantity 1. deg>, alpha=1.0, progress=True, **kwargs)[source]
Optimize the gh-score cut in every energy bin of reconstructed energy for best sensitivity.
This procedure is EventDisplay-like, since it only applies a pre-computed theta cut and then optimizes only the gamma/hadron separation cut.
- Parameters:
- signal: astropy.table.QTable
event list of simulated signal events. Required columns are theta, reco_energy, ‘weight’, gh_score No directional (theta) or gamma/hadron cut should already be applied.
- background: astropy.table.QTable
event list of simulated background events. Required columns are reco_source_fov_offset, reco_energy, ‘weight’, gh_score. No directional (theta) or gamma/hadron cut should already be applied.
- reco_energy_bins: astropy.units.Quantity[energy]
Bins in reconstructed energy to use for sensitivity computation
- gh_cut_efficiencies: np.ndarray[float, ndim=1]
The cut efficiencies to scan for best sensitivity.
- theta_cuts: astropy.table.QTable
cut definition of the energy dependent theta cut, e.g. as created by
calculate_percentile_cut
- op: comparison function with signature f(a, b) -> bool
The comparison function to use for the gamma hadron score. Returning true means an event passes the cut, so is not discarded. E.g. for gammaness-like score, use operator.ge (>=) and for a hadroness-like score use operator.le (<=).
- fov_offset_min: astropy.units.Quantity[angle]
Minimum distance from the fov center for background events to be taken into account
- fov_offset_max: astropy.units.Quantity[angle]
Maximum distance from the fov center for background events to be taken into account
- alpha: float
Size ratio of off region / on region. Will be used to scale the background rate.
- progress: bool
If True, show a progress bar during cut optimization
- **kwargs are passed to ``calculate_sensitivity``