tabular_model#
- astropy.modeling.tabular.tabular_model(dim, name=None)[source]#
Make a
Tabular
model wheren_inputs
is based on the dimension of the lookup_table.This model has to be further initialized and when evaluated returns the interpolated values.
Examples
>>> import numpy as np >>> from astropy.modeling.models import tabular_model >>> tab = tabular_model(2, name='Tabular2D') >>> print(tab) <class 'astropy.modeling.tabular.Tabular2D'> Name: Tabular2D N_inputs: 2 N_outputs: 1
Setting
fill_value
toNone
allows extrapolation.>>> points = ([1, 2, 3], [1, 2, 3]) >>> table = np.array([[3., 0., 0.], ... [0., 2., 0.], ... [0., 0., 0.]]) >>> model = 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] >>> model(xinterp, xinterp) array([3., 3., 3., 0., 0.])