Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions Exec/science/Detonation/analysis/snapshot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# Plot the structure of a single plotfile, including the most abundance nuclei

Expand Down Expand Up @@ -74,7 +74,7 @@ def get_nuc_profile(plotfile):
return time, x_coord, nuc_fracs, nuc_names


def doit(pf, xmin, xmax, nuc_thresh):
def doit(pf, xmin, xmax, nuc_thresh, axis_label_size, tick_size, legend_size):

f = plt.figure()

Expand All @@ -86,6 +86,13 @@ def doit(pf, xmin, xmax, nuc_thresh):
ax_e = f.add_subplot(312)
ax_X = f.add_subplot(313)

for ax in [ax_T, ax_e, ax_X]:
ax.xaxis.label.set_size(axis_label_size)
ax.yaxis.label.set_size(axis_label_size)
ax.tick_params(axis='both', which='major', labelsize=tick_size)
ax.tick_params(axis='both', which='minor', labelsize=tick_size)


time, x, T, enuc = get_Te_profile(pf)

_, __, mass_fractions, nuc_names = get_nuc_profile(pf)
Expand All @@ -109,6 +116,13 @@ def doit(pf, xmin, xmax, nuc_thresh):
ax_T.xaxis.set_major_formatter(mticker.ScalarFormatter(useMathText=True))
ax_T.yaxis.set_major_formatter(mticker.ScalarFormatter(useMathText=True))

ax_T.xaxis.offsetText.set_fontsize(axis_label_size)
ax_T.yaxis.offsetText.set_fontsize(axis_label_size)
ax_e.xaxis.offsetText.set_fontsize(axis_label_size)
ax_e.yaxis.offsetText.set_fontsize(axis_label_size)
ax_X.xaxis.offsetText.set_fontsize(axis_label_size)
ax_X.yaxis.offsetText.set_fontsize(axis_label_size)

if xmax > 0:
ax_T.set_xlim(xmin, xmax)
ax_e.set_xlim(xmin, xmax)
Expand All @@ -117,8 +131,6 @@ def doit(pf, xmin, xmax, nuc_thresh):
max_enuc = np.abs(enuc).max()
ax_e.set_yscale("symlog", linthresh=1.e-6 * max_enuc)
ax_e.set_ylabel(r"$S_\mathrm{nuc}$ (erg/g/s)")
#cur_lims = ax_e.get_ylim()
#ax_e.set_ylim(1.e-10*cur_lims[-1], cur_lims[-1])
ax_e.xaxis.set_major_formatter(mticker.ScalarFormatter(useMathText=True))

ax_X.set_yscale("log")
Expand All @@ -130,10 +142,10 @@ def doit(pf, xmin, xmax, nuc_thresh):
if nplot >= 5:
ncol = 2

ax_X.legend(ncol=ncol, fontsize="small") #, loc="upper left")
ax_X.legend(ncol=ncol, fontsize=legend_size) #, loc="upper left")
ax_X.xaxis.set_major_formatter(mticker.ScalarFormatter(useMathText=True))

f.text(0.02, 0.02, f"t = {float(time):8.3f} s", transform=f.transFigure)
f.text(0.02, 0.02, f"t = {float(time):8.3f} s", transform=f.transFigure, fontsize=axis_label_size)
f.tight_layout()

prefix = os.getcwd().split("/")[-1]
Expand All @@ -154,7 +166,13 @@ def doit(pf, xmin, xmax, nuc_thresh):
help="minimum value of X for a nuclei to be plotted")
p.add_argument("plotfile", type=str, nargs=1,
help="plotfiles to plot")
p.add_argument("--axis_label_size", type=float, default=12.0,
help="size of the x-axis text in points")
p.add_argument("--tick_size", type=float, default=12.0,
help="size of the tick labels in points")
p.add_argument("--legend_size", type=float, default=12.0,\
help="size of the legend text in points")

args = p.parse_args()

doit(args.plotfile[0], args.xmin, args.xmax, args.nuc_thresh)
doit(args.plotfile[0], args.xmin, args.xmax, args.nuc_thresh, args.axis_label_size, args.tick_size, args.legend_size)
Loading