From f5996046c495aba1341a6d253d21cf76042bf8ef Mon Sep 17 00:00:00 2001 From: domfournier Date: Thu, 16 Apr 2026 15:51:24 -0700 Subject: [PATCH 1/3] Remove time stamp in name --- simpeg/directives/_save_geoh5.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/simpeg/directives/_save_geoh5.py b/simpeg/directives/_save_geoh5.py index 72712b31a2..de7522851d 100644 --- a/simpeg/directives/_save_geoh5.py +++ b/simpeg/directives/_save_geoh5.py @@ -396,15 +396,13 @@ def __init__( def write(self, iteration: int, **_): dirpath = Path(self._workspace.h5file).parent - filepath = dirpath / f"SimPEG_{self.time_stamp}.out" + filepath = dirpath / "SimPEG.out" if iteration == 0: with open(filepath, "w", encoding="utf-8") as f: f.write("iteration beta phi_d phi_m time\n") log = [] - with open( - dirpath / f"SimPEG_{self.time_stamp}.log", "r", encoding="utf-8" - ) as file: + with open(dirpath / "SimPEG.log", "r", encoding="utf-8") as file: iteration = 0 for line in file: val = re.findall(r"[+-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+-]?\d+)", line) @@ -432,9 +430,9 @@ def save_log(self): h5_object = w_s.get_entity(self.h5_object)[0] for file in [ - f"SimPEG_{self.time_stamp}.out", - f"SimPEG_{self.time_stamp}.log", - f"ChiFactors_{self.time_stamp}.log", + "SimPEG.out", + "SimPEG.log", + "ChiFactors.log", ]: filepath = dirpath / file From 6d5989b46f1de08b164b353de0dabbe147f7bd73 Mon Sep 17 00:00:00 2001 From: domfournier Date: Fri, 17 Apr 2026 12:50:48 -0700 Subject: [PATCH 2/3] Remove time_stamp as input. Warn that the out will be overwritten if exists --- simpeg/directives/_save_geoh5.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/simpeg/directives/_save_geoh5.py b/simpeg/directives/_save_geoh5.py index de7522851d..423f484174 100644 --- a/simpeg/directives/_save_geoh5.py +++ b/simpeg/directives/_save_geoh5.py @@ -1,3 +1,4 @@ +import logging import re from abc import ABC, abstractmethod from datetime import datetime @@ -387,11 +388,8 @@ class SaveLogFilesGeoH5(BaseSaveGeoH5): def __init__( self, h5_object, - start_date_time: str, **kwargs, ): - - self.time_stamp = start_date_time super().__init__(h5_object, **kwargs) def write(self, iteration: int, **_): @@ -399,6 +397,13 @@ def write(self, iteration: int, **_): filepath = dirpath / "SimPEG.out" if iteration == 0: + + if filepath.exists(): + logging.WARNING( + "SimPEG.out file already exists and will be overwritten." + ) + filepath.unlink() + with open(filepath, "w", encoding="utf-8") as f: f.write("iteration beta phi_d phi_m time\n") log = [] From 6fc66abbe5607deda10e3ecb00ac124cab18e42e Mon Sep 17 00:00:00 2001 From: domfournier Date: Fri, 17 Apr 2026 12:56:08 -0700 Subject: [PATCH 3/3] Move the warning to simpeg_drivers instead --- simpeg/directives/_save_geoh5.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/simpeg/directives/_save_geoh5.py b/simpeg/directives/_save_geoh5.py index 423f484174..4c4f43b80d 100644 --- a/simpeg/directives/_save_geoh5.py +++ b/simpeg/directives/_save_geoh5.py @@ -1,4 +1,3 @@ -import logging import re from abc import ABC, abstractmethod from datetime import datetime @@ -397,13 +396,6 @@ def write(self, iteration: int, **_): filepath = dirpath / "SimPEG.out" if iteration == 0: - - if filepath.exists(): - logging.WARNING( - "SimPEG.out file already exists and will be overwritten." - ) - filepath.unlink() - with open(filepath, "w", encoding="utf-8") as f: f.write("iteration beta phi_d phi_m time\n") log = []