Ejemplo n.º 1
0
def testCubeTransformStokes2CorrsLinearNonStandardMSMapping():
    conv = ClassStokes([
        StokesTypes["XX"], StokesTypes["YY"], StokesTypes["XY"],
        StokesTypes["YX"]
    ], "IQUV")
    stokesCube = np.zeros([1, 4, 1, 3], dtype=np.complex64)
    stokesCube[:, 0, :, 0] = 1
    stokesCube[:, 1, :, 0] = 1
    #full horizontal (Q=1)
    stokesCube[:, 0, :, 1] = 1
    stokesCube[:, 2, :, 1] = 0.25
    stokesCube[:, 3, :, 1] = 0.75
    #0.25 45 linear (U), 0.75 right circular (V)
    stokesCube[:, 0, :, 2] = 1
    stokesCube[:, 3, :, 2] = 1
    #full right circular (V=1)
    corrCube = conv.stokes2corrs(stokesCube)
    assert np.allclose(corrCube[0, :, 0, 0], np.array([2, 0, 0,
                                                       0]))  #I+Q=2 and I-Q=0
    assert np.allclose(
        corrCube[0, :, 0, 1],
        np.array([1, 1, 0.25 + 0.75j, 0.25 - 0.75j
                  ]))  #I+0=1 and I-0=1 and U+iV=0.75+0.25i and U-iV=0.75-0.25i
    assert np.allclose(corrCube[0, :, 0, 2],
                       np.array([1, 1, 1j, -1j
                                 ]))  #I+0=1 and 0+iV=1i and 0-iV=-1i and I-0=1
Ejemplo n.º 2
0
def testCannotReconstructCorrelationRLLR():
    conv = ClassStokes(
        [
            StokesTypes["RR"], StokesTypes["RL"], StokesTypes["LR"],
            StokesTypes["LL"]
        ],  #non-standard enumeration
        ["I", "Q"])
    stokesCube = np.zeros([1, 4, 1, 3], dtype=np.complex64)
    corrsCube = conv.stokes2corrs(stokesCube)
Ejemplo n.º 3
0
def testCannotReconstructCorrelationXXYY():
    conv = ClassStokes(
        [
            StokesTypes["XY"], StokesTypes["XX"], StokesTypes["YY"],
            StokesTypes["YX"]
        ],  #non-standard enumeration
        ["V", "U"])
    stokesCube = np.zeros([1, 4, 1, 3], dtype=np.complex64)
    corrsCube = conv.stokes2corrs(stokesCube)
Ejemplo n.º 4
0
def testCubeTransformStokes2CorrsStokesInplace():
    conv = ClassStokes([StokesTypes["I"], StokesTypes["Q"], StokesTypes["U"], StokesTypes["V"]],
                       "QVUI") #jumble the mapping and make sure things are mapped correctly
    stokesCube = np.zeros([1,4,1,3],dtype=np.complex64)
    stokesCube[:, 3, :, 0] = 1; stokesCube[:, 1, :, 0] = 1;
    stokesCube[:, 1, :, 1] = 2; stokesCube[:, 2, :, 1] = 2;
    stokesCube[:, 0, :, 2] = 3; stokesCube[:, 3, :, 2] = 3;
    corrCube = conv.stokes2corrs(stokesCube, inplace=True)
    assert np.allclose(corrCube[0, :, 0, 0], np.array([1+0j, 0, 0, 1+0j]))
    assert np.allclose(corrCube[0, :, 0, 1], np.array([0, 0, 2+0j, 2+0j]))
    assert np.allclose(corrCube[0, :, 0, 2], np.array([3+0j, 3+0j, 0, 0]))
Ejemplo n.º 5
0
def testCubeTransformStokes2CorrsCircular():
    conv = ClassStokes([StokesTypes["RR"], StokesTypes["RL"], StokesTypes["LR"], StokesTypes["LL"]],
                       "IQUV")
    stokesCube = np.zeros([1, 4, 1, 3], dtype=np.complex64)
    stokesCube[:, 0, :, 0] = 1; stokesCube[:, 1, :, 0] = 1; #full horizontal (Q=1)
    stokesCube[:, 0, :, 1] = 1; stokesCube[:, 2, :, 1] = 1; #full 45 linear (U=1)
    stokesCube[:, 0, :, 2] = 1; stokesCube[:, 3, :, 2] = 1; #full right circular (V=1)
    corrCube = conv.stokes2corrs(stokesCube)
    assert np.allclose(corrCube[0, :, 0, 0], np.array([1,1,1,1])) #I+0=1,Q+0=1,Q-0=1,I-0=1
    assert np.allclose(corrCube[0, :, 0, 1], np.array([1,1j,-1j,1])) #I+0=1,0+iU=1i,0-iU=-1i,I-0=1
    assert np.allclose(corrCube[0, :, 0, 2], np.array([2,0,0,0])) #I+V=2,I-V=0
Ejemplo n.º 6
0
def testCubeTransformStokes2CorrsLinear():
    conv = ClassStokes([StokesTypes["XX"], StokesTypes["XY"], StokesTypes["YX"], StokesTypes["YY"]],
                       "IQUV")
    stokesCube = np.zeros([1, 4, 1, 3], dtype=np.complex64)
    stokesCube[:, 0, :, 0] = 1; stokesCube[:, 1, :, 0] = 1; #full horizontal (Q=1)
    stokesCube[:, 0, :, 1] = 1; stokesCube[:, 2, :, 1] = 1; #full 45 linear (U=1)
    stokesCube[:, 0, :, 2] = 1; stokesCube[:, 3, :, 2] = 1; #full right circular (V=1)
    corrCube = conv.stokes2corrs(stokesCube)
    assert np.allclose(corrCube[0, :, 0, 0], np.array([2,0,0,0])) #I+Q=2 and I-Q=0
    assert np.allclose(corrCube[0, :, 0, 1], np.array([1,1,1,1])) #I+0=1 and U+0=1 and U-0=1 and I-0=0
    assert np.allclose(corrCube[0, :, 0, 2], np.array([1,1j,-1j,1])) #I+0=1 and 0+iV=1i and 0-iV=-1i and I-0=1
Ejemplo n.º 7
0
def testCubeMustBeComplexStokes2Corrs():
    conv = ClassStokes([
        StokesTypes["I"], StokesTypes["Q"], StokesTypes["U"], StokesTypes["V"]
    ], "QVUI")
    stokesCube = np.zeros([1, 4, 1, 3], dtype=np.float32)
    stokesCube = conv.stokes2corrs(stokesCube)
Ejemplo n.º 8
0
def testDependenciesNotSatisfiedRRwithLinear():
    conv = ClassStokes([StokesTypes["XX"], StokesTypes["YY"]], ["XX", "RR"])
    corrsCube = np.zeros([1, 4, 1, 3], dtype=np.complex64)
    stokesCube = conv.stokes2corrs(corrsCube)