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().

thetas: Dict[str, ndarray]#
density_radii: Dict[str, int]#
efficiency: float = 0.0#
phase: str = ''#
step: int = 0#
removed_islands: int = 0#
filled_holes: int = 0#
property theta: ndarray#

First (or only) layer’s theta array.

property shape: Tuple[int, int]#
property layer_names: List[str]#
property density_filter_radius: int#

First layer’s density radius (backward compat).

design_mask(layer_name=None)#
Return type:

ndarray

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().

design: Design#
history: List[Dict[str, Any]]#
phase: str#
n_steps: int#
best_efficiency: float = 0.0#
best_step: int = 0#
schedule_config: Dict[str, Any]#
n_steps_planned: int = 0#
run_id: str = ''#
optimizer_state_bytes: bytes | None = None#
save(path)#
Return type:

str

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().

cd_violations: int#
cd_pct: float#
gap_violations: int#
gap_pct: float#
binarization_score: float#
disk_radius: int#
min_feature_nm: float#
min_gap_nm: float#
design_pixels: int#
status: str = ''#
passed: bool = False#

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:

str

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=…).

hyperwave_community.list_checkpoints(path)#

List all checkpoints in a directory.

Parameters:

path (str) – Parent directory containing step_NNNN subdirectories.

Return type:

List[Dict[str, Any]]

Returns:

List of dicts with step, efficiency, phase, created_at for each.