Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions plate_simulation/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from plate_simulation.models.events import Anomaly, Erosion, Overburden
from plate_simulation.models.plates import Plate
from plate_simulation.models.series import DikeSwarm, Geology
from plate_simulation.params import PlateSimulationParams
from plate_simulation.options import PlateSimulationOptions
from plate_simulation.utils import replicate


Expand All @@ -44,7 +44,7 @@ class PlateSimulationDriver:
:param survey: Survey object for the simulation
"""

def __init__(self, params: PlateSimulationParams):
def __init__(self, params: PlateSimulationOptions):
self.params = params

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

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

return PlateSimulationDriver(params).run()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from pydantic import BaseModel


class MeshParams(BaseModel):
class MeshOptions(BaseModel):
"""Core parameters for octree mesh creation."""

u_cell_size: float
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
T = TypeVar("T")


class PlateParams(BaseModel):
class PlateOptions(BaseModel):
"""
Parameters describing an anomalous plate.

Expand Down Expand Up @@ -72,7 +72,7 @@ class PlateParams(BaseModel):
@field_validator("reference_surface", "reference_type", mode="before")
@classmethod
def none_to_default(cls, value: T | None, info: ValidationInfo) -> T:
return value or cls.model_fields[info.field_name].default # type: ignore
return value or cls.model_fields[info.field_name].default # pylint: disable=unsubscriptable-object

@model_validator(mode="after")
def single_plate(self):
Expand Down Expand Up @@ -132,7 +132,7 @@ def _get_z(self, surface: Points, offset: float = 0.0) -> float:
return z


class OverburdenParams(BaseModel):
class OverburdenOptions(BaseModel):
"""
Parameters for the overburden layer.

Expand All @@ -144,7 +144,7 @@ class OverburdenParams(BaseModel):
overburden: float


class ModelParams(BaseModel):
class ModelOptions(BaseModel):
"""
Parameters for the blackground + overburden and plate model.

Expand All @@ -158,5 +158,5 @@ class ModelParams(BaseModel):

name: str
background: float
overburden: OverburdenParams
plate: PlateParams
overburden: OverburdenOptions
plate: PlateOptions
4 changes: 2 additions & 2 deletions plate_simulation/models/plates.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from geoh5py.ui_json.utils import fetch_active_workspace
from geoh5py.workspace import Workspace

from plate_simulation.models.params import PlateParams
from plate_simulation.models.options import PlateOptions


class Plate:
Expand All @@ -31,7 +31,7 @@ class Plate:

def __init__(
self,
params: PlateParams,
params: PlateOptions,
center_x: float = 0.0,
center_y: float = 0.0,
center_z: float = 0.0,
Expand Down
10 changes: 5 additions & 5 deletions plate_simulation/params.py → plate_simulation/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
)

from . import assets_path
from .mesh.params import MeshParams
from .models.params import ModelParams
from .mesh.options import MeshOptions
from .models.options import ModelOptions


PARAM_MAP = {
Expand All @@ -49,7 +49,7 @@
}


