laboneq_applications.core.validation
¶
Utilities for the LabOne Q Applications library.
convert_qubits_sweeps_to_lists(qubits, sweep_points=None)
¶
Convert the qubits and sweep points to lists.
Deprecated in version 26.10.0
Use laboneq_applications.conversion.sweeps_per_quantum_element instead.
Checks the following conditions:
qubitsmust be aQuantumElementor a sequence ofQuantumElement.- All elements of the sweep points must be lists of numbers or arrays.
If a single qubit is passed, converts it and the sweep points (if not None)
to a list. If the conditions are met, returns the qubits and sweep points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qubits
|
QuantumElement | Sequence[QuantumElement]
|
Either a single |
required |
sweep_points
|
Sequence[float] | Sequence[Sequence[float] | ndarray] | ndarray | None
|
The sweep points for each qubit. If |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Sequence[QuantumElement], Sequence[Sequence[float] | ndarray] | ndarray] | Sequence[QuantumElement]
|
A tuple containing the validated qubits and sweep points or only the validated and converted qubits if sweep_points is None. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the conditions are not met. |
validate_and_convert_qubits_sweeps(qubits, sweep_points=None)
¶
Validate the qubits and sweep points, and return them as lists.
Deprecated in version 26.10.0
Use laboneq_applications.conversion.sweeps_per_quantum_element instead.
A single qubit needs a 1D sweep, and several qubits need one row of sweep points per qubit.
Returns:
| Type | Description |
|---|---|
tuple[Sequence[QuantumElement], Sequence[Sequence[float] | ndarray] | ndarray] | Sequence[QuantumElement]
|
A tuple containing the validated qubits and sweep points or only the validated and converted qubits if sweep_points is None. |
validate_and_convert_single_qubit_sweeps(qubit, sweep_points=None)
¶
Validates that single qubit is passed and converts a 1D sweep to array.
Deprecated in version 26.10.0
Use laboneq_applications.conversion.sweeps_per_quantum_element instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qubit
|
QuantumElement
|
A single |
required |
sweep_points
|
Sequence[float] | Sequence[Sequence[float]] | ndarray | None
|
The sweep points for a qubit. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[QuantumElement, Sequence[float] | ndarray] | QuantumElement
|
A tuple containing the qubit and sweep points as array, or
a single |
validate_and_convert_sweeps_to_arrays(sweep_points)
¶
Return the sweep points as a 1D array, or a 2D array with one row per qubit.
Deprecated in version 26.10.0
Use laboneq_applications.conversion.as_array instead.
validate_flux_driven_edges(edges)
¶
Checks that the quantum element of every edge has a flux line.
The experiments drive the flux line of the element on the edge, so any element
that has one works, not only a TunableCoupler.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
edges
|
list[TopologyEdge]
|
The edges to check. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If an edge has no quantum element, or its quantum element has no flux signal. |
validate_length_qubits_sweeps(qubits, sweep_points=None)
¶
Validate the length of the qubits and sweep points.
Deprecated in version 26.10.0
Use laboneq_applications.conversion.sweeps_per_quantum_element instead.
Checks the following conditions:
qubitsmust be aQuantumElementor a sequence ofQuantumElement.- If a single qubit is passed, the sweep points must be a list or array of numbers.
- The qubits and sweep points must have the same length.
- All elements of the sweep points must be lists of numbers or arrays.
If the conditions are met, returns the qubits and sweep points.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qubits
|
QuantumElement | Sequence[QuantumElement]
|
Either a single |
required |
sweep_points
|
Sequence[float] | Sequence[Sequence[float] | ndarray] | ndarray | None
|
The sweep points for each qubit. If |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Sequence[QuantumElement], Sequence[Sequence[float] | ndarray] | ndarray] | Sequence[QuantumElement]
|
A tuple containing the validated qubits and sweep points or only the validated qubits if sweep_points is None. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the conditions are not met. |
validate_parallel_two_qubit_experiment(qpu, qubit_pair_uids)
¶
Checks that an experiment can be run in parallel on the qubit pairs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qpu
|
QPU
|
The QPU where the topology is stored. |
required |
qubit_pair_uids
|
list[list[str]]
|
The pairs of UIDs for the qubits that will be used as source and target node from the edge. |
required |
Returns:
| Type | Description |
|---|---|
list[QuantumElement]
|
The flat list of qubit objects corresponding to |
Raises:
| Type | Description |
|---|---|
ValueError
|
If a qubit is passed more than once in the full list. (One cannot act on them in parallel.) |
validate_result(result)
¶
Checks that result is an instance of RunExperimentResults.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
RunExperimentResults
|
the acquired results |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If result is not an instance of RunExperimentResults. |