Types and Checkpoints#
Data types that flow between pipeline stages, and checkpoint utilities for saving and resuming optimization runs.
Types#
- class hyperwave_community.Design(thetas, density_radii, efficiency=0.0, phase='', step=0, removed_islands=0, filled_holes=0)#
Optimization state that flows between phases.
Carries the design variables (theta arrays per layer), the filter settings, and metadata about which phase produced this design. Pass between optimize() calls, and to surgery(), check_drc(), export_gds().
- class hyperwave_community.OptimizationResult(design, history, phase, n_steps, best_efficiency=0.0, best_step=0, schedule_config=<factory>, n_steps_planned=0, run_id='', optimizer_state_bytes=None)#
Result from optimize().
- class hyperwave_community.DrcReport(cd_violations, cd_pct, gap_violations, gap_pct, binarization_score, disk_radius, min_feature_nm, min_gap_nm, design_pixels, status='', passed=False)#
Result from check_drc().
Checkpoints#
- hyperwave_community.save_checkpoint(result, path, schedule_config=None, n_steps_planned=None, run_id=None)#
Save optimization state to a local directory.
- Parameters:
result (
Any) – An OptimizationResult (from optimize()) or a Checkpoint.path (
str) – Directory path to save to. Created if it doesn’t exist. If path already exists, a step-numbered subdirectory is created to avoid overwriting.schedule_config (
Optional[Dict[str,Any]]) – Schedule parameters (beta_init, beta_max, etc.). Required when saving an OptimizationResult. Ignored for Checkpoint.n_steps_planned (
Optional[int]) – Total steps the schedule was designed for. Required when saving an OptimizationResult.run_id (
Optional[str]) – Unique run identifier. Auto-generated if not provided.
- Return type:
- Returns:
Absolute path to the saved checkpoint directory.
- hyperwave_community.load_checkpoint(path)#
Load a checkpoint from a local directory.
- Parameters:
path (
str) – Path to the checkpoint directory (the step_NNNN dir). If path points to a parent run directory, loads the latest step.- Return type:
Checkpoint- Returns:
Checkpoint object ready to pass to optimize(resume_from=…).