Commit 2c2465cd365902433dbc8a4f3f7914fe6485472e
1 parent
deb49172
Correct pickling of GCTAModelSpatialMultiplicative
Showing
2 changed files
with
10 additions
and
4 deletions
inst/cta/pyext/GCTAModelSpatialMultiplicative.i
| @@ -84,9 +84,6 @@ public: | @@ -84,9 +84,6 @@ public: | ||
| 84 | state = (xml,) | 84 | state = (xml,) |
| 85 | return state | 85 | return state |
| 86 | def __setstate__(self, state): | 86 | def __setstate__(self, state): |
| 87 | - if state[0].elements('parameter') == 0: | ||
| 88 | - self.__init__() | ||
| 89 | - else: | ||
| 90 | - self.__init__(state[0]) | 87 | + self.__init__(state[0]) |
| 91 | } | 88 | } |
| 92 | }; | 89 | }; |
inst/cta/test/test_CTA.py
| @@ -397,6 +397,7 @@ class Test(gammalib.GPythonTestSuite): | @@ -397,6 +397,7 @@ class Test(gammalib.GPythonTestSuite): | ||
| 397 | test_support.pickeling(self, gammalib.GCTAEventCube()) | 397 | test_support.pickeling(self, gammalib.GCTAEventCube()) |
| 398 | test_support.pickeling(self, gammalib.GCTAEventList()) | 398 | test_support.pickeling(self, gammalib.GCTAEventList()) |
| 399 | test_support.pickeling(self, gammalib.GCTAInstDir()) | 399 | test_support.pickeling(self, gammalib.GCTAInstDir()) |
| 400 | + test_support.pickeling(self, gammalib.GCTAModelBackground()) | ||
| 400 | test_support.pickeling(self, gammalib.GCTAModelAeffBackground()) | 401 | test_support.pickeling(self, gammalib.GCTAModelAeffBackground()) |
| 401 | test_support.pickeling(self, gammalib.GCTAModelCubeBackground()) | 402 | test_support.pickeling(self, gammalib.GCTAModelCubeBackground()) |
| 402 | test_support.pickeling(self, gammalib.GCTAModelIrfBackground()) | 403 | test_support.pickeling(self, gammalib.GCTAModelIrfBackground()) |
| @@ -404,6 +405,8 @@ class Test(gammalib.GPythonTestSuite): | @@ -404,6 +405,8 @@ class Test(gammalib.GPythonTestSuite): | ||
| 404 | test_support.pickeling(self, gammalib.GCTAModelRadialGauss()) | 405 | test_support.pickeling(self, gammalib.GCTAModelRadialGauss()) |
| 405 | test_support.pickeling(self, gammalib.GCTAModelRadialPolynom()) | 406 | test_support.pickeling(self, gammalib.GCTAModelRadialPolynom()) |
| 406 | test_support.pickeling(self, gammalib.GCTAModelRadialProfile()) | 407 | test_support.pickeling(self, gammalib.GCTAModelRadialProfile()) |
| 408 | + test_support.pickeling(self, gammalib.GCTAModelSpatialGradient()) | ||
| 409 | + test_support.pickeling(self, gammalib.GCTAModelSpatialMultiplicative()) | ||
| 407 | test_support.pickeling(self, gammalib.GCTAObservation()) | 410 | test_support.pickeling(self, gammalib.GCTAObservation()) |
| 408 | test_support.pickeling(self, gammalib.GCTAOnOffObservation()) | 411 | test_support.pickeling(self, gammalib.GCTAOnOffObservation()) |
| 409 | test_support.pickeling(self, gammalib.GCTAPointing()) | 412 | test_support.pickeling(self, gammalib.GCTAPointing()) |
| @@ -467,6 +470,9 @@ class Test(gammalib.GPythonTestSuite): | @@ -467,6 +470,9 @@ class Test(gammalib.GPythonTestSuite): | ||
| 467 | obs5 = gammalib.GCTAOnOffObservation(obs1, ptsrc, ebds, ebds, regs, regs) | 470 | obs5 = gammalib.GCTAOnOffObservation(obs1, ptsrc, ebds, ebds, regs, regs) |
| 468 | radgauss = gammalib.GCTAModelRadialGauss(1.0) | 471 | radgauss = gammalib.GCTAModelRadialGauss(1.0) |
| 469 | radacc = gammalib.GCTAModelRadialAcceptance(radgauss, plaw) | 472 | radacc = gammalib.GCTAModelRadialAcceptance(radgauss, plaw) |
| 473 | + multi = gammalib.GCTAModelSpatialMultiplicative() | ||
| 474 | + multi.append(radgauss, 'Src1') | ||
| 475 | + multi.append(radgauss, 'Src2') | ||
| 470 | kingname = self._caldb + '/prod1_king.fits' | 476 | kingname = self._caldb + '/prod1_king.fits' |
| 471 | hessaeff = self._data + '/irf_hess_aeff.fits.gz' | 477 | hessaeff = self._data + '/irf_hess_aeff.fits.gz' |
| 472 | hesspsf = self._data + '/irf_hess_psf.fits.gz' | 478 | hesspsf = self._data + '/irf_hess_psf.fits.gz' |
| @@ -498,6 +504,7 @@ class Test(gammalib.GPythonTestSuite): | @@ -498,6 +504,7 @@ class Test(gammalib.GPythonTestSuite): | ||
| 498 | test_support.pickeling(self, gammalib.GCTAEventCube(cube)) | 504 | test_support.pickeling(self, gammalib.GCTAEventCube(cube)) |
| 499 | test_support.pickeling(self, gammalib.GCTAEventList(list)) | 505 | test_support.pickeling(self, gammalib.GCTAEventList(list)) |
| 500 | test_support.pickeling(self, gammalib.GCTAInstDir(instdir)) | 506 | test_support.pickeling(self, gammalib.GCTAInstDir(instdir)) |
| 507 | + test_support.pickeling(self, gammalib.GCTAModelBackground(radgauss,plaw)) | ||
| 501 | test_support.pickeling(self, gammalib.GCTAModelAeffBackground(plaw)) | 508 | test_support.pickeling(self, gammalib.GCTAModelAeffBackground(plaw)) |
| 502 | test_support.pickeling(self, gammalib.GCTAModelCubeBackground(plaw)) | 509 | test_support.pickeling(self, gammalib.GCTAModelCubeBackground(plaw)) |
| 503 | test_support.pickeling(self, gammalib.GCTAModelIrfBackground(plaw)) | 510 | test_support.pickeling(self, gammalib.GCTAModelIrfBackground(plaw)) |
| @@ -505,6 +512,8 @@ class Test(gammalib.GPythonTestSuite): | @@ -505,6 +512,8 @@ class Test(gammalib.GPythonTestSuite): | ||
| 505 | test_support.pickeling(self, gammalib.GCTAModelRadialGauss(1.0)) | 512 | test_support.pickeling(self, gammalib.GCTAModelRadialGauss(1.0)) |
| 506 | test_support.pickeling(self, gammalib.GCTAModelRadialPolynom([1.0,2.0])) | 513 | test_support.pickeling(self, gammalib.GCTAModelRadialPolynom([1.0,2.0])) |
| 507 | test_support.pickeling(self, gammalib.GCTAModelRadialProfile(1.0,2.0,3.0)) | 514 | test_support.pickeling(self, gammalib.GCTAModelRadialProfile(1.0,2.0,3.0)) |
| 515 | + test_support.pickeling(self, gammalib.GCTAModelSpatialGradient(1.0,2.0)) | ||
| 516 | + test_support.pickeling(self, gammalib.GCTAModelSpatialMultiplicative(multi)) | ||
| 508 | test_support.pickeling(self, gammalib.GCTAObservation(obs1)) | 517 | test_support.pickeling(self, gammalib.GCTAObservation(obs1)) |
| 509 | test_support.pickeling(self, gammalib.GCTAObservation(obs2)) | 518 | test_support.pickeling(self, gammalib.GCTAObservation(obs2)) |
| 510 | test_support.pickeling(self, gammalib.GCTAObservation(obs3)) | 519 | test_support.pickeling(self, gammalib.GCTAObservation(obs3)) |