Ejemplo n.º 1
0
def testCubeTransformCorrs2StokesStokesInplace():
    conv = ClassStokes([StokesTypes["I"], StokesTypes["Q"], StokesTypes["U"], StokesTypes["V"]],
                       "QVUI") #jumble the mapping and make sure things are mapped correctly
    corrCube = np.zeros([1,4,1,3],dtype=np.complex64)
    corrCube[:, 0, :, 0] = 1; corrCube[:, 1, :, 0] = 1;
    corrCube[:, 0, :, 1] = 2; corrCube[:, 2, :, 1] = 2;
    corrCube[:, 0, :, 2] = 3; corrCube[:, 3, :, 2] = 3;
    stokesCube = conv.corrs2stokes(corrCube, inplace=True)
    assert np.allclose(stokesCube[0, :, 0, 0], np.array([1+0j, 0, 0, 1+0j]))
    assert np.allclose(stokesCube[0, :, 0, 1], np.array([0, 0, 2+0j, 2+0j]))
    assert np.allclose(stokesCube[0, :, 0, 2], np.array([0, 3+0j, 0, 3+0j]))
Ejemplo n.º 2
0
def testCubeTransformCorrs2StokesCircular():
    conv = ClassStokes([StokesTypes["RR"], StokesTypes["RL"], StokesTypes["LR"], StokesTypes["LL"]],
                       "IQUV")
    corrCube = np.zeros([1, 4, 1, 3], dtype=np.complex64)
    corrCube[:, 0, :, 0] = 2; corrCube[:, 3, :, 0] = 0  # full right circular (V = 1)
    corrCube[:, 0, :, 1] = 1; corrCube[:, 1, :, 1] = 1; corrCube[:, 2, :, 1] = 1; corrCube[:, 3, :, 1] = 1  # full horizontal (Q = 1)
    corrCube[:, 0, :, 2] = 1; corrCube[:, 1, :, 2] = 1j * 1; corrCube[:, 2, :, 2] = -1j * 1; corrCube[:, 3, :, 2] = 1  #full 45 linear (U = 1)
    stokesCube = conv.corrs2stokes(corrCube)
    assert np.allclose(stokesCube[0, :, 0, 0], np.array([1 + 0j, 0, 0, 1 + 0j]))
    assert np.allclose(stokesCube[0, :, 0, 1], np.array([1 + 0j, 1 + 0j, 0, 0]))
    assert np.allclose(stokesCube[0, :, 0, 2], np.array([1 + 0j, 0, 1 + 0j, 0]))
Ejemplo n.º 3
0
def testCubeMustBeComplexCorrs2Stokes():
    conv = ClassStokes([
        StokesTypes["I"], StokesTypes["Q"], StokesTypes["U"], StokesTypes["V"]
    ], "QVUI")
    corrCube = np.zeros([1, 4, 1, 3], dtype=np.float32)
    stokesCube = conv.corrs2stokes(corrCube)