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

PEIS problem #34

Open
oliverfernihough opened this issue Aug 9, 2024 · 10 comments
Open

PEIS problem #34

oliverfernihough opened this issue Aug 9, 2024 · 10 comments

Comments

@oliverfernihough
Copy link

oliverfernihough commented Aug 9, 2024

Hey,

When I run a PEIS on the EC-Lab programme I get a usual expected spectra, but when I run the following code for the PEIS command in this software, I don't get a clean spectra. Am I missing something ?

# Function to run PEIS test
def run_peis_test(bl, save_path, voc):
    params_peis = {
        'voltage': list(voc.values())[0],
        'final_frequency': 10,
        'initial_frequency': 1000000,
        'amplitude_voltage': 0.005,
        'frequency_number': 51,
        'duration': 0,
        'repeat': 2,
        'wait': 1
    }
    peis = blp.PEIS(bl, params_peis, channels=[2])
    peis.run('data')
    peis.save_data(save_path)

I'm using this code as part of a loop with other instruments so I can't just use the base programme, I have automated the other components but I need an impedance measure for the HFR of an electrochemical device so i'm hoping that I've just missed something obvious :)

bad spectra 

image
same conditions in EC-lab
image

@bicarlsen
Copy link
Owner

bicarlsen commented Aug 9, 2024

Unfortunately, I no longer work with these machines so can't test it, but nothing looks particularly off. Perhaps you can run some tests with modified parameters to see if that cleans it up, starting with the most basic applicable parameters. Or, if you have the ability, you can modify the PEIS source code to see if there is an issue occurring there.

@DangerLin
Copy link
Contributor

Hey,

When I run a PEIS on the EC-Lab programme I get a usual expected spectra, but when I run the following code for the PEIS command in this software, I don't get a clean spectra. Am I missing something ?

# Function to run PEIS test
def run_peis_test(bl, save_path, voc):
    params_peis = {
        'voltage': list(voc.values())[0],
        'final_frequency': 10,
        'initial_frequency': 1000000,
        'amplitude_voltage': 0.005,
        'frequency_number': 51,
        'duration': 0,
        'repeat': 2,
        'wait': 1
    }
    peis = blp.PEIS(bl, params_peis, channels=[2])
    peis.run('data')
    peis.save_data(save_path)

I'm using this code as part of a loop with other instruments so I can't just use the base programme, I have automated the other components but I need an impedance measure for the HFR of an electrochemical device so i'm hoping that I've just missed something obvious :)

bad spectra 

image same conditions in EC-lab image

Hi @oliverfernihough , may I ask which two columns did you use to plot the Nyquist plot? You may need to process the data first because the data collected by this code is not straightforward enough to do the Nyquist plot.

@oliverfernihough
Copy link
Author

oliverfernihough commented Aug 12, 2024

Hey @DangerLin so i am using the impedance phase and impedance modulus columns.

i could have used the equivalent versions for the counter electrode ? CE?

i used the following code for analysis:

plt.figure(figsize=(10, 8))

for file_path, pressure in file_paths:
# Load the data
df = pd.read_csv(file_path, header=1)

# Calculate real and imaginary impedance
df['Real Impedance'] = df['Impedance modulus'] * np.cos(np.deg2rad(df['Impedance phase']))
df['Imaginary Impedance'] = df['Impedance modulus'] * np.sin(np.deg2rad(df['Impedance phase']))

# Plot the data
plt.plot(df['Real Impedance'], -df['Imaginary Impedance'], marker='o', linestyle='-', label=f'{pressure:.2f} bar')

plt.title('Nyquist Plot for Multiple Pressures')
plt.xlabel('Real Impedance (Ohm)')
plt.ylabel('Imaginary Impedance (-Ohm)')
plt.legend()
plt.grid(True)
plt.show()

if there is something im doing wrong that would be great, i am trying to automate PEIS measurements throughout a complex test, we have some pressure, temperature, variables which are controlled through third party heaters etc, if i can get this working it would save a HUGE amount of time standing waiting nearby for the right moment to measure the PEIS

@bicarlsen i am very new to code, python is okay, but C etc is quite alot, i am reading through the original API by biologic with someone who knows C better than me but its some head scratching! i dont feel confident enough to edit the source code. but i really appreciate the reply

@DangerLin
Copy link
Contributor

Hi @oliverfernihough , you are using the correct columns. Can you use a dummy cell to check if this situation still happens? If it works for the dummy cell, I am afraid something might happen in your experimental setup. We sometimes get the noisy spectrum as you did due to cable or electrode connection issues. Also, please keep the parameters consistent between the EC-Lab software and the code.

@oliverfernihough
Copy link
Author

Hey @DangerLin, I did some testing, should the value of the amplitude voltage be in mV ? i am entering 0.005 for 5 mV, but is the unit natively mV rather than V?

i have also run identical experiments where i run a PEIS with the EC-lab software, then immediately use the python script it does not give me a correct reading ?

if i use EC-lab the reading is a normal spectra but the python gives one that is very noisy, there must be some mistake i am making that it doesnt show a good spectra.

@bicarlsen
Copy link
Owner

... should the value of the amplitude voltage be in mV?

It appears the voltage is in V, but the field labels could also be wrong.

@DangerLin
Copy link
Contributor

DangerLin commented Aug 13, 2024

Hi @oliverfernihough , I double-checked the unit, the amplitude voltage is in V, so 0.005 is for 5 mV. And the unit for the frequency is Hertz.

I just noticed that you converted degrees to radians when you were processing the data. If I didn't get it wrong, the impedance phase is already in radians. Can you try using the impedance phase directly to process the data?

Also, the default sweep mode (the spacing between frequencies) is logarithmic. If you are using linear spacing, please use

"sweep": "lin"

in the parameters.

Finally, just wanna make sure, which channel do you use for the PEIS test? Based on your Nyquist plot, it seemed the resistance was pretty high, and the system is likely open-circuit. If you're using channel 2 in your potentiostat, please note that in the code we use the index to identify the channel, so please use

channels=[1]

in your code.

Hope it helps.

@oliverfernihough
Copy link
Author

Hey @DangerLin Thanks for the fast reply,

so i noticed something when i run the impedance measurements on EC-Lab vs Easy biologic (EBL). the lights on the machine come on for EC-Lab but not EBL. perhaps that is nothing worth saying.

my VSP-300 has 2 channels weirdly labelled 1 and 3.
it also has a booster which could also pose an issue ?

i will try the above and get back to you

thank you for your help

@DangerLin
Copy link
Contributor

Hi, @oliverfernihough ,

If the lights are on for normal tests but off when you get abnormal results, something is probably wrong (e.g., connection issues, incorrect channel, etc.).

I have never used a booster in an EC-Biologic potentiostat, so I have no idea whether and how the booster impacts the EBL testing. I think a quick test is using channel 1 to test the code.

Good luck!

@oliverfernihough
Copy link
Author

@DangerLin I tested it today, and there seems to be a green light on for the test during the EBL usage, but a Red light for the regular test, perhaps the current range isn't correctly detected and this is the source of the issue.

i will test the first channel to see if the code runs fine for that, i just need a low power battery

again thanks for all the help

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

3 participants