ctools
2.0.0
|
Public Member Functions | |
def | __init__ |
def | __getstate__ |
def | __setstate__ |
def | process |
def | save |
def | sensitivity |
Private Member Functions | |
def | _get_parameters |
def | _median |
def | _set_source |
def | _set_obs |
def | _set_obs_ebounds |
def | _get_crab_flux |
def | _get_sensitivity |
def | _set_src_prefactor |
def | _simulate_events |
def | _sim_evt_excess |
def | _predict_flux |
def | _e_bin |
def | _create_fits |
Private Attributes | |
_ebounds | |
_obs_ebounds | |
_fits | |
_srcname | |
_ra | |
_dec | |
_log_clients | |
_models | |
_seed | |
_nthreads | |
Computes the CTA sensitivity This class computes the CTA sensitivity for a number of energy bins using ctlike. Spectra are fitted in narrow energy bins to simulated data, and the flux level is determined that leads to a particular significance. The significance is determined using the Test Statistic, defined as twice the likelihood difference between fitting with and without the test source.
def cscripts.cssens.cssens.__init__ | ( | self, | |
argv | |||
) |
def cscripts.cssens.cssens.__getstate__ | ( | self | ) |
Extend ctools.csobservation getstate method to include some members Returns ------- state : dict Pickled instance
Definition at line 69 of file cssens.py.
References cscripts.csfindobs.csfindobs._dec, cscripts.cssens.cssens._dec, cscripts.csebins.csebins._ebounds, cscripts.csphagen.csphagen._ebounds, cscripts.csobsinfo.csobsinfo._ebounds, cscripts.csiactobs.csiactobs._ebounds, cscripts.cssens.cssens._ebounds, cscripts.cspull.cspull._fits, cscripts.csresspec.csresspec._fits, cscripts.csscs.csscs._fits, cscripts.cssens.cssens._fits, cscripts.csphasecrv.csphasecrv._fits, cscripts.cslightcrv.cslightcrv._fits, cscripts.cssens.cssens._log_clients, cscripts.csbkgmodel.csbkgmodel._models, cscripts.csmodelselect.csmodelselect._models, cscripts.csmodelmerge.csmodelmerge._models, cscripts.csmodelinfo.csmodelinfo._models, cscripts.csphagen.csphagen._models, cscripts.csiactobs.csiactobs._models, cscripts.csmodelsois.csmodelsois._models, cscripts.cssens.cssens._models, cscripts.cspull.cspull._nthreads, cscripts.csscs.csscs._nthreads, cscripts.csphagen.csphagen._nthreads, cscripts.cssens.cssens._nthreads, cscripts.csphasecrv.csphasecrv._nthreads, cscripts.cslightcrv.cslightcrv._nthreads, cscripts.cssens.cssens._obs_ebounds, cscripts.csfindobs.csfindobs._ra, cscripts.cssens.cssens._ra, cscripts.cssens.cssens._seed, cscripts.csphagen.csphagen._srcname, cscripts.cssens.cssens._srcname, cscripts.csphasecrv.csphasecrv._srcname, and cscripts.cslightcrv.cslightcrv._srcname.
def cscripts.cssens.cssens.__setstate__ | ( | self, | |
state | |||
) |
Extend ctools.csobservation setstate method to include some members Parameters ---------- state : dict Pickled instance
Definition at line 94 of file cssens.py.
References cscripts.csfindobs.csfindobs._dec, cscripts.cssens.cssens._dec, cscripts.csebins.csebins._ebounds, cscripts.csphagen.csphagen._ebounds, cscripts.csobsinfo.csobsinfo._ebounds, cscripts.csiactobs.csiactobs._ebounds, cscripts.cssens.cssens._ebounds, cscripts.cspull.cspull._fits, cscripts.csresspec.csresspec._fits, cscripts.csscs.csscs._fits, cscripts.cssens.cssens._fits, cscripts.csphasecrv.csphasecrv._fits, cscripts.cslightcrv.cslightcrv._fits, cscripts.cssens.cssens._log_clients, cscripts.csbkgmodel.csbkgmodel._models, cscripts.csmodelselect.csmodelselect._models, cscripts.csmodelmerge.csmodelmerge._models, cscripts.csmodelinfo.csmodelinfo._models, cscripts.csphagen.csphagen._models, cscripts.csiactobs.csiactobs._models, cscripts.csmodelsois.csmodelsois._models, cscripts.cssens.cssens._models, cscripts.cspull.cspull._nthreads, cscripts.csscs.csscs._nthreads, cscripts.csphagen.csphagen._nthreads, cscripts.cssens.cssens._nthreads, cscripts.csphasecrv.csphasecrv._nthreads, cscripts.cslightcrv.cslightcrv._nthreads, cscripts.cssens.cssens._obs_ebounds, cscripts.csfindobs.csfindobs._ra, cscripts.cssens.cssens._ra, cscripts.cssens.cssens._seed, cscripts.csphagen.csphagen._srcname, cscripts.cssens.cssens._srcname, cscripts.csphasecrv.csphasecrv._srcname, and cscripts.cslightcrv.cslightcrv._srcname.
|
private |
Create FITS file from results Parameters ---------- results : list of dict List of result dictionaries
Definition at line 1027 of file cssens.py.
References cscripts.cspull.cspull._fits, cscripts.csresspec.csresspec._fits, cscripts.csscs.csscs._fits, cscripts.cssens.cssens._fits, cscripts.csphasecrv.csphasecrv._fits, cscripts.cslightcrv.cslightcrv._fits, cscripts.csphagen.csphagen._srcname, cscripts.cssens.cssens._srcname, cscripts.csphasecrv.csphasecrv._srcname, and cscripts.cslightcrv.cslightcrv._srcname.
Referenced by cscripts.cstsdist.cstsdist.process(), cscripts.cssens.cssens.process(), and cscripts.csspec.csspec.process().
|
private |
Determines sensivity in energy bin Parameters ---------- ieng : int Energy bin number Returns ------- result : dict Result dictionary
Definition at line 991 of file cssens.py.
References cscripts.cssens.cssens._get_sensitivity(), 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, and cscripts.cssens.cssens._models.
Referenced by cscripts.cssens.cssens.process().
|
private |
Return Crab photon flux in a given energy interval Parameters ---------- emin : `~gammalib.GEnergy` Minimum energy emax : `~gammalib.GEnergy` Maximum energy Returns ------- flux : float Crab photon flux in specified energy interval (ph/cm2/s)
Definition at line 357 of file cssens.py.
Referenced by cscripts.cssens.cssens._get_sensitivity().
|
private |
Get user parameters from parfile
Definition at line 120 of file cssens.py.
References cscripts.csebins.csebins._ebounds, cscripts.csphagen.csphagen._ebounds, cscripts.csobsinfo.csobsinfo._ebounds, cscripts.csiactobs.csiactobs._ebounds, cscripts.cssens.cssens._ebounds, cscripts.cspull.cspull._nthreads, cscripts.csscs.csscs._nthreads, cscripts.csphagen.csphagen._nthreads, cscripts.cssens.cssens._nthreads, cscripts.csphasecrv.csphasecrv._nthreads, cscripts.cslightcrv.cslightcrv._nthreads, cscripts.cssens.cssens._seed, cscripts.cssens.cssens._set_obs(), cscripts.cssens.cssens._set_source(), 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.cstsmapmerge.cstsmapmerge.process(), cscripts.csworkflow.csworkflow.process(), cscripts.cstsdist.cstsdist.process(), cscripts.cssrcdetect.cssrcdetect.process(), cscripts.csviscube.csviscube.process(), cscripts.cssens.cssens.process(), and cscripts.csspec.csspec.process().
|
private |
Determine sensitivity for given observations Parameters ---------- emin : `~gammalib.GEnergy` Minimum energy for fitting and flux computation emax : `~gammalib.GEnergy` Maximum energy for fitting and flux computation test_model : `~gammalib.GModels` Test source model Returns ------- result : dict Result dictionary
Definition at line 383 of file cssens.py.
References cscripts.cssens.cssens._get_crab_flux(), cscripts.cssens.cssens._log_clients, cscripts.cssens.cssens._obs_ebounds, cscripts.cssens.cssens._predict_flux(), cscripts.cssens.cssens._seed, cscripts.cssens.cssens._set_obs_ebounds(), cscripts.cssens.cssens._set_src_prefactor(), cscripts.cssens.cssens._sim_evt_excess(), cscripts.csphagen.csphagen._srcname, cscripts.cssens.cssens._srcname, cscripts.csphasecrv.csphasecrv._srcname, cscripts.cslightcrv.cslightcrv._srcname, ctobservation.obs(), cscripts.csobsdef.csobsdef.obs(), and cscripts.csiactobs.csiactobs.obs().
Referenced by cscripts.cssens.cssens._e_bin().
|
private |
Compute median value for an array Parameters ---------- array : list of floats Array Returns ------- median : float Median value of array
Definition at line 178 of file cssens.py.
Referenced by cscripts.cssens.cssens._simulate_events().
|
private |
Predict Crab flux for a given TS value The Crab flux at a given Test Statistic value is predicted by doing a linear regression of the log(TS) and log(crab_flux) values in a results list. See https://en.wikipedia.org/wiki/Simple_linear_regression Parameters ---------- results : list of dict List of results ts : float Test Statistic value Returns ------- crab_flux_prediction, regcoeff : tuple of float Predicted Crab flux and regression coefficient
Definition at line 919 of file cssens.py.
Referenced by cscripts.cssens.cssens._get_sensitivity().
|
private |
Set an observation container Parameters ---------- emin : float Minimum energy (TeV) emax : float Maximum energy (TeV) Returns ------- obs : `~gammalib.GObservations` Observation container
Definition at line 240 of file cssens.py.
Referenced by cscripts.cssens.cssens._get_parameters().
|
private |
Set energy boundaries for all observations in container Parameters ---------- emin : `~gammalib.GEnergy` Minimum energy emax : `~gammalib.GEnergy` Maximum energy
Definition at line 307 of file cssens.py.
References cscripts.cssens.cssens._obs_ebounds, ctobservation.obs(), cscripts.csobsdef.csobsdef.obs(), and cscripts.csiactobs.csiactobs.obs().
Referenced by cscripts.cssens.cssens._get_sensitivity().
|
private |
Set source name and position
Definition at line 213 of file cssens.py.
References cscripts.csfindobs.csfindobs._dec, cscripts.cssens.cssens._dec, cscripts.csfindobs.csfindobs._ra, cscripts.cssens.cssens._ra, cscripts.csphagen.csphagen._srcname, cscripts.cssens.cssens._srcname, cscripts.csphasecrv.csphasecrv._srcname, cscripts.cslightcrv.cslightcrv._srcname, ctobservation.obs(), cscripts.csobsdef.csobsdef.obs(), and cscripts.csiactobs.csiactobs.obs().
Referenced by cscripts.cssens.cssens._get_parameters().
|
private |
Create a copy of the test models, set the normalisation parameter of the test source in the models, and append the models to the observation. Parameters ---------- test_model : `~gammalib.GModels` Test source model crab_unit : float Crab unit factor test_crab_flux : float Test flux in Crab units (100 mCrab) Returns ------- crab_prefactor : float the prefactor that corresponds to a flux of 1 Crab.
Definition at line 724 of file cssens.py.
References cscripts.csphagen.csphagen._srcname, cscripts.cssens.cssens._srcname, cscripts.csphasecrv.csphasecrv._srcname, cscripts.cslightcrv.cslightcrv._srcname, ctobservation.obs(), cscripts.csobsdef.csobsdef.obs(), and cscripts.csiactobs.csiactobs.obs().
Referenced by cscripts.cssens.cssens._get_sensitivity().
|
private |
Return the number of excess events for the source model, compared to all other models Parameters ---------- enumbins : int Number of bins for the observation simulation binsz : float Bin size for the observation simulation npix : int Pixel size for the observation simulation n_bck_evts : int Number of background counts from previous call Returns ------- pass_evt_cut : bool Signals that the source passes the minimal excess criteria n_bck_evts : int Number of background counts
Definition at line 841 of file cssens.py.
References cscripts.cssens.cssens._simulate_events(), cscripts.csphagen.csphagen._srcname, cscripts.cssens.cssens._srcname, cscripts.csphasecrv.csphasecrv._srcname, cscripts.cslightcrv.cslightcrv._srcname, ctobservation.obs(), cscripts.csobsdef.csobsdef.obs(), and cscripts.csiactobs.csiactobs.obs().
Referenced by cscripts.cssens.cssens._get_sensitivity().
|
private |
Simulate events Parameters ---------- obs : `~gammalib.GObservations` Observation container rad : float Simulation selection radius (degrees) enumbins : integer Number of energy bins binsz : float Pixel size npix : integer Number of pixels
Definition at line 778 of file cssens.py.
References cscripts.cssens.cssens._log_clients, cscripts.cssens.cssens._median(), and cscripts.cssens.cssens._seed.
Referenced by cscripts.cssens.cssens._sim_evt_excess().
def cscripts.cssens.cssens.process | ( | self | ) |
Process the script
Definition at line 1115 of file cssens.py.
References cscripts.csphasecrv.csphasecrv._create_fits(), cscripts.cspull.cspull._create_fits(), cscripts.cssens.cssens._create_fits(), cscripts.csfindobs.csfindobs._dec, cscripts.cssens.cssens._dec, cscripts.cssens.cssens._e_bin(), 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.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.cssens.cssens._get_parameters(), cscripts.csphasecrv.csphasecrv._get_parameters(), cscripts.cslightcrv.cslightcrv._get_parameters(), cscripts.csscs.csscs._get_parameters(), cscripts.csphagen.csphagen._get_parameters(), 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.cssens.cssens._models, cscripts.cspull.cspull._nthreads, cscripts.csscs.csscs._nthreads, cscripts.csphagen.csphagen._nthreads, cscripts.cssens.cssens._nthreads, cscripts.csphasecrv.csphasecrv._nthreads, cscripts.cslightcrv.cslightcrv._nthreads, cscripts.csfindobs.csfindobs._ra, cscripts.cssens.cssens._ra, cscripts.csphagen.csphagen._srcname, cscripts.cssens.cssens._srcname, cscripts.csphasecrv.csphasecrv._srcname, cscripts.cslightcrv.cslightcrv._srcname, ctobservation.obs(), cscripts.csobsdef.csobsdef.obs(), and cscripts.csiactobs.csiactobs.obs().
def cscripts.cssens.cssens.save | ( | self | ) |
Save sensitivity FITS file
Definition at line 1177 of file cssens.py.
References cscripts.cspull.cspull._fits, cscripts.csresspec.csresspec._fits, cscripts.csscs.csscs._fits, cscripts.cssens.cssens._fits, cscripts.csphasecrv.csphasecrv._fits, and cscripts.cslightcrv.cslightcrv._fits.
def cscripts.cssens.cssens.sensitivity | ( | self | ) |
Return sensitivity FITS file Returns: FITS file containing sensitivity curve
Definition at line 1199 of file cssens.py.
References cscripts.cspull.cspull._fits, cscripts.csresspec.csresspec._fits, cscripts.csscs.csscs._fits, cscripts.cssens.cssens._fits, cscripts.csphasecrv.csphasecrv._fits, and cscripts.cslightcrv.cslightcrv._fits.
|
private |
Definition at line 59 of file cssens.py.
Referenced by cscripts.cssens.cssens.__getstate__(), cscripts.cssens.cssens.__setstate__(), cscripts.cssens.cssens._set_source(), and cscripts.cssens.cssens.process().
|
private |
Definition at line 54 of file cssens.py.
Referenced by cscripts.csspec.csspec.__getstate__(), cscripts.cssens.cssens.__getstate__(), cscripts.csspec.csspec.__setstate__(), cscripts.cssens.cssens.__setstate__(), cscripts.csspec.csspec._fit_energy_bins(), cscripts.cssens.cssens._get_parameters(), cscripts.csspec.csspec._set_ebounds(), and cscripts.csspec.csspec._set_replace_src_spectrum_by_bins().
|
private |
Definition at line 56 of file cssens.py.
Referenced by cscripts.cstsdist.cstsdist.__getstate__(), cscripts.csspec.csspec.__getstate__(), cscripts.cssens.cssens.__getstate__(), cscripts.cstsdist.cstsdist.__setstate__(), cscripts.csspec.csspec.__setstate__(), cscripts.cssens.cssens.__setstate__(), cscripts.cstsdist.cstsdist._create_fits(), cscripts.cssens.cssens._create_fits(), cscripts.csspec.csspec._create_fits(), cscripts.csspec.csspec.publish(), cscripts.cstsdist.cstsdist.save(), cscripts.cssens.cssens.save(), cscripts.csspec.csspec.save(), cscripts.cssens.cssens.sensitivity(), cscripts.csspec.csspec.spectrum(), and cscripts.cstsdist.cstsdist.ts_distribution().
|
private |
Definition at line 60 of file cssens.py.
Referenced by cscripts.cstsdist.cstsdist.__getstate__(), cscripts.cssens.cssens.__getstate__(), cscripts.cstsdist.cstsdist.__setstate__(), cscripts.cssens.cssens.__setstate__(), cscripts.cssens.cssens._get_sensitivity(), cscripts.cstsdist.cstsdist._sim(), and cscripts.cssens.cssens._simulate_events().
|
private |
Definition at line 61 of file cssens.py.
Referenced by cscripts.cssens.cssens.__getstate__(), cscripts.cssens.cssens.__setstate__(), cscripts.cssens.cssens._e_bin(), cscripts.cssrcdetect.cssrcdetect.models(), cscripts.cssrcdetect.cssrcdetect.process(), cscripts.cssens.cssens.process(), and cscripts.cssrcdetect.cssrcdetect.save().
|
private |
Definition at line 63 of file cssens.py.
Referenced by cscripts.cstsdist.cstsdist.__getstate__(), cscripts.csspec.csspec.__getstate__(), cscripts.cssens.cssens.__getstate__(), cscripts.cstsdist.cstsdist.__setstate__(), cscripts.csspec.csspec.__setstate__(), cscripts.cssens.cssens.__setstate__(), cscripts.csspec.csspec._fit_energy_bins(), cscripts.cstsdist.cstsdist._get_parameters(), cscripts.csspec.csspec._get_parameters(), cscripts.cssens.cssens._get_parameters(), cscripts.cstsdist.cstsdist.process(), and cscripts.cssens.cssens.process().
|
private |
Definition at line 55 of file cssens.py.
Referenced by cscripts.cssens.cssens.__getstate__(), cscripts.cssens.cssens.__setstate__(), cscripts.cssens.cssens._get_sensitivity(), and cscripts.cssens.cssens._set_obs_ebounds().
|
private |
Definition at line 58 of file cssens.py.
Referenced by cscripts.cssens.cssens.__getstate__(), cscripts.cssens.cssens.__setstate__(), cscripts.cssens.cssens._set_source(), and cscripts.cssens.cssens.process().
|
private |
Definition at line 62 of file cssens.py.
Referenced by cscripts.cssens.cssens.__getstate__(), cscripts.cssens.cssens.__setstate__(), cscripts.cssens.cssens._get_parameters(), cscripts.cssens.cssens._get_sensitivity(), and cscripts.cssens.cssens._simulate_events().
|
private |
Definition at line 57 of file cssens.py.
Referenced by cscripts.cstsdist.cstsdist.__getstate__(), cscripts.cssens.cssens.__getstate__(), cscripts.cstsdist.cstsdist.__setstate__(), cscripts.cssens.cssens.__setstate__(), cscripts.cstsmapsplit.cstsmapsplit._compute_null_hypothesis(), cscripts.cssens.cssens._create_fits(), cscripts.cstsmapsplit.cstsmapsplit._get_parameters(), cscripts.cstsdist.cstsdist._get_parameters(), cscripts.cssens.cssens._get_sensitivity(), cscripts.cssens.cssens._set_source(), cscripts.cssens.cssens._set_src_prefactor(), cscripts.cssens.cssens._sim_evt_excess(), cscripts.cstsdist.cstsdist._trial(), cscripts.cstsmapsplit.cstsmapsplit.process(), cscripts.cstsdist.cstsdist.process(), and cscripts.cssens.cssens.process().