def test_sinc_decimate_3(self): """Test function for sinc_decimate() 3/4""" x = [1]*10 x = np.cumsum(np.asarray(x)) self.assertTrue(np.allclose(ds.sinc_decimate(x, 1, 5), [3., 8.])) self.assertTrue(np.allclose(ds.sinc_decimate(x, 2, 5), [1.4, 6.])) self.assertTrue(np.allclose(ds.sinc_decimate(x, 3, 3), [0.55555556, 3., 6.]))
def test_sinc_decimate_4(self): """Test function for sinc_decimate() 4/4""" x = [1]*10 ds.sinc_decimate(x, 2, 15)
def test_sinc_decimate_2(self): """Test function for sinc_decimate() 2/4""" x = [1]*10 self.assertTrue(np.allclose(ds.sinc_decimate(x, 2, 5), [.6, 1.]))
def test_sinc_decimate_1(self): """Test function for sinc_decimate() 1/4""" x = [1]*10 self.assertTrue(np.allclose(ds.sinc_decimate(x, 1, 10), [1.]))
def test_sinc_decimate_4(self): """Test function for sinc_decimate() 4/4""" x = [1]*10 with self.assertRaises(ValueError): ds.sinc_decimate(x, 2, 15)
def test_sinc_decimate(self): """Test function for sinc_decimate()""" tv = np.sin(2*np.pi*.1*np.arange(0, 100)) res = ds.sinc_decimate(tv, 1, 10) self.assertTrue(np.allclose(res, self.r, rtol=1e-5, atol=1e-8))
def test_sinc_decimate_4(self): """Test function for sinc_decimate() 4/4""" x = [1] * 10 ds.sinc_decimate(x, 2, 15)