qblox_scheduler.experiments#

Submodules#

Classes#

Experiment

An experiment.

Step

A step containing a single (possibly) near-time operation to be performed in an experiment.

Loop

Experiment step that loops other steps over some values.

SetHardwareDescriptionField

Experiment step that sets a hardware description parameter for a given instrument.

SetHardwareOption

Experiment step that sets a hardware option for a given port/clock.

SetParameter

Experiment step that sets a QCoDeS parameter, or device element parameter.

ExecuteSchedule

Experiment step that runs a schedule.

Package Contents#

class Experiment(name: str, data: dict[str, Any] | None = None)[source]#

Bases: qblox_scheduler.json_utils.JSONSchemaValMixin, qblox_scheduler.json_utils.JSONSerializable, collections.UserDict

An experiment.

schema_filename = 'experiment.json'#
property name: str#

Return the name of the experiment.

property steps: list[Step]#

Return the steps in the experiment.

declare(dtype: qblox_scheduler.operations.expressions.DType) qblox_scheduler.operations.variables.Variable[source]#

Declare a variable.

Parameters:

dtype – The variable type.

define(var: qblox_scheduler.operations.variables.Variable) None[source]#

Add a declared variable.

Parameters:

var – The variable.

add(step: Step) None[source]#

Add step to experiment.

run(device: qblox_scheduler.device_under_test.QuantumDevice, timeout: int = 10) xarray.Dataset[source]#

Run experiment on quantum device.

clone() Experiment[source]#

Clone this schedule into a separate independent experiment.

substitute(substitutions: dict[qblox_scheduler.operations.expressions.Expression, qblox_scheduler.operations.expressions.Expression | int | float | complex]) Experiment[source]#

Substitute matching expressions in this experiment.

class Step(name: str)[source]#

Bases: qblox_scheduler.json_utils.JSONSchemaValMixin, collections.UserDict, abc.ABC

A step containing a single (possibly) near-time operation to be performed in an experiment.

An Experiment consists of steps, each of which performs a specific operation (usually on hardware). There is no real-time guarantee between steps, as opposed to Operation.

schema_filename = 'step.json'#
_class_signature = None#
_update() None[source]#

Update the Step’s internals.

clone() Step[source]#

Clone this operation into a new independent operation.

substitute(substitutions: dict[qblox_scheduler.operations.expressions.Expression, qblox_scheduler.operations.expressions.Expression | int | float | complex]) Step[source]#

Substitute matching expressions in operand, possibly evaluating a result.

property name: str#

Return the name of the step.

classmethod _get_signature(parameters: dict) str[source]#

Returns the constructor call signature of this instance for serialization.

The string constructor representation can be used to recreate the object using eval(signature).

Parameters:

parameters (dict) – The current data dictionary.

Returns:

:

abstract run(device: qblox_scheduler.device_under_test.QuantumDevice, timeout: int) xarray.Dataset | None[source]#

Execute step on quantum device.

class Loop(domains: dict[qblox_scheduler.operations.variables.Variable, qblox_scheduler.operations.loop_domains.LinearDomain], steps: list[qblox_scheduler.experiments.experiment.Step])[source]#

Bases: qblox_scheduler.experiments.experiment.Step

Experiment step that loops other steps over some values.

property domains: dict[qblox_scheduler.operations.variables.Variable, qblox_scheduler.operations.loop_domains.LinearDomain]#

Domains to loop over.

property steps: list[qblox_scheduler.experiments.experiment.Step]#

Steps to execute.

run(device: qblox_scheduler.device_under_test.QuantumDevice, timeout: int = 10) xarray.Dataset | None[source]#

Execute step on quantum device.

class SetHardwareDescriptionField(name: str | int | tuple[str | int, Ellipsis], value: Any, instrument: str, create_new: bool = False)[source]#

Bases: qblox_scheduler.experiments.experiment.Step

Experiment step that sets a hardware description parameter for a given instrument.

Example

schedule = Schedule("test")
# corresponds to:
#   hardware_config = device.generate_hardware_compilation_config()
#   cluster0_description = hardware_config.hardware_description["cluster0"]
#   cluster0_description.modules[2].rf_output_on = False
schedule.add(
    SetHardwareDescriptionField(("modules", 2, "rf_output_on"), False, instrument="cluster0")
)
schedule.add(Measure("q0"))
Parameters:
  • name

    one of:

    • a str, corresponding to a hardware option on the port/clock.

    • a tuple of str, corresponding to a nested hardware option on the port/clock

  • value – Value to set the parameter to.

  • instrument – Instrument to set the parameter for.

  • create_new – If True, create a new entry in the hardware configuration if no entry exists for this port-clock and hardware option. Otherwise, raise an error if the entry does not exist. Optional, by default False.

