Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

Commit cbd8b80

Browse files
authored
Merge pull request #76 from MiraGeoscience/GEOPY-2149
GEOPY-2149: Rename params to options
2 parents a790377 + 53c1357 commit cbd8b80

10 files changed

Lines changed: 43 additions & 39 deletions

File tree

plate_simulation/driver.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
from plate_simulation.models.events import Anomaly, Erosion, Overburden
2929
from plate_simulation.models.plates import Plate
3030
from plate_simulation.models.series import DikeSwarm, Geology
31-
from plate_simulation.params import PlateSimulationParams
31+
from plate_simulation.options import PlateSimulationOptions
3232
from plate_simulation.utils import replicate
3333

3434

@@ -44,7 +44,7 @@ class PlateSimulationDriver:
4444
:param survey: Survey object for the simulation
4545
"""
4646

47-
def __init__(self, params: PlateSimulationParams):
47+
def __init__(self, params: PlateSimulationOptions):
4848
self.params = params
4949

5050
self._surfaces: list[Surface] | None = None
@@ -305,7 +305,7 @@ def start(ifile: str | Path | InputFile):
305305
return None
306306

307307
with ifile.geoh5.open(mode="r+"): # type: ignore
308-
params = PlateSimulationParams.build(ifile)
308+
params = PlateSimulationOptions.build(ifile)
309309

310310
return PlateSimulationDriver(params).run()
311311

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pydantic import BaseModel
1515

1616

17-
class MeshParams(BaseModel):
17+
class MeshOptions(BaseModel):
1818
"""Core parameters for octree mesh creation."""
1919

2020
u_cell_size: float
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
T = TypeVar("T")
2424

2525

26-
class PlateParams(BaseModel):
26+
class PlateOptions(BaseModel):
2727
"""
2828
Parameters describing an anomalous plate.
2929
@@ -72,7 +72,7 @@ class PlateParams(BaseModel):
7272
@field_validator("reference_surface", "reference_type", mode="before")
7373
@classmethod
7474
def none_to_default(cls, value: T | None, info: ValidationInfo) -> T:
75-
return value or cls.model_fields[info.field_name].default # type: ignore
75+
return value or cls.model_fields[info.field_name].default # pylint: disable=unsubscriptable-object
7676

7777
@model_validator(mode="after")
7878
def single_plate(self):
@@ -132,7 +132,7 @@ def _get_z(self, surface: Points, offset: float = 0.0) -> float:
132132
return z
133133

134134

135-
class OverburdenParams(BaseModel):
135+
class OverburdenOptions(BaseModel):
136136
"""
137137
Parameters for the overburden layer.
138138
@@ -144,7 +144,7 @@ class OverburdenParams(BaseModel):
144144
overburden: float
145145

146146

147-
class ModelParams(BaseModel):
147+
class ModelOptions(BaseModel):
148148
"""
149149
Parameters for the blackground + overburden and plate model.
150150
@@ -158,5 +158,5 @@ class ModelParams(BaseModel):
158158

159159
name: str
160160
background: float
161-
overburden: OverburdenParams
162-
plate: PlateParams
161+
overburden: OverburdenOptions
162+
plate: PlateOptions

plate_simulation/models/plates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from geoh5py.ui_json.utils import fetch_active_workspace
1919
from geoh5py.workspace import Workspace
2020

21-
from plate_simulation.models.params import PlateParams
21+
from plate_simulation.models.options import PlateOptions
2222

2323

2424
class Plate:
@@ -31,7 +31,7 @@ class Plate:
3131

3232
def __init__(
3333
self,
34-
params: PlateParams,
34+
params: PlateOptions,
3535
center_x: float = 0.0,
3636
center_y: float = 0.0,
3737
center_z: float = 0.0,
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
)
3535

3636
from . import assets_path
37-
from .mesh.params import MeshParams
38-
from .models.params import ModelParams
37+
from .mesh.options import MeshOptions
38+
from .models.options import ModelOptions
3939

4040

4141
PARAM_MAP = {
@@ -49,7 +49,7 @@
4949
}
5050

5151

