From: <zk...@us...> - 2009-07-17 13:44:17
|
Revision: 649 http://pyphant.svn.sourceforge.net/pyphant/?rev=649&view=rev Author: zklaus Date: 2009-07-17 13:44:14 +0000 (Fri, 17 Jul 2009) Log Message: ----------- Merge branch 'master' into svn-trunk * master: Enh: Take steepness of model into account. Modified Paths: -------------- trunk/src/workers/OSC/OSC/EstimateParameter.py Modified: trunk/src/workers/OSC/OSC/EstimateParameter.py =================================================================== --- trunk/src/workers/OSC/OSC/EstimateParameter.py 2009-06-24 13:56:20 UTC (rev 648) +++ trunk/src/workers/OSC/OSC/EstimateParameter.py 2009-07-17 13:44:14 UTC (rev 649) @@ -56,18 +56,25 @@ _params = [("extentX", u"Extension of x-axis [%%]", 10, None), ("extentY", u"Extension of y-axis [%%]", 10, None)] - def calculateThickness(self, row, model,error=None): + def calculateThickness(self, row, model, error=None): + """ + Given a vector of minima (row) and a 2 dimensional model, + this estimates the corresponding parameter. + """ if len(row)==0: return numpy.nan data = model.data.transpose() - def calc(row, col,error): + data = data[:,:-1]*(numpy.diff(data)**2) + def calc(row, col, error): if error: - return sum([col[numpy.argmin(((model.dimensions[0].data-c)/e)**2)] - for c,e in zip(row,error)]) + return sum([ + col[numpy.argmin(((model.dimensions[0].data-c)/e)**2)] + for c,e in zip(row, error) + ]) else: return sum([col[numpy.argmin((model.dimensions[0].data-c)**2)] for c in row]) - i = numpy.argmin(numpy.array([calc(row, col,error) for col in data])) + i = numpy.argmin(numpy.array([calc(row, col, error) for col in data])) return model.dimensions[1].data[i] @Worker.plug(Connectors.TYPE_IMAGE) @@ -84,17 +91,21 @@ subscriber %= acc for row in minima: if error: - filteredError = filter(lambda c: not numpy.isnan(c), error.next()) + filteredError = filter( + lambda c: not numpy.isnan(c), error.next()) else: filteredError = None - parameter.append(self.calculateThickness( filter(lambda c: not numpy.isnan(c), row), - model, - filteredError)) + parameter.append(self.calculateThickness( + filter(lambda c: not numpy.isnan(c), row), + model, + filteredError + )) acc += inc subscriber %= acc - result = DataContainer.FieldContainer(numpy.array(parameter), - longname = model.dimensions[-1].longname, - shortname = model.dimensions[-1].shortname, - unit = model.dimensions[-1].unit) + result = DataContainer.FieldContainer( + numpy.array(parameter), + longname = model.dimensions[-1].longname, + shortname = model.dimensions[-1].shortname, + unit = model.dimensions[-1].unit) result.seal() return result This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |