|
3 | 3 | from zahner_analysis.file_import.ism_import import IsmImport
|
4 | 4 | import matplotlib.pyplot as plt
|
5 | 5 |
|
6 |
| -if __name__ == "__main__": |
7 |
| - impedanceCircuitModel = IsfxModelImport("rc-model.isfx") |
8 |
| - impedanceData = IsmImport("rc-data.ism") |
| 6 | +impedanceCircuitModel = IsfxModelImport("rc-model.isfx") |
| 7 | +impedanceData = IsmImport("rc-data.ism") |
9 | 8 |
|
10 |
| - print(impedanceCircuitModel) |
| 9 | +print(impedanceCircuitModel) |
11 | 10 |
|
12 |
| - fitting = EisFitting() |
| 11 | +fitting = EisFitting() |
13 | 12 |
|
14 |
| - fittingResult = fitting.fit(impedanceCircuitModel, impedanceData) |
| 13 | +fittingResult = fitting.fit(impedanceCircuitModel, impedanceData) |
15 | 14 |
|
16 |
| - print(fittingResult) |
| 15 | +print(fittingResult) |
17 | 16 |
|
18 |
| - foldername = "fit_results" |
19 |
| - fittingResult.save(foldername=foldername) |
| 17 | +foldername = "fit_results" |
| 18 | +fittingResult.save(foldername=foldername) |
20 | 19 |
|
21 |
| - (fig2, (impedanceAxis2, phaseAxis2)) = EisFittingPlotter.plotBode(fittingResult) |
| 20 | +(fig2, (impedanceAxis2, phaseAxis2)) = EisFittingPlotter.plotBode(fittingResult) |
22 | 21 |
|
23 |
| - impedanceAxis2.legend( |
24 |
| - impedanceAxis2.get_lines() + phaseAxis2.get_lines(), |
25 |
| - 2 * ["Measured Data", "Fitted Model"], |
26 |
| - ) |
| 22 | +impedanceAxis2.legend( |
| 23 | + impedanceAxis2.get_lines() + phaseAxis2.get_lines(), |
| 24 | + 2 * ["Measured Data", "Fitted Model"], |
| 25 | +) |
27 | 26 |
|
28 |
| - fig2.set_size_inches(18, 10) |
29 |
| - plt.show() |
| 27 | +fig2.set_size_inches(18, 10) |
| 28 | +plt.show() |
30 | 29 |
|
31 |
| - fig2.savefig(f"{foldername}/bode.svg") |
| 30 | +fig2.savefig(f"{foldername}/bode.svg") |
32 | 31 |
|
33 |
| - fittetModel = fittingResult.getFittedModel() |
| 32 | +fittetModel = fittingResult.getFittedModel() |
| 33 | + |
| 34 | +print( |
| 35 | + f"{fittetModel['C0'].getType()}: {fittetModel['C0']['C'].getValue():1.3e} {fittetModel['C0']['C'].getUnit()}" |
| 36 | +) |
| 37 | +print( |
| 38 | + f"{fittetModel['R0'].getType()}: {fittetModel['R0']['R'].getValue():1.3e} {fittetModel['R0']['R'].getUnit()}" |
| 39 | +) |
| 40 | + |
| 41 | +print(f"System: {impedanceData.getSystemString()}") |
| 42 | +print(f"Voltage: {impedanceData.getStartVoltageString()}") |
| 43 | +print(f"Current: {impedanceData.getStartCurrentString()}") |
| 44 | +print(f"Temperature: {impedanceData.getStartTemperatureString()}") |
| 45 | +print(f"Time window: {impedanceData.getTimeWindowString()}") |
| 46 | +print(f"Comment: {impedanceData.getCommentStrings()}") |
| 47 | +print(f"Amplitude: {impedanceData.getAmplitude()}") |
| 48 | + |
| 49 | +for track in impedanceData.getTrackTypesList(): |
| 50 | + print(track) |
| 51 | + print(impedanceData.getTrack(track)[0:3]) |
34 | 52 |
|
35 |
| - print( |
36 |
| - f"{fittetModel['C0'].getType()}: {fittetModel['C0']['C'].getValue():1.3e} {fittetModel['C0']['C'].getUnit()}" |
37 |
| - ) |
38 |
| - print( |
39 |
| - f"{fittetModel['R0'].getType()}: {fittetModel['R0']['R'].getValue():1.3e} {fittetModel['R0']['R'].getUnit()}" |
40 |
| - ) |
|
0 commit comments