moviemaker2.function

  • Defining math overloads requires that the mathematical Functions are at hand. But those are derivatives of Function. So we would have to define the Functions for mathematical overloads in the same scope as the Function base class.
  • Defining the Function class first, it is possible to define mathematical Functions in moviemaker2.math, when defining the MathFunction class, which has mathematical overloads using those mathematical Functions.
  • Tests whether an object is a function or not require only testing if the object is an instance of Function.
class moviemaker2.function.Function[source]

The base class of all Functions. It is a bare class without any attributes. Used in isinstance(object, Function).

class moviemaker2.function.Constant(value)[source]

A Function yielding always the same value.

__init__(value)[source]

value is the value of the Constant.

__call__(*args, **kwargs)[source]

Returns the constant value.

class moviemaker2.function.Identity[source]

Returns always its argument(s). If called with precisely one argument, returns the argument as a scalar, else the argument vector is returned.

__call__(*args)[source]
moviemaker2.function.asfunction(function_like)[source]
  • If function_like is a Function, it is returned unchanged.
  • If function_like is None, an Identity is returned.
  • Else, the function_like is interpreted as a Constant.

For asfunctionv(), asfunction() is applied to any element of an array_like argument.

moviemaker2.function.asfunctionv(pyfunc, otypes='', doc=None)
  • If function_like is a Function, it is returned unchanged.
  • If function_like is None, an Identity is returned.
  • Else, the function_like is interpreted as a Constant.

For asfunctionv(), asfunction() is applied to any element of an array_like argument.

Previous topic

API

Next topic

moviemaker2.math

This Page