Skip to main content

pyEmpatica

Parties Involved

Institution: Munroe Meyer Institute in the University of Nebraska Medical Center
Laboratory: Virtual Reality Laboratory
Advisor: Dr. James Gehringer
Developer: Walker Arce

Motivation

This Python library was written to facilitate biometric data collection from an Empatica E4. It also includes windowed sample collection, threaded error handling, and on-wrist detection.

Installation

This library is available for installation over pip using: pip install pyEmpatica

For developers, clone this repository, cd into the directory using either your virtual environment or your local environment, and run: python setup.py install

To actually utilize this library the Empatica Streaming Server is required, meaning this library is only compatible with Windows systems.

Usage

from pyempatica import EmpaticaClient, EmpaticaE4, EmpaticaDataStreams, EmpaticaServerConnectError
import time


try:
    client = EmpaticaClient()
    print("Connected to E4 Streaming Server...")
    client.list_connected_devices()
    print("Listing E4 devices...")
    time.sleep(1)
    if len(client.device_list) != 0:
        e4 = EmpaticaE4(client.device_list[0])
        if e4.connected:
            print("Connected to", str(client.device_list[0]), "device...")
            for stream in EmpaticaDataStreams.ALL_STREAMS:
                e4.subscribe_to_stream(stream)
            print("Subscribed to all streams, starting streaming...")
            e4.start_streaming()
            for i in range(0, 10):
                time.sleep(1)
                if not e4.on_wrist:
                    print("E4 is not on wrist, please put it on!")
                if e4.client.last_error:
                    print("Error encountered:", e4.client.last_error)
                    break
            e4.suspend_streaming()
            e4.disconnect()
            e4.close()
            print("E4 Errors")
            for key in e4.client.errors:
                print("\t", key, ":", e4.client.errors[key])
            print("E4 connection closed, saving readings...")
            e4.save_readings("readings.txt")
            print("Readings saved to readings.txt...")
        else:
            print("Could not connect to Empatica E4:", client.device_list[0])
    client.close()
    print("Cleaning up connections...")
except EmpaticaServerConnectError:
    print("Failed to connect to server, check that the E4 Streaming Server is open and connected to the BLE dongle.")

Before running this script, ensure the Empatica Streaming Server is up and running. This library is currently only compatible with Windows due to the Streaming Server dependency.

Citation

@misc{Arce_pyEmpatica_2021,
      author = {Arce, Walker and Gehringer, James},
      month = {8},
      title = {{pyEmpatica}},
      url = {https://github.com/Munroe-Meyer-Institute-VR-Laboratory/pyEmpatica},
      year = {2021}
}

Metadata

Release files for pyEmpatica 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyEmpatica 0.6.0
File Size Uploaded
pyEmpatica-0.6.0.tar.gz 20.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pyEmpatica 0.6.0
File Interpreter ABI Platform
pyEmpatica-0.6.0-py3.8.egg Legacy Egg format - - Details
pyEmpatica-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 29.5 kB

Release files / pyEmpatica-0.6.0.tar.gz

Download URL pyEmpatica-0.6.0.tar.gz
Size 20.2 kB
Tags Source
SHA-256 checksum
How to use checksums
28fea7ad8f9afdf2d0d9cfd51fd8f99aede4ec0fa1b3a5fa5065265c17c20966
BLAKE2b-256 checksum
How to use checksums
c7e235fa0def2257c0bd2ef84f0f635c831959b310e11dd6f663ccc73a71ddd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release files / pyEmpatica-0.6.0-py3.8.egg

Download URL pyEmpatica-0.6.0-py3.8.egg
Size 2.3 kB
Tags Egg
SHA-256 checksum
How to use checksums
48d7772aa4c7938605f3e00badfeeadf19aa7945371069286eab4bcb251f395b
BLAKE2b-256 checksum
How to use checksums
96b2f1b21a211ebefadc68ab9c84b4cdac5e398f0401c644b2fd1cdef930a940
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release files / pyEmpatica-0.6.0-py3-none-any.whl

Download URL pyEmpatica-0.6.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5fc4d71711cf6588c13f72f7f0291229b11a2ccae883c49cf0d0e8100fadc7e4
BLAKE2b-256 checksum
How to use checksums
6f035f7a483c598157bf752c90c1c4bc1c0031593cc956514fcbab7cf4fcaec8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.6.0 This release

3 release files

0.5.9

3 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page