Changeset 946b452 in sasview for sansmodels/src/sans
- Timestamp:
- Aug 29, 2011 12:13:50 PM (13 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- c832374d
- Parents:
- 2c60cb69
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/qsmearing.py
r5d2e4c1 r946b452 404 404 def __setstate__(self, state): 405 405 """ 406 Restore the state of the object by reconstruction the (smearer) object 406 407 """ 407 408 self.__dict__, self.model, self.data = state … … 409 410 self._smearer = smearer.new_slit_smearer_with_q(self.width, 410 411 self.height, self.qvalues) 412 self.__dict__['_smearer'] = self._smearer 411 413 412 414 def __reduce_ex__(self, proto): 413 415 """ 414 Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of 415 c model. 416 Overwrite the __reduce_ex__to avoid pickle PyCobject(smearer) 416 417 """ 417 418 model = copy.deepcopy(self.model) 418 419 data = copy.deepcopy(self.data) 419 dict = self.__dict__ 420 if "_smearer" in dict.keys(): 421 del dict["_smearer"] 420 dict = {} 421 for k , v in self.__dict__.iteritems(): 422 if k != "_smearer": 423 dict[k] = v 422 424 state = (dict, model, data) 423 return ( QSmearer, (data, model), state, None, None)425 return (SlitSmearer, (data, model), state, None, None) 424 426 425 427 … … 450 452 self._weights = None 451 453 self.qvalues = None 454 452 455 453 456 def _initialize_smearer(self): … … 515 518 ## Q-values 516 519 self.qvalues = data1d_x 520 517 521 518 522 def __deepcopy__(self, memo={}): … … 541 545 def __setstate__(self, state): 542 546 """ 547 Restore the state of the object by reconstruction the (smearer) object 543 548 """ 544 549 self.__dict__, self.model, self.data = state … … 546 551 self._smearer = smearer.new_q_smearer_with_q(numpy.asarray(self.width), 547 552 self.qvalues) 553 self.__dict__['_smearer'] = self._smearer 548 554 549 555 def __reduce_ex__(self, proto): 550 556 """ 551 Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of 552 c model. 557 Overwrite the __reduce_ex__to avoid pickle PyCobject(smearer) 553 558 """ 554 559 model = copy.deepcopy(self.model) 555 560 data = copy.deepcopy(self.data) 556 dict = self.__dict__ 557 if "_smearer" in dict.keys(): 558 del dict["_smearer"] 561 dict = {} 562 for k , v in self.__dict__.iteritems(): 563 if k != "_smearer": 564 dict[k] = v 559 565 state = (dict, model, data) 560 566 return (QSmearer, (data, model), state, None, None)
Note: See TracChangeset
for help on using the changeset viewer.