Skip to main content

Python implementation of the cvxEDA algorithm

Project description

cvxEDA – Python implementation

This program implements the cvxEDA algorithm for the analysis of electrodermal activity (EDA) using methods of convex optimisation, described in:

A. Greco, G. Valenza, A. Lanata, E. P. Scilingo, and L. Citi
“cvxEDA: a Convex Optimization Approach to Electrodermal Activity Processing”
IEEE Transactions on Biomedical Engineering, 2015
DOI: 10.1109/TBME.2015.2474131

What the algorithm does

It is based on a model which describes EDA as the sum of three terms:

  • phasic component – transient increases reflecting sudomotor bursts;
  • tonic component – slowly varying baseline activity;
  • additive white‑Gaussian‑noise term – captures model prediction errors, measurement noise and artifacts.

The model is physiologically inspired and fully explains EDA through a rigorous methodology based on Bayesian statistics, convex optimisation and sparsity.

Installation

# ── From PyPI (recommended)
pip install cvxeda                                # latest release
pip install "cvxeda==1.0.0"                       # or a specific version

# ── Directly from GitHub
pip install git+https://github.com/lciti/cvxEDA.git         # latest commit
pip install git+https://github.com/lciti/cvxEDA.git@v1.0.0  # or a specific version

# ── From a local clone
git clone https://github.com/youruser/cvxEDA.git  # clone
cd cvxEDA                                         # enter folder
git checkout v1.0.0                               # (optional) pick version
pip install .                                     # install

Quick example

import numpy as np
import cvxeda
import matplotlib.pyplot as plt

# Simulated EDA signal (replace with your own data)
tm = np.linspace(0, 40, 1000)                                           # 40 s at 25 Hz
y = np.convolve(np.sin(.7 * tm) < -.8, np.exp(-.5 * tm[:200]), 'same')  # simple fake signal
y += np.random.randn(len(y))                                            # add noise

yn = (y - y.mean()) / y.std()  # standardise
Fs = 25.0                      # sampling frequency (Hz)

# Run the algorithm
r, p, t, l, d, e, obj = cvxeda.cvxEDA(yn, 1.0 / Fs)

# Plot
tm = np.arange(1, len(y) + 1) / Fs
plt.figure()
plt.plot(tm, yn, label='normalised input')
plt.plot(tm, r,  label='phasic component')
plt.plot(tm, p,  label='sparse SMNA driver')
plt.plot(tm, t,  label='tonic component')
plt.xlabel('Time (s)')
plt.legend()
plt.show()

help(cvxeda.cvxEDA) prints the full function signature and argument description.

License & citation

The code is released under GPL‑3.0 (see LICENSE.txt).

If you use this program in support of published research, please cite the reference above. If you use this code in a software package, please explicitly inform the end users of this copyright notice and ask them to cite the reference above in their published research.

Project repository: https://github.com/lciti/cvxeda

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cvxeda-1.0.0.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cvxeda-1.0.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file cvxeda-1.0.0.tar.gz.

File metadata

  • Download URL: cvxeda-1.0.0.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for cvxeda-1.0.0.tar.gz
Algorithm Hash digest
SHA256 63fe8d5d837d33c2e21d5192a28367296aa36e919eaa11d2d30490adb58d51d5
MD5 393ebf32a1fad2c6c0d42ca4b757e59f
BLAKE2b-256 103e5cf29e6a8c2e9cae6f571767207e4a27ba11d7a1aae23aa588f95ec4ee52

See more details on using hashes here.

File details

Details for the file cvxeda-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cvxeda-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for cvxeda-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 057d86b2246b12902be08c07a3aaeb60152e1fbe47e915958a3fb69487412a86
MD5 b9df159ac02f4d1465a37e01e99eec23
BLAKE2b-256 4e09aa2a85b9e0ed549292698851ca655d7f9ebfb7128ea70a1887a02932aaa5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page