Skip to content

GEOPY-3040: Accept integer data type for weights and norm, and coerce to floats - #472

Open
domfournier wants to merge 6 commits into
developfrom
GEOPY-3040
Open

GEOPY-3040: Accept integer data type for weights and norm, and coerce to floats#472
domfournier wants to merge 6 commits into
developfrom
GEOPY-3040

Conversation

@domfournier

@domfournier domfournier commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

GEOPY-3040 - Accept integer data type for weights and norm, and coerce to floats

# 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
Copilot AI lite review requested due to automatic review settings August 26, 2026 19:29
@github-actions github-actions Bot changed the title GEOPY-3040 GEOPY-3040: Accept integer data type for weights and norm, and coerce to floats Aug 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 FloatData to FloatData | IntegerData across drivers/options (e.g., norms, bounds, length scales, reference/starting models).
  • Updated many .ui.json definitions 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.

Comment on lines 39 to +41
# 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
Comment thread pyproject.toml
Comment on lines 96 to +103
# 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"}
Comment thread simpeg_drivers/options.py
Comment on lines 284 to 285
@property
def gradient_direction(self) -> FloatData | None:
@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.48485% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.41%. Comparing base (b5389d8) to head (5fadc6b).

Files with missing lines Patch % Lines
simpeg_drivers/components/topography.py 0.00% 1 Missing ⚠️
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              
Files with missing lines Coverage Δ
...pth_of_investigation/sensitivity_cutoff/options.py 92.59% <100.00%> (ø)
simpeg_drivers/electricals/base_2d.py 98.09% <100.00%> (ø)
simpeg_drivers/joint/joint_petrophysics/options.py 100.00% <100.00%> (ø)
simpeg_drivers/joint/joint_surveys/options.py 93.54% <100.00%> (ø)
simpeg_drivers/joint/options.py 100.00% <100.00%> (ø)
simpeg_drivers/options.py 95.94% <100.00%> (ø)
simpeg_drivers/plate_simulation/driver.py 88.65% <100.00%> (ø)
simpeg_drivers/potential_fields/gravity/options.py 100.00% <100.00%> (ø)
...rivers/potential_fields/magnetic_scalar/options.py 100.00% <100.00%> (ø)
...rivers/potential_fields/magnetic_vector/options.py 100.00% <100.00%> (ø)
... and 2 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmcga
gmcga self-requested a review August 28, 2026 18:20
Comment on lines 289 to +293
"association": "Cell",
"dataType": "Float",
"dataType": [
"Float",
"Integer"
],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +115 to +118
"dataType": [
"Float",
"Integer"
],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants