Skip to content

Fix scalar versus size(1) array incompatibility between numpy 1.x and 2.x - #38

Open
dhuppenkothen wants to merge 1 commit into
handley-lab:masterfrom
dhuppenkothen:fix_numpy2_issue
Open

Fix scalar versus size(1) array incompatibility between numpy 1.x and 2.x#38
dhuppenkothen wants to merge 1 commit into
handley-lab:masterfrom
dhuppenkothen:fix_numpy2_issue

Conversation

@dhuppenkothen

Copy link
Copy Markdown

Description

Fixes issue #37. Key problem is that implicit conversion of 1D arrays to scalars now throws a TypeError (see release notes for numpy 2.4 here: https://numpy.org/devdocs/release/2.4.0-notes.html). the .item() syntax extracts the relevant value from the array and passes this as a scalar instead.

Type of change

Please delete options that are not relevant.

  • [ x] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Tested on the minimum example given in issue #37, on python 3.14 and numpy 2.4.

  • [ x] My code follows the style guidelines of this project
  • [x ] I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • [x ] My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • [ x] New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

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