Parameter Sweeps¶
Parameter sweep utilities.
- class openquantumsim.sweep.SweepPoint(index, id, params, base_system, result_file=None, output_dir=None)¶
Bases:
objectOne 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_systemmerged 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:
objectResult 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:
objectSpecification for a parameter-grid simulation sweep.
base_systemstores fixed configuration shared by all points.paramsmaps each swept parameter name to a scalar or sequence of values. The run callback receives aSweepPointand may return a solverResult, a scalar mapping, or any custom object paired with a customsummarizecallback.- 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_diris provided, the sweep writes a restartablemanifest.json, one HDF5 result per point when the callback returns aResult, plussummary.csvandsummary.h5. Completed points are skipped on later calls unlessforceorrestartis 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: