diff --git a/simpeg_drivers-assets/uijson/direct_current_2d_inversion.ui.json b/simpeg_drivers-assets/uijson/direct_current_2d_inversion.ui.json index c34b2950..da4e8783 100644 --- a/simpeg_drivers-assets/uijson/direct_current_2d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/direct_current_2d_inversion.ui.json @@ -343,17 +343,7 @@ "enabled": true, "tooltip": "Lp-norm used in the z-smoothness term of the objective function." }, - "gradient_type": { - "choiceList": [ - "total", - "components" - ], - "group": "Sparse/blocky model", - "label": "Gradient type", - "value": "total", - "verbose": 3, - "tooltip": "Choose whether the IRLS weights for regularization terms are updated using total or partial gradients." - }, + "gradient_type": "total", "max_irls_iterations": { "min": 0, "group": "Sparse/blocky model", diff --git a/simpeg_drivers-assets/uijson/direct_current_3d_inversion.ui.json b/simpeg_drivers-assets/uijson/direct_current_3d_inversion.ui.json index 45d9b982..896658ff 100644 --- a/simpeg_drivers-assets/uijson/direct_current_3d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/direct_current_3d_inversion.ui.json @@ -312,17 +312,7 @@ "enabled": true, "tooltip": "Lp-norm used in the z-smoothness term of the objective function." }, - "gradient_type": { - "choiceList": [ - "total", - "components" - ], - "group": "Sparse/blocky model", - "label": "Gradient type", - "value": "total", - "verbose": 3, - "tooltip": "Choose whether the IRLS weights for regularization terms are updated using total or partial gradients." - }, + "gradient_type": "total", "max_irls_iterations": { "min": 0, "group": "Sparse/blocky model", diff --git a/simpeg_drivers-assets/uijson/direct_current_batch2d_inversion.ui.json b/simpeg_drivers-assets/uijson/direct_current_batch2d_inversion.ui.json index 741592ca..36761d7f 100644 --- a/simpeg_drivers-assets/uijson/direct_current_batch2d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/direct_current_batch2d_inversion.ui.json @@ -324,17 +324,7 @@ "enabled": true, "tooltip": "Lp-norm used in the z-smoothness term of the objective function." }, - "gradient_type": { - "choiceList": [ - "total", - "components" - ], - "group": "Sparse/blocky model", - "label": "Gradient type", - "value": "total", - "verbose": 3, - "tooltip": "Choose whether the IRLS weights for regularization terms are updated using total or partial gradients." - }, + "gradient_type": "total", "max_irls_iterations": { "min": 0, "group": "Sparse/blocky model", diff --git a/simpeg_drivers-assets/uijson/fdem1d_inversion.ui.json b/simpeg_drivers-assets/uijson/fdem1d_inversion.ui.json index a0d7347b..21ec479a 100644 --- a/simpeg_drivers-assets/uijson/fdem1d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/fdem1d_inversion.ui.json @@ -335,17 +335,7 @@ "enabled": true, "tooltip": "Lp-norm used in the z-smoothness term of the objective function." }, - "gradient_type": { - "choiceList": [ - "total", - "components" - ], - "group": "Sparse/blocky model", - "label": "Gradient type", - "value": "total", - "verbose": 3, - "tooltip": "Choose whether the IRLS weights for regularization terms are updated using total or partial gradients." - }, + "gradient_type": "total", "max_irls_iterations": { "min": 0, "group": "Sparse/blocky model", diff --git a/simpeg_drivers-assets/uijson/fem_inversion.ui.json b/simpeg_drivers-assets/uijson/fem_inversion.ui.json index 67f23c06..f88585b1 100644 --- a/simpeg_drivers-assets/uijson/fem_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/fem_inversion.ui.json @@ -348,17 +348,7 @@ "enabled": true, "tooltip": "Lp-norm used in the z-smoothness term of the objective function." }, - "gradient_type": { - "choiceList": [ - "total", - "components" - ], - "group": "Sparse/blocky model", - "label": "Gradient type", - "value": "total", - "verbose": 3, - "tooltip": "Choose whether the IRLS weights for regularization terms are updated using total or partial gradients." - }, + "gradient_type": "total", "max_irls_iterations": { "min": 0, "group": "Sparse/blocky model", diff --git a/simpeg_drivers-assets/uijson/gravity_inversion.ui.json b/simpeg_drivers-assets/uijson/gravity_inversion.ui.json index 0865871a..8b16f211 100644 --- a/simpeg_drivers-assets/uijson/gravity_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/gravity_inversion.ui.json @@ -581,17 +581,7 @@ "enabled": true, "tooltip": "Lp-norm used in the z-smoothness term of the objective function." }, - "gradient_type": { - "choiceList": [ - "total", - "components" - ], - "group": "Sparse/blocky model", - "label": "Gradient type", - "value": "total", - "verbose": 3, - "tooltip": "Choose whether the IRLS weights for regularization terms are updated using total or partial gradients." - }, + "gradient_type": "total", "max_irls_iterations": { "min": 0, "group": "Sparse/blocky model", 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 45f97440..e8dfeb13 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_2d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_2d_inversion.ui.json @@ -351,17 +351,7 @@ "enabled": true, "tooltip": "Lp-norm used in the z-smoothness term of the objective function." }, - "gradient_type": { - "choiceList": [ - "total", - "components" - ], - "group": "Sparse/blocky model", - "label": "Gradient type", - "value": "total", - "verbose": 3, - "tooltip": "Choose whether the IRLS weights for regularization terms are updated using total or partial gradients." - }, + "gradient_type": "total", "max_irls_iterations": { "min": 0, "group": "Sparse/blocky model", 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 c4604374..c2bd225f 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_3d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_3d_inversion.ui.json @@ -328,17 +328,7 @@ "enabled": true, "tooltip": "Lp-norm used in the z-smoothness term of the objective function." }, - "gradient_type": { - "choiceList": [ - "total", - "components" - ], - "group": "Sparse/blocky model", - "label": "Gradient type", - "value": "total", - "verbose": 3, - "tooltip": "Choose whether the IRLS weights for regularization terms are updated using total or partial gradients." - }, + "gradient_type": "total", "max_irls_iterations": { "min": 0, "group": "Sparse/blocky model", 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 7e1f02bc..96a45c29 100644 --- a/simpeg_drivers-assets/uijson/induced_polarization_batch2d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/induced_polarization_batch2d_inversion.ui.json @@ -335,17 +335,7 @@ "enabled": true, "tooltip": "Lp-norm used in the z-smoothness term of the objective function." }, - "gradient_type": { - "choiceList": [ - "total", - "components" - ], - "group": "Sparse/blocky model", - "label": "Gradient type", - "value": "total", - "verbose": 3, - "tooltip": "Choose whether the IRLS weights for regularization terms are updated using total or partial gradients." - }, + "gradient_type": "total", "max_irls_iterations": { "min": 0, "group": "Sparse/blocky model", 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 03185f01..90416f3c 100644 --- a/simpeg_drivers-assets/uijson/joint_cross_gradient_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/joint_cross_gradient_inversion.ui.json @@ -226,17 +226,7 @@ "lineEdit": false, "enabled": false }, - "gradient_type": { - "choiceList": [ - "total", - "components" - ], - "group": "Regularization", - "label": "Gradient type", - "value": "total", - "verbose": 3, - "enabled": false - }, + "gradient_type": "total", "max_irls_iterations": { "min": 0, "group": "Sparse/blocky model", diff --git a/simpeg_drivers-assets/uijson/joint_surveys_inversion.ui.json b/simpeg_drivers-assets/uijson/joint_surveys_inversion.ui.json index 6ff0c3a3..0eb8d741 100644 --- a/simpeg_drivers-assets/uijson/joint_surveys_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/joint_surveys_inversion.ui.json @@ -317,17 +317,7 @@ "enabled": true, "tooltip": "Lp-norm used in the z-smoothness term of the objective function." }, - "gradient_type": { - "choiceList": [ - "total", - "components" - ], - "group": "Sparse/blocky model", - "label": "Gradient type", - "value": "total", - "verbose": 3, - "tooltip": "Choose whether the IRLS weights for regularization terms are updated using total or partial gradients." - }, + "gradient_type": "total", "max_irls_iterations": { "min": 0, "group": "Sparse/blocky model", diff --git a/simpeg_drivers-assets/uijson/magnetic_scalar_inversion.ui.json b/simpeg_drivers-assets/uijson/magnetic_scalar_inversion.ui.json index afe86f40..db066843 100644 --- a/simpeg_drivers-assets/uijson/magnetic_scalar_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/magnetic_scalar_inversion.ui.json @@ -613,17 +613,7 @@ "enabled": true, "tooltip": "Lp-norm used in the z-smoothness term of the objective function." }, - "gradient_type": { - "choiceList": [ - "total", - "components" - ], - "group": "Sparse/blocky model", - "label": "Gradient type", - "value": "total", - "verbose": 3, - "tooltip": "Choose whether the IRLS weights for regularization terms are updated using total or partial gradients." - }, + "gradient_type": "total", "max_irls_iterations": { "min": 0, "group": "Sparse/blocky model", diff --git a/simpeg_drivers-assets/uijson/magnetic_vector_inversion.ui.json b/simpeg_drivers-assets/uijson/magnetic_vector_inversion.ui.json index 1198f658..56d9e522 100644 --- a/simpeg_drivers-assets/uijson/magnetic_vector_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/magnetic_vector_inversion.ui.json @@ -678,17 +678,7 @@ "enabled": true, "tooltip": "Lp-norm used in the z-smoothness term of the objective function." }, - "gradient_type": { - "choiceList": [ - "total", - "components" - ], - "group": "Sparse/blocky model", - "label": "Gradient type", - "value": "total", - "verbose": 3, - "tooltip": "Choose whether the IRLS weights for regularization terms are updated using total or partial gradients." - }, + "gradient_type": "total", "max_irls_iterations": { "min": 0, "group": "Sparse/blocky model", diff --git a/simpeg_drivers-assets/uijson/magnetotellurics_inversion.ui.json b/simpeg_drivers-assets/uijson/magnetotellurics_inversion.ui.json index 6cc75b8d..13984b77 100644 --- a/simpeg_drivers-assets/uijson/magnetotellurics_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/magnetotellurics_inversion.ui.json @@ -533,17 +533,7 @@ "enabled": true, "tooltip": "Lp-norm used in the z-smoothness term of the objective function." }, - "gradient_type": { - "choiceList": [ - "total", - "components" - ], - "group": "Sparse/blocky model", - "label": "Gradient type", - "value": "total", - "verbose": 3, - "tooltip": "Choose whether the IRLS weights for regularization terms are updated using total or partial gradients." - }, + "gradient_type": "total", "max_irls_iterations": { "min": 0, "group": "Sparse/blocky model", diff --git a/simpeg_drivers-assets/uijson/tdem1d_inversion.ui.json b/simpeg_drivers-assets/uijson/tdem1d_inversion.ui.json index d173d1a1..a527abc8 100644 --- a/simpeg_drivers-assets/uijson/tdem1d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/tdem1d_inversion.ui.json @@ -313,17 +313,7 @@ "enabled": true, "tooltip": "Lp-norm used in the z-smoothness term of the objective function." }, - "gradient_type": { - "choiceList": [ - "total", - "components" - ], - "group": "Sparse/blocky model", - "label": "Gradient type", - "value": "total", - "verbose": 3, - "tooltip": "Choose whether the IRLS weights for regularization terms are updated using total or partial gradients." - }, + "gradient_type": "total", "max_irls_iterations": { "min": 0, "group": "Sparse/blocky model", diff --git a/simpeg_drivers-assets/uijson/tdem_inversion.ui.json b/simpeg_drivers-assets/uijson/tdem_inversion.ui.json index ce3b7007..a04b2d45 100644 --- a/simpeg_drivers-assets/uijson/tdem_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/tdem_inversion.ui.json @@ -383,17 +383,7 @@ "enabled": true, "tooltip": "Lp-norm used in the z-smoothness term of the objective function." }, - "gradient_type": { - "choiceList": [ - "total", - "components" - ], - "group": "Sparse/blocky model", - "label": "Gradient type", - "value": "total", - "verbose": 3, - "tooltip": "Choose whether the IRLS weights for regularization terms are updated using total or partial gradients." - }, + "gradient_type": "total", "max_irls_iterations": { "min": 0, "group": "Sparse/blocky model", diff --git a/simpeg_drivers-assets/uijson/tipper_inversion.ui.json b/simpeg_drivers-assets/uijson/tipper_inversion.ui.json index a9dcdf5e..75abce51 100644 --- a/simpeg_drivers-assets/uijson/tipper_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/tipper_inversion.ui.json @@ -413,17 +413,7 @@ "enabled": true, "tooltip": "Lp-norm used in the z-smoothness term of the objective function." }, - "gradient_type": { - "choiceList": [ - "total", - "components" - ], - "group": "Sparse/blocky model", - "label": "Gradient type", - "value": "total", - "verbose": 3, - "tooltip": "Choose whether the IRLS weights for regularization terms are updated using total or partial gradients." - }, + "gradient_type": "total", "max_irls_iterations": { "min": 0, "group": "Sparse/blocky model", diff --git a/simpeg_drivers/driver.py b/simpeg_drivers/driver.py index 1b1cb2a9..e2bbcab1 100644 --- a/simpeg_drivers/driver.py +++ b/simpeg_drivers/driver.py @@ -540,15 +540,6 @@ def get_regularization(self): reg_func.norms = [fun.norm for fun in functions] reg_funcs.append(reg_func) - # TODO - To be deprcated on GEOPY-2109 - if getattr(self.params, "gradient_type") is not None: - for reg in reg_funcs: - setattr( - reg, - "gradient_type", - getattr(self.params, "gradient_type"), - ) - return objective_function.ComboObjectiveFunction(objfcts=reg_funcs) def get_tiles(self): diff --git a/simpeg_drivers/potential_fields/gravity/uijson.py b/simpeg_drivers/potential_fields/gravity/uijson.py index 0d0196b9..11b60080 100644 --- a/simpeg_drivers/potential_fields/gravity/uijson.py +++ b/simpeg_drivers/potential_fields/gravity/uijson.py @@ -149,6 +149,7 @@ class GravityInversionUIJson(SimPEGDriversUIJson): out_group: GroupForm generate_sweep: BoolForm distributed_workers: str + gradient_type: Deprecated | None = None output_tile_files: Deprecated | None = None inversion_style: Deprecated | None = None max_ram: Deprecated | None = None diff --git a/tests/run_tests/driver_mvi_test.py b/tests/run_tests/driver_mvi_test.py index ba742e87..458afac4 100644 --- a/tests/run_tests/driver_mvi_test.py +++ b/tests/run_tests/driver_mvi_test.py @@ -13,6 +13,7 @@ from pathlib import Path import numpy as np +from geoh5py.groups import PropertyGroup from geoh5py.groups.property_group import GroupTypeEnum from geoh5py.objects import Curve from geoh5py.workspace import Workspace @@ -34,7 +35,7 @@ # To test the full run and validate the inversion. # Move this file out of the test directory and run. -target_mvi_run = {"data_norm": 6.3559205278626525, "phi_d": 0.0143, "phi_m": 0.0009} +target_mvi_run = {"data_norm": 6.3559205278626525, "phi_d": 0.0091, "phi_m": 0.00603} def test_magnetic_vector_fwr_run( @@ -95,6 +96,19 @@ def test_magnetic_vector_run( topography = geoh5.get_entity("topography")[0] inducing_field = (50000.0, 90.0, 0.0) + dip, direction = mesh.add_data( + { + "dip": {"values": np.zeros(mesh.n_cells)}, + "direction": {"values": np.zeros(mesh.n_cells)}, + } + ) + gradient_rotation = PropertyGroup( + name="gradient_rotations", + property_group_type=GroupTypeEnum.DIPDIR, + properties=[dip, direction], + parent=mesh, + ) + # Run the inverse active_cells = ActiveCellsOptions(topography_object=topography) params = MVIInversionOptions( @@ -111,10 +125,10 @@ def test_magnetic_vector_run( x_norm=1.0, y_norm=1.0, z_norm=1.0, - gradient_type="components", tmi_channel=tmi, tmi_uncertainty=4.0, max_global_iterations=max_iterations, + gradient_rotation=gradient_rotation, initial_beta_ratio=1e1, store_sensitivities="ram", save_sensitivities=True,