blimpy/calib_utils/stokescal.py
def gain_offsets(Idat,Qdat,Udat,Vdat,tsamp,chan_per_coarse,feedtype='l',**kwargs):
    '''
    Determines relative gain error in the X and Y feeds for an
    observation given I and Q (I and V for circular basis) noise diode data.
    '''
    if feedtype=='l':
        #Fold noise diode data and calculate ON OFF differences for I and Q
        I_OFF,I_ON = foldcal(Idat,tsamp,**kwargs)
        Q_OFF,Q_ON = foldcal(Qdat,tsamp,**kwargs)

        #Calculate power in each feed for noise diode ON and OFF
        XX_ON = (I_ON+Q_ON)/2
        XX_OFF = (I_OFF+Q_OFF)/2
        YY_ON = (I_ON-Q_ON)/2
        YY_OFF = (I_OFF-Q_OFF)/2

        #Calculate gain offset (divided by 2) as defined in Heiles (2001)
        G = (XX_OFF-YY_OFF)/(XX_OFF+YY_OFF)

    if feedtype=='c':
        #Fold noise diode data and calculate ON OFF differences for I and Q
        I_OFF,I_ON = foldcal(Idat,tsamp,**kwargs)
        V_OFF,V_ON = foldcal(Vdat,tsamp,**kwargs)

        #Calculate power in each feed for noise diode ON and OFF
        RR_ON = (I_ON+V_ON)/2
        RR_OFF = (I_OFF+V_OFF)/2
        LL_ON = (I_ON-V_ON)/2
        LL_OFF = (I_OFF-V_OFF)/2

        #Calculate gain offset (divided by 2) as defined in Heiles (2001)
        G = (RR_OFF-LL_OFF)/(RR_OFF+LL_OFF)

    return convert_to_coarse(G,chan_per_coarse)
def gain_offsets(Idat,Qdat,Udat,Vdat,tsamp,chan_per_coarse,feedtype='l',**kwargs):
    '''
    Determines relative gain error in the X and Y feeds for an
    observation given I and Q (I and V for circular basis) noise diode data.
    '''
    if feedtype=='l':
        #Fold noise diode data and calculate ON OFF differences for I and Q
        I_OFF,I_ON = foldcal(Idat,tsamp,**kwargs)
        Q_OFF,Q_ON = foldcal(Qdat,tsamp,**kwargs)

        #Calculate power in each feed for noise diode ON and OFF
        XX_ON = (I_ON+Q_ON)/2
        XX_OFF = (I_OFF+Q_OFF)/2
        YY_ON = (I_ON-Q_ON)/2
        YY_OFF = (I_OFF-Q_OFF)/2

        #Calculate gain offset (divided by 2) as defined in Heiles (2001)
        G = (XX_OFF-YY_OFF)/(XX_OFF+YY_OFF)

    if feedtype=='c':
        #Fold noise diode data and calculate ON OFF differences for I and Q
        I_OFF,I_ON = foldcal(Idat,tsamp,**kwargs)
        V_OFF,V_ON = foldcal(Vdat,tsamp,**kwargs)

        #Calculate power in each feed for noise diode ON and OFF
        RR_ON = (I_ON+V_ON)/2
        RR_OFF = (I_OFF+V_OFF)/2
        LL_ON = (I_ON-V_ON)/2
        LL_OFF = (I_OFF-V_OFF)/2

        #Calculate gain offset (divided by 2) as defined in Heiles (2001)
        G = (RR_OFF-LL_OFF)/(RR_OFF+LL_OFF)

    return convert_to_coarse(G,chan_per_coarse)
Determines relative gain error in the X and Y feeds for an
    observation given I and Q (I and V for circular basis) noise diode data.