plotting#

Plotting utilities for Paroto visualization.

This module provides functions for visualizing generator operating windows, parameter spaces, and other system characteristics.

Functions#

plot_operating_window(ax[, Z, t_pulse, P_max, ...])

Plot the high-voltage generator operating window.

add_design_points_to_operating_window(ax, frequencies, ...)

Add design points to an operating window plot.

plot_constraint_boundary(ax, boundary_data[, ...])

Visualize constraint boundary exploration results.

Module Contents#

plotting.plot_operating_window(ax, Z=50.0, t_pulse=2e-08, P_max=1000.0, f_range=None, V_range=None, show_annotations=True)#

Plot the high-voltage generator operating window.

The operating window defines the feasible region in (frequency, voltage) space where the generator can operate safely. The constraint is:

\[\begin{split}P_{window} = \\frac{f \\cdot V^2 \\cdot t_{pulse}}{Z} \\leq P_{max}\end{split}\]

The boundary curve is given by:

\[\begin{split}V = \\sqrt{\\frac{P_{max} \\cdot Z}{f \\cdot t_{pulse}}}\end{split}\]
Parameters:
  • ax (matplotlib.axes.Axes) – Matplotlib axes object to plot on

  • Z (float, optional) – Design output impedance of generator (Ohm), default=50.0

  • t_pulse (float, optional) – Pulse duration (s), default=20e-9 (20 ns)

  • P_max (float, optional) – Maximum power in operating window (W), default=1000.0

  • f_range (tuple of float, optional) – (f_min, f_max) frequency range in Hz. If None, uses (1000, 300000)

  • V_range (tuple of float, optional) – (V_min, V_max) voltage range in V. If None, auto-computed from boundary

  • show_annotations (bool, optional) – If True, add text annotations with parameter values, default=True

Returns:

  • f_boundary (np.ndarray) – Frequency values along the boundary (Hz)

  • V_boundary (np.ndarray) – Voltage values along the boundary (V)

Examples

>>> import matplotlib.pyplot as plt
>>> from paroto.utils.plotting import plot_operating_window
>>> fig, ax = plt.subplots()
>>> f_bound, V_bound = plot_operating_window(ax)
>>> ax.set_xlabel("Frequency (Hz)")
>>> ax.set_ylabel("HV Voltage (V)")
>>> plt.show()
plotting.add_design_points_to_operating_window(ax, frequencies, voltages, constraint_values, label_prefix='Design')#

Add design points to an operating window plot.

Points are colored by whether they satisfy the operating window constraint.

Parameters:
  • ax (matplotlib.axes.Axes) – Matplotlib axes object (should already have operating window plotted)

  • frequencies (array_like) – Frequency values in Hz

  • voltages (array_like) – HV voltage values in V

  • constraint_values (array_like) – Operating window constraint satisfaction values (≥1 is feasible)

  • label_prefix (str, optional) – Prefix for legend labels, default=’Design’

Returns:

Examples

>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> from paroto.utils.plotting import (
...     plot_operating_window,
...     add_design_points_to_operating_window,
... )
>>> fig, ax = plt.subplots()
>>> plot_operating_window(ax)
>>> f_points = np.array([50000, 100000, 150000])
>>> V_points = np.array([15000, 20000, 25000])
>>> constraints = np.array([1.2, 0.8, 1.5])  # Middle point violates constraint
>>> add_design_points_to_operating_window(ax, f_points, V_points, constraints)
>>> plt.show()
plotting.plot_constraint_boundary(ax, boundary_data, param1_name=None, param2_name=None, show_grid_points=True, show_refinement_regions=False, shade_regions=True, boundary_color='red', boundary_width=2, show_colorbar=False)#

Visualize constraint boundary exploration results.

Plots the results from constraint boundary exploration, showing evaluated grid points, the constraint boundary, and feasible/infeasible regions.

Parameters:
  • ax (matplotlib.axes.Axes) – Matplotlib axes object to plot on

  • boundary_data (dict) – Dictionary returned from explore_constraint_boundary_2d() containing: - ‘param1_values’: Array of param1 evaluation points - ‘param2_values’: Array of param2 evaluation points - ‘constraint_values’: Array of constraint values - ‘feasible_mask’: Boolean array (True where feasible) - ‘boundary_points’: List of (param1, param2) tuples near boundary - Other metadata fields

  • param1_name (str, optional) – Name for x-axis (parameter 1). If None, uses boundary_data[‘param1_name’]

  • param2_name (str, optional) – Name for y-axis (parameter 2). If None, uses boundary_data[‘param2_name’]

  • show_grid_points (bool, optional) – If True, plot evaluated grid points, default=True

  • show_refinement_regions (bool, optional) – If True, highlight adaptively refined regions, default=False

  • shade_regions (bool, optional) – If True, shade feasible/infeasible regions, default=True

  • boundary_color (str, optional) – Color for boundary curve, default=’red’

  • boundary_width (float, optional) – Line width for boundary curve, default=2

  • show_colorbar (bool, optional) – If True, add colorbar showing constraint values, default=False

Return type:

None

Examples

>>> import matplotlib.pyplot as plt
>>> from paroto.utils.constraint_explorer import explore_constraint_boundary_2d
>>> from paroto.utils.plotting import plot_constraint_boundary
>>> # ... setup prob ...
>>> result = explore_constraint_boundary_2d(prob, "param1", "param2", "constraint")
>>> fig, ax = plt.subplots()
>>> plot_constraint_boundary(ax, result)
>>> plt.show()