Commit e0d308239555e1f7377a4540ea5e1e1d737a6079
1 parent
7f14ff4e
Solve some minor issues
Showing
47 changed files
with
156 additions
and
194 deletions
cscripts/csmodelsois.py
| @@ -55,7 +55,9 @@ class csmodelsois(ctools.cscript): | @@ -55,7 +55,9 @@ class csmodelsois(ctools.cscript): | ||
| 55 | self._version = ctools.__version__ | 55 | self._version = ctools.__version__ |
| 56 | 56 | ||
| 57 | # Initialize parameters | 57 | # Initialize parameters |
| 58 | - self._init_members() | 58 | + self._cubegen = ctools.ctmapcube() |
| 59 | + self._models = gammalib.GModels() | ||
| 60 | + self._cubemodels = gammalib.GModels() | ||
| 59 | 61 | ||
| 60 | # Initialise application by calling the appropriate class constructor | 62 | # Initialise application by calling the appropriate class constructor |
| 61 | self._init_cscript(argv) | 63 | self._init_cscript(argv) |
| @@ -65,18 +67,6 @@ class csmodelsois(ctools.cscript): | @@ -65,18 +67,6 @@ class csmodelsois(ctools.cscript): | ||
| 65 | 67 | ||
| 66 | 68 | ||
| 67 | # Private methods | 69 | # Private methods |
| 68 | - def _init_members(self): | ||
| 69 | - """ | ||
| 70 | - Initialize the parameters for this object | ||
| 71 | - """ | ||
| 72 | - # Initialise parameters | ||
| 73 | - self.cubegen = ctools.ctmapcube() # Implements ctmapcube for generate the cube | ||
| 74 | - self.m_models = gammalib.GModels() # Stores the full list of input models | ||
| 75 | - self.cubemodels = gammalib.GModels() # Stores the list of models to be written to file | ||
| 76 | - | ||
| 77 | - # Return | ||
| 78 | - return | ||
| 79 | - | ||
| 80 | def _get_parameters(self): | 70 | def _get_parameters(self): |
| 81 | """ | 71 | """ |
| 82 | Get parameters from parfile | 72 | Get parameters from parfile |
| @@ -89,39 +79,39 @@ class csmodelsois(ctools.cscript): | @@ -89,39 +79,39 @@ class csmodelsois(ctools.cscript): | ||
| 89 | ptsrcsig = self['ptsrcsig'].real() | 79 | ptsrcsig = self['ptsrcsig'].real() |
| 90 | 80 | ||
| 91 | # Get the cube centre coordinates | 81 | # Get the cube centre coordinates |
| 92 | - self.cubegen['coordsys'].string(self['coordsys'].string()) | 82 | + self._cubegen['coordsys'].string(self['coordsys'].string()) |
| 93 | if self['coordsys'].string() == 'CEL': | 83 | if self['coordsys'].string() == 'CEL': |
| 94 | - self.cubegen['xref'].real(self['ra'].real()) | ||
| 95 | - self.cubegen['yref'].real(self['dec'].real()) | 84 | + self._cubegen['xref'].real(self['ra'].real()) |
| 85 | + self._cubegen['yref'].real(self['dec'].real()) | ||
| 96 | else: | 86 | else: |
| 97 | - self.cubegen['xref'].real(self['glon'].real()) | ||
| 98 | - self.cubegen['yref'].real(self['glat'].real()) | 87 | + self._cubegen['xref'].real(self['glon'].real()) |
| 88 | + self._cubegen['yref'].real(self['glat'].real()) | ||
| 99 | 89 | ||
| 100 | # Get spatial binning parameters | 90 | # Get spatial binning parameters |
| 101 | - self.cubegen['binsz'].real(self['binsz'].real()) | ||
| 102 | - self.cubegen['nxpix'].integer(self['nxpix'].integer()) | ||
| 103 | - self.cubegen['nypix'].integer(self['nypix'].integer()) | ||
| 104 | - self.cubegen['proj'].string(self['proj'].string()) | 91 | + self._cubegen['binsz'].real(self['binsz'].real()) |
| 92 | + self._cubegen['nxpix'].integer(self['nxpix'].integer()) | ||
| 93 | + self._cubegen['nypix'].integer(self['nypix'].integer()) | ||
| 94 | + self._cubegen['proj'].string(self['proj'].string()) | ||
| 105 | 95 | ||
| 106 | # Get the energy binning parameters | 96 | # Get the energy binning parameters |
| 107 | - self.cubegen['ebinalg'].string(self['ebinalg'].string()) | 97 | + self._cubegen['ebinalg'].string(self['ebinalg'].string()) |
| 108 | if self['ebinalg'].string() == 'FILE': | 98 | if self['ebinalg'].string() == 'FILE': |
| 109 | - self.cubegen['ebinfile'].filename(self['ebinfile'].filename()) | 99 | + self._cubegen['ebinfile'].filename(self['ebinfile'].filename()) |
| 110 | else: | 100 | else: |
| 111 | - self.cubegen['emin'].real(self['emin'].real()) | ||
| 112 | - self.cubegen['emax'].real(self['emax'].real()) | ||
| 113 | - self.cubegen['enumbins'].integer(self['enumbins'].integer()) | 101 | + self._cubegen['emin'].real(self['emin'].real()) |
| 102 | + self._cubegen['emax'].real(self['emax'].real()) | ||
| 103 | + self._cubegen['enumbins'].integer(self['enumbins'].integer()) | ||
| 114 | 104 | ||
| 115 | # Get remaining hidden parameters | 105 | # Get remaining hidden parameters |
| 116 | - self.cubegen['ptsrcsig'].real(ptsrcsig) | 106 | + self._cubegen['ptsrcsig'].real(ptsrcsig) |
| 117 | 107 | ||
| 118 | # Read optionally output cube filenames | 108 | # Read optionally output cube filenames |
| 119 | if self._read_ahead(): | 109 | if self._read_ahead(): |
| 120 | - self.cubegen['outcube'].filename(self['outcube'].filename()) | 110 | + self._cubegen['outcube'].filename(self['outcube'].filename()) |
| 121 | self['outmodel'].filename() | 111 | self['outmodel'].filename() |
| 122 | 112 | ||
| 123 | # Write parameters into logger | 113 | # Write parameters into logger |
| 124 | - self._log_parameters(gammalib.TERSE); | 114 | + self._log_parameters(gammalib.TERSE) |
| 125 | 115 | ||
| 126 | return | 116 | return |
| 127 | 117 | ||
| @@ -133,28 +123,27 @@ class csmodelsois(ctools.cscript): | @@ -133,28 +123,27 @@ class csmodelsois(ctools.cscript): | ||
| 133 | sources = self['soilist'].string().split(',') | 123 | sources = self['soilist'].string().split(',') |
| 134 | 124 | ||
| 135 | # Load the model into a model container | 125 | # Load the model into a model container |
| 136 | - if (self.m_models.size() == 0): | ||
| 137 | - self.m_models = gammalib.GModels(self['inmodel'].filename()) | 126 | + if (self._models.size() == 0): |
| 127 | + self._models = gammalib.GModels(self['inmodel'].filename()) | ||
| 138 | 128 | ||
| 139 | # Store a copy of the models | 129 | # Store a copy of the models |
| 140 | - self.cubemodels = self.m_models.copy() | 130 | + self._cubemodels = self._models.copy() |
| 141 | 131 | ||
| 142 | # Loop through models and pull out all models not in the list | 132 | # Loop through models and pull out all models not in the list |
| 143 | - models2remove = [] | ||
| 144 | - for model in self.m_models: | 133 | + for model in self._models: |
| 145 | 134 | ||
| 146 | # If model is not a sky model then continue | 135 | # If model is not a sky model then continue |
| 147 | if model.classname() != 'GModelSky': | 136 | if model.classname() != 'GModelSky': |
| 148 | - self.cubemodels.remove(model.name()) | 137 | + self._cubemodels.remove(model.name()) |
| 149 | 138 | ||
| 150 | # ... otherwise, if model is in list of sources the remove it | 139 | # ... otherwise, if model is in list of sources the remove it |
| 151 | # from the container | 140 | # from the container |
| 152 | elif model.name() in sources: | 141 | elif model.name() in sources: |
| 153 | - self.cubemodels.remove(model.name()) | 142 | + self._cubemodels.remove(model.name()) |
| 154 | 143 | ||
| 155 | # Log the number of models to be put into the cube | 144 | # Log the number of models to be put into the cube |
| 156 | self._log_value(self['chatter'].integer(), 'Numner of cube models', | 145 | self._log_value(self['chatter'].integer(), 'Numner of cube models', |
| 157 | - self.cubemodels.size()) | 146 | + self._cubemodels.size()) |
| 158 | 147 | ||
| 159 | # Return | 148 | # Return |
| 160 | return | 149 | return |
| @@ -176,16 +165,16 @@ class csmodelsois(ctools.cscript): | @@ -176,16 +165,16 @@ class csmodelsois(ctools.cscript): | ||
| 176 | self._gen_cubemodel() | 165 | self._gen_cubemodel() |
| 177 | 166 | ||
| 178 | # Only run if there still models to be filled into the cube | 167 | # Only run if there still models to be filled into the cube |
| 179 | - if not self.cubemodels.is_empty(): | 168 | + if not self._cubemodels.is_empty(): |
| 180 | 169 | ||
| 181 | # Log action | 170 | # Log action |
| 182 | self._log_string(gammalib.NORMAL, 'Generating model cube') | 171 | self._log_string(gammalib.NORMAL, 'Generating model cube') |
| 183 | 172 | ||
| 184 | # Fill the cube models into the ctmapcube object | 173 | # Fill the cube models into the ctmapcube object |
| 185 | - self.cubegen.models(self.cubemodels) | 174 | + self._cubegen.models(self._cubemodels) |
| 186 | 175 | ||
| 187 | # Run the map generating method | 176 | # Run the map generating method |
| 188 | - self.cubegen.run() | 177 | + self._cubegen.run() |
| 189 | 178 | ||
| 190 | else: | 179 | else: |
| 191 | self._log_string(gammalib.NORMAL, | 180 | self._log_string(gammalib.NORMAL, |
| @@ -199,19 +188,19 @@ class csmodelsois(ctools.cscript): | @@ -199,19 +188,19 @@ class csmodelsois(ctools.cscript): | ||
| 199 | Save the cube and optionally the updated XML model file | 188 | Save the cube and optionally the updated XML model file |
| 200 | """ | 189 | """ |
| 201 | # Save the generated cube if the cube and filename are not empty | 190 | # Save the generated cube if the cube and filename are not empty |
| 202 | - if ((not self.cubegen.mapcube().cube().is_empty()) and | 191 | + if ((not self._cubegen.mapcube().cube().is_empty()) and |
| 203 | self._is_valid_filename(self['outcube'].filename())): | 192 | self._is_valid_filename(self['outcube'].filename())): |
| 204 | - self.cubegen.mapcube().save(self['outcube'].filename(), | 193 | + self._cubegen.mapcube().save(self['outcube'].filename(), |
| 205 | self['clobber'].boolean()) | 194 | self['clobber'].boolean()) |
| 206 | 195 | ||
| 207 | # If requested, save the updated list of models | 196 | # If requested, save the updated list of models |
| 208 | if self._is_valid_filename(self['outmodel'].filename()): | 197 | if self._is_valid_filename(self['outmodel'].filename()): |
| 209 | 198 | ||
| 210 | # Generate a list of models that will be output to file | 199 | # Generate a list of models that will be output to file |
| 211 | - outmodels = gammalib.GModels(self.m_models) | 200 | + outmodels = gammalib.GModels(self._models) |
| 212 | 201 | ||
| 213 | # Remove all models used in the generated cube | 202 | # Remove all models used in the generated cube |
| 214 | - for model in self.cubemodels: | 203 | + for model in self._cubemodels: |
| 215 | outmodels.remove(model.name()) | 204 | outmodels.remove(model.name()) |
| 216 | 205 | ||
| 217 | # Generate the actual cube model | 206 | # Generate the actual cube model |
| @@ -236,7 +225,7 @@ class csmodelsois(ctools.cscript): | @@ -236,7 +225,7 @@ class csmodelsois(ctools.cscript): | ||
| 236 | Return the mapcube generated by the underlying 'ctmapcube' object | 225 | Return the mapcube generated by the underlying 'ctmapcube' object |
| 237 | """ | 226 | """ |
| 238 | # Return | 227 | # Return |
| 239 | - return self.cubegen.mapcube() | 228 | + return self._cubegen.mapcube() |
| 240 | 229 | ||
| 241 | def cubemodelname(self): | 230 | def cubemodelname(self): |
| 242 | """ | 231 | """ |
| @@ -255,7 +244,7 @@ class csmodelsois(ctools.cscript): | @@ -255,7 +244,7 @@ class csmodelsois(ctools.cscript): | ||
| 255 | Model container | 244 | Model container |
| 256 | """ | 245 | """ |
| 257 | # Set models | 246 | # Set models |
| 258 | - self.m_models = models | 247 | + self._models = models |
| 259 | 248 | ||
| 260 | # Return | 249 | # Return |
| 261 | return | 250 | return |
cscripts/csobsdef.py
| @@ -119,7 +119,7 @@ class csobsdef(ctools.cscript): | @@ -119,7 +119,7 @@ class csobsdef(ctools.cscript): | ||
| 119 | # Return | 119 | # Return |
| 120 | return | 120 | return |
| 121 | 121 | ||
| 122 | - def _set_response(self, obs, caldb, irf): | 122 | + def _set_irf(self, obs, caldb, irf): |
| 123 | """ | 123 | """ |
| 124 | Set response for an observation | 124 | Set response for an observation |
| 125 | 125 | ||
| @@ -258,7 +258,7 @@ class csobsdef(ctools.cscript): | @@ -258,7 +258,7 @@ class csobsdef(ctools.cscript): | ||
| 258 | else: | 258 | else: |
| 259 | irf = self['irf'].string() | 259 | irf = self['irf'].string() |
| 260 | if caldb != '' and irf != '': | 260 | if caldb != '' and irf != '': |
| 261 | - obs = self._set_response(obs, caldb, irf) | 261 | + obs = self._set_irf(obs, caldb, irf) |
| 262 | 262 | ||
| 263 | # Set deadtime correction factor. If no information is provided | 263 | # Set deadtime correction factor. If no information is provided |
| 264 | # then use the user parameter value "deadc". | 264 | # then use the user parameter value "deadc". |
cscripts/csphagen.py
| @@ -39,7 +39,7 @@ class csphagen(ctools.cscript): | @@ -39,7 +39,7 @@ class csphagen(ctools.cscript): | ||
| 39 | Constructor | 39 | Constructor |
| 40 | """ | 40 | """ |
| 41 | # Set name, version | 41 | # Set name, version |
| 42 | - self._name = 'csphagen' | 42 | + self._name = 'csphagen' |
| 43 | self._version = ctools.__version__ | 43 | self._version = ctools.__version__ |
| 44 | 44 | ||
| 45 | # Initialise observation container from constructor arguments | 45 | # Initialise observation container from constructor arguments |
| @@ -56,6 +56,8 @@ class csphagen(ctools.cscript): | @@ -56,6 +56,8 @@ class csphagen(ctools.cscript): | ||
| 56 | self._bkg_regs = [] | 56 | self._bkg_regs = [] |
| 57 | self._excl_reg = None | 57 | self._excl_reg = None |
| 58 | self._has_exclusion = False | 58 | self._has_exclusion = False |
| 59 | + self._srcshape = '' | ||
| 60 | + self._rad = 0.0 | ||
| 59 | 61 | ||
| 60 | # Return | 62 | # Return |
| 61 | return | 63 | return |
cscripts/csphasecrv.py
| @@ -62,10 +62,11 @@ class csphasecrv(ctools.cscript): | @@ -62,10 +62,11 @@ class csphasecrv(ctools.cscript): | ||
| 62 | 62 | ||
| 63 | # Initialise some members. Phases are stored in a nested list | 63 | # Initialise some members. Phases are stored in a nested list |
| 64 | # [[ph1min,ph1max], [ph2min,ph2max],..] | 64 | # [[ph1min,ph1max], [ph2min,ph2max],..] |
| 65 | - self._srcname = '' | ||
| 66 | - self._phbins = [[0.0,1.0]] | ||
| 67 | - self._stacked = False | ||
| 68 | - self._fits = gammalib.GFits() | 65 | + self._srcname = '' |
| 66 | + self._phbins = [[0.0,1.0]] | ||
| 67 | + self._stacked = False | ||
| 68 | + self._fits = gammalib.GFits() | ||
| 69 | + self._fitmodels = {} | ||
| 69 | 70 | ||
| 70 | # Initialise observation container from constructor arguments. | 71 | # Initialise observation container from constructor arguments. |
| 71 | self._obs, argv = self._set_input_obs(argv) | 72 | self._obs, argv = self._set_input_obs(argv) |
cscripts/cspull.py
| @@ -19,7 +19,6 @@ | @@ -19,7 +19,6 @@ | ||
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | import sys | 21 | import sys |
| 22 | -import math | ||
| 23 | import gammalib | 22 | import gammalib |
| 24 | import ctools | 23 | import ctools |
| 25 | from cscripts import obsutils | 24 | from cscripts import obsutils |
cscripts/cssens.py
| @@ -19,7 +19,6 @@ | @@ -19,7 +19,6 @@ | ||
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | import sys | 21 | import sys |
| 22 | -import csv | ||
| 23 | import math | 22 | import math |
| 24 | import gammalib | 23 | import gammalib |
| 25 | import ctools | 24 | import ctools |
| @@ -387,9 +386,6 @@ class cssens(ctools.cscript): | @@ -387,9 +386,6 @@ class cssens(ctools.cscript): | ||
| 387 | energy = gammalib.GEnergy(e_mean, 'TeV') | 386 | energy = gammalib.GEnergy(e_mean, 'TeV') |
| 388 | sensitivity = source.spectral().eval(energy) * e_mean*erg_mean*1.0e6 | 387 | sensitivity = source.spectral().eval(energy) * e_mean*erg_mean*1.0e6 |
| 389 | 388 | ||
| 390 | - # Assess quality based on a comparison between Npred and Nevents | ||
| 391 | - quality = npred - nevents | ||
| 392 | - | ||
| 393 | # Write fit results into logger | 389 | # Write fit results into logger |
| 394 | name = 'Iteration %d' % iterations | 390 | name = 'Iteration %d' % iterations |
| 395 | value = ('TS=%10.4f Sim=%9.4f mCrab Fit=%9.4f mCrab ' | 391 | value = ('TS=%10.4f Sim=%9.4f mCrab Fit=%9.4f mCrab ' |
cscripts/cssrcdetect.py
| @@ -319,7 +319,7 @@ class cssrcdetect(ctools.cscript): | @@ -319,7 +319,7 @@ class cssrcdetect(ctools.cscript): | ||
| 319 | 319 | ||
| 320 | # Get fit parameters | 320 | # Get fit parameters |
| 321 | fit_pos = self['fit_pos'].boolean() | 321 | fit_pos = self['fit_pos'].boolean() |
| 322 | - fit_shape = self['fit_shape'].boolean() | 322 | + #fit_shape = self['fit_shape'].boolean() |
| 323 | 323 | ||
| 324 | # Loop over all parameters | 324 | # Loop over all parameters |
| 325 | for par in spatial: | 325 | for par in spatial: |
cscripts/ioutils.py
cscripts/modutils.py
| @@ -17,8 +17,8 @@ | @@ -17,8 +17,8 @@ | ||
| 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | # | 18 | # |
| 19 | # ========================================================================== | 19 | # ========================================================================== |
| 20 | -import gammalib | ||
| 21 | -import ctools | 20 | +#import gammalib |
| 21 | +#import ctools | ||
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | # ============================================ # | 24 | # ============================================ # |
cscripts/obsutils.py
| @@ -76,21 +76,21 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, | @@ -76,21 +76,21 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, | ||
| 76 | Observation container filled with simulated events | 76 | Observation container filled with simulated events |
| 77 | """ | 77 | """ |
| 78 | # Allocate ctobssim application and set parameters | 78 | # Allocate ctobssim application and set parameters |
| 79 | - sim = ctools.ctobssim(obs) | ||
| 80 | - sim['seed'] = seed | ||
| 81 | - sim['edisp'] = edisp | ||
| 82 | - sim['chatter'] = chatter | ||
| 83 | - sim['debug'] = debug | 79 | + obssim = ctools.ctobssim(obs) |
| 80 | + obssim['seed'] = seed | ||
| 81 | + obssim['edisp'] = edisp | ||
| 82 | + obssim['chatter'] = chatter | ||
| 83 | + obssim['debug'] = debug | ||
| 84 | 84 | ||
| 85 | # Optionally open the log file | 85 | # Optionally open the log file |
| 86 | if log: | 86 | if log: |
| 87 | - sim.logFileOpen() | 87 | + obssim.logFileOpen() |
| 88 | 88 | ||
| 89 | # Run ctobssim application. This will loop over all observations in the | 89 | # Run ctobssim application. This will loop over all observations in the |
| 90 | # container and simulation the events for each observation. Note that | 90 | # container and simulation the events for each observation. Note that |
| 91 | # events are not added together, they still apply to each observation | 91 | # events are not added together, they still apply to each observation |
| 92 | # separately. | 92 | # separately. |
| 93 | - sim.run() | 93 | + obssim.run() |
| 94 | 94 | ||
| 95 | # Binned option? | 95 | # Binned option? |
| 96 | if nbins > 0: | 96 | if nbins > 0: |
| @@ -101,12 +101,12 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, | @@ -101,12 +101,12 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, | ||
| 101 | if emin == None or emax == None: | 101 | if emin == None or emax == None: |
| 102 | emin = 1.0e30 | 102 | emin = 1.0e30 |
| 103 | emax = 0.0 | 103 | emax = 0.0 |
| 104 | - for run in sim.obs(): | 104 | + for run in obssim.obs(): |
| 105 | emin = min(run.events().ebounds().emin().TeV(), emin) | 105 | emin = min(run.events().ebounds().emin().TeV(), emin) |
| 106 | emax = max(run.events().ebounds().emax().TeV(), emax) | 106 | emax = max(run.events().ebounds().emax().TeV(), emax) |
| 107 | 107 | ||
| 108 | # Allocate ctbin application and set parameters | 108 | # Allocate ctbin application and set parameters |
| 109 | - bin = ctools.ctbin(sim.obs()) | 109 | + bin = ctools.ctbin(obssim.obs()) |
| 110 | bin['ebinalg'] = 'LOG' | 110 | bin['ebinalg'] = 'LOG' |
| 111 | bin['emin'] = emin | 111 | bin['emin'] = emin |
| 112 | bin['emax'] = emax | 112 | bin['emax'] = emax |
| @@ -130,10 +130,10 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, | @@ -130,10 +130,10 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, | ||
| 130 | 130 | ||
| 131 | # If we have multiple input observations then create stacked response | 131 | # If we have multiple input observations then create stacked response |
| 132 | # cubes and append them to the observation | 132 | # cubes and append them to the observation |
| 133 | - if len(sim.obs()) > 1: | 133 | + if len(obssim.obs()) > 1: |
| 134 | 134 | ||
| 135 | # Get stacked response (use pointing for map centre) | 135 | # Get stacked response (use pointing for map centre) |
| 136 | - response = get_stacked_response(sim.obs(), None, None, | 136 | + response = get_stacked_response(obssim.obs(), None, None, |
| 137 | binsz=binsz, nxpix=npix, nypix=npix, | 137 | binsz=binsz, nxpix=npix, nypix=npix, |
| 138 | emin=emin, emax=emax, enumbins=nbins, | 138 | emin=emin, emax=emax, enumbins=nbins, |
| 139 | edisp=edisp, | 139 | edisp=edisp, |
| @@ -166,10 +166,10 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, | @@ -166,10 +166,10 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, | ||
| 166 | # Make a deep copy of the observation that will be returned | 166 | # Make a deep copy of the observation that will be returned |
| 167 | # (the ctobssim object will go out of scope one the function is | 167 | # (the ctobssim object will go out of scope one the function is |
| 168 | # left) | 168 | # left) |
| 169 | - obs = sim.obs().copy() | 169 | + obs = obssim.obs().copy() |
| 170 | 170 | ||
| 171 | # Delete the simulation | 171 | # Delete the simulation |
| 172 | - del sim | 172 | + del obssim |
| 173 | 173 | ||
| 174 | # Return observation container | 174 | # Return observation container |
| 175 | return obs | 175 | return obs |
examples/make_pointings.py
| @@ -301,7 +301,7 @@ def set_irf(site, obs, caldb, lst=True): | @@ -301,7 +301,7 @@ def set_irf(site, obs, caldb, lst=True): | ||
| 301 | # Compute Right Ascension and Declination of pointing | 301 | # Compute Right Ascension and Declination of pointing |
| 302 | pnt = gammalib.GSkyDir() | 302 | pnt = gammalib.GSkyDir() |
| 303 | pnt.lb_deg(obs['lon'], obs['lat']) | 303 | pnt.lb_deg(obs['lon'], obs['lat']) |
| 304 | - ra = pnt.ra_deg() | 304 | + #ra = pnt.ra_deg() |
| 305 | dec = pnt.dec_deg() | 305 | dec = pnt.dec_deg() |
| 306 | 306 | ||
| 307 | # Set geographic latitude of array | 307 | # Set geographic latitude of array |
examples/make_spectrum.py
| @@ -204,7 +204,7 @@ def make_spectrum(): | @@ -204,7 +204,7 @@ def make_spectrum(): | ||
| 204 | {'option': '-p', 'value': ''}] | 204 | {'option': '-p', 'value': ''}] |
| 205 | 205 | ||
| 206 | # Get arguments and options from command line arguments | 206 | # Get arguments and options from command line arguments |
| 207 | - args, options = cscripts.ioutils.get_args_options(options, usage) | 207 | + _, options = cscripts.ioutils.get_args_options(options, usage) |
| 208 | 208 | ||
| 209 | # Extract script parameters from options | 209 | # Extract script parameters from options |
| 210 | datadir = options[0]['value'] | 210 | datadir = options[0]['value'] |
examples/make_ts_distributions.py
| @@ -18,7 +18,6 @@ | @@ -18,7 +18,6 @@ | ||
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | -import sys | ||
| 22 | import cscripts | 21 | import cscripts |
| 23 | 22 | ||
| 24 | 23 | ||
| @@ -101,13 +100,13 @@ def make_ts_distribution(): | @@ -101,13 +100,13 @@ def make_ts_distribution(): | ||
| 101 | {'option': '-d', 'value': 'data'}] | 100 | {'option': '-d', 'value': 'data'}] |
| 102 | 101 | ||
| 103 | # Get arguments and options from command line arguments | 102 | # Get arguments and options from command line arguments |
| 104 | - args, options = cscripts.ioutils.get_args_options(options, usage) | 103 | + _, options = cscripts.ioutils.get_args_options(options, usage) |
| 105 | 104 | ||
| 106 | # Extract script parameters from options | 105 | # Extract script parameters from options |
| 107 | ntrials = int(options[0]['value']) | 106 | ntrials = int(options[0]['value']) |
| 108 | enumbins = int(options[1]['value']) | 107 | enumbins = int(options[1]['value']) |
| 109 | duration = float(options[2]['value']) | 108 | duration = float(options[2]['value']) |
| 110 | - max_threads = int(options[3]['value']) | 109 | + #max_threads = int(options[3]['value']) |
| 111 | datadir = options[4]['value'] | 110 | datadir = options[4]['value'] |
| 112 | 111 | ||
| 113 | # Loop over energy bands. The energy bands are those that are also | 112 | # Loop over energy bands. The energy bands are those that are also |
| @@ -116,7 +115,7 @@ def make_ts_distribution(): | @@ -116,7 +115,7 @@ def make_ts_distribution(): | ||
| 116 | 115 | ||
| 117 | # Set energies | 116 | # Set energies |
| 118 | loge = -1.7 + ieng * 0.2 | 117 | loge = -1.7 + ieng * 0.2 |
| 119 | - emean = pow(10.0, loge) | 118 | + #emean = pow(10.0, loge) |
| 120 | emin = pow(10.0, loge-0.1) | 119 | emin = pow(10.0, loge-0.1) |
| 121 | emax = pow(10.0, loge+0.1) | 120 | emax = pow(10.0, loge+0.1) |
| 122 | if loge < 0: | 121 | if loge < 0: |
| @@ -125,8 +124,8 @@ def make_ts_distribution(): | @@ -125,8 +124,8 @@ def make_ts_distribution(): | ||
| 125 | loge = 'p'+str(abs(loge)) | 124 | loge = 'p'+str(abs(loge)) |
| 126 | 125 | ||
| 127 | # Create TS | 126 | # Create TS |
| 128 | - create_ts(datadir, loge, emin, emax, ntrials=ntrials, enumbins=enumbins, | ||
| 129 | - duration=duration) | 127 | + create_ts(datadir, loge, emin, emax, ntrials=ntrials, |
| 128 | + enumbins=enumbins, duration=duration) | ||
| 130 | 129 | ||
| 131 | # Return | 130 | # Return |
| 132 | return | 131 | return |
examples/pipeline_binned_disk.py
| @@ -138,7 +138,7 @@ def pipeline_binned_disk(): | @@ -138,7 +138,7 @@ def pipeline_binned_disk(): | ||
| 138 | options = [{'option': '-d', 'value': 'data'}] | 138 | options = [{'option': '-d', 'value': 'data'}] |
| 139 | 139 | ||
| 140 | # Get arguments and options from command line arguments | 140 | # Get arguments and options from command line arguments |
| 141 | - args, options = cscripts.ioutils.get_args_options(options, usage) | 141 | + _, options = cscripts.ioutils.get_args_options(options, usage) |
| 142 | 142 | ||
| 143 | # Extract script parameters from options | 143 | # Extract script parameters from options |
| 144 | datadir = options[0]['value'] | 144 | datadir = options[0]['value'] |
examples/pipeline_binned_mem.py
| @@ -109,7 +109,7 @@ def pipeline_binned_mem(): | @@ -109,7 +109,7 @@ def pipeline_binned_mem(): | ||
| 109 | options = [{'option': '-d', 'value': 'data'}] | 109 | options = [{'option': '-d', 'value': 'data'}] |
| 110 | 110 | ||
| 111 | # Get arguments and options from command line arguments | 111 | # Get arguments and options from command line arguments |
| 112 | - args, options = cscripts.ioutils.get_args_options(options, usage) | 112 | + _, options = cscripts.ioutils.get_args_options(options, usage) |
| 113 | 113 | ||
| 114 | # Extract script parameters from options | 114 | # Extract script parameters from options |
| 115 | datadir = options[0]['value'] | 115 | datadir = options[0]['value'] |
examples/pipeline_stacked_disk.py
| @@ -188,7 +188,7 @@ def pipeline_stacked_disk(): | @@ -188,7 +188,7 @@ def pipeline_stacked_disk(): | ||
| 188 | options = [{'option': '-d', 'value': 'data'}] | 188 | options = [{'option': '-d', 'value': 'data'}] |
| 189 | 189 | ||
| 190 | # Get arguments and options from command line arguments | 190 | # Get arguments and options from command line arguments |
| 191 | - args, options = cscripts.ioutils.get_args_options(options, usage) | 191 | + _, options = cscripts.ioutils.get_args_options(options, usage) |
| 192 | 192 | ||
| 193 | # Extract script parameters from options | 193 | # Extract script parameters from options |
| 194 | datadir = options[0]['value'] | 194 | datadir = options[0]['value'] |
examples/pipeline_stacked_mem.py
| @@ -161,7 +161,7 @@ def pipeline_stacked_mem(): | @@ -161,7 +161,7 @@ def pipeline_stacked_mem(): | ||
| 161 | options = [{'option': '-d', 'value': 'data'}] | 161 | options = [{'option': '-d', 'value': 'data'}] |
| 162 | 162 | ||
| 163 | # Get arguments and options from command line arguments | 163 | # Get arguments and options from command line arguments |
| 164 | - args, options = cscripts.ioutils.get_args_options(options, usage) | 164 | + _, options = cscripts.ioutils.get_args_options(options, usage) |
| 165 | 165 | ||
| 166 | # Extract script parameters from options | 166 | # Extract script parameters from options |
| 167 | datadir = options[0]['value'] | 167 | datadir = options[0]['value'] |
examples/pipeline_unbinned_disk.py
| @@ -112,7 +112,7 @@ def pipeline_unbinned_disk(): | @@ -112,7 +112,7 @@ def pipeline_unbinned_disk(): | ||
| 112 | options = [{'option': '-d', 'value': 'data'}] | 112 | options = [{'option': '-d', 'value': 'data'}] |
| 113 | 113 | ||
| 114 | # Get arguments and options from command line arguments | 114 | # Get arguments and options from command line arguments |
| 115 | - args, options = cscripts.ioutils.get_args_options(options, usage) | 115 | + _, options = cscripts.ioutils.get_args_options(options, usage) |
| 116 | 116 | ||
| 117 | # Extract script parameters from options | 117 | # Extract script parameters from options |
| 118 | datadir = options[0]['value'] | 118 | datadir = options[0]['value'] |
examples/pipeline_unbinned_mem.py
| @@ -94,7 +94,7 @@ def pipeline_unbinned_mem(): | @@ -94,7 +94,7 @@ def pipeline_unbinned_mem(): | ||
| 94 | options = [{'option': '-d', 'value': 'data'}] | 94 | options = [{'option': '-d', 'value': 'data'}] |
| 95 | 95 | ||
| 96 | # Get arguments and options from command line arguments | 96 | # Get arguments and options from command line arguments |
| 97 | - args, options = cscripts.ioutils.get_args_options(options, usage) | 97 | + _, options = cscripts.ioutils.get_args_options(options, usage) |
| 98 | 98 | ||
| 99 | # Extract script parameters from options | 99 | # Extract script parameters from options |
| 100 | datadir = options[0]['value'] | 100 | datadir = options[0]['value'] |
examples/show_irf.py
| @@ -226,15 +226,13 @@ def plot_psf(sub, psf, emin=None, emax=None, tmin=None, tmax=None, | @@ -226,15 +226,13 @@ def plot_psf(sub, psf, emin=None, emax=None, tmin=None, tmax=None, | ||
| 226 | # ====================== # | 226 | # ====================== # |
| 227 | # Plot energy dispersion # | 227 | # Plot energy dispersion # |
| 228 | # ====================== # | 228 | # ====================== # |
| 229 | -def plot_edisp(sub, edisp, emin=None, emax=None, tmin=None, tmax=None, | 229 | +def plot_edisp(edisp, emin=None, emax=None, tmin=None, tmax=None, |
| 230 | nengs=100, nthetas=100): | 230 | nengs=100, nthetas=100): |
| 231 | """ | 231 | """ |
| 232 | Plot Background template | 232 | Plot Background template |
| 233 | 233 | ||
| 234 | Parameters | 234 | Parameters |
| 235 | ---------- | 235 | ---------- |
| 236 | - sub : figure | ||
| 237 | - Subplot | ||
| 238 | edisp : `~gammalib.GCTAEdisp2D` | 236 | edisp : `~gammalib.GCTAEdisp2D` |
| 239 | Instrument Response Function | 237 | Instrument Response Function |
| 240 | emin : float, optional | 238 | emin : float, optional |
| @@ -296,8 +294,8 @@ def plot_edisp(sub, edisp, emin=None, emax=None, tmin=None, tmax=None, | @@ -296,8 +294,8 @@ def plot_edisp(sub, edisp, emin=None, emax=None, tmin=None, tmax=None, | ||
| 296 | row_std = [] | 294 | row_std = [] |
| 297 | 295 | ||
| 298 | # Compute detx and dety | 296 | # Compute detx and dety |
| 299 | - detx = theta*gammalib.deg2rad | ||
| 300 | - dety = 0.0 | 297 | + #detx = theta*gammalib.deg2rad |
| 298 | + #dety = 0.0 | ||
| 301 | 299 | ||
| 302 | # Loop over energies | 300 | # Loop over energies |
| 303 | for logenergy in logenergies: | 301 | for logenergy in logenergies: |
| @@ -551,8 +549,8 @@ def plot_irf(irf, emin, emax, tmin, tmax, plotfile): | @@ -551,8 +549,8 @@ def plot_irf(irf, emin, emax, tmin, tmax, plotfile): | ||
| 551 | plot_bkg(ax3, irf.background(), emin=emin, emax=emax, tmin=tmin, tmax=tmax) | 549 | plot_bkg(ax3, irf.background(), emin=emin, emax=emax, tmin=tmin, tmax=tmax) |
| 552 | 550 | ||
| 553 | # Plot Edisp | 551 | # Plot Edisp |
| 554 | - ax4 = fig.add_subplot(234) | ||
| 555 | - plot_edisp(ax4, irf.edisp(), emin=emin, emax=emax, tmin=tmin, tmax=tmax) | 552 | + fig.add_subplot(234) |
| 553 | + plot_edisp(irf.edisp(), emin=emin, emax=emax, tmin=tmin, tmax=tmax) | ||
| 556 | 554 | ||
| 557 | # Show plots or save it into file | 555 | # Show plots or save it into file |
| 558 | if len(plotfile) > 0: | 556 | if len(plotfile) > 0: |
examples/show_pull_evolution.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # Shows the evolution of the mean and rms pull | 3 | # Shows the evolution of the mean and rms pull |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2015-2016 Juergen Knoedlseder | 5 | +# Copyright (C) 2015-2017 Juergen Knoedlseder |
| 6 | # | 6 | # |
| 7 | # This program is free software: you can redistribute it and/or modify | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by | 8 | # it under the terms of the GNU General Public License as published by |
| @@ -19,7 +19,6 @@ | @@ -19,7 +19,6 @@ | ||
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | import sys | 21 | import sys |
| 22 | -import csv | ||
| 23 | import cscripts | 22 | import cscripts |
| 24 | try: | 23 | try: |
| 25 | import matplotlib.pyplot as plt | 24 | import matplotlib.pyplot as plt |
examples/show_pull_histogram.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # Shows the pull histogram | 3 | # Shows the pull histogram |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2011-2016 Juergen Knoedlseder | 5 | +# Copyright (C) 2011-2017 Juergen Knoedlseder |
| 6 | # | 6 | # |
| 7 | # This program is free software: you can redistribute it and/or modify | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by | 8 | # it under the terms of the GNU General Public License as published by |
| @@ -19,7 +19,6 @@ | @@ -19,7 +19,6 @@ | ||
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | import sys | 21 | import sys |
| 22 | -import csv | ||
| 23 | import cscripts | 22 | import cscripts |
| 24 | try: | 23 | try: |
| 25 | import matplotlib.pyplot as plt | 24 | import matplotlib.pyplot as plt |
| @@ -58,8 +57,8 @@ def plot_pull_histogram(filename, parname, nbins, plotfile): | @@ -58,8 +57,8 @@ def plot_pull_histogram(filename, parname, nbins, plotfile): | ||
| 58 | values = np.array(cscripts.ioutils.read_pull_values(filename, parname)) | 57 | values = np.array(cscripts.ioutils.read_pull_values(filename, parname)) |
| 59 | 58 | ||
| 60 | # Create histogram | 59 | # Create histogram |
| 61 | - n, bins, patches = plt.hist(values, nbins, range=[-4.0,4.0], | ||
| 62 | - normed=True, facecolor='green') | 60 | + _, bins, _ = plt.hist(values, nbins, range=[-4.0,4.0], |
| 61 | + normed=True, facecolor='green') | ||
| 63 | 62 | ||
| 64 | # Create expected distribution | 63 | # Create expected distribution |
| 65 | y = mlab.normpdf(bins, 0.0, 1.0) | 64 | y = mlab.normpdf(bins, 0.0, 1.0) |
examples/show_response.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # Shows one or several CTA response functions. | 3 | # Shows one or several CTA response functions. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2014-2016 Juergen Knoedlseder | 5 | +# Copyright (C) 2014-2017 Juergen Knoedlseder |
| 6 | # | 6 | # |
| 7 | # This program is free software: you can redistribute it and/or modify | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by | 8 | # it under the terms of the GNU General Public License as published by |
| @@ -54,9 +54,9 @@ def sigma_lima(Non, Noff, alpha=0.2): | @@ -54,9 +54,9 @@ def sigma_lima(Non, Noff, alpha=0.2): | ||
| 54 | """ | 54 | """ |
| 55 | # Compute sensitivity in Gaussian sigma | 55 | # Compute sensitivity in Gaussian sigma |
| 56 | alpha1 = alpha + 1.0 | 56 | alpha1 = alpha + 1.0 |
| 57 | - sum = Non + Noff | ||
| 58 | - arg1 = Non / sum | ||
| 59 | - arg2 = Noff / sum | 57 | + Ntotal = Non + Noff |
| 58 | + arg1 = Non / Ntotal | ||
| 59 | + arg2 = Noff / Ntotal | ||
| 60 | term1 = Non * math.log((alpha1/alpha)*arg1) | 60 | term1 = Non * math.log((alpha1/alpha)*arg1) |
| 61 | term2 = Noff * math.log(alpha1*arg2) | 61 | term2 = Noff * math.log(alpha1*arg2) |
| 62 | sigma = math.sqrt(2.0 * (term1 + term2)) | 62 | sigma = math.sqrt(2.0 * (term1 + term2)) |
| @@ -425,7 +425,7 @@ def show_response(): | @@ -425,7 +425,7 @@ def show_response(): | ||
| 425 | options = [{'option': '-p', 'value': ''}] | 425 | options = [{'option': '-p', 'value': ''}] |
| 426 | 426 | ||
| 427 | # Get arguments and options from command line arguments | 427 | # Get arguments and options from command line arguments |
| 428 | - args, options = cscripts.ioutils.get_args_options(options, usage) | 428 | + _, options = cscripts.ioutils.get_args_options(options, usage) |
| 429 | 429 | ||
| 430 | # Extract script parameters from options | 430 | # Extract script parameters from options |
| 431 | plotfile = options[0]['value'] | 431 | plotfile = options[0]['value'] |
examples/show_ts_distribution.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # Display TS distribution generated by cstsdist | 3 | # Display TS distribution generated by cstsdist |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2011-2016 Jurgen Knodlseder | 5 | +# Copyright (C) 2011-2017 Jurgen Knodlseder |
| 6 | # | 6 | # |
| 7 | # This program is free software: you can redistribute it and/or modify | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by | 8 | # it under the terms of the GNU General Public License as published by |
| @@ -165,7 +165,7 @@ def dist_cdf(values, nbins, title, plotfile, expect=''): | @@ -165,7 +165,7 @@ def dist_cdf(values, nbins, title, plotfile, expect=''): | ||
| 165 | for i in range(nbins): | 165 | for i in range(nbins): |
| 166 | x_min = min_value+i*binsize | 166 | x_min = min_value+i*binsize |
| 167 | x_max = min_value+(i+1)*binsize | 167 | x_max = min_value+(i+1)*binsize |
| 168 | - x_val = 0.5*(x_min+x_max) | 168 | + #x_val = 0.5*(x_min+x_max) |
| 169 | y_val = 0.0 | 169 | y_val = 0.0 |
| 170 | for ts in values: | 170 | for ts in values: |
| 171 | if ts > x_min: | 171 | if ts > x_min: |
| @@ -235,9 +235,9 @@ def dist_pdf(values, nbins, title, plotfile, expect=''): | @@ -235,9 +235,9 @@ def dist_pdf(values, nbins, title, plotfile, expect=''): | ||
| 235 | nbins += 1 | 235 | nbins += 1 |
| 236 | 236 | ||
| 237 | # Create histogram | 237 | # Create histogram |
| 238 | - n, bins, patches = plt.hist(values, nbins, range=[min_value, max_value], | ||
| 239 | - align='mid', facecolor='green', | ||
| 240 | - log=True, label='simulations') | 238 | + _, bins, _ = plt.hist(values, nbins, range=[min_value, max_value], |
| 239 | + align='mid', facecolor='green', | ||
| 240 | + log=True, label='simulations') | ||
| 241 | 241 | ||
| 242 | # Create expected distribution (only for positive TS). We compute the | 242 | # Create expected distribution (only for positive TS). We compute the |
| 243 | # full and half of the distribution, as for positively constrained | 243 | # full and half of the distribution, as for positively constrained |
| @@ -250,8 +250,8 @@ def dist_pdf(values, nbins, title, plotfile, expect=''): | @@ -250,8 +250,8 @@ def dist_pdf(values, nbins, title, plotfile, expect=''): | ||
| 250 | x.append(0.0) | 250 | x.append(0.0) |
| 251 | y_full.append(len(values)) | 251 | y_full.append(len(values)) |
| 252 | y_half.append(0.5*len(values)) | 252 | y_half.append(0.5*len(values)) |
| 253 | - for bin in bins: | ||
| 254 | - ts = bin + 0.5*width | 253 | + for i in bins: |
| 254 | + ts = i + 0.5*width | ||
| 255 | if ts > 0: | 255 | if ts > 0: |
| 256 | y = norm*math.pow(ts,-0.5)*math.exp(-0.5*ts) | 256 | y = norm*math.pow(ts,-0.5)*math.exp(-0.5*ts) |
| 257 | x.append(ts) | 257 | x.append(ts) |
pyext/ctool.i
| @@ -91,7 +91,7 @@ public: | @@ -91,7 +91,7 @@ public: | ||
| 91 | %rename(_create_map) create_map; | 91 | %rename(_create_map) create_map; |
| 92 | %rename(_create_cube) create_cube; | 92 | %rename(_create_cube) create_cube; |
| 93 | %rename(_create_cta_obs) create_cta_obs; | 93 | %rename(_create_cta_obs) create_cta_obs; |
| 94 | - %rename(_require_inobs) require_inobs; | 94 | + //%rename(_require_inobs) require_inobs; |
| 95 | %rename(_require_inobs_nocube) require_inobs_nocube; | 95 | %rename(_require_inobs_nocube) require_inobs_nocube; |
| 96 | %rename(_get_roi) get_roi; | 96 | %rename(_get_roi) get_roi; |
| 97 | %rename(_get_ebounds) get_ebounds; | 97 | %rename(_get_ebounds) get_ebounds; |
| @@ -99,14 +99,14 @@ public: | @@ -99,14 +99,14 @@ public: | ||
| 99 | %rename(_get_pointing) get_pointing; | 99 | %rename(_get_pointing) get_pointing; |
| 100 | %rename(_get_skydir) get_skydir; | 100 | %rename(_get_skydir) get_skydir; |
| 101 | %rename(_set_outfile_name) set_outfile_name; | 101 | %rename(_set_outfile_name) set_outfile_name; |
| 102 | - %rename(_is_stacked) is_stacked; | 102 | + //%rename(_is_stacked) is_stacked; |
| 103 | %rename(_set_response) set_response; | 103 | %rename(_set_response) set_response; |
| 104 | %rename(_set_edisp) set_edisp; | 104 | %rename(_set_edisp) set_edisp; |
| 105 | %rename(_restore_edisp) restore_edisp; | 105 | %rename(_restore_edisp) restore_edisp; |
| 106 | %rename(_set_obs_response) set_obs_response; | 106 | %rename(_set_obs_response) set_obs_response; |
| 107 | %rename(_set_obs_bounds) set_obs_bounds; | 107 | %rename(_set_obs_bounds) set_obs_bounds; |
| 108 | %rename(_get_mean_pointing) get_mean_pointing; | 108 | %rename(_get_mean_pointing) get_mean_pointing; |
| 109 | - %rename(_get_current_rss) get_current_rss; | 109 | + //%rename(_get_current_rss) get_current_rss; |
| 110 | %rename(_get_obs_header) get_obs_header; | 110 | %rename(_get_obs_header) get_obs_header; |
| 111 | %rename(_insert_energy_boundaries) insert_energy_boundaries; | 111 | %rename(_insert_energy_boundaries) insert_energy_boundaries; |
| 112 | %rename(_cube_layer_usage) cube_layer_usage; | 112 | %rename(_cube_layer_usage) cube_layer_usage; |
| @@ -133,7 +133,7 @@ public: | @@ -133,7 +133,7 @@ public: | ||
| 133 | GCTAObservation create_cta_obs(void); | 133 | GCTAObservation create_cta_obs(void); |
| 134 | 134 | ||
| 135 | // Protected methods that check user parameters | 135 | // Protected methods that check user parameters |
| 136 | - void require_inobs(const std::string& method); | 136 | + //void require_inobs(const std::string& method); |
| 137 | void require_inobs_nocube(const std::string& method); | 137 | void require_inobs_nocube(const std::string& method); |
| 138 | 138 | ||
| 139 | // Protected methods that extract user parameters | 139 | // Protected methods that extract user parameters |
| @@ -145,7 +145,7 @@ public: | @@ -145,7 +145,7 @@ public: | ||
| 145 | std::string set_outfile_name(const std::string& filename); | 145 | std::string set_outfile_name(const std::string& filename); |
| 146 | 146 | ||
| 147 | // Protected methods that query user parameters | 147 | // Protected methods that query user parameters |
| 148 | - bool is_stacked(void); | 148 | + //bool is_stacked(void); |
| 149 | 149 | ||
| 150 | // Protected support methods | 150 | // Protected support methods |
| 151 | void set_response(GObservations& obs); | 151 | void set_response(GObservations& obs); |
| @@ -156,7 +156,7 @@ public: | @@ -156,7 +156,7 @@ public: | ||
| 156 | void set_obs_bounds(GObservations& obs); | 156 | void set_obs_bounds(GObservations& obs); |
| 157 | GObservations get_observations(const bool& get_response = true); | 157 | GObservations get_observations(const bool& get_response = true); |
| 158 | GSkyDir get_mean_pointing(const GObservations& obs); | 158 | GSkyDir get_mean_pointing(const GObservations& obs); |
| 159 | - size_t get_current_rss(void); | 159 | + //size_t get_current_rss(void); |
| 160 | std::string get_obs_header(const GObservation* obs) const; | 160 | std::string get_obs_header(const GObservation* obs) const; |
| 161 | GEnergies insert_energy_boundaries(const GEnergies& energies, | 161 | GEnergies insert_energy_boundaries(const GEnergies& energies, |
| 162 | const GCTAObservation& obs); | 162 | const GCTAObservation& obs); |
src/ctskymap/ctskymap.cpp
| @@ -600,8 +600,8 @@ void ctskymap::map_events(GCTAObservation* obs) | @@ -600,8 +600,8 @@ void ctskymap::map_events(GCTAObservation* obs) | ||
| 600 | 600 | ||
| 601 | // If RoI is valid then skip if instrument direction is not within RoI | 601 | // If RoI is valid then skip if instrument direction is not within RoI |
| 602 | if (roi.is_valid() && !roi.contains(*inst)) { | 602 | if (roi.is_valid() && !roi.contains(*inst)) { |
| 603 | - continue; | ||
| 604 | num_outside_roi++; | 603 | num_outside_roi++; |
| 604 | + continue; | ||
| 605 | } | 605 | } |
| 606 | 606 | ||
| 607 | // Fill event in skymap | 607 | // Fill event in skymap |
src/support/ctool.cpp
| @@ -810,6 +810,7 @@ GCTAObservation ctool::create_cta_obs(void) | @@ -810,6 +810,7 @@ GCTAObservation ctool::create_cta_obs(void) | ||
| 810 | * @todo This method is only used by csobsinfo, csresmap and csspec. We | 810 | * @todo This method is only used by csobsinfo, csresmap and csspec. We |
| 811 | * should try to get rid of it | 811 | * should try to get rid of it |
| 812 | ***************************************************************************/ | 812 | ***************************************************************************/ |
| 813 | +/* | ||
| 813 | void ctool::require_inobs(const std::string& method) | 814 | void ctool::require_inobs(const std::string& method) |
| 814 | { | 815 | { |
| 815 | // Get inobs filename | 816 | // Get inobs filename |
| @@ -828,6 +829,7 @@ void ctool::require_inobs(const std::string& method) | @@ -828,6 +829,7 @@ void ctool::require_inobs(const std::string& method) | ||
| 828 | // Return | 829 | // Return |
| 829 | return; | 830 | return; |
| 830 | } | 831 | } |
| 832 | +*/ | ||
| 831 | 833 | ||
| 832 | 834 | ||
| 833 | /***********************************************************************//** | 835 | /***********************************************************************//** |
| @@ -1168,6 +1170,7 @@ std::string ctool::set_outfile_name(const std::string& filename) | @@ -1168,6 +1170,7 @@ std::string ctool::set_outfile_name(const std::string& filename) | ||
| 1168 | * Using this method assures that the parameters are always queried in the | 1170 | * Using this method assures that the parameters are always queried in the |
| 1169 | * same order. | 1171 | * same order. |
| 1170 | ***************************************************************************/ | 1172 | ***************************************************************************/ |
| 1173 | +/* | ||
| 1171 | bool ctool::is_stacked(void) | 1174 | bool ctool::is_stacked(void) |
| 1172 | { | 1175 | { |
| 1173 | // First query the minimum and maximum energies | 1176 | // First query the minimum and maximum energies |
| @@ -1192,6 +1195,7 @@ bool ctool::is_stacked(void) | @@ -1192,6 +1195,7 @@ bool ctool::is_stacked(void) | ||
| 1192 | // Return stacked flag | 1195 | // Return stacked flag |
| 1193 | return stacked; | 1196 | return stacked; |
| 1194 | } | 1197 | } |
| 1198 | +*/ | ||
| 1195 | 1199 | ||
| 1196 | 1200 | ||
| 1197 | /***********************************************************************//** | 1201 | /***********************************************************************//** |
| @@ -1455,9 +1459,6 @@ void ctool::set_obs_response(GCTAObservation* obs) | @@ -1455,9 +1459,6 @@ void ctool::set_obs_response(GCTAObservation* obs) | ||
| 1455 | // Attach response to observation | 1459 | // Attach response to observation |
| 1456 | obs->response(response); | 1460 | obs->response(response); |
| 1457 | 1461 | ||
| 1458 | - // Signal response availability | ||
| 1459 | - has_response = true; | ||
| 1460 | - | ||
| 1461 | } // endif: no response information was available | 1462 | } // endif: no response information was available |
| 1462 | 1463 | ||
| 1463 | // Return | 1464 | // Return |
| @@ -1705,6 +1706,7 @@ GSkyDir ctool::get_mean_pointing(const GObservations& obs) | @@ -1705,6 +1706,7 @@ GSkyDir ctool::get_mean_pointing(const GObservations& obs) | ||
| 1705 | * @todo This method is currently not used and can be removed if we do not | 1706 | * @todo This method is currently not used and can be removed if we do not |
| 1706 | * use it | 1707 | * use it |
| 1707 | ***************************************************************************/ | 1708 | ***************************************************************************/ |
| 1709 | +/* | ||
| 1708 | size_t ctool::get_current_rss(void) | 1710 | size_t ctool::get_current_rss(void) |
| 1709 | { | 1711 | { |
| 1710 | // Initialize resident set size | 1712 | // Initialize resident set size |
| @@ -1745,6 +1747,7 @@ size_t ctool::get_current_rss(void) | @@ -1745,6 +1747,7 @@ size_t ctool::get_current_rss(void) | ||
| 1745 | // Return resident set size | 1747 | // Return resident set size |
| 1746 | return rss; | 1748 | return rss; |
| 1747 | } | 1749 | } |
| 1750 | +*/ | ||
| 1748 | 1751 | ||
| 1749 | 1752 | ||
| 1750 | /***********************************************************************//** | 1753 | /***********************************************************************//** |
| @@ -2129,7 +2132,6 @@ void ctool::provide_help(void) const | @@ -2129,7 +2132,6 @@ void ctool::provide_help(void) const | ||
| 2129 | { | 2132 | { |
| 2130 | // Allocate line buffer | 2133 | // Allocate line buffer |
| 2131 | const int n = 1000; | 2134 | const int n = 1000; |
| 2132 | - char line[n]; | ||
| 2133 | 2135 | ||
| 2134 | // Build help file name | 2136 | // Build help file name |
| 2135 | std::string helpfile = name()+".txt"; | 2137 | std::string helpfile = name()+".txt"; |
| @@ -2148,6 +2150,7 @@ void ctool::provide_help(void) const | @@ -2148,6 +2150,7 @@ void ctool::provide_help(void) const | ||
| 2148 | std::string fname = std::string(ptr) + "/share/help/" + helpfile; | 2150 | std::string fname = std::string(ptr) + "/share/help/" + helpfile; |
| 2149 | FILE* fptr = fopen(fname.c_str(), "r"); | 2151 | FILE* fptr = fopen(fname.c_str(), "r"); |
| 2150 | if (fptr != NULL) { | 2152 | if (fptr != NULL) { |
| 2153 | + char line[n]; | ||
| 2151 | while (fgets(line, n, fptr) != NULL) { | 2154 | while (fgets(line, n, fptr) != NULL) { |
| 2152 | std::cout << std::string(line); | 2155 | std::cout << std::string(line); |
| 2153 | } | 2156 | } |
src/support/ctool.hpp
| @@ -90,7 +90,7 @@ protected: | @@ -90,7 +90,7 @@ protected: | ||
| 90 | GCTAObservation create_cta_obs(void); | 90 | GCTAObservation create_cta_obs(void); |
| 91 | 91 | ||
| 92 | // Protected methods that check user parameters | 92 | // Protected methods that check user parameters |
| 93 | - void require_inobs(const std::string& method); | 93 | + //void require_inobs(const std::string& method); |
| 94 | void require_inobs_nolist(const std::string& method); | 94 | void require_inobs_nolist(const std::string& method); |
| 95 | void require_inobs_nocube(const std::string& method); | 95 | void require_inobs_nocube(const std::string& method); |
| 96 | 96 | ||
| @@ -103,7 +103,7 @@ protected: | @@ -103,7 +103,7 @@ protected: | ||
| 103 | std::string set_outfile_name(const std::string& filename); | 103 | std::string set_outfile_name(const std::string& filename); |
| 104 | 104 | ||
| 105 | // Protected methods that query user parameters | 105 | // Protected methods that query user parameters |
| 106 | - bool is_stacked(void); | 106 | + //bool is_stacked(void); |
| 107 | 107 | ||
| 108 | // Protected methods for logging | 108 | // Protected methods for logging |
| 109 | void log_observations(const GChatter& chatter, | 109 | void log_observations(const GChatter& chatter, |
| @@ -122,7 +122,7 @@ protected: | @@ -122,7 +122,7 @@ protected: | ||
| 122 | void set_obs_bounds(GObservations& obs); | 122 | void set_obs_bounds(GObservations& obs); |
| 123 | GObservations get_observations(const bool& get_response = true); | 123 | GObservations get_observations(const bool& get_response = true); |
| 124 | GSkyDir get_mean_pointing(const GObservations& obs); | 124 | GSkyDir get_mean_pointing(const GObservations& obs); |
| 125 | - size_t get_current_rss(void); | 125 | + //size_t get_current_rss(void); |
| 126 | std::string get_obs_header(const GObservation* obs) const; | 126 | std::string get_obs_header(const GObservation* obs) const; |
| 127 | GEnergies insert_energy_boundaries(const GEnergies& energies, | 127 | GEnergies insert_energy_boundaries(const GEnergies& energies, |
| 128 | const GCTAObservation& obs); | 128 | const GCTAObservation& obs); |
test/science_verification.py
| @@ -32,7 +32,7 @@ import csv | @@ -32,7 +32,7 @@ import csv | ||
| 32 | import math | 32 | import math |
| 33 | import sys | 33 | import sys |
| 34 | import gammalib | 34 | import gammalib |
| 35 | -import ctools | 35 | +#import ctools |
| 36 | import cscripts | 36 | import cscripts |
| 37 | 37 | ||
| 38 | 38 | ||
| @@ -100,7 +100,7 @@ def generate_pull_distribution(model, obs='NONE', trials=100, \ | @@ -100,7 +100,7 @@ def generate_pull_distribution(model, obs='NONE', trials=100, \ | ||
| 100 | Name of pull distribution output file | 100 | Name of pull distribution output file |
| 101 | """ | 101 | """ |
| 102 | # Derive parameters | 102 | # Derive parameters |
| 103 | - head, tail = os.path.split(model) | 103 | + _, tail = os.path.split(model) |
| 104 | inmodel = model + '.xml' | 104 | inmodel = model + '.xml' |
| 105 | outfile = 'cspull_' + tail + '.dat' | 105 | outfile = 'cspull_' + tail + '.dat' |
| 106 | 106 | ||
| @@ -164,7 +164,7 @@ def analyse_pull_distribution(filename): | @@ -164,7 +164,7 @@ def analyse_pull_distribution(filename): | ||
| 164 | 164 | ||
| 165 | # Read rows | 165 | # Read rows |
| 166 | first = True | 166 | first = True |
| 167 | - index = -1 | 167 | + #index = -1 |
| 168 | samples = 0.0 | 168 | samples = 0.0 |
| 169 | for row in reader: | 169 | for row in reader: |
| 170 | 170 |
test/test_cscaldb.py
| @@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | -import gammalib | 21 | +#import gammalib |
| 22 | import cscripts | 22 | import cscripts |
| 23 | from testing import test | 23 | from testing import test |
| 24 | 24 |
test/test_csiactdata.py
| @@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | -import gammalib | 21 | +#import gammalib |
| 22 | import cscripts | 22 | import cscripts |
| 23 | from testing import test | 23 | from testing import test |
| 24 | 24 |
test/test_csinfo.py
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | # ========================================================================== | 2 | # ========================================================================== |
| 3 | # This scripts performs unit tests for the csinfo script. | 3 | # This scripts performs unit tests for the csinfo script. |
| 4 | # | 4 | # |
| 5 | -# Copyright (C) 2016 Juergen Knoedlseder | 5 | +# Copyright (C) 2016-2017 Juergen Knoedlseder |
| 6 | # | 6 | # |
| 7 | # This program is free software: you can redistribute it and/or modify | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by | 8 | # it under the terms of the GNU General Public License as published by |
| @@ -18,8 +18,8 @@ | @@ -18,8 +18,8 @@ | ||
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | -import gammalib | ||
| 22 | -import cscripts | 21 | +#import gammalib |
| 22 | +#import cscripts | ||
| 23 | from testing import test | 23 | from testing import test |
| 24 | 24 | ||
| 25 | 25 |
test/test_csmodelinfo.py
| @@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | -import gammalib | 21 | +#import gammalib |
| 22 | import cscripts | 22 | import cscripts |
| 23 | from testing import test | 23 | from testing import test |
| 24 | 24 |
test/test_csmodelselect.py
| @@ -18,7 +18,6 @@ | @@ -18,7 +18,6 @@ | ||
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | -import os | ||
| 22 | import gammalib | 21 | import gammalib |
| 23 | import cscripts | 22 | import cscripts |
| 24 | from testing import test | 23 | from testing import test |
test/test_csmodelsois.py
| @@ -246,7 +246,6 @@ class Test(test): | @@ -246,7 +246,6 @@ class Test(test): | ||
| 246 | """ | 246 | """ |
| 247 | # Get energies (this forces loading in case the map cube is not | 247 | # Get energies (this forces loading in case the map cube is not |
| 248 | # loaded) | 248 | # loaded) |
| 249 | - energies = cube.energies() | ||
| 250 | self.test_value(len(cube.energies()), nmaps, 'Check number of energies') | 249 | self.test_value(len(cube.energies()), nmaps, 'Check number of energies') |
| 251 | 250 | ||
| 252 | # Check dimensions | 251 | # Check dimensions |
test/test_csobsinfo.py
| @@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | -import gammalib | 21 | +#import gammalib |
| 22 | import cscripts | 22 | import cscripts |
| 23 | from testing import test | 23 | from testing import test |
| 24 | 24 |
test/test_csobsselect.py
| @@ -18,7 +18,6 @@ | @@ -18,7 +18,6 @@ | ||
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | -import os | ||
| 22 | import gammalib | 21 | import gammalib |
| 23 | import cscripts | 22 | import cscripts |
| 24 | from testing import test | 23 | from testing import test |
test/test_csroot2caldb.py
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | import os | 21 | import os |
| 22 | -import gammalib | 22 | +#import gammalib |
| 23 | import cscripts | 23 | import cscripts |
| 24 | from testing import test | 24 | from testing import test |
| 25 | 25 |
test/test_cssrcdetect.py
| @@ -18,7 +18,6 @@ | @@ -18,7 +18,6 @@ | ||
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | -import os | ||
| 22 | import gammalib | 21 | import gammalib |
| 23 | import cscripts | 22 | import cscripts |
| 24 | from testing import test | 23 | from testing import test |
test/test_ctbutterfly.py
| @@ -18,7 +18,6 @@ | @@ -18,7 +18,6 @@ | ||
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | -import os | ||
| 22 | import gammalib | 21 | import gammalib |
| 23 | import ctools | 22 | import ctools |
| 24 | from testing import test | 23 | from testing import test |
| @@ -151,7 +150,7 @@ class Test(test): | @@ -151,7 +150,7 @@ class Test(test): | ||
| 151 | self._check_result_file('ctbutterfly_py2.dat') | 150 | self._check_result_file('ctbutterfly_py2.dat') |
| 152 | 151 | ||
| 153 | # Recover observation container | 152 | # Recover observation container |
| 154 | - obs = butterfly.obs() | 153 | + #obs = butterfly.obs() |
| 155 | 154 | ||
| 156 | # TODO: Do someting test on observation container | 155 | # TODO: Do someting test on observation container |
| 157 | 156 |
test/test_cterror.py
| @@ -18,7 +18,6 @@ | @@ -18,7 +18,6 @@ | ||
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | -import os | ||
| 22 | import gammalib | 21 | import gammalib |
| 23 | import ctools | 22 | import ctools |
| 24 | from testing import test | 23 | from testing import test |
test/test_ctlike.py
| @@ -18,7 +18,6 @@ | @@ -18,7 +18,6 @@ | ||
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | -import os | ||
| 22 | import gammalib | 21 | import gammalib |
| 23 | import ctools | 22 | import ctools |
| 24 | from testing import test | 23 | from testing import test |
test/test_ctmapcube.py
| @@ -248,7 +248,6 @@ class Test(test): | @@ -248,7 +248,6 @@ class Test(test): | ||
| 248 | """ | 248 | """ |
| 249 | # Get energies (this forces loading in case the map cube is not | 249 | # Get energies (this forces loading in case the map cube is not |
| 250 | # loaded) | 250 | # loaded) |
| 251 | - energies = cube.energies() | ||
| 252 | self.test_value(len(cube.energies()), nmaps, 'Check number of energies') | 251 | self.test_value(len(cube.energies()), nmaps, 'Check number of energies') |
| 253 | 252 | ||
| 254 | # Check dimensions | 253 | # Check dimensions |
test/test_ctobssim.py
| @@ -239,14 +239,14 @@ class Test(test): | @@ -239,14 +239,14 @@ class Test(test): | ||
| 239 | return | 239 | return |
| 240 | 240 | ||
| 241 | # Check observation | 241 | # Check observation |
| 242 | - def _test_observation(self, ctobssim, nobs=1, | 242 | + def _test_observation(self, obssim, nobs=1, |
| 243 | pnts=[{'ra': 83.63, 'dec': 22.01}]): | 243 | pnts=[{'ra': 83.63, 'dec': 22.01}]): |
| 244 | """ | 244 | """ |
| 245 | Test content of an observation | 245 | Test content of an observation |
| 246 | 246 | ||
| 247 | Parameters | 247 | Parameters |
| 248 | ---------- | 248 | ---------- |
| 249 | - ctobssim : `~ctools.ctobssim` | 249 | + obssim : `~ctools.ctobssim` |
| 250 | ctobssim instance | 250 | ctobssim instance |
| 251 | nobs : int | 251 | nobs : int |
| 252 | Number of observations | 252 | Number of observations |
| @@ -254,10 +254,10 @@ class Test(test): | @@ -254,10 +254,10 @@ class Test(test): | ||
| 254 | List of pointing dictionaries | 254 | List of pointing dictionaries |
| 255 | """ | 255 | """ |
| 256 | # Test observation container | 256 | # Test observation container |
| 257 | - self.test_value(ctobssim.obs().size(), nobs, | 257 | + self.test_value(obssim.obs().size(), nobs, |
| 258 | 'There is one observation') | 258 | 'There is one observation') |
| 259 | - for i in range(ctobssim.obs().size()): | ||
| 260 | - obs = gammalib.GCTAObservation(ctobssim.obs()[i]) | 259 | + for i in range(obssim.obs().size()): |
| 260 | + obs = gammalib.GCTAObservation(obssim.obs()[i]) | ||
| 261 | pnt = obs.pointing() | 261 | pnt = obs.pointing() |
| 262 | self.test_assert(obs.instrument() == 'CTA', | 262 | self.test_assert(obs.instrument() == 'CTA', |
| 263 | 'Observation is CTA observation') | 263 | 'Observation is CTA observation') |
test/test_ctphase.py
| @@ -206,14 +206,14 @@ class Test(test): | @@ -206,14 +206,14 @@ class Test(test): | ||
| 206 | # Test invalid source name | 206 | # Test invalid source name |
| 207 | self.test_try('Test ctphase with invalid source name') | 207 | self.test_try('Test ctphase with invalid source name') |
| 208 | try: | 208 | try: |
| 209 | - test = ctools.ctphase() | ||
| 210 | - test['inobs'] = self._events | ||
| 211 | - test['inmodel'] = self._model_file | ||
| 212 | - test['srcname'] = 'Venus' | ||
| 213 | - test['outobs'] = 'ctphase_py5.fits' | ||
| 214 | - test['logfile'] = 'ctphase_py5.log' | ||
| 215 | - test.logFileOpen() | ||
| 216 | - test.execute() | 209 | + phase = ctools.ctphase() |
| 210 | + phase['inobs'] = self._events | ||
| 211 | + phase['inmodel'] = self._model_file | ||
| 212 | + phase['srcname'] = 'Venus' | ||
| 213 | + phase['outobs'] = 'ctphase_py5.fits' | ||
| 214 | + phase['logfile'] = 'ctphase_py5.log' | ||
| 215 | + phase.logFileOpen() | ||
| 216 | + phase.execute() | ||
| 217 | self.test_try_failure('Exception not thrown') | 217 | self.test_try_failure('Exception not thrown') |
| 218 | except (ValueError): | 218 | except (ValueError): |
| 219 | self.test_try_success() | 219 | self.test_try_success() |
| @@ -221,14 +221,14 @@ class Test(test): | @@ -221,14 +221,14 @@ class Test(test): | ||
| 221 | # Test invalid model type | 221 | # Test invalid model type |
| 222 | self.test_try('Test ctphase with invalid model') | 222 | self.test_try('Test ctphase with invalid model') |
| 223 | try: | 223 | try: |
| 224 | - test = ctools.ctphase() | ||
| 225 | - test['inobs'] = self._events | ||
| 226 | - test['inmodel'] = self._model | ||
| 227 | - test['srcname'] = 'Background' | ||
| 228 | - test['outobs'] = 'ctphase_py6.fits' | ||
| 229 | - test['logfile'] = 'ctphase_py6.log' | ||
| 230 | - test.logFileOpen() | ||
| 231 | - test.execute() | 224 | + phase = ctools.ctphase() |
| 225 | + phase['inobs'] = self._events | ||
| 226 | + phase['inmodel'] = self._model | ||
| 227 | + phase['srcname'] = 'Background' | ||
| 228 | + phase['outobs'] = 'ctphase_py6.fits' | ||
| 229 | + phase['logfile'] = 'ctphase_py6.log' | ||
| 230 | + phase.logFileOpen() | ||
| 231 | + phase.execute() | ||
| 232 | self.test_try_failure('Exception not thrown') | 232 | self.test_try_failure('Exception not thrown') |
| 233 | except (ValueError): | 233 | except (ValueError): |
| 234 | self.test_try_success() | 234 | self.test_try_success() |
| @@ -236,14 +236,14 @@ class Test(test): | @@ -236,14 +236,14 @@ class Test(test): | ||
| 236 | # Test invalid model without temporal phase curve model | 236 | # Test invalid model without temporal phase curve model |
| 237 | self.test_try('Test ctphase with invalid model') | 237 | self.test_try('Test ctphase with invalid model') |
| 238 | try: | 238 | try: |
| 239 | - test = ctools.ctphase() | ||
| 240 | - test['inobs'] = self._events | ||
| 241 | - test['inmodel'] = self._model | ||
| 242 | - test['srcname'] = 'Crab' | ||
| 243 | - test['outobs'] = 'ctphase_py7.fits' | ||
| 244 | - test['logfile'] = 'ctphase_py7.log' | ||
| 245 | - test.logFileOpen() | ||
| 246 | - test.execute() | 239 | + phase = ctools.ctphase() |
| 240 | + phase['inobs'] = self._events | ||
| 241 | + phase['inmodel'] = self._model | ||
| 242 | + phase['srcname'] = 'Crab' | ||
| 243 | + phase['outobs'] = 'ctphase_py7.fits' | ||
| 244 | + phase['logfile'] = 'ctphase_py7.log' | ||
| 245 | + phase.logFileOpen() | ||
| 246 | + phase.execute() | ||
| 247 | self.test_try_failure('Exception not thrown') | 247 | self.test_try_failure('Exception not thrown') |
| 248 | except (ValueError): | 248 | except (ValueError): |
| 249 | self.test_try_success() | 249 | self.test_try_success() |
test/test_ctulimit.py
| @@ -18,8 +18,7 @@ | @@ -18,8 +18,7 @@ | ||
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | -import os | ||
| 22 | -import gammalib | 21 | +#import gammalib |
| 23 | import ctools | 22 | import ctools |
| 24 | from testing import test | 23 | from testing import test |
| 25 | 24 | ||
| @@ -79,9 +78,6 @@ class Test(test): | @@ -79,9 +78,6 @@ class Test(test): | ||
| 79 | self.test_assert(self._execute(cmd) == 0, | 78 | self.test_assert(self._execute(cmd) == 0, |
| 80 | 'Check successful execution from command line') | 79 | 'Check successful execution from command line') |
| 81 | 80 | ||
| 82 | - # Check result file | ||
| 83 | - self._check_result_file('ctulimit_cmd1.log') | ||
| 84 | - | ||
| 85 | # Setup ctulimit command | 81 | # Setup ctulimit command |
| 86 | cmd = ctulimit+' inobs="event_file_that_does_not_exist.fits"'+ \ | 82 | cmd = ctulimit+' inobs="event_file_that_does_not_exist.fits"'+ \ |
| 87 | ' inmodel="'+self._model+'" srcname="Crab"'+ \ | 83 | ' inmodel="'+self._model+'" srcname="Crab"'+ \ |
| @@ -255,11 +251,3 @@ class Test(test): | @@ -255,11 +251,3 @@ class Test(test): | ||
| 255 | 251 | ||
| 256 | # Return | 252 | # Return |
| 257 | return | 253 | return |
| 258 | - | ||
| 259 | - # Check result file | ||
| 260 | - def _check_result_file(self, filename): | ||
| 261 | - """ | ||
| 262 | - Check result file | ||
| 263 | - """ | ||
| 264 | - # Return | ||
| 265 | - return |
test/test_examples.py.in
| @@ -19,10 +19,7 @@ | @@ -19,10 +19,7 @@ | ||
| 19 | # | 19 | # |
| 20 | # ========================================================================== | 20 | # ========================================================================== |
| 21 | import os | 21 | import os |
| 22 | -import sys | ||
| 23 | import gammalib | 22 | import gammalib |
| 24 | -import ctools | ||
| 25 | -import cscripts | ||
| 26 | 23 | ||
| 27 | 24 | ||
| 28 | # =============================================== # | 25 | # =============================================== # |