from A_to_E_converter import *

# Test the conversion function
phi=303.6814   #Az in Stellerium
theta=43.9667   #Alt in Stellarium

print "Start Az=",phi," Alt=",theta
newthetaE,newphiE=A_to_E(theta,phi)    
phiHA=(newphiE+180.)/15.  #Hour angle, angle relative to the meridian plane, converted to Hours
                          #See en.wikipedia.org/wiki/Hour_angle
                          #This is what Stellarium uses
if phiHA > 24.0:
  phiHA -= 24.0

print "HA=",phiHA,"Dec=",newthetaE
#print "newthetaE=",newthetaE," newphiE=",newphiE," phiHA=",phiHA

# Test the reverse conversion
newthetaA,newphiA=E_to_A(newthetaE,newphiE)
print "End Az=",newphiA," Alt=",newthetaA
#print "newthetaA=",newthetaA," newphiA=",newphiA

# Test the reverse conversion, but now based on the Hour Angle
newphiE=(phiHA-12.0)*15.0
#print "newphiE=",newphiE
newthetaA,newphiA=E_to_A(newthetaE,newphiE)
print "End Az=",newphiA," Alt=",newthetaA
#print "newthetaA=",newthetaA," newphiA=",newphiA
