示例#1
0
def collect(*args):
    if len(args) == 0:
        print "Motors are listed with the innermost loop first."
        print "Press ^D (control D) to abort input\n"
        print ("Fastest moving motor (X0) is "+str(spec.GetMtrInfo(motor3)['symbol']))
        X0 = macros.UserIn("X0",spec.wm(motor3),float)
        DX = macros.UserIn("DX",0.1,float)
        NX = macros.UserIn("NX",1,int)

        print ("Next fastest moving motor (PHI0) is "+str(spec.GetMtrInfo(motor2)['symbol']))
        PHI0 = macros.UserIn("PHI0",spec.wm(motor2),float)
        DPHI = macros.UserIn("DPHI",0.1,float)
        NPHI = macros.UserIn("NPHI",1,int)

        print ("Slowest moving motor (Y0) is "+str(spec.GetMtrInfo(motor1)['symbol']))
        Y0 = macros.UserIn("Y0",spec.wm(motor1),float)
        DY = macros.UserIn("DY",0.1,float)
        NY = macros.UserIn("NY",1,int)

        Count = macros.UserIn("count",1.0,float)
        frames = macros.UserIn("frames",1,int)
        filename = macros.UserIn("filename",None,str)
    elif len(args) == 12:
        X0, DX, NX, PHI0, DPHI, NPHI, Y0, DY, NY, Count, frames, filename = args
    else:
        print 'Wrong number of arguments'
        print '  collect(X0, DX, NX, PHI0, DPHI, NPHI, Y0, DY, NY, Count, frames, filename)'
        return

#    print 'NX = ', NX, ', NPH1 = ', NPHI, ', X0 = ', X0, ', DX = ', DX, ', PHI0 = ', PHI0, ', DPH1 = ', DPHI, ', File Name = ', filename, ', Time Per Frame = ', Count, ', Number of Frames = ', frames

    macros.write_logging_header(logfile)

    try: 
        for IY in range(NY):
            Y = Y0 + (IY*DY)
            spec.umv(motor1,Y)
            for IPHI in range(NPHI):
                PHI = PHI0 + (IPHI*DPHI)
                spec.umv(motor2,PHI)
                for IX in range(NX):
                    X = X0 + (IX*DX)
                    spec.umv(motor3,X)                
                    macros.Copen()
                    spec.count_em(Count*frames)
                    AD.AD_acquire(det,filename,Count,frames,wait=True)
                    spec.wait_count()
                    spec.get_counts()
                    macros.Cclose()
                    macros.write_logging_parameters(logfile)
    except Exception,err:
        import traceback
        msg = "An error occurred at " + macros.specdate()
        msg += " in file " + __file__ + "\\n\\n"
        msg += str(traceback.format_exc())
        macros.SendTextEmail(userlist, msg, '1-ID Beamline specpy Abort')
        print 'Error=',err
        print str(traceback.format_exc())
示例#2
0
def scan_xyN (fname, Nframe, tframe, stX, nX, dX, stY, nY, dY, nLoop, logname):
    ''' Usage: scan_xyN [fname] [Nframe] [tframe] [x0] [Nx] [dx] [y0] [Ny] [dy] [nLoop] [logname]
    '''
    # define PVs to be recorded

#p date(),GE_fname,GE_fnum,GE_tframe,GE_Nframe,S[0],S[1],S[2],S[8],S[9],S[10],S[11],
#   p1Hs,p1Vs,Iring,energy,energy_cal,preamp1,preamp2,
#    sammy_x,sammy_y,sammy_z,sammy_x2,sammy_z2,sammy_phi,
#    keyence1,keyence2,cross,load,mts3,mts4,temp1,temp2,temp3,temp4

    mac.write_logging_header(logname)
    for iLoop in range(nLoop):
        spec.umv(spec.mts_y,stY) 
        for yLoop in range(nY):
            spec.umv(spec.mts_x2,stX) 
            for xLoop in range(nX): 
                GE_expose(fname, Nframe, tframe)
                #record beamline and exposure data in parameter file after exposure
                mac.write_logging_parameters(logname)
                spec.umvr(spec.mts_x2,dX) 
            spec.umvr(spec.mts_y,dY) 
    mac.beep_dac()