예제 #1
0
def red(fnm):
    if os.path.isfile(fnm):a=rhicdata(fnm)
    else: print fnm, "doesn't exists"; sys.exit()
    print "Selected file:", opt.FILE    
    tx=npy.array([j.data[int(opt.NT)-1:] for j in a.H])
    ty=npy.array([j.data[int(opt.NT)-1:] for j in a.V])
    return a, npy.transpose(tx),npy.transpose(ty)
예제 #2
0
    return c11, c12, c21, c22


if __name__ == "__main__":
    #-- Input options
    opt, args = parsse()
    if opt.FILE == "None": file, NTURNS = rinput()
    else: file = opt.PATH + opt.FILE
    print "Input File:", file
    BLABEL = 0
    SLABEL = 0
    AMP01 = 0
    PHASE01 = 0

    #--- read tbt input
    aD = rhicdata(file)
    bx, by = bMat(aD)
    sx = array([j.location for j in aD.H]) / 1.0e3
    sy = array([j.location for j in aD.V]) / 1.0e3

    #---- write USV modes only
    wUSV(file, bx, sx)
    if opt.CALC == "1":
        print "Writing SVD modes only"
        sys.exit()

    #-- Tunes, CO, PTOP & Noise
    TUNEX, TUNEY = fTune(bx, by)
    Q1 = average(TUNEX)
    Q2 = average(TUNEY)
    print "Average {Qx, Qy}:", round(Q1, 4), round(Q2, 4)
예제 #3
0
    else:
        print "WARNING: # of mode input should be 4!"
        print "will use default modes 0,1,2,3 instead"
        m1i=0;m2i=1;m3i=0;m4i=1
    return m1i,m2i,m3i,m4i

if __name__ == "__main__":
    
    #-- Input options
    opt,args=parsse()
    file, NTURNS=rinput(opt.PATH)
    print "Input File:", file    
    BLABEL=0;SLABEL=0;AMP01=0;PHASE01=0

    #--- read tbt input
    aD=rhicdata(file);bx,by=bMat(aD)
    sx=array([j.location for j in aD.H])/1.0e3
    sy=array([j.location for j in aD.V])/1.0e3

    #--- define tune windows for x & y
    qsx=int((qx0-win)*len(bx));qex=int((qx0+win)*len(bx))
    qsy=int((qy0-win)*len(by));qey=int((qy0+win)*len(by))
    
    #---- write USV modes only
    pl='x'; Ux,Sx,Vx,Fx=wrtUSV(file,bx,sx);
    pl='y'; Uy,Sy,Vy,Fy=wrtUSV(file,by,sy);
    
    #--- find x & y modes in each plane
    m1,m2=findModes(Fx,qsx,qex,nm=20);
    m3,m4=findModes(Fy,qsy,qey,nm=20)
    
예제 #4
0
    phm=array(phm)
    pylab.subplot(2,1,1);
    pylab.scatter(sx,phx);pylab.plot(a.S,phm[:,0]);
    pylab.subplot(2,1,2);
    pylab.scatter(sy,phy);pylab.plot(a.S,phm[:,1]);
    pylab.show()


if __name__ == "__main__":
    t0=time.time()
    #-- Input options & read data
    opt,args=parsse()
    file, NTURNS=rinput(opt.PATH)
    print "Input File:", file
    BLABEL=0;SLABEL=0;AMP01=0;PHASE01=0
    aD=rhicdata(file);bx,by,sx,sy=bMat(aD)

    #-- Tunes, CO, PTOP & Noise & write modes
    TUNEX=findTunes(bx,qx0,tol=0.1);
    TUNEY=findTunes(by,qy0,tol=0.1);
    Q1=average(TUNEX);Q2=average(TUNEY)
    print "Av. Measured {Qx, Qy}:", round(Q1,4), round(Q2,4)
    Q1RMS=sqrt(average(TUNEX)**2); Q2RMS=sqrt(average(TUNEY)**2)
    COX, PK2PKX=ptp(bx); COY, PK2PKY=ptp(by)
    #Ux,Sx,Vx,NOISEX=computeSVD(bx);Uy,Sy,Vy,NOISEY=computeSVD(by);
    [Ux,Sx,Vx,NOISEX],[Uy,Sy,Vy,NOISEY]=foreach(computeSVD,[bx,by],threads=2,return_=True)
    Fx=wrtUSV(file,Ux,Sx,Vx,sx,pl='x');
    Fy=wrtUSV(file,Uy,Sy,Vy,sy,pl='y');

    #--- find modes & compute phadv(x,y)
    if opt.MODE=="0": #--- ph/amp from uncoupled case
