Skip to content

Commit

Permalink
update the massive star plotting scripts
Browse files Browse the repository at this point in the history
these reflect what was used in the paper
  • Loading branch information
zingale committed Oct 20, 2024
1 parent 71b5b56 commit 402cf97
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 21 deletions.
32 changes: 20 additions & 12 deletions Exec/science/massive_star/analysis/massive_star_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

matplotlib.use('agg')


ANNOTATE_O16 = False
ANNOTATE_NSE = True


def make_plot(plotfile, prefix="plot", width_frac=0.1,
Expand All @@ -25,8 +26,8 @@ def make_plot(plotfile, prefix="plot", width_frac=0.1,
t_drive = 0.0
if "[*] castro.drive_initial_convection_tmax" in ds.parameters:
t_drive = ds.parameters["[*] castro.drive_initial_convection_tmax"]
elif "castro.drive_initial_convection_tmax" in ds.parameters:
t_drive = ds.parameters["castro.drive_initial_convection_tmax"]
elif "[*] castro.drive_initial_convection_tmax" in ds.parameters:
t_drive = ds.parameters["[*] castro.drive_initial_convection_tmax"]
print(t_drive)

xmin = ds.domain_left_edge[0]
Expand Down Expand Up @@ -75,27 +76,34 @@ def make_plot(plotfile, prefix="plot", width_frac=0.1,
sp.set_cmap(f, "magma")
sp.set_zlim(f, 1.e-2, 5)

if f == "enuc":
# now do a contour of NSE
if ("boxlib", "in_nse") in ds.derived_field_list:
sp.annotate_contour("in_nse", ncont=1, clim=(0.5, 0.5), take_log=False,
plot_args={"colors": "k", "linewidths": 2})

# now do a contour of O
if ANNOTATE_O16:
sp.annotate_contour(("boxlib", "X(O16)"), ncont=1, clim=(0.5, 0.5), factor=32, take_log=False,
plot_args={"colors": "0.5", "linewidths": 2})

# now do a contour of NSE
if ANNOTATE_NSE:
if ("boxlib", "in_nse") in ds.derived_field_list:
sp.annotate_contour("in_nse", levels=1, clim=(0.5, 0.5), take_log=False,
plot_args={"colors": "k", "linewidths": 2})


sp.set_axes_unit("cm")

fig = sp.export_to_mpl_figure((layout[0], layout[1]), axes_pad=(1.0, 0.4),
cbar_location=cbar_location, cbar_pad="2%")

fig.subplots_adjust(left=0.05, right=0.95, bottom=0.025, top=0.975)
fig.text(0.02, 0.02, f"$t - \\tau_\\mathrm{{drive}}$ = {float(ds.current_time) - t_drive:6.1f} s",
fig.subplots_adjust(left=0.05, right=0.95, bottom=0.035, top=0.975)
fig.text(0.02, 0.01, f"$t - \\tau_\\mathrm{{drive}}$ = {float(ds.current_time) - t_drive:6.1f} s",
transform=fig.transFigure)
fig.set_size_inches(size)
fig.tight_layout()
extra = ""
if layout[0] >= layout[1]:
extra = "_vertical"

fig.savefig(f"{prefix}_{os.path.basename(plotfile)}_w{width_frac:04.2f}{extra}.pdf", pad_inches=0.1, bbox_inches="tight")
fig.savefig(f"{prefix}_{os.path.basename(plotfile)}_w{width_frac:04.2f}{extra}.pdf", pad_inches=0.1) #, bbox_inches="tight")


if __name__ == "__main__":
Expand All @@ -112,7 +120,7 @@ def make_plot(plotfile, prefix="plot", width_frac=0.1,
plotfile = args.plotfile[0]

if args.vertical:
size = (7.5, 11.0)
size = (7.0, 10.0)
layout = (2, 2)
else:
size = (19.2, 8.5)
Expand Down
17 changes: 8 additions & 9 deletions Exec/science/massive_star/analysis/massive_star_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

matplotlib.use('agg')

times = [50, 100, 150, 200, 250]
times = [50, 100, 150, 200, 250, 300]

def find_files(plist):

Expand Down Expand Up @@ -60,8 +60,8 @@ def make_plot(field, pfiles, *,
t_drive = 0.0
if "[*] castro.drive_initial_convection_tmax" in ds.parameters:
t_drive = ds.parameters["[*] castro.drive_initial_convection_tmax"]
elif "castro.drive_initial_convection_tmax" in ds.parameters:
t_drive = ds.parameters["castro.drive_initial_convection_tmax"]
elif "[*] castro.drive_initial_convection_tmax" in ds.parameters:
t_drive = ds.parameters["[*] castro.drive_initial_convection_tmax"]
print(t_drive)

xmin = ds.domain_left_edge[0]
Expand Down Expand Up @@ -127,11 +127,10 @@ def make_plot(field, pfiles, *,
sp.set_cmap(f, "magma")
sp.set_zlim(f, 1.e-2, 5)

if f == "enuc":
# now do a contour of NSE
if ("boxlib", "in_nse") in ds.derived_field_list:
sp.annotate_contour("in_nse", levels=1, clim=(0.5, 0.5), take_log=False,
plot_args={"colors": "k", "linewidths": 2})
# now do a contour of NSE
if ("boxlib", "in_nse") in ds.derived_field_list:
sp.annotate_contour("in_nse", levels=1, clim=(0.5, 0.5), take_log=False,
plot_args={"colors": "k", "linewidths": 2})

sp.set_axes_unit("cm")

Expand Down Expand Up @@ -168,7 +167,7 @@ def make_plot(field, pfiles, *,
args = p.parse_args()

if args.vertical:
size = (7.5, 8.5)
size = (7.0, 8.0)
else:
size = (19.2, 8.5)

Expand Down

0 comments on commit 402cf97

Please sign in to comment.