Skip to main content
`Ctrl`+`K`

# tabular_model

astropy.modeling.tabular.tabular_model(dim, name=None)

  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 `python:int`

      Dimensions of the lookup table.

    name `python:str`

      Name for the class.

  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` to `None` 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.])