tqec.templates.layout.LayoutTemplate
- class LayoutTemplate(element_layout: dict[Position2D, RectangularTemplate], k: int = 2, default_increments: Displacement | None = None)[source]
- __init__(element_layout: dict[Position2D, RectangularTemplate], k: int = 2, default_increments: Displacement | None = None) None [source]
A template representing a layout of other templates.
Each element template in the layout is placed at a specific position in the 2D grid.
Note
The provided template positions have only one restriction: two templates should not be at the same position. In particular, this class does not require that the provided template are spatially connected or entirely cover a rectangular portion of the 2 spatial dimensions.
- Parameters:
element_layout – a dictionary with the position of the element templates in the layout as keys and the templates as values.
k – initial value for the scaling parameter.
default_increments – default increments between two plaquettes. Defaults to Displacement(2, 2) when None.
Methods
__init__
(element_layout[, k, default_increments])A template representing a layout of other templates.
get_increments
()Get the default increments of the template.
get_indices_map_for_instantiation
([...])get_midline_plaquettes
([orientation])Returns the default observable qubits for the template.
get_plaquette_indices_on_sides
(_)Get the indices of plaquettes that are located on the provided sides.
get_spatially_distinct_subtemplates
([...])Returns a representation of all the distinct sub-templates of the provided manhattan radius.
instantiate
([plaquette_indices])Generate the numpy array representing the template.
scale_to
(k)Scales self to the given scale k.
Attributes
element_shape
Return the uniform shape of the element templates.
expected_plaquettes_number
Returns the number of plaquettes expected from the instantiate method.
k
origin_shift
scalable_shape
Returns a scalable version of the template shape.
shape
Returns the current template shape.