Example #1
0
def convertlineartostokes(vis):
    """Convert linear polarisations (XX, XY, YX, YY) into Stokes parameters.
    
    Args:
    vis (obj): ARL visibility data.
    
    Returns:
    vis: Converted visibility data.
    """
    vis.data['vis'] = convert_linear_to_stokes(vis.data['vis'], polaxis=1)
    vis.polarisation_frame = PolarisationFrame('stokesIQUV')
    return vis
Example #2
0
def convert_polimage_to_stokes(im: Image):
    """Convert a polarisation image to stokes (complex)
    
    """
    assert type(im) == Image
    assert im.data.dtype == 'complex'
    
    if im.polarisation_frame == PolarisationFrame('linear'):
        cimarr = convert_linear_to_stokes(im.data)
        return create_image_from_array(cimarr, im.wcs, PolarisationFrame('stokesIQUV'))
    elif im.polarisation_frame == PolarisationFrame('circular'):
        cimarr = convert_circular_to_stokes(im.data)
        return create_image_from_array(cimarr, im.wcs, PolarisationFrame('stokesIQUV'))
    else:
        raise ValueError("Cannot convert %s to stokes" % (im.polarisation_frame.type))