diff --git a/simpeg_drivers/components/topography.py b/simpeg_drivers/components/topography.py index a54c19abc..0d0bf9107 100644 --- a/simpeg_drivers/components/topography.py +++ b/simpeg_drivers/components/topography.py @@ -121,7 +121,7 @@ def active_cells(self, mesh: InversionMesh, data: InversionData) -> np.ndarray: active_cells = active_from_xyz( mesh.entity, vertices, - grid_reference="center", + grid_reference="bottom" if forced_to_surface else "center", triangulation=cells, ) diff --git a/tests/run_tests/driver_dc_2d_rotated_gradients_test.py b/tests/run_tests/driver_dc_2d_rotated_gradients_test.py index 90bcfc251..dd95b298f 100644 --- a/tests/run_tests/driver_dc_2d_rotated_gradients_test.py +++ b/tests/run_tests/driver_dc_2d_rotated_gradients_test.py @@ -43,11 +43,11 @@ # To test the full run and validate the inversion. # Move this file out of the test directory and run. -target_run = {"data_norm": 10.11130699043982, "phi_d": 193000, "phi_m": 439} +target_run = {"data_norm": 1.0864e01, "phi_d": 4.5530e04, "phi_m": 7.7120e02} def test_dc_rotated_2d_fwr_run( - tmp_path: Path, n_electrodes=10, n_lines=3, cell_size=(5.0, 5.0) + tmp_path: Path, n_electrodes=10, n_lines=3, cell_size=(10.0, 10.0) ): opts = SyntheticsComponentsOptions( method="direct current 2d", diff --git a/tests/run_tests/driver_dc_2d_test.py b/tests/run_tests/driver_dc_2d_test.py index 1da6ba863..3d45091e1 100644 --- a/tests/run_tests/driver_dc_2d_test.py +++ b/tests/run_tests/driver_dc_2d_test.py @@ -43,7 +43,7 @@ # To test the full run and validate the inversion. # Move this file out of the test directory and run. -target_run = {"data_norm": 10.864162198305321, "phi_d": 5370, "phi_m": 334} +target_run = {"data_norm": 1.1186e01, "phi_d": 5.1220e03, "phi_m": 3.3940e02} def test_dc_2d_fwr_run( diff --git a/tests/run_tests/driver_dc_test.py b/tests/run_tests/driver_dc_test.py index 9bce6c276..d64bb5695 100644 --- a/tests/run_tests/driver_dc_test.py +++ b/tests/run_tests/driver_dc_test.py @@ -38,7 +38,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.14571066077648995, "phi_d": 14.4, "phi_m": 3940} +target_run = {"data_norm": 1.3680e-01, "phi_d": 1.1720e01, "phi_m": 4.6400e03} def test_dc_3d_fwr_run( diff --git a/tests/run_tests/driver_ip_2d_test.py b/tests/run_tests/driver_ip_2d_test.py index 0b2452f66..3365bef5e 100644 --- a/tests/run_tests/driver_ip_2d_test.py +++ b/tests/run_tests/driver_ip_2d_test.py @@ -39,7 +39,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.1236630897188764, "phi_d": 15800, "phi_m": 0.000171} +target_run = {"data_norm": 1.2313e-01, "phi_d": 1.5580e04, "phi_m": 2.2570e-04} def test_ip_2d_fwr_run( diff --git a/tests/run_tests/driver_ip_test.py b/tests/run_tests/driver_ip_test.py index 3d117a899..ca15138f0 100644 --- a/tests/run_tests/driver_ip_test.py +++ b/tests/run_tests/driver_ip_test.py @@ -37,7 +37,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.004782189506580897, "phi_d": 571, "phi_m": 1.55e-06} +target_run = {"data_norm": 4.6608e-03, "phi_d": 5.4190e02, "phi_m": 2.1450e-06} def test_ip_3d_fwr_run( diff --git a/tests/run_tests/driver_joint_cross_gradient_test.py b/tests/run_tests/driver_joint_cross_gradient_test.py index 0738e721b..630050fa1 100644 --- a/tests/run_tests/driver_joint_cross_gradient_test.py +++ b/tests/run_tests/driver_joint_cross_gradient_test.py @@ -70,7 +70,7 @@ # To test the full run and validate the inversion. # Move this file out of the test directory and run. -target_run = {"data_norm": 53.31485005157825, "phi_d": 498.5, "phi_m": 0.2658} +target_run = {"data_norm": 5.3315e01, "phi_d": 4.9190e02, "phi_m": 2.7810e-01} INDUCING_FIELD = (50000.0, 90.0, 0.0) @@ -334,13 +334,13 @@ def test_joint_cross_gradient_inv_run( # the scaling from its total misfit. np.testing.assert_allclose( driver.directives.scale_misfits.scalings, - [1.0, 0.423491, 0.125, 0.125, 0.319101], + [1.0, 0.423571, 0.125, 0.125, 0.300323], atol=1e-3, ) # Check that scaling * chi factor is reflected in data misfit multipliers np.testing.assert_allclose( driver.data_misfit.multipliers, - [0.8, 0.338793, 0.125, 0.125, 0.319101], + [0.8, 0.338857, 0.125, 0.125, 0.300323], atol=1e-3, ) diff --git a/tests/run_tests/driver_mt_test.py b/tests/run_tests/driver_mt_test.py index c49afc7dd..7c5d8e79e 100644 --- a/tests/run_tests/driver_mt_test.py +++ b/tests/run_tests/driver_mt_test.py @@ -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.003584600661140228, "phi_d": 4.45, "phi_m": 5.56} +target_run = {"data_norm": 3.4932e-02, "phi_d": 1.4260e-01, "phi_m": 3.3270e00} def setup_data(workspace, survey): diff --git a/tests/utils/targets.py b/tests/utils/targets.py index 7d851636e..c1900d41f 100644 --- a/tests/utils/targets.py +++ b/tests/utils/targets.py @@ -51,7 +51,7 @@ def check_target(output: dict, target: dict, tolerance=0.05): :param tolerance: Tolerance between output and target measured as: |a-b|/b """ print( - f"Output: 'data_norm': {np.linalg.norm(output['data'])}, 'phi_d': {output['phi_d'][-1]}, 'phi_m': {output['phi_m'][-1]}" + f"Output: 'data_norm': {np.linalg.norm(output['data']):.4e}, 'phi_d': {output['phi_d'][-1]:.4e}, 'phi_m': {output['phi_m'][-1]:.4e}" ) print(f"Target: {target}")