def test_fit_phase2d(self): w = np.zeros((500, 2)) w[1, 0], w[2, 1] = (1, 1) self.assertTrue( np.all( np.isclose(fit_phase(w, .002, axis=0), np.array([.002, .004])))) self.assertTrue( np.all( np.isclose(fit_phase(w.transpose(), .002), np.array([.002, .004]))))
def test_fit_phase1d(self): w = np.zeros(500) w[1] = 1 self.assertTrue(np.isclose(fit_phase(w, .002), .002))