Commit 2fbb3e3a560f824732e813e34c9ae58ed6154087
1 parent
ea01af0f
Changed 'raise gammalib.GException' to 'raise RuntimeError' in all occurences in cscripts
Showing
6 changed files
with
11 additions
and
8 deletions
ChangeLog
| 1 | -2015-12-16 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> | |
| 1 | +2015-12-17 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> | |
| 2 | 2 | |
| 3 | 3 | * Version 1.0.0 released |
| 4 | 4 | ======================== |
| 5 | 5 | |
| 6 | 6 | Update end-user documentation |
| 7 | + Change GException to RuntimeError in cscripts (#1604) | |
| 7 | 8 | Adapt to GammaLib interface changs (#1603) |
| 8 | 9 | Implement handling of stacked data in csspec (#1566) |
| 9 | 10 | Resolve Python test problem on El Capitan (#1563) | ... | ... |
NEWS
| ... | ... | @@ -2,7 +2,7 @@ New Features and Important Changes in ctools 1.0.0 |
| 2 | 2 | |
| 3 | 3 | Author(s) : Juergen Knoedlseder |
| 4 | 4 | |
| 5 | -16 December 2015 | |
| 5 | +17 December 2015 | |
| 6 | 6 | |
| 7 | 7 | |
| 8 | 8 | 1. Introduction |
| ... | ... | @@ -111,6 +111,9 @@ requested energy binning, it selects for each spectral energy bin the |
| 111 | 111 | relevant energy bins from the counts cube and performs a maximum likelihood |
| 112 | 112 | analysis. |
| 113 | 113 | |
| 114 | +All GExceptions are replaced by Python RuntimeErrors as the GException | |
| 115 | +classes are not exposed to Python. | |
| 116 | + | |
| 114 | 117 | |
| 115 | 118 | 20. Examples |
| 116 | 119 | ------------ | ... | ... |
cscripts/csobsdef.py
| ... | ... | @@ -249,8 +249,7 @@ class csobsdef(ctools.cscript): |
| 249 | 249 | pntdir = gammalib.GSkyDir() |
| 250 | 250 | pntdir.lb_deg(lon,lat) |
| 251 | 251 | else: |
| 252 | - raise gammalib.GException.invalid_value(self.name, | |
| 253 | - "No (ra,dec) or (lon,lat) columns found in pointing" | |
| 252 | + raise RuntimeError("No (ra,dec) or (lon,lat) columns found in pointing" | |
| 254 | 253 | " definition file.") |
| 255 | 254 | obs.pointing(gammalib.GCTAPointing(pntdir)) |
| 256 | 255 | ... | ... |
cscripts/cssens.py
| ... | ... | @@ -241,7 +241,7 @@ class cssens(ctools.cscript): |
| 241 | 241 | else: |
| 242 | 242 | msg = "Invalid sensitivity type \""+self.m_type+"\" encountered."+ \ |
| 243 | 243 | " Either use \"Differential\" or \"Integral\"." |
| 244 | - raise gammalib.GException.invalid_value("cssens", msg) | |
| 244 | + raise RuntimeError(msg) | |
| 245 | 245 | |
| 246 | 246 | # Determine sensitivity |
| 247 | 247 | result = self.get_sensitivity(self.obs, emin, emax, |
| ... | ... | @@ -347,7 +347,7 @@ class cssens(ctools.cscript): |
| 347 | 347 | if not model.has_par("Prefactor"): |
| 348 | 348 | msg = "Model \""+self.m_srcname+"\" has no parameter \"Prefactor\"."+ \ |
| 349 | 349 | " Only spectral models with a \"Prefactor\" parameter are supported." |
| 350 | - raise gammalib.GException.invalid_value("cssens", msg) | |
| 350 | + raise RuntimeError(msg) | |
| 351 | 351 | |
| 352 | 352 | # Set source position |
| 353 | 353 | if self.m_ra != None and self.m_dec != None: | ... | ... |
cscripts/csspec.py
| ... | ... | @@ -206,7 +206,7 @@ class csspec(ctools.cscript): |
| 206 | 206 | "cube does not overlap with specified energy range ["+ \ |
| 207 | 207 | str(emin)+", "+str(emax)+"]. Specify "+ \ |
| 208 | 208 | "overlapping energy range." |
| 209 | - raise gammalib.GException.invalid_argument("csspec", msg) | |
| 209 | + raise RuntimeError(msg) | |
| 210 | 210 | |
| 211 | 211 | # Determine number of layers to use for each spectral bin |
| 212 | 212 | n_layers = int(len(use_layers) / self.m_enumbins) | ... | ... |
cscripts/cstsdist.py
| ... | ... | @@ -275,7 +275,7 @@ class cstsdist(ctools.cscript): |
| 275 | 275 | if not model.has_par("Prefactor"): |
| 276 | 276 | msg = "Model \""+self.m_srcname+"\" has no parameter \"Prefactor\"."+ \ |
| 277 | 277 | " Only spectral models with a \"Prefactor\" parameter are supported." |
| 278 | - raise gammalib.GException.invalid_value("cssens", msg) | |
| 278 | + raise RuntimeError(msg) | |
| 279 | 279 | |
| 280 | 280 | # Fit or fix spatial parameters |
| 281 | 281 | if fitpos: | ... | ... |