def _test_process(cls, arrayshape, nproc=2): arrin = numpy.zeros(arrayshape) # test adding one mp = MultiTool(lambda x: numpy.sqrt(x) + 1, nbandsout=arrin.shape[0], nchunks=cls.nchunks, nproc=nproc) arrout = mp.process_array(arrin) nt.assert_array_equal(numpy.sqrt(arrin) + 1, arrout)
def _test_passthrough(cls, arrayshape, nproc=2): """ Test passthrough function """ arrin = numpy.zeros(arrayshape) mp = MultiTool(lambda x: x, nbandsout=arrin.shape[0], nchunks=cls.nchunks, nproc=nproc) arrout = mp.process_array(arrin) nt.assert_array_equal(arrin, arrout)