diff --git a/build/lib/iexcode/instruments/Motors.py b/build/lib/iexcode/instruments/Motors.py index 8193e565b2015f9db2e95c29e43ee069a109f8cb..01bc8f305dc74ed10ae9d4cb6afb39ef3ab4fcdb 100644 --- a/build/lib/iexcode/instruments/Motors.py +++ b/build/lib/iexcode/instruments/Motors.py @@ -117,8 +117,7 @@ class Motors: """ position_list = [name] for motor in self.physical_motors: - position_list.append(self.get(motor,verbose=False)) - + position_list.append(self.get(motor)) return position_list def mvsample(self,position_list,verbose=True): @@ -427,11 +426,14 @@ def dscanphi(start,stop,step): ######## mprint and mvsample ################### -def mprint(): +def mprint(name=''): """ prints current position of the physical motors """ - iex.BL.motors.mprint() + vals = iex.BL.motors.mprint(name) + print(vals) + + return vals def mvsample(position_list): """ diff --git a/build/lib/iexcode/instruments/current_amplifiers.py b/build/lib/iexcode/instruments/current_amplifiers.py index cb6a1b778a92facd0dbcb22c3a4e22fcc3cca7fe..c9374e5c1eabd29f87b0bedc128c0f370cec6352 100644 --- a/build/lib/iexcode/instruments/current_amplifiers.py +++ b/build/lib/iexcode/instruments/current_amplifiers.py @@ -332,42 +332,44 @@ class SRS: self._scaler_pv = scaler_pv self._srs_pv = srs_pv - self.scaler_value - self.gain - self.current_Amp - self.current_unit - self.invert - self.baseline - self.offset_value - self.offset_unit - self.offset_sign - self.offset_factor + self.scaler_value = None + self.gain = None + self.current_Amp = None + self.current_unit = None + self.invert = None + self.baseline = None + self.offset_value = None + self.offset_unit = None + self.offset_sign = None + self.offset_factor = None self.get(verbose=False) - def get(self): + def get(self,extended=False,verbose=False): """ reads the current SRS and corresponding scaler values """ self.scaler_value = caget(self._scaler_pv) - self.gain = float(caget(self._scaler_pv+'sens_num.VAL',as_string=True)) - self.current_unit = caget(self._scaler_pv+'sens_unit.VAL',as_string=True) - self.invert = caget(self._scaler_pv+'invert_on.VAL',as_string=True) + self.gain = caget(self._srs_pv+'sens_num.VAL',as_string=True) + self.current_unit = caget(self._srs_pv+'sens_unit.VAL',as_string=True) + self.invert = caget(self._srs_pv+'invert_on.VAL',as_string=True) unit_sciNote = {'pA':1e-12, 'nA':1e-9, 'uA':1e-6, 'mA':1e-3} - self.current_Amp = self.scaler_value * self.gain * unit_sciNote[self.current_unit] + #self.current_Amp = self.scaler_value * self.gain * unit_sciNote[self.current_unit] - self.offset_value=caget(self._scaler_pv+"offset_num.VAL",as_string=True) - self.offset_unit=caget(self._scaler_pv+"offset_unit.VAL",as_string=True) - self.offset_sign=caget(self._scaler_pv+"offset_sign.VAL",as_string=True) - self.offset_factor=caget(self._scaler_pv+"off_u_put.VAL",as_string=True) - self.baseline = self.offset_factor * self.offset_value * unit_sciNote[self.offset_unit] + self.offset_value=caget(self._srs_pv+"offset_num.VAL",as_string=True) + self.offset_unit=caget(self._srs_pv+"offset_unit.VAL",as_string=True) + self.offset_sign=caget(self._srs_pv+"offset_sign.VAL",as_string=True) + self.offset_factor=caget(self._srs_pv+"off_u_put.VAL",as_string=True) + #self.baseline = self.offset_factor * self.offset_value * unit_sciNote[self.offset_unit] - self.filter_type=caget(self._scaler_pv+'filter_type.VAL',as_string=True) - self.filter_low=caget(self._scaler_pv+'low_freq.VAL',as_string=True) - self.filter_high=caget(self._scaler_pv+'high_freq.VAL',as_string=True) - self.blank=caget(self._scaler_pv+'blank_on.VAL',as_string=True) - self.bias_OnOff=caget(self._scaler_pv+'bias_on.VAL',as_string=True) - self.bias_value=caget(self._scaler_pv+'bias_put.VAL',as_string=True) - + self.filter_type=caget(self._srs_pv+'filter_type.VAL',as_string=True) + self.filter_low=caget(self._srs_pv+'low_freq.VAL',as_string=True) + self.filter_high=caget(self._srs_pv+'high_freq.VAL',as_string=True) + self.blank=caget(self._srs_pv+'blank_on.VAL',as_string=True) + self.bias_OnOff=caget(self._srs_pv+'bias_on.VAL',as_string=True) + self.bias_value=caget(self._srs_pv+'bias_put.VAL',as_string=True) + + if verbose: + self.srs_print_all(extended) def setgain(self,gain,unit): """ @@ -378,21 +380,19 @@ class SRS: caput(self._srs_pv+'sens_unit.VAL',str(unit)) - def srs_print_all(self, long=False): + def srs_print_all(self, extended=False): """ prints SRS setting """ - self.get() - - print('Gain: '+self.scaler_value+' '+self.current_unit+' (invert '+self.invert+')') - print('Baseline: '+self.offset_sign+' '+self.offset_factor+' x '+self.offset_value+" "+self.offset_unit) - if long: - filterType = self.filter_type - filterLow = self.filter_low - filterHigh = self.filter_high - blank = self.blank - biasOnOff = self.bias_OnOff - biasValue = self.bias_value + print('Gain: '+str(self.scaler_value)+' '+str(self.current_unit)+' (invert '+str(self.invert)+')') + print('Baseline: '+str(self.offset_sign)+' '+str(self.offset_factor)+' x '+str(self.offset_value)+" "+str(self.offset_unit)) + if extended: + filterType = str(self.filter_type) + filterLow = str(self.filter_low) + filterHigh = str(self.filter_high) + blank = str(self.blank) + biasOnOff = str(self.bias_OnOff) + biasValue = str(self.bias_value) print('Filter: '+filterType+' - Low/High: '+filterLow+' -'+filterHigh) print('Bias: '+biasOnOff+'- '+biasValue) print('Blank: '+blank) diff --git a/build/lib/iexcode/instruments/scalers.py b/build/lib/iexcode/instruments/scalers.py index 2c17c476b4b9dc444cacf4f67bba08e231b0580c..df39f3910ee1aacd5680b1491f32152a673ae1da 100644 --- a/build/lib/iexcode/instruments/scalers.py +++ b/build/lib/iexcode/instruments/scalers.py @@ -47,7 +47,7 @@ def Octupole_scaler(time_seconds,verbose): class Scaler: - def __inti__(self, pv): + def __init__(self, pv): """ to access scaler pvs usage: diff --git a/build/lib/iexcode/instruments/shutters.py b/build/lib/iexcode/instruments/shutters.py index 8279908e4238c86e583d37f4efc55646a6bdc78d..e30e9f6ad338a8ab4bdc0181f25c515919588d15 100644 --- a/build/lib/iexcode/instruments/shutters.py +++ b/build/lib/iexcode/instruments/shutters.py @@ -82,8 +82,8 @@ def branch_shutter_status(branch=None,verbose=False): """ if branch == None: branch = iex.BL.branch - pvA="PA:29ID:S"+branch+"S_BLOCKING_BEAM.VAL" - pvB="PB:29ID:S"+branch+"S_BLOCKING_BEAM.VAL" + pvA="PA:29ID:S"+branch.upper()+"S_BLOCKING_BEAM.VAL" + pvB="PB:29ID:S"+branch.upper()+"S_BLOCKING_BEAM.VAL" #"ON" = 1 => shutter open status=caget(pvA)+caget(pvB) if status == 2: @@ -104,8 +104,8 @@ def branch_shutter_close(branch=None,verbose=False): """ if branch == None: branch = iex.BL.branch - caput("PC:29ID:S"+branch+"S_CLOSE_REQUEST.VAL",1,wait=True,timeout=18000) - print("Closing "+branch+"-Shutter...") + caput("PC:29ID:S"+branch.upper()+"S_CLOSE_REQUEST.VAL",1,wait=True,timeout=18000) + print("Closing "+branch.upper()+"-Shutter...") def branch_shutter_open(branch=None,verbose=False): @@ -121,6 +121,6 @@ def branch_shutter_open(branch=None,verbose=False): if shutter_status: print(branch+"-Shutter already open...") else: - caput("PC:29ID:S"+branch+"S_OPEN_REQUEST.VAL",1,wait=True,timeout=18000) - print("Opening "+branch+"-Shutter...") + caput("PC:29ID:S"+branch.upper()+"S_OPEN_REQUEST.VAL",1,wait=True,timeout=18000) + print("Opening "+branch.upper()+"-Shutter...") diff --git a/build/lib/iexcode/instruments/xrays.py b/build/lib/iexcode/instruments/xrays.py index b1052348293ac2eca78e74bdad33da75c1524f4b..5aa6707c149a9e611f5ed9d5aa530a8ca96222c9 100644 --- a/build/lib/iexcode/instruments/xrays.py +++ b/build/lib/iexcode/instruments/xrays.py @@ -9,7 +9,7 @@ from time import sleep from epics import caget,caput import iexcode.instruments.cfg as iex -from iexcode.instruments.cameras import _enable_endstation_cameras +from iexcode.instruments.IEX_cameras import _enable_endstation_cameras from iexcode.instruments.current_amplifiers import ca_average, ca_detector_list from iexcode.instruments.diagnostics import * from iexcode.instruments.FMB_mirrors import FMB_mirror_get @@ -639,7 +639,7 @@ def slit_get(verbose=True): if verbose: message = iex.BL.branch+' exit slit: '+str(slit_size) - message += ", @ "+str(slit_center) if iex.BL.branch is not 'c' else '' + message += ", @ "+str(slit_center) print(message) return slit_size,slit_center diff --git a/iexcode/instruments/Motors.py b/iexcode/instruments/Motors.py index 8193e565b2015f9db2e95c29e43ee069a109f8cb..01bc8f305dc74ed10ae9d4cb6afb39ef3ab4fcdb 100644 --- a/iexcode/instruments/Motors.py +++ b/iexcode/instruments/Motors.py @@ -117,8 +117,7 @@ class Motors: """ position_list = [name] for motor in self.physical_motors: - position_list.append(self.get(motor,verbose=False)) - + position_list.append(self.get(motor)) return position_list def mvsample(self,position_list,verbose=True): @@ -427,11 +426,14 @@ def dscanphi(start,stop,step): ######## mprint and mvsample ################### -def mprint(): +def mprint(name=''): """ prints current position of the physical motors """ - iex.BL.motors.mprint() + vals = iex.BL.motors.mprint(name) + print(vals) + + return vals def mvsample(position_list): """ diff --git a/iexcode/instruments/Octupole.py b/iexcode/instruments/Octupole.py index 2f7af76bfa4382a8d1c462ea097be1d240150366..8bae7e610d9ebe0261918a919840bf39becf9288 100644 --- a/iexcode/instruments/Octupole.py +++ b/iexcode/instruments/Octupole.py @@ -5,7 +5,7 @@ from math import floor from epics import caget, caput,PV import iexcode.instruments.cfg as iex -from iexcode.instruments.IEX_endstations import Endstation +from iexcode.instruments.IEX_BL_config import Beamline_Config from iexcode.instruments.IEX_cameras import _enable_endstation_cameras @@ -19,7 +19,7 @@ from iexcode.instruments.utilities import * from iexcode.instruments.userCalcs import userStringSeq_clear, userStringSeq_pvs from iexcode.instruments.Motors import Motors -from iexcode.instruments.current_amplifiers import Keithley, _Keithley_pv, ca_reset_all, _ca_live_sequence +from iexcode.instruments.current_amplifiers import * from iexcode.instruments.valves import branch_valve_close from iexcode.instruments.shutters import branch_shutter_close @@ -28,7 +28,7 @@ from iexcode.instruments.shutters import branch_shutter_close from iexcode.instruments.slits import slit3D_get #endstation specific -from iexcode.instruments.scalers import scaler_cts +from iexcode.instruments.scalers import scaler_cts,Scaler from iexcode.instruments.spec_stuff import folders_spec default_ioc = '29ide:' @@ -61,7 +61,7 @@ def Octupole_init(*userName,**kwargs): Octupole_Motors = Motors('Octupole',_Octupole_motor_dictionary(),physical_motors,pseudo_motors) #endstation - iex.BL = Endstation('Octupole',kwargs['scan_ioc'],kwargs['xrays'],kwargs['mode'],Octupole_Motors) + iex.BL = Beamline_Config('Octupole',kwargs['scan_ioc'],kwargs['xrays'],kwargs['mode'],Octupole_Motors) #setting folders if kwargs['set_folders']: @@ -80,12 +80,12 @@ def Octupole_init(*userName,**kwargs): #global detectors mesh = SRS("29ide:scaler1.S2", '29idd:A4') - diag = SRS("29ide:scaler1.S6", '29ide:SR570_1') - kbh = SRS("29ide:scaler1.S7", '29ide:SR570_2') - kbv = SRS("29ide:scaler1.S8", '29ide:SR570_3') - tey = SRS("29ide:scaler1.S3", '29ide:SR570_4') + diag = SRS("29ide:scaler1.S6", '29ide:SR570_1:') + kbh = SRS("29ide:scaler1.S7", '29ide:SR570_2:') + kbv = SRS("29ide:scaler1.S8", '29ide:SR570_3:') + tey = SRS("29ide:scaler1.S3", '29ide:SR570_4:') tfy = Scaler("29ide:scaler1.S4") - pd = SRS("29idMZ0:scaler1.S5", '29ide:SR570_5') + pd = SRS("29idMZ0:scaler1.S5", '29ide:SR570_5:') Octupole_scaler_pv = '29ide:scaler1.CNT' #resetting everything @@ -166,11 +166,11 @@ def _Octupole_detector_dictionary(**kwargs): return det_dict -def _Octupole_motor_dictionary(name): +def _Octupole_motor_dictionary(): """ motor_dictionary = {name:[rbv,val,spmg,pv]} for physical and psuedo/Euler motors usage: - KappaS_PVmotor('x') => ['29idKappa:m2.RBV', '29idKappa:m2.VAL', '29idKapp:m2.SPMG','29idKappa:m2'] + Octupole_PVmotor('x') => ['29idKappa:m2.RBV', '29idKappa:m2.VAL', '29idKapp:m2.SPMG','29idKappa:m2'] """ motor_nums={ 'x':11, @@ -182,7 +182,7 @@ def _Octupole_motor_dictionary(name): motor_dictionary = {} for name in motor_nums.keys(): pv = '29ide:m'+str(motor_nums[name]) - motor_dictionary.update({name:[pv+'.VAL',pv+'.SPMG',pv]}) + motor_dictionary.update({name:[pv+'.RBV',pv+'.VAL',pv+'.SPMG',pv]}) return motor_dictionary @@ -271,7 +271,7 @@ def Octupole_reset(): ############################################################################################################## def Octupole_get_all(verbose=True): """ - returns a dictionary with the current status of the Kappa endstation and exit slit + returns a dictionary with the current status of the Octupole endstation and exit slit """ vals = {} @@ -320,7 +320,7 @@ def _Octupole_log_entries(): Previously: scanlog """ - vals = Kappa_get_all(verbose=False) + vals = Octupole_get_all(verbose=False) x = vals['x'] y = vals['y'] z = vals['z'] @@ -415,7 +415,7 @@ def _Octupole_scan_after_sequence(scan_ioc,scan_dim,**kwargs): if kwargs['snake']: snake_dim = scan_dim - 1 - #snake_proc= Kappa_snake_pv(snake_dim,enable=True) + #snake_proc= Octupole_snake_pv(snake_dim,enable=True) #caput(after_scan_pv+".LNK10",Kappa_snake_pv()+"PP NMS") #caput(after_scan_pv+".D10",1) diff --git a/iexcode/instruments/current_amplifiers.py b/iexcode/instruments/current_amplifiers.py index cb6a1b778a92facd0dbcb22c3a4e22fcc3cca7fe..c9374e5c1eabd29f87b0bedc128c0f370cec6352 100644 --- a/iexcode/instruments/current_amplifiers.py +++ b/iexcode/instruments/current_amplifiers.py @@ -332,42 +332,44 @@ class SRS: self._scaler_pv = scaler_pv self._srs_pv = srs_pv - self.scaler_value - self.gain - self.current_Amp - self.current_unit - self.invert - self.baseline - self.offset_value - self.offset_unit - self.offset_sign - self.offset_factor + self.scaler_value = None + self.gain = None + self.current_Amp = None + self.current_unit = None + self.invert = None + self.baseline = None + self.offset_value = None + self.offset_unit = None + self.offset_sign = None + self.offset_factor = None self.get(verbose=False) - def get(self): + def get(self,extended=False,verbose=False): """ reads the current SRS and corresponding scaler values """ self.scaler_value = caget(self._scaler_pv) - self.gain = float(caget(self._scaler_pv+'sens_num.VAL',as_string=True)) - self.current_unit = caget(self._scaler_pv+'sens_unit.VAL',as_string=True) - self.invert = caget(self._scaler_pv+'invert_on.VAL',as_string=True) + self.gain = caget(self._srs_pv+'sens_num.VAL',as_string=True) + self.current_unit = caget(self._srs_pv+'sens_unit.VAL',as_string=True) + self.invert = caget(self._srs_pv+'invert_on.VAL',as_string=True) unit_sciNote = {'pA':1e-12, 'nA':1e-9, 'uA':1e-6, 'mA':1e-3} - self.current_Amp = self.scaler_value * self.gain * unit_sciNote[self.current_unit] + #self.current_Amp = self.scaler_value * self.gain * unit_sciNote[self.current_unit] - self.offset_value=caget(self._scaler_pv+"offset_num.VAL",as_string=True) - self.offset_unit=caget(self._scaler_pv+"offset_unit.VAL",as_string=True) - self.offset_sign=caget(self._scaler_pv+"offset_sign.VAL",as_string=True) - self.offset_factor=caget(self._scaler_pv+"off_u_put.VAL",as_string=True) - self.baseline = self.offset_factor * self.offset_value * unit_sciNote[self.offset_unit] + self.offset_value=caget(self._srs_pv+"offset_num.VAL",as_string=True) + self.offset_unit=caget(self._srs_pv+"offset_unit.VAL",as_string=True) + self.offset_sign=caget(self._srs_pv+"offset_sign.VAL",as_string=True) + self.offset_factor=caget(self._srs_pv+"off_u_put.VAL",as_string=True) + #self.baseline = self.offset_factor * self.offset_value * unit_sciNote[self.offset_unit] - self.filter_type=caget(self._scaler_pv+'filter_type.VAL',as_string=True) - self.filter_low=caget(self._scaler_pv+'low_freq.VAL',as_string=True) - self.filter_high=caget(self._scaler_pv+'high_freq.VAL',as_string=True) - self.blank=caget(self._scaler_pv+'blank_on.VAL',as_string=True) - self.bias_OnOff=caget(self._scaler_pv+'bias_on.VAL',as_string=True) - self.bias_value=caget(self._scaler_pv+'bias_put.VAL',as_string=True) - + self.filter_type=caget(self._srs_pv+'filter_type.VAL',as_string=True) + self.filter_low=caget(self._srs_pv+'low_freq.VAL',as_string=True) + self.filter_high=caget(self._srs_pv+'high_freq.VAL',as_string=True) + self.blank=caget(self._srs_pv+'blank_on.VAL',as_string=True) + self.bias_OnOff=caget(self._srs_pv+'bias_on.VAL',as_string=True) + self.bias_value=caget(self._srs_pv+'bias_put.VAL',as_string=True) + + if verbose: + self.srs_print_all(extended) def setgain(self,gain,unit): """ @@ -378,21 +380,19 @@ class SRS: caput(self._srs_pv+'sens_unit.VAL',str(unit)) - def srs_print_all(self, long=False): + def srs_print_all(self, extended=False): """ prints SRS setting """ - self.get() - - print('Gain: '+self.scaler_value+' '+self.current_unit+' (invert '+self.invert+')') - print('Baseline: '+self.offset_sign+' '+self.offset_factor+' x '+self.offset_value+" "+self.offset_unit) - if long: - filterType = self.filter_type - filterLow = self.filter_low - filterHigh = self.filter_high - blank = self.blank - biasOnOff = self.bias_OnOff - biasValue = self.bias_value + print('Gain: '+str(self.scaler_value)+' '+str(self.current_unit)+' (invert '+str(self.invert)+')') + print('Baseline: '+str(self.offset_sign)+' '+str(self.offset_factor)+' x '+str(self.offset_value)+" "+str(self.offset_unit)) + if extended: + filterType = str(self.filter_type) + filterLow = str(self.filter_low) + filterHigh = str(self.filter_high) + blank = str(self.blank) + biasOnOff = str(self.bias_OnOff) + biasValue = str(self.bias_value) print('Filter: '+filterType+' - Low/High: '+filterLow+' -'+filterHigh) print('Bias: '+biasOnOff+'- '+biasValue) print('Blank: '+blank) diff --git a/iexcode/instruments/scalers.py b/iexcode/instruments/scalers.py index 2c17c476b4b9dc444cacf4f67bba08e231b0580c..df39f3910ee1aacd5680b1491f32152a673ae1da 100644 --- a/iexcode/instruments/scalers.py +++ b/iexcode/instruments/scalers.py @@ -47,7 +47,7 @@ def Octupole_scaler(time_seconds,verbose): class Scaler: - def __inti__(self, pv): + def __init__(self, pv): """ to access scaler pvs usage: diff --git a/iexcode/instruments/shutters.py b/iexcode/instruments/shutters.py index 8279908e4238c86e583d37f4efc55646a6bdc78d..e30e9f6ad338a8ab4bdc0181f25c515919588d15 100644 --- a/iexcode/instruments/shutters.py +++ b/iexcode/instruments/shutters.py @@ -82,8 +82,8 @@ def branch_shutter_status(branch=None,verbose=False): """ if branch == None: branch = iex.BL.branch - pvA="PA:29ID:S"+branch+"S_BLOCKING_BEAM.VAL" - pvB="PB:29ID:S"+branch+"S_BLOCKING_BEAM.VAL" + pvA="PA:29ID:S"+branch.upper()+"S_BLOCKING_BEAM.VAL" + pvB="PB:29ID:S"+branch.upper()+"S_BLOCKING_BEAM.VAL" #"ON" = 1 => shutter open status=caget(pvA)+caget(pvB) if status == 2: @@ -104,8 +104,8 @@ def branch_shutter_close(branch=None,verbose=False): """ if branch == None: branch = iex.BL.branch - caput("PC:29ID:S"+branch+"S_CLOSE_REQUEST.VAL",1,wait=True,timeout=18000) - print("Closing "+branch+"-Shutter...") + caput("PC:29ID:S"+branch.upper()+"S_CLOSE_REQUEST.VAL",1,wait=True,timeout=18000) + print("Closing "+branch.upper()+"-Shutter...") def branch_shutter_open(branch=None,verbose=False): @@ -121,6 +121,6 @@ def branch_shutter_open(branch=None,verbose=False): if shutter_status: print(branch+"-Shutter already open...") else: - caput("PC:29ID:S"+branch+"S_OPEN_REQUEST.VAL",1,wait=True,timeout=18000) - print("Opening "+branch+"-Shutter...") + caput("PC:29ID:S"+branch.upper()+"S_OPEN_REQUEST.VAL",1,wait=True,timeout=18000) + print("Opening "+branch.upper()+"-Shutter...") diff --git a/iexcode/instruments/xrays.py b/iexcode/instruments/xrays.py index b1052348293ac2eca78e74bdad33da75c1524f4b..5aa6707c149a9e611f5ed9d5aa530a8ca96222c9 100644 --- a/iexcode/instruments/xrays.py +++ b/iexcode/instruments/xrays.py @@ -9,7 +9,7 @@ from time import sleep from epics import caget,caput import iexcode.instruments.cfg as iex -from iexcode.instruments.cameras import _enable_endstation_cameras +from iexcode.instruments.IEX_cameras import _enable_endstation_cameras from iexcode.instruments.current_amplifiers import ca_average, ca_detector_list from iexcode.instruments.diagnostics import * from iexcode.instruments.FMB_mirrors import FMB_mirror_get @@ -639,7 +639,7 @@ def slit_get(verbose=True): if verbose: message = iex.BL.branch+' exit slit: '+str(slit_size) - message += ", @ "+str(slit_center) if iex.BL.branch is not 'c' else '' + message += ", @ "+str(slit_center) print(message) return slit_size,slit_center