def test_scatter_neu(self): Q = self.Q QQ = wavemap.scatter(Q, wavemap.neumann) i,j = 1,2 npt.assert_allclose(QQ[i+1,j+1], Q[i,j]) npt.assert_allclose(QQ[0,:]-QQ[1,:],0) npt.assert_allclose(QQ[:,-2]-QQ[:,-1],0)
def test_scatter_per(self): Q = self.Q QQ = wavemap.scatter(Q, wavemap.periodic) i,j = 1,2 npt.assert_allclose(QQ[i+1,j+1], Q[i,j]) npt.assert_allclose(QQ[0]-QQ[-2],0) npt.assert_allclose(QQ[:,1]-QQ[:,-1],0)
def test_grad_pot(self): Q = np.ones([5,5,3]) QQ = wavemap.scatter(Q, border=wavemap.periodic) wm = get_wavemap() pot = wm.grad_potential(QQ) npt.assert_allclose(pot, 0.)
def test_dir_grad(self): Q = np.ones([5,5,3]) QQ = wavemap.scatter(Q, wavemap.periodic) dQ = wavemap.directed_grad(QQ, 0) self.assertEqual(np.shape(dQ), (5,5,3)) npt.assert_allclose(dQ, 0.)
def test_laplace(self): Q = self.Q QQ = wavemap.scatter(Q, wavemap.periodic) L = wavemap.directed_laplace(QQ, 0) self.assertEqual(np.shape(L), np.shape(Q))