def test_displacement_int_stats(self): # Here, we only check that the use of stats # does not through an exception. img = np.random.normal(size=(32, 32)) img2 = shift(img, (1, 2)) displacement = dic(img, img2, pixelar, bsize=8, stats=True) assert_equal(displacement.dy, np.ones(len(displacement.dy)) * 1) assert_equal(displacement.dx, np.ones(len(displacement.dy)) * 2)
def test_rbf_displacement_int(self): method = 'rbf' img2 = shift(self.img, (1, 2)) displacement = dic(self.img, img2, subpixelar_interp, bsize=8, method=method) assert_array_almost_equal(displacement.dy, np.ones(len(displacement.dy)) * 1) assert_array_almost_equal(displacement.dx, np.ones(len(displacement.dx)) * 2)
def test_interp2d_displacement_float2(self): method = 'interp2d' shift = 1.7 npoints = 15 tform = tf.AffineTransform(scale=(1, 1), rotation=0, translation=(-shift, 0), shear=0) img2 = tf.warp(self.img, tform, order=3) displacement = dic(self.img, img2, subpixelar_interp, num_points_interp=npoints, method=method) assert_almost_identical(displacement.dy, np.zeros(len(displacement.dy)), tol=0.12) expected = np.ones(len(displacement.dx)) * shift assert_array_less(np.abs(displacement.dx - expected[1]), np.ones(expected[1].shape) * 0.31)
def test_RectBivariateSpline_displacement_float(self): method = 'RectBivariateSpline' shift = 1.3 npoints = 5 tform = tf.AffineTransform(scale=(1, 1), rotation=0, translation=(-shift, 0), shear=0) img2 = tf.warp(self.img, tform, order=3) displacement = dic(self.img, img2, subpixelar_interp, bsize=8, num_points_interp=npoints, method=method) assert_array_almost_equal(displacement.dy, np.zeros(len(displacement.dy))) expected = np.ones(len(displacement.dx)) * shift assert_array_less(np.abs(displacement.dx - expected[1]), np.ones(expected[1].shape) * 0.31)
def test_displacement_int(self): img = np.random.normal(size=(32, 32)) img2 = shift(img, (1, 2)) displacement = dic(img, img2, pixelar, bsize=8) assert_equal(displacement.dy, np.ones(len(displacement.dy)) * 1) assert_equal(displacement.dx, np.ones(len(displacement.dy)) * 2)