def test_useFunction(self): def square(x): return x**2 arlexecute.set_client(use_dask=False) graph = arlexecute.execute(square)(numpy.arange(10)) assert (arlexecute.compute(graph) == numpy.array( [0, 1, 4, 9, 16, 25, 36, 49, 64, 81])).all() arlexecute.close()
def test_create_simulate_vis_graph(self): arlexecute.set_client(use_dask=True) vis_list = simulate_component(frequency=self.frequency, channel_bandwidth=self.channel_bandwidth) assert len(vis_list) == len(self.frequency) vt = vis_list[0].compute() assert isinstance(vt, BlockVisibility) assert vt.nvis > 0 arlexecute.close()
def test_useDaskSync(self): def square(x): return x**2 arlexecute.set_client(use_dask=True) graph = arlexecute.execute(square)(numpy.arange(10)) result = arlexecute.compute(graph, sync=True) assert (result == numpy.array([0, 1, 4, 9, 16, 25, 36, 49, 64, 81])).all() arlexecute.close()
def test_create_generic_image_graph(self): def imagerooter(im): im.data = numpy.sqrt(numpy.abs(im.data)) return im root = generic_image_component(imagerooter, self.image, facets=4) root = arlexecute.compute(root, sync=True) arlexecute.close() numpy.testing.assert_array_almost_equal_nulp( root.data**2, numpy.abs(self.image.data), 7)
def test_create_generic_blockvisibility_graph(self): self.blockvis = [ create_blockvisibility( self.lowcore, self.times, self.frequency, phasecentre=self.phasecentre, channel_bandwidth=self.channel_bandwidth, weight=1.0, polarisation_frame=PolarisationFrame('stokesI')) ] self.blockvis = generic_blockvisibility_component( predict_skycomponent_visibility, vis_list=self.blockvis, sc=self.comp)[0] self.blockvis = arlexecute.compute(self.blockvis, sync=True) arlexecute.close() assert numpy.max(numpy.abs(self.blockvis[0].vis)) > 0.0
deconvolve_overlap=32, deconvolve_taper='tukey', vis_slices=ntimes, timeslice='auto', global_solution=False, psf_support=64, do_selfcal=True) # In[ ]: log.info('About to run ical') result = arlexecute.compute(ical_list, sync=True) deconvolved = result[0][0] residual = result[1][0] restored = result[2][0] arlexecute.close() show_image(deconvolved, title='Clean image', cm='Greys', vmax=0.1, vmin=-0.01) print(qa_image(deconvolved, context='Clean image')) plt.show() export_image_to_fits(deconvolved, '%s/gleam_ical_deconvolved.fits' % (results_dir)) show_image(restored, title='Restored clean image', cm='Greys', vmax=0.1,
def tearDown(self): arlexecute.close()