ChipTopology#

class ChipTopology(qubits, computational_resonators, couplers, probe_lines, variant='')#

Bases: object

Topology information for a chip (typically a QPU).

Can represent the information found in a CHAD, as well as locus mappings for gates.

Parameters:
  • qubits (Iterable[str]) – names of the qubits.

  • computational_resonators (Iterable[str]) – names of the computational resonators.

  • couplers (dict[str, Iterable[str]]) – mapping from coupler name to names of chip components it connects to.

  • probe_lines (dict[str, Iterable[str]]) – mapping from probe line name to names of chip components it connects to.

  • variant (str) – identifier of the QPU design variant.

Module: exa.common.qcm_data.chip_topology

Attributes

computational_resonators

Computational resonators on the chip, in any order.

computational_resonators_sorted

Computational resonators on the chip, sorted.

couplers

Tunable couplers on the chip, in any order.

couplers_sorted

Tunable couplers on the chip, sorted by numerical IDs.

probe_lines

Probe lines on the chip, in any order.

probe_lines_sorted

Probe lines on the chip, sorted.

all_components

All components on the chip.

coupler_to_components

Map from each coupler to all other components it connects to.

component_to_couplers

Map from each component to all couplers connected to it.

probe_line_to_components

Map from each probe line to all components it connects to.

component_to_probe_line

Map from each component to the probeline connected to it.

Methods

from_chad

Construct a ChipTopology instance from a CHAD.

from_chip_design_record

Construct a ChipTopology instance from a raw Chip design record.

get_all_common_resonators

Extracts common resonator connected to all qubits.

get_common_computational_resonator

Convenience method for getting the name of a computational resonator which is connected to both specified qubit components via tunable couplers.

get_connected_probe_lines

Get probelines that are connected to any of the given components.

get_connecting_couplers

Couplers that only connect to the given chip components, and connect at least two of them.

get_coupler_for

Common coupler for the given chip components (e.g. qubit or computational resonator).

get_loci

Gives all the loci of a given gate.

get_neighbor_couplers

Couplers that connect to at least one of the given chip components.

get_neighbor_locus_components

Chip components that are connected to the given components by a coupler, but not included in them.

is_computational_resonator

True iff the given component is a computational resonator.

is_coupler

True iff the given component is a coupler.

is_probe_line

True iff the given component is a probe line.

is_qubit

True iff the given component is a qubit.

limit_values

Prunes the given dictionary (e.g. a coupler-to-qubits map) to a subset of values.

map_locus

Returns the mapped components for the given locus and the given gate.

map_to_locus

Returns the locus that is mapped to the given components.

set_locus_mapping

Add a custom mapping from a gate locus to a set of components required for the gate operation.

computational_resonators#

Computational resonators on the chip, in any order.

computational_resonators_sorted#

Computational resonators on the chip, sorted.

couplers: frozenset[str]#

Tunable couplers on the chip, in any order.

couplers_sorted: tuple[str, ...]#

Tunable couplers on the chip, sorted by numerical IDs.

probe_lines: frozenset[str]#

Probe lines on the chip, in any order.

probe_lines_sorted: tuple[str, ...]#

Probe lines on the chip, sorted.

all_components#

All components on the chip.

coupler_to_components: dict[str, tuple[str, ...]]#

Map from each coupler to all other components it connects to. The values are sorted.

component_to_couplers: dict[str, frozenset]#

Map from each component to all couplers connected to it.

probe_line_to_components: dict[str, tuple[str, ...]]#

Map from each probe line to all components it connects to.

component_to_probe_line#

Map from each component to the probeline connected to it. Max 1 connection per component is assumed. Components without connection to a probe line don’t appear.

classmethod from_chip_design_record(record)#

Construct a ChipTopology instance from a raw Chip design record.

Parameters:

record (dict) – Record as returned by Station control.

Returns:

Corresponding chip topology

Return type:

ChipTopology

classmethod from_chad(chad)#

Construct a ChipTopology instance from a CHAD. Use from_chip_design_record() if possible.

Parameters:

chad (CHAD) – parsed CHAD model

Returns:

corresponding chip topology

Return type:

ChipTopology

get_neighbor_couplers(components)#

Couplers that connect to at least one of the given chip components.

Parameters:

components (Iterable[str]) – some chip components, typically qubits and computational resonators

Returns:

couplers that connect to at least one of components

Return type:

set[str]

get_connecting_couplers(components)#

Couplers that only connect to the given chip components, and connect at least two of them.

Equivalent to returning the edges in the components-induced subgraph of the coupling topology.

Parameters:

components (Collection[str]) – some chip components, typically qubits and computational resonators

Returns:

couplers that connect to only members of components, and to at least two of them

Return type:

set[str]

get_coupler_for(component_1, component_2)#

Common coupler for the given chip components (e.g. qubit or computational resonator).

Parameters:
  • component_1 (str) – first component

  • component_2 (str) – second component

