本文整理汇总了Python中augustus.core.NumpyInterface.NP.min方法的典型用法代码示例。如果您正苦于以下问题:Python NP.min方法的具体用法?Python NP.min怎么用?Python NP.min使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类augustus.core.NumpyInterface.NP
的用法示例。
在下文中一共展示了NP.min方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: prepare
# 需要导入模块: from augustus.core.NumpyInterface import NP [as 别名]
# 或者: from augustus.core.NumpyInterface.NP import min [as 别名]
def prepare(self, state, dataTable, functionTable, performanceTable, plotRange):
"""Prepare a plot element for drawing.
This stage consists of calculating all quantities and
determing the bounds of the data. These bounds may be unioned
with bounds from other plot elements that overlay this plot
element, so the drawing (which requires a finalized coordinate
system) cannot begin yet.
This method modifies C{plotRange}.
@type state: ad-hoc Python object
@param state: State information that persists long enough to use quantities computed in C{prepare} in the C{draw} stage. This is a work-around of lxml's refusal to let its Python instances maintain C{self} and it is unrelated to DataTableState.
@type dataTable: DataTable
@param dataTable: Contains the data to plot.
@type functionTable: FunctionTable
@param functionTable: Defines functions that may be used to transform data for plotting.
@type performanceTable: PerformanceTable
@param performanceTable: Measures and records performance (time and memory consumption) of the drawing process.
@type plotRange: PlotRange
@param plotRange: The bounding box of plot coordinates that this function will expand.
"""
self.checkRoles(["y(x)", "dy/dx", "x(t)", "y(t)", "dx/dt", "dy/dt", "x", "y", "dx", "dy"])
performanceTable.begin("PlotCurve prepare")
self._saveContext(dataTable)
yofx = self.xpath("pmml:PlotFormula[@role='y(x)']")
dydx = self.xpath("pmml:PlotFormula[@role='dy/dx']")
xoft = self.xpath("pmml:PlotFormula[@role='x(t)']")
yoft = self.xpath("pmml:PlotFormula[@role='y(t)']")
dxdt = self.xpath("pmml:PlotFormula[@role='dx/dt']")
dydt = self.xpath("pmml:PlotFormula[@role='dy/dt']")
nx = self.xpath("pmml:PlotNumericExpression[@role='x']")
ny = self.xpath("pmml:PlotNumericExpression[@role='y']")
ndx = self.xpath("pmml:PlotNumericExpression[@role='dx']")
ndy = self.xpath("pmml:PlotNumericExpression[@role='dy']")
cutExpression = self.xpath("pmml:PlotSelection")
if len(yofx) + len(dydx) + len(xoft) + len(yoft) + len(dxdt) + len(dydt) > 0:
if len(yofx) == 1 and len(dydx) == 0 and len(xoft) == 0 and len(yoft) == 0 and len(dxdt) == 0 and len(dydt) == 0:
expression = (yofx[0].text,)
derivative = (None,)
elif len(yofx) == 1 and len(dydx) == 1 and len(xoft) == 0 and len(yoft) == 0 and len(dxdt) == 0 and len(dydt) == 0:
expression = (yofx[0].text,)
derivative = (dydx[0].text,)
elif len(yofx) == 0 and len(dydx) == 0 and len(xoft) == 1 and len(yoft) == 1 and len(dxdt) == 0 and len(dydt) == 0:
expression = xoft[0].text, yoft[0].text
derivative = None, None
elif len(yofx) == 0 and len(dydx) == 0 and len(xoft) == 1 and len(yoft) == 1 and len(dxdt) == 1 and len(dydt) == 1:
expression = xoft[0].text, yoft[0].text
derivative = dxdt[0].text, dydt[0].text
else:
raise defs.PmmlValidationError("The only allowed combinations of PlotFormulae are: \"y(x)\", \"y(x) dy/dx\", \"x(t) y(t)\", and \"x(t) y(t) dx/dt dy/dt\"")
low = self.get("low", convertType=True)
high = self.get("high", convertType=True)
if low is None or high is None:
raise defs.PmmlValidationError("The \"low\" and \"high\" attributes are required for PlotCurves defined by formulae")
samples = self.generateSamples(low, high)
loop = self.get("loop", defaultFromXsd=True, convertType=True)
state.x, state.y, state.dx, state.dy, xfieldType, yfieldType = self.expressionsToPoints(expression, derivative, samples, loop, functionTable, performanceTable)
else:
performanceTable.pause("PlotCurve prepare")
if len(ndx) == 1:
dxdataColumn = ndx[0].evaluate(dataTable, functionTable, performanceTable)
else:
dxdataColumn = None
if len(ndy) == 1:
dydataColumn = ndy[0].evaluate(dataTable, functionTable, performanceTable)
else:
dydataColumn = None
performanceTable.unpause("PlotCurve prepare")
if len(nx) == 0 and len(ny) == 1:
performanceTable.pause("PlotCurve prepare")
ydataColumn = ny[0].evaluate(dataTable, functionTable, performanceTable)
performanceTable.unpause("PlotCurve prepare")
if len(cutExpression) == 1:
performanceTable.pause("PlotCurve prepare")
selection = cutExpression[0].select(dataTable, functionTable, performanceTable)
performanceTable.unpause("PlotCurve prepare")
else:
selection = NP("ones", len(ydataColumn.data), NP.dtype(bool))
if ydataColumn.mask is not None:
selection = NP("logical_and", selection, NP(ydataColumn.mask == defs.VALID), selection)
if dxdataColumn is not None and dxdataColumn.mask is not None:
selection = NP("logical_and", selection, NP(dxdataColumn.mask == defs.VALID), selection)
#.........这里部分代码省略.........