Conversation
Add default resistivity/phase error parameters to MT.to_simpeg_1d and pass impedance units to Simpeg1D. Heavily refactor Simpeg1D: add type hints, docstrings and defaults, introduce resistivity_error and phase_error attributes, compute model error columns for modes (te/tm/det), and ensure phase values are mapped to the recursive 1D SimPEG branch before inversion. Improve robustness by filling NaN errors, removing zero rows, and adding a plotting-phase conversion for display; return matplotlib Figure from plot methods and fix axis labels/limits. Also include small API/behavior changes (receiver component/orientation update, minor culling prototypes, and other readability/typing improvements).
Add a new test suite for the Simpeg1D inversion recipe and run it in CI (non-Windows runners). The workflow was updated to execute the new tests. Fixes and improvements in mtpy/modeling/simpeg/recipes/inversion_1d.py: - Initialize resistivity_error and phase_error on the instance earlier. - Rework the 'det' branch error handling to compute res_model_error and phase_model_error from the z_object using numpy indexing instead of manipulating the dataframe in-place. - Commented/clarified phase-model-error override logic. - Remove an unnecessary stray line and minor print cleanup. - Adjust plotting: use _plot_z ordering (no reverse) and relax default y-axis lower limit from 0.01 to 0.5. Tests: add tests/modeling/simpeg/test_simpeg_1d_inversion_recipe.py covering mode-specific sub-dataframe construction, phase bounds, invalid-mode handling, data/error vector lengths, plotting conversion, and a short integration smoke test for TE (skipped on Windows).
Add explicit impedance unit support and dataset-based TF computations. Introduce MT_TO_OHM_FACTOR and IMPEDANCE_UNITS and extend tf_helpers functions to accept z_units ("mt" or "ohm") with appropriate conversions. Normalize units string in Z.units setter, switch Z properties to read values from the dataset.transfer_function* attributes (instead of raw z/z_error) and apply the scale factor consistently (including determinant and its errors). Add tests: verify resistivity/phase remain unchanged when switching units and assert final misfit is below target in the SimPEG 2D recipe test.
Refactor impedance unit handling to allow separate input_units and output_units on Z while keeping internal storage in MT units. Add backward-compatible units alias (units -> output_units) and validate unit choices; incoming arrays are scaled by input_units and returned arrays by output_units. Update MT dataframe import/export to set Z.output_units (and pass units into to_z_object) so dataframes are interpreted and exposed with requested units. Add/adjust tests to cover input/output unit behavior, round-trip conversions, and error handling.
Add explicit impedance unit handling across MT, MTData, and MTDataFrame conversions. MTDataFrame.from_z_object now accepts a units parameter and uses a copy of the Z object (setting its output_units) to avoid mutating the input; MT.to_dataframe and MTData.to_dataframe/from_dataframe call through with impedance_units. Z objects are constructed with input_units/output_units where appropriate and resistivity/phase→Z conversion forces mt input_units. Tests updated to cover round-trip conversions with ohm units and to assert that exporting with units does not mutate the source Z object.
Document that transfer-function rotation operates on the coordinate reference frame (not the physical measurement), with an example for frame-angle sign. Add a unit test (test_rotation_shifts_estimated_strike_with_frame_rotation) that verifies a +10° frame rotation produces a -10° shift in estimated invariant strike and phase-tensor azimuth (handles 180° strike ambiguity and wraps differences appropriately).
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #100 +/- ##
==========================================
+ Coverage 40.86% 41.27% +0.41%
==========================================
Files 121 121
Lines 24265 24342 +77
==========================================
+ Hits 9915 10048 +133
+ Misses 14350 14294 -56
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
There were some updates in simpeg 0.25 which need to be updated in mtpy-v2.
There is also a change needed for impedance units. The logic was originally to just set the units to "mt" or "ohm" but that was incorrect because if you input "mt" units but then changed the units to "ohm" you wouldn't get the correct resistivity values. Should change the logic to attributes "input_units" and "output_units" to the impedance tensor. Then internally be sure to set output units for simpeg data to "ohm".
Motivation and Context
We want to plugin to the latest version of simpeg.
How Has This Been Tested?
Adding tests
Screenshots (if appropriate):
Types of changes
Checklist: