Bases: object
This mixin class (i.e. a class intended to be subclassed to provide extra
functionality) converts FunctionModel input values from one coordinate
system to another.
Subclassing
In subclasses, the following class attributes should be defined:
- _inputtransforms : a dictionary of dictionaries where the values
are functions that define the transforms as
_intransforms[incoordsys][funccoordsys] = func
- incoordsys : the default input coordinate system
- fcoordsys : the coordinate system in which the function is defined
To implement the transform, just call tranformCoordinates() and
feed the return value into the f() function.
-
__init__()
x.__init__(...) initializes x; see help(type(x)) for signature
Methods
| addTransform(input, output, func) |
Register a function as a transform from one coordinate system to another. |
| transformCoordinates(x[, incoordsys, ...]) |
Transform from the input coordinate system into that defined for the model function. |
Attributes
-
addTransform(input, output, func)[source]
Register a function as a transform from one coordinate system to
another.
| Parameters: |
- input (string) – The name for the input system of this function.
- output (string) – The name for the output system of this function.
- func (callable) – The function to perform the transform. It should take one argument,
an array with at least 2 dimensions where the first dimension is defined
by the coordinate system.
|
-
transformCoordinates(x, incoordsys=None, outcoordsys=None)[source]
Transform from the input coordinate system into that defined for the
model function.
| Parameters: |
- incoordsys (string or None) – The input coordinate system name to use for this model. If None,
incoordsys will be used.
- outcoordsys (string) – The output coordinate system name to use for this model. If None,
the standard for this model will be used.
|
if incoordsys is None, self.`incoordsys will be used