Skip to content

GEOPY-2758: Implement direct run_commands to specific modules for forwards and inversions#363

Open
domfournier wants to merge 21 commits intodevelopfrom
GEOPY-2758
Open

GEOPY-2758: Implement direct run_commands to specific modules for forwards and inversions#363
domfournier wants to merge 21 commits intodevelopfrom
GEOPY-2758

Conversation

@domfournier
Copy link
Collaborator

@domfournier domfournier commented Mar 20, 2026

GEOPY-2758 - Implement direct run_commands to specific modules for forwards and inversions

Copilot AI review requested due to automatic review settings March 20, 2026 20:38
@github-actions github-actions bot changed the title GEOPY-2758 GEOPY-2758: Implement direct run_commands to specific modules for forwards and inversions Mar 20, 2026
Copy link

Copilot AI left a comment

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 refactors driver/module entrypoints and option metadata across simpeg_drivers, aligning each method’s UI JSON run_command with new dedicated forward/inversion modules, while introducing a unified 2D DC/IP drape-mesh workflow (and deprecating/removing pseudo-3D batch drivers). Tests are updated accordingly to use the new imports, drivers, and 2D meshing behavior.

Changes:

  • Split multiple methods into explicit forward.py / inversion.py entrypoints and update package __init__ exports and UI JSON run_command fields.
  • Introduce/standardize 2D DC/IP behavior via a new Base2DDriver/Base2DOptions and utilities for line-part inference + drape mesh creation/merging.
  • Update and prune tests/run-tests to use the new driver imports and revised 2D/legacy behaviors (including removal of batch-2D test modules).

Reviewed changes

