Skip to content

laboneq_applications.tasks.evaluation

This module defines the task for updating setup parameters.

evaluate_parameter_and_fit_r2_thresholds(old_parameter_values, new_parameter_values, fit_data, quantum_elements, *, parameter, default_parameter_threshold, default_fit_r2_threshold, evaluation_parameters=None)

Evaluates the parameter and fit r2 thresholds.

We evaluate the analysis workflow results for a generic experiment. We output the evaluation flags, which is a dictionary of the form:

{"q0": {"success": False, "update": False}, ...}

For each quantum element:

If the r2 value of the fit is above the r2_threshold, then the success flag is set to True.

If the change in one of the new_parameter_values relative to the old_parameter_values is above a threshold, then the update flag is set to True.

If both the success and update flags are True, then the QPU will be updated.

Warning

This evaluation task is not compatible with all experiment workflows. This task requires an evaluation parameter of type float and fit data that contains an r2 value at the location fit_data[q].rsquared.

Note

In this evaluation task, we check only the r2 value of the fit to determine whether a generic experiment is successful, and we check only the change in one qubit parameter to determine whether the qubit update is significant. In practice, many other indictors can be used. We encourage the user to write their own experiment evaluation task to match their criteria for success and updates.

Parameters:

Name Type Description Default
old_parameter_values dict[str, Any]

The old parameter values.

required
new_parameter_values dict[str, Any]

The new parameter values.

required
fit_data dict[str, ModelResult]

The fit data.

required
quantum_elements QuantumElements

The quantum elements to run the experiments on.

required
parameter str

The name of the parameter for which to evaluate the difference.

required
default_parameter_threshold float

The default parameter threshold. If the change in the parameter value is above this threshold, then update is set to True.

required
default_fit_r2_threshold float

The default r2 threshold. If the r2 value of the fit is above this threshold, then success is set to True.

required
evaluation_parameters dict[str, dict[str, float]] | None

The evaluation parameters. The expected dictionary keys are "parameter_thresholds" and "fit_r2_thresholds". The "parameter_thresholds" is the dictionary of thresholds for the parameter differences, keyed by quantum element UID. The "fit_r2_thresholds" is the dictionary of thresholds for the r2 values of the fits, keyed by quantum element UID.

None

Returns:

Type Description
dict[str, dict[str, bool]]

The dictionary of evaluation flags. The keys are the quantum element 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 parameter value updates are significant. If both the success and update flags are True, then the quantum element in the QPU will be updated.