RectangularLatticeLayout
- class pulser.register.RectangularLatticeLayout(rows, columns, col_spacing, row_spacing)
Bases:
RegisterLayout
RegisterLayout with rectangular lattice pattern in a rectangular shape.
- Parameters:
rows (
int
) – The number of rows of traps.columns (
int
) – The number of columns of traps.col_spacing (
float
) – Horizontal distance between neighbouring traps (in µm).row_spacing (
float
) – Vertical distance between neighbouring traps (in µm)
Attributes
A shorthand for 'sorted_coords'.
The dimensionality of the coordinates (2 or 3).
The number of traps in the layout.
The sorted coordinates.
Mapping between trap IDs and coordinates.
slug
Methods
Defines a DetuningMap for some trap ids of the register layout.
Defines a register from selected traps.
Draws the entire register layout.
Deserialize a layout from an abstract JSON object.
Finds the trap ID for a given set of trap coordinates.
Creates a mappable register associated with this layout.
Defines a register with a rectangular shape.
Defines a register with a square shape.
Returns the idempotent hash.
Serializes the layout into an abstract JSON object.
Signatures
- define_detuning_map(detuning_weights, slug=None)
Defines a DetuningMap for some trap ids of the register layout.
- Parameters:
detuning_weights (
Mapping
[int
,float
]) – A mapping between the IDs of the targeted traps and detuning weights (between 0 and 1).slug (
str
|None
, default:None
) – An optional identifier for the detuning map.
- Return type:
- Returns:
A DetuningMap associating detuning weights to the trap coordinates of the targeted traps.
- define_register(*trap_ids, qubit_ids=None)
Defines a register from selected traps.
- Parameters:
trap_ids (
int
) – The trap IDs selected to form the Register.qubit_ids (
Sequence
[str
] |None
, default:None
) – A sequence of unique qubit IDs to associated to the selected traps. Must be of the same length as the selected traps.
- Return type:
BaseRegister
- Returns:
The respective register instance.
- draw(blockade_radius=None, draw_graph=False, draw_half_radius=False, projection=True, fig_name=None, kwargs_savefig={}, show=True)
Draws the entire register layout.
- Parameters:
blockade_radius (
float
|None
, default:None
) – The distance (in μm) between atoms below which the Rydberg blockade effect occurs.draw_half_radius (
bool
, default:False
) – Whether or not to draw half the blockade radius surrounding each trap. If True, requires blockade_radius to be defined.draw_graph (
bool
, default:False
) – Whether or not to draw the interaction between atoms as edges in a graph. Will only draw if the blockade_radius is defined.projection (
bool
, default:True
) – If the layout is in 3D, draws it as projections on different planes.fig_name (
str
|None
, default:None
) – The name on which to save the figure. If None the figure will not be saved.kwargs_savefig (
dict
, default:{}
) – Keywords arguments formatplotlib.pyplot.savefig
. Not applicable if fig_name isNone
.show (
bool
, default:True
) – Whether or not to call plt.show() before returning. When combining this plot with other ones in a single figure, one may need to set this flag to False.
- Return type:
None
Note
When drawing half the blockade radius, we say there is a blockade effect between atoms whenever their respective circles overlap. This representation is preferred over drawing the full Rydberg radius because it helps in seeing the interactions between atoms.
- static from_abstract_repr(obj_str)
Deserialize a layout from an abstract JSON object.
- Parameters:
obj_str (str) – the JSON string representing the layout encoded in the abstract JSON format.
- Return type:
- get_traps_from_coordinates(*coordinates)
Finds the trap ID for a given set of trap coordinates.
- Parameters:
coordinates (ArrayLike) – The coordinates to return the trap IDs.
- Return type:
list
[int
]- Returns:
The list of trap IDs corresponding to the coordinates.
- make_mappable_register(n_qubits, prefix='q')
Creates a mappable register associated with this layout.
A mappable register is a register whose atoms’ positions have not yet been defined. It can be used to create a sequence whose register is only defined when it is built. Note that not all the qubits ‘reserved’ in a MappableRegister need to be in the final Register, as qubits not associated with trap IDs won’t be included. If you intend on defining registers of different sizes from the same mappable register, reserve as many qubits as you need for your largest register.
- Parameters:
n_qubits (
int
) – The number of qubits to reserve in the mappable register.prefix (
str
, default:'q'
) – The prefix for the qubit ids. Each qubit ID starts with the prefix, followed by an int from 0 to N-1 (e.g. prefix=’q’ -> IDs: ‘q0’, ‘q1’, ‘q2’, …).
- Return type:
MappableRegister
- Returns:
A substitute for a regular register that can be used to initialize a Sequence.
- rectangular_register(rows, columns, prefix='q')
Defines a register with a rectangular shape.
- Parameters:
rows (
int
) – The number of rows in the register.columns (
int
) – The number of columns in the register.prefix (
str
, default:'q'
) – The prefix for the qubit ids. Each qubit ID starts with the prefix, followed by an int from 0 to N-1 (e.g. prefix=’q’ -> IDs: ‘q0’, ‘q1’, ‘q2’, …).
- Return type:
- Returns:
The register instance created from this layout.
- square_register(side, prefix='q')
Defines a register with a square shape.
- Parameters:
side (
int
) – The length of the square’s side, in number of atoms.prefix (
str
, default:'q'
) – The prefix for the qubit ids. Each qubit ID starts with the prefix, followed by an int from 0 to N-1 (e.g. prefix=’q’ -> IDs: ‘q0’, ‘q1’, ‘q2’, …).
- Return type:
- Returns:
The register instance created from this layout.
- static_hash()
Returns the idempotent hash.
Python’s standard hash is not idempotent as it changes between sessions. This hash can be used when an idempotent hash is required.
- Returns:
An hexstring encoding the hash.
- Return type:
str
Note
This hash will be returned as an hexstring without the ‘0x’ prefix (unlike what is returned by ‘hex()’).
- to_abstract_repr()
Serializes the layout into an abstract JSON object.
- Return type:
str
- property coords: ndarray
A shorthand for ‘sorted_coords’.
- property dimensionality: int
The dimensionality of the coordinates (2 or 3).
- property number_of_traps: int
The number of traps in the layout.
- property sorted_coords: ndarray
The sorted coordinates.
- property traps_dict: dict[int, ndarray]
Mapping between trap IDs and coordinates.