Esempio n. 1
0
    def test_create_list_spectral_average(self):

        uvfitsfile = arl_path("data/vis/ASKAP_example.fits")

        vis_by_channel = list()
        nchan_ave = 16
        nchan = 192
        for schan in range(0, nchan, nchan_ave):
            max_chan = min(nchan, schan + nchan_ave)
            v = create_blockvisibility_from_uvfits(uvfitsfile,
                                                   range(schan, max_chan))
            vis_by_channel.append(integrate_visibility_by_channel(v[0]))

        assert len(vis_by_channel) == 12
        for v in vis_by_channel:
            assert v.vis.data.shape[-1] == 4
            assert v.vis.data.shape[-2] == 1
            assert v.polarisation_frame.type == "linear"
Esempio n. 2
0
def calibrate_list_serial_workflow(vis_list,
                                   model_vislist,
                                   calibration_context='TG',
                                   global_solution=True,
                                   **kwargs):
    """ Create a set of components for (optionally global) calibration of a list of visibilities

    If global solution is true then visibilities are gathered to a single visibility data set which is then
    self-calibrated. The resulting gaintable is then effectively scattered out for application to each visibility
    set. If global solution is false then the solutions are performed locally.

    :param vis_list:
    :param model_vislist:
    :param calibration_context: String giving terms to be calibrated e.g. 'TGB'
    :param global_solution: Solve for global gains
    :param kwargs: Parameters for functions in components
    :return:
    """
    def solve_and_apply(vis, modelvis=None):
        return calibrate_function(vis,
                                  modelvis,
                                  calibration_context=calibration_context,
                                  **kwargs)[0]

    if global_solution:
        point_vislist = [
            divide_visibility(vis_list[i], model_vislist[i])
            for i, _ in enumerate(vis_list)
        ]
        global_point_vis_list = visibility_gather_channel(point_vislist)
        global_point_vis_list = integrate_visibility_by_channel(
            global_point_vis_list)
        # This is a global solution so we only compute one gain table
        _, gt_list = solve_and_apply(global_point_vis_list)
        return [apply_gaintable(v, gt_list, inverse=True) for v in vis_list]
    else:

        return [
            solve_and_apply(vis_list[i], model_vislist[i])
            for i, v in enumerate(vis_list)
        ]
 def create_and_average(schan):
     max_chan = min(nchan, schan + nchan_ave)
     bv = create_blockvisibility_from_ms(msfile, range(schan, max_chan))
     return integrate_visibility_by_channel(bv[0])