Skip to content

Conversation

@Leguark
Copy link
Member

@Leguark Leguark commented Nov 18, 2025

Refactor Geophysics Input Structure and Improve Tensor Type Handling

[FIX] Improve tensor type matching and error reporting in backend_tensor.py

  • Fix inconsistent tensor type matching for PyTorch tensors
  • Enhance error message to include unsupported tensor type details

[ENH] Refactor magnetics input structure and update TMI computation

  • Introduced GravityInput and MagneticsInput dataclasses to encapsulate related geophysical fields
  • Updated GeophysicsInput to utilize GravityInput and MagneticsInput for improved modularity
  • Modified compute_tmi to accept MagneticsInput instead of GeophysicsInput for better type specificity
  • Adjusted model_api.py to align with new MagneticsInput structure

[ENH] Refactor magnetics input handling and relocate _direction_cosines

  • Simplified magnetics input condition check in model_api.py by replacing mag_kernel and susceptibilities with magnetics_input
  • Moved _direction_cosines method within magnetic_gradient.py for better modularity and code organization

…sor.py

- Fix inconsistent tensor type matching for PyTorch tensors.
- Enhance error message to include unsupported tensor type details.
- Introduced `GravityInput` and `MagneticsInput` dataclasses to encapsulate related geophysical fields.
- Updated `GeophysicsInput` to utilize `GravityInput` and `MagneticsInput` for improved modularity.
- Modified `compute_tmi` to accept `MagneticsInput` instead of `GeophysicsInput` for better type specificity.
- Adjusted `model_api.py` to align with new `MagneticsInput` structure.
…nes`

- Simplified magnetics input condition check in `model_api.py` by replacing `mag_kernel` and `susceptibilities` with `magnetics_input`.
- Moved `_direction_cosines` method within `magnetic_gradient.py` for better modularity and code organization.
@Leguark Leguark changed the title [FIX] Improve tensor type matching and error reporting in backend_tensor.py [REFACTOR] Restructure geophysics input classes for better magnetics and gravity handling Nov 18, 2025
Copy link
Member Author

Leguark commented Nov 18, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Leguark Leguark marked this pull request as ready for review November 18, 2025 09:47
…r and update initialization logic

- Introduced `warnings.warn` to notify usage of deprecated `GeophysicsInput` constructor involving `tz` and `densities`.
- Updated `GeophysicsInput` initialization to utilize `GravityInput` and `MagneticsInput` for better modularity.
@Leguark Leguark merged commit 6b2ad60 into main Nov 18, 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.

2 participants