Exemple #1
0
def findFringes(filename):
    """
    Find fringes in the scanning file 'filename'. Plots the results and returns
    the value of the offset.
    """
    f = pyfits.open(filename)
    fringes = (f['IMAGING_DATA_FSUA'].data['DATA1']-f['IMAGING_DATA_FSUA'].data['DATA3'])[:,0]
    snr = f['IMAGING_DATA_FSUA'].data['PDSNR']
    opd = np.interp(f['IMAGING_DATA_FSUA'].data['TIME'],
                    f['OPDC'].data['TIME'], f['OPDC'].data['RTOFFSET'])
    s = opd.argsort()
    fringes = fringes[s]
    snr = snr[s]
    opd = opd[s]
    
    plt.figure(0)
    plt.clf()
    ax=plt.subplot(211)
    plt.plot(opd, fringes, label='A-C')
    plt.legend()
    plt.subplot(212, sharex=ax)
    rms = slidop.slidingStd(opd,fringes, 10e-6)
    rms/= rms.mean()
    plt.plot(opd, rms, 'r', label='A-C RMS')
    plt.plot(opd, snr, 'g', label='PDSNR')
    plt.legend()
    f.close()
    return opd[rms.argmax()]
Exemple #2
0
def ftkPerfo(filename, minState=5):
    """
    estimate OPDC performance as OPD residuals
    """
    f = pyfits.open(filename)
    x = f['OPDC'].data.field('TIME')*1e-6
    y = f['OPDC'].data.field('UWPHASE')
    s = f['OPDC'].data.field('STATE')
    f.close()
     
    x = x[np.where(s>=minState)]
    y = y[np.where(s>=minState)]
    
    y = y[np.where(1-np.isnan(x))]
    x = x[np.where(1-np.isnan(x))]
    
    x = x[np.where(1-np.isnan(y))]
    y = y[np.where(1-np.isnan(y))]
    
    x = x[::3]
    y = y[::3]
   
    plt.figure(0)
    plt.clf()
    #plt.plot(x,y,'+', label='raw')
    all_dx = np.logspace(-1,0.5,10)
    jitt = []
    for dx in all_dx:
        try:
            yp = slidop.slidingStd(1.0*x,1.0*y,dx)*2.2/(2*np.pi)
        except:
            print np.diff(x)
            y_,yp,x_ = slidop.sliding_avg_rms(y*2.2/(2*np.pi),x,dx)
            print yp
            yp = np.interp(x,x_,yp)
        jitt.append(yp.mean())
    plt.plot(all_dx,jitt, 'ok-', label='residual jitter')
    plt.ylabel('opd residual RMS (um)')
    plt.xlabel('time window')
    plt.xscale('log')
    plt.vlines(21*0.040, plt.ylim()[0], plt.ylim()[1], label='MIDI frame')
    plt.legend()
    #plt.yscale('log')
    return