tabular_model#

astropy.modeling.tabular.tabular_model(dim, name=None)[源代码]#

做一个 Tabular 模型在哪里 n_inputs 基于查找表的维度。

这个模型必须进一步初始化,当被求值时返回插值值。

参数:
dim : intPython :整型

查找表的维度。

name : strPython :字符串

类的名称。

实例

>>> 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

设置 fill_valueNone 允许外推。

>>> 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.])