I am new to PyEphem and I am trying to figure out what it can do and how it works. As I do not want to use it as a black box and blindly trust whatever figure I get, I wanted to recreate an example that is explained here.
The example calculates the azimuth and altitude of an object for a given observer on the 10th August 1998 at 23:10 UT. The following parameters are given:
RA = 16 h 41.7 min, DEC = 36 d 28 min
The observer's latitude is 52 d 30 min North and longitude 1 d 55 min West.
The correct answer according to the example (which I can recreate in Excel) is AZ = 269.14634 degrees and ALT = 49.169122 degrees.
I wrote the following code using pyephem to try to achieve the same result:
day = '1998/8/10 23:10:00'
longitude = ephem.degrees('-1.91667')
latitude = ephem.degrees('52.5')
star = ephem.FixedBody()
star._ra = '16:41:42.0'
star._dec = '36:28:00.0'
observer = ephem.Observer()
observer.date = day
observer.lon = longitude
observer.lat = latitude
star.compute(observer)
print 'Observer', observer
print 'RA', star.ra, 'DEC', star.dec
print 'AZ', star.az, 'ALT', star.alt
Running the program gives me this output:
>>>
Observer <ephem.Observer date='1998/8/10 23:10:00' epoch='2000/1/1 12:00:00' lon=-1:55:00.0 lat=52:30:00.0 elevation=0.0m horizon=0:00:00.0 temp=15.0C pressure=1010.0mBar>
RA 16:41:39.23 DEC 36:28:33.5
AZ 269:09:54.9 ALT 49:10:57.7
The results for AZ + ALT are obviously ballpark to the example but far from identical. I am also puzzled by the fact that RA and DEC are slightly modified in the print out compared to what I entered.
If anyone can help me shed some light to why the results differ and what I can or should do to replicate the results, I would greatly appreciate it. Thanks.
EDIT: Corrected a typo pointed out in answer below. The question is still valid.
EDIT2: OK, I have read (and sort of understood) why the right ascension and declination is adjusted by PyEphem from this link. What I do not understand is if there is any way to get PyEphem to ignore adjusting for relativistic deflection, nutation and aberration of light the same way that you can make it ignore atmospheric refraction? I am assuming that the difference in Azimuth is due to the adjustment of RA and DEC but it would be nice to confirm.