qibolab.platform package#

class qibolab.platform.Platform(name: str, qubits: ~typing.Dict[str | int, ~qibolab.qubits.Qubit], pairs: ~typing.Dict[~typing.Tuple[str | int, str | int], ~qibolab.qubits.QubitPair], instruments: ~typing.Dict[str, ~qibolab.instruments.abstract.Instrument], settings: ~qibolab.platform.platform.Settings = <factory>, resonator_type: str | None = None, couplers: ~typing.Dict[str | int, ~qibolab.couplers.Coupler] = <factory>, is_connected: bool = False, topology: ~networkx.classes.graph.Graph = <factory>)[source]#

Bases: object

Platform for controlling quantum devices.

name: str#

Name of the platform.

qubits: Dict[str | int, Qubit]#

Dictionary mapping qubit names to qibolab.qubits.Qubit objects.

pairs: Dict[Tuple[str | int, str | int], QubitPair]#

Dictionary mapping tuples of qubit names to qibolab.qubits.QubitPair objects.

instruments: Dict[str, Instrument]#

Dictionary mapping instrument names to qibolab.instruments.abstract.Instrument objects.

settings: Settings#

Container with default execution settings.

resonator_type: str | None = None#

Type of resonator (2D or 3D) in the used QPU.

Default is 3D for single-qubit chips and 2D for multi-qubit.

couplers: Dict[str | int, Coupler]#

Dictionary mapping coupler names to qibolab.couplers.Coupler objects.

is_connected: bool = False#

Flag for whether we are connected to the physical instruments.

topology: Graph#

Graph representing the qubit connectivity in the quantum chip.

property nqubits: int#

Total number of usable qubits in the QPU.

property ordered_pairs#

List of qubit pairs that are connected in the QPU.

property sampling_rate#

Sampling rate of control electronics in giga samples per second (GSps).

connect()[source]#

Connect to all instruments.

disconnect()[source]#

Disconnects from instruments.

execute_pulse_sequence(sequence: PulseSequence, options: ExecutionParameters, **kwargs)[source]#
Parameters:
  • sequence (qibolab.pulses.PulseSequence) – Pulse sequences to execute.

  • options (qibolab.platforms.platform.ExecutionParameters) – Object holding the execution options.

  • **kwargs – May need them for something

Returns:

Readout results acquired by after execution.

execute_pulse_sequences(sequences: List[PulseSequence], options: ExecutionParameters, **kwargs)[source]#
Parameters:
  • sequence (List[qibolab.pulses.PulseSequence]) – Pulse sequences to execute.

  • options (qibolab.platforms.platform.ExecutionParameters) – Object holding the execution options.

  • **kwargs – May need them for something

Returns:

Readout results acquired by after execution.

sweep(sequence: PulseSequence, options: ExecutionParameters, *sweepers: Sweeper)[source]#

Executes a pulse sequence for different values of sweeped parameters.

Useful for performing chip characterization.

Example

import numpy as np
from qibolab.dummy import create_dummy
from qibolab.sweeper import Sweeper, Parameter
from qibolab.pulses import PulseSequence
from qibolab.execution_parameters import ExecutionParameters


platform = create_dummy()
sequence = PulseSequence()
parameter = Parameter.frequency
pulse = platform.create_qubit_readout_pulse(qubit=0, start=0)
sequence.add(pulse)
parameter_range = np.random.randint(10, size=10)
sweeper = Sweeper(parameter, parameter_range, [pulse])
platform.sweep(sequence, ExecutionParameters(), sweeper)
Returns:

Readout results acquired by after execution.

get_qubit(qubit)[source]#

Return the name of the physical qubit corresponding to a logical qubit.

Temporary fix for the compiler to work for platforms where the qubits are not named as 0, 1, 2, …

get_coupler(coupler)[source]#

Return the name of the physical coupler corresponding to a logical coupler.

Temporary fix for the compiler to work for platforms where the couplers are not named as 0, 1, 2, …

