Skip to content

laboneq_applications.tasks.parameter_updating

This module defines the task for updating setup parameters.

temporary_qpu(qpu, temporary_parameters=None)

Modify the QPU temporarily with the given parameters.

Parameters:

Name Type Description Default
qpu QPU

The QPU to be temporarily modified.

required
temporary_parameters dict[str | tuple[str, str, str], dict | QuantumParameters] | None

The parameters to be temporarily modified. If None, the QPU is returned as is. The dictionary has the following form:

{
    key: {
        "param": param_value
    }
}
or
{
    key: QuantumParameters
}
where key may be either a quantum element UID string or edge key tuple of the form (tag, source node UID, target node UID).
None

Note

The quantum element attached to a topology edge cannot be temporarily modified.

Returns:

Name Type Description
QPU QPU

The QPU with the temporary parameters applied to each quantum element or edge.

Raises:

Type Description
TypeError

If the temporary parameters have invalid type.

temporary_quantum_elements_from_qpu(qpu, quantum_elements=None)

Return temporarily-modified quantum elements from the QPU.

Removed in version 26.7.0.

The qubits argument of type QuantumElements has been removed. Please pass qubits of type list[str] | str | None instead, i.e., the quantum element UIDs instead of the quantum element instances.

Parameters:

Name Type Description Default
qpu QPU

The temporarily-modified QPU.

required
quantum_elements list[str] | str | None

The quantum elements to return, passed by UID.

None

Returns:

Type Description
QuantumElements

The temporarily-modified quantum elements.

Raises:

Type Description
TypeError

If the quantum elements have invalid type.

update_qpu(qpu, parameters, eval_flags=None)

Updates the parameters of the quantum objects in the qpu.

A quantum object is any object that has associated quantum parameters. This includes quantum elements and topology edges.

Parameters:

Name Type Description Default
qpu QPU

The qpu containing the quantum objects to be updated.

required
parameters dict[str | tuple[str, str, str], dict[str, dict[str, int | float | Variable | None]]]

Quantum object parameters and the new values to be updated. This dictionary has the following form:

{key: {param_name: param_value}}
required
eval_flags dict[str, dict[str, bool]] | None

The dictionary of evaluation flags (optional). The keys are the qubit UIDs and the values are dictionaries of booleans. The success flag tells us whether the experiment is successful, and the update flag tells us whether the qubit parameter values have additionally been significantly updated. If both the success and update flags are True, then the qubit in the QPU will be updated.

None

Note

The key for a quantum element is the quantum element UID. The key for a topology edge is the tuple (tag, source node UID, target node UID), as returned by the qpu.topology.edge_keys() method.