4 import matplotlib.pyplot
as plt
5 import matplotlib.gridspec
as gridspec
6 from matplotlib
import cm
10 sys.path.append(
'../../bin')
11 from class_files.winnet_class
import winnet
16 fig = plt.figure(figsize=(5,6))
19 gs = fig.add_gridspec(nrows=3, ncols=6,
23 ax0 = fig.add_subplot(gs[0, :])
25 ax1 = fig.add_subplot(gs[1, 0:3])
26 ax2 = fig.add_subplot(gs[1, 3:])
27 ax3 = fig.add_subplot(gs[2, 0:3])
28 ax4 = fig.add_subplot(gs[2, 3:])
31 ax = np.array([[ax1,ax2],[ax3,ax4]])
34 def plot_tr(path,color,ls2='--',ls3='-',label=""):
36 Function to plot mass fractions, temperature, density, radius, and electron
37 fraction of one WinNet run.
43 path_trajectory = w.get_trajectory_path()
54 ax0.plot(A[A<220],X[A<220],color=color,ls=ls3,lw=2,label=label)
56 ax0.scatter(A[A>220],X[A>220],color=color,marker=
"d",s=10)
61 ax0.set_xlabel(
"Mass number")
64 ax0.xaxis.set_label_position(
"top")
65 ax0.spines[
"bottom"].set_linewidth(2.5)
70 mainout_iteration, mainout_time, mainout_temp, mainout_dens, mainout_ye, mainout_rad, \
71 mainout_yn, mainout_yp, mainout_ya, mainout_ylight, mainout_yheavy, mainout_zbar, \
72 mainout_abar, mainout_entropy = w.get_mainout()
74 time,temp,dens,ye = np.loadtxt(path_trajectory,unpack=
True,usecols=[0,1,2,4])
79 mask = mainout_time<tf
83 ax[0,0].plot(mainout_time[mask]-t0,mainout_temp[mask],lw=lw,color=color)
84 ax[0,0].plot(mainout_time[mask2]-t0,mainout_temp[mask2],lw=lw,color=color,ls=ls2)
85 ax[0,0].set_xlim(-0.1,2)
88 ax[0,1].plot(mainout_time[mask]-t0,mainout_dens[mask],lw=lw,color=color)
89 ax[0,1].plot(mainout_time[mask2]-t0,mainout_dens[mask2],lw=lw,color=color,ls=ls2)
90 ax[0,1].set_yscale(
'log')
91 ax[0,1].set_xlim(-0.1,2)
92 ax[0,1].set_ylim(2e1,5e9)
93 ax[0,1].yaxis.tick_right()
94 ax[0,1].yaxis.set_label_position(
"right")
95 ax[0,1].set_ylabel(
r"Density [g cm$^{-3}$]")
98 ax[1,0].plot(mainout_time[mask]-t0,mainout_ye[mask],lw=lw,color=color)
99 ax[1,0].plot(mainout_time[mask2]-t0,mainout_ye[mask2],lw=lw,color=color,ls=ls2)
100 ax[0,0].set_ylim(0.1,9)
101 ax[1,0].set_xlim(-0.1,2)
104 ax[1,1].plot(mainout_time[mask]-t0,mainout_rad[mask],lw=lw,color=color)
105 ax[1,1].plot(mainout_time[mask2]-t0,mainout_rad[mask2],lw=lw,color=color,ls=ls2)
106 ax[1,1].set_yscale(
'log')
107 ax[1,1].set_xlim(-0.1,2)
108 ax[1,1].set_ylim(1e2,4e6)
109 ax[1,1].yaxis.tick_right()
110 ax[1,1].yaxis.set_label_position(
"right")
111 ax[1,1].set_ylabel(
r"Radius [km]")
117 plot_tr(path,
"#005AA9",label=
"Prompt")
119 path =
"tr_PNS_shape"
120 plot_tr(path,
"#009D81",label=
"PNS-shape")
122 path =
"tr_High_entropy"
123 plot_tr(path,
"#EC6500",label=
"High entropy")
129 fig.text(0.5,0.05,
"Time [s]",ha=
"center")
132 for a
in ax.flatten():
140 pos = ax0.get_position()
141 totpos = (pos.y1+pos.y0)/2.
142 fig.text(xpos,totpos,
"Mass fraction",rotation=90,ha=
"center",va=
"center")
145 l = [
"Temperature [GK]",
r"Electron fraction"]
146 for i,a
in enumerate(ax[:,0]):
147 pos = a.get_position()
148 totpos = (pos.y1+pos.y0)/2.
149 fig.text(xpos,totpos,l[i],rotation=90,ha=
"center",va=
"center")
151 fig.savefig(
"comparison_rprocess.pdf",bbox_inches=
"tight")
159 Plot the nuclear chart at neutron freezeout, i.e., Yn/Yh = 1.
163 time = w.get_mainout_time()
164 yheavy = w.get_mainout_yheavy()
165 yn = w.get_mainout_yn()
167 index = np.argmin(abs(yn/yheavy-1))
168 t_freezout = time[index]
175 w.plot_nuclear_chart_at(t_freezout,figure=ax,axes_label=
False,element_labels=
False,fig_is_ax=
True,colorbar=
True,
176 colorbar_position=[0.27, 0.85, 0.5, 0.025],colorbar_inset=
True,min_X=min_X,max_X=max_X,
177 cmap= cmap,nuclei_linewidths=lw)
179 ax.text(0.01,0.98,label,transform=ax.transAxes,va=
"top",ha=
"left")
183 fig_chart,ax_chart = plt.subplots(1,3,figsize=(15,4),sharex=
True,sharey=
True)
185 plt.subplots_adjust(wspace=0)
191 path =
"tr_PNS_shape"
194 path =
"tr_High_entropy"
197 fig_chart.savefig(
"nuclear_chart_at_freezeout.pdf",bbox_inches=
"tight")