Skip to content

Commit 4699cb0

Browse files
authored
Merge pull request #183 from MiraGeoscience/GEOPY-2105b
GEOPY-2105: b
2 parents e3980ac + bdc10b8 commit 4699cb0

2 files changed

Lines changed: 9 additions & 17 deletions

File tree

simpeg_drivers/potential_fields/magnetic_vector/options.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
from pathlib import Path
1515
from typing import ClassVar
16-
from warnings import warn
1716

1817
from geoh5py.data import FloatData
18+
from geoh5py.ui_json.annotations import Deprecated
1919
from pydantic import model_validator
2020

2121
from simpeg_drivers import assets_path
@@ -129,19 +129,10 @@ class MVIInversionOptions(BaseInversionOptions):
129129
inducing_field_strength: float | FloatData = 50000.0
130130
inducing_field_inclination: float | FloatData = 90.0
131131
inducing_field_declination: float | FloatData = 0.0
132+
133+
lower_bound: Deprecated | None = None
134+
132135
starting_inclination: float | FloatData | None = None
133136
starting_declination: float | FloatData | None = None
134137
reference_inclination: float | FloatData | None = None
135138
reference_declination: float | FloatData | None = None
136-
137-
@model_validator(mode="after")
138-
def validate_lower_bound(self):
139-
if self.lower_bound is not None:
140-
warn(
141-
"Parameter 'lower_bound' for Magnetic Vector Inversion has been deprecated. "
142-
"Defaulting to the negative value of 'upper_bound'.",
143-
DeprecationWarning,
144-
stacklevel=1,
145-
)
146-
self.lower_bound = None
147-
return self

tests/run_tests/driver_mvi_test.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from __future__ import annotations
1212

13+
import logging
1314
from pathlib import Path
1415

1516
import numpy as np
@@ -165,6 +166,7 @@ def test_magnetic_vector_run(
165166

166167
def test_magnetic_vector_bounds_run(
167168
tmp_path: Path,
169+
caplog,
168170
max_iterations=4,
169171
pytest=True,
170172
):
@@ -185,10 +187,7 @@ def test_magnetic_vector_bounds_run(
185187

186188
# Run the inverse
187189
active_cells = ActiveCellsOptions(topography_object=topography)
188-
with warns(
189-
DeprecationWarning,
190-
match="Parameter 'lower_bound' for Magnetic Vector Inversion",
191-
):
190+
with caplog.at_level(logging.WARNING):
192191
params = MVIInversionOptions(
193192
geoh5=geoh5,
194193
mesh=mesh,
@@ -216,6 +215,8 @@ def test_magnetic_vector_bounds_run(
216215
)
217216
params.write_ui_json(path=tmp_path / "Inv_run.ui.json")
218217

218+
assert "Skipping deprecated field: lower_bound" in caplog.text
219+
219220
driver = MVIInversionDriver(params)
220221
assert np.all(driver.models.lower_bound == -upper_bound)
221222

0 commit comments

Comments
 (0)