Skip to content

Fix: String class breaks when using numpy >=2 with npbytes.#2808

Closed
santorofer wants to merge 2 commits intoMDSplus:alphafrom
santorofer:numpy2-string-fix
Closed

Fix: String class breaks when using numpy >=2 with npbytes.#2808
santorofer wants to merge 2 commits intoMDSplus:alphafrom
santorofer:numpy2-string-fix

Conversation

@santorofer
Copy link
Copy Markdown
Contributor

In the String class, check for Python version when using npbytes and npunicode
Fixes #2807

In the String class, check for Python version when using npbytes and npunicode
Fixes MDSplus#2807
@santorofer
Copy link
Copy Markdown
Contributor Author

The added logic works well with:

Python 3.12.3
Numpy 1.26.4

@santorofer
Copy link
Copy Markdown
Contributor Author

santorofer commented Sep 13, 2024

With the new logic, i.e. check for the numpy version, instead of the python version, the following works:

Python 3.12.3
Numpy 1.26.4

>>> tree = MDSplus.Tree('magtest', -1)
>>> tree.getNode("ACQ2106_122:SITE6:OUTPUT_01").data()
array([0.        , 0.        , 0.        , 0.03333333, 0.06666667,
       0.1       , 0.13333333, 0.16666667, 0.2       , 0.23333333,
       0.26666667, 0.3       , 0.33333333, 0.36666667, 0.4       ,
       0.43333333, 0.46666667, 0.5       , 0.53333333, 0.56666667,
       0.6       , 0.63333333, 0.66666667, 0.7       , 0.73333333,
       0.76666667, 0.8       , 0.83333333, 0.86666667, 0.9       ,
       0.93333333, 0.96666667, 1.        , 1.        , 1.        ,
       1.        , 1.        , 1.        , 1.        , 1.        ,
       0.        ])
>>> 

@WhoBrokeTheBuild
Copy link
Copy Markdown
Member

This was replaced by #2809

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.

another trouble with numpy 2.x

2 participants