Returns:

the common coupler

Raises:

ValueError – the given components have zero or more than one connecting coupler

Return type:

str

get_neighbor_locus_components(components)#

Chip components that are connected to the given components by a coupler, but not included in them.

Parameters:

components (Collection[str]) – some chip components, typically qubits and computational resonators

Returns:

components that are connected to components by a coupler, but not included in them

Return type:

set[str]

get_connected_probe_lines(components)#

Get probelines that are connected to any of the given components.

Parameters:

components (Collection[str]) –

Return type:

set[str]

static limit_values(dct, limit_to)#

Prunes the given dictionary (e.g. a coupler-to-qubits map) to a subset of values.

Used to prune e.g. coupler_to_components to a subset of relevant elements.

Parameters:
  • dct (ComponentMap) – Dictionary of collections of values.

  • limit_to (Collection[str]) – Components to limit the output to.

Returns:

The input dictionary, but only with key-value pairs where the value intersects with limit_to.

Return type:

ComponentMap

is_qubit(component)#

True iff the given component is a qubit.

Parameters:

component (str) –

Return type:

bool

is_coupler(component)#

True iff the given component is a coupler.

Parameters:

component (str) –

Return type:

bool

is_probe_line(component)#

True iff the given component is a probe line.

Parameters:

component (str) –

Return type:

bool

is_computational_resonator(component)#

True iff the given component is a computational resonator.

Parameters:

component (str) –

Return type:

bool

set_locus_mapping(name, mapping)#

Add a custom mapping from a gate locus to a set of components required for the gate operation.

The mapping is of the form {<locus>: <components mapped to locus>}, where a locus can be mapped to one or more components. The locus itself can be a set (denoting a reciprocal gate) or a tuple (non-reciprocal gate).

Some examples: - The default mapping (added in init of self) maps pairs of qubits to their common coupler reciprocally. - Fast flux CZ-gate maps couplers to their pairs of qubits that can perform qubit flux pulses non-reciprocally - A two-qubit gate implementation that includes playing pulses on neighboring components in addition to the

connecting coupler.

Parameters:
  • name (str) – The name for the gate & implementation this locus mapping represents (typically in the format "<gate name>.<implementation name>").

  • mapping (dict[tuple[str, ...] | frozenset[str], tuple[str, ...]]) – The locus mapping to be added.

Return type:

None

_validate_locus_mapping(mapping=None)#

Validate that the components given in mapping are found in self and the mapping is correctly formed.

Parameters:

mapping (dict[str | tuple[str], tuple[str, ...] | frozenset[str]] | None) –

Return type:

None

map_locus(locus, name=None)#

Returns the mapped components for the given locus and the given gate.

If the locus or the gate is not found from the locus mappings of self, returns None.

Parameters:
  • locus (tuple[str, ...] | frozenset[str]) – The locus to map.

  • name (str | None) – The name for the gate & implementation with which to map the locus (typically in the format "<gate name>.<implementation name>").

Returns:

The components mapped to the given locus or None if locus is not found in the given mapping.

Return type:

str | tuple[str] | None

map_to_locus(mapped, name)#

Returns the locus that is mapped to the given components.

Parameters:
  • mapped (str | tuple[str]) – The mapped components.

  • name (str) – The name for the gate & implementation with which to map the locus (typically in the format "<gate name>.<implementation name>").

Returns:

The locus mapped to the given components or None if the components are not mapped to any locus.

Return type:

tuple[str, …] | frozenset[str] | None

get_loci(name, default_mapping_dimension=None)#

Gives all the loci of a given gate.

If no mapping with the given the name nor a default mapping with the given dimensionality is found, returns an empty list.

Parameters:
  • name (str) – The name for the gate & implementation with which to map the locus (typically in the format "<gate name>.<implementation name>").

  • default_mapping_dimension (int | None) – If provided, will return the loci of the default mapping of the given dimensionality in case no mapping for name can be found.

Returns:

The loci associated with the given gate.

Return type:

list[tuple[str, …] | frozenset[str]]

get_common_computational_resonator(first_qubit, second_qubit)#

Convenience method for getting the name of a computational resonator which is connected to both specified qubit components via tunable couplers.

Args:

first_qubit: The name of the first qubit. second_qubit: The name of the second qubit.

The order of qubits does not matter, i.e. the first_qubit and second_qubit arguments are interchangeable.

Returns:
  • The name of the computational resonator that is connected to both inputted qubits via tunable couplers.

Raises:
  • ValueError: If no computational resonator was found that is connected to both qubits via tunable

couplers.

Parameters:
  • first_qubit (str) –

  • second_qubit (str) –

Return type:

str

get_all_common_resonators(qubits)#

Extracts common resonator connected to all qubits.

Parameters:

qubits (list[str]) – List of qubit names.

Returns:

Returns a set containing computational resonator names. If there is no common resonator returns an empty set.

Return type:

set