ctools  2.0.0
 All Classes Namespaces Files Functions Variables Macros Pages
cscripts.csphagen.csphagen Class Reference
Inheritance diagram for cscripts.csphagen.csphagen:

Public Member Functions

def __init__
 
def __getstate__
 
def __setstate__
 
def process
 
def save
 
def exclusion_map
 
def obs_off
 

Private Member Functions

def _query_src_direction
 
def _compute_posang
 
def _get_regions
 
def _get_source_parameters
 
def _get_parameters_bkgmethod_reflected
 
def _get_parameters_bkgmethod_custom
 
def _get_parameters_bkgmethod_off
 
def _get_parameters_bkgmethod
 
def _get_parameters
 
def _compute_region_separation
 
def _reflected_regions
 
def _instrument_regions
 
def _set_models
 
def _set_statistic
 
def _etrue_ebounds
 
def _set_background_regions
 
def _process_observation
 
def _unpack_result
 

Private Attributes

 _obs_off
 
 _ebounds
 
 _etruebounds
 
 _src_dir
 
 _src_reg
 
 _models
 
 _srcname
 
 _bkg_regs
 
 _excl_reg
 
 _has_exclusion
 
 _srcshape
 
 _rad
 
 _reg_width
 
 _reg_height
 
 _reg_posang
 
 _nthreads
 

Detailed Description

Generate PHA, ARF and RMF files for classical IACT spectral analysis

Definition at line 32 of file csphagen.py.

Constructor & Destructor Documentation

def cscripts.csphagen.csphagen.__init__ (   self,
  argv 
)
Constructor

Definition at line 38 of file csphagen.py.

Member Function Documentation

def cscripts.csphagen.csphagen._compute_posang (   self,
  pnt_dir,
  a,
  b 
)
private
Compute the difference in position angle wrt the pointing in degrees

Parameters
----------
pnt_dir : `~gammalib.GSkyDir`
    Pointing direction
a : `~gammalib.GSkyDir`
    First sky direction
a : `~gammalib.GSkyDir`
    Second sky direction

Returns
-------
posang : float
    Position angle (degrees)

Definition at line 155 of file csphagen.py.

Referenced by cscripts.csphagen.csphagen._compute_region_separation().

def cscripts.csphagen.csphagen._compute_region_separation (   self,
  pnt_dir 
)
private
Compute the separation angle for reflected off regions in radians

Returns
-------
angle : float
    Separation angle of two off regions (radians)

Definition at line 473 of file csphagen.py.

References cscripts.csphagen.csphagen._compute_posang(), cscripts.csphagen.csphagen._rad, cscripts.csphagen.csphagen._src_dir, cscripts.csphagen.csphagen._src_reg, and cscripts.csphagen.csphagen._srcshape.

Referenced by cscripts.csphagen.csphagen._reflected_regions().

def cscripts.csphagen.csphagen._etrue_ebounds (   self)
private
Set true energy boundaries

Returns
-------
ebounds : `~gammalib.GEbounds()`
    True energy boundaries

Definition at line 806 of file csphagen.py.

Referenced by cscripts.csphagen.csphagen.process().

def cscripts.csphagen.csphagen._get_parameters (   self)
private
Get parameters from parfile and setup observations

Definition at line 391 of file csphagen.py.

References cscripts.csebins.csebins._ebounds, cscripts.csphagen.csphagen._ebounds, cscripts.csobsinfo.csobsinfo._ebounds, cscripts.csiactobs.csiactobs._ebounds, cscripts.csphagen.csphagen._excl_reg, cscripts.csphagen.csphagen._get_parameters_bkgmethod(), cscripts.csphagen.csphagen._has_exclusion, cscripts.csbkgmodel.csbkgmodel._models, cscripts.csmodelselect.csmodelselect._models, cscripts.csmodelinfo.csmodelinfo._models, cscripts.csmodelmerge.csmodelmerge._models, cscripts.csphagen.csphagen._models, cscripts.csiactobs.csiactobs._models, cscripts.csmodelsois.csmodelsois._models, cscripts.csphagen.csphagen._nthreads, cscripts.cslightcrv.cslightcrv._nthreads, cscripts.csphagen.csphagen._src_dir, cscripts.csphagen.csphagen._src_reg, cscripts.csphagen.csphagen._srcname, cscripts.cslightcrv.cslightcrv._srcname, ctobservation.obs(), cscripts.csobsdef.csobsdef.obs(), and cscripts.csiactobs.csiactobs.obs().

