Exemple #1
0
    def test_regression_1310(self):
        # Regression test for gh-1310
        data = np.load(data_file('bug-1310.npz'))['data']

        # Shouldn't crash -- the input data triggers work array sizes
        # that caused previously some data to not be aligned on
        # sizeof(double) boundaries in memory, which made the Fortran
        # code to crash when compiled with -O3
        bisplrep(data[:,0], data[:,1], data[:,2], kx=3, ky=3, s=0,
                 full_output=True)
Exemple #2
0
 def test_ilp64_bisplrep(self):
     check_free_memory(28000)  # VM size, doesn't actually use the pages
     x = np.linspace(0, 1, 400)
     y = np.linspace(0, 1, 400)
     x, y = np.meshgrid(x, y)
     z = np.zeros_like(x)
     tck = bisplrep(x, y, z, kx=3, ky=3, s=0)
     assert_allclose(bisplev(0.5, 0.5, tck), 0.0)
Exemple #3
0
 def check_5(self,f=f2,kx=3,ky=3,xb=0,xe=2*pi,yb=0,ye=2*pi,Nx=20,Ny=20,s=0):
     x = xb+(xe-xb)*arange(Nx+1,dtype=float)/float(Nx)
     y = yb+(ye-yb)*arange(Ny+1,dtype=float)/float(Ny)
     xy = makepairs(x,y)
     tck = bisplrep(xy[0],xy[1],f(xy[0],xy[1]),s=s,kx=kx,ky=ky)
     tt = [tck[0][kx:-kx],tck[1][ky:-ky]]
     t2 = makepairs(tt[0],tt[1])
     v1 = bisplev(tt[0],tt[1],tck)
     v2 = f2(t2[0],t2[1])
     v2.shape = len(tt[0]),len(tt[1])
     err = norm2(ravel(v1-v2))
     assert_(err < 1e-2, err)
     put(err)
Exemple #4
0
    def test_smoke_bisplrep_bisplev(self):
        xb, xe = 0, 2. * np.pi
        yb, ye = 0, 2. * np.pi
        kx, ky = 3, 3
        Nx, Ny = 20, 20

        def f2(x, y):
            return np.sin(x + y)

        x = np.linspace(xb, xe, Nx + 1)
        y = np.linspace(yb, ye, Ny + 1)
        xy = makepairs(x, y)
        tck = bisplrep(xy[0], xy[1], f2(xy[0], xy[1]), s=0, kx=kx, ky=ky)

        tt = [tck[0][kx:-kx], tck[1][ky:-ky]]
        t2 = makepairs(tt[0], tt[1])
        v1 = bisplev(tt[0], tt[1], tck)
        v2 = f2(t2[0], t2[1])
        v2.shape = len(tt[0]), len(tt[1])

        assert norm2(np.ravel(v1 - v2)) < 1e-2