fix_inputs#

astropy.modeling.fix_inputs(modelinstance, values, bounding_boxes=None, selector_args=None)[source]#

This function creates a compound model with one or more of the input values of the input model assigned fixed values (scalar or array).

Parameters:
modelinstanceModel instance

This is the model that one or more of the model input values will be fixed to some constant value.

valuesdict

A dictionary where the key identifies which input to fix and its value is the value to fix it at. The key may either be the name of the input or a number reflecting its order in the inputs.

bounding_boxesdict, optional

A dictionary of bounding boxes for the fixed model, keyed on the fixed input values, from which a CompoundBoundingBox is constructed. If not given, the returned model has no bounding box.

selector_argslist of tuple, optional

The selector arguments used to construct the compound bounding box from bounding_boxes. If not given, defaults to (key, True) for each input named in values.

Examples

>>> from astropy.modeling.models import Gaussian2D
>>> g = Gaussian2D(1, 2, 3, 4, 5)
>>> gv = fix_inputs(g, {0: 2.5})

Results in a 1D function equivalent to Gaussian2D(1, 2, 3, 4, 5)(x=2.5, y)