How to use the impedance.circuits.Randles function in impedance

To help you get started, we’ve selected a few impedance examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ECSHackWeek / impedance.py / examples / randles.py View on Github external
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append('../')

# import Randles circuit object
from impedance.circuits import Randles  # noqa E402

# read in data
data = np.genfromtxt('./data/exampleData.csv', delimiter=',')
f = data[:, 0]
Z = data[:, 1] + 1j*data[:, 2]

# initialize circuit objects
randles = Randles(initial_guess=[.01, .005, .1, .0001, 500])
randlesCPE = Randles(initial_guess=[.01, .005, .1, .9, .0001, 500], CPE=True)

# fit models
randles.fit(f, Z)
randlesCPE.fit(f, Z)

# print model objects
print(randles)
print(randlesCPE)

# impedance predictions based on model fits
Z_randles = randles.predict(f)
Z_randlesCPE = randlesCPE.predict(f)

# plot the data and the fits
fig, ax = plt.subplots(figsize=(5, 5))
ax.plot(np.real(Z), -np.imag(Z), 'o')
github ECSHackWeek / impedance.py / examples / randles.py View on Github external
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append('../')

# import Randles circuit object
from impedance.circuits import Randles  # noqa E402

# read in data
data = np.genfromtxt('./data/exampleData.csv', delimiter=',')
f = data[:, 0]
Z = data[:, 1] + 1j*data[:, 2]

# initialize circuit objects
randles = Randles(initial_guess=[.01, .005, .1, .0001, 500])
randlesCPE = Randles(initial_guess=[.01, .005, .1, .9, .0001, 500], CPE=True)

# fit models
randles.fit(f, Z)
randlesCPE.fit(f, Z)

# print model objects
print(randles)
print(randlesCPE)

# impedance predictions based on model fits
Z_randles = randles.predict(f)
Z_randlesCPE = randlesCPE.predict(f)

# plot the data and the fits
fig, ax = plt.subplots(figsize=(5, 5))