GEOPY-3040: Accept integer data type for weights and norm, and coerce to floats - #472
GEOPY-3040: Accept integer data type for weights and norm, and coerce to floats#472domfournier wants to merge 6 commits into
Conversation
# Conflicts: # environments/py-3.12-linux-64-dev.conda.lock.yml # environments/py-3.12-linux-64.conda.lock.yml # environments/py-3.12-win-64-dev.conda.lock.yml # environments/py-3.12-win-64.conda.lock.yml # environments/py-3.13-linux-64-dev.conda.lock.yml # environments/py-3.13-linux-64.conda.lock.yml # environments/py-3.13-win-64-dev.conda.lock.yml # environments/py-3.13-win-64.conda.lock.yml # py-3.12.conda-lock.yml # py-3.13.conda-lock.yml # pyproject.toml
There was a problem hiding this comment.
Pull request overview
This PR broadens SimPEG Drivers’ parameter handling so inversion/forward options and UI JSON schemas can accept IntegerData (in addition to FloatData) for weights/norms and other numeric model inputs, with test updates to exercise integer inputs.
Changes:
- Widened multiple Pydantic option types from
FloatDatatoFloatData | IntegerDataacross drivers/options (e.g., norms, bounds, length scales, reference/starting models). - Updated many
.ui.jsondefinitions to allow"dataType": ["Float", "Integer"]where numeric channels are selectable. - Updated tests and environment/dependency pins (pyproject + conda lockfiles) to align with the new typing/schema expectations.
Reviewed changes
Copilot reviewed 58 out of 58 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/run_tests/driver_rotated_gradients_test.py | Use integer dip/azimuth arrays to validate rotated-gradient inputs accept ints. |
| tests/run_tests/driver_grav_test.py | Add integer norms/length scales/reference model inputs in gravity run test. |
| simpeg_drivers/potential_fields/magnetic_vector/options.py | Allow IntegerData for vector model option fields; constrain inducing field params to scalar floats. |
| simpeg_drivers/potential_fields/magnetic_vector_pde/options.py | Allow IntegerData for PDE vector model option fields; constrain inducing field params to scalar floats. |
| simpeg_drivers/potential_fields/magnetic_scalar/options.py | Allow IntegerData for scalar magnetic model fields; constrain inducing field params to scalar floats. |
| simpeg_drivers/potential_fields/gravity/options.py | Allow IntegerData for gravity reference model option. |
| simpeg_drivers/plate_simulation/driver.py | Permit integer-valued model data for plate simulation driver _model. |
| simpeg_drivers/options.py | Expand core option type unions to include IntegerData for multiple numeric model parameters. |
| simpeg_drivers/joint/options.py | Expand joint model option unions to include IntegerData for bounds/norms/regularization inputs. |
| simpeg_drivers/joint/joint_surveys/options.py | Allow integer data for starting/reference models in joint surveys options. |
| simpeg_drivers/joint/joint_petrophysics/options.py | Allow integer data for alpha_s in joint petrophysics options; cleanup imports. |
| simpeg_drivers/electricals/base_2d.py | Allow integer data for 2D conductivity model option. |
| simpeg_drivers/depth_of_investigation/sensitivity_cutoff/options.py | Cleanup unused import (SimPEGGroup). |
| simpeg_drivers/components/topography.py | Coerce topography channel values to float when building locations. |
| simpeg_drivers-assets/uijson/tipper_inversion.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/tipper_forward.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/tdem1d_inversion.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/tdem1d_forward.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/tdem_inversion.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/tdem_forward.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/magnetotellurics_inversion.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/magnetotellurics_forward.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/magnetic_vector_pde_inversion.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/magnetic_vector_pde_forward.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/magnetic_vector_inversion.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/magnetic_vector_forward.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/magnetic_scalar_inversion.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/magnetic_scalar_forward.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/joint_surveys_inversion.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/joint_petrophysics_inversion.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/joint_cross_gradient_inversion.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/induced_polarization_3d_inversion.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/induced_polarization_3d_forward.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/induced_polarization_2d_inversion.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/induced_polarization_2d_forward.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/gravity_inversion.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/gravity_forward.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/fdem1d_inversion.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/fdem1d_forward.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/fdem_inversion.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/fdem_forward.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/direct_current_3d_inversion.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/direct_current_3d_forward.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/direct_current_2d_inversion.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/direct_current_2d_forward.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/apparent_conductivity_inversion.ui.json | Permit Integer channels where Float channels were previously required. |
| simpeg_drivers-assets/uijson/apparent_conductivity_forward.ui.json | Permit Integer channels where Float channels were previously required. |
| pyproject.toml | Switch several git dependencies to track develop. |
| py-3.13.conda-lock.yml | Update lockfile to reflect dependency rev changes and package resolution changes. |
| environments/py-3.13-win-64.conda.lock.yml | Update resolved environment for win-64 (py3.13). |
| environments/py-3.13-win-64-dev.conda.lock.yml | Update resolved dev environment for win-64 (py3.13). |
| environments/py-3.13-linux-64.conda.lock.yml | Update resolved environment for linux-64 (py3.13). |
| environments/py-3.13-linux-64-dev.conda.lock.yml | Update resolved dev environment for linux-64 (py3.13). |
| environments/py-3.12-win-64.conda.lock.yml | Update resolved environment for win-64 (py3.12). |
| environments/py-3.12-win-64-dev.conda.lock.yml | Update resolved dev environment for win-64 (py3.12). |
| environments/py-3.12-linux-64.conda.lock.yml | Update resolved environment for linux-64 (py3.12). |
| environments/py-3.12-linux-64-dev.conda.lock.yml | Update resolved dev environment for linux-64 (py3.12). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| # Model values for regularization | ||
| alpha_s: float | FloatData | None | None = None | ||
| length_scale_x: float | FloatData | None = None | ||
| length_scale_y: float | FloatData | None = None | ||
| length_scale_z: float | FloatData | None = None | ||
| alpha_s: float | FloatData | IntegerData | None | None = None | ||
| length_scale_x: float | FloatData | IntegerData | None = None |
| # geoh5py = {version = ">=0.14.0a, 0.14.*", source = "pypi", allow-prereleases = true} | ||
| geoh5py = {git = "https://github.com/MiraGeoscience/geoh5py.git", rev = "feature/uijson"} | ||
| geoh5py = {git = "https://github.com/MiraGeoscience/geoh5py.git", rev = "develop"} | ||
|
|
||
| # grid-apps = {version = ">=0.3.0a, 0.3.*", source = "pypi", allow-prereleases = true} | ||
| grid-apps = {git = "https://github.com/MiraGeoscience/grid-apps.git", rev = "GEOPY-2965"} | ||
| grid-apps = {git = "https://github.com/MiraGeoscience/grid-apps.git", rev = "develop"} | ||
|
|
||
| # geoapps-utils = {version = ">=0.8.0a, 0.8.*", source = "pypi", allow-prereleases = true} | ||
| geoapps-utils = {git = "https://github.com/MiraGeoscience/geoapps-utils.git", rev = "feature/uijson"} | ||
| geoapps-utils = {git = "https://github.com/MiraGeoscience/geoapps-utils.git", rev = "develop"} |
| @property | ||
| def gradient_direction(self) -> FloatData | None: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #472 +/- ##
===========================================
- Coverage 90.41% 90.41% -0.01%
===========================================
Files 113 113
Lines 6983 6982 -1
Branches 862 862
===========================================
- Hits 6314 6313 -1
Misses 452 452
Partials 217 217
🚀 New features to boost your workflow:
|
| "association": "Cell", | ||
| "dataType": "Float", | ||
| "dataType": [ | ||
| "Float", | ||
| "Integer" | ||
| ], |
There was a problem hiding this comment.
only the y_norm was updated in this form. Should the other norms, bounds, topography, weights also be changed from Float-only? I noticed similar thing in joint_cross_gradient, tdem inversion, forward fdem/tdem receiver orientations
| "dataType": [ | ||
| "Float", | ||
| "Integer" | ||
| ], |
There was a problem hiding this comment.
this form now allows Integer channels for conductivity_model, but ConductivityModelOptions.conductivity_model still accepts only float or FloatData. This seems to mean that all the IP forms therefore allow for selection of type Integer that will fail pydantic validation. Similar issue for IPModelOptions.lower_bound. Support for IntegerData should be added there and covered by a test/tests
GEOPY-3040 - Accept integer data type for weights and norm, and coerce to floats