tschoonj / xraylib

A library for X-ray matter interaction cross sections for X-ray fluorescence applications
https://github.com/tschoonj/xraylib/wiki
Other
120 stars 54 forks source link

Issue with python example xrlexample5.py (numpy: int64 vs int) #218

Closed delorytheape closed 1 year ago

delorytheape commented 1 year ago

Hi,

I have just attempted to use xraylib with Python and have run into a problem with the example xrlexample5.py The example throws an exception at line 67, while attempting to call xraylib.AtomicNumberToSymbol(Z[0]), where Z=np.array([26]) The output is

Traceback (most recent call last):

File "blah/Downloads/xraylib/example/xrlexample5.py", line 67, in \<module>

symbol = xraylib.AtomicNumberToSymbol(Z[0]) File "blah/miniconda3/envs/py3/lib/python3.10/site-packages/xraylib.py", line 1037, in AtomicNumberToSymbol return _xraylib.AtomicNumberToSymbol(Z) TypeError: in method \'AtomicNumberToSymbol\', argument 1 of type \'int\'

ie. It looks like AtomicNumberToSymbol is expecting an int (but getting a numpy.int64).

To confirm this, I,

tschoonj commented 1 year ago

Hi @delorytheape,

This bug was fixed in the 4.1.3 release. You may want to update your conda environment.

delorytheape commented 1 year ago

Ok - thanks.