Skip to content

PyPalmSens Documentation


Image title Image title


PyPalmSens is a Python toolkit for easily automating electrochemistry experiments using your PalmSens instruments. It offers an intuitive Python API, making it simple to integrate into your existing workflows.

With PyPalmSens, you can:

To install:

$ pip install pypalmsens

PyPalmSens works on Windows, MacOS, and Linux (including ARM-based single-board computers like Raspberry Pi).

Since PyPalmSens is built on top of the PalmSens .NET libraries, you will need the .NET runtime installed. Please check the installation instructions for platform-specific details.

Getting started

The following example shows how to set up and measure a simple chronoamperometry experiment:

>>> import pypalmsens as ps

>>> method = ps.ChronoAmperometry(
...     interval_time=0.01,
...     potential=1.0,
...     run_time=10.0,
... )

>>> ps.measure(method) # (1)!
Measurement(title=Chronoamperometry, timestamp=2026-08-07T16:01:46, device=EmStat4LR)
  1. measure discovers any plugged-in device to start the measurement. An error is raised when more than 1 instruments are connected.

Tip

Shorten the imported name from pypalmsens to ps. This widely adopted convention helps with better readability of code.

The following example shows how to discover devices and manually read out the current.

>>> import pypalmsens as ps

>>> instruments = ps.discover()
>>> emstat4, *_ = [inst for inst in instruments if inst.name.startswith('EmStat4')]

>>> with ps.connect(instrument=emstat4) as manager: # (1)!
...     manager.set_cell(True)
...     manager.set_potential(1)
...     manager.set_current_range('1mA')
...
...     current = manager.read_current()
...     print(f'{current=} µA')
...
...     manager.set_cell(False)
current=92.8065 µA
  1. The context manager opens and closes the connection

Analyze a previous measurement with pandas:

>>> import pypalmsens as ps

>>> measurements = ps.load_session_file('examples/Demo CV DPV EIS IS-C electrode.pssession')
>>> dpv = measurements[0]
>>> print(f'{dpv.title} ({dpv.timestamp})')
Differential Pulse Voltammetry (2017-07-12T14:28:58)

>>> dpv.dataset.to_dataframe()  #(1)!
Time Potential   Current    CR ReadingStatus
0     0.0 -0.399962  0.352146  10uA            OK
1     0.2 -0.394962  0.351192  10uA            OK
...
217  43.4  0.692698   0.19908  10uA            OK
218  43.6  0.697776  0.199557  10uA            OK
<BLANKLINE>
[219 rows x 5 columns]
  1. Extract all arrays from the dataset into a pandas dataframe.