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
5 changes: 4 additions & 1 deletion simpeg_drivers/utils/regularization.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,10 @@ def set_rotated_operators(
grad_op_active = function.regularization_mesh.Pac.T @ (
grad_op @ function.regularization_mesh.Pac
)
active_faces = grad_op_active.max(axis=1).toarray().ravel() > 0
active_faces = np.isclose(
grad_op_active @ np.ones(function.regularization_mesh.n_cells), 0
)
active_faces &= grad_op_active.max(axis=1).toarray().ravel() != 0

setattr(
function.regularization_mesh,
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 @@ -36,7 +36,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": 6.3559205278626525, "phi_d": 0.0091, "phi_m": 0.00603}
target_mvi_run = {"data_norm": 6.3559205278626525, "phi_d": 0.00933, "phi_m": 0.00401}


def test_magnetic_vector_fwr_run(
Expand Down
11 changes: 9 additions & 2 deletions tests/run_tests/driver_rotated_gradients_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,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.006830937520353864, "phi_d": 0.0276, "phi_m": 0.0288}
target_run = {"data_norm": 0.006830937520353864, "phi_d": 0.0309, "phi_m": 0.028}


def test_gravity_rotated_grad_fwr_run(
Expand Down Expand Up @@ -142,13 +142,20 @@ def test_rotated_grad_run(
inactive_ind = run_ws.get_entity("active_cells")[0].values == 0
assert np.all(nan_ind == inactive_ind)

# Smooth functions should be zero for uniform model
for obj in driver.regularization.objfcts:
for smooth in obj.objfcts[1:]:
np.testing.assert_allclose(
smooth(np.ones(driver.models.n_active)), 0, atol=1e-6
)


if __name__ == "__main__":
# Full run
test_gravity_rotated_grad_fwr_run(
Path("./"),
n_grid_points=10,
refinement=(4, 8),
refinement=(6, 8),
)

test_rotated_grad_run(
Expand Down
Loading