Exemplo n.º 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
def convert_polimage_to_stokes(im: Image):
    """Convert a polarisation image to stokes (complex)
    
    """
    assert isinstance(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))
Exemplo n.º 3
0
def convert_visibility_to_stokes(vis):
    """Convert the polarisation frame data into Stokes parameters.

    Args:
    vis (obj): ARL visibility data.

    Returns:
    vis: Converted visibility data.
    """
    poldef = vis.polarisation_frame
    if poldef == PolarisationFrame('linear'):
        vis.data['vis'] = convert_linear_to_stokes(vis.data['vis'], polaxis=1)
        vis.polarisation_frame = PolarisationFrame('stokesIQUV')
    elif poldef == PolarisationFrame('circular'):
        vis.data['vis'] = convert_circular_to_stokes(vis.data['vis'],
                                                     polaxis=1)
        vis.polarisation_frame = PolarisationFrame('stokesIQUV')
    return vis
Exemplo n.º 4
0
 def test_stokes_linear_stokes_conversion(self):
     stokes = numpy.array([1, 0.5, 0.2, -0.1])
     linear = convert_stokes_to_linear(stokes)
     assert_array_almost_equal(
         convert_linear_to_stokes(linear).real, stokes, 15)