suboptimumg.sweep.sweep_results_2var#

class suboptimumg.sweep.sweep_results_2var.SweepResults2Var(sweep_data, dependencies={})[source]#

Bases: object

Results and visualization for a 2D parameter sweep.

Parameters:
  • sweep_data (SweepData2D)

  • dependencies (dict[str, Callable[[float, float], float]])

dzdx_at_xy(x, y, z_var=SweepDatatype.TOTAL_PTS)[source]#

Estimate the partial derivative of the sweep result with respect to x.

Parameters:
  • x (float) – Value of the first sweep variable

  • y (float) – Value of the second sweep variable

  • z_var (SweepDatatype, optional) – Sweep datatype to differentiate (default is SweepDatatype.TOTAL_PTS)

Returns:

Estimated partial derivative with respect to x

Return type:

float

dzdy_at_xy(x, y, z_var=SweepDatatype.TOTAL_PTS)[source]#

Estimate the partial derivative of the sweep result with respect to y.

Parameters:
  • x (float) – Value of the first sweep variable

  • y (float) – Value of the second sweep variable

  • z_var (SweepDatatype, optional) – Sweep datatype to differentiate (default is SweepDatatype.TOTAL_PTS)

Returns:

Estimated partial derivative with respect to y

Return type:

float

grid_plot(plot_type, show_event_times=False, rows=2, cols=3, *, title=None, x_label=None, y_label=None, **kwargs)[source]#

Creates a dynamic grid plot for event results.

Parameters:
  • plot_type (PlotType) – PlotType enum (CONTOUR or SURFACE). Required.

  • show_event_times (bool, optional) – Whether to show event times on the plot instead of points (default is False)

  • rows (int, optional) – Number of rows in the grid (default is 2)

  • cols (int, optional) – Number of columns in the grid (default is 3)

  • title (str, optional) – Overall grid title. If empty, a default is generated.

  • x_label (str, optional) – Common X-axis label. Defaults to var_name_1.

  • y_label (str, optional) – Common Y-axis label. Defaults to var_name_2.

  • **kwargs (dict) – Additional arguments passed to plot_grid_3D (theme, font_config, layout_config, colorbar_config, smoothing_config)

Returns:

Plotly figure object

Return type:

go.Figure

plot_contour(z_var=SweepDatatype.TOTAL_PTS, *, title=None, subtitle=None, x_label=None, y_label=None, z_label=None, **kwargs)[source]#

Generates a single contour plot.

Parameters:
  • z_var (SweepDatatype, optional) – SweepDatatype to plot on z-axis (default is SweepDatatype.TOTAL_PTS)

  • title (str, optional) – Plot title (auto-generated if None)

  • subtitle (str, optional) – Plot subtitle (auto-generated from dependencies if None)

  • x_label (str, optional) – X-axis label (defaults to var_name_1)

  • y_label (str, optional) – Y-axis label (defaults to var_name_2)

  • z_label (str, optional) – Z-axis label (defaults to TITLE_MAPPING)

  • **kwargs (dict) – Additional arguments passed to plot3D_contour (theme, font_config, layout_config, colorbar_config, smoothing_config)

Returns:

Plotly figure object

Return type:

go.Figure

plot_surface(z_var=SweepDatatype.TOTAL_PTS, *, title=None, subtitle=None, x_label=None, y_label=None, z_label=None, **kwargs)[source]#

Generates a single surface plot.

Parameters:
  • z_var (SweepDatatype, optional) – SweepDatatype to plot on z-axis (default is SweepDatatype.TOTAL_PTS)

  • title (str, optional) – Plot title (auto-generated if None)

  • subtitle (str, optional) – Plot subtitle (auto-generated from dependencies if None)

  • x_label (str, optional) – X-axis label (defaults to var_name_1)

  • y_label (str, optional) – Y-axis label (defaults to var_name_2)

  • z_label (str, optional) – Z-axis label (defaults to TITLE_MAPPING)

  • **kwargs (dict) – Additional arguments passed to plot3D_surface (theme, font_config, layout_config, colorbar_config, smoothing_config, scene_config)

Returns:

Plotly figure object

Return type:

go.Figure

z_at_xy(x, y, z_var=SweepDatatype.TOTAL_PTS)[source]#

Interpolate the sweep result at an arbitrary (x, y) point.

Parameters:
  • x (float or ndarray) – Value(s) of the first sweep variable

  • y (float or ndarray) – Value(s) of the second sweep variable

  • z_var (SweepDatatype, optional) – Sweep datatype to interpolate (default is SweepDatatype.TOTAL_PTS)

Returns:

Interpolated value(s). A float when both x and y are scalars, otherwise an array matching the broadcast shape of x and y.

Return type:

float or ndarray

Notes

x and y are broadcast against each other, so passing one scalar and one array evaluates the scalar against every element of the array.