pro imaging_and_diffraction_1a, ZIM, ZDIF1 ;Usage: Enter at the IDL command line: ;imaging_and_diffraction_1,3.5,3.6 ;(without the ;) ;(3.5, 3.6, and are examples of the Z pedestal position for ;imaging, and diffraction respectively. ;2 position labels which go in comment 1 text0='Imaging Position' text1='Q measurement during phase transformation' ;"CLOSED" cam slit positions YPOS=0.0 ZPOS=0.0 YCLOSE=0 ZCLOSE=0 ;close means small, for diffraction ; med_name='X17B2:med:' ;First define an epics med object for your detector. x17med = obj_new('epics_med', med_name, 4) ; create the object, the 4 designates the number of detector elements ;Now define several epics_motor objects z=obj_new('epics_motor','X17B2:m7') slitywidth=obj_new('epics_motor','X17B2:pm8') slitypos=obj_new('epics_motor','X17B2:pm9') slitzwidth=obj_new('epics_motor','X17B2:pm10') slitzpos=obj_new('epics_motor','X17B2:pm11') ; ;z->get_position,ZORIG ;get start position ;now ask about the file name sFile='t:\LastFileWritten.txt' openr,inunit,sFile, /get_lun full_file_name="" file_name="" path="" readf,inunit,full_file_name close,inunit,/all slash = strpos(full_file_name, '\',/reverse_search) length=strlen(full_file_name) path=strmid(full_file_name,0,slash+1) file_name=strmid(full_file_name,slash+1,length-(slash+1)) file_name=increment_filename(file_name) print,path,file_name ; START: status=caget('X17B2:med:PresetReal',ctime) ; check that diffraction count time is not 0.0 If ctime eq 0 then begin print, 'Set count time in 4 ELEMENT DETECTOR CONTROL medm window' stop endif ;IMAGING status=caput('X17B2:ExperimentComment1.VAL',text0) z->move,ZIM ;move to imaging position z->wait status=caput('X17B2:UnidigBo0',1) ; close shutter before moving slit slitzwidth->move,-1.36 ;open Z cam slit slitywidth->move,-.35 ;open Y cam slit slitzpos->move,-.7 ;move Z cam slit slitypos->move,0 ;move Y cam slit slitzwidth->wait slitywidth->wait slitzpos->wait slitypos->wait ;start acquiring image status=caput('X17B2_CCD:det1:AcquireCLBK',1) wait, 2. slitzwidth->move,ZCLOSE ;close Z cam slit slitywidth->move,YCLOSE ;close Y cam slit slitzpos->move,ZPOS ;move Z cam slit slitypos->move,YPOS ;move Y cam slit slitzwidth->wait slitywidth->wait slitzpos->wait slitypos->wait status=caput('X17B2:UnidigBo0',0) ; open shutter before moving slit ;END IMAGING ; ;START DIFFRACTION ;move sample to diffraction position status=caput('X17B2:ExperimentComment1.VAL',text1) z->move,ZDIF1 ;move to point "ZDIF1" z->wait x17med->erase ;erase any spectra that was there x17med->acquire_on ;start acquisition x17med->acquire_wait,/start ;wait for acquisition to complete ;insert scan routines here x17med->acquire_wait x17med->write_file, file_name ;save the spectrum ; ; Save the name of the last file written openw,ilun,sFile, /get_lun printf,ilun,path+file_name close,ilun,/all ; file_name=increment_filename(file_name) R = GET_KBRD(0) print, R if R ne 'q' then begin goto, START endif z->move,ZORIG ;move to original position z->wait print, "PROGRAM HAS STOPPED" END