Question

i tried to calculate sun lat and long using PyEphem what i dont understand is when i calculate suns longitude and constellation

>>> sun = ephem.Sun()
>>> sun.compute('2011/05/04')
>>> print ephem.Ecliptic(sun).lon
43:02:58.8

so 43:02:58.8 is 13.02 Taurus but when i try to get the constellation

>>> print ephem.constellation(sun)
('Ari', 'Aries')

it says Aries what is wrong i don't understand please some one help

Was it helpful?

Solution

Good question!

There are two reasons that you are getting a different answer than you might expect.

First, the constellation boundaries currently used by astronomers were established using the position in which the ecliptic happened to lie in 1875. Since then the point of “zero longitude” on the ecliptic has continued to move as the earth's axis has precessed, so that the answers you get will be a few degrees off. To actually learn the longitude in 1875 coordinates, you have to ask like this:

import ephem
sun = ephem.Sun()
sun.compute('2011/05/04')
print "Today's coordinates:", ephem.Ecliptic(sun).lon
sun.compute('2011/05/04', epoch='1875')
print "In 1875 coordinates:", ephem.Ecliptic(sun).lon

When running this script I get the output:

Today's coordinates: 43:02:58.8
In 1875 coordinates: 41:18:14.1

So that removes one source of error from your result. Note that the PyEphem constellation() function converts coordinates to 1875 automatically before looking up a sky position in its table of constellation boundaries, if you provide a body as its argument that has an epoch that is different than 1875.

The other problem you are running into is that the official constellation boundaries mark the actual groups of stars in the sky that form the figures of the Ram (Taurus), the Scales (Libra), and so forth. And it happens that these figures do not even come close to each spanning exactly 30° across the ecliptic (as you may have expected, since you are subtracting 30° from the angle you get back?). If you print out the constellation at every degree along the ecliptic, you will (a) find that the constellations vary greatly in their width, and (b) you will find that 13, not 12, constellations cross the ecliptic since part of Ophiuchus lies along the 1875 ecliptic.

Here are some references that might be helpful:

http://en.wikipedia.org/wiki/Constellation#IAU_constellations

http://en.wikipedia.org/wiki/Precession

OTHER TIPS

It's in Aries. Here's my computation using Beta Ari as the reference:

>>> sun = e.Sun()
>>> sun.compute('2011/05/04')
>>> e.Ecliptic(sun).lon
43:02:58.8
>>> beta_ari = e.readdb('Sheratan,f|S|A5,01:54:38.5|98.74,28:48:28.9|-110.41,2.65,2000,0')
>>> beta_ari.compute('2011/05/04')
>>> e.Ecliptic(beta_ari).lon
36:53:55.2
>>> e.Ecliptic(sun).lon - e.Ecliptic(beta_ari).lon
0.10735523133236013
>>> e.degrees(e.Ecliptic(sun).lon - e.Ecliptic(beta_ari).lon)
6:09:03.6

Sun on the Ecliptic line is 6:09 degree away from Beta Ari, so it's still in Aries. I also double checked this result with other programs using that date, and the results are the same.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top