From 383db365137541e8bdb2ec419fdcaed331d84162 Mon Sep 17 00:00:00 2001 From: domfournier Date: Wed, 29 Jul 2026 08:13:07 -0700 Subject: [PATCH 1/5] Switch topo definition back to bottom for dc and mt --- simpeg_drivers/components/topography.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/simpeg_drivers/components/topography.py b/simpeg_drivers/components/topography.py index a54c19ab..0d0bf910 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, ) From ceb09be642d67085b1da72a25596963e478566da Mon Sep 17 00:00:00 2001 From: domfournier Date: Wed, 29 Jul 2026 08:14:21 -0700 Subject: [PATCH 2/5] Update affected tests --- tests/run_tests/driver_dc_2d_rotated_gradients_test.py | 2 +- tests/run_tests/driver_dc_2d_test.py | 2 +- tests/run_tests/driver_dc_test.py | 2 +- tests/run_tests/driver_ip_2d_test.py | 2 +- tests/run_tests/driver_ip_test.py | 2 +- tests/run_tests/driver_joint_cross_gradient_test.py | 6 +++--- tests/run_tests/driver_mt_test.py | 2 +- tests/utils/targets.py | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) 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 90bcfc25..5c852672 100644 --- a/tests/run_tests/driver_dc_2d_rotated_gradients_test.py +++ b/tests/run_tests/driver_dc_2d_rotated_gradients_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.11130699043982, "phi_d": 193000, "phi_m": 439} +target_run = {"data_norm": 1.0474e01, "phi_d": 2.0890e05, "phi_m": 3.9450e02} def test_dc_rotated_2d_fwr_run( diff --git a/tests/run_tests/driver_dc_2d_test.py b/tests/run_tests/driver_dc_2d_test.py index 1da6ba86..3d45091e 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 9bce6c27..d64bb569 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 0b2452f6..3365bef5 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 3d117a89..ca15138f 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 0738e721..630050fa 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 c49afc7d..7c5d8e79 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 7d851636..c1900d41 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}") From d87a4d1b3eb1effe5a309edf319bfb38fbbd89c4 Mon Sep 17 00:00:00 2001 From: domfournier Date: Wed, 29 Jul 2026 08:49:39 -0700 Subject: [PATCH 3/5] Increase tolerance for linux interp --- tests/run_tests/driver_dc_2d_rotated_gradients_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 5c852672..78f79a86 100644 --- a/tests/run_tests/driver_dc_2d_rotated_gradients_test.py +++ b/tests/run_tests/driver_dc_2d_rotated_gradients_test.py @@ -162,7 +162,7 @@ def test_dc_rotated_gradient_2d_run( if geoh5.open(): output["data"] = potential.values if pytest: - check_target(output, target_run) + check_target(output, target_run, tolerance=0.1) if __name__ == "__main__": From 8840f30ab0006918bd2c0bd28e00d23c0e80a764 Mon Sep 17 00:00:00 2001 From: domfournier Date: Wed, 29 Jul 2026 11:46:34 -0700 Subject: [PATCH 4/5] Increase tolerance again --- tests/run_tests/driver_dc_2d_rotated_gradients_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 78f79a86..1f9807e0 100644 --- a/tests/run_tests/driver_dc_2d_rotated_gradients_test.py +++ b/tests/run_tests/driver_dc_2d_rotated_gradients_test.py @@ -162,7 +162,7 @@ def test_dc_rotated_gradient_2d_run( if geoh5.open(): output["data"] = potential.values if pytest: - check_target(output, target_run, tolerance=0.1) + check_target(output, target_run, tolerance=0.2) if __name__ == "__main__": From f78dbf56b15d161436e7d3eb8bff77dfdb4859a4 Mon Sep 17 00:00:00 2001 From: domfournier Date: Wed, 29 Jul 2026 12:58:56 -0700 Subject: [PATCH 5/5] Attempt to fix linux with coarser mesh --- tests/run_tests/driver_dc_2d_rotated_gradients_test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 1f9807e0..dd95b298 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": 1.0474e01, "phi_d": 2.0890e05, "phi_m": 3.9450e02} +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", @@ -162,7 +162,7 @@ def test_dc_rotated_gradient_2d_run( if geoh5.open(): output["data"] = potential.values if pytest: - check_target(output, target_run, tolerance=0.2) + check_target(output, target_run) if __name__ == "__main__":