Skip to content

About

Python API for Biologic EC-lab potentiostats

Topics

Resources

Stars

6 stars

Watchers

1 watching

Forks

Repository files navigation

aurora-biologic logo


PyPI version License Python Versions Checks Coverage

A standalone Python API and command line interface (CLI) to control Biologic cyclers.

This requires EC-lab >=11.11, and has been designed and tested on EC-lab 11.52 and 11.61 using MPG2 cyclers.

Features

  • CLI and Python API
  • Connect to EC-lab cyclers
  • Retrieve status of channels
  • Load protocols onto channels
  • Start and stop experiments

For parsing binary data from Biologic, we recommend yadg.

Installation

Install on a Windows PC with EC-lab >=11.11 installed. EC-lab must have OLE/COM activated.

OLE/COM is a Windows interface for programs to expose their functionality to third-parties.

To enable OLE/COM on EC-lab, open a terminal as administrator, go to your folder containing EClab.exe and register the server:

cmd

cd "C:/Program files (x86)/EC-lab"
eclab /regserver

powershell

cd "C:/Program files (x86)/EC-lab"
./eclab /regserver

Important

The slash direction matters! ✅ /regserver, ❌ \regserver

If EC-lab opens, you probably did the wrong command.

If you get Error creating system registry entry, make sure you are running cmd/PowerShell as administrator

You can also deregister in the same way with /unregserver.

Next, install this package with

pip install aurora-biologic

You can check what devices and channels were found with

biologic pipelines

When you run a command for the first time, a config file is generated at:

C:\Users\<user>\AppData\Local\aurora-biologic\config.json

which will look like:

{
    "serial_to_name": {
        "12345": "MPG2-1",
        "12346": "MPG2-2"
    },
    "eclab_path": "C:/Program Files (x86)/EC-Lab/EClab.exe"
}

Make sure eclab_path is correct and points to the same file you registered in the first step.

We recommend renaming your devices to something meaningful using serial_to_name, e.g. matching their human-friendly names in EC-lab. You can see the device serial numbers in EC-lab in the 'add device' menu.

CLI usage

You can check what devices and channels were found with

biologic pipelines

The pipeline ID is made up of the {device name}-{channel index}, such as MPG2-1-7 (or 12345-7 if you are still using the serial number).

These IDs are used for other functions, for example to see the status of that channel use

biologic status MPG2-1-7
biologic start MPG2-1-7 "my/settings.mps" "my/output.mpr"
biologic stop MPG2-1-7

Tip

See all commands with biologic --help.

See details of a command with biologic [command] --help e.g. biologic status --help.

API usage

Commands can also be run using Python, e.g.:

import aurora_biologic as bio

print(bio.get_status())

bio.start(
    "my_pipeline_id",
    "path/to/my_experiment.mps",
    "path/to/an/output.mpr",
)

Using commands over SSH

Warning

OLE/COM requires an interactive session to function.

Standard command line functions will not work in non-interactive session, such as normal SSH from a terminal.

To use the CLI over SSH you must start a listener daemon in an interactive terminal.

On the PC with EC-lab, start the listener with:

biologic daemon

Then from the SSH session use normal CLI commands with the --ssh option, e.g.

biologic status --ssh

Instead of trying to run OLE/COM commands directly in the non-interactive session, it will send commands to the daemon, which will execute and reply.

Help! It doesn't work

Bug reports and compatibility issues are very useful to us. Raise an issue on GitHub and we will try our best to fix the problem.

For developers

Clone the repo and install in editable mode with developer dependencies:

git clone https://github.com/EmpaEconversion/aurora-biologic
cd aurora-biologic
pip install -e .[dev]

Run tests without EC-lab running with:

pytest  # runs without ec-lab

To test against a real EC-lab instance, ensure EC-lab is open and has at least 2 channels available (can be virtual potentiostat), then run:

pytest --real-eclab  # runs on ec-lab

The tests don't start/stop channels, but still do not run this if you have real experiments running.

Contributors

Acknowledgements

Special thanks to Julian Diener from Biologic for their advice and support.

This software was developed at the Laboratory of Materials for Energy Conversion at Empa, the Swiss Federal Laboratories for Materials Science and Technology, and supported by funding from the IntelLiGent project from the European Union’s research and innovation program under grant agreement No. 101069765, and from the Swiss State Secretariat for Education, Research, and Innovation (SERI) under contract No. 22.001422.

IntelLiGent logo IntelLiGent logo     EU flag     Swiss secretariat

About

Python API for Biologic EC-lab potentiostats

Topics

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages