Skip to content

Results are limited to Pulser v1.9.1

Product news
You are reading Pulser v1.9.1, an older version of this documentation. Go to the latest version (v1.10.0)

DetuningMap

class pulser.register.DetuningMap(trap_coordinates, weights, slug=None)

Bases: WeightMap

Defines a DetuningMap.

A DetuningMap is associated to a DMM in a Sequence. It links a set of weights to a set of trap coordinates. It is intended to be defined by the user from a RegisterLayout, a Register or a MappableRegister using define_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

dimensionality

The dimensionality of the coordinates (2 or 3).

number_of_traps

The number of traps in the layout.

sorted_coords

The sorted coordinates.

sorted_weights

The weights sorted to match the sorted trap coordinates.

trap_coordinates

The array of trap coordinates, in the order they were given.

traps_dict

Mapping between trap IDs and coordinates.

weights

slug

Methods

draw

Draws the detuning map.

get_qubit_weight_map

Creates a map between qubit IDs and the weight on their sites.

get_traps_from_coordinates

Finds the trap ID for a given set of trap coordinates.

static_hash

Returns the idempotent hash.

with_pos_offset

Returns a new weight map with a common offset on all coordinates.

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 for matplotlib.pyplot.savefig. Not applicable if fig_name is None.

  • 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, spot_waist=None)

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()’).

with_pos_offset(x_offset, y_offset)

Returns a new weight map with a common offset on all coordinates.

Parameters:
  • x_offset (float) – The shift along x, in µm.

  • y_offset (float) – The shift along y, in µm.

Return type:

TypeVar(WeightMapType, bound= WeightMap)

Returns:

A new instance of the weight map with the shift on all coordinates.

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.