skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.4k stars 211 forks source link

To_spherical phi probleme #700

Closed aerodynamics-py closed 2 years ago

aerodynamics-py commented 2 years ago

Hi, (first of all skyfiled is awesome, thank you very much). It seems that there is a problem with the calculation of phi in the to_spherical function (function.py line 85). when calculating I have a :

...skyfield/functions.py:85: RuntimeWarning: invalid value encountered in remainder
  phi = arctan2(y, x) % tau

I tried to add _AVOID_DIVIDE_BY_ZERO to tau or x but not improvement so far...

brandon-rhodes commented 2 years ago

Are any of your input values nan? Could you print them out so we see what results you are getting?

aerodynamics-py commented 2 years ago

The weird thing I just noticed is that on my laptop (running on ubuntu) no problem, but when running the same code on my raspberry pi zero the warning occurs...

brandon-rhodes commented 2 years ago

Are those two platforms using different versions of NumPy, maybe?

aerodynamics-py commented 2 years ago

1.22 on ubuntu and 1.21 on the pi. Might be the root cause. I'm going to update and see if it's ok.

aerodynamics-py commented 2 years ago

The problem seems to come from my numpy version indeed but the 1.22.1 version is available with python3.9 which can't be installed on a raspbian buster version. So I will live with the warning or just upgrade the pi zero to bullseye. Thanks for your help.

brandon-rhodes commented 2 years ago

Thanks for the update, after thinking about the issue some more, my guess is that indeed there is nothing that Skyfield can do here that would be terribly useful. I'll go ahead and close the issue.