GridLens
Vendor-neutral Python power-quality analysis, standards checks, and reports from waveform files.
Quickstart
Install from PyPI and try the demo:
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)
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.
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
- IEEE 519 current distortion (TDD)
- Indian grid code limits
- COMTRADE loading (optional
comtrade) - HTML compliance reports
- Command-line tool
- PDF report and web UI
Development
To work on GridLens itself, install it from a clone in editable mode:
git clone https://github.com/bhuvi-777/gridlens.git
cd gridlens
pip install -e ".[dev]"
pytest
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.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gridlens-0.2.2.tar.gz | 22.2 kB | With provenance | Details for gridlens-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gridlens-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for gridlens-0.2.2-py3-none-any.whl |
Total release size: 45.6 kB
Release files / gridlens-0.2.2.tar.gz
| Download URL | gridlens-0.2.2.tar.gz |
|---|---|
| Size | 22.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
69aaab395c5170606a22499c0d922e24d2468fb59ae4e2e344d1bbf7e35f53cd
|
|
BLAKE2b-256 checksum How to use checksums |
9f7a9733258dc4bd471cf2770618765dae80b178162262f821f83a267783cd7e
|
| 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 24, 2026.
Transparency logRelease files / gridlens-0.2.2-py3-none-any.whl
| Download URL | gridlens-0.2.2-py3-none-any.whl |
|---|---|
| Size | 23.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8284deccf35fd63ea1cdff1e402c3b53d5c29c2448d5766b19766a380ca67714
|
|
BLAKE2b-256 checksum How to use checksums |
e4d91341d2559d9bf05eaea67b2b0194b1ee287147bd67bb543ae2cbde8d4e6c
|
| 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 24, 2026.
Transparency logSecurity for gridlens 0.2.2
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.
Attestation for gridlens-0.2.2.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 24, 2026.
Transparency logA 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.