Commit 98256666c264d23dd22955eea53a2420542b9c10
Merge branch 'devel' of https://cta-gitlab.irap.omp.eu/ctools/ctools into 1646-write-iact-docs
Showing
21 changed files
with
150 additions
and
88 deletions
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 | 3 | * Version 1.1.0 released |
| 4 | 4 | ======================== |
| 5 | 5 | |
| 6 | + Adapt to revise GTime operators (#1714) | |
| 6 | 7 | Add publish() methods to tools producing images (#1710) |
| 7 | 8 | Read ahead output filename in cterror (#1700) |
| 8 | 9 | Subdivide simulation energy range in ctobssim (#1673) | ... | ... |
NEWS
cscripts/cslightcrv.py
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | # ========================================================================== |
| 3 | 3 | # Light curve generation script. |
| 4 | 4 | # |
| 5 | -# Copyright (C) 2014-2015 Michael Mayer | |
| 5 | +# Copyright (C) 2014-2016 Michael Mayer | |
| 6 | 6 | # |
| 7 | 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | 8 | # it under the terms of the GNU General Public License as published by |
| ... | ... | @@ -22,6 +22,7 @@ import gammalib |
| 22 | 22 | import ctools |
| 23 | 23 | import sys |
| 24 | 24 | |
| 25 | + | |
| 25 | 26 | # ============ # |
| 26 | 27 | # csspec class # |
| 27 | 28 | # ============ # |
| ... | ... | @@ -358,14 +359,12 @@ class cslightcrv(ctools.cscript): |
| 358 | 359 | tmax = self.m_tbins.tstop(i) |
| 359 | 360 | |
| 360 | 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 | 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 | 369 | # Log information |
| 371 | 370 | if self.logExplicit(): | ... | ... |
cscripts/csobsinfo.py
| ... | ... | @@ -186,9 +186,7 @@ class csobsinfo(ctools.cscript): |
| 186 | 186 | obs_gti = obs.events().gti() |
| 187 | 187 | |
| 188 | 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 | 191 | # Retrieve pointing and store Ra,Dec |
| 194 | 192 | pnt_dir = obs.pointing().dir() |
| ... | ... | @@ -202,8 +200,8 @@ class csobsinfo(ctools.cscript): |
| 202 | 200 | # Append time interval |
| 203 | 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 | 205 | livetime += obs.livetime() |
| 208 | 206 | |
| 209 | 207 | # Log the event type (binned or unbinned) | ... | ... |
src/ctobssim/ctobssim.cpp
| ... | ... | @@ -947,17 +947,16 @@ void ctobssim::simulate_interval(GCTAObservation* obs, |
| 947 | 947 | double flux = get_model_flux(model, emin, emax, dir, rad, |
| 948 | 948 | indent, wrklog); |
| 949 | 949 | double rate = flux * area; |
| 950 | - double duration = 1800.0; // default: 1800 sec | |
| 950 | + double duration = 1800.0; // default: 1800 sec | |
| 951 | 951 | if (rate > 0.0) { |
| 952 | 952 | duration = m_max_photons / rate; |
| 953 | - if (duration < 1.0) { // not <1 sec | |
| 953 | + if (duration < 1.0) { // not <1 sec | |
| 954 | 954 | duration = 1.0; |
| 955 | 955 | } |
| 956 | 956 | else if (duration > 180000.0) { // not >50 hr |
| 957 | 957 | duration = 180000.0; |
| 958 | 958 | } |
| 959 | 959 | } |
| 960 | - GTime tslice(duration, "sec"); | |
| 961 | 960 | |
| 962 | 961 | // Skip model if photon rate is 0 |
| 963 | 962 | if (rate <= 0.0) { |
| ... | ... | @@ -983,16 +982,16 @@ void ctobssim::simulate_interval(GCTAObservation* obs, |
| 983 | 982 | " photons/s for model \""+mod+"\" exceeds " |
| 984 | 983 | "maximum allowed photon rate of "+ |
| 985 | 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 | 988 | throw GException::invalid_value(G_SIMULATE_INTERVAL, msg); |
| 990 | 989 | } |
| 991 | 990 | |
| 992 | 991 | // To reduce memory requirements we split long time intervals into |
| 993 | 992 | // several time slices |
| 994 | 993 | GTime tstart = tmin; |
| 995 | - GTime tstop = tstart + tslice; | |
| 994 | + GTime tstop = tstart + duration; | |
| 996 | 995 | |
| 997 | 996 | // Save state of photon and event counters before doing the |
| 998 | 997 | // simulation |
| ... | ... | @@ -1009,7 +1008,7 @@ void ctobssim::simulate_interval(GCTAObservation* obs, |
| 1009 | 1008 | |
| 1010 | 1009 | // Log time slice |
| 1011 | 1010 | if (logExplicit()) { |
| 1012 | - if (tmax - tmin > tslice) { | |
| 1011 | + if (tmax - tmin > duration) { | |
| 1013 | 1012 | indent++; |
| 1014 | 1013 | wrklog->indent(indent); |
| 1015 | 1014 | } |
| ... | ... | @@ -1030,11 +1029,11 @@ void ctobssim::simulate_interval(GCTAObservation* obs, |
| 1030 | 1029 | |
| 1031 | 1030 | // Go to next time slice |
| 1032 | 1031 | tstart = tstop; |
| 1033 | - tstop = tstart + tslice; | |
| 1032 | + tstop = tstart + duration; | |
| 1034 | 1033 | |
| 1035 | 1034 | // Reset indentation |
| 1036 | 1035 | if (logExplicit()) { |
| 1037 | - if (tmax - tmin > tslice) { | |
| 1036 | + if (tmax - tmin > duration) { | |
| 1038 | 1037 | indent--; |
| 1039 | 1038 | wrklog->indent(indent); |
| 1040 | 1039 | } | ... | ... |
src/ctselect/ctselect.cpp
| ... | ... | @@ -954,9 +954,8 @@ void ctselect::select_events(GCTAObservation* obs, |
| 954 | 954 | } |
| 955 | 955 | |
| 956 | 956 | // Recompute ontime and livetime. |
| 957 | - GTime meantime = 0.5 * (list->gti().tstart() + list->gti().tstop()); | |
| 958 | 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 | 960 | // Return |
| 962 | 961 | return; | ... | ... |
src/ctskymap/ctskymap.cpp
| ... | ... | @@ -325,8 +325,14 @@ void ctskymap::save(void) |
| 325 | 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 | 83 | try: |
| 84 | 84 | bin.run() |
| 85 | 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 | 90 | self.test_try_failure(msg) |
| 89 | 91 | |
| 90 | 92 | # Save counts cube |
| ... | ... | @@ -92,8 +94,10 @@ class Test(gammalib.GPythonTestSuite): |
| 92 | 94 | try: |
| 93 | 95 | bin.save() |
| 94 | 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 | 101 | self.test_try_failure(msg) |
| 98 | 102 | |
| 99 | 103 | # Return | ... | ... |
test/test_ctbkgcube.py
| ... | ... | @@ -91,8 +91,10 @@ class Test(gammalib.GPythonTestSuite): |
| 91 | 91 | try: |
| 92 | 92 | bkgcube.run() |
| 93 | 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 | 98 | self.test_try_failure(msg) |
| 97 | 99 | |
| 98 | 100 | # Save background cube |
| ... | ... | @@ -100,8 +102,10 @@ class Test(gammalib.GPythonTestSuite): |
| 100 | 102 | try: |
| 101 | 103 | bkgcube.save() |
| 102 | 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 | 109 | self.test_try_failure(msg) |
| 106 | 110 | |
| 107 | 111 | # Return | ... | ... |
test/test_ctbutterfly.py
| ... | ... | @@ -81,8 +81,10 @@ class Test(gammalib.GPythonTestSuite): |
| 81 | 81 | try: |
| 82 | 82 | butterfly.run() |
| 83 | 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 | 88 | self.test_try_failure(msg) |
| 87 | 89 | |
| 88 | 90 | # Save results |
| ... | ... | @@ -90,8 +92,10 @@ class Test(gammalib.GPythonTestSuite): |
| 90 | 92 | try: |
| 91 | 93 | butterfly.save() |
| 92 | 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 | 99 | self.test_try_failure(msg) |
| 96 | 100 | |
| 97 | 101 | # Return | ... | ... |
test/test_ctcubemask.py
| ... | ... | @@ -79,8 +79,10 @@ class Test(gammalib.GPythonTestSuite): |
| 79 | 79 | try: |
| 80 | 80 | mask.run() |
| 81 | 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 | 86 | self.test_try_failure(msg) |
| 85 | 87 | |
| 86 | 88 | # Save counts cube |
| ... | ... | @@ -88,8 +90,10 @@ class Test(gammalib.GPythonTestSuite): |
| 88 | 90 | try: |
| 89 | 91 | mask.save() |
| 90 | 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 | 97 | self.test_try_failure(msg) |
| 94 | 98 | |
| 95 | 99 | # Return | ... | ... |
test/test_cterror.py
| ... | ... | @@ -80,8 +80,10 @@ class Test(gammalib.GPythonTestSuite): |
| 80 | 80 | try: |
| 81 | 81 | error.run() |
| 82 | 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 | 87 | self.test_try_failure(msg) |
| 86 | 88 | |
| 87 | 89 | # Save results |
| ... | ... | @@ -89,8 +91,10 @@ class Test(gammalib.GPythonTestSuite): |
| 89 | 91 | try: |
| 90 | 92 | error.save() |
| 91 | 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 | 98 | self.test_try_failure(msg) |
| 95 | 99 | |
| 96 | 100 | # Return | ... | ... |
test/test_ctexpcube.py
| ... | ... | @@ -88,8 +88,10 @@ class Test(gammalib.GPythonTestSuite): |
| 88 | 88 | try: |
| 89 | 89 | expcube.run() |
| 90 | 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 | 95 | self.test_try_failure(msg) |
| 94 | 96 | |
| 95 | 97 | # Save exposure cube |
| ... | ... | @@ -97,8 +99,10 @@ class Test(gammalib.GPythonTestSuite): |
| 97 | 99 | try: |
| 98 | 100 | expcube.save() |
| 99 | 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 | 106 | self.test_try_failure(msg) |
| 103 | 107 | |
| 104 | 108 | # Return | ... | ... |
test/test_ctlike.py
| ... | ... | @@ -78,8 +78,10 @@ class Test(gammalib.GPythonTestSuite): |
| 78 | 78 | try: |
| 79 | 79 | like.run() |
| 80 | 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 | 85 | self.test_try_failure(msg) |
| 84 | 86 | |
| 85 | 87 | # Save results |
| ... | ... | @@ -87,8 +89,10 @@ class Test(gammalib.GPythonTestSuite): |
| 87 | 89 | try: |
| 88 | 90 | like.save() |
| 89 | 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 | 96 | self.test_try_failure(msg) |
| 93 | 97 | |
| 94 | 98 | # Return | ... | ... |
test/test_ctmodel.py
| ... | ... | @@ -96,8 +96,10 @@ class Test(gammalib.GPythonTestSuite): |
| 96 | 96 | try: |
| 97 | 97 | model.run() |
| 98 | 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 | 103 | self.test_try_failure(msg) |
| 102 | 104 | |
| 103 | 105 | # Save counts cube |
| ... | ... | @@ -105,8 +107,10 @@ class Test(gammalib.GPythonTestSuite): |
| 105 | 107 | try: |
| 106 | 108 | model.save() |
| 107 | 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 | 114 | self.test_try_failure(msg) |
| 111 | 115 | |
| 112 | 116 | # Return | ... | ... |
test/test_ctobssim.py
| ... | ... | @@ -84,8 +84,10 @@ class Test(gammalib.GPythonTestSuite): |
| 84 | 84 | try: |
| 85 | 85 | sim.run() |
| 86 | 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 | 91 | self.test_try_failure(msg) |
| 90 | 92 | |
| 91 | 93 | # Retrieve observation and check content |
| ... | ... | @@ -105,8 +107,10 @@ class Test(gammalib.GPythonTestSuite): |
| 105 | 107 | try: |
| 106 | 108 | sim.save() |
| 107 | 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 | 114 | self.test_try_failure(msg) |
| 111 | 115 | |
| 112 | 116 | # Test ctobssim on observation container |
| ... | ... | @@ -126,8 +130,10 @@ class Test(gammalib.GPythonTestSuite): |
| 126 | 130 | try: |
| 127 | 131 | sim.run() |
| 128 | 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 | 137 | self.test_try_failure(msg) |
| 132 | 138 | |
| 133 | 139 | # Retrieve observation and check content |
| ... | ... | @@ -138,8 +144,10 @@ class Test(gammalib.GPythonTestSuite): |
| 138 | 144 | try: |
| 139 | 145 | sim.save() |
| 140 | 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 | 151 | self.test_try_failure(msg) |
| 144 | 152 | |
| 145 | 153 | # Setup observation container | ... | ... |
test/test_ctpsfcube.py
| ... | ... | @@ -90,8 +90,10 @@ class Test(gammalib.GPythonTestSuite): |
| 90 | 90 | try: |
| 91 | 91 | psfcube.run() |
| 92 | 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 | 97 | self.test_try_failure(msg) |
| 96 | 98 | |
| 97 | 99 | # Save PSF cube |
| ... | ... | @@ -99,8 +101,10 @@ class Test(gammalib.GPythonTestSuite): |
| 99 | 101 | try: |
| 100 | 102 | psfcube.save() |
| 101 | 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 | 108 | self.test_try_failure(msg) |
| 105 | 109 | |
| 106 | 110 | # Return | ... | ... |
test/test_ctselect.py
| ... | ... | @@ -79,8 +79,10 @@ class Test(gammalib.GPythonTestSuite): |
| 79 | 79 | try: |
| 80 | 80 | select.run() |
| 81 | 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 | 86 | self.test_try_failure(msg) |
| 85 | 87 | |
| 86 | 88 | # Save events |
| ... | ... | @@ -88,8 +90,10 @@ class Test(gammalib.GPythonTestSuite): |
| 88 | 90 | try: |
| 89 | 91 | select.save() |
| 90 | 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 | 97 | self.test_try_failure(msg) |
| 94 | 98 | |
| 95 | 99 | # Return | ... | ... |
test/test_ctskymap.py
| ... | ... | @@ -81,8 +81,10 @@ class Test(gammalib.GPythonTestSuite): |
| 81 | 81 | try: |
| 82 | 82 | skymap.run() |
| 83 | 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 | 88 | self.test_try_failure(msg) |
| 87 | 89 | |
| 88 | 90 | # Save counts cube |
| ... | ... | @@ -90,8 +92,10 @@ class Test(gammalib.GPythonTestSuite): |
| 90 | 92 | try: |
| 91 | 93 | skymap.save() |
| 92 | 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 | 99 | self.test_try_failure(msg) |
| 96 | 100 | |
| 97 | 101 | # Return | ... | ... |
test/test_cttsmap.py
| ... | ... | @@ -86,8 +86,10 @@ class Test(gammalib.GPythonTestSuite): |
| 86 | 86 | try: |
| 87 | 87 | tsmap.run() |
| 88 | 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 | 93 | self.test_try_failure(msg) |
| 92 | 94 | |
| 93 | 95 | # Save results |
| ... | ... | @@ -95,8 +97,10 @@ class Test(gammalib.GPythonTestSuite): |
| 95 | 97 | try: |
| 96 | 98 | tsmap.save() |
| 97 | 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 | 104 | self.test_try_failure(msg) |
| 101 | 105 | |
| 102 | 106 | # Return | ... | ... |
test/test_ctulimit.py
| ... | ... | @@ -78,8 +78,10 @@ class Test(gammalib.GPythonTestSuite): |
| 78 | 78 | try: |
| 79 | 79 | ulimit.run() |
| 80 | 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 | 85 | self.test_try_failure(msg) |
| 84 | 86 | |
| 85 | 87 | # Save results |
| ... | ... | @@ -87,8 +89,10 @@ class Test(gammalib.GPythonTestSuite): |
| 87 | 89 | try: |
| 88 | 90 | ulimit.save() |
| 89 | 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 | 96 | self.test_try_failure(msg) |
| 93 | 97 | |
| 94 | 98 | # Return | ... | ... |