Search code examples
coordinatesastronomypyephem

Why can't I get the same coordinate back with pyephem?


If you simply create a FixedObject and give it a set of coordinates and then ask for them back you get a different position:

>>> import ephem
>>> TestStar = ephem.FixedBody()
>>> TestStar._ra, TestStar._dec = '12:43:20', '-45:34:12'
>>> TestStar.compute()
>>> print TestStar.ra, TestStar.dec
12:44:15.34 -45:39:46.8

I now understand that this is because, as documented, the FixedBody is by default at the J2000 epoch, however the default observer's epoch is the moment that said observer is created, and it seems that that is the default for when you don't specify an observer.

However if I try to compensate for that:

>>> TestStar4 = ephem.FixedBody()
>>> TestStar4._ra, TestStar4._dec, TestStar4._epoch = '12:43:20', '-45:34:12', '2000/01/01 12:00:00'
>>> TestSite2 = ephem.Observer()
>>> TestSite2.lat, TestSite2.lon, TestSite2.date = 0,0,'2000/01/01 12:00:00'
>>> TestStar4.compute(TestSite2)
>>> print TestStar4.ra, TestStar4.dec
12:43:19.42 -45:33:51.9

You get an almost identical RA, but a DEC that is different by 20 arcseconds for this example.

I'm specifically trying to get the J2000 coordinates of some stars in a WEBDA catalog which provide relative coordinates for most stars.

For example see this random cluster: http://www.univie.ac.at/webda/cgi-bin/frame_list.cgi?ic0166

The "Coordinates J2000" only has information on 9 stars and almost all stars have information in the "XY positions" link. The center and scale of these XY positions is a bit arbitrary but can be found in the site.

However if don't know why that 20 arcsecond difference in coordinates is there, I don't know when my system will fail.


Solution

  • Ok at this point I imagine the discrepancy is due to some correction factor. I know now I want to use the Astrometric Geocentric Position, so:

    >>> import ephem
    >>> TestStar = ephem.FixedBody()
    >>> TestStar._ra, TestStar._dec = '12:43:20', '-45:34:12'
    >>> TestStar.compute()
    >>> print TestStar.a_ra, TestStar.a_dec
    12:43:20 -45:34:12
    

    Simple enough (just hadn't understood that part of the manual, sorry).

    I'm still curious as to which of all the corrections would affect this mostly, but I can carry on without knowing for now.