Referenced by cscript_base.cscript_base.process(), cscript_like.cscript_like.process(), cscript_obs.cscript_obs.process(), cscripts.cstsmapsplit.cstsmapsplit.process(), cscripts.csresmap.csresmap.process(), cscripts.cstsmapmerge.cstsmapmerge.process(), cscripts.csworkflow.csworkflow.process(), cscripts.cstsdist.cstsdist.process(), cscripts.cssrcdetect.cssrcdetect.process(), cscripts.cspull.cspull.process(), cscripts.csphasecrv.csphasecrv.process(), cscripts.csviscube.csviscube.process(), cscripts.csresspec.csresspec.process(), cscripts.csscs.csscs.process(), cscripts.csphagen.csphagen.process(), cscripts.cssens.cssens.process(), cscripts.csspec.csspec.process(), and cscripts.csroot2caldb.csroot2caldb.process().

def cscripts.csphagen.csphagen._get_parameters_bkgmethod (   self)
private
def cscripts.csphagen.csphagen._get_parameters_bkgmethod_custom (   self)
private
def cscripts.csphagen.csphagen._get_parameters_bkgmethod_off (   self)
private
Get parameters for OFF background method

Raises
------
RuntimeError
    On and Off observations must have same size
RuntimeError
    Off observations must be event lists

Definition at line 299 of file csphagen.py.

References cscripts.csphagen.csphagen._get_source_parameters(), ctobservation.obs(), cscripts.csobsdef.csobsdef.obs(), cscripts.csiactobs.csiactobs.obs(), and cscripts.csphagen.csphagen.obs_off().

Referenced by cscripts.csphagen.csphagen._get_parameters_bkgmethod().

def cscripts.csphagen.csphagen._get_parameters_bkgmethod_reflected (   self)
private
Get parameters for REFLECTED background method

Definition at line 245 of file csphagen.py.

References cscripts.csphagen.csphagen._get_source_parameters().

Referenced by cscripts.csphagen.csphagen._get_parameters_bkgmethod().

def cscripts.csphagen.csphagen._get_regions (   self,
  filename 
)
private
Get regions from DS9 file or FITS file

Parameters
----------
filename : `~gammalib.GFilename`
    Filename

Returns
-------
regs : `~gammalib.GSkyRegions`
    Region container

Definition at line 183 of file csphagen.py.

Referenced by cscripts.csphagen.csphagen._get_parameters_bkgmethod_custom().

def cscripts.csphagen.csphagen._instrument_regions (   self,
  obs,
  obs_off 
)
private
Compute background regions for Off observation

Calculate background region in Off observation that corresponds to the
source region in the On observation in instrument coordinates

Parameters
----------
obs : `~gammalib.GCTAObservation()`
    On CTA observation
obs_off : `~gammalib.GCTAObservation()`
    Off CTA observation

Returns
-------
regions : `~gammalib.GSkyRegions`
    Container with background region

Definition at line 625 of file csphagen.py.

References cscripts.csphagen.csphagen._has_exclusion, cscripts.csphagen.csphagen._rad, cscripts.csphagen.csphagen._reg_height, cscripts.csphagen.csphagen._reg_posang, cscripts.csphagen.csphagen._reg_width, cscripts.csphagen.csphagen._src_dir, and cscripts.csphagen.csphagen._srcshape.

Referenced by cscripts.csphagen.csphagen._set_background_regions().

def cscripts.csphagen.csphagen._query_src_direction (   self)
private
def cscripts.csphagen.csphagen._reflected_regions (   self,
  obs 
)
private
Calculate list of reflected regions for a single observation (pointing)

Parameters
----------
obs : `~gammalib.GCTAObservation()`
    CTA observation

Returns
-------
regions : `~gammalib.GSkyRegions`
    List of reflected regions

Definition at line 514 of file csphagen.py.

References cscripts.csphagen.csphagen._compute_region_separation(), cscripts.csphagen.csphagen._has_exclusion, cscripts.csphagen.csphagen._rad, cscripts.csphagen.csphagen._reg_height, cscripts.csphagen.csphagen._reg_posang, cscripts.csphagen.csphagen._reg_width, cscripts.csphagen.csphagen._src_dir, and cscripts.csphagen.csphagen._srcshape.

Referenced by cscripts.csphagen.csphagen._set_background_regions().

def cscripts.csphagen.csphagen._set_background_regions (   self,
  obs,
  obs_off = None 
)
private
Set background regions for an observation

Parameters
----------
obs : `~gammalib.GCTAObservation()`
    CTA observation

Returns
-------
regions : `~gammalib.GSkyRegions()`
    Background regions

Definition at line 843 of file csphagen.py.

References cscripts.csphagen.csphagen._instrument_regions(), and cscripts.csphagen.csphagen._reflected_regions().

Referenced by cscripts.csphagen.csphagen._process_observation().

