From 0d1e91fbf2d28c915ed84b11be135d09d4665d51 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 8 Sep 2010 16:13:18 -0400 Subject: [PATCH] Fix distance_base_unit extraction in JPK driver for encoded data. --- hooke/driver/jpk.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hooke/driver/jpk.py b/hooke/driver/jpk.py index afa9570..286766c 100644 --- a/hooke/driver/jpk.py +++ b/hooke/driver/jpk.py @@ -219,9 +219,14 @@ class JPKDriver (Driver): assert distance_base == 'volts', distance_base base_conversion = chan_info['channel']['vDeflection']['conversion-set']['conversions']['base'] assert base_conversion == distance_base, base_conversion - distance_base_unit = self._zip_unit( - chan_info['channel']['vDeflection']['data'], - version) + if 'encoder' in chan_info['channel']['vDeflection']['data']: + distance_base_unit = self._zip_unit( + chan_info['channel']['vDeflection']['data']['encoder']['scaling'], + version) + else: + distance_base_unit = self._zip_unit( + chan_info['channel']['vDeflection']['data'], + version) assert distance_base_unit == 'V', distance_base_unit force_mult = float( chan_info['channel']['vDeflection']['conversion-set']['conversion']['force']['scaling']['multiplier']) -- 2.26.2