Skip to content

Commit fae0697

Browse files
authored
Merge branch 'develop' into GEOPY-2594
2 parents 5ebf159 + b1ad7f4 commit fae0697

5 files changed

Lines changed: 20 additions & 7 deletions

File tree

simpeg_drivers/utils/nested.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,13 @@ def create_simulation(
307307
# For DCIP-2D, create a projection from the global active cells to
308308
# the local active cells
309309
else:
310-
# Map the line_ids to the mesh parts (assumes sequential numbering)
311-
line_number = np.unique(local_survey.line_ids)
312-
active_mesh_part = np.isin(simulation.mesh.parts, line_number)
310+
# Map the survey locations (distances) to the mesh parts
311+
in_cell = np.searchsorted(
312+
simulation.mesh.cell_centers_x, local_survey.locations_a[:, 0]
313+
)
314+
unique_parts = np.unique(simulation.mesh.parts[in_cell])
315+
active_mesh_part = np.isin(simulation.mesh.parts, unique_parts)
316+
313317
n_actives = simulation.active_cells.sum()
314318
activate_ind = np.zeros(simulation.mesh.n_cells, dtype=int)
315319
activate_ind[np.where(simulation.active_cells)[0]] = np.arange(n_actives)

simpeg_drivers/utils/utils.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,17 @@ def get_drape_model(
419419
distances = compute_alongline_distance(xyz_smooth)
420420
x_interp = interp1d(distances[:, 0], xyz_smooth[:, 0], fill_value="extrapolate")
421421
y_interp = interp1d(distances[:, 0], xyz_smooth[:, 1], fill_value="extrapolate")
422+
423+
# Round the values for mesh creation to avoid issue with floor (int) rounding
424+
limits = np.vstack(
425+
[
426+
np.floor(distances.min(axis=0)),
427+
np.ceil(distances.max(axis=0)),
428+
]
429+
)
430+
422431
mesh = mesh_utils.mesh_builder_xyz(
423-
distances,
432+
limits,
424433
h,
425434
padding_distance=[
426435
[pads[0], pads[1]],

tests/run_tests/driver_dc_2d_rotated_gradients_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
# To test the full run and validate the inversion.
4242
# Move this file out of the test directory and run.
4343

44-
target_run = {"data_norm": 10.305373769233688, "phi_d": 187000, "phi_m": 410}
44+
target_run = {"data_norm": 10.37631617283848, "phi_d": 199000, "phi_m": 421}
4545

4646

4747
def test_dc_rotated_2d_fwr_run(tmp_path: Path, n_electrodes=10, n_lines=3):

tests/run_tests/driver_dc_2d_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
# To test the full run and validate the inversion.
4242
# Move this file out of the test directory and run.
4343

44-
target_run = {"data_norm": 11.14351536256954, "phi_d": 6360, "phi_m": 245}
44+
target_run = {"data_norm": 11.136935742296085, "phi_d": 5570, "phi_m": 314}
4545

4646

4747
def test_dc_2d_fwr_run(

tests/run_tests/driver_ip_2d_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
# To test the full run and validate the inversion.
3838
# Move this file out of the test directory and run.
3939

40-
target_run = {"data_norm": 0.1267394640365658, "phi_d": 16300, "phi_m": 6.05e-05}
40+
target_run = {"data_norm": 0.1244717397585979, "phi_d": 15500, "phi_m": 0.0002845}
4141

4242

4343
def test_ip_2d_fwr_run(

0 commit comments

Comments
 (0)