diff --git a/iexcode/Octupole_cheatsheet.md b/iexcode/Octupole_cheatsheet.md index d089d83c4a86c2eacbe0d5a2e30db59eec844c24..4524d08fca782cff7840fb70676dc6df102f9f84 100644 --- a/iexcode/Octupole_cheatsheet.md +++ b/iexcode/Octupole_cheatsheet.md @@ -8,27 +8,10 @@ ### **Octupole Endstation initalization (run in the first cell)** tey,tfy,pd,mesh,diag,kbh,kbv = Octupole_init('user_name') -### **Beamline and energy** - safe_state() #puts the beamline in a safe state - ------------------------------------------------------------- - xrays_get_all() #gets current beamline settings - energy_get_all() #gets current ID and mono settings - energy_get() #return the photon energy - slit_get() #gets the exit slit size - ------------------------------------------------------------- - polarization(ID_mode) #sets the polarization but not the energy - grating(grating_name) #changes grating ('HEG','MEG') - energy(hv) #sets the photon energy (ID, mono, apertures) - qp(QP_ratio) #set the QP ration (off = 100 ) - apertures_set(c_2B=1) #(c_2B <1 kills flux) - slit(size) #sets the exit slit - ------------------------------------------------------------- - scanXAS(hv_list) #scans beamline energy (ID_tracking = True/False to set ID move/stay) - ------------------------------------------------------------- - resolution() #prints resolution for current setting - ### **Octupole Endstation** Octupole_get_all() Octupole_safe_state() + ------------------------------------------------------------- + Octupole_light(ON_OFF) \ No newline at end of file diff --git a/iexcode/instruments/VLS_PGM.py b/iexcode/instruments/VLS_PGM.py index 0481388f84504f10010a485724768a4899e1b837..77a1892f05eea1dda762036f4d596d6876c2fe22 100644 --- a/iexcode/instruments/VLS_PGM.py +++ b/iexcode/instruments/VLS_PGM.py @@ -658,7 +658,7 @@ def mono_grating_offset_set(val,grt_num=None): Previously: Mono_Set_GRT0 """ - pvs=_mono_pvs(None,None) + pvs=_mono_pvs(grt_num,None) caput(pvs['grt_offset'],val) mono_get_all_extended(verbose=True) diff --git a/iexcode/instruments/xrays.py b/iexcode/instruments/xrays.py index 3ec1eb15de7d1f1b7624a7b5b4bc959a07b58f16..af9e5ad0a0fc4ce68ee5bb7b98439feac56d04dc 100644 --- a/iexcode/instruments/xrays.py +++ b/iexcode/instruments/xrays.py @@ -326,6 +326,13 @@ def getE(): """ return energy_get() +def getLambda(): + """ + Returns the energy in wavelength (A) + """ + hv = energy_get() + return eV2Lambda(hv) + def grating(grating_name): """ used to switch between gratings diff --git a/iexcode/macros/commissioning.py b/iexcode/macros/commissioning.py index 3e627f0e8889e65e60d0514d58615a2e9fa34322..8800101255aa8aa04274e7b63f2befd7e655c878 100644 --- a/iexcode/macros/commissioning.py +++ b/iexcode/macros/commissioning.py @@ -191,6 +191,7 @@ def scan_mono_vs_slit(slit='2V',slit_parameters=[0.25,-2,2,0.5],energy_parameter def mono_MIR_GRT_find_offset(grt,slit_list,**kwargs): """ Find MIR-GRT offset by scanning 0 order through exit slit + for very rough alignment **kwargs: detNum = 15 @@ -468,9 +469,6 @@ def beamsteering_2B(v_position): else: v_direction=' -' v_steering=v_direction+str(abs(vroll))+' urad' return v_steering,float(v_steering.split(" ")[1]) - - - def ID_steering_scans(**kwargs): @@ -485,6 +483,7 @@ def ID_steering_scans(**kwargs): extended_range True/False False: default range = -3,3,0.1 True: -5,5,0.1 + set_ID: if included sets the ID to the specified value Note: Does not set the ID, mvID = 2.0 gives a nice gaussian """ @@ -495,6 +494,9 @@ def ID_steering_scans(**kwargs): else: start,stop = (-3,3) + if 'set_ID' in kwargs: + ID_set_eV(kwargs['set_ID']) + size,center = slit1A_get(verbose=False) slits_scan_center('slit1A','H',start,stop,0.1,size=(0.25,inf),comment='Slit center - 1H') @@ -535,6 +537,9 @@ def wire_scans(**kwargs): if kwargs['sound']: playsound() +def wire_plots(scanNum,det_num): + print('copy code here') + def monoVslit_quick_scan(slit_name, **kwargs): """ sets the slit to be narrow and scans along and across the grating @@ -565,6 +570,17 @@ def monoVslit_quick_plot(scanNum,detDiode,c,xrange=None): plt.show() return position +def monoVslit_full_profile_scan(slit_name, **kwargs): + """ + Makes a nice 2D image of the energy distribution of the beam across the grating at ID=500 + SlitList=["2H","2V","1H","1V"] + + kwargs: + + + Previously BeamProfile + """ + ##################################################################################### ### Slit-1A Procedures @@ -625,46 +641,6 @@ def procedure_reset_slit1A(): print("# Then SetSlit1A(1Hsize,1Vsize,0,0); where 1Hsize and 1Vsize are the size where CA4 = 0") print(" for m in [9,10,11,12]: Reset_Motor_User(m,'b',0);SyncAllSlits()") - -def check_ID_steering(hv=2000): - """ - Scans Slit1A center (set to a (0.25,0.25) pinhole) while looking at the back blade: - - slit center vs fixed aperture: given by the position of the edges - - beam center vs fixed aperture: given by the position of the bump in the middle - """ - slit1A_set(0.25,0.25,0,0) - ID_set(hv) - scan_slit_center('1H',-3,3,0.1) - scan_slit_center('1V',-3,3,0.1) - -def scan_slit_center(slit,start,stop,step,size=0.25): - """ - slit = '1H','1V','2H' or '2V' - - Previously: Scan_SlitCenter - """ - if slit[0] == '1': - slit_name = "slit1A" - elif slit[0] == '2': - slit_name = "slit2B" - direction = slit[1] - slits_scan_center(slit_name,direction,start,stop,step,size=size) - - -def scan_slit_size(slit,start,stop,step,center=(0,0)): - """ - slit = '1H','1V','2H' or '2V' - - Previously: Scan_SlitSize - """ - if slit[0] == '1': - slit_name = "slit1A" - elif slit[0] == '2': - slit_name = "slit2B" - direction = slit[1] - slits_scan_center(slit_name,direction,start,stop,step,center=center) - - ##################################################################################### # Checking the beam steering uses the gas-cell to see if the beam is centered on the grating diff --git a/iexcode/staff_cheatsheet.md b/iexcode/staff_cheatsheet.md index d7f13d88c617e88dc91212ccfecdbbf7402f223c..81e842682516d198497f3d8f2584c6430a0e16ad 100644 --- a/iexcode/staff_cheatsheet.md +++ b/iexcode/staff_cheatsheet.md @@ -109,8 +109,8 @@ To Do: M0M1 table moves to dictionary with csv file FMB_mirror_move_all(mirror_num,position_list) #moves all the axes to the positions specified in position_list FMB_mirror_tweak(mirror_num,axis) #relative moves FMB_mirror_scan(mirror_num,start,stop,step) #scan a mirror axis - M0M1_Table => reads the dictionary file to get the previous mirror positions - M0M1_SP => writes the values form M0M1_Table to the set points (still need to push move) + M0M1_Table #reads the dictionary file to get the previous mirror positions + M0M1_SP #writes the values form M0M1_Table to the set points (still need to push move) ## **hxp_mirrors** Newport hexapods M3A/M4A and M4R @@ -175,6 +175,19 @@ kappa specific functions tey,d3,d4,mesh,tth_pv,tthdet = kappa_init('user_name) +## **Keithley_current_amplifiers** +Keithley specific functions + + ca = Keithley(ca_crate, ca_num) #class for Keithley current amplifiers + ca.get() #gets current values + ca.reset() #resets + ca.autoscale(On_Off) #turn autoscaling on/off + ca.avg(num_averages) #set averaging (1 or 0 is off) + ca_detector_list #list of detectors which are used in a given branch ('b for beamline) + ca_average() #turns on averaging for all Keithleys in ca_list + ca_reset_all() #resets all Keithleys in all branches + + ## **Logfile** functions for writing logfile.txt, gets set by IEX_BL_config @@ -182,8 +195,6 @@ functions for writing logfile.txt, gets set by IEX_BL_config log_update() #updates the logfile with the current info (used if script is aborted) log_name_set(new_name) #change name of logfile - - ## **m3r** functions for dealing with m3r To Do - move m3r table to dictionary @@ -213,7 +224,7 @@ motor class and common name functions scaler_cts() #sets the scaler counter for the current endstation -## scanRecord +## **scanRecord** functions and class for handling the scanRecord saveData_get_all() #returns dictions of fileSystem,subDir,scanNumber,baseName @@ -246,9 +257,6 @@ functions and class for handling the scanRecord .empty_scan #scan with no positioners .time_scan #scan with positioner readback as time and detector settling as minutes - - - ## **Scienta** base functions for taking spectra, called by electron_analyzer @@ -263,129 +271,205 @@ main shutter and branch shutter functions branch_shutter_close() #checks status then closes iex.BL.mda.branch shuttter if not closed branch_shutter_status() #returns open=True/False -## slits +## **slits** beamline slits and aperatures - slit_name_list() #list all slits/apertures - slits_synch(slit_name) #syncs the motor position with the slit table for a given slit - slits_synch_all() #syncs all slits - slits_get_all() #gets current values - slits_set #sets the slit/aperature to the specified size and position - slits_get #gets the slit/aperature size and position - slits_set_size - slits_set_center - slits_scan_size - slits_scan_center - slit1A_scribe_marks #moves the slits so that the scribe marks should align - slit1A_get/set - slit2B_get/set - slit2B_encoders_reset #resets the encords to be zero at the specified position - slit3C_get/set - slit3D_get/set - exit_slit #uses iex.BL.branch to set correct exit slit size - -#staff -folders_startup => makes folder structure for a new run - -#storage ring -wait_for_beam => waits for storage ring current to be above ring_current - -#userCals: functions for filling in user calcs and string Sequences - -#utilities: general functions -dateandtime => prints current date and time -today => returns a string with the date -print_warning_message => prints a warning message_string -wait_for_it => waits for future time -input_timeout => used to break for an input -playsound -range_up/down => loop for noninteger counting (inclusive of last point) -take_closest_value => takes the closest value from a list -read_dict => reads text files in iexcode.IEX_dictionaries -make_table => makes a table array from a list of lists - -#valves: control valves via epics -branch_valve_close/open -valve_close/open - -#VLS_PGM: mono functions -mono_get_all => returns the current mono settings from most common parameters -mono_get_all_extended => returns all the current mono settings -mono_grating_get/set -mono_energy_get/set -mono_reset_pitch => resets the motors after a following error -mono_stop => stops the mono motors -mono_enage => reenables the mono motors -mono_limits_reset => sets the energy lower limit to 200 -mono_cff_print -mono_parameters_get -mono_parameters_history_read -mono_parameters_history_write -mono_temperature_interlock => moving this to EPS -mono_scan_fillin/_table -mono_scan_after -mono_motor_move -mono_motor_scan_fillin -mono_zero_order -mono_angles_set -mono_pink_beam -mono_grating_offset_set -mono_mirror_offset_set -mono_grating_mirror_offsets_set -mono_grating_b2_set -mono_cff_set -mono_arm_set - -#xrays -safe_state -energy_get_all -energy_get => retuns the mono energy -getE => same as energy_get -energy => set the ID, aperatures and mono -qp => set the qp ratio -apertures_set => decrease aperature size/cutting flux -mvID => moves the ID to a given set point (not calibrated) -mvID_calibrated => moves the ID for max flux -mvmono => sets mono energy -grating/_get => switches gratings/gets the current grating -polarization/_get => changes the polariation/gets current polarization -scanXAS => table scan of the energy -shutter_check => checks main and branch shutter -switch_branch => moves m3R to default position for the branch; close/reopens shutters too -get_mirros => gets all the FMB mirror positions -slit => sets the exit_slit -slit_get => gets the exit slit - -## Keithley_current_amplifiers -Keithley specific functions + slit_name_list() #list all slits/apertures + slits_synch(slit_name) #syncs the motor position with the slit table for a given slit + slits_synch_all() #syncs all slits + slits_get_all() #gets current values + slits_set(slit_name,(Hsize,Vsize),(Hcenter,Vcenter)) #sets the slit/aperature to the specified size and position + slits_get(slit_name) #gets the slit/aperature size and position + slits_set_size(slit_name,(Hsize,Vsize)) #sets the slit/aperature to the specified size + slits_set_center(slit_name,(Hcenter,Vcenter)) + slits_scan_size(slit_name,direction,start,stop,step) + slits_scan_center(slits_scan_center(slit_name,direction,start,stop,step) + slit1A_scribe_marks() #moves the slits so that the scribe marks should align + slit1A_get() + slit1A_set(H_size,V_size) + slit2B_get() + slit2B_set(H_size,V_size) + slit2B_encoders_reset(Hcenter,Vcenter) #resets the encords to be zero at the specified position + slit3C_get() + slit3C_set(size) + slit3D_get() + slit3D_set(V_size,center=None) + slit3D_encoders_reset(Vcenter) + exit_slit_get() + exit_slit_set(branch, size) #uses iex.BL.branch to set correct exit slit size + +## **SRS_current_amplifiers** +SRS specific functions + + d=SRS #class for SRS current amplifiers + d.get() #read the current values + d.set_all() #updates pv + d.setgain(gain,unit) #sets the gain + d.srs_print_all() #prints current values + + +## **staff** +detector dictionionary for staff + +## **storage ring** +wait_for_beam() #waits for storage ring current to be above ring_current + +## **userCals** +functions for filling in user calcs and string Sequences + + +## **utilities** +general functions + + dateandtime() #prints current date and time + today() #returns a string with the date + print_warning_message(message) #prints a warning message_string + wait_for_it(D,H,M) #waits for future time + input_timeout(question,t) #used to break for an input + playsound() #plays audio file + range_up/down(start,end,step) #loop for noninteger counting (inclusive of last point) + take_closest_value(my_list,my_number) #takes the closest value from a list + read_dict(filename) #reads text files in iexcode.IEX_dictionaries + make_table(start_stop_step_lists) #makes a table array from a list of lists + +## **valves** +control valves via epics + +branch_valve_close/open() +valve_close/open() + +## **VLS_PGM** +mono functions +To Do - we need to look at the parameters_history + + mono_get_all() #returns the current mono settings from most common parameters + mono_get_all_extended() #returns all the current mono settings + mono_grating_get() #gets the grating_name + mono_grating_set(grating_name) #translate to the specified grating (mono only, no shutter) + mono_energy_get() #gets the current mono energy + mono_energy_set() #set the mono energy + mono_reset_pitch() #resets the motors after a following error + mono_stop() #stops the mono motors + mono_enable() #reenables the mono motors + mono_limits_reset() #sets the energy lower limit to 200 + mono_cff_print() + mono_parameters_get() + mono_parameters_history_read() + mono_parameters_history_write() + mono_temperature_interlock() #moving this to EPS + mono_scan_fillin/_table #standard scanRecord fill in stuff + mono_scan_after() #standard scanRecord fill in stuff + mono_motor_move(motor,value) + mono_motor_scan_fillin() #standard scanRecord fill in stuff + mono_zero_order(angle) #set mono mirror and grating angle the same + mono_angles_set(alpha,beta) #moves the mirror,grating angles + mono_pink_beam() #sets the mono angles to 0, and translates grating and mirror to let pink beam pass + mono_grating_offset_set(offset_val) #sets the grating offset + mono_mirror_offset_set(offset_val) #sets the grating offset + mono_grating_mirror_offsets_set(mirror_offset) #sets the offsets while maintaining parallelism + mono_grating_b2_set/get(b2_val) + mono_cff_set/get(val,tune_num) #set the ccf tuning value + mono_arm_set/get(distance_mm) #set the mono arm distance + +## **vortex** +control of the vortex +To Do - make a class, add stuff to the ioc instead of userCalcs + + mca_energy() #sets the energy window for the vortex + mca_scaler(time_sec) #sets acquisition time for vortex and SRS to time_sec + mca_run(time_sec) + mca_off() #turns off the power to the vortex + mca_on() #turns on the power to the vortex + scanmca() #setup the scanRecord for triggering the vortex + mca_check_save() #checks that the saving is setup + +## **xrays** + + + safe_state() #puts the beamline in a safe state + ------------------------------------------------------------- + xrays_get_all() #gets current beamline settings + energy_get_all() #gets current ID and mono settings + energy_get() / getE() #return the photon energy + getLambda() ##return the photon energy in wavelength (A) + slit_get() #gets the exit slit size + ------------------------------------------------------------- + polarization(ID_mode) #sets the polarization but not the energy + grating(grating_name) #changes grating ('HEG','MEG') + energy(hv) #sets the photon energy (ID, mono, apertures) + mvmono(hv) #moves the mono energy only + mvID(hv) #move the ID energy (non calibrated) + mvID_calibrated() #moves the ID for max flux + qp(QP_ratio) #set the QP ration (off = 100 ) + apertures_set(c_2B=1) #(c_2B <1 kills flux) + slit(size) #sets the exit slit + ------------------------------------------------------------- + scanXAS(hv_list,ID_tracking=True) + ------------------------------------------------------------- + shutter_check() #checks main and branch shutter + switch_branch(branch) #moves m3R to default position for the branch; close/reopens shutters too + get_mirrors() #gets all the FMB mirror positions + slit() #sets the exit_slit + slit_get() #gets the exit slit - ca = Keithley(ca_crate, ca_num) #class for Keithley current amplifiers - ca.get() #gets current values - ca.reset() #resets - ca.autoscale(On_Off) #turn autoscaling on/off - ca.avg(num_averages) #set averaging (1 or 0 is off) - ca_detector_list #list of detectors which are used in a given branch ('b for beamline) - ca_average() #turns on averaging for all Keithleys in ca_list - ca_reset_all() #resets all Keithleys in all branches -## SRS_current_amplifiers - SRS specific functions - SRS => class for SRS current amplifiers - .get - .setgain -current2flux => calculates the flux based on the current reading in an AUX100 photodiode -flux2current => calculates the current reading for a given flux for and AUX100 photodiode +current2flux #calculates the flux based on the current reading in an AUX100 photodiode +flux2current #calculates the current reading for a given flux for and AUX100 photodiode # **Macros** -## **IEX_cameras** + +## **ARPES_macros** + + WorkFunction_Measure(PE,KE=409) + WorkFunction_Calc() + RoughPositions_Find(th_start,th_stop, th_step,**kwargs) + +## **ARPES_macros** + + BL_Shutdown() + + +## **cam_macros** used for taking images from epics cam_snap(cam_num) # takes a single image cam_scan_setup(cam_num) #configures the scanRecord trigger an image cam_live(cam_nume) #puts the camera back in live/free-run mode cam_done(cam_num) #turns off acquisition + +## **commissioning** +functions for aligning the beamline + + check_flux_scan() #puts the diode in and scans the mono + check_flux_read() #puts the diode in in the branch defined my position of m3r + measures flux + ------------------------------------------------------------- + scan_wire(direction) + ------------------------------------------------------------- + scan_narrow_slit(slit='2V',slit_parameters=[0.25,-2,2,0.5]) + scan_mono_vs_slit(slit='2V',slit_parameters=[0.25,-2,2,0.5],energy_parameters=[470,530,2]) + mono_MIR_GRT_find_offset(grt,slit_list) #find MIR-GRT offset by scanning 0 order through exit slit + -------------------------------------------------------------exit_slit_vs_hv(hv) #Adjust slit size to keep reasonable count vs hv + scan_energy_along_grating(hv) #Takes a Slit-2V map for a range of photon energies + scan_mono_energy_drift(start,stop,step #measure the energy shift vs photon energy + ------------------------------------------------------------- + scan_pinhole_full() #pinhole scan of slit1A + ------------------------------------------------------------- + iex_steering(h_position,v_position) #calculates ID steering required + M0M1_steering(H2,V2) #calculates M1 adjustment + + ID_steering_scans() + ID_steering_plots(scanNum,det_num,xrange=[-1,1]) + + wire_scans() + + monoVslit_quick_scan(slit_name) + monoVslit_quick_plot(scanNum,detDiode,c,xrange=None) + + ------------------------------------------------------------- + check_slit1A(step=0.1) #realign slit 1A; obsolete \ No newline at end of file