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.

A bug in fraction_illuminated() on Venus?

See original GitHub issue

A bug in fraction_illuminated() on Venus?

It worked well in the skyfield for the moon using fraction_illuminated(). But when I tried to do it on Venus, the results were completely wrong and weird. I could not in any way use fraction_illuminated() on Venus and get a sensible result. (After all, it is known that Venus also has different appearances, and different illuminations, just like the moon has). I use Stellarium software. The illumination percentage of Venus for today September 24, 2022 is 99 percent. Whereas for the date August 11, 2023 the lighting percentage is 0.9. If I use skyfield according to the example given on the skyfield examples page (the example is for the moon, and I changed it for Venus) the result is that today, September 24, 2022, the illumination percentage of Venus is 0.4, while on August 11, 2023, the illumination percentage is 0.5. What is the problem? And how should it be solved? I didn’t check for Mercury, but it also has different illuminated, like the moon has. Thank you.

from skyfield.api import load
from skyfield.framelib import ecliptic_frame

ts = load.timescale()
t = ts.utc(2022, 9, 24, 15, 36)

eph = load('de440s.bsp')
sun, venus, earth = eph['sun'], eph['venus'], eph['earth']

e = earth.at(t)
s = e.observe(sun).apparent()
v = e.observe(venus).apparent()

percent = 100.0 * v.fraction_illuminated(sun)

print('Percent illuminated: {0:.1f}%'.format(percent))
Percent illuminated: 0.4%

image image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sgbmzmcommented, Sep 28, 2022

The sun is illuminated at 100 percent of its circumference. On the other hand, the moon is always lit only on 50 percent of its circumference: only on the side facing the sun. When the side of the moon that faces the earth, faces the sun, we see the entire illuminated part which is about 50 percent of the moon’s circumference, and we call it 100% illuminated.

So the sun has 200% illuminated. But we only see 100 of what is there, so 100 out of 200 is 50 percent.

So everyone is right, but the question is what will the user understand.

1reaction
brandon-rhodescommented, Sep 25, 2022

I’ve re-thought and rewritten the fraction-illuminated logic and this time have tested it against JPL HORIZONS results. See if installing the development version of Skyfield fixes things!

To install the development version of this project, run:

pip install -U https://github.com/skyfielders/python-skyfield/archive/master.zip
Read more comments on GitHub >

github_iconTop Results From Across the Web

Venus' magnitude during inferior conjunction
When it is closest to us, the smallest fraction of the disk is illuminated, and when it's farthest, nearly the whole disk is...
Read more >
Fraction of the Moon Illuminated
This data service calculates the fraction of the visible lunar disk illuminated by the Sun for every day in a selected year between...
Read more >
Fractions in Space
expressed as a simple fraction involving the numbers 1, 2, 3 or 4 in the numerator ... Venus. Place a point on each...
Read more >
Planetary Candidates Observed by Kepler. VIII. A Fully ...
(the fraction of simulated transits that are determined to be planet candidates) across all observed stars is greater.
Read more >
Astronomy-LR.pdf - cloudfront.net
Figure 2.18 Phases of Venus. As Venus moves around the Sun, we see changing illumination of its surface, just as we see the...
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