From: W. Trevor King Date: Tue, 1 Jun 2010 17:32:43 +0000 (-0400) Subject: Cleanups in hooke.driver.picoforce X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=63f8022384c15c83abf2b436243d608a5a6c835e;p=hooke.git Cleanups in hooke.driver.picoforce Scaling adjustment: * Use 'z piezo gain' in bit->m conversion (is this correct?) Info field renames for clarity and consistency: * 'z piezo magnification' -> 'z piezo gain' (is this correct?) * 'z piezo scale (V/bit)' -> 'z piezo sensitivity (V/bit)' * 'z piezo scale (V)' -> 'z piezo range (V)' * 'raw-data' -> 'raw data' Also: * Stripped trailing whitespace. * Comment typo correction 'inzrease' -> 'increase' --- diff --git a/hooke/driver/picoforce.py b/hooke/driver/picoforce.py index 4ab2008..64d349f 100644 --- a/hooke/driver/picoforce.py +++ b/hooke/driver/picoforce.py @@ -183,7 +183,7 @@ class PicoForceDriver (Driver): def _extract_traces(self, buffer, info): """Extract each of the three vector blocks in a PicoForce file. - + The blocks are: * Deflection input @@ -192,7 +192,7 @@ class PicoForceDriver (Driver): And their headers are marked with 'Ciao force image list'. """ - traces = [] + traces = [] for image in info['Ciao force image list']: offset = int(image['Data offset']) length = int(image['Data length']) @@ -241,7 +241,7 @@ class PicoForceDriver (Driver): 'raw info':info, 'raw z piezo info': z_piezo_info, 'raw deflection info': deflection_info, - 'spring constant (N/m)':float(z_piezo_info['Spring Constant']) + 'spring constant (N/m)':float(z_piezo_info['Spring Constant']), } t = info['Force file list']['Date'] # 04:42:34 PM Tue Sep 11 2007 @@ -293,12 +293,12 @@ class PicoForceDriver (Driver): const_re = re.compile('C \[([:\w\s]*)\] ([.0-9]*)') match = const_re.match(z_piezo_info['@Z magnify']) assert match.group(1) == '4:Z scale', match.group(1) - ret['z piezo magnification'] = match.group(2) + ret['z piezo gain'] = match.group(2) match = volt_re.match(z_piezo_info['@4:Z scale']) assert match.group(1) == 'ZSensorSens', match.group(1) - ret['z piezo scale (V/bit)'] = float(match.group(2)) - ret['z piezo scale (V)'] = float(match.group(3)) + ret['z piezo sensitivity (V/bit)'] = float(match.group(2)) + ret['z piezo range (V)'] = float(match.group(3)) match = volt_re.match(z_piezo_info['@4:Ramp size']) assert match.group(1) == 'Zsens', match.group(1) @@ -309,10 +309,10 @@ class PicoForceDriver (Driver): assert match.group(1) == 'Zsens', match.group(1) ret['z piezo ramp offset (V/bit)'] = float(match.group(2)) ret['z piezo ramp offset (V)'] = float(match.group(3)) - + # Unaccounted for: # Samps* - + return ret def _scale_block(self, data): @@ -325,7 +325,7 @@ class PicoForceDriver (Driver): ) info = data.info ret.info = info - ret.info['raw-data'] = data # store the raw data + ret.info['raw data'] = data # store the raw data data.info = {} # break circular reference info <-> data z_col = info['columns'].index('z piezo (m)') @@ -333,12 +333,13 @@ class PicoForceDriver (Driver): # Leading '-' because Veeco's z increases towards the surface # (positive indentation), but it makes more sense to me to - # have it inzrease away from the surface (positive + # have it increase away from the surface (positive # separation). ret[:,z_col] = -( (data[:,z_col].astype(ret.dtype) * info['z piezo sensitivity (V/bit)'] - info['z piezo offset (V)']) + * info['z piezo gain'] * info['z piezo sensitivity (m/V)'] ) @@ -350,4 +351,3 @@ class PicoForceDriver (Driver): ) return ret -