def __init__(self, xp, fp, x, left=None, right=None): """Arguments are like for ``numpy.interp()``. If *left* or *right* is None, *None* will be handed over to ``numpy.interp()``.""" self.xp = asfunction(xp) self.fp = asfunction(fp) self.x = asfunction(x) self.left = asfunction(left) self.right = asfunction(right)
def __init__(self, points, progress): """*points* is a sequence of points of the Bezier curve. *progress* is the real-valued [0, 1] progress value of the Bezier curve. The constituents of *points* must be Functions (callable). So you might use ``fframework.compound()`` to generate a list or a tuple consisting of OpFunctions.""" self.points = asfunction(points) self.progress = asfunction(progress)
def __init__(self, coefficients, x=None, null=None): """*coefficients* gives the coefficients of the polynomial. *x* gives the argument of the polynomial. *null* is the null with respect to +, and ``None`` means ordinary 0.0.""" self.coefficients = asfunction(coefficients) self.x = asfunction(x) if null is None: self.null = Constant(0.0) else: self.null = asfunction(null)
def __init__(self, zero_layer=None, zero_weight=None): """*zero_layer* is the 0 to use in summing up the layers (the start value), it defaults to 0. *zero_weight* is the 0 to use in summing up the weights, it default to 0, too.""" if zero_layer is None: zero_layer = 0 if zero_weight is None: zero_weight = 0 Stack.__init__(self) self.zero_layer = asfunction(zero_layer) self.zero_weight = asfunction(zero_weight)
def insert(self, index, other): """Stacks *other* by insert()'ing it into the layer list. Acts in-place. Returns the inserted element.""" other_fn = asfunction(other) self.elements.insert(index, other_fn) return other_fn
def add_bottom(self, other): """Stacks *other* at the bottom of *self*. Acts in-place. Returns the added element.""" other_fn = asfunction(other) self.elements = [other_fn] + self.elements return other_fn
def add_top(self, other): """Stacks *other* onto *self*. Acts in-place. Returns the added element.""" other_fn = asfunction(other) self.elements.append(other_fn) return other_fn
def __xor__(self, other): """Stack *other* onto *self*. Acts in-place! This is done so that derived classes do not have to overlaod just to get the return class right. Anyway, returns *self*.""" self.elements.append(asfunction(other)) return self
def __init__(self, key, choices=None): """*key* gives an index into *choices*. *choices* is supposed to be a dictionary, mapping return values onto Functions, and defaults to the empty dict.""" if choices is None: choices = {} self.key = asfunction(key) self.choices = choices
def __init__(self, mesh=None): """*mesh* is the mesh generator.""" self.mesh = asfunction(mesh)
def __init__(self, background): Stack.__init__(self) self.background = asfunction(background)
def __init__(self, mesh=None): """*mesh* is in cartesian coordinates (y, x). The (y, x) coordinates are in the last dimension of the mesh.""" self.mesh = asfunction(mesh)
def __init__(self, background): """The *background* yields the background layer, no alpha.""" Stack.__init__(self) self.background = asfunction(background)
def __init__(self, vector, mesh=None): """*mesh* is the mesh Function, *vector* the vector Function.""" self.vector = asfunction(vector) self.mesh = asfunction(mesh)
def __call__(self, ps): """Evaluates ``.key(ps)`` and calls the appropriate function. The item from the dict will be passed through ``asfunction``.""" key = self.key(ps) return asfunction(self.choices[key])(ps)
def __init__(self, mesh): """*mesh* is the mesh Function.""" self.mesh = asfunction(mesh)
def __init__(self, p, value): """*value* is called and stored in the parameter object via *p*.""" self.p = p self.value = asfunction(value)
def __init__(self, mesh=None): """*mesh* is in polar coordinates (r, phi). This spacial coordinates are in the last dimension of the mesh.""" self.mesh = asfunction(mesh)