laboneq_applications.contrib.experiments.single_qubit_randomized_benchmarking
¶
This module defines a randomized benchmarking experiment.
In this experiment, ...
The experiment has the following pulse sequence:
qb --- [clifford sequence] --- [recovery gate] --- [ measure ]
If multiple qubits are passed to the run workflow, the above pulses are applied
in parallel on all the qubits.
Note that in the current implementation, the same Clifford sequences are applied on all qubits.
create_experiment(qpu, qubits, clifford_sequences, options=None)
¶
Creates a single-qubit randomized benchmarking experiment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qpu
|
QPU
|
The qpu consisting of the original qubits and quantum operations. |
required |
qubits
|
QuantumElements
|
The qubits to run the experiments on. May be either a single qubit or a list of qubits. |
required |
clifford_sequences
|
tuple[list[tuple], ...]
|
The RB sequences that generate_clifford_sequences returns. |
required |
options
|
TuneupExperimentOptions | None
|
The options for building the workflow. In addition to options from WorkflowOptions, the following custom options are supported:
|
None
|
Returns:
| Name | Type | Description |
|---|---|---|
experiment |
Experiment
|
The generated LabOne Q experiment instance to be compiled and executed. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the quantum operations cannot prepare the initial state of the transition or one of the calibration states. |
Example
options = TuneupExperimentOptions()
options.count = 10
# QPU from a two-qubit device setup
qpu = QPU(
quantum_elements=TunableTransmonQubit.from_device_setup(setup),
quantum_operations=TunableTransmonOperations(),
)
clifford_sequences = generate_clifford_sequences(
length_cliffords=[1, 5, 10, 20, 50],
variations=5,
)
q0, q1 = qpu["q0"], qpu["q1"]
create_experiment(
qpu=qpu,
qubits=[q0, q1],
clifford_sequences=clifford_sequences,
options=options,
)
experiment_workflow(session, qpu, qubits, *, length_cliffords, variations=1, seed=None, gate_map=None, temporary_parameters=None, options=None)
¶
The Randomized Benchmarking Workflow for single qubits.
The workflow consists of the following steps:
Changed in version 26.10.0
The experiment no longer routes its Clifford sequences through OpenQASM.
create_sq_rb_qasm is now generate_clifford_sequences, returns the
gates themselves and applies the default gate_map itself, so
add_qasm_operations and get_gate_map are gone.
Removed in version 26.7.0
The qubits argument of type QuantumElements has been removed.
Please pass qubits of type list[str] | str instead, i.e., the quantum
element UIDs instead of the quantum element instances.
Changed in version 26.4.0
All arguments apart from session, qpu, and qubits are now keyword
arguments.
Changed in version 26.1.0
The temporary_parameters positional argument was added in the
penultimate position. Note that this is a breaking change if
calling the experiment workflow with the options positional argument.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
The connected session to use for running the experiment. |
required |
qpu
|
QPU
|
The qpu consisting of the original qubits and quantum operations. |
required |
qubits
|
list[str] | str
|
The qubits to run the experiments on, passed by UID. May be either a single qubit or a list of qubits. |
required |
length_cliffords
|
list
|
list of numbers of Clifford gates to sweep |
required |
variations
|
int
|
Number of random seeds for RB. |
1
|
seed
|
int | None
|
A seed used to initialize numpy.random.default_rng when generating circuits. Default is None and provides a random seed. |
None
|
gate_map
|
dict | None
|
Dictionary to define the native gate set in qiskit and the corresponding quantum_operations's in LabOne Q. Default: {"id":None, "sx":"x90", "x":"x180", "rz":"rz"}. |
None
|
temporary_parameters
|
dict[str, dict | QuantumParameters] | None
|
The temporary parameters to update the qubits with. |
None
|
options
|
TuneUpWorkflowOptions | None
|
The options for building the workflow. In addition to options from WorkflowOptions, the following custom options are supported:
|
None
|
Returns:
| Name | Type | Description |
|---|---|---|
result |
None
|
The result of the workflow. |
Example
options = experiment_workflow.options()
options.count(10)
options.transition("ge")
# QPU from a two-qubit device setup
qpu = QPU(
quantum_elements=TunableTransmonQubit.from_device_setup(setup),
quantum_operations=TunableTransmonOperations(),
)
result = experiment_workflow(
session=session,
qpu=qpu,
qubits=["q0", "q1"],
length_cliffords=[1, 5, 10, 20, 50],
variations=5,
options=options,
).run()
generate_clifford_sequences(length_cliffords, gate_map=None, variations=1, seed=None, options=None)
¶
Creates the RB Clifford sequences as lists of gates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
length_cliffords
|
list
|
A list of RB sequences lengths. |
required |
gate_map
|
dict | None
|
Dictionary to define the native gate set in qiskit and the corresponding quantum operations in LabOne Q. Default: {"sx":"x90", "x":"x180", "rz":"rz"}. |
None
|
variations
|
int
|
Number of samples to generate for each sequence length. |
1
|
seed
|
int | None
|
A seed used to initialize numpy.random.default_rng when generating circuits. |
None
|
options
|
TuneupExperimentOptions | None
|
The options for building the workflow. In addition to options from WorkflowOptions, the following custom options are supported:
|
None
|
Returns:
| Type | Description |
|---|---|
tuple[list[tuple], ...]
|
One list per Clifford sequence of |