diff --git a/simpeg_drivers/utils/synthetics/surveys/time_domain.py b/simpeg_drivers/utils/synthetics/surveys/time_domain.py index 7e823186..c67825ff 100644 --- a/simpeg_drivers/utils/synthetics/surveys/time_domain.py +++ b/simpeg_drivers/utils/synthetics/surveys/time_domain.py @@ -75,11 +75,11 @@ def generate_borehole_survey( survey = generate_large_loop_survey( geoh5, X, Y, Z, channels=channels, waveform=waveform, name=name, n_loops=1 ) - - center = survey.vertices[0, :] - survey.vertices = ( - y_rotation_matrix(np.pi / 4) @ (survey.vertices - center).T - ).T + center + # Put receivers in the air + vertices = survey.vertices + vertices[:, 2] -= 25.0 + center = vertices[0, :] + survey.vertices = (y_rotation_matrix(np.pi / 4) @ (vertices - center).T).T + center return survey @@ -216,6 +216,9 @@ def generate_large_loop_survey( cells.append(np.c_[inds, inds + 1]) count += X.shape[1] + # Put receivers in the air + vertices[:, 2] += 25.0 + survey = LargeLoopGroundTEMReceivers.create( geoh5, name=name, vertices=vertices, cells=np.vstack(cells) ) diff --git a/simpeg_drivers/utils/utils.py b/simpeg_drivers/utils/utils.py index b223cce4..f18f566f 100644 --- a/simpeg_drivers/utils/utils.py +++ b/simpeg_drivers/utils/utils.py @@ -491,8 +491,6 @@ def get_containing_cells( else: locations = data.locations - inds = mesh.get_containing_cells(locations) - if isinstance(data.entity, LargeLoopGroundEMSurvey): line_ind = [] transmitters = data.entity.transmitters @@ -503,7 +501,9 @@ def get_containing_cells( transmitters.vertices[cell[1], :], ) ) - inds = np.r_[inds, np.hstack(line_ind)] + inds = np.hstack(line_ind) + else: + inds = mesh.get_containing_cells(locations) elif isinstance(mesh, TensorMesh): locations = data.drape_locations() diff --git a/tests/run_tests/driver_ground_tem_test.py b/tests/run_tests/driver_ground_tem_test.py index 389cff25..888381ae 100644 --- a/tests/run_tests/driver_ground_tem_test.py +++ b/tests/run_tests/driver_ground_tem_test.py @@ -45,7 +45,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.8460e-11, "phi_d": 3.0390e01, "phi_m": 2.0320e04} +target_run = {"data_norm": 3.3993e-11, "phi_d": 2.3720e02, "phi_m": 6.4250e03} def test_tiling_ground_tem( @@ -112,6 +112,11 @@ def test_tiling_ground_tem( for tile in tiles[None]: assert len(np.unique(components.survey.tx_id_property.values[tile])) == 1 + # Check that all receivers are in the air + indices = fwr_driver.inversion_mesh.mesh.get_containing_cells( + components.survey.vertices + ) + assert np.all(~fwr_driver.models.active_cells[indices]) fwr_driver.run() diff --git a/tests/run_tests/oriented_ground_tem_receiver_test.py b/tests/run_tests/oriented_ground_tem_receiver_test.py index 4350309d..06cf489a 100644 --- a/tests/run_tests/oriented_ground_tem_receiver_test.py +++ b/tests/run_tests/oriented_ground_tem_receiver_test.py @@ -166,7 +166,7 @@ def test_tem_fwr_run(tmp_path: Path): rot_vals = np.vstack(rot_vals) # Check that the total fields are preserved - np.testing.assert_allclose( + np.testing.assert_array_almost_equal( np.linalg.norm(rot_vals, axis=0), np.linalg.norm(comp_vals, axis=0) )