def test_index_tricks(): mgrid = nd_grid() g = mgrid[0:5, 0:5] tile(g) # tileable means no loop exists ogrid = nd_grid(sparse=True) o = ogrid[0:5, 0:5] tile(*o) # tilesable means no loop exists
def testIndexTricks(self): mgrid = nd_grid() g = mgrid[0:5, 0:5] g.tiles() # tilesable means no loop exists ogrid = nd_grid(sparse=True) o = ogrid[0:5, 0:5] [ob.tiles() for ob in o] # tilesable means no loop exists
def testIndexTrickExecution(self): mgrid = nd_grid() t = mgrid[0:5, 0:5] res = self.executor.execute_tensor(t, concat=True)[0] expected = np.lib.index_tricks.nd_grid()[0:5, 0:5] np.testing.assert_equal(res, expected) t = mgrid[-1:1:5j] res = self.executor.execute_tensor(t, concat=True)[0] expected = np.lib.index_tricks.nd_grid()[-1:1:5j] np.testing.assert_equal(res, expected) ogrid = nd_grid(sparse=True) t = ogrid[0:5, 0:5] res = [self.executor.execute_tensor(o, concat=True)[0] for o in t] expected = np.lib.index_tricks.nd_grid(sparse=True)[0:5, 0:5] [np.testing.assert_equal(r, e) for r, e in zip(res, expected)]
def test_index_trick_execution(setup): mgrid = nd_grid() t = mgrid[0:5, 0:5] res = t.execute().fetch() expected = np.lib.index_tricks.nd_grid()[0:5, 0:5] np.testing.assert_equal(res, expected) t = mgrid[-1:1:5j] res = t.execute().fetch() expected = np.lib.index_tricks.nd_grid()[-1:1:5j] np.testing.assert_equal(res, expected) ogrid = nd_grid(sparse=True) t = ogrid[0:5, 0:5] res = [o.execute().fetch() for o in t] expected = np.lib.index_tricks.nd_grid(sparse=True)[0:5, 0:5] [np.testing.assert_equal(r, e) for r, e in zip(res, expected)]