Skip to main content

signal-digitizer logo

signal-digitizer

signal-digitizer is a Python library for converting scanned charts and grid-based plots into calibrated one-dimensional signals. It is designed for applications such as ECG traces, laboratory recorder outputs, and other plotted signals stored as PDF documents.

The library processes a chart by rendering the page, correcting skew, detecting the grid, extracting the signal trace, and converting pixel coordinates into calibrated signal values.

Package Information

Python Versions PyPI Version

Installation

pip install signal-digitizer

Quick Start

import signal_digitizer as sd

x, y = sd.digitize(
    "chart.pdf",
    unit_per_vgap=1.0,
    unit_per_hgap=1.0,
)

The returned x and y arrays contain the extracted and calibrated signal coordinates.

Command Line Usage

signal-digitizer chart.pdf -o signal.csv

This processes the input PDF and saves the extracted signal to a CSV file.

How It Works

The digitization workflow consists of the following stages:

  1. Page rendering – The input PDF page is converted into an image.
  2. Skew correction – Page rotation is estimated and corrected.
  3. Grid detection – Grid lines are identified using image-processing techniques.
  4. Calibration – Grid spacing is used to convert pixel coordinates into data units.
  5. Trace extraction – The plotted signal is separated from the chart image.
  6. Signal generation – The extracted trace is converted into calibrated x and y values.

Main API

digitize()

Processes a PDF file through the complete signal digitization pipeline.

x, y = sd.digitize(
    "chart.pdf",
    unit_per_vgap=1.0,
    unit_per_hgap=1.0,
)

digitize_page()

Processes an already opened PyMuPDF page.

import pymupdf
import signal_digitizer as sd

document = pymupdf.open("chart.pdf")

x, y = sd.digitize_page(
    document[0],
    unit_per_vgap=1.0,
    unit_per_hgap=1.0,
)

digitize_image()

Processes an image that has already been loaded as a NumPy array.

x, y = sd.digitize_image(
    image_array,
    unit_per_vgap=1.0,
    unit_per_hgap=1.0,
)

Core Functionality

The library includes functionality for:

  • PDF page rendering
  • Skew estimation and correction
  • Grid-line detection
  • Axis calibration
  • Signal trace extraction
  • Conversion of extracted traces into calibrated signals
  • Signal validation using Pearson correlation and RMSE

Signal Validation

If a reference signal is available, the extracted signal can be evaluated using:

result = sd.validate_signal(y, reference_signal)
print(result)

The validation result includes correlation and error-based measures for comparing the extracted signal with the reference.

Requirements

signal-digitizer requires Python 3.9 or later.

Its core dependencies include:

  • PyMuPDF
  • NumPy
  • OpenCV
  • SciPy

These dependencies are installed automatically with the package.

Authors

  • Manoj Kumar C S
  • V N Manjunath Aradhya
  • Nikhil D Bharadwaj

Maintainers

  • Manoj Kumar C S
  • Nikhil D Bharadwaj

License

This project is distributed under the MIT License. See the License file for details.

Metadata

Release files for signal-digitizer 0.2.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 signal-digitizer 0.2.0
File Size Uploaded
signal_digitizer-0.2.0.tar.gz 13.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for signal-digitizer 0.2.0
File Interpreter ABI Platform
signal_digitizer-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.9 kB

Release files / signal_digitizer-0.2.0.tar.gz

Download URL signal_digitizer-0.2.0.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
28b093d28e6ba535bdcb1b790546549791ef9c49206ef63442893285dc676266
BLAKE2b-256 checksum
How to use checksums
ba1a067d789a1e7290f1e770cdb3693de34d1c2e109aecfa39117fa9023807a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.16

Release files / signal_digitizer-0.2.0-py3-none-any.whl

Download URL signal_digitizer-0.2.0-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3df1c886fa5296a44391be4d32a6d6ab9c8d83ce6335ed1a4ed098fd1e5753a1
BLAKE2b-256 checksum
How to use checksums
c8c9c156500e2ecb8d48605eccb077b81654731f8ffd64d0ec236917b69c3abd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.11.16

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

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