This script exercises Section 15.2, “AltAz.raDec(): Horizon to equatorial
coordinates” and Section 17.3, “RADec.altAz(): Equatorial to horizon
coordinates”, sections 25 and 26 of Duffett-Smith. Here is the
problem statement for the forward conversion; the book's
answer is =19° 20′ 02″, a=283° 16′ 18″.
A
What are the altitude and azimuth of a star whose hour-angle is 05h 51m 44s and declination is 23° 13′ 10″? The observer's latitude is 52° N.
#!/usr/bin/env python #================================================================ # test25-26: Test equatorial <-> horizon coordinates. # For documentation, see: # http://www.nmt.edu/tcc/help/lang/python/examples/sidereal/ims/ #---------------------------------------------------------------- import math import datetime import sidereal
First we set up a MixedUnits instance to do
mixed-unit conversion and formatting. Then we set up the
inputs: the equatorial coordinates, the hour angle, and
the observer's latitude.
#-- # Converter for mixed units #-- dmsUnits = sidereal.MixedUnits ( (60, 60) ) #-- # Set up inputs #-- dec = math.radians ( dmsUnits.mixToSingle ( (23, 13, 10) ) ) raDec = sidereal.RADec ( 0.0, dec ) hHours = dmsUnits.mixToSingle ( (5, 51, 44) ) hRadians = sidereal.hoursToRadians ( hHours ) lat = math.radians ( 52.0 ) latLon = sidereal.LatLon ( lat, 0.0 )
The result returned by RADec.altAz is an AltAz instance, which we then display.
#-- # Convert to horizon coordinates #-- altAz = raDec.altAz ( hRadians, lat ) print "Horizon coordinates:", altAz
Finally we do the back-conversion.
#-- # Convert back to an hour angle. #-- gst = sidereal.SiderealTime ( dmsUnits.mixToSingle ( (0, 24, 05) ) ) check = altAz.raDec ( gst, latLon ) print "Check RA/Dec:", check