-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_circuit_fitting.py
104 lines (93 loc) · 4.66 KB
/
test_circuit_fitting.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
from .EISDataIO import eis_dataframe_from_csv, ECM_from_raw_strings
class TestCircuitFitting:
eis_data = eis_dataframe_from_csv("train_data.csv")
def test_l_r_rcpe_rcpe_rcpe(self):
sample = self.eis_data.loc[self.eis_data.Circuit == "L-R-RCPE-RCPE-RCPE"].iloc[0]
frequencies = sample.freq
impedances = sample.Z
circuit = ECM_from_raw_strings(sample.Circuit, sample.Parameters)
params_before_fit = circuit.param_values
circuit.fit(frequencies, impedances)
params_after_fit = circuit.param_values
assert params_after_fit != params_before_fit
assert len(params_after_fit) == len(params_before_fit)
def test_l_r_rcpe_rcpe(self):
sample = self.eis_data.loc[self.eis_data.Circuit == "L-R-RCPE-RCPE"].iloc[0]
frequencies = sample.freq
impedances = sample.Z
circuit = ECM_from_raw_strings(sample.Circuit, sample.Parameters)
params_before_fit = circuit.param_values
circuit.fit(frequencies, impedances)
params_after_fit = circuit.param_values
assert params_after_fit != params_before_fit
assert len(params_after_fit) == len(params_before_fit)
def test_l_r_rcpe(self):
sample = self.eis_data.loc[self.eis_data.Circuit == "L-R-RCPE"].iloc[0]
frequencies = sample.freq
impedances = sample.Z
circuit = ECM_from_raw_strings(sample.Circuit, sample.Parameters)
params_before_fit = circuit.param_values
circuit.fit(frequencies, impedances)
params_after_fit = circuit.param_values
assert params_after_fit != params_before_fit
assert len(params_after_fit) == len(params_before_fit)
def test_rc_g_g(self):
sample = self.eis_data.loc[self.eis_data.Circuit == "RC-G-G"].iloc[0]
frequencies = sample.freq
impedances = sample.Z
circuit = ECM_from_raw_strings(sample.Circuit, sample.Parameters)
params_before_fit = circuit.param_values
circuit.fit(frequencies, impedances)
params_after_fit = circuit.param_values
assert params_after_fit != params_before_fit
assert len(params_after_fit) == len(params_before_fit)
def test_rc_rc_rcpe_rcpe(self):
sample = self.eis_data.loc[self.eis_data.Circuit == "RC-RC-RCPE-RCPE"].iloc[0]
frequencies = sample.freq
impedances = sample.Z
circuit = ECM_from_raw_strings(sample.Circuit, sample.Parameters)
params_before_fit = circuit.param_values
circuit.fit(frequencies, impedances)
params_after_fit = circuit.param_values
assert params_after_fit != params_before_fit
assert len(params_after_fit) == len(params_before_fit)
def test_rcpe_rcpe_rcpe_rcpe(self):
sample = self.eis_data.loc[self.eis_data.Circuit == "RCPE-RCPE-RCPE-RCPE"].iloc[0]
frequencies = sample.freq
impedances = sample.Z
circuit = ECM_from_raw_strings(sample.Circuit, sample.Parameters)
params_before_fit = circuit.param_values
circuit.fit(frequencies, impedances)
params_after_fit = circuit.param_values
assert params_after_fit != params_before_fit
assert len(params_after_fit) == len(params_before_fit)
def test_rcpe_rcpe_rcpe(self):
sample = self.eis_data.loc[self.eis_data.Circuit == "RCPE-RCPE-RCPE"].iloc[0]
frequencies = sample.freq
impedances = sample.Z
circuit = ECM_from_raw_strings(sample.Circuit, sample.Parameters)
params_before_fit = circuit.param_values
circuit.fit(frequencies, impedances)
params_after_fit = circuit.param_values
assert params_after_fit != params_before_fit
assert len(params_after_fit) == len(params_before_fit)
def test_rcpe_rcpe(self):
sample = self.eis_data.loc[self.eis_data.Circuit == "RCPE-RCPE"].iloc[0]
frequencies = sample.freq
impedances = sample.Z
circuit = ECM_from_raw_strings(sample.Circuit, sample.Parameters)
params_before_fit = circuit.param_values
circuit.fit(frequencies, impedances)
params_after_fit = circuit.param_values
assert params_after_fit != params_before_fit
assert len(params_after_fit) == len(params_before_fit)
def test_rs_ws(self):
sample = self.eis_data.loc[self.eis_data.Circuit == "Rs_Ws"].iloc[0]
frequencies = sample.freq
impedances = sample.Z
circuit = ECM_from_raw_strings(sample.Circuit, sample.Parameters)
params_before_fit = circuit.param_values
circuit.fit(frequencies, impedances)
params_after_fit = circuit.param_values
assert params_after_fit != params_before_fit
assert len(params_after_fit) == len(params_before_fit)