pyopmspe11.visualization.plotting module#
Create benchmark figures from pyopmspe11 CSV output.
The module reads sparse, dense, and performance data, configures shared plotting styles, creates individual case figures, and compares compatible results from multiple folders.
- class PlotCase(case, tlabel, dims, tscale, lower)[source]#
Bases:
objectCase-dependent settings used by all plotting functions.
- Attributes:
- case
SPE11 case identifier.
- tlabel
Short time-unit label used in titles and filenames.
- dims
Number of coordinate columns in spatial CSV files.
- tscale
Factor converting simulation seconds to the displayed time unit.
- lower
Whether plots represent only the lower neighbourhood.
- Parameters:
- class PlotConfig(folders, generate, compare, where, dataf, colors, linestyles, props)[source]#
Bases:
objectFolders, output settings, and styles shared by one plotting run.
- Attributes:
- folders
Case directories whose generated CSV files are plotted.
- generate
Requested combination of plot types.
- compare
SPE11 case selected for a multi-folder comparison.
- where
Directory in which figures are saved.
- dataf
Optional data subdirectory relative to each case folder.
- colors, linestyles
Style sequences used to distinguish cases and quantities.
- props
Matplotlib properties used for folder labels.
- Parameters:
- class PlotGrid(times, xmsh, zmsh, xmx, ymy, zmz, kinds, cmaps, dims)[source]#
Bases:
objectCoordinates and display settings for dense spatial plots.
- Attributes:
- times
Spatial output times selected for plotting.
- xmsh, zmsh
Meshgrid coordinates passed to
pcolormesh.- xmx, ymy, zmz
Reporting-grid vertices along x, y, and z.
- kinds
Dense data variants to plot.
- cmaps
Colormaps assigned to dense quantities.
- dims
Number of coordinate columns in the spatial CSV files.
- Parameters:
- configure_matplotlib()[source]#
Configure Matplotlib defaults for benchmark figures.
- Return type:
None
- read_csv(path)[source]#
Read a benchmark CSV file into a numeric array.
- Parameters:
- pathstr
Input or output path.
- Returns:
- NDArray
Calculated numeric values.
- Parameters:
path (str)
- Return type:
NDArray
- load_time_series(folder, case)[source]#
Load a sparse time-series CSV file when available.
- Parameters:
- folderstr
Case output directory.
- casestr
SPE11 case identifier.
- Returns:
- csvNDArray or None
Loaded sparse time-series values, or
Nonewhen the file is absent.- foundbool
Whether a matching time-series file was found.
- Parameters:
- Return type:
- load_performance_series(folder, case, kind)[source]#
Load a performance time-series CSV file when available.
- Parameters:
- folderstr
Case output directory.
- casestr
SPE11 case identifier.
- kindstr
Regular or detailed data variant.
- Returns:
- csvNDArray or None
Loaded performance values, or
Nonewhen the file is absent.- foundbool
Whether a matching performance file was found.
- Parameters:
- Return type:
- load_spatial_map(folder, dataf, case, kind, time, tlabel)[source]#
Load one dense or performance-spatial CSV map.
- Parameters:
- folderstr
Case output directory.
- datafstr
Optional data subdirectory.
- casestr
SPE11 case identifier.
- kindstr
Regular or detailed data variant.
- timestr
Case-dependent time conversion factor.
- tlabelstr
Short time-unit label.
- Returns:
- NDArray
Calculated numeric values.
- Parameters:
- Return type:
NDArray
- format_performance_label(csv, index, folder)[source]#
Format the aggregate metric shown in a performance legend.
- build_plot_grid(folder, dataf, tlabel, dims, time)[source]#
Build plotting coordinates and select spatial output times.
- Parameters:
- folderstr
Case output directory.
- datafstr
Optional data subdirectory.
- tlabelstr
Short time-unit label.
- dimsint
Number of coordinate columns.
- timefloat
Case-dependent time conversion factor.
- Returns:
- timeslist[int]
Spatial output times selected for plotting.
- xmsh, zmshNDArray
Meshgrid coordinates used by
pcolormesh.- xmx, ymy, zmzNDArray
Reporting-grid vertices along x, y, and z.
- Parameters:
- Return type:
- plot_performance(case_cfg, run_cfg)[source]#
Create regular and detailed performance figures.
- Parameters:
- case_cfgPlotCase
Case-dependent plotting settings.
- run_cfgPlotConfig
Folders and styles for the plotting run.
- Returns:
- list[str]
Names of the generated regular and detailed performance figures.
- Parameters:
case_cfg (PlotCase)
run_cfg (PlotConfig)
- Return type:
- plot_sparse_data(case_cfg, run_cfg)[source]#
Create the sparse benchmark figure.
- Parameters:
- case_cfgPlotCase
Case-dependent plotting settings.
- run_cfgPlotConfig
Folders and styles for the plotting run.
- Returns:
- str
Generated filename or formatted text.
- Parameters:
case_cfg (PlotCase)
run_cfg (PlotConfig)
- Return type:
- plot_dense_data(case_cfg, run_cfg, grid)[source]#
Create dense spatial-map figures.
- Parameters:
- case_cfgPlotCase
Case-dependent plotting settings.
- run_cfgPlotConfig
Folders and styles for the plotting run.
- gridPlotGrid
Spatial coordinates and plot settings.
- Returns:
- list[str]
Names of the generated dense spatial-map figures.
- Parameters:
case_cfg (PlotCase)
run_cfg (PlotConfig)
grid (PlotGrid)
- Return type:
- plot_results(args)[source]#
Create all figures requested by the plotting configuration.
Comparison mode discovers compatible case folders, while normal mode reads data from one configured output directory.