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