Copilot reviewed 176 out of 176 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/utils_surveys_test.py Adds tests for electrode part extraction and drape mesh creation by line id.
tests/utils_regularization_test.py Updates orientation conversion test to use direction_and_dip with geoh5 property groups.
tests/uijson_test.py Adjusts legacy uijson driver loading and asserts new warnings/mesh option handling.
tests/topography_test.py Updates MVI option class import/name to MagneticVectorInversionOptions.
tests/run_tests/sensitivity_cutoff_test.py Updates gravity imports to new package exports.
tests/run_tests/oriented_fem_receiver_test.py Updates FDEM driver/options imports to new package exports.
tests/run_tests/oriented_airborne_tem_receiver_test.py Updates TDEM driver/options imports to new package exports.
tests/run_tests/driver_tipper_test.py Updates tipper imports to new package exports.
tests/run_tests/driver_tile_estimator_test.py Updates magnetic scalar imports to new package exports.
tests/run_tests/driver_rotated_gradients_test.py Updates gravity imports to new package exports.
tests/run_tests/driver_mvi_test.py Renames MVI drivers/options to MagneticVector equivalents and updates imports.
tests/run_tests/driver_mt_test.py Updates MT imports to new package exports.
tests/run_tests/driver_mag_test.py Updates magnetic scalar imports to new package exports.
tests/run_tests/driver_mag_automesh_test.py Updates magnetic scalar forward driver import path.
tests/run_tests/driver_joint_surveys_test.py Updates driver imports and gravity forward driver usage in joint survey tests.
tests/run_tests/driver_joint_pgi_homogeneous_test.py Refactors homogeneous PGI test to reuse forward-run artifacts and updated driver imports.
tests/run_tests/driver_joint_cross_gradient_test.py Refactors joint cross-gradient test to reuse forward-run artifacts and updated driver imports; updates target values.
tests/run_tests/driver_ip_test.py Updates IP3D driver/options imports to new package exports.
tests/run_tests/driver_ip_b2d_test.py Removes pseudo-3D batch IP test module.
tests/run_tests/driver_ip_2d_test.py Switches IP2D tests to drape-mesh workflow and uncertainty data objects.
tests/run_tests/driver_ground_tem_test.py Updates TEM imports and adjusts expected transmitter id property name.
tests/run_tests/driver_grav_test.py Updates gravity imports to new package exports.
tests/run_tests/driver_dc_test.py Updates DC3D imports and changes mesh assertion to fixed cell count.
tests/run_tests/driver_dc_b2d_test.py Removes pseudo-3D batch DC test module.
tests/run_tests/driver_app_con_test.py Updates apparent conductivity imports to new package exports.
tests/run_tests/driver_airborne_tem_test.py Updates TEM imports to new package exports.
tests/run_tests/driver_airborne_tem_1d_test.py Updates TEM-1D imports to new package exports.
tests/run_tests/driver_airborne_fem_test.py Updates FEM imports to new package exports.
tests/run_tests/driver_airborne_fem_1d_test.py Updates FEM-1D imports to new package exports.
tests/run_tests/driver_2d_rotated_gradients_test.py Removes a rotated-gradients 2D run-test module.
tests/plate_simulation/runtest/match_test.py Updates TDEM forward imports to new package exports.
tests/plate_simulation/runtest/driver_test.py Removes unused Workspace import.
tests/models_test.py Updates magnetic vector driver/options imports and type annotations.
tests/meshes_test.py Updates magnetic vector driver/options imports and type annotations.
tests/locations_test.py Updates magnetic vector options import and type annotations.
tests/driver_test.py Updates gravity imports to new package exports.
tests/data_test.py Updates magnetic vector imports and option type annotations.
simpeg_drivers/utils/synthetics/topography.py Extends mesh extent calculation to accept drape model options.
simpeg_drivers/utils/synthetics/options.py Allows synthetics mesh option to be either MeshOptions or DrapeModelOptions.
simpeg_drivers/utils/synthetics/meshes/tensors.py Removes old tensor-mesh drape model helper.
simpeg_drivers/utils/synthetics/meshes/factory.py Removes old mesh factory in favor of consolidated meshes.py.
simpeg_drivers/utils/synthetics/meshes/init.py Removes now-empty package init.
simpeg_drivers/utils/synthetics/meshes.py Adds 2D mesh creation path using create_mesh_by_line_id.
simpeg_drivers/utils/synthetics/driver.py Refactors synthetics component getters and switches mesh lookup to "mesh".
simpeg_drivers/utils/surveys.py Adds electrode-part inference and drape mesh creation/merge utilities.
simpeg_drivers/utils/regularization.py Replaces ensure_dip_direction_convention with direction_and_dip returning geoh5 Data objects.
simpeg_drivers/utils/nested.py Refactors nested mesh creation (incl. 2D tensor nesting) and propagates line_ids into tiled surveys.
simpeg_drivers/potential_fields/magnetic_vector/options.py Renames MVI option classes and adds explicit run_command.
simpeg_drivers/potential_fields/magnetic_vector/inversion.py Defines magnetic vector inversion driver entrypoint module.
simpeg_drivers/potential_fields/magnetic_vector/forward.py Adds magnetic vector forward driver entrypoint module.
simpeg_drivers/potential_fields/magnetic_vector/init.py Exports forward/inversion drivers and renamed options.
simpeg_drivers/potential_fields/magnetic_scalar/options.py Adds explicit run_command for magnetic scalar forward/inversion options.
simpeg_drivers/potential_fields/magnetic_scalar/inversion.py Defines magnetic scalar inversion driver entrypoint module.
simpeg_drivers/potential_fields/magnetic_scalar/forward.py Adds magnetic scalar forward driver entrypoint module.
simpeg_drivers/potential_fields/magnetic_scalar/init.py Exports forward/inversion drivers and options.
simpeg_drivers/potential_fields/gravity/uijson.py Removes legacy gravity UIJson model classes.
simpeg_drivers/potential_fields/gravity/options.py Adds explicit run_command for gravity forward/inversion options.
simpeg_drivers/potential_fields/gravity/inversion.py Defines gravity inversion driver entrypoint module.
simpeg_drivers/potential_fields/gravity/forward.py Adds gravity forward driver entrypoint module.
simpeg_drivers/potential_fields/gravity/init.py Exports forward/inversion drivers and options.
simpeg_drivers/potential_fields/init.py Removes re-exports of PF options to favor per-method modules.
simpeg_drivers/plate_simulation/sweep/options.py Converts title/run_command from ClassVar to instance fields.
simpeg_drivers/plate_simulation/sweep/driver.py Refactors sweep driver to use geoapps Driver and new client/worker validation.
simpeg_drivers/plate_simulation/options.py Updates magnetic vector forward option mapping and converts title/run_command to instance fields.
simpeg_drivers/plate_simulation/match/driver.py Refactors match driver to use geoapps Driver and shared parallelization defaults.
simpeg_drivers/plate_simulation/driver.py Refactors plate simulation driver to use geoapps Driver and shared client/worker validation.
simpeg_drivers/options.py Refactors gradient-rotation orientation handling and expands line selection structure; moves IPModelOptions here.
simpeg_drivers/natural_sources/tipper/options.py Adds explicit run_command for tipper forward/inversion options.
simpeg_drivers/natural_sources/tipper/inversion.py Defines tipper inversion driver entrypoint module.
simpeg_drivers/natural_sources/tipper/forward.py Adds tipper forward driver entrypoint module.
simpeg_drivers/natural_sources/tipper/init.py Exports forward/inversion drivers and options.
simpeg_drivers/natural_sources/magnetotellurics/options.py Adds explicit run_command for MT forward/inversion options.
simpeg_drivers/natural_sources/magnetotellurics/inversion.py Defines MT inversion driver entrypoint module.
simpeg_drivers/natural_sources/magnetotellurics/forward.py Adds MT forward driver entrypoint module.
simpeg_drivers/natural_sources/magnetotellurics/init.py Exports forward/inversion drivers and options.
simpeg_drivers/natural_sources/apparent_conductivity/options.py Adds explicit run_command for AppCon forward/inversion options.
simpeg_drivers/natural_sources/apparent_conductivity/inversion.py Defines AppCon inversion driver entrypoint module.
simpeg_drivers/natural_sources/apparent_conductivity/forward.py Adds AppCon forward driver entrypoint module.
simpeg_drivers/natural_sources/apparent_conductivity/init.py Exports forward/inversion drivers and options.
simpeg_drivers/line_sweep/init.py Removes empty init file.
simpeg_drivers/joint/joint_surveys/options.py Adds explicit run_command for joint surveys.
simpeg_drivers/joint/joint_petrophysics/options.py Adds explicit run_command for joint petrophysics.
simpeg_drivers/joint/joint_cross_gradient/options.py Adds explicit run_command for joint cross-gradient.
simpeg_drivers/joint/driver.py Removes a duplicate/overridden run() implementation (delegating to base).
simpeg_drivers/electromagnetics/time_domain/options.py Adds explicit run_command for TDEM forward/inversion options.
simpeg_drivers/electromagnetics/time_domain/inversion.py Defines TDEM inversion driver entrypoint module.
simpeg_drivers/electromagnetics/time_domain/forward.py Adds TDEM forward driver entrypoint module.
simpeg_drivers/electromagnetics/time_domain/init.py Exports forward/inversion drivers and options.
simpeg_drivers/electromagnetics/time_domain_1d/options.py Adds explicit run_command for TDEM-1D forward/inversion options.
simpeg_drivers/electromagnetics/time_domain_1d/inversion.py Adds TDEM-1D inversion driver entrypoint module.
simpeg_drivers/electromagnetics/time_domain_1d/forward.py Refactors TDEM-1D forward driver to ForwardDriver + adds CLI entrypoint.
simpeg_drivers/electromagnetics/time_domain_1d/init.py Exports forward/inversion drivers and options.
simpeg_drivers/electromagnetics/frequency_domain/options.py Adds explicit run_command for FDEM forward/inversion options.
simpeg_drivers/electromagnetics/frequency_domain/inversion.py Defines FDEM inversion driver entrypoint module.
simpeg_drivers/electromagnetics/frequency_domain/forward.py Adds FDEM forward driver entrypoint module.
simpeg_drivers/electromagnetics/frequency_domain/init.py Exports forward/inversion drivers and options.
simpeg_drivers/electromagnetics/frequency_domain_1d/options.py Adds explicit run_command for FDEM-1D forward/inversion options and fixes docstring.
simpeg_drivers/electromagnetics/frequency_domain_1d/inversion.py Adds FDEM-1D inversion driver entrypoint module.
simpeg_drivers/electromagnetics/frequency_domain_1d/forward.py Refactors FDEM-1D forward driver to ForwardDriver + adds CLI entrypoint.
simpeg_drivers/electromagnetics/frequency_domain_1d/init.py Exports forward/inversion drivers and options.
simpeg_drivers/electromagnetics/base_1d_driver.py Refactors 1D base driver to use BaseDriver and shared tiling/parallel defaults.
simpeg_drivers/electricals/options.py Removes duplicate IPModelOptions/file control definitions (moved elsewhere).
simpeg_drivers/electricals/induced_polarization/two_dimensions/options.py Switches IP2D options to use new Base2DOptions and IPModelOptions from core options.
simpeg_drivers/electricals/induced_polarization/two_dimensions/inversion.py Adds IP2D inversion driver entrypoint module.
simpeg_drivers/electricals/induced_polarization/two_dimensions/forward.py Refactors IP2D forward driver to ForwardDriver + adds CLI entrypoint.
simpeg_drivers/electricals/induced_polarization/two_dimensions/init.py Exports forward/inversion drivers and options.
simpeg_drivers/electricals/induced_polarization/three_dimensions/options.py Updates import source for IPModelOptions.
simpeg_drivers/electricals/induced_polarization/three_dimensions/inversion.py Defines IP3D inversion driver entrypoint module.
simpeg_drivers/electricals/induced_polarization/three_dimensions/forward.py Refactors IP3D forward driver to ForwardDriver + adds CLI entrypoint.
simpeg_drivers/electricals/induced_polarization/three_dimensions/init.py Exports forward/inversion drivers and options.
simpeg_drivers/electricals/induced_polarization/pseudo_three_dimensions/options.py Removes pseudo-3D IP batch options.
simpeg_drivers/electricals/induced_polarization/pseudo_three_dimensions/driver.py Removes pseudo-3D IP batch drivers.
simpeg_drivers/electricals/direct_current/two_dimensions/options.py Switches DC2D options to use new Base2DOptions.
simpeg_drivers/electricals/direct_current/two_dimensions/inversion.py Adds DC2D inversion driver entrypoint module.
simpeg_drivers/electricals/direct_current/two_dimensions/forward.py Adds DC2D forward driver entrypoint module.
simpeg_drivers/electricals/direct_current/two_dimensions/init.py Exports forward/inversion drivers and options.
simpeg_drivers/electricals/direct_current/three_dimensions/options.py Adds explicit run_command for DC3D forward/inversion options.
simpeg_drivers/electricals/direct_current/three_dimensions/inversion.py Defines DC3D inversion driver entrypoint module.
simpeg_drivers/electricals/direct_current/three_dimensions/forward.py Adds DC3D forward driver entrypoint module.
simpeg_drivers/electricals/direct_current/three_dimensions/init.py Exports forward/inversion drivers and options.
simpeg_drivers/electricals/direct_current/pseudo_three_dimensions/options.py Removes pseudo-3D DC batch options.
simpeg_drivers/electricals/direct_current/pseudo_three_dimensions/driver.py Removes pseudo-3D DC batch drivers.
simpeg_drivers/electricals/base_2d.py Introduces base 2D driver/options with drape mesh creation and line selection/tiling.
simpeg_drivers/components/windows.py Removes InversionWindow implementation.
simpeg_drivers/components/topography.py Extends active cell logic to include pseudo-3D naming and adjusts 2D/pseudo handling.
simpeg_drivers/components/models.py Converts gradient direction/dip models to radians on access.
simpeg_drivers/components/factories/simulation_factory.py Removes pseudo-3D simulation type routing in the factory.
simpeg_drivers/components/factories/receiver_factory.py Adapts to direction_and_dip returning geoh5 Data objects.
simpeg_drivers/components/factories/directives_factory.py Handles missing inversion objects, expands ghost handling to 2D, and reshapes data with NaNs.
simpeg_drivers/components/data.py Moves electrode-part logic to shared utility and adds 2D line_ids propagation for tiling.
simpeg_drivers/components/init.py Removes InversionWindow export.
simpeg_drivers/init.py Updates DRIVER_MAP module paths to new package exports and maps pseudo-3D names to 2D drivers.
simpeg_drivers-assets/uijson/tipper_inversion.ui.json Updates run_command to method-specific inversion module.
simpeg_drivers-assets/uijson/tipper_forward.ui.json Updates run_command to method-specific forward module.
simpeg_drivers-assets/uijson/tdem1d_inversion.ui.json Updates run_command to method-specific inversion module.
simpeg_drivers-assets/uijson/tdem1d_forward.ui.json Updates run_command to method-specific forward module.
simpeg_drivers-assets/uijson/tdem_inversion.ui.json Updates run_command to method-specific inversion module.
simpeg_drivers-assets/uijson/tdem_forward.ui.json Updates run_command to method-specific forward module.
simpeg_drivers-assets/uijson/plate_sweep.ui.json Updates run_command field and removes redundant metadata fields.
simpeg_drivers-assets/uijson/plate_simulation.ui.json Updates run_command field and removes redundant metadata fields.
simpeg_drivers-assets/uijson/plate_match.ui.json Removes redundant top-level metadata fields from the UI JSON.
simpeg_drivers-assets/uijson/magnetotellurics_inversion.ui.json Updates run_command to method-specific inversion module.
simpeg_drivers-assets/uijson/magnetotellurics_forward.ui.json Updates run_command to method-specific forward module.
simpeg_drivers-assets/uijson/magnetic_vector_inversion.ui.json Updates run_command to method-specific inversion module.
simpeg_drivers-assets/uijson/magnetic_vector_forward.ui.json Updates run_command to method-specific forward module.
simpeg_drivers-assets/uijson/magnetic_scalar_inversion.ui.json Updates run_command to method-specific inversion module.
simpeg_drivers-assets/uijson/magnetic_scalar_forward.ui.json Updates run_command to method-specific forward module.
simpeg_drivers-assets/uijson/joint_surveys_inversion.ui.json Updates run_command to joint driver module.
simpeg_drivers-assets/uijson/joint_petrophysics_inversion.ui.json Updates run_command to joint driver module.
simpeg_drivers-assets/uijson/joint_cross_gradient_inversion.ui.json Updates run_command to joint driver module.
simpeg_drivers-assets/uijson/induced_polarization_batch2d_forward.ui.json Removes legacy batch-2D IP UI JSON.
simpeg_drivers-assets/uijson/induced_polarization_3d_inversion.ui.json Updates run_command to method-specific inversion module.
simpeg_drivers-assets/uijson/induced_polarization_3d_forward.ui.json Updates run_command to method-specific forward module.
simpeg_drivers-assets/uijson/induced_polarization_2d_inversion.ui.json Updates run_command and migrates line selection schema.
simpeg_drivers-assets/uijson/induced_polarization_2d_forward.ui.json Updates run_command and migrates line selection schema.
simpeg_drivers-assets/uijson/gravity_inversion.ui.json Updates run_command to method-specific inversion module.
simpeg_drivers-assets/uijson/gravity_forward.ui.json Updates run_command to method-specific forward module.
simpeg_drivers-assets/uijson/fdem1d_inversion.ui.json Updates run_command to method-specific inversion module.
simpeg_drivers-assets/uijson/fdem1d_forward.ui.json Updates run_command to method-specific forward module.
simpeg_drivers-assets/uijson/fdem_inversion.ui.json Updates run_command to method-specific inversion module.
simpeg_drivers-assets/uijson/fdem_forward.ui.json Updates run_command to method-specific forward module.
simpeg_drivers-assets/uijson/direct_current_batch2d_forward.ui.json Removes legacy batch-2D DC UI JSON.
simpeg_drivers-assets/uijson/direct_current_3d_inversion.ui.json Updates run_command to method-specific inversion module.
simpeg_drivers-assets/uijson/direct_current_3d_forward.ui.json Updates run_command to method-specific forward module.
simpeg_drivers-assets/uijson/direct_current_2d_inversion.ui.json Updates run_command and migrates line selection schema.
simpeg_drivers-assets/uijson/direct_current_2d_forward.ui.json Updates run_command and migrates line selection schema.
simpeg_drivers-assets/uijson/apparent_conductivity_inversion.ui.json Updates run_command to method-specific inversion module.
simpeg_drivers-assets/uijson/apparent_conductivity_forward.ui.json Updates run_command to method-specific forward module.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 73.73573% with 161 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.85%. Comparing base (a9a6e21) to head (faf805d).

