Attach raw info etc. to curve in MFP3D driver (used to be just data blocks).
[hooke.git] / hooke / driver / mfp3d.py
index fce318c0a8e87d1c346b4124e8a9d1a4fc0e3a43..ccffd5e8de798f1e7afb1d9fa9db6e5f00ae394b 100644 (file)
@@ -6,15 +6,15 @@
 #
 # 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
@@ -31,13 +31,13 @@ Hooke submission: Rolf Schmidt, Alberto Gomez-Casado 2009
 """
 
 import copy
+import os.path
 import pprint
 
 import numpy
 
 from .. import curve as curve
 from .. import experiment as experiment
-from ..config import Setting
 from . import Driver as Driver
 from .igorbinarywave import loadibw
 
@@ -54,6 +54,8 @@ class MFP3DDriver (Driver):
     def is_me(self, path):
         """Look for identifying fields in the IBW note.
         """
+        if os.path.isdir(path):
+            return False
         if not path.endswith('.ibw'):
             return False
         targets = ['Version:', 'XOPVersion:', 'ForceNote:']
@@ -69,9 +71,9 @@ class MFP3DDriver (Driver):
     
     def read(self, path, info=None):
         data,bin_info,wave_info = loadibw(path)
-        approach,retract = self._translate_ibw(data, bin_info, wave_info)
-
-        info = {'filetype':self.name, 'experiment':experiment.VelocityClamp}
+        approach,retract,info = self._translate_ibw(data, bin_info, wave_info)
+        info['filetype'] = self.name
+        info['experiment'] = experiment.VelocityClamp
         return ([approach, retract], info)
      
     def _translate_ibw(self, data, bin_info, wave_info):
@@ -106,7 +108,7 @@ class MFP3DDriver (Driver):
         # MFP3D's native data dimensions match Hooke's (<point>, <column>) layout.
         approach = self._scale_block(data[:wave_info['npnts']/2,:], info, 'approach')
         retract = self._scale_block(data[wave_info['npnts']/2:,:], info, 'retract')
-        return (approach, retract)
+        return (approach, retract, info)
 
     def _scale_block(self, data, info, name):
         """Convert the block from its native format to a `numpy.float`