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
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:
- Page rendering – The input PDF page is converted into an image.
- Skew correction – Page rotation is estimated and corrected.
- Grid detection – Grid lines are identified using image-processing techniques.
- Calibration – Grid spacing is used to convert pixel coordinates into data units.
- Trace extraction – The plotted signal is separated from the chart image.
- Signal generation – The extracted trace is converted into calibrated
xandyvalues.
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.1.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| signal_digitizer-0.1.11.tar.gz | 13.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| signal_digitizer-0.1.11-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.8 kB
Release files / signal_digitizer-0.1.11.tar.gz
| Download URL | signal_digitizer-0.1.11.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
29ce2a6c641d5c47b77eb3e55b62ebd5293fdaf56b84803af93ee6da3c4e1b48
|
|
BLAKE2b-256 checksum How to use checksums |
1a9b4b73102ff6c6e99b1ecee639b36ad32c291aa33daba35c970dc280ac6bb9
|
| 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.1.11-py3-none-any.whl
| Download URL | signal_digitizer-0.1.11-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b5e59fbac7c66c5d1ab94d5f0b64dc9da304054696a3643ac195431f85557c9
|
|
BLAKE2b-256 checksum How to use checksums |
bc0b89240408d1024b22a9f213d394d5ddc1add1ba3ee5925b46a786a48de4c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|