processing_components/imaging/base.py
def shift_vis_to_image(vis: Union[Visibility, BlockVisibility], im: Image, tangent: bool = True, inverse: bool = False) \
        -> Union[Visibility, BlockVisibility]:
    """Shift visibility to the FFT phase centre of the image in place

    :param vis: Visibility data
    :param im: Image model used to determine phase centre
    :param tangent: Is the shift purely on the tangent plane True|False
    :param inverse: Do the inverse operation True|False
    :return: visibility with phase shift applied and phasecentre updated

    """
    assert isinstance(vis, Visibility) or isinstance(vis, BlockVisibility), "vis is not a Visibility or " \
                                                                            "BlockVisibility: %r" % vis
    
    nchan, npol, ny, nx = im.data.shape
    
    # Convert the FFT definition of the phase center to world coordinates (1 relative)
    # This is the only place in ARL where the relationship between the image and visibility
    # frames is defined.
    
    image_phasecentre = pixel_to_skycoord(nx // 2 + 1, ny // 2 + 1, im.wcs, origin=1)
    if vis.phasecentre.separation(image_phasecentre).rad > 1e-15:
        if inverse:
            log.debug("shift_vis_from_image: shifting phasecentre from image phase centre %s to visibility phasecentre "
                      "%s" % (image_phasecentre, vis.phasecentre))
        else:
            log.debug("shift_vis_from_image: shifting phasecentre from vis phasecentre %s to image phasecentre %s" %
                      (vis.phasecentre, image_phasecentre))
        vis = phaserotate_visibility(vis, image_phasecentre, tangent=tangent, inverse=inverse)
        vis.phasecentre = im.phasecentre
    
    return vis
Shift visibility to the FFT phase centre of the image in place

    :param vis: Visibility data
    :param im: Image model used to determine phase centre
    :param tangent: Is the shift purely on the tangent plane True|False
    :param inverse: Do the inverse operation True|False
    :return: visibility with phase shift applied and phasecentre updated

    
Shift visibility to the FFT phase centre of the image in place
Shift visibility to the FFT phase centre of the image in place
def shift_vis_to_image(vis: Union[Visibility, BlockVisibility], im: Image, tangent: bool = True, inverse: bool = False) \
        -> Union[Visibility, BlockVisibility]:
    assert isinstance(vis, Visibility) or isinstance(vis, BlockVisibility), "vis is not a Visibility or " \
                                                                            "BlockVisibility: %r" % vis
    nchan, npol, ny, nx = im.data.shape
    image_phasecentre = pixel_to_skycoord(nx // 2 + 1, ny // 2 + 1, im.wcs, origin=1)
    if vis.phasecentre.separation(image_phasecentre).rad > 1e-15:
        if inverse:
            log.debug("shift_vis_from_image: shifting phasecentre from image phase centre %s to visibility phasecentre "
                      "%s" % (image_phasecentre, vis.phasecentre))
        else:
            log.debug("shift_vis_from_image: shifting phasecentre from vis phasecentre %s to image phasecentre %s" %
                      (vis.phasecentre, image_phasecentre))
        vis = phaserotate_visibility(vis, image_phasecentre, tangent=tangent, inverse=inverse)
        vis.phasecentre = im.phasecentre
    return vis
def shift_vis_to_image ( vis : Union [ Visibility , BlockVisibility ] , im : Image , tangent : bool = True , inverse : bool = False ) -> Union [ Visibility , BlockVisibility ] : assert isinstance ( vis , Visibility ) or isinstance ( vis , BlockVisibility ) , "vis is not a Visibility or " "BlockVisibility: %r" % vis nchan , npol , ny , nx = im . data . shape image_phasecentre = pixel_to_skycoord ( nx // 2 + 1 , ny // 2 + 1 , im . wcs , origin = 1 ) if vis . phasecentre . separation ( image_phasecentre ) . rad > 1e-15 : if inverse : log . debug ( "shift_vis_from_image: shifting phasecentre from image phase centre %s to visibility phasecentre " "%s" % ( image_phasecentre , vis . phasecentre ) ) else : log . debug ( "shift_vis_from_image: shifting phasecentre from vis phasecentre %s to image phasecentre %s" % ( vis . phasecentre , image_phasecentre ) ) vis = phaserotate_visibility ( vis , image_phasecentre , tangent = tangent , inverse = inverse ) vis . phasecentre = im . phasecentre return vis
Shift visibility to the FFT phase centre of the image in place
Shift visibility to the FFT phase centre of the image in place
"""Shift visibility to the FFT phase centre of the image in place

    :param vis: Visibility data
    :param im: Image model used to determine phase centre
    :param tangent: Is the shift purely on the tangent plane True|False
    :param inverse: Do the inverse operation True|False
    :return: visibility with phase shift applied and phasecentre updated

    """ # Convert the FFT definition of the phase center to world coordinates (1 relative) # This is the only place in ARL where the relationship between the image and visibility # frames is defined.
visibility with phase shift applied and phasecentre updated
visibility with phase shift applied and phasecentre updated
vis
Union[Visibility, BlockVisibility]
None
im
Image
Image model used to determine phase centre
Image model used to determine phase centre
tangent
bool
None
inverse
bool
Do the inverse operation True|False
Do the inverse operation True|False