-
Notifications
You must be signed in to change notification settings - Fork 1
/
plot_cosmology.py
41 lines (31 loc) · 998 Bytes
/
plot_cosmology.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import numpy as np
import astropy
from astropy.cosmology import WMAP9 as cosmo
from astropy import units as u
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
small_radius = 7 * u.kpc
large_radius = 50 * u.kpc
z_range = np.linspace(0.02, 1.50, 75)
small_angles = []
large_angles = []
for z in z_range:
scale = cosmo.arcsec_per_kpc_proper(z)
small_angles.append((small_radius * scale).value)
large_angles.append((large_radius * scale).value)
plt.figure()
plt.plot(z_range, small_angles, label="Typical Small Galaxy (Radius 7 Kpc)")
plt.plot(z_range, large_angles, label="Typical Large Galaxy (Radius 50 Kpc)")
plt.axhline(y=10, color='r', linestyle='-', label="ASASSN cut")
plt.legend()
path = "plots/galaxy_radius.pdf"
print "Saving to", path
plt.savefig(path)
plt.close()
z = 0.014350
d1 = cosmo.angular_diameter_distance(z)
d2 = cosmo.luminosity_distance(z)
print z, d1, d2
print d1.to("au"), d1.to("lightyear")
# d = astropy.coordinates.Distance(z=z)