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,7 +3,7 @@
3 # This script performs an unbinned maximum likelihood analysis for a 3 # This script performs an unbinned maximum likelihood analysis for a
4 # variety of models. This allows checking the models. 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 # This program is free software: you can redistribute it and/or modify 8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by 9 # it under the terms of the GNU General Public License as published by
@@ -51,7 +51,7 @@ def pipeline(model_name): @@ -51,7 +51,7 @@ def pipeline(model_name):
51 rad_select = 3.0 51 rad_select = 3.0
52 52
53 # Write model name 53 # Write model name
54 - print "Model: "+model_name 54 + print("Model: "+model_name)
55 55
56 # Initialise timing 56 # Initialise timing
57 wall_seconds = 0.0 57 wall_seconds = 0.0
@@ -87,7 +87,7 @@ def pipeline(model_name): @@ -87,7 +87,7 @@ def pipeline(model_name):
87 like.run() 87 like.run()
88 88
89 # Show model fitting results 89 # Show model fitting results
90 - print like.obs().models()[0] 90 + print(like.obs().models()[0])
91 91
92 # Return 92 # Return
93 return 93 return
@@ -111,7 +111,7 @@ if __name__ == '__main__': @@ -111,7 +111,7 @@ if __name__ == '__main__':
111 show_data = True 111 show_data = True
112 112
113 # Test for command line arguments 113 # Test for command line arguments
114 - print sys.argv[0] 114 + print(sys.argv[0])
115 if (len(sys.argv) > 1): 115 if (len(sys.argv) > 1):
116 if sys.argv[1] == "-h": 116 if sys.argv[1] == "-h":
117 need_help = True 117 need_help = True
@@ -122,15 +122,15 @@ if __name__ == '__main__': @@ -122,15 +122,15 @@ if __name__ == '__main__':
122 122
123 # Print help if needed and exit 123 # Print help if needed and exit
124 if need_help: 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 sys.exit() 128 sys.exit()
129 129
130 # Dump header 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 # Perform analysis for Crab model 135 # Perform analysis for Crab model
136 pipeline("data/crab.xml") 136 pipeline("data/crab.xml")