blimpy/calib_utils/calib_plots.py
def plot_diode_fold(dio_cross,bothfeeds=True,feedtype='l',min_samp=-500,max_samp=7000,legend=True,**kwargs):
    '''
    Plots the calculated average power and time sampling of ON (red) and
    OFF (blue) for a noise diode measurement over the observation time series
    '''
    #Get full stokes data of ND measurement
    obs = Waterfall(dio_cross,max_load=150)
    tsamp = obs.header['tsamp']
    data = obs.data
    obs = None
    I,Q,U,V = get_stokes(data,feedtype)

    #Calculate time series, OFF and ON averages, and time samples for each
    tseriesI = np.squeeze(np.mean(I,axis=2))
    I_OFF,I_ON,OFFints,ONints = foldcal(I,tsamp,inds=True,**kwargs)
    if bothfeeds==True:
        if feedtype=='l':
            tseriesQ = np.squeeze(np.mean(Q,axis=2))
            tseriesX = (tseriesI+tseriesQ)/2
            tseriesY = (tseriesI-tseriesQ)/2
        if feedtype=='c':
            tseriesV = np.squeeze(np.mean(V,axis=2))
            tseriesR = (tseriesI+tseriesV)/2
            tseriesL = (tseriesI-tseriesV)/2

    stop = ONints[-1,1]

    #Plot time series and calculated average for ON and OFF
    if bothfeeds==False:
        plt.plot(tseriesI[0:stop],'k-',label='Total Power')
        for i in ONints:
            plt.plot(np.arange(i[0],i[1]),np.full((i[1]-i[0]),np.mean(I_ON)),'r-')
        for i in OFFints:
            plt.plot(np.arange(i[0],i[1]),np.full((i[1]-i[0]),np.mean(I_OFF)),'b-')
    else:
        if feedtype=='l':
            diff = np.mean(tseriesX)-np.mean(tseriesY)
            plt.plot(tseriesX[0:stop],'b-',label='XX')
            plt.plot(tseriesY[0:stop]+diff,'r-',label='YY (shifted)')
        if feedtype=='c':
            diff = np.mean(tseriesL)-np.mean(tseriesR)
            plt.plot(tseriesL[0:stop],'b-',label='LL')
            plt.plot(tseriesR[0:stop]+diff,'r-',label='RR (shifted)')

    #Calculate plotting limits
    if bothfeeds==False:
        lowlim = np.mean(I_OFF)-(np.mean(I_ON)-np.mean(I_OFF))/2
        hilim = np.mean(I_ON)+(np.mean(I_ON)-np.mean(I_OFF))/2
        plt.ylim((lowlim,hilim))

    plt.xlim((min_samp,max_samp))
    plt.xlabel('Time Sample Number')
    plt.ylabel('Power (Counts)')
    plt.title('Noise Diode Fold')
    if legend==True:
        plt.legend()
def plot_diode_fold(dio_cross,bothfeeds=True,feedtype='l',min_samp=-500,max_samp=7000,legend=True,**kwargs):
    '''
    Plots the calculated average power and time sampling of ON (red) and
    OFF (blue) for a noise diode measurement over the observation time series
    '''
    #Get full stokes data of ND measurement
    obs = Waterfall(dio_cross,max_load=150)
    tsamp = obs.header['tsamp']
    data = obs.data
    obs = None
    I,Q,U,V = get_stokes(data,feedtype)

    #Calculate time series, OFF and ON averages, and time samples for each
    tseriesI = np.squeeze(np.mean(I,axis=2))
    I_OFF,I_ON,OFFints,ONints = foldcal(I,tsamp,inds=True,**kwargs)
    if bothfeeds==True:
        if feedtype=='l':
            tseriesQ = np.squeeze(np.mean(Q,axis=2))
            tseriesX = (tseriesI+tseriesQ)/2
            tseriesY = (tseriesI-tseriesQ)/2
        if feedtype=='c':
            tseriesV = np.squeeze(np.mean(V,axis=2))
            tseriesR = (tseriesI+tseriesV)/2
            tseriesL = (tseriesI-tseriesV)/2

    stop = ONints[-1,1]

    #Plot time series and calculated average for ON and OFF
    if bothfeeds==False:
        plt.plot(tseriesI[0:stop],'k-',label='Total Power')
        for i in ONints:
            plt.plot(np.arange(i[0],i[1]),np.full((i[1]-i[0]),np.mean(I_ON)),'r-')
        for i in OFFints:
            plt.plot(np.arange(i[0],i[1]),np.full((i[1]-i[0]),np.mean(I_OFF)),'b-')
    else:
        if feedtype=='l':
            diff = np.mean(tseriesX)-np.mean(tseriesY)
            plt.plot(tseriesX[0:stop],'b-',label='XX')
            plt.plot(tseriesY[0:stop]+diff,'r-',label='YY (shifted)')
        if feedtype=='c':
            diff = np.mean(tseriesL)-np.mean(tseriesR)
            plt.plot(tseriesL[0:stop],'b-',label='LL')
            plt.plot(tseriesR[0:stop]+diff,'r-',label='RR (shifted)')

    #Calculate plotting limits
    if bothfeeds==False:
        lowlim = np.mean(I_OFF)-(np.mean(I_ON)-np.mean(I_OFF))/2
        hilim = np.mean(I_ON)+(np.mean(I_ON)-np.mean(I_OFF))/2
        plt.ylim((lowlim,hilim))

    plt.xlim((min_samp,max_samp))
    plt.xlabel('Time Sample Number')
    plt.ylabel('Power (Counts)')
    plt.title('Noise Diode Fold')
    if legend==True:
        plt.legend()
