X-Git-Url: http://git.tremily.us/?p=hooke.git;a=blobdiff_plain;f=hooke%2Fdriver%2Ftutorial.py;h=bbc456518da41c91a9730cf7bc7aec59f07de8ce;hp=adcaf2cec1529d7b87d6f3d1cda3338325c19e47;hb=23bcfd05915a61e3a41d01babd291fd3089ba329;hpb=7762de28cee60f98882d72db0c2ae2c6009ac465 diff --git a/hooke/driver/tutorial.py b/hooke/driver/tutorial.py index adcaf2c..bbc4565 100644 --- a/hooke/driver/tutorial.py +++ b/hooke/driver/tutorial.py @@ -1,20 +1,19 @@ -# Copyright (C) 2010 W. Trevor King +# Copyright (C) 2010-2012 W. Trevor King # # 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 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. +# 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 -# . +# You should have received a copy of the GNU Lesser General Public License +# along with Hooke. If not, see . """Tutorial driver for Hooke. @@ -61,10 +60,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 @@ -105,6 +105,8 @@ class TutorialDriver (Driver): Hooke to understand what kind of files we're looking at automatically. """ + if os.path.isdir(path): + return False f = open(path, 'r') header = f.readline() # we only need the first line @@ -120,7 +122,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 @@ -132,5 +134,5 @@ class TutorialDriver (Driver): f.close() # remember to close the file data = curve.Data() - info = {'filetype':'tutorial', 'experiment':experiment.Experiment} + info = {} return (data, info)