super(NotRecognized, self).__init__(msg)
self.curve = data
+
class Data (numpy.ndarray):
"""Stores a single, continuous data set.
"""
def __init__(self, path, info=None):
#the data dictionary contains: {name of data: list of data sets [{[x], [y]}]
- self.path = path
+ self.name = None
+ self.set_path(path)
self.driver = None
self.data = None
if info == None:
info = {}
self.info = info
- self.name = os.path.basename(path)
self.command_stack = CommandStack()
self._hooke = None # Hooke instance for Curve.load()
def __repr__(self):
return self.__str__()
+ def set_path(self, path):
+ self.path = path
+ if self.name == None and path != None:
+ self.name = os.path.basename(path)
+
+ def __getstate__(self):
+ state = dict(self.__dict__)
+ del(state['_hooke'])
+ dc = state['command_stack']
+ if hasattr(dc, '__getstate__'):
+ state['command_stack'] = dc.__getstate__()
+ return state
+
+ def __setstate__(self, state):
+ self.name = self._hooke = None
+ for key,value in state.items():
+ if key == 'path':
+ self.set_path(value)
+ continue
+ elif key == 'command_stack':
+ v = CommandStack()
+ v.__setstate__(value)
+ value = v
+ setattr(self, key, value)
+
def set_hooke(self, hooke=None):
if hooke != None:
self._hooke = hooke