Extract 'z piezo sensitivity (m/V)' from JPK files into Curve.info.
authorW. Trevor King <wking@drexel.edu>
Wed, 8 Sep 2010 14:54:40 +0000 (10:54 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 8 Sep 2010 14:54:40 +0000 (10:54 -0400)
Not particularly important, since we convert from V to m inside the
driver, but it's an interesting property for getting a feel for how a
particular instrument works.

hooke/driver/jpk.py

index ee78f35..24d9777 100644 (file)
@@ -160,9 +160,16 @@ class JPKDriver (Driver):
         assert force_base == 'distance', force_base
         dist_unit = chan_info['channel']['vDeflection']['conversion-set']['conversion']['distance']['scaling']['unit']['unit']
         assert dist_unit == 'm', dist_unit
         assert force_base == 'distance', force_base
         dist_unit = chan_info['channel']['vDeflection']['conversion-set']['conversion']['distance']['scaling']['unit']['unit']
         assert dist_unit == 'm', dist_unit
+        distance_base = chan_info['channel']['vDeflection']['conversion-set']['conversion']['distance']['base-calibration-slot']
+        assert distance_base == 'volts', distance_base
+        # Assume volts unit is V, but it is not specified in the JPK
+        # file format.
         force_mult = float(
             chan_info['channel']['vDeflection']['conversion-set']['conversion']['force']['scaling']['multiplier'])
         force_mult = float(
             chan_info['channel']['vDeflection']['conversion-set']['conversion']['force']['scaling']['multiplier'])
+        sens_mult = float(
+            chan_info['channel']['vDeflection']['conversion-set']['conversion']['distance']['scaling']['multiplier'])
         info['spring constant (N/m)'] = force_mult
         info['spring constant (N/m)'] = force_mult
+        info['z piezo sensitivity (m/V)'] = sens_mult
         return info
 
     def _zip_translate_segment_params(self, params):
         return info
 
     def _zip_translate_segment_params(self, params):