Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions tests/run_tests/driver_airborne_tem_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@
# To test the full run and validate the inversion.
# Move this file out of the test directory and run.

target_run = {
"data_norm": 2.81018e-10,
"phi_d": 15400,
"phi_m": 718.9,
}
target_run = {"data_norm": 7.05481e-08, "phi_d": 198200000, "phi_m": 7806}


def test_bad_waveform(tmp_path: Path):
Expand Down Expand Up @@ -76,6 +72,7 @@ def test_airborne_tem_fwr_run(
tmp_path: Path,
n_grid_points=3,
refinement=(2,),
cell_size=(20.0, 20.0, 20.0),
):
# Run the forward
geoh5, _, model, survey, topography = setup_inversion_workspace(
Expand All @@ -84,6 +81,7 @@ def test_airborne_tem_fwr_run(
anomaly=1.0,
n_electrodes=n_grid_points,
n_lines=n_grid_points,
cell_size=cell_size,
refinement=refinement,
inversion_type="airborne_tem",
drape_height=10.0,
Expand Down Expand Up @@ -200,15 +198,17 @@ def test_airborne_tem_run(tmp_path: Path, max_iterations=1, pytest=True):
)
output["data"] = orig_dBzdt
if pytest:
check_target(output, target_run, tolerance=0.5)
check_target(output, target_run, tolerance=0.1)
nan_ind = np.isnan(run_ws.get_entity("Iteration_0_model")[0].values)
inactive_ind = run_ws.get_entity("active_cells")[0].values == 0
assert np.all(nan_ind == inactive_ind)


if __name__ == "__main__":
# Full run
test_airborne_tem_fwr_run(Path("./"), n_grid_points=5, refinement=(0, 0, 4))
test_airborne_tem_fwr_run(
Path("./"), n_grid_points=5, cell_size=(5.0, 5.0, 5.0), refinement=(0, 0, 4)
)
test_airborne_tem_run(
Path("./"),
max_iterations=15,
Expand Down
10 changes: 7 additions & 3 deletions tests/run_tests/driver_fem_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@
# To test the full run and validate the inversion.
# Move this file out of the test directory and run.

target_run = {"data_norm": 47.522882323952054, "phi_d": 729, "phi_m": 883.8}
target_run = {"data_norm": 81.8361, "phi_d": 2161, "phi_m": 5828}


def test_fem_fwr_run(
tmp_path: Path,
n_grid_points=3,
refinement=(2,),
cell_size=(20.0, 20.0, 20.0),
):
# Run the forward
geoh5, _, model, survey, topography = setup_inversion_workspace(
Expand All @@ -48,6 +49,7 @@ def test_fem_fwr_run(
n_lines=n_grid_points,
refinement=refinement,
drape_height=15.0,
cell_size=cell_size,
padding_distance=400,
inversion_type="fem",
flatten=True,
Expand Down Expand Up @@ -166,15 +168,17 @@ def test_fem_run(tmp_path: Path, max_iterations=1, pytest=True):
)

if pytest:
check_target(output, target_run, tolerance=0.5)
check_target(output, target_run, tolerance=0.1)
nan_ind = np.isnan(run_ws.get_entity("Iteration_0_model")[0].values)
inactive_ind = run_ws.get_entity("active_cells")[0].values == 0
assert np.all(nan_ind == inactive_ind)


if __name__ == "__main__":
# Full run
test_fem_fwr_run(Path("./"), n_grid_points=5, refinement=(4, 4, 4))
test_fem_fwr_run(
Path("./"), n_grid_points=5, cell_size=(5.0, 5.0, 5.0), refinement=(4, 4, 4)
)
test_fem_run(
Path("./"),
max_iterations=15,
Expand Down
17 changes: 10 additions & 7 deletions tests/run_tests/driver_ground_tem_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@
# To test the full run and validate the inversion.
# Move this file out of the test directory and run.

target_run = {
"data_norm": 5.95181e-7,
"phi_d": 86.58,
"phi_m": 443.1,
}
target_run = {"data_norm": 8.806897e-07, "phi_d": 152.8, "phi_m": 12850}


def test_tiling_ground_tem(
Expand Down Expand Up @@ -89,6 +85,7 @@ def test_ground_tem_fwr_run(
caplog,
n_grid_points=4,
refinement=(2,),
cell_size=(20.0, 20.0, 20.0),
pytest=True,
):
if pytest:
Expand All @@ -103,6 +100,7 @@ def test_ground_tem_fwr_run(
refinement=refinement,
inversion_type="ground_tem",
drape_height=5.0,
cell_size=cell_size,
padding_distance=1000.0,
flatten=True,
)
Expand Down Expand Up @@ -229,7 +227,7 @@ def test_ground_tem_run(tmp_path: Path, max_iterations=1, pytest=True):
assert driver.inversion_data.entity.tx_id_property.name == "tx_id"
output["data"] = orig_dBzdt
if pytest:
check_target(output, target_run, tolerance=0.5)
check_target(output, target_run, tolerance=0.1)
nan_ind = np.isnan(run_ws.get_entity("Iteration_0_model")[0].values)
inactive_ind = run_ws.get_entity("active_cells")[0].values == 0
assert np.all(nan_ind == inactive_ind)
Expand All @@ -238,7 +236,12 @@ def test_ground_tem_run(tmp_path: Path, max_iterations=1, pytest=True):
if __name__ == "__main__":
# Full run
test_ground_tem_fwr_run(
Path("./"), None, n_grid_points=5, refinement=(2, 2, 2), pytest=False
Path("./"),
None,
n_grid_points=5,
refinement=(2, 2, 2),
cell_size=(5.0, 5.0, 5.0),
pytest=False,
)
test_ground_tem_run(
Path("./"),
Expand Down
8 changes: 6 additions & 2 deletions tests/run_tests/driver_mt_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@
# To test the full run and validate the inversion.
# Move this file out of the test directory and run.

target_run = {"data_norm": 0.0042988, "phi_d": 50.2, "phi_m": 11.1}
target_run = {"data_norm": 0.032649770, "phi_d": 6.676, "phi_m": 212.3}


def test_magnetotellurics_fwr_run(
tmp_path: Path,
n_grid_points=2,
refinement=(2,),
cell_size=(20.0, 20.0, 20.0),
):
# Run the forward
geoh5, _, model, survey, topography = setup_inversion_workspace(
Expand All @@ -47,6 +48,7 @@ def test_magnetotellurics_fwr_run(
n_electrodes=n_grid_points,
n_lines=n_grid_points,
refinement=refinement,
cell_size=cell_size,
drape_height=0.0,
inversion_type="magnetotellurics",
flatten=False,
Expand Down Expand Up @@ -200,7 +202,9 @@ def test_magnetotellurics_run(tmp_path: Path, max_iterations=1, pytest=True):

if __name__ == "__main__":
# Full run
test_magnetotellurics_fwr_run(Path("./"), n_grid_points=8, refinement=(4, 8))
test_magnetotellurics_fwr_run(
Path("./"), n_grid_points=8, cell_size=(5.0, 5.0, 5.0), refinement=(4, 8)
)
test_magnetotellurics_run(
Path("./"),
max_iterations=15,
Expand Down
10 changes: 7 additions & 3 deletions tests/run_tests/driver_tipper_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@
# To test the full run and validate the inversion.
# Move this file out of the test directory and run.

target_run = {"data_norm": 0.0055932, "phi_d": 7.346, "phi_m": 472.2}
target_run = {"data_norm": 0.006549595043425509, "phi_d": 221.4, "phi_m": 270.5}


def test_tipper_fwr_run(
tmp_path: Path,
n_grid_points=2,
refinement=(2,),
cell_size=(20.0, 20.0, 20.0),
):
# Run the forward
geoh5, _, model, survey, topography = setup_inversion_workspace(
Expand All @@ -41,6 +42,7 @@ def test_tipper_fwr_run(
n_electrodes=n_grid_points,
n_lines=n_grid_points,
refinement=refinement,
cell_size=cell_size,
inversion_type="tipper",
drape_height=15.0,
flatten=False,
Expand Down Expand Up @@ -162,15 +164,17 @@ def test_tipper_run(tmp_path: Path, max_iterations=1, pytest=True):
)
output["data"] = orig_tyz_real_1
if pytest:
check_target(output, target_run, tolerance=0.5)
check_target(output, target_run, tolerance=0.1)
nan_ind = np.isnan(run_ws.get_entity("Iteration_0_model")[0].values)
inactive_ind = run_ws.get_entity("active_cells")[0].values == 0
assert np.all(nan_ind == inactive_ind)


if __name__ == "__main__":
# Full run
test_tipper_fwr_run(Path("./"), n_grid_points=8, refinement=(4, 4))
test_tipper_fwr_run(
Path("./"), n_grid_points=8, cell_size=(5.0, 5.0, 5.0), refinement=(4, 4)
)
test_tipper_run(
Path("./"),
max_iterations=15,
Expand Down