-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_usage.py
71 lines (67 loc) · 1.88 KB
/
example_usage.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
import Surface_confined_inference as sci
from Surface_confined_inference.plot import plot_harmonics
from Surface_confined_inference.infer import get_input_parameters
import sys
import matplotlib.pyplot as plt
import numpy as np
ftv = sci.SingleExperiment(
"FTACV",
{
"E_start": -0.4,
"E_reverse": 0.3,
"omega": 10,
"delta_E": 0.15,
"area": 0.07,
"Temp": 298,
"N_elec": 1,
"phase": 0,
"Surface_coverage": 1e-10,
"v": 25e-3,
},
)
ftv.boundaries = {"k0": [1e-3, 200], "E0_std": [1e-3, 0.06]}
ftv.fixed_parameters = {
"E0_mean":0.1,
"Cdl": 1e-4,
"gamma": 1e-10,
"alpha": 0.5,
"Ru": 100,
}
ftv.dispersion_bins=[2]
ftv.GH_quadrature=True
ftv.optim_list = ["E0_std","k0"]
nondim_t = ftv.calculate_times(sampling_factor=200, dimensional=False)
dim_t = ftv.dim_t(nondim_t)
dec_amount=8
voltage=ftv.get_voltage(dim_t, dimensional=True)
current = ftv.dim_i(ftv.simulate([0.03,100],nondim_t, ))
"""
sci.infer.get_input_parameters(dim_t, sci._utils.add_noise(voltage, 0.01*max(voltage)), current, "FTACV", plot_results=True)
current_fig, current_ax = plt.subplots()
current_ax.plot(dim_t, current)
current_ax.set_xlabel("Time (s)")
current_ax.set_ylabel("Current (A)")
plot_harmonics(
Synthetic_data={"time": dim_t, "current": current},
hanning=False,
plot_func=abs,
harmonics=list(range(3, 9)),
xlabel="Time (s)",
ylabel="Current (A)"
)
plt.show()"""
ftv.save_class("json_test")
load=sci.LoadSingleExperiment("json_test.json")
plt.plot(current)
plt.plot(load.dim_i(load.simulate([0.03, 100], nondim_t)))
plt.show()
"""
FT=ftv.FTsimulate([0.03,100],nondim_t,dispersion_bins=[5], Fourier_harmonics=list(range(1, 4)))
print(ftv.dispersion_bins)
plt.plot(FT)
plt.show()
ftv.normalise_parameters=True
plt.plot(ftv.Dimensionalsimulate([0.03,100],nondim_t,))
print(ftv.normalise_parameters)
plt.show()
"""