io_utils#

I/O utilities for parameter sweep data management.

This module provides utilities for saving and loading parameter sweep results, particularly for Windows multiprocessing mode where OpenMDAO’s native recorder cannot be used.

Functions#

write_results_to_sqlite(results, filename)

Write parameter sweep results to SQLite database.

load_results_from_sqlite(filename)

Load parameter sweep results from SQLite database.

Module Contents#

io_utils.write_results_to_sqlite(results, filename)#

Write parameter sweep results to SQLite database.

This function is used when running parameter sweeps with Python’s multiprocessing module (default on Windows), where OpenMDAO’s DOEDriver and SqliteRecorder are bypassed. It creates a simple SQLite database with a single table containing all sweep results.

Use Case#

When use_multiprocessing=True (Windows default), the parameter sweep uses Python’s ProcessPoolExecutor instead of OpenMDAO’s parallel DOE. This bypasses OpenMDAO’s native case recording system, so results must be manually written to SQLite after the sweep completes.

param results:

Results dictionary with numpy arrays containing: - frequency : array of frequencies (Hz) - hv_voltage : array of HV voltages (V) - gap : array of gap distances (m) - energy_per_pulse : array of energy per pulse (J) - power_to_gas : array of power to gas (W) - power_error : array of power errors (fraction) - breakdown_voltage : array of breakdown voltages (V) - breakdown_margin : array of breakdown margins (V) - arc_current : array of arc currents (A) - sustainer_pulse_duration : array of sustainer pulse durations (s) - converged : array of convergence flags (bool)

type results:

dict

param filename:

Output SQLite database filename (e.g., ‘parameter_sweep_cases.sql’)

type filename:

str

Notes

The created database has a simple schema: - Single table named ‘cases’ - Each row represents one parameter sweep evaluation - Columns match the results dictionary keys - Can be queried with standard SQL tools

Examples

>>> results = run_parameter_sweep(use_multiprocessing=True)
>>> write_results_to_sqlite(results, "parameter_sweep_cases.sql")
io_utils.load_results_from_sqlite(filename)#

Load parameter sweep results from SQLite database.

Reads results from a SQLite database created by write_results_to_sqlite() and returns them as a dictionary of numpy arrays.

Parameters:

filename (str) – SQLite database filename

Returns:

Results dictionary with numpy arrays for each parameter/output

Return type:

dict

Raises:

FileNotFoundError – If the database file does not exist

Examples

>>> results = load_results_from_sqlite("parameter_sweep_cases.sql")
>>> print(f"Loaded {len(results['frequency'])} cases")