Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions simpeg_drivers/components/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ def lower_bound(self) -> np.ndarray | None:
bound_model = -self._upper_bound.model

if bound_model is None:
return -np.inf

lbound = bound_model.copy()
lbound = np.full(self.n_active, -np.inf)
else:
lbound = bound_model.copy()

if self.is_sigma:
is_finite = np.isfinite(lbound)
Expand All @@ -304,9 +304,9 @@ def upper_bound(self) -> np.ndarray | None:
bound_model = self._upper_bound.model

if bound_model is None:
return np.inf

ubound = bound_model.copy()
ubound = np.full(self.n_active, np.inf)
else:
ubound = bound_model.copy()

if self.is_sigma:
is_finite = np.isfinite(ubound)
Expand Down
8 changes: 6 additions & 2 deletions simpeg_drivers/utils/regularization.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,13 @@ def set_rotated_operators(
)

grad_op_active = mesh.Pac.T @ (unit_grad_op @ mesh.Pac)

# Remove extra partial volume from missing neighbors
row_sum = np.asarray(grad_op_active.sum(axis=1)).ravel()
grad_op_active -= sdiag(row_sum)

vol_avg_op = mesh.Pac.T @ (vol_avg_op @ mesh.Pac)
active_faces = np.isclose(grad_op_active @ np.ones(mesh.n_cells), 0)
active_faces &= grad_op_active.max(axis=1).toarray().ravel() != 0
active_faces = grad_op_active.max(axis=1).toarray().ravel() != 0

vol_avg_op = vol_avg_op[active_faces, :]
vol_avg_op = sdiag(np.asarray(vol_avg_op.sum(axis=1)).ravel() ** -1) @ vol_avg_op
Expand Down
4 changes: 2 additions & 2 deletions tests/run_tests/driver_2d_rotated_gradients_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# To test the full run and validate the inversion.
# Move this file out of the test directory and run.

target_run = {"data_norm": 0.6464643069717512, "phi_d": 1160, "phi_m": 5.29}
target_run = {"data_norm": 0.6464643069717512, "phi_d": 1150, "phi_m": 5.37}


def test_dc2d_rotated_grad_fwr_run(
Expand All @@ -52,7 +52,7 @@ def test_dc2d_rotated_grad_fwr_run(
refinement=(4, 6),
):
filepath = Path(tmp_path) / "inversion_test.ui.geoh5"
with Workspace.create(filepath) as geoh5:
with get_workspace(filepath) as geoh5:
# Run the forward
components = SyntheticsComponents(
geoh5=geoh5,
Expand Down
2 changes: 1 addition & 1 deletion tests/run_tests/driver_dc_b2d_rotated_gradients_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
# To test the full run and validate the inversion.
# Move this file out of the test directory and run.

target_run = {"data_norm": 1.1060093911270892, "phi_d": 208, "phi_m": 0.468}
target_run = {"data_norm": 1.1060093911270892, "phi_d": 209, "phi_m": 0.468}


def test_dc_rotated_p3d_fwr_run(
Expand Down
4 changes: 3 additions & 1 deletion tests/run_tests/driver_grav_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
from tests.utils.targets import check_target, get_inversion_output, get_workspace


# pylint: disable=no-member

# To test the full run and validate the inversion.
# Move this file out of the test directory and run.
target_run = {"data_norm": 0.0028055270497087128, "phi_d": 8.24e-06, "phi_m": 0.0234}
Expand Down Expand Up @@ -161,7 +163,7 @@ def test_gravity_run(
driver = GravityInversionDriver.start(str(tmp_path / "Inv_run.ui.json"))

assert driver.params.data_object.uid != gz.parent.uid
assert driver.models.upper_bound is np.inf
assert np.all(np.isinf(driver.models.upper_bound))

with Workspace(driver.params.geoh5.h5file) as run_ws:
output = get_inversion_output(
Expand Down
2 changes: 1 addition & 1 deletion tests/run_tests/driver_joint_pgi_homogeneous_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
# To test the full run and validate the inversion.
# Move this file out of the test directory and run.

target_run = {"data_norm": 390.70695894864303, "phi_d": 2020, "phi_m": 8.98}
target_run = {"data_norm": 390.70695894864303, "phi_d": 2030, "phi_m": 9.23}
INDUCING_FIELD = (50000.0, 90.0, 0.0)


Expand Down
2 changes: 1 addition & 1 deletion tests/run_tests/driver_mvi_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
# To test the full run and validate the inversion.
# Move this file out of the test directory and run.

target_mvi_run = {"data_norm": 149.10117434016038, "phi_d": 1070, "phi_m": 0.129}
target_mvi_run = {"data_norm": 149.10117434016038, "phi_d": 1040, "phi_m": 0.129}


def test_magnetic_vector_fwr_run(
Expand Down
3 changes: 2 additions & 1 deletion tests/run_tests/driver_rotated_gradients_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@

# To test the full run and validate the inversion.
# Move this file out of the test directory and run.
# pylint: disable=no-member

target_run = {"data_norm": 0.4076195420139727, "phi_d": 37.5, "phi_m": 427}
target_run = {"data_norm": 0.4076195420139727, "phi_d": 35.5, "phi_m": 432}


def test_gravity_rotated_grad_fwr_run(
Expand Down