From b65571f7536899127ac089cf74fa92068cb602d9 Mon Sep 17 00:00:00 2001
From: jmcchesn <jmcchesn@aps.anl.gov>
Date: Mon, 10 Oct 2022 15:43:34 -0500
Subject: [PATCH] debug EA

---
 iexcode/instruments/Logfile.py           | 7 +++++++
 iexcode/instruments/electron_analyzer.py | 9 +++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/iexcode/instruments/Logfile.py b/iexcode/instruments/Logfile.py
index b180cba..38dc283 100644
--- a/iexcode/instruments/Logfile.py
+++ b/iexcode/instruments/Logfile.py
@@ -48,6 +48,11 @@ def log_init(endstation_name,user_name,log_dictionary,set_file=False):
     """
     iex.BL.mda.log=Logfile(endstation_name,user_name,log_dictionary,set_file=False)
 
+def log_header(header_list,**kwargs):
+    """
+    writes the header for EA files
+    """
+    iex.BL.mda.log.write_header(header_list,**kwargs)
 ##############################################################################################################
 ##############################            general   logfile functions          ##############################
 ##############################################################################################################
@@ -243,6 +248,8 @@ class Logfile:
         To be used for scanlog and scanEA functions.
         Update SaveFile_Header version number when changing the structure of the file (indexing).
 
+        ** kwargs
+            header_only = True/False (default => False)
         Previously: SaveFile
         """
         if d == None:
diff --git a/iexcode/instruments/electron_analyzer.py b/iexcode/instruments/electron_analyzer.py
index 4e42e36..aafa391 100644
--- a/iexcode/instruments/electron_analyzer.py
+++ b/iexcode/instruments/electron_analyzer.py
@@ -17,6 +17,7 @@ from iexcode.instruments.IEX_BL_config import *
 
 from iexcode.instruments.AD_utilities import AD_filepath,AD_prefix
 from iexcode.instruments.scanRecord import *
+from iexcode.instruments.Logfile import *
 from iexcode.instruments.conversions_constants import *
 from iexcode.instruments.xrays import energy, scanXAS, BL_energy_tables,energy_get
 from iexcode.instruments.shutters import branch_shutter_close
@@ -190,7 +191,7 @@ def EAlog_header():
     d=EA_log_dictionary()
     try:
         header_list,data_list,format_list = iex.BL.mda.log.log_entries(d)
-        iex.BL.mda.log.write_entry(header_list,label="EA Header:  ")    
+        log_header(header_list,label="EA Header:  ")    
     except:
         print("EAlog did not write header")
 
@@ -252,9 +253,9 @@ def _scanEATrigger(EAlist,before_after,**kwargs):
         _scanEAPrefix("mda",**kwargs)
         #set det trigger
         mda_kwargs={'scan_dim':kwargs['scan_dim'],'trigger_dictionary':{kwargs['detTrig']:HVscanPV}}
-        iex.BL.mda.trigger_set(mda_kwargs)
+        scan_triggers_set(mda_kwargs)
         #add scanNum as detector
-        iex.BL.mda.detectors_set(detector_dictionary={20:EA._savePlugin +"FileName"})
+        scan_detectors_set({20:EA._savePlugin +"FileName"})
         
     if before_after == "after":
         #set prefix
@@ -353,7 +354,7 @@ def scanEA(EAlist,**kwargs):
         
     """
 
-    kwargs.setdefault('scanIOC',iex.BL.ioc)
+    kwargs.setdefault('scanIOC',mda_ioc())
     kwargs.setdefault('scan_dim',1)
     kwargs.setdefault('execute',True)
     kwargs.setdefault("debug",False)
-- 
GitLab