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