From bdc84d123190c4621963c5233fde6f6b9c2d9b15 Mon Sep 17 00:00:00 2001
From: "FR@29iduser" <rodolakis@anl.gov>
Date: Mon, 19 Sep 2022 10:52:11 -0500
Subject: [PATCH] debug

---
 build/lib/iexcode/instruments/ARPES.py             |  3 ++-
 build/lib/iexcode/instruments/Scienta.py           |  5 ++++-
 build/lib/iexcode/instruments/electron_analyzer.py | 12 ++++++------
 build/lib/iexcode/instruments/scanRecord.py        |  6 ++++--
 iexcode/instruments/ARPES.py                       |  3 ++-
 iexcode/instruments/IEX_cameras.py                 |  1 +
 iexcode/instruments/Octupole.py                    | 12 +++++-------
 iexcode/instruments/Scienta.py                     |  5 ++++-
 iexcode/instruments/electron_analyzer.py           | 12 ++++++------
 iexcode/instruments/scanRecord.py                  |  6 ++++--
 10 files changed, 38 insertions(+), 27 deletions(-)

diff --git a/build/lib/iexcode/instruments/ARPES.py b/build/lib/iexcode/instruments/ARPES.py
index d156ced..82be3b4 100644
--- a/build/lib/iexcode/instruments/ARPES.py
+++ b/build/lib/iexcode/instruments/ARPES.py
@@ -102,7 +102,7 @@ def ARPES_init(*userName,**kwargs):
     #enable cameras
     _enable_endstation_cameras()
     
-    print ('ARPES initalized')
+    print ('\nARPES initalized')
     #return any detectors or other parameters that you want access to from jupyter
     return tey,ca15
 
@@ -315,6 +315,7 @@ def _ARPES_log_dictionary():
 
     Previously: scanlog
     """
+    #header: pv, format
     d={
         "x":(ARPES_Motors.get('x'),".2f"),
         "y":(ARPES_Motors.get('y'),".2f"),
diff --git a/build/lib/iexcode/instruments/Scienta.py b/build/lib/iexcode/instruments/Scienta.py
index 8417aac..66ebb4e 100644
--- a/build/lib/iexcode/instruments/Scienta.py
+++ b/build/lib/iexcode/instruments/Scienta.py
@@ -79,6 +79,9 @@ class Scienta:
 
         #Camera Settings
         self.Frames = None
+
+        #external variables
+        self.Motors = None
         
         pv = PV(self.PHV+"WorkFunction")
         time.sleep(1)
@@ -97,7 +100,7 @@ class Scienta:
         """
 
         for key in vars(self):
-            if key not in ["PHV","_Pcam","_savePlugin","_statsPlugin","wk","Frames","dtype","connected"]:
+            if key not in ["PHV","_Pcam","_savePlugin","_statsPlugin","wk","Frames","dtype","connected","Motors"]:
                 vars(self)[key]=caget(self.PHV+key+".VAL")
             if key  in ["LensMode","SpectraMode"]:
                 vars(self)[key]=caget(self.PHV+key+".VAL",as_string=True)
diff --git a/build/lib/iexcode/instruments/electron_analyzer.py b/build/lib/iexcode/instruments/electron_analyzer.py
index 6c192f8..9ae62cf 100644
--- a/build/lib/iexcode/instruments/electron_analyzer.py
+++ b/build/lib/iexcode/instruments/electron_analyzer.py
@@ -262,8 +262,8 @@ def _scanEAPrefix(ptype,**kwargs):
         print(ptype)
 
     if ptype == "mda":
-        fpath = iex.BL.mda.filepath[0:-3]+EA.dtype
-        nextMDA = iex.BL.mda.fileNum 
+        fpath = iex.BL.mda.filepath()[0:-3]+EA.dtype
+        nextMDA = iex.BL.mda.fileNum() 
         prefix = "MDAscan"+str.zfill(str(nextMDA),kwargs["nzeros"])
     else:
         prefix = ptype
@@ -447,10 +447,10 @@ def scanFM(RoughPositions,thList,EAlist,**kwargs):
     if kwargs['debug']:
         print(x,y,z,th,chi,phi)
     
