skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.42k stars 213 forks source link

ValueError in the "Charting an apparition of Venus" example script #581

Closed OH6BG closed 3 years ago

OH6BG commented 3 years ago

https://rhodesmill.org/skyfield/example-plots.html#charting-an-apparition-of-venus

Thank you for the script! Just a note that copying that script from the page and running it will throw a ValueError. Is it just me? Python 3.9.3 Skyfield version: 1.38 jplephem version: 2.15 sgp4 version: 2.18

Traceback (most recent call last): File "c:\Users\user\Desktop\Venus\venus.py", line 34, in m = planetary_magnitude(apparent) File "D:\Programs\Python39\lib\site-packages\skyfield\magnitudelib.py", line 66, in planetary_magnitude return function(r, delta, ph_ang) File "D:\Programs\Python39\lib\site-packages\skyfield\magnitudelib.py", line 82, in _venus_magnitude if ph_ang < 163.7: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

brandon-rhodes commented 3 years ago

Well, drat. The script takes advantage of an improvement in Skyfield that, alas, hasn't been released yet. I guess I'll need to do the next release earlier than I had expected, to get the documentation and Skyfield back into agreement. In the meantime you could try out the development version with:

pip install -U https://github.com/skyfielders/python-skyfield/archive/master.zip
OH6BG commented 3 years ago

Thank you, Brandon! It works nicely now :)

brandon-rhodes commented 3 years ago

I've just released Skyfield 1.39 so the code should work now without installing from GitHub. Enjoy!