From 4152e93663a17c357136fc7a4cd98802a48f4261 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 19 May 2010 03:15:23 -0400 Subject: [PATCH] Added preliminary hooke.plugin.vclamp.scale (just def. m -> N conversion). --- hooke/plugin/vclamp.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 -- 2.26.2