From 84a43a5c8612965be0c0d4cb9820f4dce4bbdaed Mon Sep 17 00:00:00 2001 From: dominiquef Date: Tue, 13 May 2025 12:08:54 -0700 Subject: [PATCH 1/6] Catch renaming of fem, augment unit test --- simpeg_drivers/__init__.py | 7 ++++ .../components/factories/simpeg_factory.py | 1 + .../frequency_domain/options.py | 17 ++++++++-- tests/run_tests/driver_fem_test.py | 33 ++++++++++++++++++- 4 files changed, 55 insertions(+), 3 deletions(-) diff --git a/simpeg_drivers/__init__.py b/simpeg_drivers/__init__.py index f21dd96d..994e87f2 100644 --- a/simpeg_drivers/__init__.py +++ b/simpeg_drivers/__init__.py @@ -96,6 +96,13 @@ def assets_path() -> Path: "inversion": "FDEMInversionDriver", }, ), + "fem": ( + "simpeg_drivers.electromagnetics.frequency_domain.driver", + { + "forward": "FDEMForwardDriver", + "inversion": "FDEMInversionDriver", + }, + ), "fdem 1d": ( "simpeg_drivers.electromagnetics.frequency_domain_1d.driver", { diff --git a/simpeg_drivers/components/factories/simpeg_factory.py b/simpeg_drivers/components/factories/simpeg_factory.py index 8e2cf885..060513a3 100644 --- a/simpeg_drivers/components/factories/simpeg_factory.py +++ b/simpeg_drivers/components/factories/simpeg_factory.py @@ -57,6 +57,7 @@ class SimPEGFactory(ABC): "induced polarization 2d", "induced polarization pseudo 3d", "fdem", + "fem", "fdem 1d", "tdem", "tdem 1d", diff --git a/simpeg_drivers/electromagnetics/frequency_domain/options.py b/simpeg_drivers/electromagnetics/frequency_domain/options.py index 1660f8e2..261b7fa1 100644 --- a/simpeg_drivers/electromagnetics/frequency_domain/options.py +++ b/simpeg_drivers/electromagnetics/frequency_domain/options.py @@ -11,6 +11,7 @@ from __future__ import annotations +from logging import getLogger from pathlib import Path from typing import ClassVar, TypeAlias @@ -20,6 +21,7 @@ LargeLoopGroundFEMReceivers, MovingLoopGroundFEMReceivers, ) +from pydantic import field_validator from simpeg_drivers import assets_path from simpeg_drivers.options import BaseForwardOptions, BaseInversionOptions, EMDataMixin @@ -29,6 +31,8 @@ MovingLoopGroundFEMReceivers | LargeLoopGroundFEMReceivers | AirborneFEMReceivers ) +logger = getLogger(__name__) + class BaseFDEMOptions(EMDataMixin): """ @@ -37,6 +41,7 @@ class BaseFDEMOptions(EMDataMixin): physical_property: str = "conductivity" data_object: Receivers + inversion_type: str = "fdem" model_type: str = "Conductivity (S/m)" @property @@ -65,6 +70,16 @@ def unit_conversion(self): } return conversion[self.data_object.unit] + @field_validator("inversion_type", mode="before") + @classmethod + def name_change(cls, value: str): + if value == "fem": + logger.warning( + "Using 'fem' as inversion type is deprecated. Use 'fdem' instead." + ) + return "fdem" + return value + class FDEMForwardOptions(BaseFDEMOptions, BaseForwardOptions): """ @@ -77,7 +92,6 @@ class FDEMForwardOptions(BaseFDEMOptions, BaseForwardOptions): name: ClassVar[str] = "Frequency Domain Electromagnetics Forward" default_ui_json: ClassVar[Path] = assets_path() / "uijson/fdem_forward.ui.json" - inversion_type: str = "fdem" title: str = "Frequency-domain EM (FEM) Forward" z_real_channel_bool: bool @@ -97,7 +111,6 @@ class FDEMInversionOptions(BaseFDEMOptions, BaseInversionOptions): name: ClassVar[str] = "Frequency Domain Electromagnetics Inversion" default_ui_json: ClassVar[Path] = assets_path() / "uijson/fdem_inversion.ui.json" - inversion_type: str = "fdem" title: str = "Frequency-domain EM (FEM) Inversion" z_real_channel: PropertyGroup | None = None diff --git a/tests/run_tests/driver_fem_test.py b/tests/run_tests/driver_fem_test.py index 624c1719..b62d055f 100644 --- a/tests/run_tests/driver_fem_test.py +++ b/tests/run_tests/driver_fem_test.py @@ -12,6 +12,7 @@ from __future__ import annotations +import logging from pathlib import Path import numpy as np @@ -37,6 +38,33 @@ target_run = {"data_norm": 81.8361, "phi_d": 2160, "phi_m": 4010} +def test_fem_name_change(tmp_path, caplog): + # Run the forward + geoh5, _, model, survey, topography = setup_inversion_workspace( + tmp_path, + background=1e-3, + anomaly=1.0, + n_electrodes=2, + n_lines=2, + refinement=(2,), + drape_height=15.0, + padding_distance=400, + inversion_type="fdem", + ) + with caplog.at_level(logging.WARNING): + FDEMForwardOptions( + geoh5=geoh5, + mesh=model.parent, + active_cells=ActiveCellsOptions(topography_object=topography), + data_object=survey, + starting_model=model, + z_real_channel_bool=True, + z_imag_channel_bool=True, + inversion_type="fem", + ) + assert "fdem" in caplog.text + + def test_fem_fwr_run( tmp_path: Path, n_grid_points=3, @@ -174,7 +202,10 @@ def test_fem_run(tmp_path: Path, max_iterations=1, pytest=True): if __name__ == "__main__": # Full run test_fem_fwr_run( - Path("./"), n_grid_points=5, cell_size=(5.0, 5.0, 5.0), refinement=(4, 4, 4) + Path("./"), + n_grid_points=5, + cell_size=(5.0, 5.0, 5.0), + refinement=(4, 4, 4), ) test_fem_run( Path("./"), From 1f765fe12b82a510dc10bdd396cfd735fbac83fd Mon Sep 17 00:00:00 2001 From: dominiquef Date: Tue, 13 May 2025 12:09:46 -0700 Subject: [PATCH 2/6] Update fdem jsons --- simpeg_drivers-assets/uijson/fdem_forward.ui.json | 2 +- simpeg_drivers-assets/uijson/fdem_inversion.ui.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/simpeg_drivers-assets/uijson/fdem_forward.ui.json b/simpeg_drivers-assets/uijson/fdem_forward.ui.json index 5d6d3bda..0adc378e 100644 --- a/simpeg_drivers-assets/uijson/fdem_forward.ui.json +++ b/simpeg_drivers-assets/uijson/fdem_forward.ui.json @@ -8,7 +8,7 @@ "geoh5": "", "monitoring_directory": "", "workspace_geoh5": "", - "inversion_type": "fem", + "inversion_type": "fdem", "physical_property": "conductivity", "forward_only": true, "data_object": { diff --git a/simpeg_drivers-assets/uijson/fdem_inversion.ui.json b/simpeg_drivers-assets/uijson/fdem_inversion.ui.json index bea5ab96..5fc0cc05 100644 --- a/simpeg_drivers-assets/uijson/fdem_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/fdem_inversion.ui.json @@ -8,7 +8,7 @@ "geoh5": "", "monitoring_directory": "", "workspace_geoh5": "", - "inversion_type": "fem", + "inversion_type": "fdem", "physical_property": "conductivity", "forward_only": false, "data_object": { From 25b09c89a2e1896056d21d29fe0b22088854f299 Mon Sep 17 00:00:00 2001 From: dominiquef Date: Wed, 14 May 2025 12:23:23 -0700 Subject: [PATCH 3/6] Remove reference to x and y channels altogether --- simpeg_drivers-assets/uijson/tdem1d_forward.ui.json | 2 -- simpeg_drivers-assets/uijson/tdem1d_inversion.ui.json | 4 ---- simpeg_drivers/electromagnetics/time_domain_1d/options.py | 6 ------ 3 files changed, 12 deletions(-) diff --git a/simpeg_drivers-assets/uijson/tdem1d_forward.ui.json b/simpeg_drivers-assets/uijson/tdem1d_forward.ui.json index 79b03899..10cc1008 100644 --- a/simpeg_drivers-assets/uijson/tdem1d_forward.ui.json +++ b/simpeg_drivers-assets/uijson/tdem1d_forward.ui.json @@ -33,8 +33,6 @@ "tooltip": "Set the units of the data", "value": "dB/dt (T/s)" }, - "x_channel_bool": "", - "y_channel_bool": "", "z_channel_bool": { "group": "Survey", "main": true, diff --git a/simpeg_drivers-assets/uijson/tdem1d_inversion.ui.json b/simpeg_drivers-assets/uijson/tdem1d_inversion.ui.json index 52562dd3..0fcd8cc2 100644 --- a/simpeg_drivers-assets/uijson/tdem1d_inversion.ui.json +++ b/simpeg_drivers-assets/uijson/tdem1d_inversion.ui.json @@ -33,8 +33,6 @@ "tooltip": "Set the units of the data", "value": "dB/dt (T/s)" }, - "x_channel": "", - "y_channel": "", "z_channel": { "association": [ "Cell", @@ -50,8 +48,6 @@ "enabled": true, "value": "" }, - "x_uncertainty": "", - "y_uncertainty": "", "z_uncertainty": { "association": [ "Cell", diff --git a/simpeg_drivers/electromagnetics/time_domain_1d/options.py b/simpeg_drivers/electromagnetics/time_domain_1d/options.py index 257e52bd..02abce25 100644 --- a/simpeg_drivers/electromagnetics/time_domain_1d/options.py +++ b/simpeg_drivers/electromagnetics/time_domain_1d/options.py @@ -55,8 +55,6 @@ class TDEM1DForwardOptions(EMDataMixin, BaseForwardOptions): data_object: Receivers z_channel_bool: bool - x_channel_bool: None = None - y_channel_bool: None = None data_units: str = "dB/dt (T/s)" model_type: str = "Conductivity (S/m)" drape_model: DrapeModelOptions = DrapeModelOptions( @@ -103,10 +101,6 @@ class TDEM1DInversionOptions(EMDataMixin, BaseInversionOptions): data_object: Receivers z_channel: PropertyGroup | None = None z_uncertainty: PropertyGroup | None = None - x_channel: None = None - x_uncertainty: None = None - y_channel: None = None - y_uncertainty: None = None length_scale_y: None = None y_norm: None = None data_units: str = "dB/dt (T/s)" From 8b5ee27e1bf201f84ef27db5f236908d9d32e138 Mon Sep 17 00:00:00 2001 From: dominiquef Date: Wed, 14 May 2025 12:29:39 -0700 Subject: [PATCH 4/6] Remove old fem from factory_types --- simpeg_drivers/components/factories/simpeg_factory.py | 1 - 1 file changed, 1 deletion(-) diff --git a/simpeg_drivers/components/factories/simpeg_factory.py b/simpeg_drivers/components/factories/simpeg_factory.py index 060513a3..8e2cf885 100644 --- a/simpeg_drivers/components/factories/simpeg_factory.py +++ b/simpeg_drivers/components/factories/simpeg_factory.py @@ -57,7 +57,6 @@ class SimPEGFactory(ABC): "induced polarization 2d", "induced polarization pseudo 3d", "fdem", - "fem", "fdem 1d", "tdem", "tdem 1d", From 7abf14385e5958822f308b88e26212663e48c7d4 Mon Sep 17 00:00:00 2001 From: dominiquef Date: Wed, 14 May 2025 13:13:32 -0700 Subject: [PATCH 5/6] Delete old default_ui_json constant --- simpeg_drivers/constants.py | 594 ------------------------------------ 1 file changed, 594 deletions(-) delete mode 100644 simpeg_drivers/constants.py diff --git a/simpeg_drivers/constants.py b/simpeg_drivers/constants.py deleted file mode 100644 index d0fd5551..00000000 --- a/simpeg_drivers/constants.py +++ /dev/null @@ -1,594 +0,0 @@ -# ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' -# Copyright (c) 2025 Mira Geoscience Ltd. ' -# ' -# This file is part of simpeg-drivers package. ' -# ' -# simpeg-drivers is distributed under the terms and conditions of the MIT License ' -# (see LICENSE file at the root of this source code package). ' -# ' -# ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' - - -from __future__ import annotations - -from uuid import UUID - -from geoh5py.objects import Curve, Grid2D, Points, Surface - -import simpeg_drivers - - -default_ui_json = { - "documentation": "https://mirageoscience-simpeg-drivers.readthedocs-hosted.com/en/stable/intro.html", - "icon": "", - "forward_only": False, - "data_object": { - "main": True, - "group": "Data", - "label": "Object", - "meshType": [ - "{202C5DB1-A56D-4004-9CAD-BAAFD8899406}", - "{6A057FDC-B355-11E3-95BE-FD84A7FFCB88}", - "{F26FEBA3-ADED-494B-B9E9-B2BBCBE298E1}", - "{48F5054A-1C5C-4CA4-9048-80F36DC60A06}", - "{b020a277-90e2-4cd7-84d6-612ee3f25051}", - ], - "value": None, - "tooltip": "Select an object containing survey geometry and data for inversion.", - }, - "receivers_offset_z": { - "group": "Data pre-processing", - "label": "Z static offset", - "optional": True, - "enabled": False, - "value": 0.0, - "verbose": 3, - "visible": False, - }, - "receivers_radar_drape": { - "association": ["Cell", "Vertex"], - "dataType": "Float", - "group": "Data pre-processing", - "label": "Z radar offset", - "tooltip": "Apply a non-homogeneous offset to survey object from radar channel.", - "optional": True, - "parent": "data_object", - "value": "", - "enabled": False, - "verbose": 3, - "visible": False, - }, - "gps_receivers_offset": "", - "mesh": { - "group": "Mesh and models", - "main": True, - "label": "Mesh", - "meshType": "{4ea87376-3ece-438b-bf12-3479733ded46}", - "value": "", - "optional": True, - "enabled": False, - "tooltip": "Select a mesh for the inversion.", - }, - "starting_model": { - "association": ["Cell", "Vertex"], - "dataType": "Float", - "group": "Mesh and models", - "main": True, - "isValue": True, - "parent": "mesh", - "label": "Initial", - "property": "", - "value": 0.001, - "tooltip": "Select a model to start the inversion.", - }, - "reference_model": { - "association": ["Cell", "Vertex"], - "main": True, - "dataType": "Float", - "group": "Mesh and models", - "isValue": True, - "optional": True, - "enabled": False, - "parent": "mesh", - "label": "Reference", - "property": None, - "value": 0.0, - }, - "lower_bound": { - "association": ["Cell", "Vertex"], - "main": True, - "dataType": "Float", - "group": "Mesh and models", - "isValue": True, - "parent": "mesh", - "label": "Lower bound", - "property": "", - "optional": True, - "value": 1e-08, - "enabled": False, - "tooltip": "Minimum value that the model will contain after inversion.", - }, - "upper_bound": { - "association": ["Cell", "Vertex"], - "main": True, - "dataType": "Float", - "group": "Mesh and models", - "isValue": True, - "parent": "mesh", - "label": "Upper bound", - "property": "", - "optional": True, - "value": 100.0, - "enabled": False, - "tooltip": "Maximum value that the model will contain after inversion.", - }, - "topography_object": { - "main": True, - "group": "Topography", - "label": "Topography", - "meshType": [ - "{202c5db1-a56d-4004-9cad-baafd8899406}", - "{6a057fdc-b355-11e3-95be-fd84a7ffcb88}", - "{f26feba3-aded-494b-b9e9-b2bbcbe298e1}", - "{48f5054a-1c5c-4ca4-9048-80f36dc60a06}", - "{b020a277-90e2-4cd7-84d6-612ee3f25051}", - ], - "value": "", - "optional": True, - "enabled": True, - "tooltip": "Select a topography object to define the active cells for inversion.", - }, - "topography": { - "association": ["Vertex", "Cell"], - "dataType": "Float", - "group": "Topography", - "main": True, - "optional": True, - "enabled": False, - "label": "Elevation channel", - "tooltip": "Set elevation from channel. If not set the topography will be set from the geometry of the selected 'topography' object.", - "parent": "topography_object", - "dependency": "topography_object", - "dependencyType": "enabled", - "value": "", - "verbose": 2, - }, - "active_model": { - "association": "Cell", - "dataType": ["Referenced", "Boolean", "Integer"], - "group": "Topography", - "main": True, - "enabled": False, - "dependency": "topography_object", - "dependencyType": "disabled", - "label": "Active model", - "tooltip": "Provide the active cell boolean model directly if topography not set.", - "parent": "mesh", - "value": "", - }, - "output_tile_files": False, - "inversion_style": "voxel", - "alpha_s": { - "min": 0.0, - "group": "Regularization", - "label": "Reference weight", - "value": 1.0, - "tooltip": "Constant ratio compared to other weights. Larger values result in models that remain close to the reference model", - "dependency": "reference_model", - "dependencyType": "enabled", - "isValue": True, - "parent": "mesh", - "association": "Cell", - "dataType": "Float", - "property": "", - "enabled": False, - }, - "length_scale_x": { - "min": 0.0, - "group": "Regularization", - "label": "X-smoothness weight", - "tooltip": "Larger values relative to other smoothness weights will result in x biased smoothness", - "value": 1.0, - "isValue": True, - "parent": "mesh", - "association": "Cell", - "dataType": "Float", - "property": "", - "enabled": True, - }, - "length_scale_y": { - "min": 0.0, - "group": "Regularization", - "label": "Y-smoothness weight", - "tooltip": "Larger values relative to other smoothness weights will result in y biased smoothness", - "value": 1.0, - "isValue": True, - "parent": "mesh", - "association": "Cell", - "dataType": "Float", - "property": "", - "enabled": True, - }, - "length_scale_z": { - "min": 0.0, - "group": "Regularization", - "label": "Z-smoothness weight", - "tooltip": "Larger values relative to other smoothness weights will result in z biased smoothess", - "value": 1.0, - "isValue": True, - "parent": "mesh", - "association": "Cell", - "dataType": "Float", - "property": "", - "enabled": True, - }, - "s_norm": { - "association": "Cell", - "dataType": "Float", - "group": "Sparse/blocky model", - "label": "Smallness norm", - "isValue": True, - "parent": "mesh", - "property": "", - "value": 0.0, - "min": 0.0, - "max": 2.0, - "precision": 2, - "lineEdit": True, - "enabled": False, - "dependency": "reference_model", - "dependencyType": "enabled", - "tooltip": "Lp-norm used in the smallness term of the objective function.", - }, - "x_norm": { - "association": "Cell", - "dataType": "Float", - "group": "Sparse/blocky model", - "label": "X-smoothness norm", - "isValue": True, - "parent": "mesh", - "property": "", - "value": 2.0, - "min": 0.0, - "max": 2.0, - "precision": 2, - "lineEdit": False, - "enabled": True, - "tooltip": "Lp-norm used in the x-smoothness term of the objective function.", - }, - "y_norm": { - "association": "Cell", - "dataType": "Float", - "group": "Sparse/blocky model", - "label": "Y-smoothness norm", - "isValue": True, - "parent": "mesh", - "property": "", - "value": 2.0, - "min": 0.0, - "max": 2.0, - "precision": 2, - "lineEdit": False, - "enabled": True, - "tooltip": "Lp-norm used in the y-smoothness term of the objective function.", - }, - "z_norm": { - "association": "Cell", - "dataType": "Float", - "group": "Sparse/blocky model", - "label": "Z-smoothness norm", - "isValue": True, - "parent": "mesh", - "property": "", - "value": 2.0, - "min": 0.0, - "max": 2.0, - "precision": 2, - "lineEdit": False, - "enabled": True, - "tooltip": "Lp-norm used in the z-smoothness term of the objective function.", - }, - "gradient_type": { - "choiceList": ["total", "components"], - "group": "Sparse/blocky model", - "label": "Gradient type", - "value": "total", - "verbose": 3, - "tooltip": "Choose whether the IRLS weights for regularization terms are updated using total or partial gradients.", - }, - "max_irls_iterations": { - "min": 0, - "group": "Sparse/blocky model", - "label": "Maximum IRLS iterations", - "tooltip": "Incomplete Re-weighted Least Squares iterations for non-L2 problems", - "value": 25, - "enabled": True, - "verbose": 2, - }, - "starting_chi_factor": { - "group": "Sparse/blocky model", - "label": "IRLS start chi factor", - "enabled": True, - "value": 1.0, - "tooltip": "This chi factor will be used to determine the misfit threshold after which IRLS iterations begin.", - "verbose": 3, - }, - "chi_factor": { - "min": 0.1, - "max": 20.0, - "precision": 1, - "lineEdit": False, - "group": "Cooling schedule/target", - "label": "Chi factor", - "value": 1.0, - "enabled": True, - "tooltip": "The global target data misfit value.", - }, - "auto_scale_misfits": { - "group": "Cooling schedule/target", - "label": "Auto-scale misfits", - "value": True, - "verbose": 3, - "visible": True, - "tooltip": "Whether to auto-scale misfits functions (tile, frequency, joint methods) based on chi-factor.", - }, - "initial_beta_ratio": { - "min": 0.0, - "precision": 2, - "group": "Cooling schedule/target", - "optional": True, - "enabled": True, - "label": "Initial beta ratio", - "value": 10.0, - "verbose": 2, - "tooltip": "Estimate the trade-off parameter by scaling the ratio between the largest derivatives in the objective function gradients.", - }, - "initial_beta": { - "min": 0.0, - "group": "Cooling schedule/target", - "optional": True, - "enabled": False, - "dependency": "initial_beta_ratio", - "dependencyType": "disabled", - "label": "Initial beta", - "value": 1.0, - "verbose": 2, - "tooltip": "Trade-off parameter between data misfit and regularization.", - }, - "coolingFactor": { - "group": "Cooling schedule/target", - "label": "Beta cooling factor", - "tooltip": "Each beta cooling step will be calculated by dividing the current beta by this factor.", - "value": 2.0, - "min": 1.1, - "max": 100, - "precision": 1, - "lineEdit": False, - "verbose": 2, - }, - "coolingRate": { - "group": "Optimization", - "label": "Iterations per beta", - "value": 2, - "min": 1, - "LineEdit": False, - "max": 10, - "precision": 1, - "verbose": 2, - "enabled": True, - "tooltip": "Set the number of iterations per beta value. Use higher values for more non-linear optimization problems.", - }, - "max_global_iterations": { - "min": 1, - "lineEdit": False, - "group": "Optimization", - "label": "Maximum iterations", - "tooltip": "Number of L2 and IRLS iterations combined", - "value": 50, - "enabled": True, - }, - "max_line_search_iterations": { - "group": "Optimization", - "label": "Maximum number of line searches", - "value": 20, - "min": 1, - "enabled": True, - "verbose": 3, - "tooltip": "Perform an Armijo backtracking linesearch for the provided number of iterations.", - }, - "max_cg_iterations": { - "min": 0, - "group": "Optimization", - "label": "Maximum CG iterations", - "value": 30, - "enabled": True, - "verbose": 2, - }, - "tol_cg": { - "min": 0, - "group": "Optimization", - "label": "Conjugate gradient tolerance", - "value": 0.0001, - "enabled": True, - "verbose": 3, - }, - "f_min_change": { - "group": "Optimization", - "label": "Minimum change in objective function", - "value": 0.01, - "min": 1e-06, - "verbose": 3, - "enabled": True, - "tooltip": "Minimum decrease in regularization beyond which the IRLS procedure is deemed to have completed.", - }, - "beta_tol": { - "group": "Update IRLS directive", - "label": "Beta tolerance", - "value": 0.5, - "min": 0.0001, - "verbose": 3, - "visible": False, - }, - "prctile": { - "group": "Update IRLS directive", - "label": "Percentile", - "value": 95, - "max": 100, - "min": 5, - "verbose": 3, - "visible": False, - }, - "coolEps_q": { - "group": "Update IRLS directive", - "label": "Cool epsilon q", - "value": True, - "verbose": 3, - "visible": False, - }, - "coolEpsFact": { - "group": "Update IRLS directive", - "label": "Cool epsilon fact", - "value": 1.2, - "verbose": 3, - "visible": False, - }, - "beta_search": { - "group": "Update IRLS directive", - "label": "Perform beta search", - "value": False, - "verbose": 3, - "visible": False, - "tooltip": "Whether to perform a beta search.", - }, - "sens_wts_threshold": { - "group": "Update sensitivity weights directive", - "tooltip": "Update sensitivity weight threshold", - "label": "Threshold (%)", - "value": 1.0, - "max": 100.0, - "min": 0.0, - "precision": 3, - "enabled": True, - "verbose": 2, - }, - "every_iteration_bool": { - "group": "Update sensitivity weights directive", - "tooltip": "Update weights at every iteration", - "label": "Every iteration", - "value": True, - "verbose": 2, - "enabled": True, - }, - "parallelized": { - "group": "Compute", - "label": "Use parallelization", - "value": True, - "visible": False, - }, - "n_cpu": { - "min": 1, - "group": "Compute", - "dependency": "parallelized", - "dependencyType": "enabled", - "optional": True, - "enabled": False, - "label": "Number of CPUs", - "value": 1, - "visible": False, - }, - "tile_spatial": { - "group": "Compute", - "label": "Number of tiles", - "parent": "data_object", - "isValue": True, - "property": "", - "value": 1, - "min": 1, - "max": 1000, - "verbose": 2, - "tooltip": "Splits the objective function into spatial tiles for distributed computation using the Dask library.", - }, - "store_sensitivities": { - "choiceList": ["disk", "ram"], - "group": "Compute", - "label": "Storage device", - "tooltip": "Use disk on a fast local SSD, and RAM elsewhere", - "value": "ram", - }, - "save_sensitivities": { - "group": "Update sensitivity weights directive", - "label": "Save sensitivities", - "tooltip": "Save the summed square row sensitivities to geoh5.", - "value": False, - }, - "max_chunk_size": { - "min": 0, - "group": "Compute", - "optional": True, - "enabled": True, - "label": "Maximum chunk size (Mb)", - "value": 128, - "verbose": 3, - "visible": False, - "tooltip": "Limit the chunk size used by Dask for distributed computation.", - }, - "chunk_by_rows": { - "group": "Compute", - "label": "Chunk by rows", - "value": True, - "verbose": 3, - "visible": False, - }, - "out_group": { - "label": "SimPEG group", - "value": "", - "groupType": "{55ed3daf-c192-4d4b-a439-60fa987fe2b8}", - "group": "Drag-and-drop options", - "visible": True, - "optional": True, - "enabled": False, - "tooltip": "Optionally set the SimPEG group to which results will be saved.", - }, - "generate_sweep": { - "label": "Generate sweep file", - "group": "Python run preferences", - "main": True, - "value": False, - "tooltip": "Generates a file for sweeping parameters instead of running the application.", - }, - "fix_aspect_ratio": True, - "colorbar": False, - "ga_group": None, - "max_ram": None, - "monitoring_directory": None, - "workspace_geoh5": None, - "geoh5": None, - "run_command": "simpeg_drivers.driver", - "run_command_boolean": None, - "conda_environment": "simpeg_drivers", - "distributed_workers": None, - "version": simpeg_drivers.__version__, -} - -######################## Validations ########################### - -validations = { - "topography_object": { - "types": [str, UUID, Surface, Points, Grid2D, Curve, type(None)], - }, - "alpha_s": {"types": [int, float]}, - "length_scale_x": {"types": [int, float]}, - "length_scale_y": {"types": [int, float]}, - "length_scale_z": {"types": [int, float]}, - "norm_s": {"types": [int, float]}, - "norm_x": {"types": [int, float]}, - "norm_y": {"types": [int, float]}, - "norm_z": {"types": [int, float]}, - "distributed_workers": {"types": [str, type(None)]}, - "ga_group": {"types": [str, type(None)]}, - "version": { - "types": [ - str, - ] - }, -} From a24417430e1dd61aba13238fcd4645434d8f11db Mon Sep 17 00:00:00 2001 From: dominiquef Date: Wed, 14 May 2025 13:19:42 -0700 Subject: [PATCH 6/6] Remove from init --- simpeg_drivers/__init__.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/simpeg_drivers/__init__.py b/simpeg_drivers/__init__.py index 994e87f2..b78605d7 100644 --- a/simpeg_drivers/__init__.py +++ b/simpeg_drivers/__init__.py @@ -18,16 +18,10 @@ import logging from pathlib import Path -from simpeg_drivers.constants import default_ui_json - logging.basicConfig(level=logging.INFO) -__all__ = [ - "DRIVER_MAP", - "assets_path", - "default_ui_json", -] +__all__ = ["DRIVER_MAP", "assets_path"] def assets_path() -> Path: