Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Pure Python scripts to read from the Attys for instant processing.

High performance Python wrappers of the C++ API doing background data acquisition are also available here: [] (Linux and Windows).

Class which reads data directly from the Attys and outputs a numpy array. It has functions for both synchronous and asynchronous acquisition. Import this module into your own program and use the following functions:

Synchronous acquisition

Data acquisition runs in the foreground.

  • readDataSync(self,_nsamples,_fs=250) reads a sepcified number of samples from the Attys. This call is blocking and you have to wait until all datapoints have arrived.

Asynchronous acquisition

Here, data acquisition runs in the background. This allows other processes to be run in the foreground, for example the plotting of the data in realtime.

  • startAsync(_fs=250) starts the acquisition in the background
  • hasData() checks if data is available. Call this function before you retrive the data to be sure there is data in the buffer
  • getDataAsync() gets the data from the ringbuffer as a numpy array. If no data is available the function returns False.
  • stopAsync() stops the background data acquisition See the program which demonstrates how it works.

This demonstrates the async aquisition by showing the incoming data in realtime on an oscilloscope screen with the help of the matplotlib animation function: it plots channel 2 of the Attys in realtime.

Demonstrates realtime filtering of data while it comes in. This script is designed for displaying EMG which first does highpass filtering to remove baseline shifts, then bandstop filtering to remove 50Hz mains and then displays the EMG in realtime.

Plots the temperature of a thermocouple connected to channel 2 of the Attys. It uses the internal temperature sensor of the Attys to calculate the absolute temperature.


You need to install the serial package:

Usage (Windows)

  • Pair the Attys,
  • then go to "more bluetooth options",
  • click on COM ports to find out which port the Attys is associated with
  • change the COM port number in the script accordingly
  • start the script

SWIG Python C++ wrappers

For high performance python applications there is a Python wrapper for the C++ API which is also platform independent. This has the advantage that the detection of the Attys and the buffering is done by the underlying C++ code in separate (p-)threads so that python won't feel any computational load. The disadvantage is that the installation / compilation in particular under Windows is challenging and that one needs to understand how SWIG translates C++ into Python commands. The python wrapper is part of the C++/JAVA AttysComm: []. Give it a try and send pull requests for the CMakeLists.txt to improve its portability, in particular under Windows.

For those who just want to use Python for postprocessing

All Attys software packages export data in a Python friendly format and can be loaded into a numpy matrix with the single command:

data = np.loadtxt('emg.tsv')

and then you can process the data as shown here. This allows you to monitor the data as it comes in, save it and then process it later with Python.