create_RX90_pulse(qubit, start=0, relative_phase=0)[source]#
create_RX_pulse(qubit, start=0, relative_phase=0)[source]#
create_RX12_pulse(qubit, start=0, relative_phase=0)[source]#
create_CZ_pulse_sequence(qubits, start=0)[source]#
create_iSWAP_pulse_sequence(qubits, start=0)[source]#
create_CNOT_pulse_sequence(qubits, start=0)[source]#
create_MZ_pulse(qubit, start)[source]#
create_qubit_drive_pulse(qubit, start, duration, relative_phase=0)[source]#
create_qubit_readout_pulse(qubit, start)[source]#
create_qubit_flux_pulse(qubit, start, duration, amplitude=1)[source]#
create_coupler_pulse(coupler, start, duration=None, amplitude=None)[source]#
create_RX90_drag_pulse(qubit, start, beta, relative_phase=0)[source]#

Create native RX90 pulse with Drag shape.

create_RX_drag_pulse(qubit, start, beta, relative_phase=0)[source]#

Create native RX pulse with Drag shape.

qibolab.platform.create_platform(name: str) Platform[source]#

A platform for executing quantum algorithms.

It consists of a quantum processor QPU and a set of controlling instruments.

Parameters:
  • name (str) – name of the platform. Options are ‘tiiq’, ‘qili’ and ‘icarusq’.

  • path (pathlib.Path) – path with platform serialization

Returns:

The plaform class.

qibolab.platform.unroll_sequences(sequences: List[PulseSequence], relaxation_time: int) Tuple[PulseSequence, Dict[str, str]][source]#

Unrolls a list of pulse sequences to a single pulse sequence with multiple measurements.

Parameters:
  • sequences (list) – List of pulse sequences to unroll.

  • relaxation_time (int) – Time in ns to wait for the qubit to relax between playing different sequences.

Returns:

Unrolled pulse sequence containing

multiple measurements.

readout_map (dict): Map from original readout pulse serials to the unrolled readout pulse

serials. Required to construct the results dictionary that is returned after execution.

Return type:

total_sequence (qibolab.pulses.PulseSequence)

Submodules#

qibolab.platform.load module#

qibolab.platform.load.create_platform(name: str) Platform[source]#

A platform for executing quantum algorithms.

It consists of a quantum processor QPU and a set of controlling instruments.

Parameters:
  • name (str) – name of the platform. Options are ‘tiiq’, ‘qili’ and ‘icarusq’.

  • path (pathlib.Path) – path with platform serialization

Returns:

The plaform class.

qibolab.platform.load.available_platforms() list[str][source]#

Returns the platforms found in the $QIBOLAB_PLATFORMS directory.

qibolab.platform.platform module#

A platform for executing quantum algorithms.

qibolab.platform.platform.unroll_sequences(sequences: List[PulseSequence], relaxation_time: int) Tuple[PulseSequence, Dict[str, str]][source]#

Unrolls a list of pulse sequences to a single pulse sequence with multiple measurements.

Parameters:
  • sequences (list) – List of pulse sequences to unroll.

  • relaxation_time (int) – Time in ns to wait for the qubit to relax between playing different sequences.

Returns:

Unrolled pulse sequence containing

multiple measurements.

readout_map (dict): Map from original readout pulse serials to the unrolled readout pulse

serials. Required to construct the results dictionary that is returned after execution.

Return type:

total_sequence (qibolab.pulses.PulseSequence)

class qibolab.platform.platform.Settings(nshots: int = 1024, relaxation_time: int = 100000)[source]#

Bases: object

Default execution settings read from the runcard.

nshots: int = 1024#

Default number of repetitions when executing a pulse sequence.

relaxation_time: int = 100000#

Time in ns to wait for the qubit to relax to its ground state between shots.

fill(options: ExecutionParameters)[source]#

Use default values for missing execution options.

class qibolab.platform.platform.Platform(name: str, qubits: ~typing.Dict[str | int, ~qibolab.qubits.Qubit], pairs: ~typing.Dict[~typing.Tuple[str | int, str | int], ~qibolab.qubits.QubitPair], instruments: ~typing.Dict[str, ~qibolab.instruments.abstract.Instrument], settings: ~qibolab.platform.platform.Settings = <factory>, resonator_type: str | None = None, couplers: ~typing.Dict[str | int, ~qibolab.couplers.Coupler] = <factory>, is_connected: bool = False, topology: ~networkx.classes.graph.Graph = <factory>)[source]#

Bases: object

Platform for controlling quantum devices.

name: str#

Name of the platform.

