def perform(p0, p1, cm, A): assert moments(A, p0, p1, cm) == _slow(A, p0,p1,cm)
def f(im): return moments(im, p0, p1, cm=mh.center_of_mass(im), normalize=1)
def test_smoke(): assert moments(np.zeros((100,23)), 2, 2) == 0.0 assert moments(np.ones((100,23)), 2, 2) != 0.0 assert moments(np.ones((100,23)), 0, 0) == 100*23 assert moments(np.ones((100,23)), 2, 2) != moments(np.ones((100,23)), 2, 2, cm=(50,12))
def test_against_slow(p0, p1, cm): A = (np.arange(2048) % 14).reshape((32, -1)) assert moments(A, p0, p1, cm) == _slow(A, p0, p1, cm)
def test_smoke(): assert moments(np.zeros((100, 23)), 2, 2) == 0.0 assert moments(np.ones((100, 23)), 2, 2) != 0.0 assert moments(np.ones((100, 23)), 0, 0) == 100 * 23 assert moments(np.ones( (100, 23)), 2, 2) != moments(np.ones((100, 23)), 2, 2, cm=(50, 12))
def perform(p0, p1, cm, A): assert moments(A, p0, p1, cm) == _slow(A, p0, p1, cm)