From: W. Trevor King Date: Wed, 19 May 2010 07:15:23 +0000 (-0400) Subject: Added preliminary hooke.plugin.vclamp.scale (just def. m -> N conversion). X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4152e93663a17c357136fc7a4cd98802a48f4261;p=hooke.git Added preliminary hooke.plugin.vclamp.scale (just def. m -> N conversion). --- diff --git a/hooke/plugin/vclamp.py b/hooke/plugin/vclamp.py index 2bc39d6..7374ab5 100644 --- a/hooke/plugin/vclamp.py +++ b/hooke/plugin/vclamp.py @@ -25,13 +25,28 @@ several associated :class:`hooke.command.Command`\s for handling common velocity clamp analysis tasks. """ +import copy + from ..command import Command, Argument, Failure +from ..curve import Data from ..plugin import Builtin # Utility functions def scale(curve): + for i,block in enumerate(curve.data): + data = Data((block.shape[0], block.shape[1]+2), dtype=block.dtype) + data.info = copy.deepcopy(block.info) + data[:,:-2] = block + data.info['columns'].extend(['surface z piezo (m)', 'deflection (N)']) + z_data = data[:,data.info['columns'].index('z piezo (m)')] + d_data = data[:,data.info['columns'].index('deflection (m)')] + surface_offset = 0 # TODO + data.info['surface offset (m)'] = surface_offset + data[:,-2] = z_data - surface_offset + data[:,-1] = d_data * data.info['spring constant (N/m)'] + curve.data[i] = data return curve