Parameter Sweeps

Parameter sweep utilities.

class openquantumsim.sweep.SweepPoint(index, id, params, base_system, result_file=None, output_dir=None)

Bases: object

One concrete parameter point in a sweep.

Parameters:
  • index (int)

  • id (str)

  • params (dict[str, Any])

  • base_system (Mapping[str, Any])

  • result_file (Path | None)

  • output_dir (Path | None)

index: int
id: str
params: dict[str, Any]
base_system: Mapping[str, Any]
result_file: Path | None = None
output_dir: Path | None = None
property context: dict[str, Any]

Return base_system merged with this point’s parameters.

class openquantumsim.sweep.SweepRunResult(points, summary, outputs=<factory>, output_dir=None, manifest_path=None, summary_csv_path=None, summary_h5_path=None)

Bases: object

Result metadata returned by ParameterSweep.run().

Parameters:
  • points (list[dict[str, Any]])

  • summary (list[dict[str, Any]])

  • outputs (list[object | None])

  • output_dir (Path | None)

  • manifest_path (Path | None)

  • summary_csv_path (Path | None)

  • summary_h5_path (Path | None)

points: list[dict[str, Any]]
summary: list[dict[str, Any]]
outputs: list[object | None]
output_dir: Path | None = None
manifest_path: Path | None = None
summary_csv_path: Path | None = None
summary_h5_path: Path | None = None
class openquantumsim.sweep.ParameterSweep(base_system, params)

Bases: object

Specification for a parameter-grid simulation sweep.

base_system stores fixed configuration shared by all points. params maps each swept parameter name to a scalar or sequence of values. The run callback receives a SweepPoint and may return a solver Result, a scalar mapping, or any custom object paired with a custom summarize callback.

Parameters:
  • base_system (Mapping[str, Any])

  • params (Mapping[str, Any])

base_system: Mapping[str, Any]
params: Mapping[str, Any]
run(runner, *, output_dir=None, summarize=None, force=False, restart=False, keep_going=False)

Run the parameter grid.

When output_dir is provided, the sweep writes a restartable manifest.json, one HDF5 result per point when the callback returns a Result, plus summary.csv and summary.h5. Completed points are skipped on later calls unless force or restart is set.

Parameters:
  • runner (Callable[[SweepPoint], object])

  • output_dir (str | Path | None)

  • summarize (Callable[[SweepPoint, object], Mapping[str, Any]] | None)

  • force (bool)

  • restart (bool)

  • keep_going (bool)

Return type:

SweepRunResult