DetuningMap
- class pulser.register.DetuningMap(trap_coordinates, weights, slug=None)
Bases:
WeightMap
Defines a DetuningMap.
A
DetuningMap
is associated to aDMM
in aSequence
. It links a set of weights to a set of trap coordinates. It is intended to be defined by the user from aRegisterLayout
, aRegister
or aMappableRegister
usingdefine_detuning_map
.- Parameters:
trap_coordinates (ArrayLike) – An array containing the coordinates of the traps.
weights (
Sequence
[float
]) – A list of detuning weights (between 0 and 1) to associate to the traps.
Attributes
The dimensionality of the coordinates (2 or 3).
The number of traps in the layout.
The sorted coordinates.
The weights sorted to match the sorted trap coordinates.
The array of trap coordinates, in the order they were given.
Mapping between trap IDs and coordinates.
weights
slug
Methods
Draws the detuning map.
Creates a map between qubit IDs and the weight on their sites.
Finds the trap ID for a given set of trap coordinates.
Returns the idempotent hash.
Signatures
- draw(labels=None, fig_name=None, kwargs_savefig={}, custom_ax=None, show=True)
Draws the detuning map.
- Parameters:
labels (
Sequence
[str
] |None
, default:None
) – If defined, writes the labels next to each site. Must have the same length and order like the trap_coordinates.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
.custom_ax (
Axes
|None
, default:None
) – If present, instead of creating its own Axes object, the function will use the provided one. Warning: if fig_name is set, it may save content beyond what is drawn in this function.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
- get_qubit_weight_map(qubits)
Creates a map between qubit IDs and the weight on their sites.
- Return type:
dict
[str
,float
]
- 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.
- 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()’).
- 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 sorted_weights: ndarray
The weights sorted to match the sorted trap coordinates.
- property trap_coordinates: ndarray
The array of trap coordinates, in the order they were given.
- property traps_dict: dict[int, ndarray]
Mapping between trap IDs and coordinates.