-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfind_omega_plot.py
59 lines (46 loc) · 1.8 KB
/
find_omega_plot.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import sys
import numpy as np
import matplotlib.pyplot as plt
import seaborn.apionly as sns
import fimport
import consts as c
prof = sys.argv[1]
mass = sys.argv[2]
prof_type = sys.argv[3]
p = sys.argv[4]
g = sys.argv[5]
mass_prof = '{}_{}'.format(mass, prof)
lin = np.linspace(0, 1e-6, 100)
mode_ratio = {'1.24_122':1.7, '1.5_138':1.5, '1.5_140':1.35}
data = fimport.load_array('data{}/find_omega_{}_{}_{}_{}.txt'.format(mass, prof, prof_type, p, g), 1)
data_mesa = fimport.load_array('data{}/profiles/profile{}.data'.format(mass, prof), 6)
radius = data_mesa['radius'][0] * c.rsun
g_vals = np.unique(data[g])
p_vals = np.unique(data[p])
i = 0
while data[g][i] == data[g][0]:
i += 1
j = len(data[g]) / i
assert int(j) == j
ratio = np.reshape(np.copy(data['ratio']), (j, i))
omega_e = np.reshape(np.copy(data['omega_e']), (j, i))
plt.pcolor(p_vals, g_vals, ratio, cmap=plt.get_cmap('cubehelix'), vmax=50, vmin=1)
plt.axis([p_vals.min(), p_vals.max(), g_vals.min(), g_vals.max()])
plt.fill_between(lin, 0, lin, color='white', alpha=0.4,linewidth=0)
plt.plot(lin, lin * mode_ratio[mass_prof], color='k')
plt.colorbar(label='$\Omega_c / \Omega_e$')
plt.xlabel(p)
plt.ylabel(g)
plt.title(prof + ' ' + prof_type)
plt.savefig('data{}/find_omega_ratio_{}_{}_{}_{}.pdf'.format(mass, prof, prof_type, p, g))
plt.clf()
plt.pcolor(p_vals, g_vals, omega_e * radius / 1e5, cmap=plt.get_cmap('cubehelix'), vmax=1, vmin=0)
plt.axis([p_vals.min(), p_vals.max(), g_vals.min(), g_vals.max()])
plt.fill_between(lin, 0, lin, color='white', alpha=0.4, linewidth=0)
plt.plot(lin, lin * mode_ratio[mass_prof], color='white')
#plt.plot(lin, lin * 1.4, color='white')
plt.colorbar(label='$v_e$ [km/s]')
plt.xlabel(p)
plt.ylabel(g)
plt.title(prof + ' ' + prof_type)
plt.savefig('data{}/plots/find_omega_ve_{}_{}_{}_{}.pdf'.format(mass, prof, prof_type, p, g))