In [ ]:
In [2]:
import mesa as ms
import matplotlib.pyplot as plt
from matplotlib import gridspec
import numpy as np
In [3]:
#folder = '/media/glauffer/Data/mesa/alpha2_cno_3alf/LOGS/'
folder = '/home/glauffer/Dropbox/UFRGS/kepler/mesa/alpha2_cno_3alf/LOGS/'
s = ms.history_data(folder)
t = s.get('log_Teff')
L = s.get('log_L')
mass = s.get('star_mass')
age = s.get('star_age')
models = s.get('model_number')
In [4]:
a = ms.mesa_profile(folder, models[437])
e = a.get('eps_nuc')
cam = a.get('zone')
In [8]:
%matplotlib inline
plt.figure(0, figsize=(20,15))
ax1 = plt.subplot2grid((2,2), (0,0))
ax1.plot(cam, e)
ax2 = plt.subplot2grid((2,2), (1,0), colspan=2)
ax2.plot(- np.log(1 - a.get('q')), a.get('h1'))
ax2.set_title(r'HRD $\alpha_{MLT}=2$', fontsize=18)
ax2.set_xlabel(r'$\log T_{Eff}$', fontsize=16)
ax2.set_ylabel(r'$\log L$', fontsize=16)
ax3 = plt.subplot2grid((2,2), (0, 1))
ax3.plot(t, L)
ax3.plot(t[437], L[437], 'ko')
ax3.invert_xaxis()
ax3.set_title(r'HRD $\alpha_{MLT}=2$', fontsize=18)
ax3.set_xlabel(r'$\log T_{Eff}$', fontsize=16)
ax3.set_ylabel(r'$\log L$', fontsize=16)
#plt.figure()
#gs = gridspec.GridSpec(1, 1)
#ax1.fig_addsubplot(gs[0,0])
#ax1.plot(cam, e)
#ax2.fig_addsubplot(gs[0,1])
#ax2.plot(t, L)
#ax2.plot(t[437], L[437], 'ko')
#ax3.fig_addsubplot(gs[1,:])
#ax3.plot(- np.log(1 - a.get('q')), a.get('h1'))
#plt.subplot(211)
#plt.plot(cam, e)
#plt.subplot(212)
#plt.plot(t, L)
#plt.plot(t[437], L[437])
#plt.subplot(221)
Out[8]:
In [14]:
# apenas energia e hrd
plt.figure(0, figsize=(20,15))
#plt.suptitle(r'$M_i = $' + str(mass[0]) + r'$M_\odot$, $M_{model} = $' +
# str(mass[437]) + r'$M_\odot$, ' 'Age = ' + str(age[437]) + ', model n ' + str(437), fontsize=18 )
plt.suptitle(r'$M_i = $' + str(mass[0]) + r'$M_\odot$, $M_{model} = $' +
str(mass[437]) + r'$M_\odot$, model n ' + str(437), fontsize=18 )
#plt.tight_layout()
ax1 = plt.subplot(221)
ax1.plot(cam, e)
ax1.set_xlabel('camadas', fontsize=16)
ax1.set_ylabel(r'$\epsilon_{nuc}$', fontsize=16)
ax3 = plt.subplot(222)
ax3.plot(t, L)
ax3.plot(t[437], L[437], 'ko')
ax3.invert_xaxis()
ax3.set_title(r'HRD $\alpha_{MLT}=2$', fontsize=18)
ax3.set_xlabel(r'$\log T_{Eff}$', fontsize=16)
ax3.set_ylabel(r'$\log L$', fontsize=16)
Out[14]:
In [16]:
# escrevendo como uma função
def plot_eps_HRD(mass, temp, lum, cam, enuc, i):
plt.figure(0, figsize=(20,15))
plt.suptitle(r'$M_i = $' + str(mass[0]) + r'$M_\odot$, $M_{model} = $' +
str(mass[i]) + r'$M_\odot$, model n ' + str(i), fontsize=18 )
ax1 = plt.subplot(221)
ax1.plot(cam, enuc)
ax1.set_xlabel('camadas', fontsize=16)
ax1.set_ylabel(r'$\epsilon_{nuc}$', fontsize=16)
ax3 = plt.subplot(222)
ax3.plot(temp, lum)
ax3.plot(temp[i], lum[i], 'ko')
ax3.invert_xaxis()
ax3.set_title(r'HRD $\alpha_{MLT}=2$', fontsize=18)
ax3.set_xlabel(r'$\log T_{Eff}$', fontsize=16)
ax3.set_ylabel(r'$\log L$', fontsize=16)
plt.close()
plot_eps_HRD(mass, t, L, cam, e, 437)
In [ ]: