diff --git a/iexcode/instruments/Logfile.py b/iexcode/instruments/Logfile.py index 63c6ef5e171495cd012659630512bdc9c318fd93..58dd96102ffbec6c2ce6492caed61ddde0347da4 100644 --- a/iexcode/instruments/Logfile.py +++ b/iexcode/instruments/Logfile.py @@ -25,14 +25,11 @@ def log_update(d=None): updates the log file with the last scan info d = dictionary of {header:[data,format]} """ - try: - if d == None: - d = iex.BL.mda.log.log_dictionary() - - iex.BL.mda.log.update(d) + #try: + iex.BL.mda.log.update(d) - except: - print('No logfile written') + #except: + # print('No logfile written') def log_name_set(file_name): try: @@ -193,13 +190,13 @@ class Logfile: entry+=item+"," f.write(entry[:-1] +'\n\n') - def write_entry(self,data_list, format_list): + def write_entry(self, head_list, data_list, format_list): """ writes an entry to the logfile """ if not isfile(self.filepath): - self.write_header() + self.write_header(head_list) with open(self.filepath, "a+") as f: for i in range(len(format_list)): @@ -209,19 +206,22 @@ class Logfile: pv_format="{0:"+format_list[last_entry]+"}\n" f.write(pv_format.format(data_list[last_entry])) - def update(self): + def update(self,d=None): """ To be used for scanlog and scanEA functions. Update SaveFile_Header version number when changing the structure of the file (indexing). Previously: SaveFile """ - header_list,data_list,format_list = self.log_entries() + if d == None: + d = iex.BL.mda.log.log_dictionary() + + header_list,data_list,format_list = self.log_entries(d) if not isfile(self.filepath): self._intit_log(header_list) - self.write_entry(self,data_list, format_list) + self.write_entry(header_list,data_list,format_list) diff --git a/iexcode/instruments/electron_analyzer.py b/iexcode/instruments/electron_analyzer.py index 393f7a817d102b0816a21a289cb25afb0b1e058f..782174e9f8f828c01db66e3f359db87a47e3b5bb 100644 --- a/iexcode/instruments/electron_analyzer.py +++ b/iexcode/instruments/electron_analyzer.py @@ -166,8 +166,7 @@ def EAlog_update(): """ d=EA_log_dictionary() try: - header_list,data_list,format_list = iex.BL.mda.log.log_entries(d) - iex.BL.mda.log.write_entry(data_list,format_list) + log_update(d) except: print("EAlog did not write to file, check for errors.")