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

Public Member Functions

def __init__
 
def process
 
def save
 
def resspec
 

Private Member Functions

def _get_parameters
 
def _bin_evlist
 
def _masked_cube
 
def _cube_to_spectrum
 
def _residuals_table
 
def _append_column
 
def _results2table
 
def _stack_results
 
def _residuals_3D
 
def _residuals_OnOff
 

Private Attributes

 _use_maps
 
 _stack
 
 _mask
 
 _fits
 

Detailed Description

Generates a residual spectrum

Definition at line 30 of file csresspec.py.

Constructor & Destructor Documentation

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

Definition at line 35 of file csresspec.py.

Member Function Documentation

def cscripts.csresspec.csresspec._append_column (   self,
  table,
  name,
  data 
)
private
Append optional column to residual table

Parameters
----------
table : `~gammalib.GFitsBinTable'
    FITS binary table
name : str
    Column name
data : float
    Data to be filled into new column

Returns
-------
table : `~gammalib.GFitsBinTable'
    FITS binary table

Definition at line 413 of file csresspec.py.

Referenced by cscripts.csresspec.csresspec._results2table().

def cscripts.csresspec.csresspec._bin_evlist (   self,
  obs 
)
private
Turn single event list into counts cube

Parameters
----------
obs : `~gammalib.GObservations`
    Observation container with single event list

Returns
-------
obs, info : `~gammalib.GObservations`, dict
    Binned observation container and dictionary with event list ROI
    and energy range information

Definition at line 183 of file csresspec.py.

References cscripts.csresspec.csresspec._masked_cube().

Referenced by cscripts.csresspec.csresspec._residuals_3D().

def cscripts.csresspec.csresspec._cube_to_spectrum (   self,
  cube,
  evlist_info 
)
private
Derive from event cube a count spectrum

If data come from event list use only the ROI and energy range of
the original data. Apply user defined mask if requested.

Parameters
----------
cube : `~gammalib.GCTAEventCube`
    Event cube
evlist_info : dict
    Dictionary with information on original event list

Returns
-------
array : `~gammalib.GNdarray'
    Counts spectrum

Definition at line 303 of file csresspec.py.

References cscripts.csresspec.csresspec._mask, and cscripts.csresspec.csresspec._masked_cube().

Referenced by cscripts.csresspec.csresspec._residuals_3D().

def cscripts.csresspec.csresspec._masked_cube (   self,
  cube,
  ra,
  dec,
  rad,
  emin = 'INDEF',
  emax = 'INDEF',
  regfile = 'NONE' 
)
private
Mask an event cube and returns the masked cube

Parameters
----------
cube : `~gammalib.GCTAEventCube`
    Event cube
ra : float (str 'INDEF' for no selection on direction)
    Right Ascension (deg)
dec : float (str 'INDEF' for no selection on direction)
    Declination (deg)
rad : float (str 'INDEF' for no selection on direction)
    Radius (deg)
emin : float (str 'INDEF' for no selection on energy)
    Minimum energy (TeV)
emax : float (str 'INDEF' for no selection on energy)
    Maximum energy (TeV)

Returns
-------
cube : `~gammalib.GCTAEventCube`
    Event cube

Definition at line 256 of file csresspec.py.

Referenced by cscripts.csresspec.csresspec._bin_evlist(), and cscripts.csresspec.csresspec._cube_to_spectrum().

def cscripts.csresspec.csresspec._residuals_3D (   self,
  obs,
  models,
  obs_id,
  ccube = None 
)
private
Calculate residuals for 3D observation

Parameters
----------
obs : `~gammalib.GCTAObservation`
    CTA observation
models : `~gammalib.GModels`
    Models
obs_id : str
    Observation ID
ccube : `~gammalib.GCTAEventCube', optional
    Count cube with stacked events lists

Returns
-------
result : dict
    Residual result dictionary

Definition at line 539 of file csresspec.py.

