params = {'curve':curve, 'block':block}
b = curve.data[block]
if ('surface distance (m)' not in b.info['columns']
- or 'surface adjusted deflection (m)' not in b.info['columns']):
+ or 'surface deflection (m)' not in b.info['columns']):
try:
contact.run(hooke, inqueue, outqueue, **params)
except PoorFit, e:
Argument(name='distance info name', type='string',
default='surface distance offset',
help="""
-Name of the column (without units) for storing the distance offset in the `.info` dictionary.
+Name (without units) for storing the distance offset in the `.info` dictionary.
""".strip()),
Argument(name='deflection info name', type='string',
default='surface deflection offset',
help="""
-Name of the column (without units) for storing the deflection offset in the `.info` dictionary.
+Name (without units) for storing the deflection offset in the `.info` dictionary.
""".strip()),
Argument(name='fit parameters info name', type='string',
default='surface deflection offset',
help="""
-Name of the column (without units) for storing the deflection offset in the `.info` dictionary.
+Name (without units) for storing the deflection offset in the `.info` dictionary.
""".strip()),
],
help=self.__doc__, plugin=plugin)
surface_index = len(d_data)-1-surface_index
return (numpy.round(surface_index), deflection_offset, info)
-class ForceCommand (Command):
- """Calculate a block's `deflection (N)` array.
- Uses the block's `deflection (m)` array and
- `spring constant (N/m)`.
+class ForceCommand (Command):
+ """Convert a deflection column from meters to newtons.
"""
def __init__(self, plugin):
super(ForceCommand, self).__init__(
Data block for which the force should be calculated. For an
approach/retract force curve, `0` selects the approaching curve and `1`
selects the retracting curve.
+""".strip()),
+ Argument(name='input deflection column', type='string',
+ default='surface deflection (m)',
+ help="""
+Name of the column to use as the deflection input.
+""".strip()),
+ Argument(name='output deflection column', type='string',
+ default='deflection',
+ help="""
+Name of the column (without units) to use as the deflection output.
+""".strip()),
+ Argument(name='spring constant info name', type='string',
+ default='spring constant (N/m)',
+ help="""
+Name of the spring constant in the `.info` dictionary.
""".strip()),
],
help=self.__doc__, plugin=plugin)
new = Data((data.shape[0], data.shape[1]+1), dtype=data.dtype)
new.info = copy.deepcopy(data.info)
new[:,:-1] = data
- new.info['columns'].append('deflection (N)')
- d_data = data[:,data.info['columns'].index('surface adjusted deflection (m)')]
- new[:,-1] = d_data * data.info['spring constant (N/m)']
+ new.info['columns'].append(
+ join_data_label(params['output deflection column'], 'N'))
+ d_data = data[:,data.info['columns'].index(
+ params['input deflection column'])]
+ new[:,-1] = d_data * data.info[params['spring constant info name']]
params['curve'].data[params['block']] = new