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.0-cp313-cp313-win_amd64.whl (335.6 kB view details)

Uploaded CPython 3.13Windows x86-64

pointprocess-0.1.0-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.0-cp313-cp313-macosx_11_0_arm64.whl (379.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

pointprocess-0.1.0-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.0-cp312-cp312-macosx_11_0_arm64.whl (379.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pointprocess-0.1.0-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.0-cp311-cp311-macosx_11_0_arm64.whl (377.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

pointprocess-0.1.0-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.0-cp310-cp310-macosx_11_0_arm64.whl (375.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

pointprocess-0.1.0-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.0-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.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 400fd2c12140819bd5e91f99ac873206cfc25b9b8c66aed01ce407b9532e6880
MD5 0683d8a2e8e47fd86ba217933ff64219
BLAKE2b-256 d5a12872ff57ccd38b97d1ce8d144e526390b4a6c4caddc48cfd1807d9a6985c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.0-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.0-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1340ca9cfc03c2f6e1fefd7004cb3f61c666aede381dd80afb4a12240c14050d
MD5 c91f48ddcf5f5f4605846712a83ef118
BLAKE2b-256 a2fc036cf83eeb6b491295e4906e5ea645755828564c13e285cd00ac6614c240

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.0-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.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 50dee1d3b882ba5d34739d58b334309d34b4a7fbfac3c359fdefeb73cfdec781
MD5 f2c81cf53e9a801a124557bd2e454aef
BLAKE2b-256 1375512343f9fa8e742ad07c50bd0cd5db7bd00eb157d9864c89b6c798903e19

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.0-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.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 85d054bd6fa57d8f3b55f50827dc5ee1741df9bfaccd8f16c0fd23201a202474
MD5 fcdf75eb0637159516e5ad43bd50147a
BLAKE2b-256 5c53bf6dd1762d1ea04e754a7bf26399e2058895aca3a372ec37341c79f657b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.0-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.0-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 45babd88588f69716028b408a9aadbd15645e125bb7a479525d5180c270c68de
MD5 b1153218698bc3437ae00c05cf645e2f
BLAKE2b-256 a4bd4c7c30998f1b0a482b03fd15fcf2024676acc5e0ac688403f67005000fe7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.0-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.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b39f7575b572e3051a2b1a6e8ab357ed059b3df4efe6c30fe2a060aaf0e8d6d8
MD5 b525fb068360c2bdabec80bf3a48fe67
BLAKE2b-256 5c7d7b05d3caf15dab2e85b1f795979462f8fdf5f7c3d0f4fd8f376635040656

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.0-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.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 188b33c0d036e57f34bce955796c5913a108e95ea9a5845588d9e8e080583c03
MD5 c5e6cd7d2593046a60980f68912c10a5
BLAKE2b-256 bf9f39f20b1d01758c7c3078d31b810bf0e34e91c8965c08fac1daabb49423eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.0-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.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e55d56eba1739e8c77a6c0e7f173034fe77cf6bd153336e0b10c9ee96dd877e9
MD5 d5ad0b0ea838151c135f64fa66ef035f
BLAKE2b-256 a52be50c71289a824e91777c67ddbdc6822c66f604991c28e66495b9fa819899

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.0-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.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8397e83d02c03987b414faa0d04e4ece1904d8c2ae7ef0b48a90f13573697640
MD5 da6f3c35c8080d5d933387f50ab25893
BLAKE2b-256 4b238588b0646b5101ee709b1ecdddbad7dd8f1dcd151fccdd7100dcadf9a9a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.0-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.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7e8c22e725e208598b39d5861a49a3c1a4d87e4c0988439668f704438d87c125
MD5 930cfe02d508fed7d03093a1a705ba39
BLAKE2b-256 a2453e00513b1fb4859dc84fe79e40d03a91a6809ae05ea73c783544c2c267bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.0-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.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7d7bf1c7d81e91d9742083f794bdfe11b27e180c6e2e33188397779b91081c27
MD5 81579bdee004ba4fd43dc77320f0b04c
BLAKE2b-256 ce63a1f891d75419fb013cc750d0bdd1c162f840ea51eb6f1ca1d24af1b402f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.0-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.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e5d04ed0b3646606c7e74987daae8ecff5ab87929af31b37297729c91cdf69de
MD5 e9ab8837d42a409a62500e67df1a6e69
BLAKE2b-256 e73fe4e6e159ed76e267e95c8ec8c71c8ba9e1e1d52be02ffefc291cea9264cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.0-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.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pointprocess-0.1.0-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.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 902e15cf09455a61f739c3554f9731132df048b835d58c9abfa91f1a96767f1a
MD5 c8aebfb3cc76a531fe361eed59c30b01
BLAKE2b-256 e2278a82492a26de82f1f57a0dffabd0b2ee8e5183e35887db43b72f444ed33a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.0-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.0-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a07f1fcc21c0263221b2b9ec0ca3a9391a55030f7e26abd222a5f333c6e24a61
MD5 15f1e9e242ba350dde0136659b873cf6
BLAKE2b-256 122c85b6ffe7eebcca68a45c53d0d0d758017af8932bda3b0511107c70be819b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.0-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.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pointprocess-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 724c2258506189c319560881f61f0bd4253bb9dc83a94273c063241b24577144
MD5 2ce3854c9e5a59b5719e71972abdb7ff
BLAKE2b-256 ea2c3084a85afdb869ee16542a3cb8ef4392362d0eb8450b7f5b351c5ffedb10

See more details on using hashes here.

Provenance

The following attestation bundles were made for pointprocess-0.1.0-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