References cscripts.csresspec.csresspec._bin_evlist(), cscripts.csresspec.csresspec._cube_to_spectrum(), cscripts.csresspec.csresspec._use_maps, and cscripts.csresmap.csresmap._use_maps.

Referenced by cscripts.csresspec.csresspec.process().

def cscripts.csresspec.csresspec._residuals_OnOff (   self,
  obs,
  models,
  obs_id 
)
private
Calculate residual for OnOff observation

Parameters
----------
obs : `~gammalib.GOnOffObservation`
    OnOff observation
models : `~gammalib.GModels`
    Models
obs_id : str
    Observation ID

Returns
-------
result : dict
    Residual result dictionary

Definition at line 651 of file csresspec.py.

Referenced by cscripts.csresspec.csresspec.process().

def cscripts.csresspec.csresspec._residuals_table (   self,
  obs_id,
  ebounds,
  counts,
  model,
  residuals 
)
private
Create a Fits Table and store counts, model, and residuals

Parameters
----------
obs_id : str
    Observation id
ebounds : `~gammalib.GEbounds'
    Energy boundaries
counts : `~gammalib.GNdarray'
    Counts spectrum
model : `~gammalib.GNdarray'
    Model spectrum
residuals : `~gammalib.GNdarray'
    Residual spectrum

Returns
-------
table : `~gammalib.GFitsBinTable'
    Residual spectrum as FITS binary table

Definition at line 355 of file csresspec.py.

Referenced by cscripts.csresspec.csresspec._results2table().

def cscripts.csresspec.csresspec._results2table (   self,
  result 
)
private
Turn results into FITS table

Parameters
----------
result : dict
    Result dictionary

Returns
-------
table : `~gammalib.GFitsBinTable`
    FITS binary table

Definition at line 450 of file csresspec.py.

References cscripts.csresspec.csresspec._append_column(), and cscripts.csresspec.csresspec._residuals_table().

Referenced by cscripts.csresspec.csresspec.process().

def cscripts.csresspec.csresspec._stack_results (   self,
  results 
)
private
Stack results

Parameters
----------
results : list of dict
    Residual spectra results

Returns
-------
results : list of dict
    Stacked result

Definition at line 496 of file csresspec.py.

Referenced by cscripts.csresspec.csresspec.process().

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

Definition at line 750 of file csresspec.py.

References cscripts.cspull.cspull._fits, cscripts.csresspec.csresspec._fits, cscripts.csphasecrv.csphasecrv._fits, cscripts.cslightcrv.cslightcrv._fits, cscripts.csobsselect.csobsselect._get_parameters(), cscripts.csadd2caldb.csadd2caldb._get_parameters(), cscripts.csebins.csebins._get_parameters(), cscripts.csmodelselect.csmodelselect._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.cscaldb.cscaldb._get_parameters(), cscripts.csmodelsois.csmodelsois._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.csresspec.csresspec._residuals_3D(), cscripts.csresspec.csresspec._residuals_OnOff(), cscripts.csresspec.csresspec._results2table(), cscripts.csresspec.csresspec._stack, cscripts.csresspec.csresspec._stack_results(), ctobservation.obs(), cscripts.csobsdef.csobsdef.obs(), and cscripts.csiactobs.csiactobs.obs().

def cscripts.csresspec.csresspec.resspec (   self)
Return residual FITS file

Returns
-------
fits : `~gammalib.GFits'
    FITS file containing residuals

Definition at line 830 of file csresspec.py.

References cscripts.cspull.cspull._fits, cscripts.csresspec.csresspec._fits, cscripts.csphasecrv.csphasecrv._fits, and cscripts.cslightcrv.cslightcrv._fits.

def cscripts.csresspec.csresspec.save (   self)
Save residuals

Definition at line 811 of file csresspec.py.

Member Data Documentation

cscripts.csresspec.csresspec._mask
private
cscripts.csresspec.csresspec._stack
private
cscripts.csresspec.csresspec._use_maps
private

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