Commit 98256666c264d23dd22955eea53a2420542b9c10

Authored by Michael Mayer
2 parents 02b0b1c2 4380d4e2

Merge branch 'devel' of https://cta-gitlab.irap.omp.eu/ctools/ctools into 1646-write-iact-docs

ChangeLog
1 -2016-02-24 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu> 1 +2016-02-25 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
2 2
3 * Version 1.1.0 released 3 * Version 1.1.0 released
4 ======================== 4 ========================
5 5
  6 + Adapt to revise GTime operators (#1714)
6 Add publish() methods to tools producing images (#1710) 7 Add publish() methods to tools producing images (#1710)
7 Read ahead output filename in cterror (#1700) 8 Read ahead output filename in cterror (#1700)
8 Subdivide simulation energy range in ctobssim (#1673) 9 Subdivide simulation energy range in ctobssim (#1673)
@@ -2,7 +2,7 @@ New Features and Important Changes in ctools 1.1.0 @@ -2,7 +2,7 @@ New Features and Important Changes in ctools 1.1.0
2 2
3 Author(s) : Juergen Knoedlseder 3 Author(s) : Juergen Knoedlseder
4 4
5 -24 February 2016 5 +25 February 2016
6 6
7 7
8 1. Introduction 8 1. Introduction
cscripts/cslightcrv.py
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # ========================================================================== 2 # ==========================================================================
3 # Light curve generation script. 3 # Light curve generation script.
4 # 4 #
5 -# Copyright (C) 2014-2015 Michael Mayer 5 +# Copyright (C) 2014-2016 Michael Mayer
6 # 6 #
7 # This program is free software: you can redistribute it and/or modify 7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by 8 # it under the terms of the GNU General Public License as published by
@@ -22,6 +22,7 @@ import gammalib @@ -22,6 +22,7 @@ import gammalib
22 import ctools 22 import ctools
23 import sys 23 import sys
24 24
  25 +
25 # ============ # 26 # ============ #
26 # csspec class # 27 # csspec class #
27 # ============ # 28 # ============ #
@@ -358,14 +359,12 @@ class cslightcrv(ctools.cscript): @@ -358,14 +359,12 @@ class cslightcrv(ctools.cscript):
358 tmax = self.m_tbins.tstop(i) 359 tmax = self.m_tbins.tstop(i)
359 360
360 # Compute time bin center and time width 361 # Compute time bin center and time width
361 - tmean = (tmin + tmax)  
362 - tmean *= 0.5  
363 - twidth = (tmax - tmin)  
364 - twidth *= 0.5 362 + twidth = 0.5 * (tmax - tmin) # in seconds
  363 + tmean = tmin + twidth
365 364
366 # Store time as MJD 365 # Store time as MJD
367 - MJD[i] = tmean.mjd()  
368 - e_MJD[i] = twidth.days() 366 + MJD[i] = tmean.mjd()
  367 + e_MJD[i] = twidth / gammalib.sec_in_day # in days
369 368
370 # Log information 369 # Log information
371 if self.logExplicit(): 370 if self.logExplicit():
cscripts/csobsinfo.py
@@ -186,9 +186,7 @@ class csobsinfo(ctools.cscript): @@ -186,9 +186,7 @@ class csobsinfo(ctools.cscript):
186 obs_gti = obs.events().gti() 186 obs_gti = obs.events().gti()
187 187
188 # Compute mean time and dead time fraction in percent 188 # Compute mean time and dead time fraction in percent
189 - tmean = (obs_gti.tstart() + obs_gti.tstop())  
190 - tmean *= 0.5  
191 - deadfrac = (1.0-obs.deadc(tmean))*100.0 189 + deadfrac = (1.0-obs.deadc())*100.0
192 190
193 # Retrieve pointing and store Ra,Dec 191 # Retrieve pointing and store Ra,Dec
194 pnt_dir = obs.pointing().dir() 192 pnt_dir = obs.pointing().dir()
@@ -202,8 +200,8 @@ class csobsinfo(ctools.cscript): @@ -202,8 +200,8 @@ class csobsinfo(ctools.cscript):
202 # Append time interval 200 # Append time interval
203 self.m_gti.append(obs_gti.tstart(), obs_gti.tstop()) 201 self.m_gti.append(obs_gti.tstart(), obs_gti.tstop())
204 202
205 - # increment global livetime and ontime  
206 - ontime += obs.ontime() 203 + # Increment global livetime and ontime
  204 + ontime += obs.ontime()
207 livetime += obs.livetime() 205 livetime += obs.livetime()
208 206
209 # Log the event type (binned or unbinned) 207 # Log the event type (binned or unbinned)
src/ctobssim/ctobssim.cpp
@@ -947,17 +947,16 @@ void ctobssim::simulate_interval(GCTAObservation* obs, @@ -947,17 +947,16 @@ void ctobssim::simulate_interval(GCTAObservation* obs,
947 double flux = get_model_flux(model, emin, emax, dir, rad, 947 double flux = get_model_flux(model, emin, emax, dir, rad,
948 indent, wrklog); 948 indent, wrklog);
949 double rate = flux * area; 949 double rate = flux * area;
950 - double duration = 1800.0; // default: 1800 sec 950 + double duration = 1800.0; // default: 1800 sec
951 if (rate > 0.0) { 951 if (rate > 0.0) {
952 duration = m_max_photons / rate; 952 duration = m_max_photons / rate;
953 - if (duration < 1.0) { // not <1 sec 953 + if (duration < 1.0) { // not <1 sec
954 duration = 1.0; 954 duration = 1.0;
955 } 955 }
956 else if (duration > 180000.0) { // not >50 hr 956 else if (duration > 180000.0) { // not >50 hr
957 duration = 180000.0; 957 duration = 180000.0;
958 } 958 }
959 } 959 }
960 - GTime tslice(duration, "sec");  
961 960
962 // Skip model if photon rate is 0 961 // Skip model if photon rate is 0
963 if (rate <= 0.0) { 962 if (rate <= 0.0) {
@@ -983,16 +982,16 @@ void ctobssim::simulate_interval(GCTAObservation* obs, @@ -983,16 +982,16 @@ void ctobssim::simulate_interval(GCTAObservation* obs,
983 " photons/s for model \""+mod+"\" exceeds " 982 " photons/s for model \""+mod+"\" exceeds "
984 "maximum allowed photon rate of "+ 983 "maximum allowed photon rate of "+
985 gammalib::str(m_max_rate)+" photons/s. " 984 gammalib::str(m_max_rate)+" photons/s. "
986 - "Please check the model parameters for "  
987 - "model \""+mod+"\" or increase the value "  
988 - "of the \"maxrate\" parameter."; 985 + "Please check the parameters of model "
  986 + "\""+mod+"\" or increase the value of the "
  987 + "\"maxrate\" parameter.";
989 throw GException::invalid_value(G_SIMULATE_INTERVAL, msg); 988 throw GException::invalid_value(G_SIMULATE_INTERVAL, msg);
990 } 989 }
991 990
992 // To reduce memory requirements we split long time intervals into 991 // To reduce memory requirements we split long time intervals into
993 // several time slices 992 // several time slices
994 GTime tstart = tmin; 993 GTime tstart = tmin;
995 - GTime tstop = tstart + tslice; 994 + GTime tstop = tstart + duration;
996 995
997 // Save state of photon and event counters before doing the 996 // Save state of photon and event counters before doing the
998 // simulation 997 // simulation
@@ -1009,7 +1008,7 @@ void ctobssim::simulate_interval(GCTAObservation* obs, @@ -1009,7 +1008,7 @@ void ctobssim::simulate_interval(GCTAObservation* obs,
1009 1008
1010 // Log time slice 1009 // Log time slice
1011 if (logExplicit()) { 1010 if (logExplicit()) {
1012 - if (tmax - tmin > tslice) { 1011 + if (tmax - tmin > duration) {
1013 indent++; 1012 indent++;
1014 wrklog->indent(indent); 1013 wrklog->indent(indent);
1015 } 1014 }
@@ -1030,11 +1029,11 @@ void ctobssim::simulate_interval(GCTAObservation* obs, @@ -1030,11 +1029,11 @@ void ctobssim::simulate_interval(GCTAObservation* obs,
1030 1029
1031 // Go to next time slice 1030 // Go to next time slice
1032 tstart = tstop; 1031 tstart = tstop;
1033 - tstop = tstart + tslice; 1032 + tstop = tstart + duration;
1034 1033
1035 // Reset indentation 1034 // Reset indentation
1036 if (logExplicit()) { 1035 if (logExplicit()) {
1037 - if (tmax - tmin > tslice) { 1036 + if (tmax - tmin > duration) {
1038 indent--; 1037 indent--;
1039 wrklog->indent(indent); 1038 wrklog->indent(indent);
1040 } 1039 }
src/ctselect/ctselect.cpp
@@ -954,9 +954,8 @@ void ctselect::select_events(GCTAObservation* obs, @@ -954,9 +954,8 @@ void ctselect::select_events(GCTAObservation* obs,
954 } 954 }
955 955
956 // Recompute ontime and livetime. 956 // Recompute ontime and livetime.
957 - GTime meantime = 0.5 * (list->gti().tstart() + list->gti().tstop());  
958 obs->ontime(list->gti().ontime()); 957 obs->ontime(list->gti().ontime());
959 - obs->livetime(list->gti().ontime() * obs->deadc(meantime)); 958 + obs->livetime(list->gti().ontime() * obs->deadc());
960 959
961 // Return 960 // Return
962 return; 961 return;
src/ctskymap/ctskymap.cpp
@@ -325,8 +325,14 @@ void ctskymap::save(void) @@ -325,8 +325,14 @@ void ctskymap::save(void)
325 log << "Save sky map into file \""+m_outmap+"\"." << std::endl; 325 log << "Save sky map into file \""+m_outmap+"\"." << std::endl;
326 } 326 }
327 327
328 - // Save sky map  
329 - m_skymap.save(m_outmap, clobber()); 328 + // Create empty FITS file
  329 + GFits fits;
  330 +
  331 + // Write sky map into FITS file
  332 + m_skymap.write(fits);
  333 +
  334 + // Save FITS file to disk
  335 + fits.saveto(m_outmap, clobber());
330 336
331 } 337 }
332 338
test/test_ctbin.py
@@ -83,8 +83,10 @@ class Test(gammalib.GPythonTestSuite): @@ -83,8 +83,10 @@ class Test(gammalib.GPythonTestSuite):
83 try: 83 try:
84 bin.run() 84 bin.run()
85 self.test_try_success() 85 self.test_try_success()
86 - except Exception, e:  
87 - msg = "Exception occured in ctbin: %s." % (e,) 86 + #except Exception as e:
  87 + # msg = "Exception occured in ctbin: %s." % (e,)
  88 + except:
  89 + msg = "Exception occured in ctbin."
88 self.test_try_failure(msg) 90 self.test_try_failure(msg)
89 91
90 # Save counts cube 92 # Save counts cube
@@ -92,8 +94,10 @@ class Test(gammalib.GPythonTestSuite): @@ -92,8 +94,10 @@ class Test(gammalib.GPythonTestSuite):
92 try: 94 try:
93 bin.save() 95 bin.save()
94 self.test_try_success() 96 self.test_try_success()
95 - except Exception, e:  
96 - msg = "Exception occured in saving counts cube: %s." % (e,) 97 + #except Exception as e:
  98 + # msg = "Exception occured in saving counts cube: %s." % (e,)
  99 + except:
  100 + msg = "Exception occured in saving counts cube."
97 self.test_try_failure(msg) 101 self.test_try_failure(msg)
98 102
99 # Return 103 # Return
test/test_ctbkgcube.py
@@ -91,8 +91,10 @@ class Test(gammalib.GPythonTestSuite): @@ -91,8 +91,10 @@ class Test(gammalib.GPythonTestSuite):
91 try: 91 try:
92 bkgcube.run() 92 bkgcube.run()
93 self.test_try_success() 93 self.test_try_success()
94 - except Exception, e:  
95 - msg = "Exception occured in ctbkgcube: %s." % (e,) 94 + #except Exception as e:
  95 + # msg = "Exception occured in ctbkgcube: %s." % (e,)
  96 + except:
  97 + msg = "Exception occured in ctbkgcube."
96 self.test_try_failure(msg) 98 self.test_try_failure(msg)
97 99
98 # Save background cube 100 # Save background cube
@@ -100,8 +102,10 @@ class Test(gammalib.GPythonTestSuite): @@ -100,8 +102,10 @@ class Test(gammalib.GPythonTestSuite):
100 try: 102 try:
101 bkgcube.save() 103 bkgcube.save()
102 self.test_try_success() 104 self.test_try_success()
103 - except Exception, e:  
104 - msg = "Exception occured in saving background cube: %s." % (e,) 105 + #except Exception as e:
  106 + # msg = "Exception occured in saving background cube: %s." % (e,)
  107 + except:
  108 + msg = "Exception occured in saving background cube."
105 self.test_try_failure(msg) 109 self.test_try_failure(msg)
106 110
107 # Return 111 # Return
test/test_ctbutterfly.py
@@ -81,8 +81,10 @@ class Test(gammalib.GPythonTestSuite): @@ -81,8 +81,10 @@ class Test(gammalib.GPythonTestSuite):
81 try: 81 try:
82 butterfly.run() 82 butterfly.run()
83 self.test_try_success() 83 self.test_try_success()
84 - except Exception, e:  
85 - msg = "Exception occured in ctbutterfly: %s." % (e,) 84 + #except Exception as e:
  85 + # msg = "Exception occured in ctbutterfly: %s." % (e,)
  86 + except:
  87 + msg = "Exception occured in ctbutterfly."
86 self.test_try_failure(msg) 88 self.test_try_failure(msg)
87 89
88 # Save results 90 # Save results
@@ -90,8 +92,10 @@ class Test(gammalib.GPythonTestSuite): @@ -90,8 +92,10 @@ class Test(gammalib.GPythonTestSuite):
90 try: 92 try:
91 butterfly.save() 93 butterfly.save()
92 self.test_try_success() 94 self.test_try_success()
93 - except Exception, e:  
94 - msg = "Exception occured in saving butterfly diagram: %s." % (e,) 95 + #except Exception as e:
  96 + # msg = "Exception occured in saving butterfly diagram: %s." % (e,)
  97 + except:
  98 + msg = "Exception occured in saving butterfly diagram."
95 self.test_try_failure(msg) 99 self.test_try_failure(msg)
96 100
97 # Return 101 # Return
test/test_ctcubemask.py
@@ -79,8 +79,10 @@ class Test(gammalib.GPythonTestSuite): @@ -79,8 +79,10 @@ class Test(gammalib.GPythonTestSuite):
79 try: 79 try:
80 mask.run() 80 mask.run()
81 self.test_try_success() 81 self.test_try_success()
82 - except Exception, e:  
83 - msg = "Exception occured in ctcubemask: %s." % (e,) 82 + #except Exception as e:
  83 + # msg = "Exception occured in ctcubemask: %s." % (e,)
  84 + except:
  85 + msg = "Exception occured in ctcubemask."
84 self.test_try_failure(msg) 86 self.test_try_failure(msg)
85 87
86 # Save counts cube 88 # Save counts cube
@@ -88,8 +90,10 @@ class Test(gammalib.GPythonTestSuite): @@ -88,8 +90,10 @@ class Test(gammalib.GPythonTestSuite):
88 try: 90 try:
89 mask.save() 91 mask.save()
90 self.test_try_success() 92 self.test_try_success()
91 - except Exception, e:  
92 - msg = "Exception occured in saving counts cube: %s." % (e,) 93 + #except Exception as e:
  94 + # msg = "Exception occured in saving counts cube: %s." % (e,)
  95 + except:
  96 + msg = "Exception occured in saving counts cube."
93 self.test_try_failure(msg) 97 self.test_try_failure(msg)
94 98
95 # Return 99 # Return
test/test_cterror.py
@@ -80,8 +80,10 @@ class Test(gammalib.GPythonTestSuite): @@ -80,8 +80,10 @@ class Test(gammalib.GPythonTestSuite):
80 try: 80 try:
81 error.run() 81 error.run()
82 self.test_try_success() 82 self.test_try_success()
83 - except Exception, e:  
84 - msg = "Exception occured in cterror: %s." % (e,) 83 + #except Exception as e:
  84 + # msg = "Exception occured in cterror: %s." % (e,)
  85 + except:
  86 + msg = "Exception occured in cterror."
85 self.test_try_failure(msg) 87 self.test_try_failure(msg)
86 88
87 # Save results 89 # Save results
@@ -89,8 +91,10 @@ class Test(gammalib.GPythonTestSuite): @@ -89,8 +91,10 @@ class Test(gammalib.GPythonTestSuite):
89 try: 91 try:
90 error.save() 92 error.save()
91 self.test_try_success() 93 self.test_try_success()
92 - except Exception, e:  
93 - msg = "Exception occured in saving results: %s." % (e,) 94 + #except Exception as e:
  95 + # msg = "Exception occured in saving results: %s." % (e,)
  96 + except:
  97 + msg = "Exception occured in saving results."
94 self.test_try_failure(msg) 98 self.test_try_failure(msg)
95 99
96 # Return 100 # Return
test/test_ctexpcube.py
@@ -88,8 +88,10 @@ class Test(gammalib.GPythonTestSuite): @@ -88,8 +88,10 @@ class Test(gammalib.GPythonTestSuite):
88 try: 88 try:
89 expcube.run() 89 expcube.run()
90 self.test_try_success() 90 self.test_try_success()
91 - except Exception, e:  
92 - msg = "Exception occured in ctexpcube: %s." % (e,) 91 + #except Exception as e:
  92 + # msg = "Exception occured in ctexpcube: %s." % (e,)
  93 + except:
  94 + msg = "Exception occured in ctexpcube."
93 self.test_try_failure(msg) 95 self.test_try_failure(msg)
94 96
95 # Save exposure cube 97 # Save exposure cube
@@ -97,8 +99,10 @@ class Test(gammalib.GPythonTestSuite): @@ -97,8 +99,10 @@ class Test(gammalib.GPythonTestSuite):
97 try: 99 try:
98 expcube.save() 100 expcube.save()
99 self.test_try_success() 101 self.test_try_success()
100 - except Exception, e:  
101 - msg = "Exception occured in saving exposure cube: %s." % (e,) 102 + #except Exception as e:
  103 + # msg = "Exception occured in saving exposure cube: %s." % (e,)
  104 + except:
  105 + msg = "Exception occured in saving exposure cube."
102 self.test_try_failure(msg) 106 self.test_try_failure(msg)
103 107
104 # Return 108 # Return
test/test_ctlike.py
@@ -78,8 +78,10 @@ class Test(gammalib.GPythonTestSuite): @@ -78,8 +78,10 @@ class Test(gammalib.GPythonTestSuite):
78 try: 78 try:
79 like.run() 79 like.run()
80 self.test_try_success() 80 self.test_try_success()
81 - except Exception, e:  
82 - msg = "Exception occured in ctlike: %s." % (e,) 81 + #except Exception as e:
  82 + # msg = "Exception occured in ctlike: %s." % (e,)
  83 + except:
  84 + msg = "Exception occured in ctlike."
83 self.test_try_failure(msg) 85 self.test_try_failure(msg)
84 86
85 # Save results 87 # Save results
@@ -87,8 +89,10 @@ class Test(gammalib.GPythonTestSuite): @@ -87,8 +89,10 @@ class Test(gammalib.GPythonTestSuite):
87 try: 89 try:
88 like.save() 90 like.save()
89 self.test_try_success() 91 self.test_try_success()
90 - except Exception, e:  
91 - msg = "Exception occured in saving results: %s." % (e,) 92 + #except Exception as e:
  93 + # msg = "Exception occured in saving results: %s." % (e,)
  94 + except:
  95 + msg = "Exception occured in saving results."
92 self.test_try_failure(msg) 96 self.test_try_failure(msg)
93 97
94 # Return 98 # Return
test/test_ctmodel.py
@@ -96,8 +96,10 @@ class Test(gammalib.GPythonTestSuite): @@ -96,8 +96,10 @@ class Test(gammalib.GPythonTestSuite):
96 try: 96 try:
97 model.run() 97 model.run()
98 self.test_try_success() 98 self.test_try_success()
99 - except Exception, e:  
100 - msg = "Exception occured in ctmodel: %s." % (e,) 99 + #except Exception as e:
  100 + # msg = "Exception occured in ctmodel: %s." % (e,)
  101 + except:
  102 + msg = "Exception occured in ctmodel."
101 self.test_try_failure(msg) 103 self.test_try_failure(msg)
102 104
103 # Save counts cube 105 # Save counts cube
@@ -105,8 +107,10 @@ class Test(gammalib.GPythonTestSuite): @@ -105,8 +107,10 @@ class Test(gammalib.GPythonTestSuite):
105 try: 107 try:
106 model.save() 108 model.save()
107 self.test_try_success() 109 self.test_try_success()
108 - except Exception, e:  
109 - msg = "Exception occured in saving model cube: %s." % (e,) 110 + #except Exception as e:
  111 + # msg = "Exception occured in saving model cube: %s." % (e,)
  112 + except:
  113 + msg = "Exception occured in saving model cube."
110 self.test_try_failure(msg) 114 self.test_try_failure(msg)
111 115
112 # Return 116 # Return
test/test_ctobssim.py
@@ -84,8 +84,10 @@ class Test(gammalib.GPythonTestSuite): @@ -84,8 +84,10 @@ class Test(gammalib.GPythonTestSuite):
84 try: 84 try:
85 sim.run() 85 sim.run()
86 self.test_try_success() 86 self.test_try_success()
87 - except Exception, e:  
88 - msg = "Exception occured in ctobssim: %s." % (e,) 87 + #except Exception as e:
  88 + # msg = "Exception occured in ctobssim: %s." % (e,)
  89 + except:
  90 + msg = "Exception occured in ctobssim."
89 self.test_try_failure(msg) 91 self.test_try_failure(msg)
90 92
91 # Retrieve observation and check content 93 # Retrieve observation and check content
@@ -105,8 +107,10 @@ class Test(gammalib.GPythonTestSuite): @@ -105,8 +107,10 @@ class Test(gammalib.GPythonTestSuite):
105 try: 107 try:
106 sim.save() 108 sim.save()
107 self.test_try_success() 109 self.test_try_success()
108 - except Exception, e:  
109 - msg = "Exception occured in saving events: %s." % (e,) 110 + #except Exception as e:
  111 + # msg = "Exception occured in saving events: %s." % (e,)
  112 + except:
  113 + msg = "Exception occured in saving events."
110 self.test_try_failure(msg) 114 self.test_try_failure(msg)
111 115
112 # Test ctobssim on observation container 116 # Test ctobssim on observation container
@@ -126,8 +130,10 @@ class Test(gammalib.GPythonTestSuite): @@ -126,8 +130,10 @@ class Test(gammalib.GPythonTestSuite):
126 try: 130 try:
127 sim.run() 131 sim.run()
128 self.test_try_success() 132 self.test_try_success()
129 - except Exception, e:  
130 - msg = "Exception occured in ctobssim: %s." % (e,) 133 + #except Exception as e:
  134 + # msg = "Exception occured in ctobssim: %s." % (e,)
  135 + except:
  136 + msg = "Exception occured in ctobssim."
131 self.test_try_failure(msg) 137 self.test_try_failure(msg)
132 138
133 # Retrieve observation and check content 139 # Retrieve observation and check content
@@ -138,8 +144,10 @@ class Test(gammalib.GPythonTestSuite): @@ -138,8 +144,10 @@ class Test(gammalib.GPythonTestSuite):
138 try: 144 try:
139 sim.save() 145 sim.save()
140 self.test_try_success() 146 self.test_try_success()
141 - except Exception, e:  
142 - msg = "Exception occured in saving events: %s." % (e,) 147 + #except Exception as e:
  148 + # msg = "Exception occured in saving events: %s." % (e,)
  149 + except:
  150 + msg = "Exception occured in saving events."
143 self.test_try_failure(msg) 151 self.test_try_failure(msg)
144 152
145 # Setup observation container 153 # Setup observation container
test/test_ctpsfcube.py
@@ -90,8 +90,10 @@ class Test(gammalib.GPythonTestSuite): @@ -90,8 +90,10 @@ class Test(gammalib.GPythonTestSuite):
90 try: 90 try:
91 psfcube.run() 91 psfcube.run()
92 self.test_try_success() 92 self.test_try_success()
93 - except Exception, e:  
94 - msg = "Exception occured in ctpsfcube: %s." % (e,) 93 + #except Exception as e:
  94 + # msg = "Exception occured in ctpsfcube: %s." % (e,)
  95 + except:
  96 + msg = "Exception occured in ctpsfcube."
95 self.test_try_failure(msg) 97 self.test_try_failure(msg)
96 98
97 # Save PSF cube 99 # Save PSF cube
@@ -99,8 +101,10 @@ class Test(gammalib.GPythonTestSuite): @@ -99,8 +101,10 @@ class Test(gammalib.GPythonTestSuite):
99 try: 101 try:
100 psfcube.save() 102 psfcube.save()
101 self.test_try_success() 103 self.test_try_success()
102 - except Exception, e:  
103 - msg = "Exception occured in saving PSF cube: %s." % (e,) 104 + #except Exception as e:
  105 + # msg = "Exception occured in saving PSF cube: %s." % (e,)
  106 + except:
  107 + msg = "Exception occured in saving PSF cubes."
104 self.test_try_failure(msg) 108 self.test_try_failure(msg)
105 109
106 # Return 110 # Return
test/test_ctselect.py
@@ -79,8 +79,10 @@ class Test(gammalib.GPythonTestSuite): @@ -79,8 +79,10 @@ class Test(gammalib.GPythonTestSuite):
79 try: 79 try:
80 select.run() 80 select.run()
81 self.test_try_success() 81 self.test_try_success()
82 - except Exception, e:  
83 - msg = "Exception occured in ctselect: %s." % (e,) 82 + #except Exception as e:
  83 + # msg = "Exception occured in ctselect: %s." % (e,)
  84 + except:
  85 + msg = "Exception occured in ctselect."
84 self.test_try_failure(msg) 86 self.test_try_failure(msg)
85 87
86 # Save events 88 # Save events
@@ -88,8 +90,10 @@ class Test(gammalib.GPythonTestSuite): @@ -88,8 +90,10 @@ class Test(gammalib.GPythonTestSuite):
88 try: 90 try:
89 select.save() 91 select.save()
90 self.test_try_success() 92 self.test_try_success()
91 - except Exception, e:  
92 - msg = "Exception occured in saving events: %s." % (e,) 93 + #except Exception as e:
  94 + # msg = "Exception occured in saving events: %s." % (e,)
  95 + except:
  96 + msg = "Exception occured in saving events."
93 self.test_try_failure(msg) 97 self.test_try_failure(msg)
94 98
95 # Return 99 # Return
test/test_ctskymap.py
@@ -81,8 +81,10 @@ class Test(gammalib.GPythonTestSuite): @@ -81,8 +81,10 @@ class Test(gammalib.GPythonTestSuite):
81 try: 81 try:
82 skymap.run() 82 skymap.run()
83 self.test_try_success() 83 self.test_try_success()
84 - except Exception, e:  
85 - msg = "Exception occured in ctskymap: %s." % (e,) 84 + #except Exception as e:
  85 + # msg = "Exception occured in ctskymap: %s." % (e,)
  86 + except:
  87 + msg = "Exception occured in ctskymap."
86 self.test_try_failure(msg) 88 self.test_try_failure(msg)
87 89
88 # Save counts cube 90 # Save counts cube
@@ -90,8 +92,10 @@ class Test(gammalib.GPythonTestSuite): @@ -90,8 +92,10 @@ class Test(gammalib.GPythonTestSuite):
90 try: 92 try:
91 skymap.save() 93 skymap.save()
92 self.test_try_success() 94 self.test_try_success()
93 - except Exception, e:  
94 - msg = "Exception occured in saving sky map: %s." % (e,) 95 + #except Exception as e:
  96 + # msg = "Exception occured in saving sky map: %s." % (e,)
  97 + except:
  98 + msg = "Exception occured in saving sky map."
95 self.test_try_failure(msg) 99 self.test_try_failure(msg)
96 100
97 # Return 101 # Return
test/test_cttsmap.py
@@ -86,8 +86,10 @@ class Test(gammalib.GPythonTestSuite): @@ -86,8 +86,10 @@ class Test(gammalib.GPythonTestSuite):
86 try: 86 try:
87 tsmap.run() 87 tsmap.run()
88 self.test_try_success() 88 self.test_try_success()
89 - except Exception, e:  
90 - msg = "Exception occured in cttsmap: %s." % (e,) 89 + #except Exception as e:
  90 + # msg = "Exception occured in cttsmap: %s." % (e,)
  91 + except:
  92 + msg = "Exception occured in cttsmap."
91 self.test_try_failure(msg) 93 self.test_try_failure(msg)
92 94
93 # Save results 95 # Save results
@@ -95,8 +97,10 @@ class Test(gammalib.GPythonTestSuite): @@ -95,8 +97,10 @@ class Test(gammalib.GPythonTestSuite):
95 try: 97 try:
96 tsmap.save() 98 tsmap.save()
97 self.test_try_success() 99 self.test_try_success()
98 - except Exception, e:  
99 - msg = "Exception occured in saving results: %s." % (e,) 100 + #except Exception as e:
  101 + # msg = "Exception occured in saving results: %s." % (e,)
  102 + except:
  103 + msg = "Exception occured in saving results."
100 self.test_try_failure(msg) 104 self.test_try_failure(msg)
101 105
102 # Return 106 # Return
test/test_ctulimit.py
@@ -78,8 +78,10 @@ class Test(gammalib.GPythonTestSuite): @@ -78,8 +78,10 @@ class Test(gammalib.GPythonTestSuite):
78 try: 78 try:
79 ulimit.run() 79 ulimit.run()
80 self.test_try_success() 80 self.test_try_success()
81 - except Exception, e:  
82 - msg = "Exception occured in ctulimit: %s." % (e,) 81 + #except Exception as e:
  82 + # msg = "Exception occured in ctulimit: %s." % (e,)
  83 + except:
  84 + msg = "Exception occured in ctulimit."
83 self.test_try_failure(msg) 85 self.test_try_failure(msg)
84 86
85 # Save results 87 # Save results
@@ -87,8 +89,10 @@ class Test(gammalib.GPythonTestSuite): @@ -87,8 +89,10 @@ class Test(gammalib.GPythonTestSuite):
87 try: 89 try:
88 ulimit.save() 90 ulimit.save()
89 self.test_try_success() 91 self.test_try_success()
90 - except Exception, e:  
91 - msg = "Exception occured in saving results: %s." % (e,) 92 + #except Exception as e:
  93 + # msg = "Exception occured in saving results: %s." % (e,)
  94 + except:
  95 + msg = "Exception occured in saving results."
92 self.test_try_failure(msg) 96 self.test_try_failure(msg)
93 97
94 # Return 98 # Return