Skip to content
Snippets Groups Projects
Commit fabe124e authored by 29iduser's avatar 29iduser
Browse files

jm-debug

parent bd6fa2b5
No related branches found
No related tags found
No related merge requests found
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
...@@ -36,7 +36,7 @@ def _enable_endstation_cameras(unused_off=True): ...@@ -36,7 +36,7 @@ def _enable_endstation_cameras(unused_off=True):
endstation=iex.BL.endstation_name endstation=iex.BL.endstation_name
#For new endstation modify here: #For new endstation modify here:
cam_dict={'ARPES':[0,1,2], cam_dict={'ARPES':[2],
'kappa':[3,4,6], 'kappa':[3,4,6],
'Octupole':[6] 'Octupole':[6]
} # index of cam_list } # index of cam_list
......
...@@ -98,24 +98,18 @@ def kappa_init(*userName,**kwargs): ...@@ -98,24 +98,18 @@ def kappa_init(*userName,**kwargs):
user_name = input('user name: ') user_name = input('user name: ')
folders_kappa(user_name,**kwargs) 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 #MPA
global mpa global MPA
iex.mpa = MPA() iex.mpa = MPA()
MPA=iex.mpa
#global detectors #global detectors
global tth_pv,tthdet global tth_pv,tthdet
det = Kappa_Detector(kappa_Motors) tthdet = Kappa_Detector(kappa_Motors)
tth_pv = _kappa_motor_dictionary()['tth'][3] tth_pv = _kappa_motor_dictionary()['tth'][3]
iex.tth = det iex.tth = tthdet
#global detectors #global detectors
global tey,d3,d4,mesh global tey,d3,d4,mesh
tey = SRS("29idMZ0:scaler1.S2", '29idd:A1') tey = SRS("29idMZ0:scaler1.S2", '29idd:A1')
...@@ -123,6 +117,15 @@ def kappa_init(*userName,**kwargs): ...@@ -123,6 +117,15 @@ def kappa_init(*userName,**kwargs):
d4 = SRS("29idMZ0:scaler1.S4", '29idd:A3') d4 = SRS("29idMZ0:scaler1.S4", '29idd:A3')
mesh = SRS("29idMZ0:scaler1.S14", '29idd:A4') 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 #default scan settings
kappa_default_scan_settings() kappa_default_scan_settings()
...@@ -145,12 +148,12 @@ def kappa_init(*userName,**kwargs): ...@@ -145,12 +148,12 @@ def kappa_init(*userName,**kwargs):
'd3':d3, 'd3':d3,
'd4':d4, 'd4':d4,
'mesh':mesh, 'mesh':mesh,
'tthdet':det 'tthdet':tthdet
} }
#return any detectors or other parameters that you want access to from jupyter #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 ############################## ############################## detectors and motors ##############################
...@@ -478,9 +481,9 @@ def _kappa_log_dictionary(): ...@@ -478,9 +481,9 @@ def _kappa_log_dictionary():
"kphi":(kappa_Motors.get('kphi'),".2f"), "kphi":(kappa_Motors.get('kphi'),".2f"),
"TA":(caget(kappa_extra_pvs()['TA']),".2f"), "TA":(caget(kappa_extra_pvs()['TA']),".2f"),
"TB":(caget(kappa_extra_pvs()['TB']),".2f"), "TB":(caget(kappa_extra_pvs()['TB']),".2f"),
"TEY":(tey.current,".2f"), "TEY":(tey.get(),".2f"),
"mesh":(mesh.current,".2f"), "mesh":(mesh.get(),".2f"),
"det_name":(Kappa_Detector.get()[0],"s"), "det_name":(tthdet.get()[0],"s"),
"mpa_HV":(MPA.HV_get(),".0f"), "mpa_HV":(MPA.HV_get(),".0f"),
"m3r_centroid":(m3r_centroid()[0],".0f"), "m3r_centroid":(m3r_centroid()[0],".0f"),
} }
...@@ -1040,7 +1043,7 @@ def kappa_safe_state(**kwargs): ...@@ -1040,7 +1043,7 @@ def kappa_safe_state(**kwargs):
if kwargs["mpa_off"]: if kwargs["mpa_off"]:
try: try:
mpa.HV_off() MPA.HV_off()
except: except:
print('MPA is not running') print('MPA is not running')
branch = 'd' branch = 'd'
......
...@@ -16,18 +16,17 @@ from iexcode.instruments.scanRecord import * ...@@ -16,18 +16,17 @@ from iexcode.instruments.scanRecord import *
def resolution(): def resolution():
""" """
Calculate the theoretical resolution for the current beamline settings: 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. ARPES: total resolution i.e. sqrt(kbT^2 + analyzer^2 + BL^2)
Kappa: beamline contribution only Kappa/Octupole: beamline contribution only
""" """
grt = mono_grating_get() grt = mono_grating_get()
hv_eV = getE() hv_eV = getE()
slit_size = take_closest_value([10,20,50,100,200],round(slit_get()[0][0],0)) slit_size = take_closest_value([10,20,50,100,200],round(slit_get()[0][0],0))
#if iex.BL.endstation_name == "ARPES": if iex.BL.endstation_name == "ARPES":
if BLconfig_endstation_name == 'ARPES':
slit_SES = SES_slit_get() slit_SES = SES_slit_get()
PE = int(EA.PassEnergy) 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) 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)") print("Calculate: resolution_ARPES(grt,hv_eV,slit_size,PE,slit_SES,Tsample)")
else: else:
......
...@@ -537,7 +537,7 @@ def wire_scans(**kwargs): ...@@ -537,7 +537,7 @@ def wire_scans(**kwargs):
Note: Does not set the ID, mvID = 2.0 gives a nice gaussian Note: Does not set the ID, mvID = 2.0 gives a nice gaussian
""" """
kwargs.setdefault('sound',True) kwargs.setdefault('sound',True)
kwargs.setdefault('ID_eV',None) kwargs.setdefault('ID_eV',2000)
if kwargs['ID_eV'] != None: if kwargs['ID_eV'] != None:
mvID(kwargs['ID_eV']) mvID(kwargs['ID_eV'])
......
...@@ -255,6 +255,10 @@ def sotw_wire(detH,detV,**kwargs): ...@@ -255,6 +255,10 @@ def sotw_wire(detH,detV,**kwargs):
scanNum_v = last_mda() scanNum_v = last_mda()
plot_mda(scanNum_h,detH,scanNum_v,detV,title='wire-H (blue) & wire-V (orange)') plot_mda(scanNum_h,detH,scanNum_v,detV,title='wire-H (blue) & wire-V (orange)')
plt.show() 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: except:
print('Unable to plot. Try:') 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()") 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): ...@@ -582,4 +586,30 @@ def sotw(grt,branch,wait=False,**kwargs):
print("\nDon't forget to put back the user folder !!!!") 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment