Utilities API

Utility Helpers

Small reusable helpers for PhysPlot.

Input data structure:

Helpers accept Qt table widgets, numeric row/column indexes, curve-fit option arrays, coefficient arrays, and custom label strings.

Return type:

table_item_float returns a float. fit_label returns the legend label string for a fitted curve.

Optional main/runtime behavior:

Imported by the application at startup; not intended to be run directly.

fit_label(fit_options, index, coefficients, custom_label) str[source]

Build the legend label for a fitted curve.

Parameters:
  • fit_options (numpy.ndarray) – Boolean-like matrix where each row stores fit settings. Column 1 means label off, column 2 means equation label, and column 3 means custom label.

  • index (int) – Row index in fit_options for the active fit.

  • coefficients (Sequence[float]) – Polynomial coefficients or optimized callable-fit parameters.

  • custom_label (str) – User-provided label shown when custom labeling is enabled.

Returns:

Empty string for no label, custom_label for custom mode, or a compact coefficient summary for equation mode.

Return type:

str

table_item_float(table, row, column) float[source]

Return a numeric value from a QTableWidget cell.

Parameters:

table (QTableWidget): Table containing user-entered numeric data. row (int): Zero-based row index. column (int): Zero-based column index.

Returns:

float: Parsed cell value. Blank, missing, or invalid cells return 0.0.

Constants

Shared plotting constants for PhysPlot.

The user-facing labels and option lists are loaded from config/ui_config.json.

Input data structure:

Reads config/ui_config.json as a JSON object containing UI option arrays and plot-label defaults.

Return type:

Exposes dictionaries and lists such as MARKERS, LINESTYLES, COLORS, and PLOT_LABEL_DEFAULTS for use by the GUI.

Optional main/runtime behavior:

Imported by the application at startup; not intended to be run directly.