Exemple #1
0
 def testDataConcatenationCy64(self):
     data = sp.zeros((100, 1), dtype=sp.float64)
     data[sp.arange(0, 100, 10)] = 1.0
     filt = sp.zeros((5, 1), dtype=sp.float64)
     filt[2] = 1.0
     hist = sp.zeros((4, 1), dtype=sp.float64)
     fout = _mcfilter_hist_cy64(data, filt, hist)[0]
     cut = int(sp.floor(5.0 / 2))
     assert_equal(data[:-cut], sp.array([fout[cut:]]).T)
Exemple #2
0
 def testHistoryCy64(self):
     """test history item"""
     tf = 3
     nc = 2
     data = sp.randn(100, nc).astype(sp.float64)
     filt = sp.ones((tf, nc), dtype=sp.float64)
     hist = sp.zeros((tf - 1, nc), dtype=sp.float64)
     fout, hist = _mcfilter_hist_cy64(data, filt, hist)
     assert_equal(hist, data[-(tf - 1):])
 def testHistoryCy64(self):
     """test history item"""
     tf = 3
     nc = 2
     data = sp.randn(100, nc).astype(sp.float64)
     filt = sp.ones((tf, nc), dtype=sp.float64)
     hist = sp.zeros((tf - 1, nc), dtype=sp.float64)
     fout, hist = _mcfilter_hist_cy64(data, filt, hist)
     assert_equal(hist, data[-(tf - 1):])
 def testDataConcatenationCy64(self):
     data = sp.zeros((100, 1), dtype=sp.float64)
     data[sp.arange(0, 100, 10)] = 1.0
     filt = sp.zeros((5, 1), dtype=sp.float64)
     filt[2] = 1.0
     hist = sp.zeros((4, 1), dtype=sp.float64)
     fout = _mcfilter_hist_cy64(data, filt, hist)[0]
     cut = sp.floor(5.0 / 2)
     assert_equal(data[:-cut], sp.array([fout[cut:]]).T)
Exemple #5
0
 def testPyVsCyOnesCy64(self):
     """test python and cython, double"""
     tf = 3
     nc = 2
     data = sp.ones((20, nc), dtype=sp.float64)
     filt = sp.ones((tf, nc), dtype=sp.float64)
     hist = sp.ones((tf - 1, nc), dtype=sp.float64)
     fopy, hopy = _mcfilter_hist_py(data, filt, hist)
     focy, hocy = _mcfilter_hist_cy64(data, filt, hist)
     assert_almost_equal(fopy, focy)
 def testPyVsCyOnesCy64(self):
     """test python and cython, double"""
     tf = 3
     nc = 2
     data = sp.ones((20, nc), dtype=sp.float64)
     filt = sp.ones((tf, nc), dtype=sp.float64)
     hist = sp.ones((tf - 1, nc), dtype=sp.float64)
     fopy, hopy = _mcfilter_hist_py(data, filt, hist)
     focy, hocy = _mcfilter_hist_cy64(data, filt, hist)
     assert_almost_equal(fopy, focy)
Exemple #7
0
 def testStepsCy64(self):
     tf = 3
     nc = 2
     data = sp.vstack([sp.concatenate([sp.arange(1, 4)] * 5)] * 2).T.astype(
         sp.float64)
     filt = sp.ones((tf, nc), dtype=sp.float64) / float(tf)
     hist_py = sp.ones((tf - 1, nc), dtype=sp.float64)
     hist_cy = sp.ones((tf - 1, nc), dtype=sp.float64)
     fopy, hopy = _mcfilter_hist_py(data, filt, hist_py)
     focy, hocy = _mcfilter_hist_cy64(data, filt, hist_cy)
     assert_almost_equal(fopy, focy)
Exemple #8
0
 def testPyVsCyRandnCy64(self):
     """test python and cython"""
     tf = 3
     nc = 2
     data = sp.randn(20, nc).astype(sp.float64)
     filt = sp.ones((tf, nc), dtype=sp.float64)
     hist_py = sp.ones((tf - 1, nc), dtype=sp.float64)
     hist_cy = sp.ones((tf - 1, nc), dtype=sp.float64)
     fopy, hopy = _mcfilter_hist_py(data, filt, hist_py)
     focy, hocy = _mcfilter_hist_cy64(data, filt, hist_cy)
     assert_almost_equal(fopy, focy)
 def testStepsCy64(self):
     tf = 3
     nc = 2
     data = sp.vstack([sp.concatenate(
         [sp.arange(1, 4)] * 5)] * 2).T.astype(sp.float64)
     filt = sp.ones((tf, nc), dtype=sp.float64) / float(tf)
     hist_py = sp.ones((tf - 1, nc), dtype=sp.float64)
     hist_cy = sp.ones((tf - 1, nc), dtype=sp.float64)
     fopy, hopy = _mcfilter_hist_py(data, filt, hist_py)
     focy, hocy = _mcfilter_hist_cy64(data, filt, hist_cy)
     assert_almost_equal(fopy, focy)
 def testPyVsCyRandnCy64(self):
     """test python and cython"""
     tf = 3
     nc = 2
     data = sp.randn(20, nc).astype(sp.float64)
     filt = sp.ones((tf, nc), dtype=sp.float64)
     hist_py = sp.ones((tf - 1, nc), dtype=sp.float64)
     hist_cy = sp.ones((tf - 1, nc), dtype=sp.float64)
     fopy, hopy = _mcfilter_hist_py(data, filt, hist_py)
     focy, hocy = _mcfilter_hist_cy64(data, filt, hist_cy)
     assert_almost_equal(fopy, focy)