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 on the chip, in any order.
Computational resonators on the chip, sorted.
Tunable couplers on the chip, in any order.
Tunable couplers on the chip, sorted by numerical IDs.
Probe lines on the chip, in any order.
Probe lines on the chip, sorted.
All components on the chip.
Map from each coupler to all other components it connects to.
Map from each component to all couplers connected to it.
Map from each probe line to all components it connects to.
Map from each component to the probeline connected to it.
Methods
Construct a ChipTopology instance from a CHAD.
Construct a ChipTopology instance from a raw Chip design record.
Extracts common resonator connected to all qubits.
Convenience method for getting the name of a computational resonator which is connected to both specified qubit components via tunable couplers.
Get probelines that are connected to any of the given components.
Couplers that only connect to the given chip components, and connect at least two of them.
Common coupler for the given chip components (e.g. qubit or computational resonator).
Gives all the loci of a given gate.
Couplers that connect to at least one of the given chip components.
Chip components that are connected to the given components by a coupler, but not included in them.
True iff the given component is a computational resonator.
True iff the given component is a coupler.
True iff the given component is a probe line.
True iff the given component is a qubit.
Prunes the given dictionary (e.g. a coupler-to-qubits map) to a subset of values.
Returns the mapped components for the given locus and the given gate.
Returns the locus that is mapped to the given components.
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.
- 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:
- 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:
- get_neighbor_couplers(components)#
Couplers that connect to at least one of the given chip components.
- 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:
- get_coupler_for(component_1, component_2)#
Common coupler for the given chip components (e.g. qubit or computational resonator).
- Parameters:
- Returns:
the common coupler
- Raises:
ValueError – the given components have zero or more than one connecting coupler
- Return type:
- 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:
- get_connected_probe_lines(components)#
Get probelines that are connected to any of the given components.
- Parameters:
components (Collection[str]) –
- Return type:
- 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.
- is_coupler(component)#
True iff the given component is a coupler.
- is_probe_line(component)#
True iff the given component is a probe line.
- is_computational_resonator(component)#
True iff the given component is a computational resonator.
- 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.
- _validate_locus_mapping(mapping=None)#
Validate that the components given in mapping are found in self and the mapping is correctly formed.
- 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:
- Returns:
The components mapped to the given locus or None if locus is not found in the given mapping.
- Return type:
- map_to_locus(mapped, name)#
Returns the locus that is mapped to the given components.
- Parameters:
- Returns:
The locus mapped to the given components or None if the components are not mapped to any locus.
- Return type:
- 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:
- 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.