def test_shift_2d(self): ns = 500 w = scipy.signal.ricker(ns, 10) w = np.tile(w, (100, 1)).transpose() self.assertTrue(np.all(np.isclose(fshift(w, 1, axis=0), np.roll(w, 1, axis=0)))) self.assertTrue(np.all(np.isclose(fshift(w, 1, axis=1), np.roll(w, 1, axis=1)))) # # test with individual shifts for each trace self.assertTrue( np.all(np.isclose(fshift(w, np.ones(w.shape[1]), axis=0), np.roll(w, 1, axis=0)))) self.assertTrue( np.all(np.isclose(fshift(w, np.ones(w.shape[0]), axis=1), np.roll(w, 1, axis=1))))
def test_shift_1d(self): ns = 500 w = scipy.signal.ricker(ns, 10) self.assertTrue(np.all(np.isclose(fshift(w, 1), np.roll(w, 1))))
def test_shift_floats(self): ns = 500 w = scipy.signal.ricker(ns, 10) w_ = fshift(w.astype(np.float32), 1) assert w_.dtype == np.float32