Mapping

class astropy.modeling.mappings.Mapping(mapping, n_inputs=None, name=None, meta=None)[source] [edit on github]

Bases: astropy.modeling.Model

Allows inputs to be reordered, duplicated or dropped.

Parameters:

mapping : tuple

A tuple of integers representing indices of the inputs to this model to return and in what order to return them. See Advanced mappings for more details.

n_inputs : int

Number of inputs; if None (default) then max(mapping) + 1 is used (i.e. the highest input index used in the mapping).

name : str, optional

A human-friendly name associated with this model instance (particularly useful for identifying the individual components of a compound model).

meta : dict-like

Free-form metadata to associate with this model.

Raises:

TypeError

Raised when number of inputs is less that max(mapping).

Examples

>>> from astropy.modeling.models import Polynomial2D, Shift, Mapping
>>> poly1 = Polynomial2D(1, c0_0=1, c1_0=2, c0_1=3)
>>> poly2 = Polynomial2D(1, c0_0=1, c1_0=2.4, c0_1=2.1)
>>> model = (Shift(1) & Shift(2)) | Mapping((0, 1, 0, 1)) | (poly1 & poly2)
>>> model(1, 2)  
(17.0, 14.2)

Attributes Summary

inputs The name(s) of the input variable(s) on which a model is evaluated.
mapping Integers representing indices of the inputs.
outputs The name(s) of the output(s) of the model.

Methods Summary

evaluate(*args) Evaluate the model on some input variables.

Attributes Documentation

inputs

The name(s) of the input variable(s) on which a model is evaluated.

mapping

Integers representing indices of the inputs.

outputs

The name(s) of the output(s) of the model.

Methods Documentation

evaluate(*args)[source] [edit on github]

Evaluate the model on some input variables.