Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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'
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)
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)).
Elements with two or more parameters are separated by a forward slash
(`/`).
Example:
Randles circuit is given by 'R0-p(R1,C1)-W1/W2'
"""
super().__init__(**kwargs)
self.circuit = circuit
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)