ECSHackWeek / impedance.py

A Python package for working with electrochemical impedance data
MIT License
212 stars 103 forks source link

print method error[BUG] #238

Closed oslopanda closed 1 year ago

oslopanda commented 1 year ago

The following code raise error:

from impedance.models.circuits import CustomCircuit
customCircuit = CustomCircuit(initial_guess=[0.045,None,.1,0.8,None, .1,0.8,],constants = {'R_1':0.03, 'R_2':0.03},
                              circuit='R_0-p(R_1,CPE_1)-p(R_2,CPE_2)')
print(customCircuit)
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Cell In[3], line 1
----> 1 print(customCircuit)

File ~\Anaconda3\envs\impedance\lib\site-packages\impedance\models\circuits\circuits.py:213, in BaseCircuit.__str__(self)
    211 units = check_and_eval(elem).units
    212 if '_' in name:
--> 213     unit = units[int(name.split('_')[-1])]
    214 else:
    215     unit = units[0]

IndexError: list index out of range
mdmurbach commented 1 year ago

Fixed by #237