Skip to content

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.

add_qasm_operations(quantum_operations, gate_map)

Helper task to add qasm operations to the set of quantum operations.

The qasm operations are added as aliases of existing operations in the set.

Parameters:

Name Type Description Default
quantum_operations QuantumOperations

the set of quantum operations to add to.

required
gate_map dict[str, str]

a dictionary specifying the names of the qasm operations as keys and the corresponding names in the set of quantum operations as values.

required

Returns:

Type Description
QuantumOperations

the extended set of quantum operations

create_experiment(qpu, qubits, qasm_rb_sequences, quantum_operations=None, options=None)

Creates an Amplitude Rabi 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
qasm_rb_sequences list

RB sequences as QASM experiments.

required
quantum_operations QuantumOperations | None

A set of quantum operations to use for the experiment. If None, the set from qpu.quantum_operations is used.

None
options TuneupExperimentOptions | None

The options for building the workflow. In addition to options from [WorkflowOptions], the following custom options are supported: - create_experiment: The options for creating the experiment.

None

Returns:

Name Type Description
experiment Experiment

The generated LabOne Q experiment instance to be compiled and executed.

Raises:

Type Description
ValueError
Example
options = TuneupExperimentOptions()
options.count = 10
create_experiment(
    qpu=qpu,
    qubits=qubits,
    length_cliffords=[1,5,10,20,50],
    variations=5,
    options=options,
)

create_sq_rb_qasm(length_cliffords, gate_map, variations=1, seed=None, options=None)

Creates RB sequences as QASM experiments.

Parameters:

Name Type Description Default
length_cliffords list

A list of RB sequences lengths.

required
gate_map dict

Dictionary to define the native gate set in QASM and the corresponding quantum operations in LabOne Q.

required
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: - create_experiment: The options for creating the experiment.

None

Returns:

Name Type Description
experiment list

The generated LabOne Q experiment instance to be compiled and executed.

experiment_workflow(session, qpu, qubits, length_cliffords, variations=1, seed=None, gate_map=None, options=None)

The Randmized Benchmarking Workflow for single qubits.

The workflow consists of the following steps:

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 QuantumElements

The qubits to run the experiments on. 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 QASM and the corresponding quantum_operations's in LabOne Q. Default: {"id":None, "sx":"x90", "x":"x180", "rz":"rz"}.

None
options TuneUpWorkflowOptions | None

The options for building the workflow. In addition to options from [WorkflowOptions], the following custom options are supported: - create_experiment: The options for creating the experiment.

None

Returns:

Name Type Description
result None

The result of the workflow.

Example
options = experiment_workflow.options()
options.count(10)
options.transition("ge")
result = experiment_workflow(
    session=session,
    qpu=qpu,
    qubits=temp_qubits,
    length_cliffords=[1,5,10,20,50],
    variations=5,
    options=options,
).run()

get_gate_map(gate_map=None)

Helper task to generate the default gate map.

Parameters:

Name Type Description Default
gate_map dict[str, str] | None

a dictionary specifying the names of the qasm operations as keys and the corresponding names in the set of quantum operations as values. If this is not provided, the default map {"sx": "x90", "x": "x180", "rz": "rz"} is returned.

None

Returns:

Type Description
dict[str, str]

the gate map