astropy:docs

SerialCompositeModel

class astropy.modeling.core.SerialCompositeModel(transforms, inmap=None, outmap=None, n_inputs=None, n_outputs=None)[source] [edit on github]

Bases: astropy.modeling.core._CompositeModel

Composite model that evaluates models in series.

Parameters :

transforms : list

a list of transforms in the order to be executed

inmap : list of lists or None

labels in an input instance of LabeledInput if None, the number of input coordinates is exactly what the transforms expect

outmap : list or None

labels in an input instance of LabeledInput if None, the number of output coordinates is exactly what the transforms expect

Notes

Output values of one model are used as input values of another. Obviously the order of the models matters.

Examples

Apply a 2D rotation followed by a shift in x and y:

>>> import numpy as np
>>> from astropy.modeling import models, LabeledInput, SerialCompositeModel
>>> x, y = np.mgrid[:5, :5]
>>> rotation = models.MatrixRotation2D(angle=23.5)
>>> offset_x = models.Shift(-4.23)
>>> offset_y = models.Shift(2)
>>> labeled_input = LabeledInput([x, y], ["x", "y"])
>>> transform = SerialCompositeModel([rotation, offset_x, offset_y],
...                                  inmap=[['x', 'y'], ['x'], ['y']],
...                                  outmap=[['x', 'y'], ['x'], ['y']])
>>> result = transform(labeled_input)

Methods Summary

inverse()

Methods Documentation

inverse()[source] [edit on github]

Page Contents