Plotting
Module: equser.plotting
Dependencies: [analysis] extra (matplotlib)
Static matplotlib plots for PMon and CPOW data. Install with:
pip install equser[analysis]
PowerMonitorPlotter
Plot power monitor (PMon) time-series data. Generates separate SVG files for frequency, voltage, current, and power.
from equser.plotting import PowerMonitorPlotter
plotter = PowerMonitorPlotter()
plotter.plot_file('pmon_data.parquet')
# Creates: pmon_data_frequency.svg, pmon_data_voltage.svg, etc.
Constructor
PowerMonitorPlotter(
visible_channels=DEFAULT_VISIBLE_CHANNELS, # set of channel names to plot
output_dir=None, # output directory (default: same as input)
)
Methods
| Method | Returns | Description |
|---|---|---|
plot_file(path) | bool | Load and plot a PMon Parquet file. Returns True on success. |
Output
Generates multi-panel SVG figures:
- Frequency vs. time
- Phase RMS voltages vs. time (with fundamental overlay)
- Phase RMS currents vs. time (with fundamental and neutral)
- Phase active power and reactive power vs. time
WaveformPlotter
Plot CPOW waveform captures. Generates a two-panel voltage/current plot with proper ADC scaling from Parquet metadata.
from equser.plotting import WaveformPlotter
plotter = WaveformPlotter()
plotter.plot_file('cpow_data.parquet')
# Creates: cpow_data_waveform.svg
Constructor
WaveformPlotter(
output_dir=None, # output directory (default: same as input)
)
Methods
| Method | Returns | Description |
|---|---|---|
plot_file(path, start_sec=0.0, duration_ms=100.0) | bool | Plot a CPOW Parquet file. Returns True on success. |
Output
Generates a two-panel SVG figure:
- Three-phase voltage waveforms (VA, VB, VC)
- Three-phase current waveforms (IA, IB, IC) with neutral current adjusted
by the CT sensitivity ratio (
NEUTRAL_CT_RATIO = 30)
Color scheme
Both plotters use the standard power systems convention:
| Phase | Color |
|---|---|
| A | Black |
| B | Red |
| C | Blue |
| Neutral | Gray |
| Fundamental values | Lighter shades of the above |
Saving in other formats
The plotters write SVG files by default. For other formats, use matplotlib directly after loading data:
from equser.data import load_pmon
import matplotlib.pyplot as plt
table = load_pmon('pmon_data.parquet')
fig, ax = plt.subplots()
ax.plot(table['FREQ'].to_numpy())
fig.savefig('frequency.png', dpi=150, bbox_inches='tight')
fig.savefig('frequency.pdf')
Or from the CLI:
equser plot data.parquet -o output.png