types
FilledGrid dataclass
FilledGrid(
x_spacing: tuple[float, ...],
y_spacing: tuple[float, ...],
x_init: float | None,
y_init: float | None,
parent: Grid[NumX, NumY],
vacancies: frozenset[tuple[int, int]],
)
Bases: Grid[NumX, NumY]
flowchart TD
bloqade.geometry.dialects.filled.types.FilledGrid[FilledGrid]
bloqade.geometry.dialects.grid.types.Grid[Grid]
bloqade.geometry.dialects.grid.types.Grid --> bloqade.geometry.dialects.filled.types.FilledGrid
click bloqade.geometry.dialects.filled.types.FilledGrid href "" "bloqade.geometry.dialects.filled.types.FilledGrid"
click bloqade.geometry.dialects.grid.types.Grid href "" "bloqade.geometry.dialects.grid.types.Grid"
positions cached property
positions: IList[tuple[float, float], Any]
All positions in the grid as a list of tuples (x, y) in lexicographic order.
x_init class-attribute instance-attribute
x_init: float | None = field(init=False)
The initial x position of the grid, or None if not set.
x_spacing class-attribute instance-attribute
x_spacing: tuple[float, ...] = field(init=False)
A tuple of x spacings between grid points.
y_init class-attribute instance-attribute
y_init: float | None = field(init=False)
The initial y position of the grid, or None if not set.
y_spacing class-attribute instance-attribute
y_spacing: tuple[float, ...] = field(init=False)
A tuple of y spacings between grid points.
col_y_pos
col_y_pos(column_index: int)
Get the y positions of a specific column in the grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
column_index | int | The index of the column. | required |
Returns:
| Type | Description |
|---|---|
IList[float, NumY] | IList[float, NumY]: The y positions of the specified column. |
Source code in src/bloqade/geometry/dialects/filled/types.py
136 137 138 139 140 | |
get_view
get_view(
x_indices: IList[int, Any], y_indices: IList[int, Any]
)
Get a sub-grid view based on the specified x and y indices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_indices | Sequence[int] | The x indices to include in the sub-grid. | required |
y_indices | Sequence[int] | The y indices to include in the sub-grid. | required |
Returns:
| Name | Type | Description |
|---|---|---|
Grid | Grid | The sub-grid view. |
Source code in src/bloqade/geometry/dialects/filled/types.py
95 96 97 98 99 100 101 102 103 104 105 106 107 | |
is_equal
is_equal(other: Any) -> bool
Check if two grid geometry are equal.
Source code in src/bloqade/geometry/dialects/filled/types.py
47 48 | |
repeat
repeat(
x_times: int, y_times: int, x_gap: float, y_gap: float
)
Repeat the grid in both x and y directions with specified gaps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_times | int | The number of times to repeat the grid in the x direction. | required |
y_times | int | The number of times to repeat the grid in the y direction. | required |
x_gap | float | The gap between repeated grids in the x direction. | required |
y_gap | float | The gap between repeated grids in the y direction. | required |
Returns:
| Type | Description |
|---|---|
Grid[NumX, NumY] | Grid[NumX, NumY]: A new grid with the specified repetitions and gaps. |
Source code in src/bloqade/geometry/dialects/filled/types.py
121 122 123 124 125 126 127 128 | |
row_x_pos
row_x_pos(row_index: int)
Get the x positions of a specific row in the grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
row_index | int | The index of the row. | required |
Returns:
| Type | Description |
|---|---|
IList[float, NumX] | IList[float, NumX]: The x positions of the specified row. |
Source code in src/bloqade/geometry/dialects/filled/types.py
130 131 132 133 134 | |
scale
scale(x_scale: float, y_scale: float)
Scale the grid spacings by the specified x and y factors with fixed x and y initial positions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_scale | float | The scaling factor for the x spacings. | required |
y_scale | float | The scaling factor for the y spacings. | required |
Returns:
| Type | Description |
|---|---|
Grid[NumX, NumY] | Grid[NumX, NumY]: A new grid with scaled x and y spacings |
Source code in src/bloqade/geometry/dialects/filled/types.py
115 116 117 118 119 | |
shift
shift(x_shift: float, y_shift: float)
Shift the grid by the specified x and y amounts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_shift | float | The amount to shift the grid in the x direction. | required |
y_shift | float | The amount to shift the grid in the y direction. | required |
Returns:
| Type | Description |
|---|---|
Grid[NumX, NumY] | Grid[NumX, NumY]: A new grid with the specified shifts applied to the initial positions. |
Source code in src/bloqade/geometry/dialects/filled/types.py
109 110 111 112 113 | |