Ejemplo n.º 1
0
    def test_crosssubtract_datamodel(self):
        self.actualSetUp(zerow=True)

        future_vis = arlexecute.scatter(self.vis_list[0])
        future_skymodel_list = arlexecute.scatter(self.skymodel_list)
        skymodel_vislist = predict_skymodel_list_arlexecute_workflow(
            future_vis, future_skymodel_list, context='2d', docal=True)
        skymodel_vislist = arlexecute.compute(skymodel_vislist, sync=True)
        vobs = sum_predict_results(skymodel_vislist)

        future_vobs = arlexecute.scatter(vobs)
        skymodel_vislist = crosssubtract_datamodels_skymodel_list_arlexecute_workflow(
            future_vobs, skymodel_vislist)

        skymodel_vislist = arlexecute.compute(skymodel_vislist, sync=True)

        result_skymodel = [
            SkyModel(components=None, image=self.skymodel_list[-1].image)
            for v in skymodel_vislist
        ]

        self.vis_list = arlexecute.scatter(self.vis_list)
        result_skymodel = invert_skymodel_list_arlexecute_workflow(
            skymodel_vislist, result_skymodel, context='2d', docal=True)
        results = arlexecute.compute(result_skymodel, sync=True)
        assert numpy.max(numpy.abs(results[0][0].data)) > 0.0
        assert numpy.max(numpy.abs(results[0][1])) > 0.0
        if self.plot:
            import matplotlib.pyplot as plt
            from wrappers.arlexecute.image.operations import show_image
            show_image(results[0][0],
                       title='Dirty image after cross-subtraction',
                       vmax=0.1,
                       vmin=-0.01)
            plt.show()
Ejemplo n.º 2
0
    print("Display power spectrum of an image")

    im = import_image_from_fits(args.image)

    nchan, npol, ny, nx = im.shape

    if args.signal_channel is None:
        signal_channel = nchan // 2
    else:
        signal_channel = args.signal_channels

    noise_channel = args.noise_channel
    resolution = args.resolution

    plt.clf()
    show_image(im, chan=signal_channel)
    plt.title('Signal image %s' % (basename))
    plt.savefig('simulation_image_channel_%d.png' % signal_channel)
    plt.show()
    plt.clf()
    show_image(im, chan=noise_channel)
    plt.title('Noise image %s' % (basename))
    plt.savefig('simulation_noise_channel_%d.png' % signal_channel)
    plt.show()

    print(im)
    imfft = fft_image(im)
    print(imfft)

    omega = numpy.pi * resolution**2 / (4 * numpy.log(2.0))
    wavelength = consts.c / numpy.average(im.frequency)
                                              global_solution=False,
                                              psf_support=64,
                                              do_selfcal=True)

    # In[ ]:

    log.info('About to run ical_list_serial_workflow')
    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_arlexecute_deconvolved.fits' % (results_dir))

    show_image(restored,
               title='Restored clean image',
               cm='Greys',
               vmax=0.1,
               vmin=-0.01)
    print(qa_image(restored, context='Restored clean image'))
    plt.show()
Ejemplo n.º 4
0
    # Now construct and run a graph to sum the results from the summations over each chunk
    final_result = sum_invert_results_arlexecute(results)
    dirty, sumwt = arlexecute.compute(final_result, sync=True)

    # We are done! make plots and fits files
    type = 'dirty'
    if dopsf:
        type = 'psf'

    if args.write_fits == "True":
        imagename = "simulate_rfi_%.1f_%s.fits" % (declination, type)
        export_image_to_fits(dirty, imagename)

    plt.clf()
    show_image(dirty, chan=len(frequency) // channel_average // 2)
    plotname = "simulate_rfi_%.1f_%s.png" % (declination, type)
    plt.title('Image of the target field')
    plt.savefig(plotname)
    plt.show(block=False)

    final_pole_result = sum_invert_results_arlexecute(pole_results)
    pole_dirty, pole_sumwt = arlexecute.compute(final_pole_result, sync=True)

    if args.write_fits == "True":
        imagename = "simulate_rfi_pole_%s.fits" % (type)
        export_image_to_fits(pole_dirty, imagename)

    plt.clf()
    show_image(pole_dirty, chan=len(frequency) // channel_average // 2)
    plotname = "simulate_rfi_pole_%s.png" % (type)