astropy:docs

SerialCompositeModel

class astropy.modeling.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

n_inputs : int

dimension of input space (e.g. 2 for a spatial model)

n_outputs : int

dimension of output

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
>>> y, x = np.mgrid[:5, :5]
>>> rotation = models.Rotation2D(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

__call__(*data) Transforms data using this model.
inverse()

Methods Documentation

__call__(*data)[source] [edit on github]

Transforms data using this model.

inverse()[source] [edit on github]

Page Contents