From fb6fe1fde4ce9d4b5d193aea850ac6306ad282aa Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 9 Aug 2010 20:10:33 -0400 Subject: [PATCH] Update PolymerFitCommand to use flexible column names. This allows you to fit multiple WLCs, etc. (by changing the 'output tension column' name), so you can fit multiple peaks and/or multiple models. --- hooke/plugin/polymer_fit.py | 34 +++++++++++++++++++++++++++++----- hooke/plugin/vclamp.py | 2 +- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/hooke/plugin/polymer_fit.py b/hooke/plugin/polymer_fit.py index 09b9909..2bdb440 100644 --- a/hooke/plugin/polymer_fit.py +++ b/hooke/plugin/polymer_fit.py @@ -38,8 +38,9 @@ from ..command import Command, Argument, Failure from ..config import Setting from ..curve import Data from ..plugin import Plugin -from ..util.fit import PoorFit, ModelFitter from ..util.callback import is_iterable +from ..util.fit import PoorFit, ModelFitter +from ..util.si import join_data_label, split_data_label from .curve import CurveArgument from .vclamp import scale @@ -945,6 +946,26 @@ approach/retract force curve, `0` selects the approaching curve and Argument(name='bounds', type='point', optional=False, count=2, help=""" Indicies of points bounding the selected data. +""".strip()), + Argument(name='input distance column', type='string', + default='cantilever adjusted extension (m)', + help=""" +Name of the column to use as the surface positioning input. +""".strip()), + Argument(name='input deflection column', type='string', + default='deflection (N)', + help=""" +Name of the column to use as the deflection input. +""".strip()), + Argument(name='output tension column', type='string', + default='polymer tension', + help=""" +Name of the column (without units) to use as the polymer tension output. +""".strip()), + Argument(name='fit parameters info name', type='string', + default='surface deflection offset', + help=""" +Name (without units) for storing the fit parameters in the `.info` dictionary. """.strip()), ], help=self.__doc__, plugin=plugin) @@ -961,14 +982,17 @@ Indicies of points bounding the selected data. 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('%s tension (N)' % model) # TODO: WLC fit for each peak, etc. + new.info['columns'].append( + join_data_label(params['output tension column'], 'N')) z_data = data[:,data.info['columns'].index( - 'cantilever adjusted extension (m)')] - d_data = data[:,data.info['columns'].index('deflection (N)')] + params['input distance column'])] + d_data = data[:,data.info['columns'].index( + params['input deflection column'])] start,stop = params['bounds'] tension_data,ps = self.fit_polymer_model( params['curve'], z_data, d_data, start, stop, outqueue) - new.info['%s polymer fit parameters' % model] = ps + new.info[params['fit parameters info name']] = ps + new.info[params['fit parameters info name']]['model'] = model new[:,-1] = tension_data params['curve'].data[params['block']] = new diff --git a/hooke/plugin/vclamp.py b/hooke/plugin/vclamp.py index 77887db..a676e31 100644 --- a/hooke/plugin/vclamp.py +++ b/hooke/plugin/vclamp.py @@ -284,7 +284,7 @@ Name (without units) for storing the deflection offset in the `.info` dictionary Argument(name='fit parameters info name', type='string', default='surface deflection offset', help=""" -Name (without units) for storing the deflection offset in the `.info` dictionary. +Name (without units) for storing fit parameters in the `.info` dictionary. """.strip()), ], help=self.__doc__, plugin=plugin) -- 2.26.2