From 03f133b884501a8e5334097351438d8a34a8fe87 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 4 Jun 2010 10:40:17 -0400 Subject: [PATCH] Adjust hooke.curve.Data so .info is picklable. Otherwise it didn't survive the Queue between the UI and Engine processes. See http://mail.scipy.org/pipermail/numpy-discussion/2007-April/027193.html --- hooke/curve.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hooke/curve.py b/hooke/curve.py index bd58a18..1b30bfa 100644 --- a/hooke/curve.py +++ b/hooke/curve.py @@ -88,6 +88,16 @@ class Data (numpy.ndarray): self.info = getattr(obj, 'info', {}) # We do not need to return anything + def __reduce__(self): + base_class_state = list(numpy.ndarray.__reduce__(self)) + own_state = (self.info,) + return (base_class_state, own_state) + + def __setstate__(self,state): + base_class_state,own_state = state + numpy.ndarray.__setstate__(self, base_class_state) + self.info, = own_state + class Curve (object): """A grouped set of :class:`Data` runs from the same file with metadata. -- 2.26.2