import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
import numpy as np
def draw_sky(galaxies):
"""adapted from Vishal Goklani"""
size_multiplier = 45
fig = plt.figure(figsize=(10,10))
ax = fig.add_subplot(111, aspect='equal')
n = galaxies.shape[0]
for i in range(n):
_g = galaxies[i,:]
x,y = _g[0], _g[1]
d = np.sqrt( _g[2]**2 + _g[3]**2 )
a = 1.0/ ( 1 - d )
b = 1.0/( 1 + d)
theta = np.degrees( np.arctan2( _g[3], _g[2])*0.5 )
ax.add_patch( Ellipse(xy=(x, y), width=size_multiplier*a, height=size_multiplier*b, angle=theta) )
ax.autoscale_view(tight=True)
return fig