-# Copyright (C) 2010 W. Trevor King <wking@drexel.edu>
+# Copyright (C) 2010-2011 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
"""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
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.
Setting(section=self.setting_section, help=self.__doc__),
Setting(section=self.setting_section,
option='cantilever calibration directory',
- value=calibcant_dir,
+ value='~/rsrch/data/calibrate_cantilever', type='path',
help='Set the directory where cantilever calibration data is stored'),
]
def is_me(self, path):
+ if os.path.isdir(path):
+ return False
if not path.endswith('_unfold'):
return False
for p in self._paths(path):
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):
ret['raw spring constant'] = calibcant_info
ret['spring constant (N/m)'] = calibcant_info['Cantilever k (N/m)']
ret['deflection sensitivity (m/V)'] = \
- 1.0/numpy.sqrt(calibcant_info['photoSensitivity**2 (V/nm)**2'])
+ 1.0/numpy.sqrt(calibcant_info['photoSensitivity**2 (V/nm)**2']) * 1e-9
# (32768 bits = 2**15 bits = 10 Volts)
ret['deflection sensitivity (V/bit)'] = 1.0/3276.8
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