def test_ical_pipeline(self): self.actualSetUp(add_errors=True) controls = create_calibration_controls() controls['T']['first_selfcal'] = 1 controls['T']['timeslice'] = 'auto' ical_list = \ ical_list_arlexecute_workflow(self.vis_list, model_imagelist=self.model_imagelist, context='2d', algorithm='mmclean', facets=1, scales=[0, 3, 10], niter=1000, fractional_threshold=0.1, threshold=0.1, nmoment=3, nmajor=1, gain=0.1, deconvolve_facets=4, deconvolve_overlap=32, deconvolve_taper='tukey', psf_support=64, restore_facets=4, psfwidth=1.0, calibration_context='T', controls=controls, do_selfcal=True, global_solution=False) clean, residual, restored, gt_list = arlexecute.compute(ical_list, sync=True) centre = len(clean) // 2 if self.persist: export_image_to_fits(clean[centre], '%s/test_pipelines_ical_pipeline_arlexecute_clean.fits' % self.dir) export_image_to_fits(residual[centre][0], '%s/test_pipelines_ical_pipeline_arlexecute_residual.fits' % self.dir) export_image_to_fits(restored[centre], '%s/test_pipelines_ical_pipeline_arlexecute_restored.fits' % self.dir) export_gaintable_to_hdf5(gt_list[centre]['T'], '%s/test_pipelines_ical_pipeline_arlexecute_gaintable.hdf5' % self.dir) qa = qa_image(restored[centre]) assert numpy.abs(qa.data['max'] - 99.32729396999524) < 1.0, str(qa) assert numpy.abs(qa.data['min'] + 0.6501547522800477) < 1.0, str(qa)
def test_ical_pipeline_global(self): self.actualSetUp(add_errors=True) controls = create_calibration_controls() controls['T']['first_selfcal'] = 1 controls['T']['timescale'] = 'auto' clean, residual, restored, gt_list = \ ical_list_serial_workflow(self.vis_list, model_imagelist=self.model_imagelist, context='2d', algorithm='mmclean', facets=1, scales=[0, 3, 10], niter=1000, fractional_threshold=0.1, threshold=0.1, nmoment=3, nmajor=5, gain=0.1, deconvolve_facets=4, deconvolve_overlap=32, deconvolve_taper='tukey', psf_support=64, calibration_context='T', controls=controls, do_selfcal=True, global_solution=True) centre = len(clean) // 2 if self.persist: export_image_to_fits(clean[centre], '%s/test_pipelines_ical_global_pipeline_serial_clean.fits' % self.dir) export_image_to_fits(residual[centre][0], '%s/test_pipelines_ical_global_pipeline_serial_residual.fits' % self.dir) export_image_to_fits(restored[centre], '%s/test_pipelines_ical_global_pipeline_serial_restored.fits' % self.dir) export_gaintable_to_hdf5(gt_list[0]['T'], '%s/test_pipelines_ical_global_pipeline_serial_gaintable.hdf5' % self.dir) qa = qa_image(restored[centre]) assert numpy.abs(qa.data['max'] - 98.92656340122159) < 1.0, str(qa) assert numpy.abs(qa.data['min'] + 0.7024492707920869) < 1.0, str(qa)
def test_readwritegaintable(self): self.vis = create_blockvisibility(self.lowcore, self.times, self.frequency, channel_bandwidth=self.channel_bandwidth, phasecentre=self.phasecentre, polarisation_frame=PolarisationFrame("linear"), weight=1.0) gt = create_gaintable_from_blockvisibility(self.vis, timeslice='auto') gt = simulate_gaintable(gt, phase_error=1.0, amplitude_error=0.1) export_gaintable_to_hdf5(gt, '%s/test_data_model_helpers_gaintable.hdf' % self.dir) newgt = import_gaintable_from_hdf5('%s/test_data_model_helpers_gaintable.hdf' % self.dir) assert gt.data.shape == newgt.data.shape assert numpy.max(numpy.abs(gt.gain - newgt.gain)) < 1e-15