GEOPY-2490: Parallelize batch 2D inversion#358
Conversation
# Conflicts: # simpeg_drivers-assets/uijson/direct_current_2d_forward.ui.json # simpeg_drivers-assets/uijson/direct_current_2d_inversion.ui.json # simpeg_drivers-assets/uijson/direct_current_batch2d_inversion.ui.json # simpeg_drivers-assets/uijson/induced_polarization_2d_forward.ui.json # simpeg_drivers-assets/uijson/induced_polarization_2d_inversion.ui.json # simpeg_drivers-assets/uijson/induced_polarization_batch2d_inversion.ui.json
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #358 +/- ##
===========================================
- Coverage 91.28% 90.76% -0.52%
===========================================
Files 120 112 -8
Lines 6652 6388 -264
Branches 806 787 -19
===========================================
- Hits 6072 5798 -274
- Misses 383 405 +22
+ Partials 197 185 -12
🚀 New features to boost your workflow:
|
benk-mira
left a comment
There was a problem hiding this comment.
Looks good, nice use of utilities for separation of concerns and documenting the drape model handling! Couple suggestions
Co-authored-by: benk-mira <81254271+benk-mira@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR (GEOPY-2490) refactors the 2D DC/IP inversion workflow by consolidating the "batch 2D" (pseudo-3D) approach into the standard 2D driver. Instead of running each survey line independently via a LineSweepDriver, the 2D drivers now internally handle multi-line surveys by creating a merged DrapeModel mesh and splitting tiles per line.
Changes:
- Removed the
LineSweepDriver,BaseBatch2DDriver, and all pseudo-3D option/driver classes, redirecting pseudo-3D inversion types to the 2D drivers with deprecation warnings. - Introduced
Base2DDriverandBase2DOptionsin a newelectricals/base_2d.pythat handles DrapeModel mesh creation per line and line-based tiling. - Refactored mesh/survey utilities (
drape_2_tensor,get_drape_model,compute_alongline_distance,get_parts_from_electrodes,create_mesh_by_line_id) and updated nested mesh creation to support 2D tensor meshes.
Reviewed changes
Copilot reviewed 53 out of 53 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
simpeg_drivers/electricals/base_2d.py |
New base class for 2D DC/IP drivers and options with pseudo-3D deprecation handling |
simpeg_drivers/electricals/driver.py |
Removed old Base2DDriver and BaseBatch2DDriver |
simpeg_drivers/electricals/options.py |
Removed; IPModelOptions moved to simpeg_drivers/options.py |
simpeg_drivers/line_sweep/driver.py |
Removed LineSweepDriver |
simpeg_drivers/options.py |
Added IPModelOptions, made LineSelectionOptions fields optional, updated gradient orientation handling |
simpeg_drivers/utils/utils.py |
Refactored drape_2_tensor for ghost prism handling, moved compute_alongline_distance, removed truncate_locs_depths |
simpeg_drivers/utils/surveys.py |
Added get_parts_from_electrodes, create_mesh_by_line_id, and related helpers |
simpeg_drivers/utils/nested.py |
Added create_nested_2d_tensor for 2D line-based tiling |
simpeg_drivers/components/data.py |
Refactored parts detection, drape location handling, line ID management |
simpeg_drivers/driver.py |
Updated tiling to split per line for 2D; removed SweepParams references |
simpeg_drivers/__init__.py |
Redirected pseudo-3D driver map entries to 2D drivers |
simpeg_drivers/utils/regularization.py |
direction_and_dip now returns Data objects instead of arrays |
simpeg_drivers/components/models.py |
Apply np.deg2rad to gradient direction/dip |
simpeg_drivers/components/factories/* |
Updated simulation/directive factories for 2D changes |
simpeg_drivers/utils/synthetics/* |
Refactored mesh factory, removed tensor mesh module, updated driver caching |
simpeg_drivers-assets/uijson/* |
Removed batch2D UI JSONs, updated 2D UI JSONs with optional line selection |
tests/run_tests/* |
Updated tests for new 2D workflow, removed batch2D tests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
# Conflicts: # simpeg_drivers/utils/synthetics/driver.py # simpeg_drivers/utils/synthetics/meshes.py # simpeg_drivers/utils/synthetics/meshes/factory.py
benk-mira
left a comment
There was a problem hiding this comment.
Couple small suggestions. I think I caught a couple of typing inconsistencies that mypy should have picked up - is it configured properly?
| ) | ||
| line_id: int | None = None | ||
| line_object: IntegerData | ReferencedData | None = None | ||
| property: ReferencedData | None = None |
There was a problem hiding this comment.
Can we name this 'line_selection' property is pretty vague
There was a problem hiding this comment.
No because it comes from the uijson directly, as defined by the form
GEOPY-2490: Parallelize batch 2D inversion