qubits: Dict[str | int, Qubit]#

Dictionary mapping qubit names to qibolab.qubits.Qubit objects.

pairs: Dict[Tuple[str | int, str | int], QubitPair]#

Dictionary mapping tuples of qubit names to qibolab.qubits.QubitPair objects.

instruments: Dict[str, Instrument]#

Dictionary mapping instrument names to qibolab.instruments.abstract.Instrument objects.

settings: Settings#

Container with default execution settings.

resonator_type: str | None = None#

Type of resonator (2D or 3D) in the used QPU.

Default is 3D for single-qubit chips and 2D for multi-qubit.

couplers: Dict[str | int, Coupler]#

Dictionary mapping coupler names to qibolab.couplers.Coupler objects.

is_connected: bool = False#

Flag for whether we are connected to the physical instruments.

topology: Graph#

Graph representing the qubit connectivity in the quantum chip.

property nqubits: int#

Total number of usable qubits in the QPU.

property ordered_pairs#

List of qubit pairs that are connected in the QPU.

property sampling_rate#

Sampling rate of control electronics in giga samples per second (GSps).

connect()[source]#

Connect to all instruments.

disconnect()[source]#

Disconnects from instruments.

execute_pulse_sequence(sequence: PulseSequence, options: ExecutionParameters, **kwargs)[source]#
Parameters:
  • sequence (qibolab.pulses.PulseSequence) – Pulse sequences to execute.

  • options (qibolab.platforms.platform.ExecutionParameters) – Object holding the execution options.

  • **kwargs – May need them for something

Returns:

Readout results acquired by after execution.

execute_pulse_sequences(sequences: List[PulseSequence], options: ExecutionParameters, **kwargs)[source]#
Parameters:
  • sequence (List[qibolab.pulses.PulseSequence]) – Pulse sequences to execute.

  • options (qibolab.platforms.platform.ExecutionParameters) – Object holding the execution options.

  • **kwargs – May need them for something

Returns:

Readout results acquired by after execution.

sweep(sequence: PulseSequence, options: ExecutionParameters, *sweepers: Sweeper)[source]#

Executes a pulse sequence for different values of sweeped parameters.

Useful for performing chip characterization.

Example

import numpy as np
from qibolab.dummy import create_dummy
from qibolab.sweeper import Sweeper, Parameter
from qibolab.pulses import PulseSequence
from qibolab.execution_parameters import ExecutionParameters


platform = create_dummy()
sequence = PulseSequence()
parameter = Parameter.frequency
pulse = platform.create_qubit_readout_pulse(qubit=0, start=0)
sequence.add(pulse)
parameter_range = np.random.randint(10, size=10)
sweeper = Sweeper(parameter, parameter_range, [pulse])
platform.sweep(sequence, ExecutionParameters(), sweeper)
Returns:

Readout results acquired by after execution.

get_qubit(qubit)[source]#

Return the name of the physical qubit corresponding to a logical qubit.

Temporary fix for the compiler to work for platforms where the qubits are not named as 0, 1, 2, …

get_coupler(coupler)[source]#

Return the name of the physical coupler corresponding to a logical coupler.

Temporary fix for the compiler to work for platforms where the couplers are not named as 0, 1, 2, …

create_RX90_pulse(qubit, start=0, relative_phase=0)[source]#
create_RX_pulse(qubit, start=0, relative_phase=0)[source]#
create_RX12_pulse(qubit, start=0, relative_phase=0)[source]#
create_CZ_pulse_sequence(qubits, start=0)[source]#
create_iSWAP_pulse_sequence(qubits, start=0)[source]#
create_CNOT_pulse_sequence(qubits, start=0)[source]#
create_MZ_pulse(qubit, start)[source]#
create_qubit_drive_pulse(qubit, start, duration, relative_phase=0)[source]#
create_qubit_readout_pulse(qubit, start)[source]#
create_qubit_flux_pulse(qubit, start, duration, amplitude=1)[source]#
create_coupler_pulse(coupler, start, duration=None, amplitude=None)[source]#
create_RX90_drag_pulse(qubit, start, beta, relative_phase=0)[source]#

Create native RX90 pulse with Drag shape.

create_RX_drag_pulse(qubit, start, beta, relative_phase=0)[source]#

Create native RX pulse with Drag shape.