MCPcopy Create free account
hub / github.com/AMReX-Astro/Castro / doit

Function doit

Exec/unit_tests/diffusion_test/analysis/profiles.py:45–85  ·  view source on GitHub ↗
(prefix, nums, skip, limitlabels, xmin, xmax)

Source from the content-addressed store, hash-verified

43
44
45def doit(prefix, nums, skip, limitlabels, xmin, xmax):
46
47 f = plt.figure()
48 f.set_size_inches(7.0, 7.0)
49
50 ax_T = f.add_subplot(111)
51
52 # Get colors
53 numplots = len(range(0, len(nums), skip))
54 colors = plt.cm.nipy_spectral(np.linspace(0, 1, numplots))
55
56 if limitlabels > 1:
57 skiplabels = int(numplots / limitlabels)
58 elif limitlabels < 0:
59 print("Illegal value for limitlabels: %.0f" % limitlabels)
60 sys.exit()
61 else:
62 skiplabels = 1
63 index = 0
64
65 for n in range(0, len(nums), skip):
66 pfile = f"{prefix}{nums[n]}"
67 i = int(n / skip)
68 time, x, T, analytic_T = get_T_profile(pfile)
69
70 if index % skiplabels == 0:
71 ax_T.plot(x, T, "-", color=colors[i], label=f"simulation: t = {time:7.5f} s")
72 ax_T.plot(x, analytic_T, "--", color=colors[i], label=f"analytic: t = {time:7.5f} s")
73 else:
74 ax_T.plot(x, T, "-", color=colors[i])
75 ax_T.plot(x, analytic_T, "--", color=colors[i])
76
77 index += 1
78
79 ax_T.legend(frameon=False)
80 ax_T.set_ylabel("T (K)")
81
82 if xmax > 0:
83 ax_T.set_xlim(xmin, xmax)
84
85 f.savefig("diffuse.png")
86
87
88if __name__ == "__main__":

Callers 1

profiles.pyFile · 0.70

Calls 1

get_T_profileFunction · 0.70

Tested by

no test coverage detected