[AstroPy] Summing an array
Homeier, Derek
dhomeie at gwdg.de
Mon Jul 11 12:09:28 EDT 2022
Hi Rudolf,
print(np.version.version) 1.18.5
That’s kind of old (Python 3.7 is supported by up to 1.21.6), but the interface really has not changed
notably since then.
class 'numpy.ndarray
1 print(np.version.version)
2 print(np.sum.__class__)
----> 3 print(np.sum.__name__)
4 print(np.sum.__module__)
AttributeError: 'numpy.ndarray' object has no attribute '__name__'
2 print(np.sum.__class__)
3 #print(np.sum.__name__)
----> 4 print(np.sum.__module__)
AttributeError: 'numpy.ndarray' object has no attribute ‘__module__'
Really looks like a polluted namespace (meaning some methods like `np.sum`, `np.nansum` have been
overwritten by some other operation).
As Eric suggested, could you provide a standalone example as a script including in particular everything from the
import numpy as np
statement in a fresh Python session onwards (I am assuming you are seeing the same error with
rpflux = np.array([3140., 2770. , 3080. , 3170. , 3050., 3060.])
np.sum(rpflux)
so no need to include your actual data file in that case).
Cheers,
Derek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/astropy/attachments/20220711/a8b72359/attachment.html>
More information about the AstroPy
mailing list