WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/source/examples/validation_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,10 @@
"ax2 = fig.add_subplot(gs[2,:])\n",
"\n",
"# plot original data\n",
"plot_nyquist(ax1, Z, fmt='s')\n",
"plot_nyquist(ax=ax1, Z=Z, fmt='s')\n",
"\n",
"# plot measurement model\n",
"plot_nyquist(ax1, meas_model.predict(f), fmt='-', scale=1e3, units='\\Omega')\n",
"plot_nyquist(ax=ax1, Z=meas_model.predict(f), fmt='-', scale=1e3, units='\\Omega')\n",
"\n",
"ax1.legend(['Data', 'Measurement model'], loc=2, fontsize=12)\n",
"\n",
Expand Down Expand Up @@ -330,10 +330,10 @@
"ax2 = fig.add_subplot(gs[2,:])\n",
"\n",
"# plot original data\n",
"plot_nyquist(ax1, Z, fmt='s')\n",
"plot_nyquist(ax=ax1, Z=Z, fmt='s')\n",
"\n",
"# plot measurement model\n",
"plot_nyquist(ax1, Z_linKK, fmt='-', scale=1e3, units='\\Omega')\n",
"plot_nyquist(ax=ax1, Z=Z_linKK, fmt='-', scale=1e3, units='\\Omega')\n",
"\n",
"ax1.legend(['Data', 'Lin-KK model'], loc=2, fontsize=12)\n",
"\n",
Expand Down
33 changes: 33 additions & 0 deletions impedance/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,39 @@ def readCHInstruments(filename):

return np.array(f), np.array(Z)

def readKolibrik(filename):
""" function for dat files from Kolibrik Potentiostats

Parameters
----------
filename: string
Filename of .dat file to extract impedance data

Returns
-------
frequencies : np.ndarray
Array of frequencies
impedance : np.ndarray of complex numbers
Array of complex impedances

"""

with open(filename, 'r', encoding="utf8") as input_file:
lines = input_file.readlines()

for i, line in enumerate(lines):
if line.find('[Data]') != -1:
start_line = i

raw_data = lines[start_line+2:-1]
f, Z = [], []
for line in raw_data:
each = line.split('\t')
f.append(float(each[5]))
Z.append(complex(float(each[3]), float(each[4])))

return np.array(f), np.array(Z)


def readCSV(filename):
""" function for reading plain csv files
Expand Down
2 changes: 1 addition & 1 deletion impedance/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def eval_linKK(elements, ts, f):
circuit_string = circuit_string.strip(',')
circuit_string += '])'

return eval(circuit_string, circuit_elements)
return eval(circuit_string, {**circuit_elements, 'np': np})


def residuals_linKK(elements, ts, Z, f, residuals='real'):
Expand Down