File tree Expand file tree Collapse file tree
simpeg_drivers/potential_fields/magnetic_vector Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313
1414from pathlib import Path
1515from typing import ClassVar
16- from warnings import warn
1716
1817from geoh5py .data import FloatData
18+ from geoh5py .ui_json .annotations import Deprecated
1919from pydantic import model_validator
2020
2121from 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
Original file line number Diff line number Diff line change 1010
1111from __future__ import annotations
1212
13+ import logging
1314from pathlib import Path
1415
1516import numpy as np
@@ -165,6 +166,7 @@ def test_magnetic_vector_run(
165166
166167def 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
You can’t perform that action at this time.
0 commit comments