def plot_diode_fold ( dio_cross , bothfeeds = True , feedtype = 'l' , min_samp = - 500 , max_samp = 7000 , legend = True , * * kwargs ) : #Get full stokes data of ND measurement obs = Waterfall ( dio_cross , max_load = 150 ) tsamp = obs . header [ 'tsamp' ] data = obs . data obs = None I , Q , U , V = get_stokes ( data , feedtype ) #Calculate time series, OFF and ON averages, and time samples for each tseriesI = np . squeeze ( np . mean ( I , axis = 2 ) ) I_OFF , I_ON , OFFints , ONints = foldcal ( I , tsamp , inds = True , * * kwargs ) if bothfeeds == True : if feedtype == 'l' : tseriesQ = np . squeeze ( np . mean ( Q , axis = 2 ) ) tseriesX = ( tseriesI + tseriesQ ) / 2 tseriesY = ( tseriesI - tseriesQ ) / 2 if feedtype == 'c' : tseriesV = np . squeeze ( np . mean ( V , axis = 2 ) ) tseriesR = ( tseriesI + tseriesV ) / 2 tseriesL = ( tseriesI - tseriesV ) / 2 stop = ONints [ - 1 , 1 ] #Plot time series and calculated average for ON and OFF if bothfeeds == False : plt . plot ( tseriesI [ 0 : stop ] , 'k-' , label = 'Total Power' ) for i in ONints : plt . plot ( np . arange ( i [ 0 ] , i [ 1 ] ) , np . full ( ( i [ 1 ] - i [ 0 ] ) , np . mean ( I_ON ) ) , 'r-' ) for i in OFFints : plt . plot ( np . arange ( i [ 0 ] , i [ 1 ] ) , np . full ( ( i [ 1 ] - i [ 0 ] ) , np . mean ( I_OFF ) ) , 'b-' ) else : if feedtype == 'l' : diff = np . mean ( tseriesX ) - np . mean ( tseriesY ) plt . plot ( tseriesX [ 0 : stop ] , 'b-' , label = 'XX' ) plt . plot ( tseriesY [ 0 : stop ] + diff , 'r-' , label = 'YY (shifted)' ) if feedtype == 'c' : diff = np . mean ( tseriesL ) - np . mean ( tseriesR ) plt . plot ( tseriesL [ 0 : stop ] , 'b-' , label = 'LL' ) plt . plot ( tseriesR [ 0 : stop ] + diff , 'r-' , label = 'RR (shifted)' ) #Calculate plotting limits if bothfeeds == False : lowlim = np . mean ( I_OFF ) - ( np . mean ( I_ON ) - np . mean ( I_OFF ) ) / 2 hilim = np . mean ( I_ON ) + ( np . mean ( I_ON ) - np . mean ( I_OFF ) ) / 2 plt . ylim ( ( lowlim , hilim ) ) plt . xlim ( ( min_samp , max_samp ) ) plt . xlabel ( 'Time Sample Number' ) plt . ylabel ( 'Power (Counts)' ) plt . title ( 'Noise Diode Fold' ) if legend == True : plt . legend ( )
Plots the calculated average power and time sampling of ON (red) and
    OFF (blue) for a noise diode measurement over the observation time series
Plots the calculated average power and time sampling of ON ( red ) and OFF ( blue ) for a noise diode measurement over the observation time series