Files with missing lines Patch % Lines
simpeg_drivers/driver.py 72.54% 44 Missing and 12 partials ⚠️
simpeg_drivers/utils/utils.py 61.53% 10 Missing ⚠️
...tricals/direct_current/three_dimensions/forward.py 70.00% 2 Missing and 1 partial ⚠️
...icals/direct_current/three_dimensions/inversion.py 57.14% 2 Missing and 1 partial ⚠️
...ectricals/direct_current/two_dimensions/forward.py 62.50% 2 Missing and 1 partial ⚠️
...tricals/direct_current/two_dimensions/inversion.py 72.72% 2 Missing and 1 partial ⚠️
...s/induced_polarization/three_dimensions/forward.py 70.00% 2 Missing and 1 partial ⚠️
...induced_polarization/three_dimensions/inversion.py 57.14% 2 Missing and 1 partial ⚠️
...als/induced_polarization/two_dimensions/forward.py 62.50% 2 Missing and 1 partial ⚠️
...s/induced_polarization/two_dimensions/inversion.py 72.72% 2 Missing and 1 partial ⚠️
... and 25 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #363      +/-   ##
===========================================
- Coverage    90.78%   89.85%   -0.93%     
===========================================
  Files          112      125      +13     
  Lines         6389     6435      +46     
  Branches       787      794       +7     
===========================================
- Hits          5800     5782      -18     
- Misses         405      449      +44     
- Partials       184      204      +20     
Files with missing lines Coverage Δ
simpeg_drivers/__init__.py 88.88% <ø> (ø)
simpeg_drivers/components/__init__.py 100.00% <ø> (ø)
simpeg_drivers/components/locations.py 85.07% <ø> (-0.44%) ⬇️
simpeg_drivers/electricals/base_2d.py 97.10% <100.00%> (ø)
...ricals/direct_current/three_dimensions/__init__.py 100.00% <100.00%> (ø)
...tricals/direct_current/three_dimensions/options.py 100.00% <100.00%> (ø)
...ctricals/direct_current/two_dimensions/__init__.py 100.00% <100.00%> (ø)
.../induced_polarization/three_dimensions/__init__.py 100.00% <100.00%> (ø)
...ls/induced_polarization/two_dimensions/__init__.py 100.00% <100.00%> (ø)
...vers/electromagnetics/frequency_domain/__init__.py 100.00% <100.00%> (ø)
... and 64 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants