diff --git a/simpeg_drivers-assets/uijson/direct_current_3d_forward.ui.json b/simpeg_drivers-assets/uijson/direct_current_3d_forward.ui.json index c81f46aa..922ab8d7 100644 --- a/simpeg_drivers-assets/uijson/direct_current_3d_forward.ui.json +++ b/simpeg_drivers-assets/uijson/direct_current_3d_forward.ui.json @@ -105,6 +105,7 @@ "parent": "mesh", "value": "" }, + "save_sensitivities": false, "n_cpu": { "min": 1, "group": "Compute", diff --git a/simpeg_drivers-assets/uijson/fdem1d_forward.ui.json b/simpeg_drivers-assets/uijson/fdem1d_forward.ui.json index 0231c1c2..ad6024e3 100644 --- a/simpeg_drivers-assets/uijson/fdem1d_forward.ui.json +++ b/simpeg_drivers-assets/uijson/fdem1d_forward.ui.json @@ -32,6 +32,11 @@ "label": "Z imag component", "value": true }, + "u_cell_size": { + "visible": false, + "label": "Vertical core cell size (m)", + "value": 0.0 + }, "v_cell_size": { "min": 0.0, "group": "1D Mesh", @@ -48,6 +53,11 @@ "label": "Depth of core (m)", "value": 500.0 }, + "horizontal_padding": { + "visible": false, + "label": "Horizontal padding (m)", + "value": 1000.0 + }, "vertical_padding": { "min": 0.0, "group": "1D Mesh", diff --git a/simpeg_drivers-assets/uijson/fdem1d_inversion.ui.json b/simpeg_drivers-assets/uijson/fdem1d_inversion.ui.json index 21ec479a..8d1ffd98 100644 --- a/simpeg_drivers-assets/uijson/fdem1d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/fdem1d_inversion.ui.json @@ -80,6 +80,11 @@ "dependencyType": "enabled", "value": "" }, + "u_cell_size": { + "visible": false, + "label": "Vertical core cell size (m)", + "value": 0.0 + }, "v_cell_size": { "min": 0.0, "group": "1D Mesh", @@ -96,6 +101,11 @@ "label": "Depth of core (m)", "value": 500.0 }, + "horizontal_padding": { + "visible": false, + "label": "Horizontal padding (m)", + "value": 1000.0 + }, "vertical_padding": { "min": 0.0, "group": "1D Mesh", @@ -272,6 +282,7 @@ "property": "", "enabled": true }, + "length_scale_y": "", "length_scale_z": { "min": 0.0, "group": "Regularization", @@ -285,6 +296,7 @@ "property": "", "enabled": true }, + "gradient_rotation": "", "s_norm": { "association": "Cell", "dataType": "Float", @@ -319,6 +331,7 @@ "enabled": true, "tooltip": "Lp-norm used in the x-smoothness term of the objective function." }, + "y_norm": "", "z_norm": { "association": "Cell", "dataType": "Float", @@ -547,6 +560,17 @@ "value": "ram", "visible": false }, + "max_chunk_size": { + "min": 0, + "group": "Compute", + "optional": true, + "enabled": true, + "label": "Maximum chunk size (Mb)", + "value": 128, + "verbose": 3, + "visible": false, + "tooltip": "Limit the chunk size used by Dask for distributed computation." + }, "out_group": { "label": "SimPEG group", "value": "", diff --git a/simpeg_drivers-assets/uijson/induced_polarization_2d_forward.ui.json b/simpeg_drivers-assets/uijson/induced_polarization_2d_forward.ui.json index a9341ec1..cb667244 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_2d_forward.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_2d_forward.ui.json @@ -219,13 +219,6 @@ "visible": false, "tooltip": "Limit the chunk size used by Dask for distributed computation." }, - "chunk_by_rows": { - "group": "Compute", - "label": "Chunk by rows", - "value": true, - "verbose": 3, - "visible": false - }, "out_group": { "label": "SimPEG group", "value": "", diff --git a/simpeg_drivers-assets/uijson/induced_polarization_2d_inversion.ui.json b/simpeg_drivers-assets/uijson/induced_polarization_2d_inversion.ui.json index e8dfeb13..b8fb7964 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_2d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_2d_inversion.ui.json @@ -273,6 +273,7 @@ "property": "", "enabled": true }, + "length_scale_y": "", "length_scale_z": { "min": 0.0, "group": "Regularization", @@ -335,6 +336,7 @@ "enabled": true, "tooltip": "Lp-norm used in the x-smoothness term of the objective function." }, + "y_norm": "", "z_norm": { "association": "Cell", "dataType": "Float", diff --git a/simpeg_drivers-assets/uijson/induced_polarization_3d_inversion.ui.json b/simpeg_drivers-assets/uijson/induced_polarization_3d_inversion.ui.json index c2bd225f..462612ec 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_3d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_3d_inversion.ui.json @@ -428,6 +428,7 @@ "enabled": true, "tooltip": "Set the number of iterations per beta value. Use higher values for more non-linear optimization problems." }, + "epsilon_cooling_factor": 1.2, "max_global_iterations": { "min": 1, "lineEdit": false, diff --git a/simpeg_drivers-assets/uijson/induced_polarization_batch2d_inversion.ui.json b/simpeg_drivers-assets/uijson/induced_polarization_batch2d_inversion.ui.json index 96a45c29..839d181e 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_batch2d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_batch2d_inversion.ui.json @@ -228,7 +228,6 @@ "parent": "mesh", "value": "" }, - "output_tile_files": false, "alpha_s": { "min": 0.0, "group": "Regularization", @@ -257,6 +256,7 @@ "property": "", "enabled": true }, + "length_scale_y": "", "length_scale_z": { "min": 0.0, "group": "Regularization", @@ -319,6 +319,7 @@ "enabled": true, "tooltip": "Lp-norm used in the x-smoothness term of the objective function." }, + "y_norm": "", "z_norm": { "association": "Cell", "dataType": "Float", diff --git a/simpeg_drivers-assets/uijson/joint_cross_gradient_inversion.ui.json b/simpeg_drivers-assets/uijson/joint_cross_gradient_inversion.ui.json index 90416f3c..cb99b67f 100644 --- a/simpeg_drivers-assets/uijson/joint_cross_gradient_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/joint_cross_gradient_inversion.ui.json @@ -186,6 +186,17 @@ "value": 1.0, "enabled": false }, + "gradient_rotation": { + "group": "Regularization", + "association": "Cell", + "dataType": "Float", + "dataGroupType": "Dip direction & dip", + "label": "Gradient rotation", + "optional": true, + "enabled": false, + "parent": "mesh", + "value": "" + }, "s_norm": { "min": 0.0, "max": 2.0, @@ -415,6 +426,7 @@ "value": "Pardiso" }, "tile_spatial": 1, + "parallelized": true, "store_sensitivities": { "choiceList": [ "disk", diff --git a/simpeg_drivers-assets/uijson/joint_surveys_inversion.ui.json b/simpeg_drivers-assets/uijson/joint_surveys_inversion.ui.json index 0eb8d741..75bab905 100644 --- a/simpeg_drivers-assets/uijson/joint_surveys_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/joint_surveys_inversion.ui.json @@ -505,6 +505,7 @@ "tooltip": "Direct solver to use for the forward calculations", "value": "Pardiso" }, + "parallelized": true, "tile_spatial": 1, "store_sensitivities": { "choiceList": [ diff --git a/simpeg_drivers-assets/uijson/tdem1d_forward.ui.json b/simpeg_drivers-assets/uijson/tdem1d_forward.ui.json index 8570a596..3d5cd76e 100644 --- a/simpeg_drivers-assets/uijson/tdem1d_forward.ui.json +++ b/simpeg_drivers-assets/uijson/tdem1d_forward.ui.json @@ -9,7 +9,7 @@ "monitoring_directory": "", "workspace_geoh5": "", "inversion_type": "tdem 1d", - "physical property": "conductivity", + "physical_property": "conductivity", "forward_only": true, "data_object": { "main": true, @@ -33,12 +33,19 @@ "tooltip": "Set the units of the data.", "value": "dB/dt (T/s)" }, + "x_channel_bool": false, + "y_channel_bool": false, "z_channel_bool": { "group": "Survey", "main": true, "label": "Z component", "value": true }, + "u_cell_size": { + "visible": false, + "label": "Vertical core cell size (m)", + "value": 0.0 + }, "v_cell_size": { "min": 0.0, "group": "1D Mesh", @@ -55,6 +62,11 @@ "label": "Depth of core (m)", "value": 500.0 }, + "horizontal_padding": { + "visible": false, + "label": "Vertical padding (m)", + "value": 0.0 + }, "vertical_padding": { "min": 0.0, "group": "1D Mesh", @@ -189,6 +201,17 @@ "visible": false, "tooltip": "Splits the objective function into spatial tiles for distributed computation using the Dask library." }, + "max_chunk_size": { + "min": 0, + "group": "Compute", + "optional": true, + "enabled": true, + "label": "Maximum chunk size (Mb)", + "value": 128, + "verbose": 3, + "visible": false, + "tooltip": "Limit the chunk size used by Dask for distributed computation." + }, "out_group": { "label": "SimPEG group", "value": "", diff --git a/simpeg_drivers-assets/uijson/tdem1d_inversion.ui.json b/simpeg_drivers-assets/uijson/tdem1d_inversion.ui.json index a527abc8..6f1ff222 100644 --- a/simpeg_drivers-assets/uijson/tdem1d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/tdem1d_inversion.ui.json @@ -33,6 +33,8 @@ "tooltip": "Set the units of the data.", "value": "dB/dt (T/s)" }, + "x_channel": "", + "y_channel": "", "z_channel": { "association": [ "Cell", @@ -48,6 +50,8 @@ "enabled": true, "value": "" }, + "x_uncertainty": "", + "y_uncertainty": "", "z_uncertainty": { "association": [ "Cell", @@ -63,6 +67,11 @@ "dependencyType": "enabled", "value": "" }, + "u_cell_size": { + "visible": false, + "label": "Vertical core cell size (m)", + "value": 0.0 + }, "v_cell_size": { "min": 0.0, "group": "1D Mesh", @@ -79,6 +88,11 @@ "label": "Depth of core (m)", "value": 500.0 }, + "horizontal_padding": { + "visible": false, + "label": "Vertical padding (m)", + "value": 0.0 + }, "vertical_padding": { "min": 0.0, "group": "1D Mesh", @@ -250,6 +264,7 @@ "property": "", "enabled": true }, + "length_scale_y": "", "length_scale_z": { "min": 0.0, "group": "Regularization", @@ -263,6 +278,7 @@ "property": "", "enabled": true }, + "gradient_rotation": "", "s_norm": { "association": "Cell", "dataType": "Float", @@ -297,6 +313,7 @@ "enabled": true, "tooltip": "Lp-norm used in the x-smoothness term of the objective function." }, + "y_norm": "", "z_norm": { "association": "Cell", "dataType": "Float", @@ -524,6 +541,17 @@ "value": "ram", "visible": false }, + "max_chunk_size": { + "min": 0, + "group": "Compute", + "optional": true, + "enabled": true, + "label": "Maximum chunk size (Mb)", + "value": 128, + "verbose": 3, + "visible": false, + "tooltip": "Limit the chunk size used by Dask for distributed computation." + }, "out_group": { "label": "SimPEG group", "value": "", diff --git a/simpeg_drivers/electricals/induced_polarization/three_dimensions/params.py b/simpeg_drivers/electricals/induced_polarization/three_dimensions/params.py index 83a001bc..b4ec8254 100644 --- a/simpeg_drivers/electricals/induced_polarization/three_dimensions/params.py +++ b/simpeg_drivers/electricals/induced_polarization/three_dimensions/params.py @@ -38,6 +38,7 @@ class IP3DForwardOptions(BaseForwardOptions): inversion_type: str = "induced polarization 3d" chargeability_channel_bool: bool = True + model_type: str = "Conductivity (S/m)" conductivity_model: float | FloatData @@ -61,5 +62,6 @@ class IP3DInversionOptions(BaseInversionOptions): chargeability_channel: FloatData chargeability_uncertainty: float | FloatData | None = None + model_type: str = "Conductivity (S/m)" conductivity_model: float | FloatData lower_bound: float | FloatData | None = 0.0 diff --git a/simpeg_drivers/electricals/induced_polarization/two_dimensions/params.py b/simpeg_drivers/electricals/induced_polarization/two_dimensions/params.py index 323726c7..1cdda7e8 100644 --- a/simpeg_drivers/electricals/induced_polarization/two_dimensions/params.py +++ b/simpeg_drivers/electricals/induced_polarization/two_dimensions/params.py @@ -50,6 +50,7 @@ class IP2DForwardOptions(BaseForwardOptions): line_selection: LineSelectionOptions mesh: DrapeModel | None = None drape_model: DrapeModelOptions = DrapeModelOptions() + model_type: str = "Conductivity (S/m)" conductivity_model: float | FloatData @@ -81,6 +82,7 @@ class IP2DInversionOptions(BaseInversionOptions): line_selection: LineSelectionOptions mesh: DrapeModel | None = None drape_model: DrapeModelOptions = DrapeModelOptions() + model_type: str = "Conductivity (S/m)" conductivity_model: float | FloatData lower_bound: float | FloatData | None = 0.0 length_scale_y: None = None diff --git a/simpeg_drivers/electromagnetics/frequency_domain_1d/params.py b/simpeg_drivers/electromagnetics/frequency_domain_1d/params.py index d56bc2a8..25806a0d 100644 --- a/simpeg_drivers/electromagnetics/frequency_domain_1d/params.py +++ b/simpeg_drivers/electromagnetics/frequency_domain_1d/params.py @@ -67,7 +67,6 @@ class FDEM1DInversionOptions(FDEMInversionOptions): title: str = "Frequency-domain EM-1D (FEM-1D) Inversion" inversion_type: str = "fdem 1d" - y_norm: None = None drape_model: DrapeModelOptions = DrapeModelOptions( u_cell_size=10.0, v_cell_size=10.0, @@ -78,3 +77,5 @@ class FDEM1DInversionOptions(FDEMInversionOptions): ) auto_scale_misfits: bool = False sens_wts_threshold: float = 100.0 + length_scale_y: None = None + y_norm: None = None diff --git a/simpeg_drivers/utils/meshes.py b/simpeg_drivers/utils/meshes.py index 3f54b77c..77215ec7 100644 --- a/simpeg_drivers/utils/meshes.py +++ b/simpeg_drivers/utils/meshes.py @@ -122,6 +122,7 @@ def auto_mesh_parameters( "levels": topography_refinement, "horizon": True, }, + None, ], "out_group": out_group, } diff --git a/tests/data_test.py b/tests/data_test.py index 084d44b2..11ed82a9 100644 --- a/tests/data_test.py +++ b/tests/data_test.py @@ -128,7 +128,6 @@ def test_survey_data(tmp_path: Path): mesh=mesh, starting_model=0.0, tile_spatial=2, - resolution=0.0, ) driver = MVIInversionDriver(params) diff --git a/tests/driver_test.py b/tests/driver_test.py index 41e10969..a0c44fd9 100644 --- a/tests/driver_test.py +++ b/tests/driver_test.py @@ -46,7 +46,6 @@ def test_smallness_terms(tmp_path: Path): alpha_s=1.0, s_norm=0.0, gradient_type="components", - gz_channel_bool=True, gz_channel=gz, gz_uncertainty=2e-3, lower_bound=0.0, diff --git a/tests/run_tests/driver_ip_b2d_test.py b/tests/run_tests/driver_ip_b2d_test.py index 2209b94b..ee80b1ea 100644 --- a/tests/run_tests/driver_ip_b2d_test.py +++ b/tests/run_tests/driver_ip_b2d_test.py @@ -130,7 +130,6 @@ def test_ip_p3d_run( length_scale_x=1.0, length_scale_z=1.0, gradient_type="components", - chargeability_channel_bool=True, max_global_iterations=max_iterations, initial_beta=None, initial_beta_ratio=1e0, diff --git a/tests/run_tests/driver_mag_automesh_test.py b/tests/run_tests/driver_mag_automesh_test.py new file mode 100644 index 00000000..355b3ded --- /dev/null +++ b/tests/run_tests/driver_mag_automesh_test.py @@ -0,0 +1,69 @@ +# ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' +# Copyright (c) 2025 Mira Geoscience Ltd. ' +# ' +# This file is part of simpeg-drivers package. ' +# ' +# simpeg-drivers is distributed under the terms and conditions of the MIT License ' +# (see LICENSE file at the root of this source code package). ' +# ' +# ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +from __future__ import annotations + +from pathlib import Path + +import numpy as np +from dask.distributed import LocalCluster, performance_report +from geoh5py.workspace import Workspace + +from simpeg_drivers.params import ActiveCellsOptions +from simpeg_drivers.potential_fields import ( + MagneticForwardOptions, + MagneticInversionOptions, +) +from simpeg_drivers.potential_fields.magnetic_scalar.driver import ( + MagneticForwardDriver, + MagneticInversionDriver, +) +from simpeg_drivers.utils.testing import check_target, setup_inversion_workspace +from simpeg_drivers.utils.utils import get_inversion_output + + +TARGET = 1132.1998 + + +def test_automesh( + tmp_path: Path, + n_grid_points=20, + refinement=(4, 8), +): + # Run the forward + geoh5, _, model, survey, topography = setup_inversion_workspace( + tmp_path, + background=0.0, + anomaly=0.05, + refinement=refinement, + n_electrodes=n_grid_points, + n_lines=n_grid_points, + flatten=False, + ) + inducing_field = (49999.8, 90.0, 0.0) + active_cells = ActiveCellsOptions(topography_object=topography) + params = MagneticForwardOptions( + forward_only=True, + geoh5=geoh5, + mesh=None, + active_cells=active_cells, + inducing_field_strength=inducing_field[0], + inducing_field_inclination=inducing_field[1], + inducing_field_declination=inducing_field[2], + data_object=survey, + starting_model=model, + ) + + fwr_driver = MagneticForwardDriver(params) + fwr_driver.run() + + with geoh5.open(mode="r"): + data = geoh5.get_entity("Iteration_0_tmi")[0].values + assert np.isclose(np.linalg.norm(data), TARGET)