blimpy/calib_utils/stokescal.py
def get_stokes(cross_dat, feedtype='l'):
    '''Output stokes parameters (I,Q,U,V) for a rawspec
    cross polarization filterbank file'''

    #Compute Stokes Parameters
    if feedtype=='l':
        #I = XX+YY
        I = cross_dat[:,0,:]+cross_dat[:,1,:]
        #Q = XX-YY
        Q = cross_dat[:,0,:]-cross_dat[:,1,:]
        #U = 2*Re(XY)
        U = 2*cross_dat[:,2,:]
        #V = -2*Im(XY)
        V = -2*cross_dat[:,3,:]

    elif feedtype=='c':
        #I = LL+RR
        I = cross_dat[:,0,:]+cross_dat[:,1,:]
        #Q = 2*Re(RL)
        Q = 2*cross_dat[:,2,:]
        #U = 2*Im(RL)
        U = -2*cross_dat[:,3,:]
        #V = RR-LL
        V = cross_dat[:,1,:]-cross_dat[:,0,:]
    else:
        raise ValueError('feedtype must be \'l\' (linear) or \'c\' (circular)')

    #Add middle dimension to match Filterbank format
    I = np.expand_dims(I,axis=1)
    Q = np.expand_dims(Q,axis=1)
    U = np.expand_dims(U,axis=1)
    V = np.expand_dims(V,axis=1)

    #Compute linear polarization
    #L=np.sqrt(np.square(Q)+np.square(U))

    return I,Q,U,V
def get_stokes(cross_dat, feedtype='l'):
    '''Output stokes parameters (I,Q,U,V) for a rawspec
    cross polarization filterbank file'''

    #Compute Stokes Parameters
    if feedtype=='l':
        #I = XX+YY
        I = cross_dat[:,0,:]+cross_dat[:,1,:]
        #Q = XX-YY
        Q = cross_dat[:,0,:]-cross_dat[:,1,:]
        #U = 2*Re(XY)
        U = 2*cross_dat[:,2,:]
        #V = -2*Im(XY)
        V = -2*cross_dat[:,3,:]

    elif feedtype=='c':
        #I = LL+RR
        I = cross_dat[:,0,:]+cross_dat[:,1,:]
        #Q = 2*Re(RL)
        Q = 2*cross_dat[:,2,:]
        #U = 2*Im(RL)
        U = -2*cross_dat[:,3,:]
        #V = RR-LL
        V = cross_dat[:,1,:]-cross_dat[:,0,:]
    else:
        raise ValueError('feedtype must be \'l\' (linear) or \'c\' (circular)')

    #Add middle dimension to match Filterbank format
    I = np.expand_dims(I,axis=1)
    Q = np.expand_dims(Q,axis=1)
    U = np.expand_dims(U,axis=1)
    V = np.expand_dims(V,axis=1)

    #Compute linear polarization
    #L=np.sqrt(np.square(Q)+np.square(U))

    return I,Q,U,V
def get_stokes ( cross_dat , feedtype = 'l' ) : #Compute Stokes Parameters if feedtype == 'l' : #I = XX+YY I = cross_dat [ : , 0 , : ] + cross_dat [ : , 1 , : ] #Q = XX-YY Q = cross_dat [ : , 0 , : ] - cross_dat [ : , 1 , : ] #U = 2*Re(XY) U = 2 * cross_dat [ : , 2 , : ] #V = -2*Im(XY) V = - 2 * cross_dat [ : , 3 , : ] elif feedtype == 'c' : #I = LL+RR I = cross_dat [ : , 0 , : ] + cross_dat [ : , 1 , : ] #Q = 2*Re(RL) Q = 2 * cross_dat [ : , 2 , : ] #U = 2*Im(RL) U = - 2 * cross_dat [ : , 3 , : ] #V = RR-LL V = cross_dat [ : , 1 , : ] - cross_dat [ : , 0 , : ] else : raise ValueError ( 'feedtype must be \'l\' (linear) or \'c\' (circular)' ) #Add middle dimension to match Filterbank format I = np . expand_dims ( I , axis = 1 ) Q = np . expand_dims ( Q , axis = 1 ) U = np . expand_dims ( U , axis = 1 ) V = np . expand_dims ( V , axis = 1 ) #Compute linear polarization #L=np.sqrt(np.square(Q)+np.square(U)) return I , Q , U , V
Output stokes parameters (I,Q,U,V) for a rawspec
    cross polarization filterbank file
Output stokes parameters ( I Q U V ) for a rawspec cross polarization filterbank file