tabular_model

astropy.modeling.tabular.tabular_model(dim, name=None)[source] [edit on github]

Make a Tabular model where n_inputs is based on the dimension of the lookup_table.

This model has to be further initialized and when evaluated returns the interpolated values.

Parameters:

dim : int

Dimensions of the lookup table.

name : str

Name for the class.

Examples

>>> table = np.array([[ 3.,  0.,  0.],
...                  [ 0.,  2.,  0.],
...                  [ 0.,  0.,  0.]])
>>> tab = tabular_model(2, name='Tabular2D')
>>> print(tab)
    <class 'abc.Tabular2D'>
    Name: Tabular2D
    Inputs: (u'x0', u'x1')
    Outputs: (u'y',)
>>> points = ([1, 2, 3], [1, 2, 3])

Setting fill_value to None, allows extrapolation. >>> m = tab(points, lookup_table=table, name=’my_table’, bounds_error=False, fill_value=None, method=’nearest’)

>>> xinterp = [0, 1, 1.5, 2.72, 3.14]
>>> m(xinterp, xinterp)
    array([ 3., 3., 3., 0., 0.])