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.
- Parameters:
- dim
python:int
Dimensions of the lookup table.
- name
python:str
Name for the class.
- dim
Examples
>>> table = np.array([[3., 0., 0.], ... [0., 2., 0.], ... [0., 0., 0.]])
>>> tab = tabular_model(2, name='Tabular2D') >>> print(tab) <class 'astropy.modeling.tabular.Tabular2D'> Name: Tabular2D N_inputs: 2 N_outputs: 1
>>> 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.])