Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using Lin_kk function #11

Open
daleduncan opened this issue Nov 20, 2020 · 4 comments
Open

Error using Lin_kk function #11

daleduncan opened this issue Nov 20, 2020 · 4 comments

Comments

@daleduncan
Copy link

daleduncan commented Nov 20, 2020

Running the ex4.Lin_KK(legend='potential') function in the tutorial gives me the following error:

   ~\anaconda3\lib\site-packages\PyEIS\PyEIS.py", line 2639, in Lin_KK
     self.KK_rr_re.append(residual_real(re=self.df[i].re, fit_re=self.KK_circuit_fit[i].real, fit_im=-self.KK_circuit_fit[i].imag)) #relative residuals for the real part
 
   ~\anaconda3\lib\site-packages\pandas\core\generic.py", line 5139, in __getattr__
     return object.__getattribute__(self, name)
 
 AttributeError: 'Series' object has no attribute 'real'

I am able to successful run all previous tutorial examples.
Has anyone experienced a similar issue and discovered a solution?
I am running Python 3.8.3 on Windows 10. Thanks.

@flottman
Copy link

yep. It's a known issue. You're going to have to make the circuit fit a numpy value

image

@flottman
Copy link

You might just want to grab n-block's version. He seems to be on top of things
(https://github.com/n-bock/PyEIS)

@gimdeokhwan
Copy link

I've fixed the this issue, but have no authority of "pull request"
but I've tested attached code, works well.

Reason why issue happened is self.KK_circuit_fit[i].real and self.KK_circuit_fit[i].imag not aligned to array data format.

so it should be changed following
(I'm in office so not possible to upload the screen shot and code)

    #changed by Gim
        length_of_kk_circuit_fit = len(self.KK_circuit_fit[i])
        KK_circuit_fit_real = []
        KK_circuit_fit_imag = []
        for idx in range(length_of_kk_circuit_fit):
            KK_circuit_fit_real.append(self.KK_circuit_fit[i][idx+length_of_kk_circuit_fit].real)
            KK_circuit_fit_imag.append(self.KK_circuit_fit[i][idx + length_of_kk_circuit_fit].imag)

        KK_circuit_fit_real = np.array(KK_circuit_fit_real)
        KK_circuit_fit_imag = np.array(KK_circuit_fit_imag)
        self.KK_rr_re.append(residual_real(re=self.df[i].re, fit_re=KK_circuit_fit_real, fit_im=-KK_circuit_fit_imag))#relative residuals for the real part
        self.KK_rr_im.append(residual_imag(im=self.df[i].im, fit_re=KK_circuit_fit_real, fit_im=-KK_circuit_fit_imag)) #relative residuals for the imag part
        # changed by Gim

        #self.KK_rr_re.append(residual_real(re=self.df[i].re, fit_re=self.KK_circuit_fit[i].real, fit_im=-self.KK_circuit_fit[i].imag)) #relative residuals for the real part
        #self.KK_rr_im.append(residual_imag(im=self.df[i].im, fit_re=self.KK_circuit_fit[i].real, fit_im=-self.KK_circuit_fit[i].imag)) #relative residuals for the imag part

@thinkmorenotdo
Copy link

yep. It's a known issue. You're going to have to make the circuit fit a numpy value

image

yes,the method you offered can let the code run fluently,3Q

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants