Giter Club home page Giter Club logo

Comments (2)

lktsui avatar lktsui commented on June 12, 2024 1

Test code for a single resistor.

from impedance.models.circuits import CustomCircuit
import numpy as np
test_circuit = CustomCircuit(circuit='R_1', initial_guess = [1.0,])
print(test_circuit)
frequency_range = np.linspace(0,100)
test_circuit.predict(frequency_range)
Circuit string: R_1
Fit: False

Initial guesses:
    R_1 = 1.00e+00 [Ohm]

Simulating circuit based on initial parameters
---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
<ipython-input-10-cbc428542153> in <module>
      4 print(test_circuit)
      5 frequency_range = np.linspace(0,100)
----> 6 test_circuit.predict(frequency_range)

~/Documents/Programs/impedance.py/impedance/models/circuits/circuits.py in predict(self, frequencies, use_initial)
    156                                      *self.initial_guess,
    157                                      constants=self.constants, eval_string='',
--> 158                                      index=0)[0],
    159                         circuit_elements)
    160 

~/Documents/Programs/impedance.py/impedance/models/circuits/fitting.py in buildCircuit(circuit, frequencies, constants, eval_string, index, *parameters)
    204         split = parallel
    205 
--> 206     for i, elem in enumerate(split):
    207         if ',' in elem or '-' in elem:
    208             eval_string, index = buildCircuit(elem, frequencies,

UnboundLocalError: local variable 'split' referenced before assignment

from impedance.py.

BGerwe avatar BGerwe commented on June 12, 2024

I can replicate this issue locally and it doesn't seem to matter what element is input. I think the issue is we don't have logic for a scenario where neither series nor parallel markers are in the string:

parallel = parse_circuit(circuit, parallel=True)
series = parse_circuit(circuit, series=True)

if series is not None and len(series) > 1:
    eval_string += "s(["
    split = series
elif parallel is not None and len(parallel) > 1:
    eval_string += "p(["
    split = parallel

for i, elem in enumerate(split):

from impedance.py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.