-    iex.BL.mda.fillin_table(EA.Motors._motor_dictionary("th")[1],EA.Motors._motor_dictionary("th")[0],th,positioner_num=1)
-    iex.BL.mda.fillin_table(EA.Motors._motor_dictionary("x")[1],EA.Motors._motor_dictionary("x")[0],x,positioner_num=2)
-    iex.BL.mda.fillin_table(EA.Motors._motor_dictionary("y")[1],EA.Motors._motor_dictionary("y")[0],y,positioner_num=3)
-    iex.BL.mda.fillin_table(EA.Motors._motor_dictionary("z")[1],EA.Motors._motor_dictionary("z")[0],z,positioner_num=4)
+    iex.BL.mda.fillin_table(EA.Motors._motor_dictionary["th"][1],EA.Motors._motor_dictionary["th"][0],th,positioner_num=1)
+    iex.BL.mda.fillin_table(EA.Motors._motor_dictionary["x"][1],EA.Motors._motor_dictionary["x"][0],x,positioner_num=2)
+    iex.BL.mda.fillin_table(EA.Motors._motor_dictionary["y"][1],EA.Motors._motor_dictionary["y"][0],y,positioner_num=3)
+    iex.BL.mda.fillin_table(EA.Motors._motor_dictionary["z"][1],EA.Motors._motor_dictionary["z"][0],z,positioner_num=4)
 
     #setting up EA
     EAkwargs={
diff --git a/build/lib/iexcode/instruments/scanRecord.py b/build/lib/iexcode/instruments/scanRecord.py
index 3d58f0e..073218e 100644
--- a/build/lib/iexcode/instruments/scanRecord.py
+++ b/build/lib/iexcode/instruments/scanRecord.py
@@ -403,13 +403,15 @@ class ScanRecord:
             print("Scan record "+self.ioc+" reset to default settings.")
 
     ### positioners 
-    def positioners_clear(self,scan_dim,verbose=True):
+    def positioners_clear(self,verbose=True,**kwargs):
         """
         Clear all extra scan positioners
 
         Previously: Clear_Scan_Positioners
         """
-        scan_pv = self.ioc+"scan"+str(scan_dim)
+        kwargs.setdefault('scan_dim',1)
+
+        scan_pv = self.ioc+"scan"+str(kwargs['scan_dim'])
         caput(scan_pv+".CMND",3)        # Clear all Positionners
         
         if verbose:
diff --git a/iexcode/instruments/ARPES.py b/iexcode/instruments/ARPES.py
index d156ced..82be3b4 100644
--- a/iexcode/instruments/ARPES.py
+++ b/iexcode/instruments/ARPES.py
@@ -102,7 +102,7 @@ def ARPES_init(*userName,**kwargs):
     #enable cameras
     _enable_endstation_cameras()
     
-    print ('ARPES initalized')
+    print ('\nARPES initalized')
     #return any detectors or other parameters that you want access to from jupyter
     return tey,ca15
 
@@ -315,6 +315,7 @@ def _ARPES_log_dictionary():
 
     Previously: scanlog
     """
+    #header: pv, format
     d={
         "x":(ARPES_Motors.get('x'),".2f"),
         "y":(ARPES_Motors.get('y'),".2f"),
diff --git a/iexcode/instruments/IEX_cameras.py b/iexcode/instruments/IEX_cameras.py
index 764c539..ab9a4ed 100644
--- a/iexcode/instruments/IEX_cameras.py
+++ b/iexcode/instruments/IEX_cameras.py
@@ -42,6 +42,7 @@ def _enable_endstation_cameras(unused_off=True):
     }  # index of cam_list 
 
     d=cam_pv_dictionary()
+    print("\nEnabling beamline cameras")
     for num in d.keys(): 
         pv=d[num]+"cam1:Acquire"   
         #camera in list
diff --git a/iexcode/instruments/Octupole.py b/iexcode/instruments/Octupole.py
index 4d5b2a5..be09d33 100644
--- a/iexcode/instruments/Octupole.py
+++ b/iexcode/instruments/Octupole.py
@@ -78,11 +78,10 @@ def Octupole_init(*userName,**kwargs):
     else:
         user_name = iex.BL.mda.user_name()
     
-    ## JM fix here
-    user_name='Freeland'
+
 
     #update for default scanRecord advanced parameters
-    #iex.BL.mda.log('Octupole',user_name,_Octupole_dictionary)
+    iex.BL.mda.log('Octupole',user_name,_Octupole_log_dictionary)
 
     #global detectors
     mesh = SRS("29ide:scaler1.S2", '29idd:A4')
@@ -98,7 +97,7 @@ def Octupole_init(*userName,**kwargs):
     if kwargs['reset']:
         Octupole_reset()
 
-    print ('Octupole initalized')
+    print ('\nOctupole initalized')
     #return any detectors or other parameters that you want access to from jupyter
     return tey,tfy,pd,mesh,diag,kbh,kbv
 ##############################################################################################################
@@ -325,14 +324,13 @@ def _Octupole_log_header():
     header_list = {'Octupole':h}
     return header_list 
 
-def _Octupole_dictionary():
+def _Octupole_log_dictionary():
     """
     enstation info for log file
 
     Previously: scanlog
     """
-    
-    #m3r_centroid = vals['kphi'] ????
+
     #header: pv, format
     d={
         "x":(Octupole_Motors.get('x'),".2f"),
diff --git a/iexcode/instruments/Scienta.py b/iexcode/instruments/Scienta.py
index 8417aac..66ebb4e 100644
--- a/iexcode/instruments/Scienta.py
+++ b/iexcode/instruments/Scienta.py
@@ -79,6 +79,9 @@ class Scienta:
 
         #Camera Settings
         self.Frames = None
+
+        #external variables
+        self.Motors = None
         
         pv = PV(self.PHV+"WorkFunction")
         time.sleep(1)
@@ -97,7 +100,7 @@ class Scienta:
         """
 
         for key in vars(self):
-            if key not in ["PHV","_Pcam","_savePlugin","_statsPlugin","wk","Frames","dtype","connected"]:
+            if key not in ["PHV","_Pcam","_savePlugin","_statsPlugin","wk","Frames","dtype","connected","Motors"]:
                 vars(self)[key]=caget(self.PHV+key+".VAL")
             if key  in ["LensMode","SpectraMode"]:
                 vars(self)[key]=caget(self.PHV+key+".VAL",as_string=True)
diff --git a/iexcode/instruments/electron_analyzer.py b/iexcode/instruments/electron_analyzer.py
index 6c192f8..9ae62cf 100644
--- a/iexcode/instruments/electron_analyzer.py
+++ b/iexcode/instruments/electron_analyzer.py
@@ -262,8 +262,8 @@ def _scanEAPrefix(ptype,**kwargs):
         print(ptype)
 
     if ptype == "mda":
-        fpath = iex.BL.mda.filepath[0:-3]+EA.dtype
-        nextMDA = iex.BL.mda.fileNum 
+        fpath = iex.BL.mda.filepath()[0:-3]+EA.dtype
+        nextMDA = iex.BL.mda.fileNum() 
         prefix = "MDAscan"+str.zfill(str(nextMDA),kwargs["nzeros"])
     else:
         prefix = ptype
@@ -447,10 +447,10 @@ def scanFM(RoughPositions,thList,EAlist,**kwargs):
     if kwargs['debug']:
         print(x,y,z,th,chi,phi)
     
-    iex.BL.mda.fillin_table(EA.Motors._motor_dictionary("th")[1],EA.Motors._motor_dictionary("th")[0],th,positioner_num=1)
-    iex.BL.mda.fillin_table(EA.Motors._motor_dictionary("x")[1],EA.Motors._motor_dictionary("x")[0],x,positioner_num=2)
-    iex.BL.mda.fillin_table(EA.Motors._motor_dictionary("y")[1],EA.Motors._motor_dictionary("y")[0],y,positioner_num=3)
-    iex.BL.mda.fillin_table(EA.Motors._motor_dictionary("z")[1],EA.Motors._motor_dictionary("z")[0],z,positioner_num=4)
+    iex.BL.mda.fillin_table(EA.Motors._motor_dictionary["th"][1],EA.Motors._motor_dictionary["th"][0],th,positioner_num=1)
+    iex.BL.mda.fillin_table(EA.Motors._motor_dictionary["x"][1],EA.Motors._motor_dictionary["x"][0],x,positioner_num=2)
+    iex.BL.mda.fillin_table(EA.Motors._motor_dictionary["y"][1],EA.Motors._motor_dictionary["y"][0],y,positioner_num=3)
+    iex.BL.mda.fillin_table(EA.Motors._motor_dictionary["z"][1],EA.Motors._motor_dictionary["z"][0],z,positioner_num=4)
 
     #setting up EA
     EAkwargs={
diff --git a/iexcode/instruments/scanRecord.py b/iexcode/instruments/scanRecord.py
index 3d58f0e..073218e 100644
--- a/iexcode/instruments/scanRecord.py
+++ b/iexcode/instruments/scanRecord.py
@@ -403,13 +403,15 @@ class ScanRecord:
             print("Scan record "+self.ioc+" reset to default settings.")
 
     ### positioners 
-    def positioners_clear(self,scan_dim,verbose=True):
+    def positioners_clear(self,verbose=True,**kwargs):
         """
         Clear all extra scan positioners
 
         Previously: Clear_Scan_Positioners
         """
-        scan_pv = self.ioc+"scan"+str(scan_dim)
+        kwargs.setdefault('scan_dim',1)
+
+        scan_pv = self.ioc+"scan"+str(kwargs['scan_dim'])
         caput(scan_pv+".CMND",3)        # Clear all Positionners
         
         if verbose:
-- 
GitLab