diff --git a/build/lib/iexcode/instruments/logfile.py b/build/lib/iexcode/instruments/logfile.py index cde224d887f9755152f7aefd9450a53fb81f19ac..dc7d7b5ad0d578328e5adc1e18052b0461acc25f 100644 --- a/build/lib/iexcode/instruments/logfile.py +++ b/build/lib/iexcode/instruments/logfile.py @@ -18,9 +18,11 @@ def log_update(): """ updates the log file with the last scan info """ - - entry_list,pv_list, format_list = BL.log_entries() - logfile_update(BL.endstation_name,BL.ioc,entry_list,pv_list,format_list) + try: + entry_list,pv_list, format_list = BL.log_entries() + logfile_update(BL.endstation_name,BL.ioc,entry_list,pv_list,format_list) + except: + print('No logfile written') ############################################################################################################## diff --git a/build/lib/iexcode/instruments/scanRecord.py b/build/lib/iexcode/instruments/scanRecord.py index 5fd1840efa09c6988477de28ef231cdc7c7ee926..f1c12a43abc4e11c4f5bb351660f0bcd3f2e5b2b 100644 --- a/build/lib/iexcode/instruments/scanRecord.py +++ b/build/lib/iexcode/instruments/scanRecord.py @@ -413,7 +413,8 @@ class ScanRecord: caput(scan_pv+".R"+str(posNum)+"PV",rbv_pv) caput(scan_pv+".P"+str(posNum)+"SP",start*1.0) caput(scan_pv+".P"+str(posNum)+"EP",stop*1.0) - if kwargs['positioner_num'] == 1: + + if posNum == 1: if 'num_points' in kwargs: if kwargs['num_points'] : caput(scan_pv+".NPTS",steps_points) @@ -681,8 +682,8 @@ class ScanRecord: print('Scan'+str(i)+': '+drive+'= '+str(start)+' / '+str(stop)+' / '+str(step)) if self.check(scan_dim): - filename = self.prefix(self.ioc) - fileNum = self.fileNum(self.ioc) + filename = self.prefix() + fileNum = self.fileNum() print(filename+str(fileNum)+" started at ", dateandtime()) scan_pv = self.ioc+"scan"+str(scan_dim) caput(scan_pv+".EXSC",1,wait=True,timeout=900000) #pushes scan button @@ -703,21 +704,24 @@ class ScanRecord: **kwargs: execute = True/False (default=True) + see scanRecord.fillin for more options Previously: Scan_Empty_Go """ kwargs.setdefault('execute',True) kwargs.setdefault('num_points',True) - self.fillin("","",0,npts,1,**kwargs) - sleep(.1) + self.fillin("","",0,npts-1,npts,**kwargs) + time.sleep(.1) if kwargs['execute']: self.go(**kwargs) - def time_scan(self,duration_min,step_sec,**kwargs): + def time_scan(self,duration_min,step_min=1,**kwargs): """ starts a scan with the readback as time in seconds - + duration: total time for the scan in minutes + step_min: steps per minute (sets the detector setting time for this) + **kwargs execute True/False (default = True) @@ -728,10 +732,12 @@ class ScanRecord: """ kwargs.setdefault('execute',True) - stop=duration_min*60.0/step_sec + kwargs.update({'detector_settling_time':60.0/step_min}) + + stop=duration_min*60.0*step_min self.fillin("","time",1,stop,1,**kwargs) - print("Time scan - Settling time : "+str(step_sec)) + print("Time scan - Settling time : "+str(step_min)) if kwargs['execute']: self.go(**kwargs) diff --git a/iexcode/instruments/logfile.py b/iexcode/instruments/logfile.py index cde224d887f9755152f7aefd9450a53fb81f19ac..dc7d7b5ad0d578328e5adc1e18052b0461acc25f 100644 --- a/iexcode/instruments/logfile.py +++ b/iexcode/instruments/logfile.py @@ -18,9 +18,11 @@ def log_update(): """ updates the log file with the last scan info """ - - entry_list,pv_list, format_list = BL.log_entries() - logfile_update(BL.endstation_name,BL.ioc,entry_list,pv_list,format_list) + try: + entry_list,pv_list, format_list = BL.log_entries() + logfile_update(BL.endstation_name,BL.ioc,entry_list,pv_list,format_list) + except: + print('No logfile written') ############################################################################################################## diff --git a/iexcode/instruments/scanRecord.py b/iexcode/instruments/scanRecord.py index 5fd1840efa09c6988477de28ef231cdc7c7ee926..2fd9113571f3760c78e9722c039dbaf1b3bb0add 100644 --- a/iexcode/instruments/scanRecord.py +++ b/iexcode/instruments/scanRecord.py @@ -413,7 +413,8 @@ class ScanRecord: caput(scan_pv+".R"+str(posNum)+"PV",rbv_pv) caput(scan_pv+".P"+str(posNum)+"SP",start*1.0) caput(scan_pv+".P"+str(posNum)+"EP",stop*1.0) - if kwargs['positioner_num'] == 1: + + if posNum == 1: if 'num_points' in kwargs: if kwargs['num_points'] : caput(scan_pv+".NPTS",steps_points) @@ -681,8 +682,8 @@ class ScanRecord: print('Scan'+str(i)+': '+drive+'= '+str(start)+' / '+str(stop)+' / '+str(step)) if self.check(scan_dim): - filename = self.prefix(self.ioc) - fileNum = self.fileNum(self.ioc) + filename = self.prefix() + fileNum = self.fileNum() print(filename+str(fileNum)+" started at ", dateandtime()) scan_pv = self.ioc+"scan"+str(scan_dim) caput(scan_pv+".EXSC",1,wait=True,timeout=900000) #pushes scan button @@ -703,21 +704,24 @@ class ScanRecord: **kwargs: execute = True/False (default=True) + see scanRecord.fillin for more options Previously: Scan_Empty_Go """ kwargs.setdefault('execute',True) kwargs.setdefault('num_points',True) - self.fillin("","",0,npts,1,**kwargs) - sleep(.1) + self.fillin("","",0,npts-1,npts,**kwargs) + time.sleep(.1) if kwargs['execute']: self.go(**kwargs) - def time_scan(self,duration_min,step_sec,**kwargs): + def time_scan(self,duration_min,step_min=1,**kwargs): """ starts a scan with the readback as time in seconds - + duration: total time for the scan in minutes + step_min: steps per minute (sets the detector setting time for this) + **kwargs execute True/False (default = True) @@ -728,10 +732,14 @@ class ScanRecord: """ kwargs.setdefault('execute',True) - stop=duration_min*60.0/step_sec - self.fillin("","time",1,stop,1,**kwargs) + kwargs.update({'detector_settling_time':60.0/step_min}) + + stop = duration_min + #num_pnts = duration_min * step_min + dwell = 60/step_min + self.fillin("","time",dwell/60,stop,dwell/60,**kwargs) - print("Time scan - Settling time : "+str(step_sec)) + print("Time scan - Settling time : "+str(step_min)) if kwargs['execute']: self.go(**kwargs)