コード例 #1
0
ファイル: test_afits.py プロジェクト: banados/xastropy
def test_bspline_fit():
    # Generate data
    x = np.linspace(0,np.pi,50)
    y = np.sin(x)
    # Fit
    dfit = xafits.func_fit(x, y, 'bspline', 3, everyn=25)
    x2 = np.linspace(0,np.pi,100)
    y2 = xafits.func_val(x2,dfit)
    np.testing.assert_allclose(y2[50], 0.9941836965580888)
コード例 #2
0
ファイル: test_afits.py プロジェクト: banados/xastropy
def test_legend_fit():
    # Generate data
    x = np.linspace(0,np.pi,50)
    y = np.sin(x)
    # Fit
    dfit = xafits.func_fit(x, y, 'legendre', 4)
    x2 = np.linspace(0,np.pi,100)
    y2 = xafits.func_val(x2,dfit)
    np.testing.assert_allclose(y2[50], 0.99940823486206976)
コード例 #3
0
ファイル: test_afits.py プロジェクト: banados/xastropy
def test_poly_fit():
    # Generate data
    x = np.linspace(0,np.pi,50)
    y = np.sin(x)
    # Fit
    dfit = xafits.func_fit(x, y, 'polynomial', 3)
    x2 = np.linspace(0,np.pi,100)
    y2 = xafits.func_val(x2,dfit)
    np.testing.assert_allclose(y2[50], 0.97854984428713754)
コード例 #4
0
def test_bspline_fit():
    # Generate data
    x = np.linspace(0, np.pi, 50)
    y = np.sin(x)
    # Fit
    dfit = xafits.func_fit(x, y, 'bspline', 3, everyn=25)
    x2 = np.linspace(0, np.pi, 100)
    y2 = xafits.func_val(x2, dfit)
    np.testing.assert_allclose(y2[50], 0.9941836965580888)
コード例 #5
0
def test_legend_fit():
    # Generate data
    x = np.linspace(0, np.pi, 50)
    y = np.sin(x)
    # Fit
    dfit = xafits.func_fit(x, y, 'legendre', 4)
    x2 = np.linspace(0, np.pi, 100)
    y2 = xafits.func_val(x2, dfit)
    np.testing.assert_allclose(y2[50], 0.99940823486206976)
コード例 #6
0
def test_poly_fit():
    # Generate data
    x = np.linspace(0, np.pi, 50)
    y = np.sin(x)
    # Fit
    dfit = xafits.func_fit(x, y, 'polynomial', 3)
    x2 = np.linspace(0, np.pi, 100)
    y2 = xafits.func_val(x2, dfit)
    np.testing.assert_allclose(y2[50], 0.97854984428713754)