Commit 8caf69149b5e2bc383286c1ddf3cd4ec9d15334f

Authored by Jürgen Knödlseder
1 parent 819fd835

Replace iteritems() by items() in csmodelinfo.

iteritems() does no longer exist in Python 3.
Showing 1 changed file with 6 additions and 10 deletions
cscripts/csmodelinfo.py
... ... @@ -233,11 +233,10 @@ class csmodelinfo(ctools.cscript):
233 233 # Log summary
234 234 self.log("\n")
235 235 self.log.header1("Summary")
236   - self.log("\n")
237 236  
238 237 # Log instruments
239 238 self.log.header3("Instrument specific models")
240   - for inst, n_inst in instruments.iteritems():
  239 + for inst, n_inst in instruments.items():
241 240 if inst == "":
242 241 inst = "All"
243 242 self.log.parformat(inst)
... ... @@ -245,16 +244,15 @@ class csmodelinfo(ctools.cscript):
245 244 self.log("\n")
246 245  
247 246 # Log model types
248   - self.log("\n")
249 247 self.log.header3("Model types")
250   - for modeltype, n_types in types.iteritems():
  248 + for modeltype, n_types in types.items():
251 249 self.log.parformat(modeltype)
252 250 self.log(str(n_types))
253 251 self.log("\n")
254 252  
255 253 # Log parameter information
256 254 self.log("\n")
257   - self.log.header2("Parameter information")
  255 + self.log.header1("Parameter information")
258 256 self.log.parformat("All parameters")
259 257 self.log(str(n_par_total))
260 258 self.log("\n")
... ... @@ -285,12 +283,11 @@ class csmodelinfo(ctools.cscript):
285 283 self.log.parformat("Parameters at limit")
286 284 self.log(str(n_par_at_limit))
287 285 self.log("\n")
288   - self.log("\n")
289 286  
290 287 # Log parameters at limit (if any)
291 288 if n_par_at_limit > 0:
292 289 self.log.header3("Parameters at limit")
293   - for source, parameter in pars_at_limit.iteritems():
  290 + for source, parameter in pars_at_limit.items():
294 291 if len(parameter):
295 292 for par in parameter:
296 293 self.log.parformat(source)
... ... @@ -301,7 +298,7 @@ class csmodelinfo(ctools.cscript):
301 298 if self.logExplicit() and len(free_src_pars):
302 299 self.log("\n")
303 300 self.log.header2("Free source parameters")
304   - for source, parameter in free_src_pars.iteritems():
  301 + for source, parameter in free_src_pars.items():
305 302 if len(parameter):
306 303 self.log.header3(source)
307 304 for par in parameter:
... ... @@ -312,7 +309,7 @@ class csmodelinfo(ctools.cscript):
312 309 # Log TS values if available
313 310 if len(ts):
314 311 self.log.header3("Test statistics")
315   - for source,tsvalue in ts.iteritems():
  312 + for source,tsvalue in ts.items():
316 313 self.log.parformat(source)
317 314 self.log("%.2f"%tsvalue)
318 315 self.log("\n")
... ... @@ -330,7 +327,6 @@ class csmodelinfo(ctools.cscript):
330 327  
331 328 self.log("\n")
332 329 self.log.header1("Save region file")
333   - self.log("\n")
334 330  
335 331 # Open file
336 332 f = open(self.ds9file,"w")
... ...