diff --git a/iexcode/instruments/BLEPS.py b/iexcode/instruments/BLEPS.py new file mode 100644 index 0000000000000000000000000000000000000000..6550969ef3a55c053195dc0bb9511009e6b6b444 --- /dev/null +++ b/iexcode/instruments/BLEPS.py @@ -0,0 +1,30 @@ +from epics import caget, caput +from time import sleep + +def BLEPS_pvs(): + """ + dictionary of BLEPS pvs + """ + pvs={ + 'trip_reset':'29id:BLEPS:TRP:RESET', + 'fault_reset':'29id:BLEPS:FLT:RESET', + 'trip_status':'29id:BLEPS:TRIPS:STS', + + } + return pvs + +def BLEPS_reset(): + """ + resets the beamline EPS faults and trips + """ + pvs = BLEPS_pvs() + caput(pvs['fault_reset'],'RESET');sleep(1) + caput(pvs['trip_reset'],'RESET');sleep(1) + caput(pvs['fault_reset'],'RESET');sleep(1) + caput(pvs['trip_reset'],'RESET');sleep(1) + +def BLEPS_fault_codes(): + """ + gets the faults codes from the BLEPS + """ + print('work in progress') \ No newline at end of file diff --git a/iexcode/instruments/IEX_cameras.py b/iexcode/instruments/IEX_cameras.py index ab9a4ed6d3388e917328c9920b0c3c620aacb1ba..afd876b29158a6070efc545bb2e0f9c632da2236 100644 --- a/iexcode/instruments/IEX_cameras.py +++ b/iexcode/instruments/IEX_cameras.py @@ -36,7 +36,7 @@ def _enable_endstation_cameras(unused_off=True): endstation=iex.BL.endstation_name #For new endstation modify here: - cam_dict={'ARPES':[0,1,2], + cam_dict={'ARPES':[2], 'kappa':[3,4,6], 'Octupole':[6] } # index of cam_list diff --git a/iexcode/instruments/Kappa.py b/iexcode/instruments/Kappa.py index 89ce1f5344dc8270275b4fb0a32ed47c51e712ce..8ff549fdfd55bf7eade4f0c4298b69e195ae88c4 100644 --- a/iexcode/instruments/Kappa.py +++ b/iexcode/instruments/Kappa.py @@ -98,24 +98,18 @@ def kappa_init(*userName,**kwargs): user_name = input('user name: ') folders_kappa(user_name,**kwargs) - #logging - if kwargs['set_folders']: - log_init('kappa',user_name,_kappa_log_dictionary,set_file=True) - else: - log_init('kappa',user_name,_kappa_log_dictionary,set_file=False) - - #MPA - global mpa + global MPA iex.mpa = MPA() + MPA=iex.mpa #global detectors global tth_pv,tthdet - det = Kappa_Detector(kappa_Motors) + tthdet = Kappa_Detector(kappa_Motors) tth_pv = _kappa_motor_dictionary()['tth'][3] - iex.tth = det + iex.tth = tthdet #global detectors global tey,d3,d4,mesh tey = SRS("29idMZ0:scaler1.S2", '29idd:A1') @@ -123,6 +117,15 @@ def kappa_init(*userName,**kwargs): d4 = SRS("29idMZ0:scaler1.S4", '29idd:A3') mesh = SRS("29idMZ0:scaler1.S14", '29idd:A4') + #logging (logging is dependent on global detectors) + if kwargs['set_folders']: + log_init('kappa',user_name,_kappa_log_dictionary,set_file=True) + else: + log_init('kappa',user_name,_kappa_log_dictionary,set_file=False) + + + + #default scan settings kappa_default_scan_settings() @@ -145,12 +148,12 @@ def kappa_init(*userName,**kwargs): 'd3':d3, 'd4':d4, 'mesh':mesh, - 'tthdet':det + 'tthdet':tthdet } #return any detectors or other parameters that you want access to from jupyter - return tey,d3,d4,mesh,tth_pv,det + return tey,d3,d4,mesh,tth_pv,tthdet ############################################################################################################## ############################## detectors and motors ############################## @@ -478,9 +481,9 @@ def _kappa_log_dictionary(): "kphi":(kappa_Motors.get('kphi'),".2f"), "TA":(caget(kappa_extra_pvs()['TA']),".2f"), "TB":(caget(kappa_extra_pvs()['TB']),".2f"), - "TEY":(tey.current,".2f"), - "mesh":(mesh.current,".2f"), - "det_name":(Kappa_Detector.get()[0],"s"), + "TEY":(tey.get(),".2f"), + "mesh":(mesh.get(),".2f"), + "det_name":(tthdet.get()[0],"s"), "mpa_HV":(MPA.HV_get(),".0f"), "m3r_centroid":(m3r_centroid()[0],".0f"), } @@ -1040,7 +1043,7 @@ def kappa_safe_state(**kwargs): if kwargs["mpa_off"]: try: - mpa.HV_off() + MPA.HV_off() except: print('MPA is not running') branch = 'd' diff --git a/iexcode/instruments/resolution.py b/iexcode/instruments/resolution.py index 0df58c2ce6fa0a0f380cbc7a4d64898be1910523..fb700e7859a08483a465fd8ec69cc7ec111ad002 100644 --- a/iexcode/instruments/resolution.py +++ b/iexcode/instruments/resolution.py @@ -16,18 +16,17 @@ from iexcode.instruments.scanRecord import * def resolution(): """ Calculate the theoretical resolution for the current beamline settings: - ARPES: total resolution i.e. sqrt(kbT^2 + analyzer^2 + BL^2); default SES slit = 5. - Kappa: beamline contribution only + ARPES: total resolution i.e. sqrt(kbT^2 + analyzer^2 + BL^2) + Kappa/Octupole: beamline contribution only """ grt = mono_grating_get() hv_eV = getE() slit_size = take_closest_value([10,20,50,100,200],round(slit_get()[0][0],0)) - #if iex.BL.endstation_name == "ARPES": - if BLconfig_endstation_name == 'ARPES': + if iex.BL.endstation_name == "ARPES": slit_SES = SES_slit_get() PE = int(EA.PassEnergy) - Tsample = caget(ARPES_extra_pvs['TA']) + Tsample = caget(ARPES_extra_pvs()['TA']) resolution_ARPES(grt,hv_eV,slit_size,PE,slit_SES,Tsample,verbose=True) print("Calculate: resolution_ARPES(grt,hv_eV,slit_size,PE,slit_SES,Tsample)") else: diff --git a/iexcode/macros/commissioning.py b/iexcode/macros/commissioning.py index 9b5a3dbb69f1f4213f6698735de7a06c4b653291..735af3802049fa19affc458f166b436f94f96ae6 100644 --- a/iexcode/macros/commissioning.py +++ b/iexcode/macros/commissioning.py @@ -537,7 +537,7 @@ def wire_scans(**kwargs): Note: Does not set the ID, mvID = 2.0 gives a nice gaussian """ kwargs.setdefault('sound',True) - kwargs.setdefault('ID_eV',None) + kwargs.setdefault('ID_eV',2000) if kwargs['ID_eV'] != None: mvID(kwargs['ID_eV']) diff --git a/iexcode/macros/start_of_the_week.py b/iexcode/macros/start_of_the_week.py index fe7d177cc1655b4a8e2e06d95fac9ebb901ae45e..7754774f4b98c1659c0a31e7487c4fbdb6522b9e 100644 --- a/iexcode/macros/start_of_the_week.py +++ b/iexcode/macros/start_of_the_week.py @@ -255,6 +255,10 @@ def sotw_wire(detH,detV,**kwargs): scanNum_v = last_mda() plot_mda(scanNum_h,detH,scanNum_v,detV,title='wire-H (blue) & wire-V (orange)') plt.show() + H_center=fit_mda(scanNum_h,detH,'gauss',plot=False) + V_center=fit_mda(scanNum_v,detV,'gauss',plot=False) + print('H-wire center = ',H_center) + print('V-wire center = ',V_center) except: print('Unable to plot. Try:') print("plot_mda("+str(scanNum_h)+","+str(detH)+","+str(scanNum_v)+","+str(detV)+",title='wire-H (blue) & wire-V (orange)');plt.show()") @@ -582,4 +586,30 @@ def sotw(grt,branch,wait=False,**kwargs): print("\nDon't forget to put back the user folder !!!!") - +def sotw_A(grt,branch,wait=False,**kwargs): + """ + does sotw for the A-hutch + i.e. scanType = ['slit1','wire'] + """ + kwargs.setdefault('scanType',['slit1','wire']) + sotw(grt,branch,wait=wait,**kwargs) + +def sotw_B(grt,branch,wait=False,**kwargs): + """ + does sotw for the monoVslits (M0/M1 steering and slit dictionary) + i.e. scanType = ['monoVslit'] + and repeat = True + """ + kwargs.setdefault('scanType',['monoVslit']) + kwargs.setdefault('repeat',True) + sotw(grt,branch,wait=wait,**kwargs) + +def sotw_C(grt,branch,wait=False,**kwargs): + """ + does sotw for the monoVslits + i.e. scanType = ['flux'] + and repeat = True + """ + kwargs.setdefault('scanType',['flux']) + kwargs.setdefault('repeat',True) + sotw(grt,branch,wait=wait,**kwargs) \ No newline at end of file