Run update-copyright.py.
[hooke.git] / hooke / driver / wtk.py
index b39bdd95845347178f9c5c1d81d980da3fde6d79..f3b7ed67b551fa7d6ae53933642ee83f66a6cca6 100644 (file)
@@ -1,35 +1,38 @@
-# Copyright (C) 2010 W. Trevor King <wking@drexel.edu>
+# Copyright (C) 2010-2012 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 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
-# <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Lesser General Public License
+# along with Hooke.  If not, see <http://www.gnu.org/licenses/>.
 
 """Driver for W. Trevor King's velocity clamp data format.
 
-See my related projects:
+See my blog post:
 
-* http://www.physics.drexel.edu/~wking/code/git/git.php?p=unfold_protein.git
-* http://www.physics.drexel.edu/~wking/code/git/git.php?p=calibrate_cantilever.git
-* http://www.physics.drexel.edu/~wking/code/git/git.php?p=data_logger.git
-* http://www.physics.drexel.edu/~wking/code/git/git.php?p=piezo.git
-* http://www.physics.drexel.edu/~wking/code/git/git.php?p=pycomedi.git
+* http://www.physics.drexel.edu/~wking/unfolding-disasters/Hooke/
 
-And the deprecated projects (which Hooke replaces):
+related projects:
 
-* http://www.physics.drexel.edu/~wking/code/git/git.php?p=scale_unfold.git
-* http://www.physics.drexel.edu/~wking/code/git/git.php?p=sawmodel.git
+* http://www.physics.drexel.edu/~wking/code/git/gitweb.cgi?p=unfold_protein.git
+* http://www.physics.drexel.edu/~wking/code/git/gitweb.cgi?p=calibrate_cantilever.git
+* http://www.physics.drexel.edu/~wking/code/git/gitweb.cgi?p=data_logger.git
+* http://www.physics.drexel.edu/~wking/code/git/gitweb.cgi?p=piezo.git
+* http://www.physics.drexel.edu/~wking/code/git/gitweb.cgi?p=pycomedi.git
+
+and the deprecated projects (which Hooke replaces):
+
+* http://www.physics.drexel.edu/~wking/code/git/gitweb.cgi?p=scale_unfold.git
+* http://www.physics.drexel.edu/~wking/code/git/gitweb.cgi?p=sawmodel.git
 """
 
 import calendar
@@ -42,21 +45,9 @@ import time
 import numpy
 
 from .. import curve as curve
-from .. import experiment as experiment
 from ..config import Setting
 from . import Driver as Driver
 
-try:
-    import calibcant.config
-    calibcant_dir = calibcant.config.LOG_DIR
-except ImportError:
-    calibcant_dir = None
-
-try:
-    import data_logger
-except ImportError:
-    data_logger = None
-
 
 class WTKDriver (Driver):
     """Handle W. Trevor King's data_logger data format.
@@ -69,7 +60,7 @@ class WTKDriver (Driver):
             Setting(section=self.setting_section, help=self.__doc__),
             Setting(section=self.setting_section,
                     option='cantilever calibration directory',
-                    value=calibcant_dir, type='path',
+                    value='~/rsrch/data/calibrate_cantilever', type='path',
                     help='Set the directory where cantilever calibration data is stored'),
             ]
 
@@ -98,7 +89,7 @@ class WTKDriver (Driver):
             unlabeled_approach_data, params, 'approach')
         retract = self._scale_block(
             unlabeled_retract_data, params, 'retract')
-        info = {'filetype':self.name, 'experiment':experiment.VelocityClamp}
+        info = {}
         return ([approach, retract], info)
 
     def _paths(self, path):
@@ -215,7 +206,8 @@ class WTKDriver (Driver):
         if basedir == None:
             basedir = self.config['cantilever calibration directory']
         YYYYMMDD = time.strftime("%Y%m%d", time.localtime(timestamp))
-        dir = os.path.join(data_logger.normalize_logdir(basedir), YYYYMMDD)
+        basedir = os.path.expanduser(basedir)
+        dir = os.path.join(basedir, YYYYMMDD)
         if not os.path.exists(dir):
             return []
         all_calibfiles = os.listdir(dir) # everything in the directory