diff --git a/pyext/GCaldb.i b/pyext/GCaldb.i index d6dd92a..7a5fe88 100644 --- a/pyext/GCaldb.i +++ b/pyext/GCaldb.i @@ -1,7 +1,7 @@ /*************************************************************************** * GCaldb.i - Calibration database class * * ----------------------------------------------------------------------- * - * copyright (C) 2011-2016 by Juergen Knoedlseder * + * copyright (C) 2011-2018 by Juergen Knoedlseder * * ----------------------------------------------------------------------- * * * * This program is free software: you can redistribute it and/or modify * @@ -75,4 +75,11 @@ public: GCaldb copy() { return (*self); } +%pythoncode { + def __getstate__(self): + state = (self.mission(), self.instrument()) + return state + def __setstate__(self, state): + self.__init__(state[0], state[1]) +} }; diff --git a/test/test_GObservation.py b/test/test_GObservation.py index 7c2a0f6..cc5adc4 100755 --- a/test/test_GObservation.py +++ b/test/test_GObservation.py @@ -17,6 +17,7 @@ # along with this program. If not, see . # # ========================================================================== +import os import gammalib import test_support @@ -36,6 +37,9 @@ class Test(gammalib.GPythonTestSuite): # Call base class constructor gammalib.GPythonTestSuite.__init__(self) + # Set CALDB + os.environ['CALDB'] = os.environ['TEST_DATA']+'/caldb' + # Return return @@ -764,7 +768,7 @@ class Test(gammalib.GPythonTestSuite): times.append(tmax) # Perform pickeling tests of filled classes - #test_support._pickeling(self, gammalib.GCaldb()) + test_support._pickeling(self, gammalib.GCaldb('cta','prod2')) test_support._pickeling(self, gammalib.GEbounds(10, emin, emax)) test_support._pickeling(self, gammalib.GEnergy(emin)) test_support._pickeling(self, gammalib.GEnergies(10, emin, emax))