Skip to main content

C++ implementation of point process models for heart rate variability analysis

Project description

Docs Status Build Status codecov

ppbig

Point Process

A modern C++ implementation of point process models for heart rate variability (HRV) analysis. Based on the MATLAB software by Riccardo Barbieri and Luca Citi (http://users.neurostat.mit.edu/barbieri/pphrv).

Key Features:

  • Fast C++ implementation with Python bindings
  • Multiple distribution models (Inverse Gaussian, Gaussian, LogNormal)
  • State-space regression and spectral analysis
  • Easy-to-use Python API with NumPy/SciPy integration
  • Cross-platform support (Linux, Windows, macOS)
  • Distributed as pre-built wheels via PyPI

Reference Papers:

Installation

From PyPI (Recommended)

pip install pointprocess

Supported platforms:

  • Linux (x86_64) - Wheels distributed via PyPI
  • Windows (x86_64) - Wheels distributed via PyPI
  • macOS (Apple Silicon) - Wheels distributed via PyPI
  • Python 3.9–3.13

Development Setup

All development work uses nox for consistency across platforms. First install system dependencies:

macOS (Homebrew):

brew install cmake boost eigen

Linux (Ubuntu/Debian):

sudo apt-get install -y cmake libboost-all-dev libeigen3-dev

Linux (Fedora/RHEL):

sudo dnf install -y cmake boost-devel eigen3-devel

Windows (Chocolatey):

choco install cmake boost-msvc-14.3 eigen

Then clone and use nox:

git clone https://github.com/andreabonvini/pointprocess.git
cd pointprocess
pipx install nox
nox

Common Development Tasks

All tasks use nox (no more bash scripts):

nox -s dev           # Set up development environment
nox -s build         # Build C++ extension
nox -s test          # Run test suite
nox -s lint          # Code quality checks (clang-format)
nox -s coverage      # Generate coverage report
nox -s docs          # Build Sphinx documentation
nox -s clean         # Clean build artifacts

Documentation

Full documentation available at pointprocess.readthedocs.io

Quick Start

Basic Usage

import numpy as np
import matplotlib.pyplot as plt
from pointprocess import (
    compute_single_regression,
    compute_full_regression,
    compute_spectral_analysis,
    Distributions,
)

# Load RR interval data (time between heartbeats in seconds)
rr = np.load("events.npy")
events = rr[75:301]

# Plot RR intervals
plt.plot(events[1:], 1000 * np.diff(events), "b")
plt.xlabel("Time [s]")
plt.ylabel("RR [ms]")
plt.show()

Single Regression

Fit a point process model to a fixed window of data:

result = compute_single_regression(
    events=events,
    ar_order=9,
    has_theta0=True,
    right_censoring=False,
    alpha=0.02,
    distribution=Distributions.InverseGaussian,
    max_iter=10000
)

# Access results
print(f"AR coefficients (θ_p): {result.thetap}")
print(f"Intercept (θ_0): {result.theta0}")
print(f"Shape parameter (κ): {result.kappa}")
print(f"Log-likelihood: {result.likelihood}")
print(f"Mean interval: {result.mean_interval}")

Spectral Analysis

# Compute power spectral density from model parameters
analysis = compute_spectral_analysis(
    thetap=result.thetap,
    mean_interval=result.mean_interval,
    variance=result.sigma ** 2
)

# Plot power spectral density
plt.figure(figsize=(10, 6))
plt.plot(analysis.frequencies, analysis.powers, "k", linewidth=0.8)
for pole in analysis.poles:
    plt.axvline(pole.frequency, color="r", linestyle="--", alpha=0.3)

plt.xlabel("Frequency [Hz]")
plt.ylabel("Power [ms²/Hz]")
plt.xlim(0, 0.5)
plt.show()

Full Regression (Time-Varying Analysis)

# Fit model across time with sliding window
result_full = compute_full_regression(
    events=rr,
    window_length=60.0,      # 60 second window
    delta=0.005,             # 5 ms step size
    ar_order=9,
    has_theta0=True,
    right_censoring=True,
    alpha=0.02,
    distribution=Distributions.InverseGaussian,
    max_iter=1000
)

# Convert to dictionary for easier access
d = result_full.to_dict()

# Plot time-varying mean
plt.figure(figsize=(12, 4))
plt.plot(d["Time"], d["Mu"], "b", linewidth=0.5, label="μ(t)")
plt.xlabel("Time [s]")
plt.ylabel("Mean Interval [s]")
plt.legend()
plt.show()

For complete examples with visualizations, see the Jupyter Notebook in examples/.

Contributing

We welcome contributions! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests: nox -s test
  5. Submit a pull request

License

MIT License - See LICENSE file for details.

Citation

If you use this library in your research, please cite:

@software{pointprocess2026,
  author = {Bonvini, Andrea},
  title = {Point Process: Heart Rate Variability Analysis Library},
  url = {https://github.com/andreabonvini/pointprocess},
  year = {2026}
}

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pointprocess-0.1.1-cp313-cp313-win_amd64.whl (335.6 kB view details)

Uploaded CPython 3.13Windows x86-64

pointprocess-0.1.1-cp313-cp313-manylinux_2_28_x86_64.whl (501.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

pointprocess-0.1.1-cp313-cp313-macosx_11_0_arm64.whl (379.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pointprocess-0.1.1-cp312-cp312-win_amd64.whl (335.5 kB view details)

Uploaded CPython 3.12Windows x86-64

pointprocess-0.1.1-cp312-cp312-manylinux_2_28_x86_64.whl (501.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

pointprocess-0.1.1-cp312-cp312-macosx_11_0_arm64.whl (379.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pointprocess-0.1.1-cp311-cp311-win_amd64.whl (333.3 kB view details)

Uploaded CPython 3.11Windows x86-64

pointprocess-0.1.1-cp311-cp311-manylinux_2_28_x86_64.whl (499.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

pointprocess-0.1.1-cp311-cp311-macosx_11_0_arm64.whl (377.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pointprocess-0.1.1-cp310-cp310-win_amd64.whl (332.5 kB view details)

Uploaded CPython 3.10Windows x86-64

pointprocess-0.1.1-cp310-cp310-manylinux_2_28_x86_64.whl (498.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

pointprocess-0.1.1-cp310-cp310-macosx_11_0_arm64.whl (375.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pointprocess-0.1.1-cp39-cp39-win_amd64.whl (341.7 kB view details)

Uploaded CPython 3.9Windows x86-64

pointprocess-0.1.1-cp39-cp39-manylinux_2_28_x86_64.whl (498.8 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

pointprocess-0.1.1-cp39-cp39-macosx_11_0_arm64.whl (376.0 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file pointprocess-0.1.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 0e16e35c0f42a4bba3ac1b22e5110aa6953b2441820d6191aeaee4083d42083c
MD5 431e8f0c71b2adab7899ac04671c1396
BLAKE2b-256 b86c0fa951718a49e0ed7c6bd48653a9fa1441e9917aa187d8bd2cb622835227

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.1-cp313-cp313-win_amd64.whl:

Publisher: main.yml on andreabonvini/pointprocess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pointprocess-0.1.1-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8bba46ad434c791245d4813e169f24b4395ad7c51232e081a34b6acba82dd0bd
MD5 bfe121117fc56ddc7187d6419fc24fe1
BLAKE2b-256 d99565f074b476af99bf059300da2d898ed7be151b201f2a9641f06110caf0b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.1-cp313-cp313-manylinux_2_28_x86_64.whl:

Publisher: main.yml on andreabonvini/pointprocess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pointprocess-0.1.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e5d50906ffd93fe11b171a9bd564edd416cad25765036a5752777effcd399668
MD5 16c715cf434e67618c6ee1abc8e48f95
BLAKE2b-256 c23dd3c18bda77ba91d2054bc94421bfe1265e1f63012e797d78dde5cc342e95

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.1-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: main.yml on andreabonvini/pointprocess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pointprocess-0.1.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6573bce693bb752b566d91cb69a8da0cb1a3a3a497bb2b724df5a7f2b04c360c
MD5 f55f53b13279f971ef7c11b579b3bfd5
BLAKE2b-256 04d7d65af8dab23efb5383a9538896d6dee1746379d68df1fd7cd37f5b434e72

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.1-cp312-cp312-win_amd64.whl:

Publisher: main.yml on andreabonvini/pointprocess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pointprocess-0.1.1-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7b195aae442f7a8a6b2b4ded24677a5ff523eefe0b61930f114834d9b3e6f1ce
MD5 ce7e98616d285e36bb5e03568913993c
BLAKE2b-256 6e5256e561dcff9b53c897b91017396ba3fbb9606ce113c626c7d7850f45f0e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.1-cp312-cp312-manylinux_2_28_x86_64.whl:

Publisher: main.yml on andreabonvini/pointprocess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pointprocess-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ef9c2e7d12db6306da0e41665c0fc1feac949f65ccf0abdcd610d86fc1c94bfc
MD5 5f42cfdf96f529b9c062e279846a7641
BLAKE2b-256 1b7ed1b50f38241bd08d76d5a2a20aaa259e922bd4150276a1800d87880f83c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.1-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: main.yml on andreabonvini/pointprocess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pointprocess-0.1.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 be919ceec6906f620a1ba568e2388952ac187e3ca391a921cc9fe34c7f6516e4
MD5 d2afbc09c0829099689ccec40d1fd001
BLAKE2b-256 b267c4441033f4f626a83deabdfc5ed702338b6cce0b64dbd81f5a4899c77cf2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.1-cp311-cp311-win_amd64.whl:

Publisher: main.yml on andreabonvini/pointprocess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pointprocess-0.1.1-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 327dd80520d5a4973369a36d327fc78aeca13261ec379d97fa38928ae7ad1ac0
MD5 5322b1d2a47efe02354b36bf3897d8b5
BLAKE2b-256 848c4ddccb8269bdcb436ed582245e884ff937378ac7f3bb9bd8975a6c1a5fa2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.1-cp311-cp311-manylinux_2_28_x86_64.whl:

Publisher: main.yml on andreabonvini/pointprocess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pointprocess-0.1.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3533ffc1ec8c596cd3dcc8dc949f9db6a429b56fcaba18cab09ee85be26ef875
MD5 826659e5c7b4ae00fb258e386f514b54
BLAKE2b-256 4cf8ebdb8ec0e2223ba53bb86a72dac7a70b589902fea1a7ed26be2c1119d11e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.1-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: main.yml on andreabonvini/pointprocess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pointprocess-0.1.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 56c3d99486e96737948bf0233ca0a68e5e53fb8605792cc9bb14a2f48c2a4383
MD5 d211ef7772a6fa0e64c0d97dd725af68
BLAKE2b-256 5f498aa5cd32d32693ff462f1cb7cae1c0e788699d95fb6788eea5f932d80e53

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.1-cp310-cp310-win_amd64.whl:

Publisher: main.yml on andreabonvini/pointprocess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pointprocess-0.1.1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a51abfc261cb19654bda27148909b6d31de23aeaf7fd840b8246ae37524c7d1d
MD5 ad614f29ba7ae892b2b6afe10fbef29f
BLAKE2b-256 b5805e901b1ba7ddc0a2e6eee4cf9dc24fff9e55e8a813a528ef7e32244b48b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.1-cp310-cp310-manylinux_2_28_x86_64.whl:

Publisher: main.yml on andreabonvini/pointprocess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pointprocess-0.1.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1f9ebdafcc8a70bf34a9c9f1fc0b6bc889335abba10127fb4d6fd002ad0b01db
MD5 1e2b8aa048ceebe753530902feedd0b9
BLAKE2b-256 980f78af49d52a947bf3882e452cbc8a0fdacaa5449b5f005dda33cde451843f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.1-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: main.yml on andreabonvini/pointprocess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pointprocess-0.1.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pointprocess-0.1.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 341.7 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pointprocess-0.1.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 dbc083f76244344692c035e4c2bbf560728709af9fc9c8c2936cd93979facf00
MD5 6d3cf30c759cb8556c3a2800b4edce73
BLAKE2b-256 b8ee1c4d40bc8652e6e604925d4a4d3ba71bb15df3366ed9ec51c8699568ec06

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.1-cp39-cp39-win_amd64.whl:

Publisher: main.yml on andreabonvini/pointprocess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pointprocess-0.1.1-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b9f9dfe722d013a75ab7aa3276917a998512f4e7fde35bcedd87a760d4ebb4b0
MD5 2fd626d1546690b10d6d9fac72190d81
BLAKE2b-256 3ea2d06ef234d94173fe65237d8986bfc69c00e1b914716ad0b28d3826fa7cdb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.1-cp39-cp39-manylinux_2_28_x86_64.whl:

Publisher: main.yml on andreabonvini/pointprocess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pointprocess-0.1.1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5a6492c49d823b9492db79a3d84337a0ae734f238a5d1899db253985139d8b8c
MD5 1c9d0c715ecfb1a2ab7b7f53c2fa1de0
BLAKE2b-256 0be9b59213aceebc1aa54053df97e1d1e5f9415ce434ef5a16fae952727d56c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.1-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: main.yml on andreabonvini/pointprocess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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