IRFFITSWriter

class lstchain.tools.lstchain_create_irf_files.IRFFITSWriter(**kwargs: Any)

Bases: Tool

Attributes Summary

aliases

classes

description

energy_dependent_alpha

True for applying energy-dependent alpha cuts

energy_dependent_gh

True for applying energy-dependent gammaness cuts

energy_dependent_theta

True for applying energy-dependent theta cuts

example

flags

input_electron_dl2

Input MC electron DL2 file

input_gamma_dl2

Input MC gamma DL2 file

input_proton_dl2

Input MC proton DL2 file

irf_obs_time

Observation time for IRF in hours

name

output_irf_file

IRF output file

overwrite

If True, overwrites existing output file without asking

point_like

True for point_like IRF, False for Full Enclosure

source_dep

True for source-dependent analysis

Methods Summary

finish()

Finish up.

setup()

Set up the tool.

start()

Main function of the tool.

Attributes Documentation

aliases: StrDict = {'allowed-tels': 'DL3Cuts.allowed_tels', 'alpha-containment': 'DL3Cuts.alpha_containment', 'gh-efficiency': 'DL3Cuts.gh_efficiency', 'global-alpha-cut': 'DL3Cuts.global_alpha_cut', 'global-gh-cut': 'DL3Cuts.global_gh_cut', 'global-theta-cut': 'DL3Cuts.global_theta_cut', 'irf-obs-time': 'IRFFITSWriter.irf_obs_time', 'overwrite': 'IRFFITSWriter.overwrite', 'scale-true-energy': 'DataBinning.scale_true_energy', 'theta-containment': 'DL3Cuts.theta_containment', ('e', 'input-electron-dl2'): 'IRFFITSWriter.input_electron_dl2', ('g', 'input-gamma-dl2'): 'IRFFITSWriter.input_gamma_dl2', ('o', 'output-irf-file'): 'IRFFITSWriter.output_irf_file', ('p', 'input-proton-dl2'): 'IRFFITSWriter.input_proton_dl2'}
classes: ClassesType = [<class 'lstchain.io.event_selection.EventSelector'>, <class 'lstchain.io.event_selection.DL3Cuts'>, <class 'lstchain.io.event_selection.DataBinning'>]
description: str | Unicode[str, str | bytes] = '\nCreate FITS file for IRFs from given MC DL2 files and selection cuts\ntaken either from command-line arguments or a config file.\n\nMC gamma files can be point_like or diffuse.\nIRFs can be point_like or Full Enclosure.\nBackground HDU maybe added if proton and electron MC are provided.\n\nChange the selection parameters as need be using the aliases.\nThe default values are written in the EventSelector, DL3Cuts and\nDataBinning Component and also given in some example configs in docs/examples/\n\nBy default, the Tool uses global cuts for gammaness and theta.\n\nFor using energy-dependent gammaness cuts, use the argument gh_efficiency\nfor passing the gamma efficiency value to calculate the gammaness cuts for\neach reco energy bin and the flag energy-dependent-gh.\nSimilarly, for energy-dependent theta cuts, use the argument\ntheta_containment and the flag energy-dependent-theta.\n\nThe energy-dependent cuts are stored as HDUs - GH_CUTS and RAD_MAX,\nand saved with other IRFs.\n\nTo use a separate config file for providing the selection parameters,\ncopy and append the relevant example config files, into a custom config file.\n\nFor source-dependent analysis, alpha cut can be used instead of theta cut.\nIf you want to generate source-dependent IRFs, source-dep flag should be activated.\nThe global alpha cut used to generate IRFs is stored as AL_CUT in the HDU header.\n\nModified IRFs with true energy scaled by a given factor can be created to evaluate \nthe systematic uncertainty in the light collection efficiency. This can be done by \nsetting a value different from one for the "scale_true_energy" argument present in \nthe DataBinning Component of the configuration file of the IRF creation Tool.\n(The true energy of the MC events will be scaled before filling the IRFs histograms \nwhen pyirf commands are used. The effects expected are a non-diagonal energy dispersion\nmatrix and a different spectrum).\n                \n\n'
energy_dependent_alpha

