|
ctools 2.1.0
|
Public Member Functions | |
| __init__ (self, *argv) | |
| process (self) | |
Protected Member Functions | |
| _get_parameters (self) | |
| _init_metadata (self) | |
| _make_dirs (self, version, irf) | |
| _open (self, irf, ds) | |
| _close (self, irf, ds) | |
| _open_hdu (self, fits, extname, name, hduclas3, hduclas4, doc, irf) | |
| _set_ogip_keywords (self, hdu, hdudoc, hduclas, irf) | |
| _add_cif_info (self, irf, ds) | |
| _set_cif_keywords (self, hdu, name, bounds, desc, irf) | |
| _root2caldb (self, irf, ds) | |
| _root2ea (self, tfile, irf, ds) | |
| _root2psf (self, tfile, irf, ds) | |
| _root2psf_get_r68_and_r80 (self, tfile) | |
| _root2psf_gauss (self, tfile, irf, ds) | |
| _root2psf_king (self, tfile, irf, ds) | |
| _root2edisp_get_migra (self, tfile) | |
| _root2edisp (self, tfile, irf, ds) | |
| _root2bgd (self, tfile, irf, ds) | |
| _append_column_axis (self, hdu, name, unit, axis, log=False) | |
| _append_column_values (self, hdu, name, unit, values) | |
| _renorm_onaxis (self, hist2D, hist1D) | |
| _plaw_replace (self, hist2D, ethres) | |
| _plaw_energy_range (self, energies, rates) | |
| _plaw_coefficients (self, energies, rates, emin, emax) | |
| _plaw_value (self, coeff, energy) | |
| _infill_bgd (self, hist2D) | |
| _make_2D (self, array, hdu, name, unit, scale=1.0) | |
| _make_3D (self, array, hdu, name, unit) | |
| _make_3D_migra (self, array, hdu, name, unit, scale=1.0) | |
Generates IRFs in CALDB from a ROOT offaxis performance file
Definition at line 34 of file csroot2caldb.py.
| cscripts.csroot2caldb.csroot2caldb.__init__ | ( | self, | |
| * | argv ) |
Constructor
Definition at line 40 of file csroot2caldb.py.
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
Get parameters from parfile
Definition at line 52 of file csroot2caldb.py.
Referenced by cscripts.csadd2caldb.csadd2caldb.process(), cscripts.csbkgmodel.csbkgmodel.process(), cscripts.cscaldb.cscaldb.process(), cscripts.csebins.csebins.process(), cscripts.csfindobs.csfindobs.process(), cscripts.csfootprint.csfootprint.process(), cscripts.csiactcopy.csiactcopy.process(), cscripts.csiactdata.csiactdata.process(), cscripts.csiactobs.csiactobs.process(), cscripts.cslightcrv.cslightcrv.process(), cscripts.csmodelinfo.csmodelinfo.process(), cscripts.csmodelmerge.csmodelmerge.process(), cscripts.csmodelselect.csmodelselect.process(), cscripts.csmodelsois.csmodelsois.process(), cscripts.csobs2caldb.csobs2caldb.process(), cscripts.csobsdef.csobsdef.process(), cscripts.csobsinfo.csobsinfo.process(), cscripts.csobsselect.csobsselect.process(), cscripts.csphagen.csphagen.process(), cscripts.csphasecrv.csphasecrv.process(), cscripts.cspull.cspull.process(), cscripts.csresmap.csresmap.process(), cscripts.csresspec.csresspec.process(), cscripts.csroot2caldb.csroot2caldb.process(), cscripts.csscs.csscs.process(), cscripts.cssens.cssens.process(), cscripts.csspec.csspec.process(), cscripts.cssrcdetect.cssrcdetect.process(), cscripts.cstsdist.cstsdist.process(), cscripts.cstsmapmerge.cstsmapmerge.process(), cscripts.cstsmapsplit.cstsmapsplit.process(), cscripts.csviscube.csviscube.process(), and cscripts.csworkflow.csworkflow.process().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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.csobs2caldb.csobs2caldb.process(), and cscripts.csroot2caldb.csroot2caldb.process().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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().
|
protected |
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().
| cscripts.csroot2caldb.csroot2caldb.process | ( | self | ) |
Process the script
Definition at line 1742 of file csroot2caldb.py.
References cscripts.csroot2caldb.csroot2caldb._close(), cscripts.csadd2caldb.csadd2caldb._get_parameters(), cscripts.csbkgmodel.csbkgmodel._get_parameters(), cscripts.cscaldb.cscaldb._get_parameters(), cscripts.csebins.csebins._get_parameters(), cscripts.csfindobs.csfindobs._get_parameters(), cscripts.csfootprint.csfootprint._get_parameters(), cscripts.csiactcopy.csiactcopy._get_parameters(), cscripts.csiactdata.csiactdata._get_parameters(), cscripts.csiactobs.csiactobs._get_parameters(), cscripts.cslightcrv.cslightcrv._get_parameters(), cscripts.csmodelinfo.csmodelinfo._get_parameters(), cscripts.csmodelmerge.csmodelmerge._get_parameters(), cscripts.csmodelselect.csmodelselect._get_parameters(), cscripts.csmodelsois.csmodelsois._get_parameters(), cscripts.csobs2caldb.csobs2caldb._get_parameters(), cscripts.csobsdef.csobsdef._get_parameters(), cscripts.csobsinfo.csobsinfo._get_parameters(), cscripts.csobsselect.csobsselect._get_parameters(), cscripts.csphagen.csphagen._get_parameters(), cscripts.csphasecrv.csphasecrv._get_parameters(), cscripts.cspull.cspull._get_parameters(), cscripts.csresmap.csresmap._get_parameters(), cscripts.csresspec.csresspec._get_parameters(), cscripts.csroot2caldb.csroot2caldb._get_parameters(), cscripts.csscs.csscs._get_parameters(), cscripts.cssens.cssens._get_parameters(), cscripts.csspec.csspec._get_parameters(), cscripts.cssrcdetect.cssrcdetect._get_parameters(), cscripts.cstsdist.cstsdist._get_parameters(), cscripts.cstsmapmerge.cstsmapmerge._get_parameters(), cscripts.cstsmapsplit.cstsmapsplit._get_parameters(), cscripts.csviscube.csviscube._get_parameters(), cscripts.csworkflow.csworkflow._get_parameters(), cscripts.csroot2caldb.csroot2caldb._init_metadata(), cscripts.csobs2caldb.csobs2caldb._make_dirs(), cscripts.csroot2caldb.csroot2caldb._make_dirs(), cscripts.csroot2caldb.csroot2caldb._open(), and cscripts.csroot2caldb.csroot2caldb._root2caldb().