i generate random positions above the horizon(az=0-360,alt=0-90)in az/alt and calculate them withradec_to()
to RA and DEC. to check the result i retransform them.
so what i don't understand is, why i get around half of coordinates back under the horizon?
import ephem
from datetime import datetime
import random
home = ephem.Observer()
home.lon = '-70.4' # +E
home.lat = '-24.62' # +N
home.elevation = 1189 # meters
home.date = datetime.utcnow()
RA = []
DEC = []
for n in range(100):
# print(random.uniform(0, 360), random.uniform(0, 90))
ra, dec = home.radec_of(az=random.uniform(0, 360), alt=random.uniform(0, 90))
# print('%s %s' % (ra, dec))
RA.append(ra)
DEC.append(dec)
dummy = 0
for coordinate in RA:
body = ephem.FixedBody()
body._epoch = ephem.J2000
body._ra = ephem.degrees(RA[dummy])
body._dec = ephem.degrees(DEC[dummy])
body.compute(home)
dummy += 1
print(body.az, body.alt)
the aim of this program is to generate random artifical stars over ans observer that can be tracked with pyephem.