25from ._math
import ChebyshevBoundedField, ChebyshevBoundedFieldControl
35 nStepX=100, nStepY=100):
37 Approximate a bounded field as a ChebyshevBoundedField.
42 A bounded field to approximate
43 orderX : `int`, optional
44 Order of the Chebyshev polynomial
in the x direction.
46 orderY : `int`, optional
47 Order of the Chebyshev polynomial
in the y direction.
49 nStepX : `int`, optional
50 Number of x steps to approximate boundedField.
52 nStepY : `int`, optional
53 Number of y steps to approximate boundedField.
61 ctrl = ChebyshevBoundedFieldControl()
64 ctrl.triangular = False
66 bbox = boundedField.getBBox()
68 xSteps = np.linspace(bbox.getMinX(), bbox.getMaxX(), nStepX)
69 ySteps = np.linspace(bbox.getMinY(), bbox.getMaxY(), nStepY)
71 x = np.tile(xSteps, nStepY)
72 y = np.repeat(ySteps, nStepX)
74 return cls.fit(bbox, x, y, boundedField.evaluate(x, y), ctrl)
def approximate(cls, boundedField, orderX=3, orderY=3, nStepX=100, nStepY=100)
An abstract base class for 2-d functions defined on an integer bounding boxes.
A BoundedField based on 2-d Chebyshev polynomials of the first kind.