Fix numpy.matrix deprecation warnings in bootstrap routines#809
Closed
Copilot wants to merge 5 commits into
Closed
Fix numpy.matrix deprecation warnings in bootstrap routines#809Copilot wants to merge 5 commits into
Copilot wants to merge 5 commits into
Conversation
- Replace numpy.matrix with ndarray in form_Ghat, form_Mhat, form_Q, find_T, find_CR, find_CMDT_CR - Use .item() to explicitly extract scalars from matrix operations - Replace .getT() with .T and .getH() with .conj().T - Fix matrix multiplication to use @ operator instead of * - Tested with NumPy 2.3.4 - no deprecation warnings Co-authored-by: Swanson-Hysell <4332322+Swanson-Hysell@users.noreply.github.com>
- Ensure form_Q converts inputs to float to avoid in-place division errors - All tests now pass without warnings Co-authored-by: Swanson-Hysell <4332322+Swanson-Hysell@users.noreply.github.com>
Co-authored-by: Swanson-Hysell <4332322+Swanson-Hysell@users.noreply.github.com>
Co-authored-by: Swanson-Hysell <4332322+Swanson-Hysell@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix deprecation warnings in ipmag bootstrap routines
Fix numpy.matrix deprecation warnings in bootstrap routines
Nov 6, 2025
Member
|
This has been dealt with in a separate pull request that was just merged #820 |
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.
NumPy 1.25+ deprecated implicit scalar coercion from
(1,1)matrices/arrays, causing thousands of warnings per bootstrap run. The warnings will become errors in future NumPy releases.Changes
pmagpy/pmag.py
form_Ghat,form_Mhat,form_Q,find_CR,find_CMDT_CR: Replacenp.matrixwithnp.ndarray, use@operator for matmulfind_T: Return scalar via.item()instead of(1,1)array.getT()→.Tand.getH()→.conj().Tthroughoutpmagpy/ipmag.py
common_mean_bootstrap_H23: Replace.getH()with.conj().T, explicit float conversion forLmin_b[i]Example
Before:
After:
No functional changes—purely API modernization to eliminate deprecated numpy.matrix usage.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
api.earthref.orgpython3 pmagpy_tests/test_ipmag.py(dns block)earthref.orgpython3 pmagpy_tests/test_ipmag.py(dns block)www2.earthref.orgpython3 pmagpy_tests/test_ipmag.py(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
numpy.matrixscalar coercion #808💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.