qblox_scheduler.experiments.parameters#

Module containing the step to a set a parameter.

Exceptions#

UndefinedParameterError

Raised when a parameter was not previously defined.

Classes#

SetParameter

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

SetHardwareOption

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

SetHardwareDescriptionField

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

Functions#

_resolve_path(→ tuple[pydantic.BaseModel | dict, ...)

_path_to_dict(→ dict[str | int, Any])

_set_value_checked(→ None)

Module Contents#

exception UndefinedParameterError(operation_name: str, parameter_type: str)[source]#

Bases: LookupError

Raised when a parameter was not previously defined.

_resolve_path(target: pydantic.BaseModel | dict, path: list[str | int], value: Any) tuple[pydantic.BaseModel | dict, str | int, Any][source]#
_path_to_dict(target: str | int, path: list[str | int], value: Any) dict[str | int, Any][source]#
_set_value_checked(target: pydantic.BaseModel | dict, key: Any, value: Any, create_new: bool) None[source]#
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[source]#

Element to set QCoDeS parameter on.

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

QCoDeS parameter name to set.

property value: Any[source]#

QCoDeS parameter value to set.

property create_new: bool[source]#

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 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[source]#

Port/clock combination to set option for.

property option: list[str | int][source]#

Option name to set.

property value: Any[source]#

Option value to set.

property create_new: bool[source]#

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 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[source]#

Instrument to set field for.

property field: list[str | int][source]#

Field path to set.

property value: Any[source]#

Field value to set.

property create_new: bool[source]#

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.