question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting "RuntimeWarning: invalid value encountered in double_scalars" in keplerlib.py

See original GitHub issue

Running the following code:

#!/usr/bin/env python3

import datetime, io, skyfield.api, skyfield.constants, skyfield.data.mpc

print( "Skyfield:", skyfield.__version__ )
latitude = -33
longitude = 151
now = datetime.datetime.strptime( "2020-08-08", "%Y-%m-%d" )
data = "    CK19Y04a  2020 05 31.0420  0.251014  1.001333  177.2464  120.9277   45.8250  20200807  11.6  6.0  C/2019 Y4-A (ATLAS)                                      MPEC 2020-L06"
timeScale = skyfield.api.load.timescale( builtin = True )
topos = skyfield.api.Topos( latitude_degrees = latitude, longitude_degrees = longitude )
ephemeris = skyfield.api.load( "de421.bsp" )
sun = ephemeris[ "sun" ]
earth = ephemeris[ "earth" ]
with io.BytesIO( data.encode() ) as f:
    dataframe = skyfield.data.mpc.load_comets_dataframe( f ).set_index( "designation", drop = False )
    body = sun + skyfield.data.mpc.comet_orbit( dataframe.loc[ "C/2019 Y4-A (ATLAS)" ], timeScale, skyfield.constants.GM_SUN_Pitjeva_2005_km3_s2 )

I am getting the following result:

Skyfield: 1.26
/usr/local/lib/python3.5/dist-packages/skyfield/keplerlib.py:256: RuntimeWarning: invalid value encountered in double_scalars
  return 2 * arctan(((1+e)/(1-e))**.5 * tan(E/2))

I stepped into the function true_anomaly and the parameter E is 0.0…not sure where to go from here!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
JoshPatersoncommented, Aug 9, 2020

I’ll be able to take a look at this later tonight!

0reactions
brandon-rhodescommented, Aug 9, 2020

Drat, when I said “re-open” I meant that I was going to press the “Reopen” button right here so we could continue the conversation without your having to open a new issue.

Then?

I closed the tab and entirely forgot to accidentally press “Reopen”.

Thanks for opening the new issue!

Read more comments on GitHub >

github_iconTop Results From Across the Web

runtimewarning: invalid value encountered in double_scalars
This error occurs when you attempt to perform some mathematical operation that involves extremely small or extremely large numbers and Python ...
Read more >
'invalid value encountered in double_scalars' warning ...
It looks like a floating-point calculation error. Check the numpy.seterr function to get more information about where it happens.
Read more >
How to Fix: runtimewarning: invalid value encountered in ...
In this article, we will discuss how to fix runtimewarning: invalid value encountered in double_scalars using Python.
Read more >
Runtimewarning: Invalid Value Encountered in Double_scalars
The best way to fix the invalid Runtime value error in Python is to use a specific function from a different library.
Read more >
[Python]Report ' RuntimeWarning: invalid value encountered ...
My source code ; @zyoohv zyoohv changed the title Report ' RuntimeWarning: invalid value encountered in double_scalars' when run cv. [Python] ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found