From ccaff99ccf9273b04239ec5fc4bbe55c3892a169 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 10 Aug 2010 13:10:40 -0400 Subject: [PATCH] Use numpy.nan to hide unfit portions of polymer tension columns. --- hooke/plugin/polymer_fit.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/hooke/plugin/polymer_fit.py b/hooke/plugin/polymer_fit.py index a5e892e..43ed44b 100644 --- a/hooke/plugin/polymer_fit.py +++ b/hooke/plugin/polymer_fit.py @@ -1032,10 +1032,9 @@ Name (without units) for storing the fit parameters in the `.info` dictionary. L = model.L(Lp) T = info['temperature (K)'] fit_info = queue.get(block=False) - mask = numpy.zeros(z_data.shape, dtype=numpy.bool) - mask[start:stop] = True - return [FJC_fn(z_data, T=T, L=L, a=a) * mask, - fit_info] + f_data = numpy.ones(z_data.shape, dtype=z_data.dtype) * numpy.nan + f_data[start:stop] = FJC_fn(z_data[start:stop], T=T, L=L, a=a) + return [f_data, fit_info] def fit_FJC_PEG_model(self, params, z_data, d_data, start, stop, outqueue=None): @@ -1049,7 +1048,7 @@ Name (without units) for storing the fit parameters in the `.info` dictionary. if True: # TODO: optionally free persistence length info['Kuhn length (m)'] = ( params['FJC Kuhn length']) - model = FJC(d_data[start:stop], info=info, rescale=True) + model = FJC_PEG(d_data[start:stop], info=info, rescale=True) queue = Queue() params = model.fit(outqueue=queue) if True: # TODO: if Kuhn length fixed @@ -1061,10 +1060,9 @@ Name (without units) for storing the fit parameters in the `.info` dictionary. N = model.L(Nr) T = info['temperature (K)'] fit_info = queue.get(block=False) - mask = numpy.zeros(z_data.shape, dtype=numpy.bool) - mask[start:stop] = True - return [FJC_PEG_fn(z_data, **kwargs) * mask, - fit_info] + f_data = numpy.ones(z_data.shape, dtype=z_data.dtype) * numpy.nan + f_data[start:stop] = FJC_PEG_fn(z_data[start:stop], **kwargs) + return [f_data, fit_info] def fit_WLC_model(self, params, z_data, d_data, start, stop, outqueue=None): @@ -1089,11 +1087,9 @@ Name (without units) for storing the fit parameters in the `.info` dictionary. L = model.L(Lp) T = info['temperature (K)'] fit_info = queue.get(block=False) - mask = numpy.zeros(z_data.shape, dtype=numpy.bool) - mask[start:stop] = True - return [WLC_fn(z_data, T=T, L=L, p=p) * mask, - fit_info] - + f_data = numpy.ones(z_data.shape, dtype=z_data.dtype) * numpy.nan + f_data[start:stop] = WLC_fn(z_data[start:stop], T=T, L=L, p=p) + return [f_data, fit_info] class PolymerFitPeaksCommand (Command): -- 2.26.2