PSFCPlasmaTools / eqtools

Python tools for magnetic equilibria in tokamak plasmas
GNU General Public License v3.0
31 stars 11 forks source link

run /tests/demo.py error #5

Closed wphu closed 7 years ago

wphu commented 7 years ago

I used python 2..13, when run "python demo.py" in tests, i got an error as below: File "demo.py", line 39, in <module> Rmid = e.psinorm2rmid(0.5, [0.25, 0.5, 0.75, 1.0]) File "/home/huanying/.local/lib/python2.7/site-packages/eqtools/core.py", line 2546, in psinorm2rmid **kwargs File "/home/huanying/.local/lib/python2.7/site-packages/eqtools/core.py", line 8018, in _psinorm2Quan scipy.concatenate(([len(time_idxs),], original_shape)) TypeError: 'numpy.float64' object cannot be interpreted as an index

When I change the line: Rmid = e.psinorm2rmid(0.5, [0.25, 0.5, 0.75, 1.0]) to: Rmid = e.psinorm2rmid([0.5], [0.25, 0.5, 0.75, 1.0]) Then no errors.

icfaust commented 7 years ago

I'm giving this a look. It seems also that something has been changed in the MDSplus error reporting (again).

icfaust commented 7 years ago

The problem was that newer versions of numpy requires a tuple of integers for the 'zeros' function, which had previously just been a warning (main:1: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future). We had not forced this in Eqtools.

I have gone and modified the core functions to reflect this change, and should now operable both in older and newer versions of numpy. I have tested it locally. If you have another error, please create another issue thread.

wphu commented 7 years ago

@icfaust OK, thank you