Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.name = 'Randles w/ CPE'
self.circuit = 'R0-p(R1,E1)-W1'
else:
self.name = 'Randles'
self.circuit = 'R0-p(R1,C1)-W1'
circuit_len = calculateCircuitLength(self.circuit)
assert len(self.initial_guess) + len(self.constants) == circuit_len, \
'The number of initial guesses + ' + \
'the number of constants ({})'.format(len(self.initial_guess)) + \
' needs to be equal to ' + \
'the circuit length ({})'.format(circuit_len)
class CustomCircuit(BaseCircuit):
def __init__(self, circuit, **kwargs):
""" Constructor for a customizable equivalent circuit model
Parameters
----------
initial_guess: numpy array
Initial guess of the circuit values
circuit: string
A string that should be interpreted as an equivalent circuit
Notes
-----
A custom circuit is defined as a string comprised of elements in series
(separated by a `-`) and elements in parallel (grouped as (x,y)).
if conf_x:
ax.fill_betweenx(-np.imag(min_Zr), np.real(min_Zr),
np.real(max_Zr), alpha='.2',
color='#7f7f7f', zorder=-2)
if conf_y:
ax.fill_between(np.real(min_Zi), -np.imag(min_Zi),
-np.imag(max_Zi), alpha='.2',
color='#7f7f7f', zorder=-2)
ax.set_ylim(base_ylim)
ax.set_xlim(base_xlim)
return ax
class Randles(BaseCircuit):
""" A Randles circuit model class """
def __init__(self, CPE=False, **kwargs):
""" Constructor for the Randles' circuit class
Parameters
----------
initial_guess: numpy array
Initial guess of the circuit values
CPE: boolean
Use a constant phase element instead of a capacitor
"""
super().__init__(**kwargs)
if CPE:
self.name = 'Randles w/ CPE'