def gauscurv_gen(N,m,n): rarr = test_spectrum.sin_cos_arr(N,m,n) gc = curvature.gaus_curv(rarr) X,Y = np.ogrid[0:N, 0:N] X -= N/2; Y -= N/2 Fxx = -(1.0*m)**2 * np.sin(2*m*np.pi*X/N) Fyy = (1.0*n)**2 * np.cos(2*n*np.pi*Y/N) Fx = (1.0*m) * np.cos(2*m*np.pi*X/N) Fy = (1.0*n) * np.sin(2*n*np.pi*Y/N) denom = (Fx**2 + Fy**2 + 1)**2 calc_gc = Fxx*Fyy / denom ok_(np.allclose(calc_gc, gc))
def test_gauscurv_zero(): zz = np.zeros((100,100), dtype='f') gc = curvature.gaus_curv(zz) ok_(np.allclose(zz, gc))