How to use the impedance.models.circuits.__init__.BaseCircuit 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 / impedance / models / circuits / __init__.py View on Github external
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)).
github ECSHackWeek / impedance.py / impedance / models / circuits / __init__.py View on Github external
model_constants = json_data["Constants"]

        self.initial_guess = model_initial_guess
        self.circuit = model_string
        self.constants = model_constants
        self.name = model_name

        if json_data["Fit"]:
            if fitted_as_initial:
                self.initial_guess = np.array(json_data['Parameters'])
            else:
                self.parameters_ = np.array(json_data["Parameters"])
                self.conf_ = np.array(json_data["Confidence"])


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'