def test_dask_feed_rotation(): import dask.array as da import numpy as np from africanus.rime import feed_rotation as np_feed_rotation from africanus.rime.dask import feed_rotation parangles = np.random.random((10, 5)) dask_parangles = da.from_array(parangles, chunks=(5, (2, 3))) np_fr = np_feed_rotation(parangles, feed_type='linear') assert np.all(np_fr == feed_rotation(dask_parangles, feed_type='linear')) np_fr = np_feed_rotation(parangles, feed_type='circular') assert np.all(np_fr == feed_rotation(dask_parangles, feed_type='circular'))
def test_cuda_feed_rotation(feed_type, shape, dtype): cp = pytest.importorskip('cupy') pa = np.random.random(shape).astype(dtype) cp_feed_rot = cp_feed_rotation(cp.asarray(pa), feed_type=feed_type) np_feed_rot = np_feed_rotation(pa, feed_type=feed_type) np.testing.assert_array_almost_equal(cp.asnumpy(cp_feed_rot), np_feed_rot)