ECSHackWeek / impedance.py

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

Plotting update and a bug fix #237

Closed oslopanda closed 1 year ago

oslopanda commented 1 year ago

When there are multiple Nyquist or bode plots, it would be better to change the font size of x and y labels and ticks to fit the figure area. So just added the option for change with the default value the same as previous settings.

for the circuits.py: if there is a circuit like

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)')

the --str-- method will raise error when print (customCircuit), but not for

customCircuit = CustomCircuit(initial_guess=[0.045,None,.1,0.8,None, .1,0.8,],constants = {'R_1_0':0.03, 'R_2_0':0.03},
                              circuit='R_0-p(R_1,CPE_1)-p(R_2,CPE_2)')

the reason is related to the code :

if '_' in name:
                    unit = units[int(name.split('_')[-1])]

So i added a evaluation that only if the len(uinits)>1 to apply the code.

mdmurbach commented 1 year ago

Thanks for putting together a PR with these bug fixes! It's failing the GitHub Actions testing because Python 3.6 is no longer supported (I fixed our workflow earlier so it should work now). Will merge these in and we can fix anything that doesn't pass in a separate PR (looks good to me now with the one whitespace fix).