True for applying energy-dependent alpha cuts

energy_dependent_gh

True for applying energy-dependent gammaness cuts

energy_dependent_theta

True for applying energy-dependent theta cuts

example = '\n    To generate IRFs from MC gamma only, using default cuts/binning:\n    > lstchain_create_irf_files\n        -g /path/to/DL2_MC_gamma_file.h5\n        -o /path/to/irf.fits.gz\n        --point-like (Only for point_like IRFs)\n        --overwrite\n\n    Or to generate all 4 IRFs, using default cuts/binning:\n    > lstchain_create_irf_files\n        -g /path/to/DL2_MC_gamma_file.h5\n        -p /path/to/DL2_MC_proton_file.h5\n        -e /path/to/DL2_MC_electron_file.h5\n        -o /path/to/irf.fits.gz\n        --point-like (Only for point_like IRFs)\n\n    Or use a config file for cuts and binning information:\n    > lstchain_create_irf_files\n        -g /path/to/DL2_MC_gamma_file.h5\n        -o /path/to/irf.fits.gz\n        --point-like (Only for point_like IRFs)\n        --config /path/to/config.json\n\n    Or pass the selection cuts from command-line:\n    > lstchain_create_irf_files\n        -g /path/to/DL2_MC_gamma_file.h5\n        -o /path/to/irf.fits.gz\n        --point-like (Only for point_like IRFs)\n        --global-gh-cut 0.9\n        --global-theta-cut 0.2\n        --irf-obs-time 50\n\n    Or use energy-dependent cuts based on a gamma efficiency:\n    > lstchain_create_irf_files\n        -g /path/to/DL2_MC_gamma_file.h5\n        -o /path/to/irf.fits.gz\n        --point-like (Only for point_like IRFs)\n        --energy-dependent-gh\n        --energy-dependent-theta\n        --gh-efficiency 0.95\n        --theta-containment 0.68\n\n    Or generate source-dependent IRFs\n    > lstchain_create_irf_files\n        -g /path/to/DL2_MC_gamma_file.h5\n        -o /path/to/irf.fits.gz\n        --point-like\n        --global-gh-cut 0.9\n        --global-alpha-cut 10\n        --source-dep\n\n    To build modified IRFs by specifying a scaling factor applying to the true energy (without using a config file):\n    > lstchain_create_irf_files\n        -g /path/to/DL2_MC_gamma_file.h5\n        -o /path/to/irf.fits.gz\n        --scale-true-energy 1.15\n        '
flags: StrDict = {'energy-dependent-alpha': ({'IRFFITSWriter': {'energy_dependent_alpha': True}}, 'Uses energy-dependent cuts for alpha'), 'energy-dependent-gh': ({'IRFFITSWriter': {'energy_dependent_gh': True}}, 'Uses energy-dependent cuts for gammaness'), 'energy-dependent-theta': ({'IRFFITSWriter': {'energy_dependent_theta': True}}, 'Uses energy-dependent cuts for theta'), 'overwrite': ({'IRFFITSWriter': {'overwrite': True}}, 'overwrites output file'), 'point-like': ({'IRFFITSWriter': {'point_like': True}}, 'Point like IRFs will be produced, otherwise Full Enclosure'), 'source-dep': ({'IRFFITSWriter': {'source_dep': True}}, 'Source-dependent analysis will be performed')}
input_electron_dl2

Input MC electron DL2 file

input_gamma_dl2

Input MC gamma DL2 file

input_proton_dl2

Input MC proton DL2 file

irf_obs_time

Observation time for IRF in hours

name: str | Unicode[str, str | bytes] = 'IRFFITSWriter'
output_irf_file

IRF output file

overwrite

If True, overwrites existing output file without asking

point_like

True for point_like IRF, False for Full Enclosure

source_dep

True for source-dependent analysis

Methods Documentation

finish()

Finish up.

This is called automatically after Tool.start when Tool.run is called.

setup()

Set up the tool.

This method runs after the configuration and command line options have been parsed.

Here the tool should construct all Components, open files, etc.

start()

Main function of the tool.

This is automatically called after Tool.initialize when Tool.run is called.