In [ ]:
import ephem
import math
import datetime, pytz

In [ ]:
p1 = ephem.Equatorial("17:6:32", "+0.0", epoch=ephem.J2000)
print p1.ra, p1.dec

In [ ]:
d =ephem.degrees(p1.ra)
print d*180/math.pi
print d
print ephem.hours(d)

In [ ]:
print p1.ra, p1.dec

In [ ]:
p2 = ephem.Equatorial(ephem.degrees('6.104381415856419'), "-0.3008855515838813")

In [ ]:
print p2.ra*180/math.pi

In [ ]:
b1 = ephem.FixedBody()
b1._ra = ephem.degrees(p1.ra)
b1._dec = p2.dec
b1.compute()
print b1.a_ra

In [ ]:
testp = ephem.Equatorial("17:6:32","+57.5")
str(testp.ra),str(testp.dec)

In [ ]:
testp.epoch

In [ ]:
print ephem.degrees('+0:7:21')*180/math.pi*60

In [ ]:
print ephem.degrees("1")*180/math.pi

In [ ]:
# greenwich_site = ephem.Site(lat=51.5,
#                                        long=0,
#                                         alt=0,
#                                         tz=0,
#                                         name="Greenwich"
#                                         )
greenwich = ephem.Observer()
greenwich.lat = ephem.degrees('51.5')
greenwich.lon = 0
greenwich.date = datetime.datetime(2012, 03, 20,
                                           5, 14,
                                           tzinfo=pytz.utc)
greenwich.name = "Royal Greenwich Observatory"
print greenwich

In [ ]:
str(greenwich.name)

In [ ]:
print greenwich.date

In [ ]:
print greenwich.sidereal_time()

In [ ]:
print greenwich.next_transit(b1)

In [ ]:
print greenwich.sidereal_time()

In [ ]:
cpn_posn = ephem.Equatorial("17:6:32", "+89.0",epoch=ephem.J2000)
print cpn_posn.ra,  cpn_posn.dec
cpn = ephem.FixedBody()
cpn._ra = cpn_posn.ra
cpn._dec = cpn_posn.dec
cpn._epoch = cpn_posn.epoch
cpn.compute(greenwich)
print cpn.a_ra, cpn.a_dec
# # cpn.circumpolar
print cpn.alt, cpn.az
print cpn.circumpolar, cpn.neverup
print cpn.rise_time
print cpn.transit_alt

In [ ]:
print greenwich.date
print greenwich.previous_transit(cpn)

In [ ]:
print cpn.transit_time

In [ ]:
eq_later_posn = ephem.Equatorial("5:6:32", "+0.0",epoch=ephem.J2000)
eq_later = ephem.FixedBody()
eq_later._ra = eq_later_posn.ra
eq_later._dec =  eq_later_posn.dec
eq_later._epoch = ephem.J2000
greenwich.horizon= ephem.degrees('9')
greenwich.date = 40987.01220277134
print greenwich.date
eq_later.compute(greenwich)
print eq_later.alt*180/math.pi
print eq_later.transit_time

print eq_later.transit_alt*180/math.pi
print eq_later.rise_time
print eq_later.alt
eq_later.alt>greenwich.horizon

In [ ]:
greenwich.date = cpn.transit_time
cpn.compute(greenwich)
cpn.alt
print cpn.az

In [ ]:
print eq_later._ra*180/math.pi

In [ ]:
print eq_later.transit_time

In [ ]:
print greenwich.previous_setting(eq_later)

In [ ]:
print greenwich.next_rising(eq_later)

In [ ]:
print greenwich.next_transit(eq_later).datetime()

In [ ]:
func = getattr(greenwich, 'next_transit')
print func(eq_later).datetime()

In [ ]:
print cpn.transit_alt*180/math.pi

In [ ]:
print eq_later.transit_alt*180/math.pi

In [ ]:
eq_later_tt = greenwich.next_transit(eq_later).datetime()
eq_later_tt = pytz.utc.localize(eq_later_tt)
print eq_later_tt

In [ ]:
greenwich.date= eq_later_tt

In [ ]:
eq_later.compute(greenwich)
print eq_later.alt, eq_later.az

In [ ]:
greenwich.date= cpn.transit_time

In [ ]:
cpn.compute(greenwich)
print cpn.alt, cpn.az
eq_later.compute(greenwich)
print eq_later.alt, eq_later.az

In [ ]:
greenwich.horizon

In [ ]:
print greenwich.sidereal_time()

In [ ]: