Skip to content

Commit

Permalink
modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
frank-ccc committed Jan 5, 2020
1 parent 10342e7 commit 63125d3
Show file tree
Hide file tree
Showing 2 changed files with 425 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1) read in the impedance data from the csv file"
"## 1) Read in the impedance data from the csv file\n",
"### IMPORTANT: the frequency value should be sorted ascendingly (from low to high)"
]
},
{
Expand All @@ -44,8 +45,6 @@
"metadata": {},
"outputs": [],
"source": [
"# read the experimental impedance data stored in a csv file\n",
"# IMPORTANT: the frequency value is sorted from low to high in default\n",
"Z_data = pd.read_csv('EIS_experiment.csv')\n",
"freq_vec, Z_exp = Z_data['freq'].values, Z_data['Z_real'].values+1j*Z_data['Z_imag'].values\n",
"\n",
Expand All @@ -54,7 +53,7 @@
"xi_vec = np.log(freq_vec)\n",
"tau = 1/freq_vec\n",
"\n",
"# define the frequency range used for prediction, we choose a wider range to better capture the DRT\n",
"# define the frequency range used for prediction, we choose a wider range to better display the DRT\n",
"freq_vec_star = np.logspace(-4., 6., num=101, endpoint=True)\n",
"xi_vec_star = np.log(freq_vec_star)\n",
"\n",
Expand All @@ -66,7 +65,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2) show the impedance in a Nyquist plot."
"## 2) Show the impedance spectrum as a Nyquist plot"
]
},
{
Expand All @@ -88,7 +87,7 @@
}
],
"source": [
"# Nyquist plot of the impedance\n",
"# Nyquist plot of the EIS spectrum\n",
"plt.plot(np.real(Z_exp), -np.imag(Z_exp), \"o\", markersize=10, fillstyle='none', color=\"red\", label=\"experiment\")\n",
"plt.plot(np.real(Z_exp[40:80:10]), -np.imag(Z_exp[40:80:10]), 'o', markersize=10, color=\"black\")\n",
"\n",
Expand All @@ -99,7 +98,7 @@
"plt.legend(frameon=False, fontsize = 15)\n",
"plt.axis('scaled')\n",
"\n",
"# be arful about the axis range, modify this according to real data\n",
"# this depends on the data used - if you wish to use your own data you may need to modify this\n",
"plt.xlim(1.42, 1.52)\n",
"plt.ylim(-0.001, 0.051)\n",
"plt.xticks(np.arange(1.42, 1.521, 0.02))\n",
Expand All @@ -108,7 +107,7 @@
"plt.xlabel(r'$Z_{\\rm re}/\\Omega$', fontsize = 20)\n",
"plt.ylabel(r'$-Z_{\\rm im}/\\Omega$', fontsize = 20)\n",
"\n",
"# label the frequency points, should be modified according to real frequency data\n",
"# label the frequencies - if you wish to use your own data you may need to modify this\n",
"label_index = range(40,80,10)\n",
"move = [[-0.005, 0.008], [-0.005, 0.008], [-0.005, 0.008], [-0.005, 0.01]]\n",
"for k, ind in enumerate(label_index):\n",
Expand All @@ -125,7 +124,7 @@
"metadata": {},
"source": [
"## 3) Compute the optimal hyperparameters\n",
"Note: the intial parameter may be adjust according to different problems"
"### Note: the intial parameters may need to be adjusted according to the specific problem"
]
},
{
Expand Down Expand Up @@ -182,7 +181,7 @@
}
],
"source": [
"# initialize the parameter for global 3D optimization to maximize the marginal log-likelihood as shown in eq (31)\n",
"# initial parameters parameter to maximize the marginal log-likelihood as shown in eq (31)\n",
"sigma_n = 1.0E-4\n",
"sigma_f = 1.0E-3\n",
"ell = 1.0\n",
Expand Down Expand Up @@ -354,7 +353,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### 4e) Plot the imaginary part of the GP-DRT impedance together with the exact one "
"### 4e) Plot the imaginary part of the GP-DRT impedance together with the experimental one"
]
},
{
Expand Down
Loading

0 comments on commit 63125d3

Please sign in to comment.