class PlateSimulationParams(BaseData):
class PlateSimulationOptions(BaseData):
"""
Parameters for the plate simulation driver.

Expand All @@ -67,8 +67,8 @@ class PlateSimulationParams(BaseData):
run_command: ClassVar[str] = "plate_simulation.driver"
out_group: UIJsonGroup | None = None

mesh: MeshParams
model: ModelParams
mesh: MeshOptions
model: ModelOptions
simulation: SimPEGGroup

def simulation_parameters(self) -> BaseForwardOptions:
Expand Down
4 changes: 2 additions & 2 deletions tests/models/events_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from geoh5py.objects import Surface

from plate_simulation.models.events import Anomaly, Deposition, Erosion, Overburden
from plate_simulation.models.params import PlateParams
from plate_simulation.models.options import PlateOptions
from plate_simulation.models.plates import Plate

from . import get_topo_mesh
Expand Down Expand Up @@ -79,7 +79,7 @@ def test_overburden(tmp_path):
def test_anomaly(tmp_path):
with Workspace(tmp_path / "test.geoh5") as workspace:
_, octree = get_topo_mesh(workspace)
params = PlateParams(
params = PlateOptions(
name="my plate",
plate=10.0,
elevation=-1.5,
Expand Down
6 changes: 3 additions & 3 deletions tests/models/params_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
from geoh5py import Workspace
from geoh5py.objects import Points, Surface

from plate_simulation.models.params import PlateParams
from plate_simulation.models.options import PlateOptions


def test_plate_params(tmp_path):
workspace = Workspace(tmp_path / "test.geoh5")
params = PlateParams(
params = PlateOptions(
name="my plate",
plate=1.0,
width=20.0,
Expand Down Expand Up @@ -57,7 +57,7 @@ def test_plate_params(tmp_path):


def test_plate_params_empty_reference():
params = PlateParams(
params = PlateOptions(
name="my plate",
plate=1.0,
width=20.0,
Expand Down
6 changes: 3 additions & 3 deletions tests/models/plates_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from geoapps_utils.utils.transformations import rotate_xyz
from geoh5py import Workspace

from plate_simulation.models.params import PlateParams
from plate_simulation.models.options import PlateOptions
from plate_simulation.models.plates import Plate


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


def vertical_east_striking_plate(workspace):
params = PlateParams(
params = PlateOptions(
name="my plate",
plate=1.0,
elevation=0.0,
Expand Down Expand Up @@ -73,7 +73,7 @@ def test_dipping_plates_all_quadrants(tmp_path):

for dip_direction in np.arange(0.0, 361.0, 45.0):
for dip in [20.0, 70.0]:
params = PlateParams(
params = PlateOptions(
name=f"plate dipping {dip} at {dip_direction}",
plate=1.0,
elevation=0.0,
Expand Down
12 changes: 6 additions & 6 deletions tests/runtest/driver_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
from simpeg_drivers.potential_fields.gravity.options import GravityForwardOptions

from plate_simulation import assets_path
from plate_simulation.driver import PlateSimulationDriver, PlateSimulationParams
from plate_simulation.mesh.params import MeshParams
from plate_simulation.models.params import ModelParams
from plate_simulation.driver import PlateSimulationDriver, PlateSimulationOptions
from plate_simulation.mesh.options import MeshOptions
from plate_simulation.models.options import ModelOptions

from . import get_survey, get_topography

Expand Down Expand Up @@ -191,7 +191,7 @@ def test_plate_simulation_params_from_input_file(tmp_path):
ifile.data["reference_surface"] = "topography"
ifile.data["reference_type"] = "mean"

params = PlateSimulationParams.build(ifile)
params = PlateSimulationOptions.build(ifile)
assert isinstance(params.simulation, SimPEGGroup)

simulation_parameters = params.simulation_parameters()
Expand All @@ -204,7 +204,7 @@ def test_plate_simulation_params_from_input_file(tmp_path):
)
assert simulation_parameters.data_object.uid == survey.uid

assert isinstance(params.mesh, MeshParams)
assert isinstance(params.mesh, MeshOptions)
assert params.mesh.u_cell_size == 10.0
assert params.mesh.v_cell_size == 10.0
assert params.mesh.w_cell_size == 10.0
Expand All @@ -214,7 +214,7 @@ def test_plate_simulation_params_from_input_file(tmp_path):
assert params.mesh.minimum_level == 8
assert not params.mesh.diagonal_balance

assert isinstance(params.model, ModelParams)
assert isinstance(params.model, ModelOptions)
assert params.model.name == "test_gravity_plate_simulation"
assert params.model.background == 1000.0
assert params.model.overburden.thickness == 50.0
Expand Down
20 changes: 12 additions & 8 deletions tests/runtest/gravity_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@
from simpeg_drivers.constants import default_ui_json

from plate_simulation.driver import PlateSimulationDriver
from plate_simulation.mesh.params import MeshParams
from plate_simulation.models.params import ModelParams, OverburdenParams, PlateParams
from plate_simulation.params import PlateSimulationParams
from plate_simulation.mesh.options import MeshOptions
from plate_simulation.models.options import (
ModelOptions,
OverburdenOptions,
PlateOptions,
)
from plate_simulation.options import PlateSimulationOptions

from . import get_survey, get_topography

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

mesh_params = MeshParams(
mesh_params = MeshOptions(
u_cell_size=10.0,
v_cell_size=10.0,
w_cell_size=10.0,
Expand All @@ -36,9 +40,9 @@ def test_gravity_plate_simulation(tmp_path):
max_distance=200.0,
)

overburden_params = OverburdenParams(thickness=50.0, overburden=0.2)
overburden_params = OverburdenOptions(thickness=50.0, overburden=0.2)

plate_params = PlateParams(
plate_params = PlateOptions(
name="plate",
plate=0.5,
elevation=-250.0,
Expand All @@ -50,7 +54,7 @@ def test_gravity_plate_simulation(tmp_path):
reference="center",
)

model_params = ModelParams(
model_params = ModelOptions(
name="density",
background=0.0,
overburden=overburden_params,
Expand All @@ -68,7 +72,7 @@ def test_gravity_plate_simulation(tmp_path):
gravity_inversion = SimPEGGroup.create(ws)
gravity_inversion.options = options

params = PlateSimulationParams(
params = PlateSimulationOptions(
title="test",
run_command="run",
geoh5=ws,
Expand Down