From: W. Trevor King Date: Wed, 11 Aug 2010 21:48:26 +0000 (-0400) Subject: Fix '@Sens. ZSensorSens' KeyError loading picoforce 0x07200000 curves. X-Git-Url: http://git.tremily.us/?p=hooke.git;a=commitdiff_plain;h=fe80f62dcde136138414d92a81c7ede97b5d4971 Fix '@Sens. ZSensorSens' KeyError loading picoforce 0x07200000 curves. Regression from 93e0e4284534. Of course, we still don't know where the z-data is in the 0x07200000 curves, http://code.google.com/p/hooke/issues/detail?id=26#c4 so its hard to know if this is the right sensitivity. It doesn't crash anyway... --- diff --git a/hooke/driver/picoforce.py b/hooke/driver/picoforce.py index bffa09e..94339d4 100644 --- a/hooke/driver/picoforce.py +++ b/hooke/driver/picoforce.py @@ -348,10 +348,17 @@ class PicoForceDriver (Driver): # offset assumed if raw data is signed... nm_sens_re = re.compile('V ([.0-9]*) nm/V') - match = nm_sens_re.match(info['Ciao scan list']['@Sens. ZSensorSens']) - assert match != None, 'Bad regexp for %s/%s, %s' \ - % ('Ciao scan list', '@Sens. ZSensorSens', - info['Ciao scan list']['@Sens. ZSensorSens']) + if version in ['0x06120002', '0x06130001']: + match = nm_sens_re.match(info['Ciao scan list']['@Sens. ZSensorSens']) + assert match != None, 'Bad regexp for %s/%s, %s' \ + % ('Ciao scan list', '@Sens. ZSensorSens', + info['Ciao scan list']['@Sens. ZSensorSens']) + else: + assert version == '0x07200000', version + match = nm_sens_re.match(info['Ciao scan list']['@Sens. ZsensSens']) + assert match != None, 'Bad regexp for %s/%s, %s' \ + % ('Ciao scan list', '@Sens. ZsensSens', + info['Ciao scan list']['@Sens. ZsensSens']) ret['z piezo sensitivity (m/V)'] = float(match.group(1))*1e-9 match = nm_sens_re.match(info['Ciao scan list']['@Sens. DeflSens'])