stanza.routines.builtins.dqd_search.grid_search
Grid-based search utilities for DQD discovery.
Module Contents
Classes
Functions
Data
HIGH_SCORE_THRESHOLD
GRID_SQUARE_MULTIPLIER
DISTANCE_DECAY_FACTOR
API
Value: 1.5
Value: None
Value: 1.0
Results from measuring a single grid square.
Value: None
Value: None
Value: None
Value: None
Value: None
Value: None
Value: None
Value: None
Value: None
Value: None
Value: None
Value: None
Value: None
Convert to JSON-serializable dictionary.
Generate grid of square corners covering the voltage space.
Parameters:
(min, max) voltage bounds for X plunger
(min, max) voltage bounds for Y plunger
Side length of each grid square
Returns:
Tuple of (grid_corners, n_x, n_y) where:
- grid_corners: (n_x*n_y, 2) array of bottom-left corners
- n_x: Number of squares in X direction
- n_y: Number of squares in Y direction
Generate diagonal line through a square.
Parameters:
(2,) bottom-left corner coordinates
Square side length
Number of points along diagonal
Returns:
(num_points, 2) array of voltage coordinates
Generate 2D grid sweep over a square.
Parameters:
(2,) bottom-left corner coordinates
Square side length
Number of points per axis
Returns:
(num_points, num_points, 2) array of voltage coordinates
Get neighboring grid square indices.
Parameters:
Linear index of current grid square
Number of grid squares in X direction
Number of grid squares in Y direction
Use 8-connected (True) vs 4-connected (False)
Returns:
List of neighboring grid square indices
Calculate Manhattan distance between two grid squares.
Manhattan distance is the sum of horizontal and vertical distances, appropriate for grid topology where moves are limited to cardinal directions.
Parameters:
Linear index of first square
Linear index of second square
Number of squares in X direction
Number of squares in Y direction
Returns:
Manhattan distance (sum of horizontal and vertical distance)
Select candidate weighted by proximity and score of successful squares.
DQDs cluster in voltage space, so weight candidates by nearby high scores.
Parameters:
Candidate square indices
High-scoring squares
Number of squares in X direction
Number of squares in Y direction
Weight decay per unit distance
Returns:
Selected square index
Select next grid square using hierarchical priority strategy.
Priority: DQD neighbors > high-score neighbors > random unvisited.
Parameters:
Already-visited squares
Confirmed DQD squares
Number of squares in X direction
Number of squares in Y direction
Use 8-connected vs 4-connected neighborhoods
Minimum score for high-scoring squares
Returns:
Grid index to sample next, or None if all visited

