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.

Parameters:

Name Type Description Default
qpu QPU

The temporarily-modified QPU.

required
quantum_elements QuantumElements | list[str] | str | None

The quantum elements to return. Either the QuantumElement objects or the UIDs may be provided.

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)

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

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