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)
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)
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)