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

Function computeError

pinn_spm_param/postProcess/computeError.py:28–91  ·  view source on GitHub ↗
(dataDict, predDict, debug=False)

Source from the content-addressed store, hash-verified

26
27
28def computeError(dataDict, predDict, debug=False):
29 phie_rescaled = predDict["phie"]
30 phis_c_rescaled = predDict["phis_c"]
31 cs_a_rescaled = predDict["cs_a"]
32 cs_c_rescaled = predDict["cs_c"]
33
34 yTest_phie = dataDict["phie"]
35 yTest_phis_c = dataDict["phis_c"]
36 yTest_cs_a = dataDict["cs_a"]
37 yTest_cs_c = dataDict["cs_c"]
38
39 if debug:
40 import matplotlib.pyplot as plt
41
42 globalError = 0
43 tmp = np.mean(
44 abs(yTest_phie - phie_rescaled)
45 / np.clip(abs(yTest_phie), a_min=1e-16, a_max=None)
46 )
47 globalError += tmp
48 globalError_phie = tmp
49 if debug:
50 plt.plot(yTest_phie, phie_rescaled, "o")
51 plt.title(f"phie {tmp}")
52 plt.show()
53 tmp = np.mean(
54 abs(yTest_phis_c - phis_c_rescaled)
55 / np.clip(abs(yTest_phis_c), a_min=1e-16, a_max=None)
56 )
57 term_volt = np.mean(abs(yTest_phis_c - phis_c_rescaled))
58 globalError += tmp
59 globalError_phis_c = tmp
60 if debug:
61 plt.plot(yTest_phis_c, phis_c_rescaled, "o")
62 plt.title(f"phis_c {tmp}")
63 plt.show()
64 tmp = np.mean(
65 abs(yTest_cs_a - cs_a_rescaled)
66 / np.clip(abs(yTest_cs_a), a_min=1e-16, a_max=None)
67 )
68 globalError += tmp
69 globalError_cs_a = tmp
70 if debug:
71 plt.plot(yTest_cs_a, cs_a_rescaled, "o")
72 plt.title(f"cs_a {tmp}")
73 plt.show()
74 tmp = np.mean(
75 abs(yTest_cs_c - cs_c_rescaled)
76 / np.clip(abs(yTest_cs_c), a_min=1e-16, a_max=None)
77 )
78 globalError += tmp
79 globalError_cs_c = tmp
80 if debug:
81 plt.plot(yTest_cs_c, cs_c_rescaled, "o")
82 plt.title(f"cs_c {tmp}")
83 plt.show()
84
85 return globalError, {

Callers 3

test_comp_errFunction · 0.90
computeError.pyFile · 0.85

Calls

no outgoing calls

Tested by 1

test_comp_errFunction · 0.72