astropy:docs

LabeledInput

class astropy.modeling.core.LabeledInput(data, labels)[source] [edit on github]

Bases: dict

Create a container with all input data arrays, assigning labels for each one.

Used by CompositeModel to choose input data using labels

Parameters:

data : list

a list of all input data

labels : list of strings

names matching each coordinate in data

Returns:

data : LabeledData

a dict of input data and their assigned labels

Examples

>>> x,y = np.mgrid[:5, :5]
>>> l = np.arange(10)
>>> ado = LabeledInput([x, y, l], ['x', 'y', 'pixel'])
>>> ado.x
array([[0, 0, 0, 0, 0],
       [1, 1, 1, 1, 1],
       [2, 2, 2, 2, 2],
       [3, 3, 3, 3, 3],
       [4, 4, 4, 4, 4]])
>>> ado['x']
array([[0, 0, 0, 0, 0],
       [1, 1, 1, 1, 1],
       [2, 2, 2, 2, 2],
       [3, 3, 3, 3, 3],
       [4, 4, 4, 4, 4]])

Methods Summary

add([label, value]) Add input data to a LabeledInput object
copy()

Methods Documentation

add(label=None, value=None, **kw)[source] [edit on github]

Add input data to a LabeledInput object

Parameters:

label : str

coordinate label

value : numerical type

coordinate value

kw : dictionary

if given this is a dictionary of {label: value} pairs

copy()[source] [edit on github]

Page Contents