From f040f407e0caa7569a582519e8c2329155f68cca Mon Sep 17 00:00:00 2001 From: 29iduser <you@example.com> Date: Tue, 1 Nov 2022 13:22:42 -0500 Subject: [PATCH] found old version of staff_cheatsheet --- iexcode/staff_cheatsheet.md | 488 ++++++++++++++++++++++++++++++++++++ 1 file changed, 488 insertions(+) create mode 100644 iexcode/staff_cheatsheet.md diff --git a/iexcode/staff_cheatsheet.md b/iexcode/staff_cheatsheet.md new file mode 100644 index 0000000..e7b988e --- /dev/null +++ b/iexcode/staff_cheatsheet.md @@ -0,0 +1,488 @@ +# **IEX python - cheatsheet** +list iexcode function by file +<br> + +--- +<br> + +# **Instruments** + +## **ARPES** +ARPES sepcific functions + + tey,ca15 = ARPES_init('user_name') + +## **AD_utilites** +functions for common area detector operations + +## **bakeout** +functions for monitoring a bakeout + +## **cfg** +config file which holds global variable BL and MPA + + + import iexcode.instruments.cfg as iex + +## **converstions_constants** + h #Planck's constant (eV/s) + c #speed of light (m/s) + ------------------------------------------------------------- + deg2rad(deg) #converts degree to radian + rad2deg(radian) #converts radian to degrees + ------------------------------------------------------------- + eV2Lambda(eV) #converts eV to wavelength in Angstroms + Lambda2eV(Angstroms) #converts Angstroms to eV + ------------------------------------------------------------- + hv2kz(lattice,V0,hv) #converts photon energy to kz + kz2hv(lattice,V0,n) #converst kz to photon energy + kx2deg(kx,hv) #converts in-plane momentum to degrees + deg2kx(th,hv) #conversts degrees to in-plane momentum + +## **diagnostics** +beamline diagnostics, positions and current amplifiers +To Do: add functions to enable scanning + + diagnostic_name_list() #prints the name of all the diagnostics_all_in/out() #move all diagnostics to in/out position + diagnostic(name,in_out) #moves the specified + diagnostic_read(name) #reads the current amplifier for a given diagnostic + ------------------------------------------------------------- + mesh_W(In_Out) #moves W-mesh in the A-hutch in/out + diode_c(In_Out) #moves diode in c-branch in/out + diode_c_read() #reads the current amplifier for the c-branch diode + diode_d(In_Out) #moves diode in c-branch in/out; located just before the kappa endstation + mesh_d(In_Out) #moves mesh in d-branch in/out; used for normalization + mesh_d_read() #reads the current amplifier for the d-branch mesh +------------------------------------------------------------- + diagnostics_preset_list() #returns the dictionary with all preset positions + diagnostics_presets_go(diag_name,preset_name) #goes to preset value + _diagnostics_sp_write(diag_name,preset_name,val) + +## **electron_analyzer** +Scienta functions + + folders_EA(userPath #sets the folder for spectra saving (called by folders_ARPES) + ------------------------------------------------------------- + EA_ioc_init() #initializes the ioc after a reboot (eventually goes in AutoSave) + ------------------------------------------------------------- + EA.get() #get current EA setting + EA.put(KE,PE) #change EA setting + EA.off() #turns off EA high voltagae + ------------------------------------------------------------- + SES_motor_get() #gets current SES slit number + SES_motor_set(slit_number) #change SES slit + ------------------------------------------------------------- + scanEA_reset() #clears scanRecord after abort + ------------------------------------------------------------- + scanEA(EAlist) #takes spectra + scanFM(EAlist,thList,RoughPositions) #takes Fermi map + scanEA_y(EAlist,y_start,y_stop,y_step) #takes spectra along y + scanEA_z(EAlist,z_start,z_stop,z_step) #takes spectra along z + scanEA_map_sample(EAlist,y_list,z_list) #takes spectra in 2D y,z scan + ------------------------------------------------------------- + EA_ioc_init() #initializes the ioc after a reboot (eventually goes in AutoSave) + + +## **encoder** +all beamline absolute encoders + + encoder_name_list() #lists names in encoder dictionary + encoder_sync(name) #syncs all the encoders associated with name + encoders_reset_zero(name) #resets the center for the current position + +## **files_and_folder** +general functions for dealing with files and directories + + path_dserv(folder,run,user_name) #path to user data directory on the dserve + check_run() #returns the current run based on todays date + folder_ftp(folder,run,user_name) #creates the folders on the ftp server, kip + make_user_folders(run,folder,user_name,endstation_name) #creates all the appropriate user folders + folder_mdarun,folder,user_name,file_prefix,ioc) #creates/set the user folder for the scanRecord + folder_SPEC(run,folder,user_name) #creat3s spec folder in 29iduser account + +## **FMB_mirrors** +functions for M0,M1,M3R +To Do: M0M1 table moves to dictionary with csv file + + FMB_mirror_get(mirror_num) #get the current position of all axes for a given mirror + FMB_mirror_move(mirror_num,axis) #moves the specified axis ('Tx','Ty','Tz','Rx','Ry','Rz') for the given mirror + 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) + +## **hxp_mirrors** +Newport hexapods M3A/M4A and M4R + + hxp_sync(mirror_name) #syncs the motor setpoint and readback values + hxp_get(mirror_name) #gets a mirror position + hxp_get_all() #gets all the mirror positions + +## **IEX_camera** +Cameras to enable/disable when switching between branches + + cam_pv_dictionary() + _enable_endstation_cameras(unused_off=True) + +## **IEX_BL_config** +used to access current beamline configuration, based on instance initialization not pv + + Beamline_Config #class to carry all configuration info gets stored in BL + BLconfig_endstation_name() #gets or sets iex.BL.endstation_name + BLconfig_folder() #gets or sets iex.BL.folder + BLconfig_branch() #gets or sets iex.BL.branch + BLconfig_xrays() #gets or sets iex.BL.xrays (True/False) + BLconfig_mode() #gets or sets iex.BL.mode ('user'/'staff') + BLconfig_get_set(endstation_get) #sets iex.BL.endstation_get + BLconfig_safe_state_set(endstation_safe_state) #sets iex.BL.safe_state + ------------------------------------------------------------- + get_all() #gets relavent pv values + +## **IEX_VPU: undulator functions** +insertion device functions + + ID_wait_for_permission() #waits for security access + ------------------------------------------------------------- + ID_get_all() #gets ID_mode, ID_QP_ratio, ID_sp, ID_rbv + ID_energy_range() #return max/min for a given mode + ID_ready() #looks at the two busy records + ID_off/on() #turns off/on the ID + ID_power_status() #returns off/on + ID_start(ID_mode,QP_ratio) #turns on the ID in a given mode + ID_switch_mode(ID_mode) #changes the ID mode + ID_get/set() #gets rbv / sets val in keV + ID_get/set_eV() #gets rbv / sets val in eV, uses keV pvs, just does math + ID_energy_set(val) #set calibrated energy in keV + ID_energy_set_eV(val) #set calibrated energy in keV, just does math + ID_get_rbv/_eV() #get the read back value in keV/eV (same as ID_get) + ID_get_sp/_eV() #get the read back value in keV/eV + ------------------------------------------------------------- + ID_calc_eV(mono_grating,ID_mode,hv_eV,QP_ratio) #calculate the set point for maximum flux + + +## **kappa_angle_calcs** + + fourc2kappa(theta,chi,phi) # converts between four-circle angles and kappa angles + kappa2fourc(kth,kappa,kphi) # converts between kappa dn four-circle angles + +## **kappa_det** +defines kappa tth detector class and other functions + + Kappa_Detector(kappa_Motors) #for detset etc in kappa chamber + tthdet.set(det_name) #sets the tth to a different detector + tthdet.get() #returns the current tth det_name + tth0_set() #resets the tth zero; d4 only + + +## **kappa** +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 + + log_print(comment) #print a comment in the logfile + log_update() #updates the logfile with the current info (used if script is aborted) + log_name_set(new_name) #change name of logfile + log_init(endstation_name,user_name,log_dictionary) #sets up logging + +## **m3r** +functions for dealing with m3r +To Do - move m3r table to dictionary + + m3r_tweak_pitch(tweak_value) #tweaks the pitch of m3r + m3r_table() #go to the default position specified branch + m3r_branch() #returns the branch based on mirror position + m3r_switch_branch() #moves the mirror to the default position for a given branch, does not close the shutter + m3r_centroid() #returns the centroid position for m3r + m3r_align () #aligns the m3r + +## **Motors** +motor class and common name functions + + Motor #class definition get set in Beamline_Config + mvx(val) #moves motor x + dmvx(val) #relative move of x + scanx(start,stop,step) #scan of x motor + dscanx (start,stop,step) #relative scan of x motor + ... + +## **resolution** + + resolution() #gives the resolution for the current settings + +## **scalers** + + scaler_cts() #sets the scaler counter for the current endstation + +## **scanRecord** +functions and class for handling the scanRecord + + saveData_get_all() #returns dictions of fileSystem,subDir,scanNumber,baseName + mda_filepath() #gets the full filepath from the current mda setting + mda_prefix() #get the prefix from the current mda setting + mda_user_name() #gets the user name from the current mda setting + mda_run_cycle() #gets the run cycle from the current mda setting + mda_ioc() #returns the ioc + mda_reset() #resets the scanRecord base on init parameters + + + mda_fileNum() #return next fileNum + last_mda() #retruns the filenum for the last saved scan + ------------------------------------------------------------- + ScanRecord #class for handling scanRecord_user + ------------------------------------------------------------- + scan_fillin(VAL,RBV,start,stop,steps) #fills in scanRecord linear mode + scan_fillin_table(VAL,RBV,my_table) #fills in scanRecord table mode + scan_go() #starts a scan + ------------------------------------------------------------- + scan_after_table_reset() #sets back to linear and clears positioners + ------------------------------------------------------------- + scan_positioners_clear() #clears the positioners + scan_positioner_after_set() #procs the after scan sequence + scan_positioner_settling_time_set() #sets the settling time + scan_triggers_set() #sets the scan triggers + scan_triggers_clear() #clears the triggers + scan_detectors_set() #adds a detector + ------------------------------------------------------------- + scan_empty() #scan with no positioners + scan_time(duration_min) #scan with positioner readback as time and detector settling as minutes + ------------------------------------------------------------- + mda_detector_dictionary() #reads,sets or updates default detector dictionary + mda_trigger_dictionaryy() #reads,sets or updates default trigger_dictionary + mda_before_scan_pv() #reads,sets before_scan_pv + mda_after_scan_pv() #reads,sets after_scan_pv + mda_snake_set() #reads,set snake_set function + + +## **Scienta** +base functions for taking spectra, called by electron_analyzer + +## **shutters** +main shutter and branch shutter functions + + shutter_check() #checks and then opens main and branch shutters + main_shutter_open() #checks status then opens if not open + main_shutter_close() #checks status then closes if not closed + main_shutter_status() #returns open=True/False + branch_shutter_open() #checks status then opens iex.BL.mda.branch shuttter if not open + branch_shutter_close() #checks status then closes iex.BL.mda.branch shuttter if not closed + branch_shutter_status() #returns open=True/False + +## **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(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 + + + +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** + + +## **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 -- GitLab