Commit 9c93dcc7ddca24b4929cc10e9fb60ddf5456ce92

Authored by Jürgen Knödlseder
1 parent e285d731

Adapt to Python 3.

Showing 1 changed file with 10 additions and 10 deletions
test/example_models.py
... ... @@ -3,7 +3,7 @@
3 3 # This script performs an unbinned maximum likelihood analysis for a
4 4 # variety of models. This allows checking the models.
5 5 #
6   -# Copyright (C) 2011 Jurgen Knodlseder
  6 +# Copyright (C) 2011-2012 Juergen Knoedlseder
7 7 #
8 8 # This program is free software: you can redistribute it and/or modify
9 9 # it under the terms of the GNU General Public License as published by
... ... @@ -51,7 +51,7 @@ def pipeline(model_name):
51 51 rad_select = 3.0
52 52  
53 53 # Write model name
54   - print "Model: "+model_name
  54 + print("Model: "+model_name)
55 55  
56 56 # Initialise timing
57 57 wall_seconds = 0.0
... ... @@ -87,7 +87,7 @@ def pipeline(model_name):
87 87 like.run()
88 88  
89 89 # Show model fitting results
90   - print like.obs().models()[0]
  90 + print(like.obs().models()[0])
91 91  
92 92 # Return
93 93 return
... ... @@ -111,7 +111,7 @@ if __name__ == '__main__':
111 111 show_data = True
112 112  
113 113 # Test for command line arguments
114   - print sys.argv[0]
  114 + print(sys.argv[0])
115 115 if (len(sys.argv) > 1):
116 116 if sys.argv[1] == "-h":
117 117 need_help = True
... ... @@ -122,15 +122,15 @@ if __name__ == '__main__':
122 122  
123 123 # Print help if needed and exit
124 124 if need_help:
125   - print "Usage: example_models.py [OPTIONS]"
126   - print " -h Display this usage message"
127   - print " -noshow Do not show data using matplotlib"
  125 + print("Usage: example_models.py [OPTIONS]")
  126 + print(" -h Display this usage message")
  127 + print(" -noshow Do not show data using matplotlib")
128 128 sys.exit()
129 129  
130 130 # Dump header
131   - print "********************************"
132   - print "* CTA unbinned analysis script *"
133   - print "********************************"
  131 + print("********************************")
  132 + print("* CTA unbinned analysis script *")
  133 + print("********************************")
134 134  
135 135 # Perform analysis for Crab model
136 136 pipeline("data/crab.xml")
... ...