-"""The curve module provides :class:`Curve` and :class:`Data` for storing
-force curves.
+# Copyright
+
+"""The `curve` module provides :class:`Curve` and :class:`Data` for
+storing force curves.
"""
import os.path
import numpy
-from .driver import NotRecognized
+class NotRecognized (ValueError):
+ def __init__(self, curve):
+ msg = 'Not a recognizable curve format: %s' % curve.path
+ ValueError.__init__(self, msg)
+ self.curve = curve
class Data (numpy.ndarray):
"""Stores a single, continuous data set.
Hooke commands could like to know if they're looking at force
clamp data, regardless of their origin.
"""
- def __init__(self, path):
+ def __init__(self, path, info=None):
#the data dictionary contains: {name of data: list of data sets [{[x], [y]}]
self.path = path
self.driver = None
self.data = []
- self.info = None
+ if info == None:
+ info = {}
+ self.info = info
self.name = os.path.basename(path)
- self.notes = ''
def identify(self, drivers):
"""Identify the appropriate :class:`hooke.driver.Driver` for
if driver.is_me(self.path):
self.driver = driver # remember the working driver
return
- raise NotRecognized(self.path)
+ raise NotRecognized(self)
def load(self):
"""Use the driver to read the curve into memory.