Updated copyright blurbs in all files to '# Copyright'
[hooke.git] / hooke / curve.py
index 5aeaeaac887f3bc3cc26f0b8ead8a73098deb7ee..66199671ef0416bba514148621dc85775f835961 100644 (file)
@@ -1,12 +1,18 @@
-"""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.
@@ -61,14 +67,15 @@ class Curve (object):
       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
@@ -78,7 +85,7 @@ class Curve (object):
             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.