ctools
2.1.0.dev
|
Public Member Functions | |
def | __init__ |
def | process |
Private Member Functions | |
def | _get_parameters |
def | _init_metadata |
def | _make_dirs |
def | _open |
def | _close |
def | _open_hdu |
def | _set_ogip_keywords |
def | _add_cif_info |
def | _set_cif_keywords |
def | _root2caldb |
def | _root2ea |
def | _root2psf |
def | _root2psf_get_r68_and_r80 |
def | _root2psf_gauss |
def | _root2psf_king |
def | _root2edisp_get_migra |
def | _root2edisp |
def | _root2bgd |
def | _append_column_axis |
def | _append_column_values |
def | _renorm_onaxis |
def | _plaw_replace |
def | _plaw_energy_range |
def | _plaw_coefficients |
def | _plaw_value |
def | _infill_bgd |
def | _make_2D |
def | _make_3D |
def | _make_3D_migra |
Generates IRFs in CALDB from a ROOT offaxis performance file
Definition at line 34 of file csroot2caldb.py.
def cscripts.csroot2caldb.csroot2caldb.__init__ | ( | self, | |
argv | |||
) |
Constructor
Definition at line 40 of file csroot2caldb.py.
|
private |
Add information to CIF extension Parameters ---------- irf : dict IRF metadata dictionary ds : dict Directory structure dictionary
Definition at line 415 of file csroot2caldb.py.
Referenced by cscripts.csroot2caldb.csroot2caldb._close().
|
private |
Append column of ROOT axis values to HDU Parameters ---------- hdu : `~gammalib.GFitsHDU` FITS HDU name : str Column name unit : str Column unit axis : `~ROOT.TAxis` ROOT histogram axis log : bool, optional Axis is logarithmic
Definition at line 1096 of file csroot2caldb.py.
Referenced by cscripts.csroot2caldb.csroot2caldb._make_2D(), cscripts.csroot2caldb.csroot2caldb._make_3D(), and cscripts.csroot2caldb.csroot2caldb._make_3D_migra().
|
private |
Append column of values to HDU Parameters ---------- hdu : `~gammalib.GFitsHDU` FITS HDU name : str Column name unit : str Column unit values : list of float Axis values
Definition at line 1149 of file csroot2caldb.py.
Referenced by cscripts.csroot2caldb.csroot2caldb._make_3D().
|
private |
Close calibration FITS files Parameters ---------- irf : dict IRF metadata dictionary ds : dict Directory structure dictionary
Definition at line 293 of file csroot2caldb.py.
References cscripts.csroot2caldb.csroot2caldb._add_cif_info().
Referenced by cscripts.csroot2caldb.csroot2caldb.process().
|
private |
Get parameters from parfile
Definition at line 52 of file csroot2caldb.py.
Referenced by cscript_base.cscript_base.process(), cscript_like.cscript_like.process(), cscript_obs.cscript_obs.process(), cscripts.cstsmapsplit.cstsmapsplit.process(), cscripts.cstsmapmerge.cstsmapmerge.process(), cscripts.csworkflow.csworkflow.process(), cscripts.cstsdist.cstsdist.process(), cscripts.cssrcdetect.cssrcdetect.process(), cscripts.csviscube.csviscube.process(), cscripts.csscs.csscs.process(), cscripts.cssens.cssens.process(), cscripts.csspec.csspec.process(), and cscripts.csroot2caldb.csroot2caldb.process().
|
private |
Fill all empty bins in 2D histogram by preceeding values in energy Parameters ---------- hist2D : `~ROOT.TH2F` ROOT 2D histogram
Definition at line 1429 of file csroot2caldb.py.
Referenced by cscripts.csroot2caldb.csroot2caldb._root2bgd().
|
private |
Initialise dictionary containing the IRF metadata Returns ------- irf : dict IRF metadata dictionary
Definition at line 80 of file csroot2caldb.py.
Referenced by cscripts.csroot2caldb.csroot2caldb.process().
|
private |
Make 2D data column as function of energy and offset angle If the HDU has already the energy and offset angle columns, this method will simply add another data column. If name==None, the method will not append any data column. Parameters ---------- array : `~ROOT.TH2F` ROOT 2D histogram hdu : `~gammalib.GFitsHDU` FITS HDU name : str Data column name unit : str Data unit scale : float, optional Scaling factor for histogram values
Definition at line 1493 of file csroot2caldb.py.
References cscripts.csroot2caldb.csroot2caldb._append_column_axis().
Referenced by cscripts.csroot2caldb.csroot2caldb._root2ea(), cscripts.csroot2caldb.csroot2caldb._root2psf_gauss(), and cscripts.csroot2caldb.csroot2caldb._root2psf_king().
|
private |
Make 3D data column as function of DETX, DETY and energy If the HDU has already the energy and offset angle columns, this method will simply add another data column. If name==None, the method will not append any data column. Parameters ---------- array : `~ROOT.TH2F` ROOT 2D histogram hdu : `~gammalib.GFitsHDU` FITS HDU name : str Data column name unit : str Data unit
Definition at line 1557 of file csroot2caldb.py.
References cscripts.csroot2caldb.csroot2caldb._append_column_axis(), and cscripts.csroot2caldb.csroot2caldb._append_column_values().
Referenced by cscripts.csroot2caldb.csroot2caldb._root2bgd().
|
private |
Make 3D data column as function of ENERG, MIGRA and THETA If the HDU has already the energy and offset angle columns, this method will simply add another data column. If name==None, the method will not append any data column. Parameters ---------- array : `~ROOT.TH3F` ROOT 2D histogram hdu : `~gammalib.GFitsHDU` FITS HDU name : str Data column name unit : str Data unit scale : float, optional Scaling factor for histogram values
Definition at line 1662 of file csroot2caldb.py.
References cscripts.csroot2caldb.csroot2caldb._append_column_axis().
Referenced by cscripts.csroot2caldb.csroot2caldb._root2edisp().
|
private |
Generate CALDB directory structure for one observation identifier The structure is given by data/<tel>/<inst>/bcf/<obsid> where <tel> is "cta" and <inst> is the instrument specified in the CALDB constructor (the instrument may be used for different array configurations). Parameters ---------- version : str Version string irf : dict IRF metadata dictionary Returns ------- ds : dict Directory structure information
Definition at line 149 of file csroot2caldb.py.
Referenced by cscripts.csroot2caldb.csroot2caldb.process().
|
private |
Open existing or create new calibration The actual version will put all calibrations in the same file, although each part of the response function will have its own logical name. We can thus easily modify the script to put each calibration information in a separate file Parameters ---------- irf : dict IRF metadata dictionary ds : dict Directory structure dictionary
Definition at line 230 of file csroot2caldb.py.
References cscripts.csroot2caldb.csroot2caldb._open_hdu().
Referenced by cscripts.csroot2caldb.csroot2caldb.process().
|
private |
Open HDU Opens a FITS binary table with given "extname". If HDU does not exist in the FITS file it will be created and appended to the FITS file. Parameters ---------- fits : `~gammalib.GFits` FITS file extname : str Extension name name : str Name string hduclas3 : str HDU class 3 string hduclas4 : str HDU class 4 string doc : str Document string irf : dict IRF metadata dictionary Returns ------- table : `~gammalib.GFitsBinTable` FITS binary table
Definition at line 329 of file csroot2caldb.py.
References cscripts.csroot2caldb.csroot2caldb._set_ogip_keywords().
Referenced by cscripts.csroot2caldb.csroot2caldb._open().
|
private |
Determines the power law coefficients Parameters ---------- energies : list of float Energy values (TeV) rates : list of float Background rate values emin : float Minimum energy (TeV) emax : float Maximum energy (TeV)
Definition at line 1367 of file csroot2caldb.py.
Referenced by cscripts.csroot2caldb.csroot2caldb._plaw_replace().
|
private |
Determine the energy range over which the power law is valid Parameters ---------- energies : list of float Energy values (TeV) rates : list of float Background rate values
Definition at line 1338 of file csroot2caldb.py.
Referenced by cscripts.csroot2caldb.csroot2caldb._plaw_replace().
|
private |
Replace background rate values by power law values Parameters ---------- hist2D : `~ROOT.TH2F` ROOT 2D histogram ethres : float Energy threshold
Definition at line 1267 of file csroot2caldb.py.
References cscripts.csroot2caldb.csroot2caldb._plaw_coefficients(), cscripts.csroot2caldb.csroot2caldb._plaw_energy_range(), and cscripts.csroot2caldb.csroot2caldb._plaw_value().
Referenced by cscripts.csroot2caldb.csroot2caldb._root2bgd().
|
private |
Determine the power law value Parameters ---------- coeff : dict Dictionary of coefficients energy : float Energy value (TeV)
Definition at line 1412 of file csroot2caldb.py.
Referenced by cscripts.csroot2caldb.csroot2caldb._plaw_replace().
|
private |
Renormalise 2D histogram (energy,offset) on 1D histogram (energy) This method makes sure that a 2D histogram has the same onaxis values as the corresponding 1D histogram. Parameters ---------- hist2D : `~ROOT.TH2F` ROOT 2D histogram hist1D : `~ROOT.TH1F` ROOT 1D histogram
Definition at line 1188 of file csroot2caldb.py.
Referenced by cscripts.csroot2caldb.csroot2caldb._root2bgd(), and cscripts.csroot2caldb.csroot2caldb._root2ea().
|
private |
Translate ROOT to CALDB background extension. The following ROOT histograms are used: - BGRatePerSqDeg_offaxis -> BKG Parameters ---------- tfile : `~ROOT.TFile` ROOT file irf : dict IRF metadata dictionary ds : dict Directory structure dictionary
Definition at line 1050 of file csroot2caldb.py.
References cscripts.csroot2caldb.csroot2caldb._infill_bgd(), cscripts.csroot2caldb.csroot2caldb._make_3D(), cscripts.csroot2caldb.csroot2caldb._plaw_replace(), cscripts.csroot2caldb.csroot2caldb._renorm_onaxis(), and cscripts.csroot2caldb.csroot2caldb._set_cif_keywords().
Referenced by cscripts.csroot2caldb.csroot2caldb._root2caldb().
|
private |
Translate ROOT to CALDB information Parameters ---------- irf : dict IRF metadata dictionary ds : dict Directory structure dictionary
Definition at line 521 of file csroot2caldb.py.
References cscripts.csroot2caldb.csroot2caldb._root2bgd(), cscripts.csroot2caldb.csroot2caldb._root2ea(), cscripts.csroot2caldb.csroot2caldb._root2edisp(), and cscripts.csroot2caldb.csroot2caldb._root2psf().
Referenced by cscripts.csroot2caldb.csroot2caldb.process().
|
private |
Translate ROOT to CALDB effective area extension The following ROOT histograms are used: - EffectiveAreaEtrueNoTheta2cut_offaxis -> EFFAREA - EffectiveAreaEtrueNoTheta2cut (for normalization) Parameters ---------- tfile : `~ROOT.TFile` ROOT file irf : dict IRF metadata dictionary ds : dict Directory structure dictionary
Definition at line 553 of file csroot2caldb.py.
References cscripts.csroot2caldb.csroot2caldb._make_2D(), cscripts.csroot2caldb.csroot2caldb._renorm_onaxis(), and cscripts.csroot2caldb.csroot2caldb._set_cif_keywords().
Referenced by cscripts.csroot2caldb.csroot2caldb._root2caldb().
|
private |
Translate ROOT to CALDB energy dispersion extension The following ROOT histograms are used: - EestOverEtrue_offaxis -> MATRIX Parameters ---------- tfile : `~ROOT.TFile` ROOT file irf : dict IRF metadata dictionary ds : dict Directory structure dictionary
Definition at line 1018 of file csroot2caldb.py.
References cscripts.csroot2caldb.csroot2caldb._make_3D_migra(), cscripts.csroot2caldb.csroot2caldb._root2edisp_get_migra(), and cscripts.csroot2caldb.csroot2caldb._set_cif_keywords().
Referenced by cscripts.csroot2caldb.csroot2caldb._root2caldb().
|
private |
Generates migration matrix histogram from AngularPSF2DEtrue_offaxis histogram Parameters ---------- tfile : `~ROOT.TFile` ROOT file Returns ------- migra : `~ROOT.TH3F` Migration matrix
Definition at line 941 of file csroot2caldb.py.
Referenced by cscripts.csroot2caldb.csroot2caldb._root2edisp().
|
private |
Translate ROOT to CALDB point spread function extension Parameters ---------- tfile : `~ROOT.TFile` ROOT file irf : dict IRF metadata dictionary ds : dict Directory structure dictionary
Definition at line 625 of file csroot2caldb.py.
References cscripts.csroot2caldb.csroot2caldb._root2psf_gauss(), and cscripts.csroot2caldb.csroot2caldb._root2psf_king().
Referenced by cscripts.csroot2caldb.csroot2caldb._root2caldb().
|
private |
Translate ROOT to CALDB point spread function extension The following ROOT histograms are used: - 1/(2*pi*SIGMA_1) -> SCALE - AngRes_offaxis -> SIGMA_1 (scaling: 1/0.8) - 0.0 -> AMPL_2 - 0.0 -> SIGMA_2 - 0.0 -> AMPL_3 - 0.0 -> SIGMA_3 Parameters ---------- tfile : `~ROOT.TFile` ROOT file irf : dict IRF metadata dictionary ds : dict Directory structure dictionary
Definition at line 724 of file csroot2caldb.py.
References cscripts.csroot2caldb.csroot2caldb._make_2D(), cscripts.csroot2caldb.csroot2caldb._root2psf_get_r68_and_r80(), and cscripts.csroot2caldb.csroot2caldb._set_cif_keywords().
Referenced by cscripts.csroot2caldb.csroot2caldb._root2psf().
|
private |
Generates 68% and 80% containment radii histograms from AngularPSF2DEtrue_offaxis histogram Parameters ---------- tfile : `~ROOT.TFile` ROOT file Returns ------- r68, r80 : Tuple of `~ROOT.THF2` 68% and 80% containment radius ROOT histograms
Definition at line 649 of file csroot2caldb.py.
Referenced by cscripts.csroot2caldb.csroot2caldb._root2psf_gauss(), and cscripts.csroot2caldb.csroot2caldb._root2psf_king().
|
private |
Translate ROOT to CALDB point spread function extension The following ROOT histograms are used: - AngRes_offaxis - AngRes80_offaxis Parameters ---------- tfile : `~ROOT.TFile` ROOT file irf : dict IRF metadata dictionary ds : dict Directory structure dictionary
Definition at line 808 of file csroot2caldb.py.
References cscripts.csroot2caldb.csroot2caldb._make_2D(), cscripts.csroot2caldb.csroot2caldb._root2psf_get_r68_and_r80(), and cscripts.csroot2caldb.csroot2caldb._set_cif_keywords().
Referenced by cscripts.csroot2caldb.csroot2caldb._root2psf().
|
private |
Set standard CIF keywords for extension Parameters ---------- hdu : `~gammalib.GFitsHDU` FITS HDU name : str Calibration name bounds : list of str Calibration boundaries desc : str Calibration description irf : dict IRF metadata dictionary
Definition at line 477 of file csroot2caldb.py.
Referenced by cscripts.csroot2caldb.csroot2caldb._root2bgd(), cscripts.csroot2caldb.csroot2caldb._root2ea(), cscripts.csroot2caldb.csroot2caldb._root2edisp(), cscripts.csroot2caldb.csroot2caldb._root2psf_gauss(), and cscripts.csroot2caldb.csroot2caldb._root2psf_king().
|
private |
Set standard OGIP keywords for extension Parameters ---------- hdu : `~gammalig.GFitsHDU` Header Data Unit hdudoc : str Documentation reference string hduclas : list of str List of HDUCLAS fields irf : dict IRF dictonary
Definition at line 378 of file csroot2caldb.py.
Referenced by cscripts.csroot2caldb.csroot2caldb._open_hdu().
def cscripts.csroot2caldb.csroot2caldb.process | ( | self | ) |
Process the script
Definition at line 1742 of file csroot2caldb.py.
References cscripts.csroot2caldb.csroot2caldb._close(), cscripts.csobsselect.csobsselect._get_parameters(), cscripts.csadd2caldb.csadd2caldb._get_parameters(), cscripts.csebins.csebins._get_parameters(), cscripts.csmodelselect.csmodelselect._get_parameters(), cscripts.csroot2caldb.csroot2caldb._get_parameters(), cscripts.csresmap.csresmap._get_parameters(), cscripts.csresspec.csresspec._get_parameters(), cscripts.csmodelinfo.csmodelinfo._get_parameters(), cscripts.csmodelmerge.csmodelmerge._get_parameters(), cscripts.csobsinfo.csobsinfo._get_parameters(), cscripts.csfindobs.csfindobs._get_parameters(), cscripts.csiactdata.csiactdata._get_parameters(), cscripts.csiactcopy.csiactcopy._get_parameters(), cscripts.csmodelsois.csmodelsois._get_parameters(), cscripts.cscaldb.cscaldb._get_parameters(), cscripts.csobs2caldb.csobs2caldb._get_parameters(), cscripts.csbkgmodel.csbkgmodel._get_parameters(), cscripts.cspull.cspull._get_parameters(), cscripts.csfootprint.csfootprint._get_parameters(), cscripts.csiactobs.csiactobs._get_parameters(), cscripts.csobsdef.csobsdef._get_parameters(), cscripts.csphasecrv.csphasecrv._get_parameters(), cscripts.cslightcrv.cslightcrv._get_parameters(), cscripts.csphagen.csphagen._get_parameters(), cscripts.csroot2caldb.csroot2caldb._init_metadata(), cscripts.csroot2caldb.csroot2caldb._make_dirs(), cscripts.csobs2caldb.csobs2caldb._make_dirs(), cscripts.csroot2caldb.csroot2caldb._open(), and cscripts.csroot2caldb.csroot2caldb._root2caldb().