I'm new to PyEphem, and I'm trying to figure out what it can do and how it works. Since I do not want to use it as a black box and blindly trust any figure that I get, I wanted to recreate the example explained here .
An example calculates the azimuth and height of an object for a given observer on August 10, 1998 at 23:10 UT. The following options are listed:
RA = 16 h 41.7 min, DEC = 36 d 28 min
The latitude of the observer 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): AZ = 269.144634 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 result:
>>> 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 approximate, for example, but far from identical. I am also puzzled by the fact that RA and DEC are slightly changed in the printout compared to what I entered.
If someone can help me shed light on why the results are different, and what I can or should do to reproduce the results, I would really appreciate it. Thanks.
EDIT : fixed the typo indicated in the answer below. The question remains valid.
EDIT2 : Well, I read (and sort of figured out) why PyEphem is setting up the correct ascent and declination from this link . I donβt understand if there is a way to make PyEphem ignore the correction of relativistic deflection, nutation and light aberration in the same way as you can make it ignore atmospheric refraction? I assume that the difference in azimuth is due to the adjustment of RA and DEC, but it would be nice to confirm.