From: W. Trevor King Date: Wed, 8 Sep 2010 20:13:18 +0000 (-0400) Subject: Fix distance_base_unit extraction in JPK driver for encoded data. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0d1e91fbf2d28c915ed84b11be135d09d4665d51;p=hooke.git Fix distance_base_unit extraction in JPK driver for encoded data. --- 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'])