Identity

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

Bases: astropy.modeling.mappings.Mapping

Returns inputs unchanged.

This class is useful in compound models when some of the inputs must be passed unchanged to the next model.

Parameters:

n_inputs : int

Specifies the number of inputs this identity model accepts.

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.

Examples

Transform (x, y) by a shift in x, followed by scaling the two inputs:

>>> from astropy.modeling.models import (Polynomial1D, Shift, Scale,
...                                      Identity)
>>> model = (Shift(1) & Identity(1)) | Scale(1.2) & Scale(2)
>>> model(1,1)  
(2.4, 2.0)
>>> model.inverse(2.4, 2) 
(1.0, 1.0)