property instrument: str#

Instrument to set field for.

property field: list[str | int]#

Field path to set.

property value: Any#

Field value to set.

property create_new: bool#

Whether to create a new configuration field if it did not previously exist.

run(device: qblox_scheduler.device_under_test.QuantumDevice, timeout: int = 10) None[source]#

Execute step on quantum device.

class SetHardwareOption(name: str | int | tuple[str | int, Ellipsis], value: Any, port: str, create_new: bool = False)[source]#

Bases: qblox_scheduler.experiments.experiment.Step

Experiment step that sets a hardware option for a given port/clock.

Example

schedule = Schedule("resonator flux spectroscopy")
with schedule.loop(linspace(36e6, 38e6, 300, DType.FREQUENCY)) as lo_freq:
    # corresponds to:
    #   hardware_config = device.generate_hardware_compilation_config()
    #   hardware_options = hardware_config.hardware_options
    #   hardware_options.modulation_frequencies["q0:mw-q0.f_larmor"].lo_freq = lo_freq
    schedule.add(
        SetHardwareOption(("modulation_frequencies", "lo_freq"), lo_freq, port="q0:mw-q0.f_larmor")
    )
    schedule.add(Measure("q0"))
Parameters:
  • name

    One of:

    • a str, corresponding to a hardware option on the port/clock.

    • a tuple of str, corresponding to a nested hardware option on the port/clock

  • value – Value to set the option to.

  • port – Port/clock combination to set the option for.

  • create_new – If True, create a new entry in the hardware configuration if no entry exists for this port-clock and hardware option. Otherwise, raise an error if the entry does not exist. Optional, by default False.

property port: str#

Port/clock combination to set option for.

property option: list[str | int]#

Option name to set.

property value: Any#

Option value to set.

property create_new: bool#

Whether to create a new configuration field if it did not previously exist.

run(device: qblox_scheduler.device_under_test.QuantumDevice, timeout: int = 10) None[source]#

Execute step on quantum device.

class SetParameter(name: qcodes.parameters.Parameter | str | int | tuple[str | int, Ellipsis], value: Any, element: str | None = None, create_new: bool = False)[source]#

Bases: qblox_scheduler.experiments.experiment.Step

Experiment step that sets a QCoDeS parameter, or device element parameter.

Examples

Set a QCoDeS parameter:

dc_offset = agent.get_clusters()["cluster0"].module4.out0_offset

schedule = Schedule("resonator flux spectroscopy")
with schedule.loop(linspace(0, 0.5, 30, DType.NUMBER)) as offset:
    schedule.add(SetParameter(dc_offset, offset))
    with schedule.loop(linspace(360e6, 380e6, 300, DType.FREQUENCY)) as freq:
        schedule.add(Reset("q0"))
        schedule.add(
            Measure("q0", freq=freq, coords={"frequency": freq, "dc_offset": offset})
        )
        schedule.add(IdlePulse(4e-9))

Set a device element parameter:

schedule = Schedule("hello")
with schedule.loop(linspace(0, 0.5, 3, DType.AMPLITUDE)) as amp:
    # corresponds to q0.measure.pulse_amp = amp
    schedule.add(SetParameter(("measure", "pulse_amp"), amp, element="q0"))
    schedule.add(Reset("q0"))
    schedule.add(
        Measure("q0", coords={"frequency": freq, "pulse_amp": amp})
    )
Parameters:
  • name

    One of:

    • QCoDeS parameter

    • a str, corresponding to a parameter on the quantum device.

    • a tuple of str, corresponding to a nested parameter on the quantum device or device element or edge.

  • value – Value to set the parameter to.

  • element – Optional. If provided, the parameter is set on the device element with the given name.

  • create_new – If True, create a new entry in the device configuration if no entry exists for this port-clock and hardware option. Otherwise, raise an error if the entry does not exist. Optional, by default False.

property element: str | None#

Element to set QCoDeS parameter on.

property parameter: list[str | int] | qcodes.parameters.Parameter#

QCoDeS parameter name to set.

property value: Any#

QCoDeS parameter value to set.

property create_new: bool#

Whether to create a new parameter if it did not previously exist.

run(device: qblox_scheduler.device_under_test.QuantumDevice, timeout: int = 10) None[source]#

Execute step on quantum device.

class ExecuteSchedule(schedule: qblox_scheduler.schedules.schedule.TimeableScheduleBase)[source]#

Bases: qblox_scheduler.experiments.experiment.Step

Experiment step that runs a schedule.

property schedule: qblox_scheduler.schedules.schedule.TimeableScheduleBase#

The schedule to run.

run(device: qblox_scheduler.device_under_test.QuantumDevice, timeout: int = 10) xarray.Dataset[source]#

Run a schedule on the quantum device.