From 264a623310f473d32c822fe71f7b9d8a8e820410 Mon Sep 17 00:00:00 2001 From: domfournier Date: Mon, 11 Aug 2025 08:39:43 -0700 Subject: [PATCH] Re-assign variable instead of inplace. Make input argument `path` optional --- simpeg/directives/directives.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/simpeg/directives/directives.py b/simpeg/directives/directives.py index be63899278..21fade5e26 100644 --- a/simpeg/directives/directives.py +++ b/simpeg/directives/directives.py @@ -14,7 +14,7 @@ from ..typing import RandomSeed from ..data_misfit import BaseDataMisfit -from ..objective_function import ComboObjectiveFunction +from ..objective_function import BaseObjectiveFunction, ComboObjectiveFunction from ..maps import IdentityMap, Wires from ..regularization import ( @@ -1841,8 +1841,6 @@ def name(self, value): @property def fileName(self): if getattr(self, "_fileName", None) is None: - from datetime import datetime - self._fileName = "{0!s}-{1!s}".format( self.name, datetime.now().strftime("%Y-%m-%d-%H-%M") ) @@ -3027,12 +3025,12 @@ class ScaleMisfitMultipliers(InversionDirective): Path to save the chi-factors log file. """ - def __init__(self, path: Path | None, **kwargs): + def __init__(self, path: Path | None = None, **kwargs): self.last_beta = None self.chi_factors = None if path is None: - path = Path() + path = Path("./") self.filepath = path / "ChiFactors.log" @@ -3081,7 +3079,7 @@ def endIter(self): ) # Update the scaling - self.scalings *= scalings + self.scalings = self.scalings * scalings # Normalize total phi_d with scalings self.invProb.dmisfit.multipliers = self.multipliers * self.scalings