MCPcopy Create free account
hub / github.com/NatLabRockies/PINNSTRIPES / plot_pde_data

Function plot_pde_data

pinn_spm_param/postProcess/plotData.py:25–97  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

23
24
25def plot_pde_data(args):
26 if args.simpleModel:
27 from spm_simpler import makeParams
28 else:
29 from spm import makeParams
30
31 if not args.verbose:
32 import matplotlib
33
34 matplotlib.use("Agg")
35
36 input_params = False
37 if not args.params_list is None:
38 input_params = True
39 if input_params:
40 deg_i0_a = float(args.params_list[0])
41 deg_ds_c = float(args.params_list[1])
42 else:
43 deg_i0_a = 0.5
44 deg_ds_c = 1
45
46 params = makeParams()
47
48 dataFolder = args.dataFolder
49
50 figureFolder = "Figures"
51 os.makedirs(figureFolder, exist_ok=True)
52 figureFolder = os.path.join(
53 figureFolder, f"pde_i0a_{deg_i0_a:.2g}_dsc_{deg_ds_c:.2g}"
54 )
55
56 if not args.verbose:
57 os.makedirs(figureFolder, exist_ok=True)
58
59 if args.params_list:
60 sol = np.load(
61 os.path.join(
62 dataFolder, f"solution_{deg_i0_a:.2g}_{deg_ds_c:.2g}.npz"
63 )
64 )
65 else:
66 sol = np.load(os.path.join(dataFolder, "solution.npz"))
67 t = sol["t"]
68 r_a = sol["r_a"]
69 r_c = sol["r_c"]
70 phie = sol["phie"]
71 phis_c = sol["phis_c"]
72 cs_a = sol["cs_a"]
73 cs_c = sol["cs_c"]
74
75 # Plot Phi
76 fig = plt.figure()
77 plt.plot(t, phie, label=r"$\phi_e$")
78 plt.plot(t, phis_c, label=r"$\phi_{s,c}$")
79 pretty_labels("t", "[V]", 14)
80 pretty_legend()
81 if not args.verbose:
82 plt.savefig(os.path.join(figureFolder, "PhiData.png"))

Callers 2

test_plot_dataFunction · 0.90
plotData.pyFile · 0.85

Calls 1

makeParamsFunction · 0.90

Tested by 1

test_plot_dataFunction · 0.72