astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v1.1.1 »
- Models and Fitting (`astropy.modeling`) »
- Mapping

# Mapping

class `astropy.modeling.mappings.``Mapping`

  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

  `eval`(*args, **kwargs) | Deprecated since version 1.0.
  `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

  `eval`(*args, **kwargs)

    Deprecated since version 1.0: The eval function is deprecated and may be removed in a future version. Use Mapping.evaluate instead.

    Evaluate the model on some input variables.

  `evaluate`(*args)

    Evaluate the model on some input variables.