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 c34b29504..da4e87830 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 45d9b9820..896658ffa 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 741592cab..36761d7ff 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 a0d7347b9..21ec479a5 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 67f23c06d..f88585b10 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 0865871a2..8b16f2119 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 45f974403..e8dfeb139 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 c4604374e..c2bd225f6 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 7e1f02bc1..96a45c297 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 03185f01b..90416f3c1 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 6ff0c3a36..0eb8d7418 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 afe86f405..db0668435 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 1198f658c..56d9e522d 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 6cc75b8dd..13984b776 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 d173d1a12..a527abc8a 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 ce3b70077..a04b2d457 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 a9dcdf5ea..75abce511 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 1b1cb2a97..e2bbcab16 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 0d0196b9d..11b600803 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 ba742e87b..458afac43 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,