diff --git a/simpeg_drivers/potential_fields/magnetic_vector/options.py b/simpeg_drivers/potential_fields/magnetic_vector/options.py index fa5bf436..562b7262 100644 --- a/simpeg_drivers/potential_fields/magnetic_vector/options.py +++ b/simpeg_drivers/potential_fields/magnetic_vector/options.py @@ -13,9 +13,9 @@ from pathlib import Path from typing import ClassVar -from warnings import warn from geoh5py.data import FloatData +from geoh5py.ui_json.annotations import Deprecated from pydantic import model_validator from simpeg_drivers import assets_path @@ -129,19 +129,10 @@ class MVIInversionOptions(BaseInversionOptions): inducing_field_strength: float | FloatData = 50000.0 inducing_field_inclination: float | FloatData = 90.0 inducing_field_declination: float | FloatData = 0.0 + + lower_bound: Deprecated | None = None + starting_inclination: float | FloatData | None = None starting_declination: float | FloatData | None = None reference_inclination: float | FloatData | None = None reference_declination: float | FloatData | None = None - - @model_validator(mode="after") - def validate_lower_bound(self): - if self.lower_bound is not None: - warn( - "Parameter 'lower_bound' for Magnetic Vector Inversion has been deprecated. " - "Defaulting to the negative value of 'upper_bound'.", - DeprecationWarning, - stacklevel=1, - ) - self.lower_bound = None - return self diff --git a/tests/run_tests/driver_mvi_test.py b/tests/run_tests/driver_mvi_test.py index 33671e73..c90abf65 100644 --- a/tests/run_tests/driver_mvi_test.py +++ b/tests/run_tests/driver_mvi_test.py @@ -10,6 +10,7 @@ from __future__ import annotations +import logging from pathlib import Path import numpy as np @@ -165,6 +166,7 @@ def test_magnetic_vector_run( def test_magnetic_vector_bounds_run( tmp_path: Path, + caplog, max_iterations=4, pytest=True, ): @@ -185,10 +187,7 @@ def test_magnetic_vector_bounds_run( # Run the inverse active_cells = ActiveCellsOptions(topography_object=topography) - with warns( - DeprecationWarning, - match="Parameter 'lower_bound' for Magnetic Vector Inversion", - ): + with caplog.at_level(logging.WARNING): params = MVIInversionOptions( geoh5=geoh5, mesh=mesh, @@ -216,6 +215,8 @@ def test_magnetic_vector_bounds_run( ) params.write_ui_json(path=tmp_path / "Inv_run.ui.json") + assert "Skipping deprecated field: lower_bound" in caplog.text + driver = MVIInversionDriver(params) assert np.all(driver.models.lower_bound == -upper_bound)