From 4e166e6d424c3338472e00dce7a416dce2ff8c50 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 10 Aug 2010 11:57:04 -0400 Subject: [PATCH] Add 'polymer fit' error reporting to PolymerFitPeaksCommand --- hooke/plugin/polymer_fit.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hooke/plugin/polymer_fit.py b/hooke/plugin/polymer_fit.py index 66df3e6..a5e892e 100644 --- a/hooke/plugin/polymer_fit.py +++ b/hooke/plugin/polymer_fit.py @@ -34,7 +34,7 @@ import sys import numpy from scipy.optimize import newton -from ..command import Command, Argument, Failure +from ..command import Command, Argument, Success, Failure from ..config import Setting from ..curve import Data from ..plugin import Plugin, argument_to_setting @@ -970,7 +970,6 @@ Name (without units) for storing the fit parameters in the `.info` dictionary. help=self.__doc__, plugin=plugin) def _run(self, hooke, inqueue, outqueue, params): - print params['curve'], id(params['curve']), 'PFC' for key,value in params.items(): if value == None: # Use configured default value. params[key] = self.plugin.config[key] @@ -987,7 +986,6 @@ Name (without units) for storing the fit parameters in the `.info` dictionary. new[:,:-1] = data new.info['columns'].append( join_data_label(params['output tension column'], 'N')) - print 'add column', id(params['curve']), new.info['columns'][-1], 'to', new.info['columns'][:-1] z_data = data[:,data.info['columns'].index( params['input distance column'])] d_data = data[:,data.info['columns'].index( @@ -997,7 +995,6 @@ Name (without units) for storing the fit parameters in the `.info` dictionary. params, z_data, d_data, start, stop, outqueue) new.info[params['fit parameters info name']] = ps new.info[params['fit parameters info name']]['model'] = model - print 'add info', params['fit parameters info name'] new[:,-1] = tension_data params['curve'].data[params['block']] = new @@ -1129,7 +1126,6 @@ Index of the selected peak in the list of peaks. Use `None` to fit all peaks. help=self.__doc__, plugin=plugin) def _run(self, hooke, inqueue, outqueue, params): - print params['curve'], id(params['curve']), 'PFPC' data = params['curve'].data[params['block']] fit_command = [c for c in hooke.commands if c.name=='polymer fit'][0] @@ -1145,6 +1141,9 @@ Index of the selected peak in the list of peaks. Use `None` to fit all peaks. p['output tension column'] = peak.name p['fit parameters info name'] = peak.name fit_command.run(hooke, inq, outq, **p) + ret = outq.get() + if not isinstance(ret, Success): + raise ret # TODO: # def dist2fit(self): -- 2.26.2