diff --git a/simpeg_drivers/utils/regularization.py b/simpeg_drivers/utils/regularization.py index 943760cb..f6c6ab9c 100644 --- a/simpeg_drivers/utils/regularization.py +++ b/simpeg_drivers/utils/regularization.py @@ -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, diff --git a/tests/run_tests/driver_mvi_test.py b/tests/run_tests/driver_mvi_test.py index c90abf65..80d9304f 100644 --- a/tests/run_tests/driver_mvi_test.py +++ b/tests/run_tests/driver_mvi_test.py @@ -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( diff --git a/tests/run_tests/driver_rotated_gradients_test.py b/tests/run_tests/driver_rotated_gradients_test.py index 63234d53..159fa64f 100644 --- a/tests/run_tests/driver_rotated_gradients_test.py +++ b/tests/run_tests/driver_rotated_gradients_test.py @@ -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( @@ -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(