Skip to content

Instantly share code, notes, and snippets.

@aisipos
Created March 13, 2012 05:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aisipos/2026960 to your computer and use it in GitHub Desktop.
Save aisipos/2026960 to your computer and use it in GitHub Desktop.
Venus Jupiter Separation
import ephem, datetime, math
import matplotlib.pyplot as plt
venus = ephem.Venus()
jupiter = ephem.Jupiter()
observer=ephem.city('Los Angeles')
dates = [datetime.date(2012,3,1) + datetime.timedelta(days=x) for x in range(180)]
sep = []
for date in dates:
observer.date=date
venus.compute(date)
jupiter.compute(date)
sep.append(ephem.separation(venus,jupiter) * 360.0 / 2*math.pi)
fig=plt.figure()
ax=fig.add_subplot(1,1,1)
ax.plot(dates, sep)
fig.autofmt_xdate()
ax.set_title('Angular Separation of Jupiter and Venus')
ax.set_xlabel('date')
ax.set_ylabel('Separation [degrees]')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment