Commit d3f2c7540d085d1e95118bbce1d88a942fdf060d
1 parent
8f3a3306
Changed 'raise gammalib.GException' to 'raise RuntimeError' in all occurences in cscripts
Showing
6 changed files
with
9 additions
and
10 deletions
cscripts/csmodelmerge.py
| @@ -121,7 +121,7 @@ class csmodelmerge(ctools.cscript): | @@ -121,7 +121,7 @@ class csmodelmerge(ctools.cscript): | ||
| 121 | msg = "Parameter \"inmodels\" must contain either an @ASCII"+\ | 121 | msg = "Parameter \"inmodels\" must contain either an @ASCII"+\ |
| 122 | " file, a comma-separated or whitespace-separated list"+\ | 122 | " file, a comma-separated or whitespace-separated list"+\ |
| 123 | " of files or a wildcard string" | 123 | " of files or a wildcard string" |
| 124 | - raise gammalib.GException.invalid_argument("csmodelmerge::get_parameters", msg) | 124 | + raise RuntimeError(msg) |
| 125 | 125 | ||
| 126 | # Get output file | 126 | # Get output file |
| 127 | self.outmodel = self["outmodel"].filename() | 127 | self.outmodel = self["outmodel"].filename() |
cscripts/csobsdef.py
| @@ -249,8 +249,7 @@ class csobsdef(ctools.cscript): | @@ -249,8 +249,7 @@ class csobsdef(ctools.cscript): | ||
| 249 | pntdir = gammalib.GSkyDir() | 249 | pntdir = gammalib.GSkyDir() |
| 250 | pntdir.lb_deg(lon,lat) | 250 | pntdir.lb_deg(lon,lat) |
| 251 | else: | 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 | " definition file.") | 253 | " definition file.") |
| 255 | obs.pointing(gammalib.GCTAPointing(pntdir)) | 254 | obs.pointing(gammalib.GCTAPointing(pntdir)) |
| 256 | 255 |
cscripts/cssens.py
| @@ -241,7 +241,7 @@ class cssens(ctools.cscript): | @@ -241,7 +241,7 @@ class cssens(ctools.cscript): | ||
| 241 | else: | 241 | else: |
| 242 | msg = "Invalid sensitivity type \""+self.m_type+"\" encountered."+ \ | 242 | msg = "Invalid sensitivity type \""+self.m_type+"\" encountered."+ \ |
| 243 | " Either use \"Differential\" or \"Integral\"." | 243 | " Either use \"Differential\" or \"Integral\"." |
| 244 | - raise gammalib.GException.invalid_value("cssens", msg) | 244 | + raise RuntimeError(msg) |
| 245 | 245 | ||
| 246 | # Determine sensitivity | 246 | # Determine sensitivity |
| 247 | result = self.get_sensitivity(self.obs, emin, emax, | 247 | result = self.get_sensitivity(self.obs, emin, emax, |
| @@ -347,7 +347,7 @@ class cssens(ctools.cscript): | @@ -347,7 +347,7 @@ class cssens(ctools.cscript): | ||
| 347 | if not model.has_par("Prefactor"): | 347 | if not model.has_par("Prefactor"): |
| 348 | msg = "Model \""+self.m_srcname+"\" has no parameter \"Prefactor\"."+ \ | 348 | msg = "Model \""+self.m_srcname+"\" has no parameter \"Prefactor\"."+ \ |
| 349 | " Only spectral models with a \"Prefactor\" parameter are supported." | 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 | # Set source position | 352 | # Set source position |
| 353 | if self.m_ra != None and self.m_dec != None: | 353 | if self.m_ra != None and self.m_dec != None: |
cscripts/csspec.py
| @@ -206,7 +206,7 @@ class csspec(ctools.cscript): | @@ -206,7 +206,7 @@ class csspec(ctools.cscript): | ||
| 206 | "cube does not overlap with specified energy range ["+ \ | 206 | "cube does not overlap with specified energy range ["+ \ |
| 207 | str(emin)+", "+str(emax)+"]. Specify "+ \ | 207 | str(emin)+", "+str(emax)+"]. Specify "+ \ |
| 208 | "overlapping energy range." | 208 | "overlapping energy range." |
| 209 | - raise gammalib.GException.invalid_argument("csspec", msg) | 209 | + raise RuntimeError(msg) |
| 210 | 210 | ||
| 211 | # Determine number of layers to use for each spectral bin | 211 | # Determine number of layers to use for each spectral bin |
| 212 | n_layers = int(len(use_layers) / self.m_enumbins) | 212 | n_layers = int(len(use_layers) / self.m_enumbins) |
cscripts/cstsdist.py
| @@ -275,7 +275,7 @@ class cstsdist(ctools.cscript): | @@ -275,7 +275,7 @@ class cstsdist(ctools.cscript): | ||
| 275 | if not model.has_par("Prefactor"): | 275 | if not model.has_par("Prefactor"): |
| 276 | msg = "Model \""+self.m_srcname+"\" has no parameter \"Prefactor\"."+ \ | 276 | msg = "Model \""+self.m_srcname+"\" has no parameter \"Prefactor\"."+ \ |
| 277 | " Only spectral models with a \"Prefactor\" parameter are supported." | 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 | # Fit or fix spatial parameters | 280 | # Fit or fix spatial parameters |
| 281 | if fitpos: | 281 | if fitpos: |
cscripts/cstsmapmerge.py
| @@ -123,13 +123,13 @@ class cstsmapmerge(ctools.cscript): | @@ -123,13 +123,13 @@ class cstsmapmerge(ctools.cscript): | ||
| 123 | msg = "Parameter \"inmmaps\" must contain either an @ASCII file,"+\ | 123 | msg = "Parameter \"inmmaps\" must contain either an @ASCII file,"+\ |
| 124 | " a comma-separated or whitespace-separated list of files"+\ | 124 | " a comma-separated or whitespace-separated list of files"+\ |
| 125 | " or a wildcard string" | 125 | " or a wildcard string" |
| 126 | - raise gammalib.GException.invalid_argument("cstsmapmerge::get_parameters", msg) | 126 | + raise RuntimeError(msg) |
| 127 | 127 | ||
| 128 | # Check number of files. We need at least two files. | 128 | # Check number of files. We need at least two files. |
| 129 | if len(self.files) <= 1: | 129 | if len(self.files) <= 1: |
| 130 | msg = "Need at least two files to start merging, "+\ | 130 | msg = "Need at least two files to start merging, "+\ |
| 131 | str(len(self.files))+" files given." | 131 | str(len(self.files))+" files given." |
| 132 | - raise gammalib.GException.invalid_argument("cstsmapmerge::get_parameters", msg) | 132 | + raise RuntimeError(msg) |
| 133 | 133 | ||
| 134 | # Get output file | 134 | # Get output file |
| 135 | self.outmap = self["outmap"].filename() | 135 | self.outmap = self["outmap"].filename() |
| @@ -217,7 +217,7 @@ class cstsmapmerge(ctools.cscript): | @@ -217,7 +217,7 @@ class cstsmapmerge(ctools.cscript): | ||
| 217 | " been merged. File \""+fitsfile+"\" contains"+\ | 217 | " been merged. File \""+fitsfile+"\" contains"+\ |
| 218 | " already merged bins. Set hidden parameter"+\ | 218 | " already merged bins. Set hidden parameter"+\ |
| 219 | " overwrite=yes to avoid this error." | 219 | " overwrite=yes to avoid this error." |
| 220 | - raise gammalib.GException.invalid_value("cstsmapmerge::add", msg) | 220 | + raise RuntimeError(msg) |
| 221 | 221 | ||
| 222 | # Copy TS values | 222 | # Copy TS values |
| 223 | self.tsmap[i] = add_tsmap[i] | 223 | self.tsmap[i] = add_tsmap[i] |