Skip to main content

PowerContract

PowerContract evaluates oscilloscope waveform data against electrical requirements defined in YAML.

For each requirement it reports PASS, FAIL, or INDETERMINATE, together with the measured value, limit, margin, and optional uncertainty and source.

It does not control the oscilloscope or replace the vendor's waveform-analysis software. Acquisition and evaluation are separate.

Try it

Install from a checkout:

python -m pip install .

Run the bundled example:

powercontract check examples/boot.csv examples/boot.yaml

Check the installed version:

powercontract --version

For your own capture, inspect the CSV first and use its actual column names in the contract. The getting-started guide walks through the full process.

Example contract

version: 1

capture:
  time_column: Time

signals:
  vdd:
    column: VDD_3V3
    nominal: 3.3

  en:
    column: EN
    nominal: 3.3

events:
  vdd_valid:
    signal: vdd
    direction: above
    threshold: 3.0

  en_release:
    signal: en
    direction: above
    threshold: 2.0

requirements:
  - id: PWR-001
    type: delay
    from: vdd_valid
    to: en_release
    min: 50us
    source: "Board power specification, section 3.2"

  - id: PWR-002
    type: max_value
    signal: vdd
    value: 3.6
    uncertainty: 0.03

Run it with:

powercontract check capture.csv power.yaml

Write a JSON report with:

powercontract check capture.csv power.yaml --json report.json

Requirements supported in v0.1

Contract version 1 uses seconds for time and volts for signal values.

  • delay between named threshold events;
  • minimum and maximum voltage;
  • event-bounded voltage windows;
  • rise time and fall time;
  • threshold stability windows;
  • explicit measurement uncertainty;
  • optional requirement source;
  • terminal and JSON output.

If the capture does not contain enough evidence to evaluate a requirement, the result is INDETERMINATE.

Capture formats

Input Support
Normal table CSV with one time column and named signal columns Supported
Siglent SDS800X HD per-channel CSV Tested with a real SDS824X HD
Older Siglent / WaveAce-style Source + units CSV Parser tested against documented/public examples
Rigol sequence CSV with Start / Increment Parser tested against public format examples
Rigol paired XY CSV Parser tested against public format examples
Tektronix five-column CSV Parser tested against the Tektronix-documented layout
Keysight InfiniiVision multi-channel CSV Supported through the normal table CSV loader when the file contains named columns
CSV from Python, pandas, MATLAB, LabVIEW, or custom acquisition code Supported through the normal table CSV loader

Only the Siglent SDS800X HD per-channel path is currently tested on physical hardware in this project. Other vendor-specific rows describe file-format support, not blanket support for every model from that vendor.

See Input formats and Oscilloscope vendor notes for details.

Documentation

Exit codes

Code Meaning
0 all requirements passed
1 at least one requirement failed or was indeterminate
2 invalid capture, contract, or output request

Scope

PowerContract answers one question: did the measured signals satisfy the declared electrical requirements?

It is not a waveform viewer, protocol decoder, SCPI control framework, automatic datasheet parser, or golden-waveform comparison tool.

Development

python -m pip install -e '.[dev]'
pytest

CI runs the test suite on Python 3.11 and 3.12, builds the package, runs twine check, and installs the built wheel in a clean virtual environment.

License

MIT. See LICENSE.

Release history is in CHANGELOG.md.

Metadata

Release files for powercontract 0.1.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 powercontract 0.1.0
File Size Uploaded
powercontract-0.1.0.tar.gz 22.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for powercontract 0.1.0
File Interpreter ABI Platform
powercontract-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 39.7 kB

Release files / powercontract-0.1.0.tar.gz

Download URL powercontract-0.1.0.tar.gz
Size 22.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e12d4415d6786a5bdb8e21924ebc7c750ff5bf60471edbcc6cc78b78fb72bd42
BLAKE2b-256 checksum
How to use checksums
bfa4eb0f678ccd33b494278200fb725cc58af11d134da508a3c105fa9806469b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release files / powercontract-0.1.0-py3-none-any.whl

Download URL powercontract-0.1.0-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dcf9f065c49880fd159a57f098f39467e6e9d8420ffb8a2a4ab29b3ac4a0428c
BLAKE2b-256 checksum
How to use checksums
bcaa6ddeb391318a0aed4c179126838be0c14668cb5df078e281e99817d6c9de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

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