Skip to content

laboneq_applications.tasks.parameter_updating

This module defines the task for updating setup parameters.

temporary_modify(qubits, temporary_parameters=None)

Modify the quantum elements temporarily with the given parameters.

Parameters:

Name Type Description Default
qubits QuantumElements

the quantum elements to be temporarily modified.

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

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

{
    quantum_element_uid: {
        "quantum_element_uid": param_value
    }
}
or
{
    "quantum_element_uid": QuantumParameters
}
None

Returns:

Type Description
QuantumElements

The list of quantum elements with the temporary parameters applied, including

QuantumElements

the original quantum elements that were not modified.

QuantumElements

If a single quantum element is passed, returns the modified quantum element.

Raises:

Type Description
TypeError

If the temporary parameters have invalid type.

Deprecated in version 2.54.0.

The task `temporary_modify` was deprecated and replaced with the task
`temporary_qpu`. Instead of passing temporary qubits to an experiment, we
now pass a temporary QPU.

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.

Deprecated in version 26.1.0.

The qubits argument of type QuantumElements is deprecated. 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 QuantumElements | 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.

update_qubits(qpu, qubit_parameters)

Updates the parameters of the qubits in the qpu.

Deprecated in version 2.14.0.

The task update_qubits was deprecated and replaced with the more general task update_qpu. The new task update_qpu works for both quantum elements and topology edges.

Parameters:

Name Type Description Default
qpu QPU

the qpu containing the qubits to be updated.

required
qubit_parameters dict[str, dict[str, dict[str, int | float | Variable | None]]]

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

{
    q.uid: {
        qb_param_name: qb_param_value
        }
}
required