Beispiel #1
0
def test_min_max():
    # min: num.Fit1D.get_min()
    x = np.linspace(-10,10,100) 
    y = (x-5)**2.0 + 1.0
    spl = Spline(x,y)
    xmin = spl.get_min()
    ymin = spl(xmin)
    np.testing.assert_almost_equal(xmin, 5.0)
    np.testing.assert_almost_equal(ymin, 1.0)

    # max: num.Fit1D.get_max()
    y = -(x-5)**2.0 + 1.0
    spl = Spline(x,y)
    xmax = spl.get_max()
    ymax = spl(xmin)
    np.testing.assert_almost_equal(xmax, 5.0)
    np.testing.assert_almost_equal(ymax, 1.0)
Beispiel #2
0
def test_min_max():
    # min: num.Fit1D.get_min()
    x = np.linspace(-10, 10, 100)
    y = (x - 5)**2.0 + 1.0
    spl = Spline(x, y)
    xmin = spl.get_min()
    ymin = spl(xmin)
    np.testing.assert_almost_equal(xmin, 5.0)
    np.testing.assert_almost_equal(ymin, 1.0)

    # max: num.Fit1D.get_max()
    y = -(x - 5)**2.0 + 1.0
    spl = Spline(x, y)
    xmax = spl.get_max()
    ymax = spl(xmin)
    np.testing.assert_almost_equal(xmax, 5.0)
    np.testing.assert_almost_equal(ymax, 1.0)