def cscripts.csphagen.csphagen._set_models (   self,
  results 
)
private
Set models for On/Off fitting

The method does the following
- append "OnOff" to the instrument name of all background models
- fix all spatial and temporal parameters

Parameters
----------
results : list of dict
    Result dictionaries

Returns
-------
models : `~gammalib.GModels()`
    Model container

Definition at line 683 of file csphagen.py.

References cscripts.csbkgmodel.csbkgmodel._models, cscripts.csmodelselect.csmodelselect._models, cscripts.csmodelmerge.csmodelmerge._models, cscripts.csmodelinfo.csmodelinfo._models, cscripts.csphagen.csphagen._models, cscripts.csiactobs.csiactobs._models, and cscripts.csmodelsois.csmodelsois._models.

Referenced by cscripts.csphagen.csphagen.process().

def cscripts.csphagen.csphagen._set_statistic (   self,
  obs 
)
private
Set statistic for observation

If the "use_model_bkg" is true then set statistic to "cstat",
otherwise set it to "wstat"

Parameters
----------
obs : `~gammalib.GObservation()`
    Observation

Returns
-------
obs : `~gammalib.GObservation()`
    Observation

Definition at line 780 of file csphagen.py.

Referenced by cscripts.csphagen.csphagen._unpack_result(), and cscripts.csphagen.csphagen.process().

def cscripts.csphagen.csphagen._unpack_result (   self,
  outobs,
  result 
)
private
Unpack result from calculation of On/Off regions

Parameters
----------
outobs : `~gammalib.GObservations`
    Observation container
result : dict
    On/Off spectra, background regions, observation id

Returns
-------
outobs : `~gammalib.GObservations`
    Observation container with result appended

Definition at line 971 of file csphagen.py.

References cscripts.csphagen.csphagen._set_statistic().

Referenced by cscripts.csphagen.csphagen.process().

def cscripts.csphagen.csphagen.exclusion_map (   self,
  object = None 
)
Return and optionally set the exclusion regions map

Parameters
----------
object : `~gammalib.GSkyRegion` or `~gammalib.GSkyMap` or `~gammalib.GFilename`
    Exclusion regions object

Returns
-------
region : `~gammalib.GSkyRegionMap`
    Exclusion regions map

Definition at line 1182 of file csphagen.py.

References cscripts.csphagen.csphagen._excl_reg.

def cscripts.csphagen.csphagen.obs_off (   self,
  obs = None 
)
Return and optionally set the Off observations

Parameters
----------
obs : `~gammalib.GCTAObservations`
    Off observations container

Returns
-------
observation container : `~gammalib.GCTAObservations`
    Off observations container

Definition at line 1203 of file csphagen.py.

References cscripts.csphagen.csphagen._obs_off.

Referenced by cscripts.csphagen.csphagen._get_parameters_bkgmethod_off(), cscripts.csphagen.csphagen._process_observation(), and cscripts.csphagen.csphagen.process().

def cscripts.csphagen.csphagen.process (   self)
Process the script

Definition at line 1008 of file csphagen.py.

References cscripts.csphagen.csphagen._bkg_regs, cscripts.csphagen.csphagen._etrue_ebounds(), cscripts.csphagen.csphagen._etruebounds, cscripts.csobsselect.csobsselect._get_parameters(), cscripts.csadd2caldb.csadd2caldb._get_parameters(), cscripts.csebins.csebins._get_parameters(), cscripts.csmodelselect.csmodelselect._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.cscaldb.cscaldb._get_parameters(), cscripts.csmodelsois.csmodelsois._get_parameters(), cscripts.csobs2caldb.csobs2caldb._get_parameters(), cscripts.csbkgmodel.csbkgmodel._get_parameters(), cscripts.csfootprint.csfootprint._get_parameters(), cscripts.csiactobs.csiactobs._get_parameters(), cscripts.csobsdef.csobsdef._get_parameters(), cscripts.cslightcrv.cslightcrv._get_parameters(), cscripts.csphagen.csphagen._get_parameters(), cscripts.csphagen.csphagen._nthreads, cscripts.cslightcrv.cslightcrv._nthreads, cscripts.csphagen.csphagen._obs_off, cscripts.csphagen.csphagen._process_observation(), cscripts.csphagen.csphagen._set_models(), cscripts.csphagen.csphagen._set_statistic(), cscripts.csphagen.csphagen._unpack_result(), ctobservation.obs(), cscripts.csobsdef.csobsdef.obs(), cscripts.csiactobs.csiactobs.obs(), and cscripts.csphagen.csphagen.obs_off().

def cscripts.csphagen.csphagen.save (   self)

Member Data Documentation


The documentation for this class was generated from the following file: