X-Git-Url: http://git.tremily.us/?p=hooke.git;a=blobdiff_plain;f=hooke%2Fplugin%2Fvclamp.py;fp=hooke%2Fplugin%2Fvclamp.py;h=c6c57344c685b1345851ae6fe077b61f37dc2c96;hp=d741173da573ebf2dcc6fad033d239e7cf766b55;hb=7bdd9b942a43a6de25db2f0f362e52a011c25c79;hpb=30e23074ef6385988825cd3e9400703794112b2e diff --git a/hooke/plugin/vclamp.py b/hooke/plugin/vclamp.py index d741173..c6c5734 100644 --- a/hooke/plugin/vclamp.py +++ b/hooke/plugin/vclamp.py @@ -102,7 +102,7 @@ Minimum `fit-contact-slope/guessed-contact-slope` ratio for a "good" fit. """ p = params # convenient alias rNC_ignore = self.info['ignore non-contact before index'] - if self.info['force zero non-contact slope'] == True: + if self.info['force zero non-contact slope'] is True: p = list(p) p.append(0.) # restore the non-contact slope parameter r2 = numpy.round(abs(p[2])) @@ -296,6 +296,11 @@ point (for the `wtk` algorithm). help=""" As an alternative to 'ignore index', ignore after the last peak in the peak list stored in the `.info` dictionary. +""".strip()), + Argument(name='force zero non-contact slope', type='bool', + default=False, count=1, + help=""" +Fix the fitted non-contact slope at zero. """.strip()), Argument(name='distance info name', type='string', default='surface distance offset', @@ -476,7 +481,8 @@ Name (without units) for storing fit parameters in the `.info` dictionary. if reverse == True: # approaching, contact region on the right d_data = d_data[::-1] s = SurfacePositionModel(d_data, info={ - 'force zero non-contact slope':True}, + 'force zero non-contact slope': + params['force zero non-contact slope']}, rescale=True) for argument in self._wtk_fit_check_arguments: s.info[argument.name] = params[argument.name] @@ -494,6 +500,10 @@ Name (without units) for storing fit parameters in the `.info` dictionary. s.info['ignore non-contact before index'] = ignore_index offset,contact_slope,surface_index,non_contact_slope = s.fit( outqueue=outqueue) + deflection_offset = offset + contact_slope*surface_index + delta_pos_per_point = z_data[1] - z_data[0] + contact_slope /= delta_pos_per_point # ddef/point -> ddev/dpos + non_contact_slope /= delta_pos_per_point info = { 'offset': offset, 'contact slope': contact_slope, @@ -501,7 +511,6 @@ Name (without units) for storing fit parameters in the `.info` dictionary. 'non-contact slope': non_contact_slope, 'reversed': reverse, } - deflection_offset = offset + contact_slope*surface_index, if reverse == True: surface_index = len(d_data)-1-surface_index return (numpy.round(surface_index), deflection_offset, info) @@ -535,6 +544,7 @@ Name of the spring constant in the `.info` dictionary. def _run(self, hooke, inqueue, outqueue, params): self._add_to_command_stack(params) params = self._setup_params(hooke=hooke, params=params) + # TODO: call .curve.ScaledColumnAdditionCommand def_data = self._get_column(hooke=hooke, params=params, column_name='deflection column') out = def_data * def_data.info[params['spring constant info name']]