Don't specify curve or data block types. See doc/standards.txt.
[hooke.git] / hooke / driver / tutorial.py
index 7bdf6ced92fecf3146122baa607bc9b28385dd62..abd2dae39d793d73767ffc390175c08efcbc1acc 100644 (file)
@@ -1,5 +1,20 @@
-# Copyright (c) 2008 Massimo Sandal
-#               2010 W. Trevor King
+# Copyright (C) 2010 W. Trevor King <wking@drexel.edu>
+#
+# This file is part of Hooke.
+#
+# Hooke is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# Hooke is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
+# Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Hooke.  If not, see
+# <http://www.gnu.org/licenses/>.
 
 """Tutorial driver for Hooke.
 
@@ -46,10 +61,11 @@ file format is as following::
 that is, two plots with two datasets each.
 """
 
+import os.path
+
 # The following are relative imports.  See PEP 328 for details
 #   http://www.python.org/dev/peps/pep-0328/
 from .. import curve as curve # this module defines data containers.
-from .. import experiment as experiment # this module defines expt. types
 from ..config import Setting # configurable setting class
 from . import Driver as Driver # this is the Driver base class
 
@@ -72,14 +88,13 @@ class TutorialDriver (Driver):
         If your driver does not have any configurable settings, there
         is no need to override this method.
         """
-        section = '%s driver' % self.name
         return [
-            Setting(section=section, help=self.__doc__),
-            Setting(section=section, option='x units', value='nm',
+            Setting(section=self.setting_section, help=self.__doc__),
+            Setting(section=self.setting_section, option='x units', value='nm',
                     help='Set the units used for the x data.'),
             ]
 
-    def is_me(self):
+    def is_me(self, path):
         """YOU MUST OVERRIDE Driver.is_me.
 
         RETURNS: Boolean (`True` or `False`)
@@ -91,8 +106,10 @@ class TutorialDriver (Driver):
         Hooke to understand what kind of files we're looking at
         automatically.
         """
+        if os.path.isdir(path):
+            return False
 
-        f = open(self.filename, 'r')
+        f = open(path, 'r')
         header = f.readline() # we only need the first line
         f.close()
 
@@ -106,7 +123,7 @@ class TutorialDriver (Driver):
             return True
         return False
 
-    def read(self, path):
+    def read(self, path, info=None):
         f = open(path,'r') # open the file for reading
         """In this case, we have a data format that is just a list of
         ASCII values, so we can just divide that in rows, and generate
@@ -118,5 +135,5 @@ class TutorialDriver (Driver):
         f.close() # remember to close the file
 
         data = curve.Data()
-        info = {'filetype':'tutorial', 'experiment':'generic'}
+        info = {}
         return (data, info)