Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEOPY-1265: Log bounds applied to twice on joint inversion #645

Merged
merged 10 commits into from
Jan 16, 2024
19 changes: 13 additions & 6 deletions geoapps/inversion/components/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,28 +115,31 @@ def active_cells(self, active_cells):

@property
def starting(self):
mstart = self._starting.model
mstart = self._starting.model.copy()

if mstart is not None and self.is_sigma:
mstart = mstart.copy()
mstart = np.log(mstart)

return mstart

@property
def reference(self):
mref = self._reference.model
mref = self._reference.model.copy()

if self.driver.params.forward_only:
return mref

if mref is None:
mref = self.starting
self.driver.params.alpha_s = 0.0
elif self.is_sigma & (all(mref == 0)):
mref = self.starting
self.driver.params.alpha_s = 0.0
else:
mref = np.log(mref) if self.is_sigma else mref
mref = mref.copy()
if self.is_sigma & (all(mref == 0)):
mref = self.starting
self.driver.params.alpha_s = 0.0
else:
mref = np.log(mref) if self.is_sigma else mref
return mref

@property
Expand All @@ -146,6 +149,8 @@ def lower_bound(self):
if lbound is None:
return -np.inf

lbound = lbound.copy()

if self.is_sigma:
is_finite = np.isfinite(lbound)
lbound[is_finite] = np.log(lbound[is_finite])
Expand All @@ -158,6 +163,7 @@ def upper_bound(self):
if ubound is None:
return np.inf

ubound = ubound.copy()
if self.is_sigma:
is_finite = np.isfinite(ubound)
ubound[is_finite] = np.log(ubound[is_finite])
Expand All @@ -169,6 +175,7 @@ def conductivity(self):
mstart = self._conductivity.model

if mstart is not None and self.is_sigma:
mstart = mstart.copy()
mstart = np.log(mstart)

return mstart
Expand Down
1 change: 1 addition & 0 deletions geoapps/inversion/joint/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def drivers(self) -> list[InversionDriver] | None:
group = self.workspace.get_entity(group.uid)[0]
ui_json = group.options
ui_json["geoh5"] = self.workspace
ui_json["workspace_geoh5"] = None

ifile = InputFile(ui_json=ui_json)
mod_name, class_name = DRIVER_MAP.get(ifile.data["inversion_type"])
Expand Down
Loading