Skip to main content

GridLens

PyPI CI License

GridLens HTML compliance report screenshot

Vendor-neutral Python power-quality analysis, standards checks, and reports from waveform files.

Quickstart

From a clone of this repository, run these three commands:

pip install gridlens
gridlens generate demo.csv --duration 60 --harmonic 5=0.04
gridlens analyze demo.csv --interval 10 --report report.html

For COMTRADE files, install the optional extra with pip install "gridlens[comtrade]".

The generated report is indicative for this short demo recording. For a full assessment, use an appropriately long recording and verify results against the official standard and certified instruments.

Why GridLens?

Power-quality tools are often tied to a particular instrument. GridLens aims to provide a free, scriptable layer for analyzing waveform data from multiple sources, with reusable metrics, event detection, standards checks, and reports.

Python example

from gridlens.generator import sine_wave
from gridlens.metrics import power_factor, rms, thd

t, v = sine_wave(rms=230, harmonics={5: 0.08})   # 230 V with 8 % 5th harmonic
_, i = sine_wave(rms=10, phase=-0.5)             # 10 A, lagging

print(f"Voltage RMS:  {rms(v):.1f} V")
print(f"Voltage THD:  {thd(v, fs=10_000):.2%}")
print(f"Power factor: {power_factor(v, i):.3f}")

Load your own data:

from gridlens.loaders import load_csv

wave = load_csv("capture.csv", voltage_col="v", current_col="i", fs=10_000)

Roadmap

  • Synthetic waveform generator
  • RMS, THD, active/reactive/apparent power, power factor
  • CSV loader
  • Sag, swell and interruption detection
  • EN 50160 and IEEE 519 voltage compliance checks
  • Indian grid code limits
  • COMTRADE loading (optional comtrade)
  • HTML compliance reports
  • Command-line tool
  • PDF report and web UI

Analyze a file

gridlens analyze capture.csv --standard en50160 --nominal 230 --freq 50
gridlens analyze capture.csv --standard ieee519 --bus-kv 11 --report report.html

Standards supported

Standard Status
EN 50160 Implemented for LV voltage, frequency, THD and harmonics
IEEE 519-2014/2022 Voltage distortion implemented; current TDD planned
India CEA/grid code Planned; limits are not implemented

Engineering guidance only. Compliance claims must be verified against the official standard text and edition, applicable system scope, and certified instruments.

Contributing

Issues and pull requests are welcome. See CONTRIBUTING.md for setup and contribution steps. Pull requests must pass CI before merging.

License

MIT

Metadata

Release files for gridlens 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gridlens 0.2.1
File Size Uploaded Provenance Actions
gridlens-0.2.1.tar.gz 21.9 kB With provenance Details for gridlens-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 45.1 kB

Release files / gridlens-0.2.1.tar.gz

Download URL gridlens-0.2.1.tar.gz
Size 21.9 kB
Tags Source
SHA-256 checksum
How to use checksums
65df92e6db841fbea49457954147b2e33e8be9f1c5b4539f1f135819716c2657
BLAKE2b-256 checksum
How to use checksums
9430b4c9cab4b20f732647d940f9c63b78a9314bc5992540fca45ae65a086b02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 20, 2026.

Transparency log

Release files / gridlens-0.2.1-py3-none-any.whl

Download URL gridlens-0.2.1-py3-none-any.whl
Size 23.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f9c8b8c141ca42ff61e1ca5c6bb8de32f689226199f743c5ea524e88a3dcd9f
BLAKE2b-256 checksum
How to use checksums
a04eb40afffc7366983fcd3fa103181fd01652a7aff22350904b4ce2604e9f2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 20, 2026.

Transparency log

Security for gridlens 0.2.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gridlens-0.2.1.tar.gz

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 Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files Full provenance

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