In [ ]:
import os
import sys
sys.path.append(os.path.expanduser('~/Sn/Release/python/pystella'))
sys.path.append(os.path.abspath(os.path.join('.')))
%matplotlib inline
from matplotlib import pyplot as plt
from matplotlib import gridspec
import numpy as np
import pystella.rf.rad_func as rf
from pystella.rf import extinction
from pystella.rf import light_curve_func as lcf
from pystella.rf import light_curve_plot as lcp
from pystella.rf import band
from pystella.model.stella import Stella
from pystella.model import sn_eve
from pystella.model import sn_swd
In [ ]:
mname = 'cat_R500_M15_Ni008_E12'
dir_strad = os.path.expanduser('~/Sn/Release/seb_git/run/strad')
In [ ]:
stella = Stella(mname, path=dir_strad)
print("Print info from stella res-files")
info = stella.get_res().Info
info.show()
# info.Data
In [ ]:
res = stella.get_res()
In [ ]:
bands = ['U', 'B', 'V']
sn_z = 0.
sn_dist = 10. # pc
serial_spec = stella.read_series_spectrum(t_diff=1.05)
curves = serial_spec.flux_to_curves(bands, z=sn_z, d=rf.pc_to_cm(sn_dist))
ax = lcp.curves_plot(curves, xlim=None, ylim=None)
In [ ]:
times = (0.5, 1, 4, 10., 60., 110.)
swd = stella.get_swd().load()
fig = lcp.plot_shock_details(swd, times=times, vnorm=1e8)
In [ ]:
# # Plot
# fig = plt.figure(num=None, figsize=(16, len(times)*4), dpi=100, facecolor='w', edgecolor='k')
# gs1 = gridspec.GridSpec(len(times), 2)
# plt.matplotlib.rcParams.update({'font.size': 14})
# i = 0
# for t in times:
# b = swd.block_nearest(t)
# ax = fig.add_subplot(gs1[i, 0])
# sn_swd.plot_swd(ax, b, is_xlabel=i==len(times)-1, vnorm=1e8, lumnorm=1e38, rnorm='lgr',
# is_legend=is_legend)
# ax2 = fig.add_subplot(gs1[i, 1])
# sn_swd.plot_swd(ax2, b, is_xlabel=i==len(times)-1, vnorm=1e8, lumnorm=1e38,
# is_legend=is_legend, is_ylabel=False)
# i += 1
# plt.show()
In [ ]:
evename = None # 'cat_R500_M15_Ni008'
dir_eve = os.path.expanduser('~/Sn/Release/seb_git/run/eve')
if evename is not None:
eve = sn_eve.StellaEve(evename, path=dir_eve)
eve.load()
ax = eve.plot_chem(ylim=[-8, 0.])
plt.show()
In [ ]:
In [ ]: