Example #1
0
    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)
Example #2
0
    def test_ical_pipeline(self):
        amp_errors = {'T': 0.0, 'G': 0.00, 'B': 0.0}
        phase_errors = {'T': 0.1, 'G': 0.0, 'B': 0.0}
        self.actualSetUp(add_errors=True,
                         block=True,
                         amp_errors=amp_errors,
                         phase_errors=phase_errors)

        controls = create_calibration_controls()

        controls['T']['first_selfcal'] = 1
        controls['G']['first_selfcal'] = 3
        controls['B']['first_selfcal'] = 4

        controls['T']['timescale'] = 'auto'
        controls['G']['timescale'] = 'auto'
        controls['B']['timescale'] = 1e5

        clean, residual, restored = \
            ical_list_serial_workflow(self.vis_list, model_imagelist=self.model_imagelist, context='2d',
                                      calibration_context='T', controls=controls, do_selfcal=True,
                                      global_solution=False,
                                      algorithm='mmclean',
                                      facets=1,
                                      scales=[0, 3, 10],
                                      niter=1000, fractional_threshold=0.1,
                                      nmoments=2, nchan=self.freqwin,
                                      threshold=2.0, nmajor=5, gain=0.1,
                                      deconvolve_facets=8, deconvolve_overlap=16, deconvolve_taper='tukey')
        centre = len(clean) // 2
        export_image_to_fits(
            clean[centre],
            '%s/test_pipelines_ical_pipeline_clean.fits' % self.dir)
        export_image_to_fits(
            residual[centre][0],
            '%s/test_pipelines_ical_pipeline_residual.fits' % self.dir)
        export_image_to_fits(
            restored[centre],
            '%s/test_pipelines_ical_pipeline_restored.fits' % self.dir)

        qa = qa_image(restored[centre])
        assert numpy.abs(qa.data['max'] - 100.13739440876233) < 1.0, str(qa)
        assert numpy.abs(qa.data['min'] + 0.03644435471804354) < 1.0, str(qa)
start = time.time()
original_ical = False
if original_ical:
    if rank == 0:

        ical_list = ical_list_serial_workflow(predicted_vislist,
                                              model_imagelist=model_list,
                                              context='wstack',
                                              calibration_context='TG',
                                              controls=controls,
                                              scales=[0, 3, 10],
                                              algorithm='mmclean',
                                              nmoment=3,
                                              niter=1000,
                                              fractional_threshold=0.1,
                                              threshold=0.1,
                                              nmajor=5,
                                              gain=0.25,
                                              deconvolve_facets=8,
                                              deconvolve_overlap=16,
                                              deconvolve_taper='tukey',
                                              vis_slices=ntimes,
                                              timeslice='auto',
                                              global_solution=False,
                                              psf_support=64,
                                              do_selfcal=True)

else:

    ical_list = ical_list_mpi_workflow(predicted_vislist,
                                       model_imagelist=model_list,
print(qa_image(model, context='Blockvis model image'))
export_image_to_fits(model, '%s/imaging-blockvis_model.fits'
                     % (results_dir))

dirty, sumwt = invert_list_serial_workflow(predicted_vis, model, vis_slices=vis_slices, dopsf=False, context='wstack')


print(qa_image(dirty, context='Dirty image'))
export_image_to_fits(dirty, '%s/imaging-dirty.fits'
                     % (results_dir))


deconvolved, residual, restored = ical_list_serial_workflow(vis_list=[blockvis],
                                                            model_imagelist=[model], vis_slices=vis_slices,
                                                            timeslice='auto',
                                                  algorithm='hogbom', niter=1000, fractional_threshold=0.1, threshold=0.1,
                                                  context='wstack', nmajor=5, gain=0.1, first_selfcal=1,
                                                  global_solution=False)
print(qa_image(deconvolved, context='Clean image'))
export_image_to_fits(deconvolved, '%s/imaging-dask_ical_deconvolved.fits'
                     % (results_dir))

print(qa_image(residual, context='Residual clean image'))
export_image_to_fits(residual, '%s/imaging-dask_ical_residual.fits'
                     % (results_dir))

print(qa_image(restored, context='Restored clean image'))
export_image_to_fits(restored, '%s/imaging-dask_ical_restored.fits'
                     % (results_dir))

print(qa_image(model, context='Blockvis model image1'))