52-
class PlateSimulationParams(BaseData):
52+
class PlateSimulationOptions(BaseData):
5353
"""
5454
Parameters for the plate simulation driver.
5555
@@ -67,8 +67,8 @@ class PlateSimulationParams(BaseData):
6767
run_command: ClassVar[str] = "plate_simulation.driver"
6868
out_group: UIJsonGroup | None = None
6969

70-
mesh: MeshParams
71-
model: ModelParams
70+
mesh: MeshOptions
71+
model: ModelOptions
7272
simulation: SimPEGGroup
7373

7474
def simulation_parameters(self) -> BaseForwardOptions:

tests/models/events_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from geoh5py.objects import Surface
1313

1414
from plate_simulation.models.events import Anomaly, Deposition, Erosion, Overburden
15-
from plate_simulation.models.params import PlateParams
15+
from plate_simulation.models.options import PlateOptions
1616
from plate_simulation.models.plates import Plate
1717

1818
from . import get_topo_mesh
@@ -79,7 +79,7 @@ def test_overburden(tmp_path):
7979
def test_anomaly(tmp_path):
8080
with Workspace(tmp_path / "test.geoh5") as workspace:
8181
_, octree = get_topo_mesh(workspace)
82-
params = PlateParams(
82+
params = PlateOptions(
8383
name="my plate",
8484
plate=10.0,
8585
elevation=-1.5,

tests/models/params_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
from geoh5py import Workspace
1212
from geoh5py.objects import Points, Surface
1313

14-
from plate_simulation.models.params import PlateParams
14+
from plate_simulation.models.options import PlateOptions
1515

1616

1717
def test_plate_params(tmp_path):
1818
workspace = Workspace(tmp_path / "test.geoh5")
19-
params = PlateParams(
19+
params = PlateOptions(
2020
name="my plate",
2121
plate=1.0,
2222
width=20.0,
@@ -57,7 +57,7 @@ def test_plate_params(tmp_path):
5757

5858

5959
def test_plate_params_empty_reference():
60-
params = PlateParams(
60+
params = PlateOptions(
6161
name="my plate",
6262
plate=1.0,
6363
width=20.0,

tests/models/plates_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from geoapps_utils.utils.transformations import rotate_xyz
1212
from geoh5py import Workspace
1313

14-
from plate_simulation.models.params import PlateParams
14+
from plate_simulation.models.options import PlateOptions
1515
from plate_simulation.models.plates import Plate
1616

1717

@@ -24,7 +24,7 @@ def are_collocated(pts1, pts2):
2424

2525

2626
def vertical_east_striking_plate(workspace):
27-
params = PlateParams(
27+
params = PlateOptions(
2828
name="my plate",
2929
plate=1.0,
3030
elevation=0.0,
@@ -73,7 +73,7 @@ def test_dipping_plates_all_quadrants(tmp_path):
7373

7474
for dip_direction in np.arange(0.0, 361.0, 45.0):
7575
for dip in [20.0, 70.0]:
76-
params = PlateParams(
76+
params = PlateOptions(
7777
name=f"plate dipping {dip} at {dip_direction}",
7878
plate=1.0,
7979
elevation=0.0,

tests/runtest/driver_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
from simpeg_drivers.potential_fields.gravity.options import GravityForwardOptions
2020

2121
from plate_simulation import assets_path
22-
from plate_simulation.driver import PlateSimulationDriver, PlateSimulationParams
23-
from plate_simulation.mesh.params import MeshParams
24-
from plate_simulation.models.params import ModelParams
22+
from plate_simulation.driver import PlateSimulationDriver, PlateSimulationOptions
23+
from plate_simulation.mesh.options import MeshOptions
24+
from plate_simulation.models.options import ModelOptions
2525

2626
from . import get_survey, get_topography
2727

@@ -191,7 +191,7 @@ def test_plate_simulation_params_from_input_file(tmp_path):
191191
ifile.data["reference_surface"] = "topography"
192192
ifile.data["reference_type"] = "mean"
193193

194-
params = PlateSimulationParams.build(ifile)
194+
params = PlateSimulationOptions.build(ifile)
195195
assert isinstance(params.simulation, SimPEGGroup)
196196

197197
simulation_parameters = params.simulation_parameters()
@@ -204,7 +204,7 @@ def test_plate_simulation_params_from_input_file(tmp_path):
204204
)
205205
assert simulation_parameters.data_object.uid == survey.uid
206206

207-
assert isinstance(params.mesh, MeshParams)
207+
assert isinstance(params.mesh, MeshOptions)
208208
assert params.mesh.u_cell_size == 10.0
209209
assert params.mesh.v_cell_size == 10.0
210210
assert params.mesh.w_cell_size == 10.0
@@ -214,7 +214,7 @@ def test_plate_simulation_params_from_input_file(tmp_path):
214214
assert params.mesh.minimum_level == 8
215215
assert not params.mesh.diagonal_balance
216216

217-
assert isinstance(params.model, ModelParams)
217+
assert isinstance(params.model, ModelOptions)
218218
assert params.model.name == "test_gravity_plate_simulation"
219219
assert params.model.background == 1000.0
220220
assert params.model.overburden.thickness == 50.0

tests/runtest/gravity_test.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,13 @@
1515
from simpeg_drivers.constants import default_ui_json
1616

1717
from plate_simulation.driver import PlateSimulationDriver
18-
from plate_simulation.mesh.params import MeshParams
19-
from plate_simulation.models.params import ModelParams, OverburdenParams, PlateParams
20-
from plate_simulation.params import PlateSimulationParams
18+
from plate_simulation.mesh.options import MeshOptions
19+
from plate_simulation.models.options import (
20+
ModelOptions,
21+
OverburdenOptions,
22+
PlateOptions,
23+
)
24+
from plate_simulation.options import PlateSimulationOptions
2125

2226
from . import get_survey, get_topography
2327

@@ -27,7 +31,7 @@ def test_gravity_plate_simulation(tmp_path):
2731
topography = get_topography(ws)
2832
survey = get_survey(ws, 10, 10)
2933

30-
mesh_params = MeshParams(
34+
mesh_params = MeshOptions(
3135
u_cell_size=10.0,
3236
v_cell_size=10.0,
3337
w_cell_size=10.0,
@@ -36,9 +40,9 @@ def test_gravity_plate_simulation(tmp_path):
3640
max_distance=200.0,
3741
)
3842

39-
overburden_params = OverburdenParams(thickness=50.0, overburden=0.2)
43+
overburden_params = OverburdenOptions(thickness=50.0, overburden=0.2)
4044

41-
plate_params = PlateParams(
45+
plate_params = PlateOptions(
4246
name="plate",
4347
plate=0.5,
4448
elevation=-250.0,
@@ -50,7 +54,7 @@ def test_gravity_plate_simulation(tmp_path):
5054
reference="center",
5155
)
5256

53-
model_params = ModelParams(
57+
model_params = ModelOptions(
5458
name="density",
5559
background=0.0,
5660
overburden=overburden_params,
@@ -68,7 +72,7 @@ def test_gravity_plate_simulation(tmp_path):
6872
gravity_inversion = SimPEGGroup.create(ws)
6973
gravity_inversion.options = options
7074

71-
params = PlateSimulationParams(
75+
params = PlateSimulationOptions(
7276
title="test",
7377
run_command="run",
7478
geoh5=ws,

0 commit comments

Comments
 (0)