From c5f55f55ca4e0698eeef2853ef537cc8864268d3 Mon Sep 17 00:00:00 2001
From: "FR@29iduser" <rodolakis@anl.gov>
Date: Wed, 21 Sep 2022 09:26:21 -0500
Subject: [PATCH] moved logfile set to reset

---
 iexcode/instruments/ARPES.py   | 11 ++++++++---
 iexcode/instruments/Logfile.py |  8 ++++++--
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/iexcode/instruments/ARPES.py b/iexcode/instruments/ARPES.py
index 43e798c..d770e83 100644
--- a/iexcode/instruments/ARPES.py
+++ b/iexcode/instruments/ARPES.py
@@ -40,7 +40,7 @@ def ARPES_init(*userName,**kwargs):
 
         **kwargs:
             set_folders: sets the mda and EA folders (default => True)  
-            reset: to reset the detectors in the IOC, etc (default => True)  
+            reset: to reset the detectors in the IOC, sets the logfile name, etc (default => False)  
             xrays: sets global variable and detectors for x-ray (default => True) 
             mode: used sets the detectors 'user ' / 'staff' (default => 'user' )  
     """
@@ -48,7 +48,7 @@ def ARPES_init(*userName,**kwargs):
     kwargs.setdefault('xrays',True)
     kwargs.setdefault('mode','user')
     kwargs.setdefault('set_folders',True)
-    kwargs.setdefault('reset',True)
+    kwargs.setdefault('reset',False)
 
     #motors
     physical_motors = ['x','y','z','th','chi','phi']
@@ -76,7 +76,7 @@ def ARPES_init(*userName,**kwargs):
         user_name = iex.BL.mda.user_name()
 
     #update for default scanRecord advanced parameters
-    iex.BL.mda.log=Logfile('ARPES',user_name,_ARPES_log_dictionary)
+    iex.BL.mda.log=Logfile('ARPES',user_name,_ARPES_log_dictionary,set_file=False)
 
     #EA
     if EA.connected: 
@@ -103,6 +103,8 @@ def ARPES_init(*userName,**kwargs):
     _enable_endstation_cameras()
     
     print ('\nARPES initalized')
+    print('\tpath = "'+iex.BL.mda.filepath()+'"')
+    print('\tprefix = "'+iex.BL.mda.prefix()+'"')
     #return any detectors or other parameters that you want access to from jupyter
     return tey,ca15
 
@@ -258,6 +260,9 @@ def ARPES_reset():
     print("resetting ARPES Lakeshore")
     Lakeshore_reset(pv,LS_355_defaults)
 
+    #set the logfile name
+    iex.BL.mda.log.name_set()
+
 ##############################################################################################################
 ##############################                    get all                 ##############################
 ##############################################################################################################
diff --git a/iexcode/instruments/Logfile.py b/iexcode/instruments/Logfile.py
index d2795cb..d49f283 100644
--- a/iexcode/instruments/Logfile.py
+++ b/iexcode/instruments/Logfile.py
@@ -42,7 +42,7 @@ def log_name_set(file_name):
 ##############################            general   logfile functions          ##############################
 ##############################################################################################################
 class Logfile:
-    def __init__(self,endstation_name,user_name,log_dictionary):
+    def __init__(self,endstation_name,user_name,log_dictionary,set_file=False):
         """
         endstation: used for filename pv ('ARPES' / 'Kappa' / 'Octupole' / 'Test') 
         user_name: used for filepath
@@ -55,7 +55,11 @@ class Logfile:
         self.filepath = self._fpath()
         self.log_dictionary = log_dictionary
 
-        self.name_set()
+        if set_file:
+            self.name_set()
+        else:
+            print('\n log_filename = '+caget(self._name_pv(),as_string=True))
+            print('\tuse log_name_set to change')
 
     def _name_pv(self):
         """
-- 
GitLab