예제 #5
0
    return PH


if __name__ == "__main__":

    # -- Input options
    opt, args = parsse()
    file, NTURNS = rinput(opt.PATH)
    print "Input File:", file
    BLABEL = 0
    SLABEL = 0
    AMP01 = 0
    PHASE01 = 0

    # --- read tbt input
    aD = rhicdata(file)
    bx, by = bMat(aD)
    sx = array([j.location for j in aD.H]) / 1.0e3
    sy = array([j.location for j in aD.V]) / 1.0e3

    # --- define tune windows for x & y
    qsx = int((qx0 - win) * len(bx))
    qex = int((qx0 + win) * len(bx))
    qsy = int((qy0 - win) * len(by))
    qey = int((qy0 + win) * len(by))

    # ---- write USV modes only
    pl = "x"
    Ux, Sx, Vx, Fx = wrtUSV(file, bx, sx)
    pl = "y"
    Uy, Sy, Vy, Fy = wrtUSV(file, by, sy)
예제 #6
0
    c12=sqrt((At*Bt)*sCa*sCb/(A*B))*sign(sCa)
    c11=c12*cCa/sCa; c22 = -c12*cCb/sCb
    c21=calC21(c11,c12,c22,PHX,PHY)
    return c11,c12,c21,c22


if __name__ == "__main__":
    #-- Input options
    opt,args=parsse()
    if opt.FILE=="None": file, NTURNS=rinput()
    else:file=opt.PATH+opt.FILE
    print "Input File:", file    
    BLABEL=0;SLABEL=0;AMP01=0;PHASE01=0
    
    #--- read tbt input
    aD=rhicdata(file);bx,by=bMat(aD)
    sx=array([j.location for j in aD.H])/1.0e3
    sy=array([j.location for j in aD.V])/1.0e3
    
    #-- Tunes, CO, PTOP & Noise
    TUNEX, TUNEY=fTune(bx,by)
    Q1=average(TUNEX); Q2=average(TUNEY)
    print "Average {Qx, Qy}:", round(Q1,4), round(Q2,4)
    Q1RMS=std(TUNEX); Q2RMS=std(TUNEY)
    COX, PK2PKX=ptp(bx); COY, PK2PKY=ptp(by)
    NOISEX=noise(bx); NOISEY=noise(by)
    
    #--- find modes & compute phadv(x,y)
    if opt.MODE=="0": #--- ph/amp from uncoupled case
        Ux,Sx,Vx=fmod(bx,m1=0,m2=1,m3=2,m4=3)
        print "Sing vals, X:", round(Sx[0],3),round(Sx[1],3)
예제 #7
0
    phm=array(phm)
    pylab.subplot(2,1,1);
    pylab.scatter(sx,phx);pylab.plot(a.S,phm[:,0]);
    pylab.subplot(2,1,2);
    pylab.scatter(sy,phy);pylab.plot(a.S,phm[:,1]);
    pylab.show()
    
    
if __name__ == "__main__":
    t0=time.time()
    #-- Input options & read data
    opt,args=parsse()
    file, NTURNS,kick=rinput(opt.PATH)
    print "Input File:", file    
    BLABEL=0;SLABEL=0;AMP01=0;PHASE01=0
    aD=rhicdata(file);bx,by,sx,sy=bMat(aD,NTURNS,kick)
    
    #-- Tunes, CO, PTOP & Noise & write modes
    #TUNEX=findTunes(bx,qx0,tol=0.1);
    #TUNEY=findTunes(by,qy0,tol=0.1);
    TUNEX,txclean=fTune(bx);
    TUNEY,tyclean=fTune(by);
    Q1=average(TUNEX);Q2=average(TUNEY)
    print "Av. Measured {Qx, Qy}:", round(Q1,4), round(Q2,4)
    Q1RMS=sqrt(average(TUNEX)**2); Q2RMS=sqrt(average(TUNEY)**2)
    COX, PK2PKX=ptp(bx); COY, PK2PKY=ptp(by)
    #Ux,Sx,Vx,NOISEX=computeSVD(bx);Uy,Sy,Vy,NOISEY=computeSVD(by);
    [Ux,Sx,Vx,NOISEX],[Uy,Sy,Vy,NOISEY]=foreach(computeSVD,[bx,by],threads=2,return_=True)
    Fx=wrtUSV(file,Ux,Sx,Vx,sx,pl='x');
    Fy=wrtUSV(file,Uy,Sy,Vy,sy,pl='y');