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
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)
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