DataReductionFITSWriter
- class lstchain.tools.lstchain_create_dl3_file.DataReductionFITSWriter(**kwargs: Any)
Bases:
Tool
Attributes Summary
If True, the DL3 file will be gzipped
Input data DL2 file
Path for compressed FITS file of IRFs
Interpolation method to be used, when required
IRF file pattern to search in the given IRF files path
If True, duplicated events after alpha and gammaness cut are not removed.
DL3 output filedir
If True, overwrites existing output file without asking
DEC position of the source
If True, source-dependent analysis will be performed.
Name of Source
RA position of the source
If True, only look for the nearest IRF node to the data.
Methods Summary
Apply gammaness and alpha cut for source-dependent analysis.
Apply gammaness cut.
Check if the final IRF has energy-dependent gammaness cuts or not.
finish
()Finish up.
Get the optimal number of IRFs necessary for interpolation IF the target parameter is not inside a simplex formed by the given list of IRFs, use the nearest grid point.
setup
()Set up the tool.
start
()Main function of the tool.
Attributes Documentation
- aliases: StrDict = {'interp-method': 'DataReductionFITSWriter.interp_method', 'source-dec': 'DataReductionFITSWriter.source_dec', 'source-name': 'DataReductionFITSWriter.source_name', 'source-ra': 'DataReductionFITSWriter.source_ra', ('d', 'input-dl2'): 'DataReductionFITSWriter.input_dl2', ('i', 'input-irf-path'): 'DataReductionFITSWriter.input_irf_path', ('o', 'output-dl3-path'): 'DataReductionFITSWriter.output_dl3_path', ('p', 'irf-file-pattern'): 'DataReductionFITSWriter.irf_file_pattern'}
- classes: ClassesType = [<class 'lstchain.io.event_selection.EventSelector'>, <class 'lstchain.io.event_selection.DL3Cuts'>]
- description: str | Unicode[str, str | bytes] = '\nCreate DL3 FITS file from given data DL2 file,\nselection cuts and IRF FITS files.\n\nChange the selection parameters as need be using the aliases.\nThe default values are written in the EventSelector and DL3Cuts Component\nand also given in some example configs in docs/examples/\n\nFor using IRF interpolation methods, to get IRF with sky pointing the same or\ncloser (in the interpolation parameter space) to that of the data provided,\none has to provide,\n\n- the path to the IRFs, and\n- glob search pattern for selecting the IRFs to be used\n\nIf instead of using IRF interpolation, one needs to add only the nearest IRF\nnode to the given data, in the interpolation space, then one needs to pass the\nuse-nearest-irf-node flag.\n\nFor the cuts on gammaness, the Tool looks at the IRF provided or the final\ninterpolated/selected IRF, to either use global cuts, based on the header\nvalue of the global gammaness cut, GH_CUT, present in each HDU, or\nenergy-dependent cuts, based on the GH_CUTS HDU.\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, a source-dep flag should be passed.\nSimilarly to the cuts on gammaness, the global alpha cut values are provided\nfrom AL_CUT stored in the HDU header. The alpha cut is already applied on this\nstep, and all survived events with each assumed source position (on and off)\nare saved after the gammaness and alpha cut.\nTo adapt to the high-level analysis used by gammapy, assumed source position\n(on and off) is set as a reco source position just as a trick to obtain\nsurvived events easily.\n'
- example = '\n To generate DL3 file from an observed data DL2 file, using default cuts:\n > lstchain_create_dl3_file\n -d /path/to/DL2_data_file.h5\n -o /path/to/DL3/file/\n -i /path/to/irf/\n --source-name Crab\n --source-ra 83.633deg\n --source-dec 22.01deg\n\n Or use a config file for the cuts:\n > lstchain_create_dl3_file\n -d /path/to/DL2_data_file.h5\n -o /path/to/DL3/file/\n -i /path/to/irf/\n --source-name Crab\n --source-ra 83.633deg\n --source-dec 22.01deg\n --overwrite\n --config /path/to/config.json\n\n Or pass the selection cuts from command-line:\n > lstchain_create_dl3_file\n -d /path/to/DL2_data_file.h5\n -o /path/to/DL3/file/\n --input-irf-path /path/to/irf/\n --irf-file-pattern "irf*.fits.gz"\n --source-name Crab\n --source-ra 83.633deg\n --source-dec 22.01deg\n --overwrite\n\n Or generate source-dependent DL3 files\n > lstchain_create_dl3_file\n -d /path/to/DL2_data_file.h5\n -o /path/to/DL3/file/\n --input-irf-path /path/to/irf\n --irf-file-pattern "irf.fits.gz"\n --source-name Crab\n --source-dep\n --overwrite\n\n Or use a list of IRFs for including interpolated IRF:\n > lstchain_create_dl3_file\n -d /path/to/DL2_data_file.h5\n -o /path/to/DL3/file/\n -i /path/to/irf/\n -p "irf*.fits.gz"\n --interp-method linear\n --source-name Crab\n --source-ra 83.633deg\n --source-dec 22.01deg\n --overwrite\n\n Or use a list of IRFs for including only the nearest IRF:\n > lstchain_create_dl3_file\n -d /path/to/DL2_data_file.h5\n -o /path/to/DL3/file/\n -i /path/to/irf/\n -p "irf*.fits.gz"\n --use-nearest-irf-node\n --source-name Crab\n --source-ra 83.633deg\n --source-dec 22.01deg\n --overwrite\n\n '
- flags: StrDict = {'gzip': ({'DataReductionFITSWriter': {'gzip': True}}, 'gzip the DL3 files if True'), 'keep-duplicated-events': ({'DataReductionFITSWriter': {'keep_duplicated_events': True}}, 'duplicated events are not removed if True'), 'overwrite': ({'DataReductionFITSWriter': {'overwrite': True}}, 'overwrite output file if True'), 'source-dep': ({'DataReductionFITSWriter': {'source_dep': True}}, 'source-dependent analysis if True'), 'use-nearest-irf-node': ({'DataReductionFITSWriter': {'use_nearest_irf_node': True}}, 'Only use the closest IRF, if True')}
- gzip
If True, the DL3 file will be gzipped
- input_dl2
Input data DL2 file
- input_irf_path
Path for compressed FITS file of IRFs
- interp_method
Interpolation method to be used, when required
- irf_file_pattern
IRF file pattern to search in the given IRF files path
- keep_duplicated_events
If True, duplicated events after alpha and gammaness cut are not removed.
- output_dl3_path
DL3 output filedir
- overwrite
If True, overwrites existing output file without asking
- source_dec
DEC position of the source
- source_dep
If True, source-dependent analysis will be performed.
- source_name
Name of Source
- source_ra
RA position of the source
- use_nearest_irf_node
If True, only look for the nearest IRF node to the data. No interpolation
Methods Documentation
- apply_srcdep_gh_alpha_cut()
Apply gammaness and alpha cut for source-dependent analysis.
- apply_srcindep_gh_cut()
Apply gammaness cut.
- check_energy_dependent_cuts()
Check if the final IRF has energy-dependent gammaness cuts or not.
- finish()
Finish up.
This is called automatically after Tool.start when Tool.run is called.
- interp_irfs()
Get the optimal number of IRFs necessary for interpolation IF the target parameter is not inside a simplex formed by the given list of IRFs, use the nearest grid point.
- 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.