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