|
ctools 2.1.0
|
Functions | |
| sim (obs, log=False, debug=False, chatter=2, edisp=False, seed=0, emin=None, emax=None, nbins=0, onsrc=None, onrad=0.2, addbounds=False, binsz=0.05, npix=200, proj='TAN', coord='GAL', nthreads=0) | |
| set_obs (pntdir, tstart=0.0, duration=1800.0, deadc=0.98, emin=0.1, emax=100.0, rad=5.0, instrument='CTA', irf='South_50h', caldb='prod2', obsid='000000', mjdref=51544.5) | |
| set_obs_list (obsdeflist, tstart=0.0, duration=1800.0, deadc=0.98, emin=0.1, emax=100.0, rad=5.0, irf='South_50h', caldb='prod2') | |
| set_obs_patterns (pattern, ra=83.6331, dec=22.0145, offset=1.5) | |
| set_observations (ra, dec, rad, tstart, duration, emin, emax, irf, caldb, deadc=0.98, pattern='single', offset=1.5) | |
| get_stacked_response (obs, cntcube, edisp=False, addbounds=False, log=False, debug=False, chatter=2) | |
| get_stacked_obs (cls, obs, nthreads=0) | |
| get_onoff_obs (cls, obs, nthreads=0, ra=None, dec=None, srcname='') | |
| residuals (cls, counts, model) | |
| create_counts_cube (cls, obs) | |
| cscripts.obsutils.create_counts_cube | ( | cls, | |
| obs ) |
Create counts cube from observations
Parameters
----------
cls : `~ctools.cscript`
cscript class
obs : `~gammalib.GObservations`
Observation container
Returns
-------
cntcube : `~gammalib.GCTAEventCube`
Counts cube
Definition at line 988 of file obsutils.py.
References ctbin.cube(), and ctool.run().
| cscripts.obsutils.get_onoff_obs | ( | cls, | |
| obs, | |||
| nthreads = 0, | |||
| ra = None, | |||
| dec = None, | |||
| srcname = '' ) |
Create On/Off observations container from given observations
Parameters
----------
cls : `~ctools.cscript`
cscript class
obs : `~gammalib.GObservations`
Observation container
nthreads : str, optional
Number of parallel processes for On/Off spectra computation (0=all available CPUs)
ra : float, optional
R.A. of source region centre
dec : float, optional
Dec. of source region centre
srcname : str, optional
Source name
Returns
-------
onoff_obs : `~gammalib.GObservations`
Observation container with On/Off observations
Definition at line 756 of file obsutils.py.
| cscripts.obsutils.get_stacked_obs | ( | cls, | |
| obs, | |||
| nthreads = 0 ) |
Bin an observation and return an observation container with a single
binned observation
Parameters
----------
cls : `~ctools.cscript`
cscript class
obs : `~gammalib.GObservations`
Observation container
nthreads : str, optional
Number of parallel processes for On/Off spectra computation (0=all available CPUs)
Returns
-------
obs : `~gammalib.GObservations`
Observation container where the first observation is a binned observation
Definition at line 681 of file obsutils.py.
References cscripts.obsutils.get_stacked_response().
| cscripts.obsutils.get_stacked_response | ( | obs, | |
| cntcube, | |||
| edisp = False, | |||
| addbounds = False, | |||
| log = False, | |||
| debug = False, | |||
| chatter = 2 ) |
Get stacked response cubes
The number of energies bins are set to at least 30 bins per decade, unless
the counts cube has more energy bins per decade.
Parameters
----------
obs : `~gammalib.GObservations`
Observation container
cntcube : `~gammalib.GCTAEventCube`
Counts cube
edisp : bool, optional
Apply energy dispersion?
addbounds : bool, optional
Add boundaries at observation energies
log : bool, optional
Create log file(s)
debug : bool, optional
Create console dump?
chatter : int, optional
Chatter level
Returns
-------
result : dict
Dictionary of response cubes
Definition at line 526 of file obsutils.py.
Referenced by cscripts.obsutils.get_stacked_obs(), and cscripts.obsutils.sim().
| cscripts.obsutils.residuals | ( | cls, | |
| counts, | |||
| model ) |
Calculate residuals given counts and models, according to algorithm
specified by user.
Can handle GSkyMap or GNdarray objects
Parameters
----------
cls : `~ctools.cscript`
cscript class
counts : `~gammalib.GSkyMap/~gammalib.GNdarray'
Data counts
model : `~gammalib.GSkyMap/~gammalib.GNdarray'
Model counts
Returns
-------
residuals : `~gammalib.GSkyMap/~gammalib.GNdarray'
Residuals
Definition at line 889 of file obsutils.py.
| cscripts.obsutils.set_obs | ( | pntdir, | |
| tstart = 0.0, | |||
| duration = 1800.0, | |||
| deadc = 0.98, | |||
| emin = 0.1, | |||
| emax = 100.0, | |||
| rad = 5.0, | |||
| instrument = 'CTA', | |||
| irf = 'South_50h', | |||
| caldb = 'prod2', | |||
| obsid = '000000', | |||
| mjdref = 51544.5 ) |
Set a single CTA observation
The function sets a single CTA observation containing an empty CTA
event list. By looping over this function CTA observations can be
added to the observation container.
Parameters
----------
pntdir : `~gammalib.GSkyDir`
Pointing direction
tstart : float, optional
Start time (s)
duration : float, optional
Duration of observation (s)
deadc : float, optional
Deadtime correction factor
emin : float, optional
Minimum event energy (TeV)
emax : float, optional
Maximum event energy (TeV)
rad : float, optional
ROI radius used for analysis (deg)
instrument : str, optional
Name of Cherenkov Telescope
irf : str, optional
Instrument response function
caldb : str, optional
Calibration database path
obsid : str, optional
Observation identifier
Returns
-------
obs : `~gammalib.GCTAObservation`
CTA observation
Definition at line 232 of file obsutils.py.
Referenced by cscripts.obsutils.set_obs_list().
| cscripts.obsutils.set_obs_list | ( | obsdeflist, | |
| tstart = 0.0, | |||
| duration = 1800.0, | |||
| deadc = 0.98, | |||
| emin = 0.1, | |||
| emax = 100.0, | |||
| rad = 5.0, | |||
| irf = 'South_50h', | |||
| caldb = 'prod2' ) |
Returns an observation container filled with a list of CTA observations
The list is defined by the obsdeflist parameter which is a dictionnary
containing the mandatory keywords 'ra' and 'dec' that specify the
pointing direction for a given observation. Optional keyword give control
over other observation proposerties, such as duration, deadtime correction,
energy range, etc. If an optional keyword is not specified, the function
keyword is used instead.
Parameters
----------
obsdeflist : list of dict
Observation definition list
tstart : float, optional
Start time (s)
duration : float, optional
Duration of observation (s)
deadc : float, optional
Deadtime correction factor
emin : float, optional
Minimum event energy (TeV)
emax : float, optional
Maximum event energy (TeV)
rad : float, optional
ROI radius used for analysis (deg)
irf : str, optional
Instrument response function
caldb : str, optional
Calibration database path
Returns
-------
obs : `~gammalib.GObservations`
Observation container filled with CTA observation
Definition at line 336 of file obsutils.py.
References cscripts.obsutils.set_obs().
Referenced by cscripts.obsutils.set_observations().
| cscripts.obsutils.set_obs_patterns | ( | pattern, | |
| ra = 83.6331, | |||
| dec = 22.0145, | |||
| offset = 1.5 ) |
Sets a number of standard patterns
Parameters
----------
pattern : str
Observation pattern ("single", "four")
ra : float, optional
Right Ascension of pattern centre (deg)
dec : float, optional
Declination of pattern centre (deg)
offset : float, optional
Offset from pattern centre (deg)
Returns
-------
obsdeflist : list
Observation definition list
Definition at line 418 of file obsutils.py.
Referenced by cscripts.obsutils.set_observations().
| cscripts.obsutils.set_observations | ( | ra, | |
| dec, | |||
| rad, | |||
| tstart, | |||
| duration, | |||
| emin, | |||
| emax, | |||
| irf, | |||
| caldb, | |||
| deadc = 0.98, | |||
| pattern = 'single', | |||
| offset = 1.5 ) |
Set an observation container filled with CTA observations
Parameters
----------
ra : float
Right Ascension of pattern centre (deg)
dec : float
Declination of pattern centre (deg)
rad : float
ROI radius used for analysis (deg)
tstart : float
Start time of observation (s)
duration : float
Duration of each observation (s)
emin : float, optional
Minimum event energy (TeV)
emax : float, optional
Maximum event energy (TeV)
irf : str
Instrument response function
caldb : str
Calibration database path
deadc : float, optional
Deadtime correction factor
pattern : str, optional
Observation pattern ("single", "four")
offset : float, optional
Offset from pattern centre (deg)
Returns
-------
obs : `~gammalib.GObservations()
Observation container
Definition at line 474 of file obsutils.py.
References cscripts.obsutils.set_obs_list(), and cscripts.obsutils.set_obs_patterns().
| cscripts.obsutils.sim | ( | obs, | |
| log = False, | |||
| debug = False, | |||
| chatter = 2, | |||
| edisp = False, | |||
| seed = 0, | |||
| emin = None, | |||
| emax = None, | |||
| nbins = 0, | |||
| onsrc = None, | |||
| onrad = 0.2, | |||
| addbounds = False, | |||
| binsz = 0.05, | |||
| npix = 200, | |||
| proj = 'TAN', | |||
| coord = 'GAL', | |||
| nthreads = 0 ) |
Simulate events for all observations in the container
Simulate events for all observations using ctobssim. If the number of
energy bins is positive, the events are binned into a counts cube using
ctbin. If multiple observations are simulated, the counts cube is a
stacked cube and the corresponding response cubes are computed using
ctexpcube, ctpsfcube, ctbkgcube and optionally ctedispcube. The response
cubes are attached to the first observation in the container, which
normally is the observation with the counts cube.
Parameters
----------
obs : `~gammalib.GObservations`
Observation container without events
log : bool, optional
Create log file(s)
debug : bool, optional
Create console dump?
chatter : int, optional
Chatter level
edisp : bool, optional
Apply energy dispersion?
seed : int, optional
Seed value for simulations
emin : float, optional
Minimum energy of counts cube for binned (TeV)
emax : float, optional
Maximum energy of counts cube for binned (TeV)
nbins : int, optional
Number of energy bins (0=unbinned)
onsrc : str, optional
Name of source for On region (None if no On/Off obs. is used)
onrad : float, optional
Radius for On region (deg)
addbounds : bool, optional
Add boundaries at observation energies
binsz : float, optional
Pixel size for binned simulation (deg/pixel)
npix : int, optional
Number of pixels in X and Y for binned simulation
proj : str, optional
Projection for binned simulation
coord : str, optional
Coordinate system for binned simulation
nthreads : str, optional
Number of parallel processes for On/Off spectra computation (0=all available CPUs)
Returns
-------
obs : `~gammalib.GObservations`
Observation container filled with simulated events
Definition at line 29 of file obsutils.py.
References cscripts.obsutils.get_stacked_response().