diff --git a/iexcode/instruments/ARPES.py b/iexcode/instruments/ARPES.py index e211556d1d8a5b06c4b3fdbb91e74e91172912d7..368b7f75f7767571f6dae2ab51cbdd2fdcaf481e 100644 --- a/iexcode/instruments/ARPES.py +++ b/iexcode/instruments/ARPES.py @@ -56,6 +56,16 @@ def ARPES_init(*userName,**kwargs): kwargs.setdefault('set_folders',False) kwargs.setdefault('reset',False) + + if len(userName) == 0: + saveData_get_all(kwargs['scan_ioc']) + user_name = mda_user_name() + else: + user_name = userName[0] + if user_name == 'staff': + user_name = 'Staff' + kwargs['mode'] = 'staff' + #motors physical_motors = ['x','y','z','th','chi','phi'] pseudo_motors = ['focus'] @@ -69,23 +79,16 @@ def ARPES_init(*userName,**kwargs): #setting folders if kwargs['set_folders']: - if BLconfig_mode() == 'staff': - user_name = 'Staff' - else: - if len(userName)==0: - user_name = input('user name: ') - else: - user_name = userName[0] - print(user_name) + if len(userName)==0: + user_name = input('user name: ') folders_ARPES(user_name,**kwargs) - - else: - user_name = mda_user_name() + #logging - log_init('ARPES',user_name,_ARPES_log_dictionary,set_file=False) if kwargs['set_folders']: - log_name_set() + log_init('ARPES',user_name,_ARPES_log_dictionary,set_file=True) + else: + log_init('ARPES',user_name,_ARPES_log_dictionary,set_file=False) #EA if EA.connected: @@ -468,7 +471,7 @@ def _ARPES_detector_triggers_sequence(**kwargs): ca_list = _ARPES_ca_list() last = len(ca_list) for i,ca in enumerate(ca_list): - ca_pv = _Keithley_pv(ca[0], ca[1])+':read.PROC PP NMS' + ca_pv = _Keithley_pv(ca[0], ca[1])+'read.PROC PP NMS' caput(detector_triggers_pv+".LNK" +str(i+1),ca_pv) caput(detector_triggers_pv+".WAIT"+str(i+1),"After"+str(last)) diff --git a/iexcode/instruments/IEX_BL_config.py b/iexcode/instruments/IEX_BL_config.py index 7a6b8b9aeaed95a1802b972d60a20dd610fd3d61..24012e9f3c525a9a10472488cc6f22bf8ed8ee24 100644 --- a/iexcode/instruments/IEX_BL_config.py +++ b/iexcode/instruments/IEX_BL_config.py @@ -166,6 +166,14 @@ class Beamline_Config: #overwrite folder for staff mode self.folder = 'b' self.prefix = endstation_name+"_" + if endstation_name == 'ARPES': + self.branch = 'c' + elif endstation_name == 'Kappa': + self.branch = 'd' + elif endstation_name == 'Octupole': + self.branch = 'd' + else: + print('folder and prefix not set') else: message = 'Not a valid BL_mode choice\n' message += 'BL_modes: '+BL_mode_list diff --git a/iexcode/instruments/IEX_VPU.py b/iexcode/instruments/IEX_VPU.py index 142091ad9abdc02a477006e3382c4a00e78c74c0..408ce168ca954f47f22b53970d5871fe1eab261b 100644 --- a/iexcode/instruments/IEX_VPU.py +++ b/iexcode/instruments/IEX_VPU.py @@ -246,6 +246,8 @@ def ID_start(ID_mode='RCP',QP_ratio=None, verbose=True): """ #turns on if ID is off if ID_power_status =='Off': + pv_sp = ID_pvs()['energy_sp'] + caput(pv_sp,3.8) ID_on() #set QP if ID_ready(): @@ -271,6 +273,10 @@ def ID_switch_mode(ID_mode): """ ID_wait_for_permission(verbose=False) shutter_check(verbose=False) + + if ID_power_status() == 'Off': + ID_start(ID_mode) + ID_state = ID_state_get() if ID_state_mode(ID_mode) != ID_state: @@ -282,7 +288,7 @@ def ID_switch_mode(ID_mode): ID_on(verbose=True) ID_mode_set(ID_mode) ID_ready() - + if ID_mode_get() != ID_mode: print_warning_message("ID mode switch had an error, please try again") else: diff --git a/iexcode/instruments/electron_analyzer.py b/iexcode/instruments/electron_analyzer.py index b2bf306f5a6a49888cfa60d0f784732f897f7af9..9ab0204afd27c977a890a22f770c5f789d8f927e 100644 --- a/iexcode/instruments/electron_analyzer.py +++ b/iexcode/instruments/electron_analyzer.py @@ -319,7 +319,7 @@ def _BE2KE_setupCalc(BE,DESC,CalcOutNum,OutputPV): caput(pvCalcOut+"Enable","D") else: caput(pvCalcOut+"Enable","E") - sleep(.1) + time.sleep(.1) caput(pvCalcOut+".DESC", DESC) caput(pvCalcOut+".A",BE) caput(pvCalcOut+".INPB","29idmono:ENERGY_MON PP NMS") diff --git a/iexcode/instruments/scanRecord.py b/iexcode/instruments/scanRecord.py index 4b168794b06300d745daa51a38e41f0f71151954..f889c887cce747b33b3a4cfe9abc7ab8796f5bd1 100644 --- a/iexcode/instruments/scanRecord.py +++ b/iexcode/instruments/scanRecord.py @@ -454,23 +454,23 @@ class ScanRecord: kwargs.setdefault('scan_dim',1) #positioners - self.positioners_clear(**kwargs) - self.positioner_settling_time_set(**kwargs) - self.positioner_after_scan_set(**kwargs) - self.positioner_absolute_mode_set(**kwargs) + self.positioners_clear(**kwargs);sleep(.1) + self.positioner_settling_time_set(**kwargs);sleep(.1) + self.positioner_after_scan_set(**kwargs);sleep(.1) + self.positioner_absolute_mode_set(**kwargs);sleep(.1) #detectors - self.detectors_clear(**kwargs) - self.detectors_set(**kwargs) + self.detectors_clear(**kwargs);sleep(.1) + self.detectors_set(**kwargs);sleep(.1) #detector settling time - self.detector_settling_time_set(**kwargs) + self.detector_settling_time_set(**kwargs);sleep(.1) #detector triggers - self.triggers_clear(**kwargs) - self.triggers_set(**kwargs) + self.triggers_clear(**kwargs);sleep(.1) + self.triggers_set(**kwargs);sleep(.1) - self.before_scan_set(**kwargs) - self.after_scan_set(**kwargs) + self.before_scan_set(**kwargs);sleep(.1) + self.after_scan_set(**kwargs);sleep(.1) def reset_all(self): """ @@ -661,7 +661,7 @@ class ScanRecord: default => {} if scan_dim > 1 (i.e. does nothing) """ kwargs.setdefault('scan_dim',1) - kwargs.setdefault('detector_dictionary',{}) + kwargs.setdefault('detector_dictionary',self.detector_dictionary) if kwargs['scan_dim'] == 1: kwargs.setdefault('detector_dictionary',self.detector_dictionary) @@ -984,12 +984,13 @@ class ScanRecord: except: print_warning_message('no shutter check') - try: - self.snake_set(kwargs['snake']) - except: - error = 'snake scanning not configured for this BL_config' - if verbose: - print(error) + if kwargs['snake']: + try: + self.snake_set(kwargs['snake']) + except: + error = 'snake scanning not configured for this BL_config' + if verbose: + print(error) if self.check(scan_dim): filename = self.prefix() diff --git a/iexcode/instruments/shutters.py b/iexcode/instruments/shutters.py index 7af1dd99727b2c34e7acde3f1f45d6d802a6049e..0ff07dfb5b28a3986b166e2c8b8c15c1931ddd44 100644 --- a/iexcode/instruments/shutters.py +++ b/iexcode/instruments/shutters.py @@ -84,8 +84,9 @@ def branch_shutter_status(branch=None,verbose=False): """ if branch == None: branch = iex.BL.branch - pvA = "PA:29ID:S"+branch.upper()+"S_BLOCKING_BEAM.VAL" - pvB = "PB:29ID:S"+branch.upper()+"S_BLOCKING_BEAM.VAL" + branch = branch.upper() + pvA = "PA:29ID:S"+branch+"S_BLOCKING_BEAM.VAL" + pvB = "PB:29ID:S"+branch+"S_BLOCKING_BEAM.VAL" #"ON" = 1 => shutter blocking status=caget(pvA)+caget(pvB) if status == 0: diff --git a/iexcode/macros/quick_plot.py b/iexcode/macros/quick_plot.py index f48fff1f7b227804d45b852e8d229717e1c247bb..d1de5af18b81a094f8b3d3bedddcaeb12b2b5853 100755 --- a/iexcode/macros/quick_plot.py +++ b/iexcode/macros/quick_plot.py @@ -134,7 +134,7 @@ def mda_unpack(ScanNum,filepath=None,prefix=None): except: print('Please specify filepath and prefix, BL is not defined') - mdaFile=filepath + prefix+'{:04}.mda'.format(ScanNum) + mdaFile=join(filepath,prefix+'{:04}.mda'.format(ScanNum)) data_file = readMDA(mdaFile) try: D={} diff --git a/iexcode/macros/start_of_the_week.py b/iexcode/macros/start_of_the_week.py index d16f4a22d38dce8a801328f5417b6517df3de3ef..ec6907831c5fd48005ee64aa79a266dfb2f51e1d 100644 --- a/iexcode/macros/start_of_the_week.py +++ b/iexcode/macros/start_of_the_week.py @@ -92,10 +92,8 @@ def interactive_fit_mda(val_name,scannum,det,FWHM_or_PolyOrder,fct,**kwargs): """ **kwargs xrange - val_name, name for printing """ kwargs.setdefault('xrange',None) - kwargs.setdefault('val_name','') fit_mda(scannum,det,FWHM_or_PolyOrder,fct,**kwargs) foo=input('\nare you happy with those values (y or n)? >') @@ -184,7 +182,7 @@ def StartOfTheWeek(grt,branch,wait=False,**kwargs): if kwargs['repeat']: #check to see if init is defined if BLconfig_branch() != branch: - BL_init('staff',reset=True,set_folders=True,xrays=True) + BL_init('staff',reset=True,set_folders=False,xrays=True) else: BL_init('staff',reset=True,set_folders=True,xrays=True) switch_branch(branch)