Skip to content

Conversation

@Leguark
Copy link
Member

@Leguark Leguark commented Oct 26, 2025

Add magnetics (TMI) forward modeling to geophysics workflows

Introduce functionality for induced-only TMI anomaly computation using precomputed voxel-based TMI kernels and geologic unit susceptibilities. Updates include:

  • compute_tmi: Core TMI calculation logic based on magnetics kernel and voxel susceptibilities in fw_magnetic.py.
  • Extended GeophysicsInput to include magnetics-specific fields such as mag_kernel, susceptibilities, and igrf_params.
  • Modified model_api.py to integrate magnetics into geophysics workflows alongside gravity computations.
  • Updated solutions.py to include magnetics in forward modeling outputs.

Ensures magnetics functionality remains optional without impacting gravity workflows.

Additional changes

  • Updated model_api.py to make gravity computations conditional, enabling workflows without gravity inputs.
  • Modified GeophysicsInput to allow tz and densities as optional fields for magnetics-only workflows.
  • Added tmi alias property in solutions.py for Total Magnetic Intensity outputs.
  • Improved formatting in geophysics README for better readability.
  • Added analytical and symmetry benchmark tests for magnetics implementation validation.
  • Included placeholder magnetics gradient computation module with core physics for initial testing.

Copy link
Member Author

Leguark commented Oct 26, 2025

@Leguark Leguark changed the title [TEST] Add analytical and symmetry benchmark tests for magnetics [WIP] Add magnetic forward modeling with TMI calculation support Oct 26, 2025
@Leguark Leguark marked this pull request as ready for review October 26, 2025 13:24
@Leguark Leguark changed the title [WIP] Add magnetic forward modeling with TMI calculation support [ENH] Add magnetic forward modeling for Total Magnetic Intensity (TMI) calculation Oct 27, 2025
Copy link
Member Author

Leguark commented Oct 27, 2025

Merge activity

  • Oct 27, 12:51 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Oct 27, 12:56 PM UTC: Graphite rebased this pull request as part of a merge.
  • Oct 27, 12:59 PM UTC: @Leguark merged this pull request with Graphite.

@Leguark Leguark changed the base branch from magnetics to graphite-base/39 October 27, 2025 12:52
@Leguark Leguark changed the base branch from graphite-base/39 to main October 27, 2025 12:55
Introduce new test cases to validate the forthcoming magnetics implementation:

- Add analytical benchmark test comparing induced-only TMI against analytical solutions for a spherical anomaly.
- Add symmetry benchmark test to verify induced-only TMI spatial accuracy along a line profile.

Also include a placeholder magnetics gradient computation module (`magnetic_gradient.py`) with core physics for initial testing.
Introduce functionality for induced-only TMI anomaly computation using precomputed voxel-based TMI kernels and geologic unit susceptibilities. Updates include:

- `compute_tmi`: Core TMI calculation logic based on magnetics kernel and voxel susceptibilities in `fw_magnetic.py`.
- Extended `GeophysicsInput` to include magnetics-specific fields such as `mag_kernel`, `susceptibilities`, and `igrf_params`.
- Modified `model_api.py` to integrate magnetics into geophysics workflows alongside gravity computations.
- Updated `solutions.py` to include magnetics in forward modeling outputs.

Ensures magnetics functionality remains optional without impacting gravity workflows.
- Updated `model_api.py` to make gravity computations conditional, enabling workflows without gravity inputs.
- Modified `GeophysicsInput` to allow `tz` and `densities` as optional fields for magnetics-only workflows.
- Added `tmi` alias property in `solutions.py` for Total Magnetic Intensity outputs.
- Improved formatting in geophysics README for better readability.
…hts, unit handling, and output sign

- Adjust `observation_heights` for improved test consistency.
- Fix `units_nT` parameter to ensure correct unit handling in TMI computation.
- Correct output sign for numerical TMI results to align with analytical expectations.
- Introduced parametrized cases for directional cosines, path equivalence, and kernel decay.
- Added edge case tests for zero and negative susceptibilities.
- Validated kernel symmetry and kernel reusability with different IGRF configurations.
- Enhanced `CenteredGrid` with methods for voxel calculations.
…s and symmetry checks

- Adjust grid dimensions to account for resolution changes and ensure shape consistency.
- Add assertions for expected voxel counts to validate kernel reshaping.
- Update symmetry check orientation from slices to a more accurate coordinate axis.
…lidation

- Refined `test_kernel_decay_with_distance` to enhance clarity and correctness of magnetic anomaly decay behavior.
- Updated grid scaling and observation point handling for better volume coverage.
- Adjust
…edge cases and symmetry validation

- Introduced new test file `test_magnetic_benchmark_II.py` covering multiple scenarios:
  - Symmetry checks for TMI profiles.
  - Edge cases for zero and negative susceptibilities.
  - Observation distance decay validation.
  - Kernel property tests for symmetry and resolution.
- Enhanced and streamlined existing tests in `test_magnetic_benchmark.py`:
  - Adjusted formatting for clearer readability.
  - Updated comments and formulas for analytical benchmarks to improve documentation consistency.
@Leguark Leguark merged commit b49c6fa into main Oct 27, 2025
2 checks passed
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.

1 participant