qblox_scheduler#

Import alias

Target

QuantumDevice

qblox_scheduler.QuantumDevice

TimeableSchedule

qblox_scheduler.TimeableSchedule

Resource

qblox_scheduler.Resource

ClockResource

qblox_scheduler.ClockResource

BasebandClockResource

qblox_scheduler.BasebandClockResource

DigitalClockResource

qblox_scheduler.DigitalClockResource

Operation

qblox_scheduler.Operation

structure

qblox_scheduler.structure

ScheduleGettable

qblox_scheduler.ScheduleGettable

BasicElectronicNVElement

qblox_scheduler.BasicElectronicNVElement

BasicSpinElement

qblox_scheduler.BasicSpinElement

BasicTransmonElement

qblox_scheduler.BasicTransmonElement

CompositeSquareEdge

qblox_scheduler.CompositeSquareEdge

InstrumentCoordinator

qblox_scheduler.InstrumentCoordinator

GenericInstrumentCoordinatorComponent

qblox_scheduler.GenericInstrumentCoordinatorComponent

SerialCompiler

qblox_scheduler.SerialCompiler

MockLocalOscillator

qblox_scheduler.MockLocalOscillator

SpinEdge

qblox_scheduler.SpinEdge

Submodules#

Classes#

HardwareAgent

Hardware definition of qblox backend.

SerialCompiler

A compiler that executes compilation passes sequentially.

BasicElectronicNVElement

A device element representing an electronic qubit in an NV center.

BasicSpinElement

A device element representing a Loss-DiVincenzo Spin qubit.

BasicTransmonElement

A device element representing a single fixed-frequency transmon qubit.

ChargeSensor

A device element representing a Charge Sensor connected to a tank circuit to perform

CompositeSquareEdge

An example Edge implementation which connects two BasicTransmonElements.

QuantumDevice

The QuantumDevice directly represents the device under test (DUT).

SpinEdge

Spin edge implementation which connects two BasicSpinElements.

Step

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

ScheduleGettable

Generic gettable for a quantify schedule using vector (I,Q) acquisition.

MockLocalOscillator

A class representing a dummy Local Oscillator.

InstrumentCoordinator

The InstrumentCoordinator serves as

GenericInstrumentCoordinatorComponent

A Generic class which can be used for interaction with the InstrumentCoordinator.

Operation

A representation of quantum circuit operations.

BasebandClockResource

Global identity for a virtual baseband clock.

ClockResource

The ClockResource corresponds to a physical clock used to modulate pulses.

DigitalClockResource

Global identity for a virtual digital clock.

Resource

A resource corresponds to a physical resource such as a port or a clock.

Schedule

High-level hybrid schedule.

TimeableSchedule

A modifiable schedule.

Package Contents#

class HardwareAgent(hardware_configuration: qblox_scheduler.backends.qblox_backend.QbloxHardwareCompilationConfig | dict | str | pathlib.Path, quantum_device_configuration: dict | str | pathlib.Path | qblox_scheduler.device_under_test.quantum_device.QuantumDevice | None = None, *, debug: qblox_instruments.types.DebugLevel = DebugLevel.MINIMAL_CHECK, output_dir: pathlib.Path | str | None = None)[source]#

Hardware definition of qblox backend. Contains definitions for the cluster, the hardware configuration, and related classes to manage the instruments.

Parameters:
  • hardware_configuration

    The hardware configuration. Either - a QbloxHardwareCompilationConfig instance - a dictionary as pydantic model of the QbloxHardwareCompilationConfig - a json file that stores the above dictionary

    The cluster fields in “hardware_description” will have its modules field autogenerated, based on its ip field when they are not defined. This ip field is mandatory.

  • quantum_device_configuration – The quantum device configuration. Either - a json dictionary of the QuantumDevice - a path to the file that stores the json dictionary

  • debug – Debug level of the cluster. By default, it is set to DebugLevel.MINIMAL_CHECK. Available debug levels are: - DebugLevel.MINIMAL_CHECK: Check compatibility between the hardware firmware version and qblox-instruments version, and check for errors when starting and stopping sequencers. - DebugLevel.ERROR_CHECK: Check for errors after every low-level cluster command. - DebugLevel.NO_CHECK: Do not check for errors. - DebugLevel.VERSION_AND_ERROR_CHECK: Combination of DebugLEVEL.MINIMAL_CHECK and DebugLevel.ERROR_CHECK.

  • default_output_dir – Default output directory where the data will be stored.

_ElementType#
_num_instances_initiated = 0#
_hardware_configuration#
_clusters: dict[str, qblox_scheduler.instrument_coordinator.components.qblox.ClusterComponent]#
_instrument_coordinator#
_measurement_control#
_debug#
_latest_compiled_schedule: qblox_scheduler.schedules.schedule.CompiledSchedule | None = None#
property hardware_configuration: qblox_scheduler.backends.qblox_backend.QbloxHardwareCompilationConfig#

The (validated) hardware configuration of this hardware. Only available after the connections with the clusters have been established using connect_clusters if initially given as a file/dictionary. Note that this is not in json/dictionary format.

add_device_elements(device_elements: collections.abc.Sequence[qblox_scheduler.device_under_test.device_element.DeviceElement]) None[source]#

Add multiple device elements to the quantum device.

Parameters:

device_elements – list of device elements to be added

add_edges(edges: list[qblox_scheduler.device_under_test.edge.Edge]) None[source]#

Add multiple edges to the quantum device.

Parameters:

edges – list of edges to be added

connect_clusters() None[source]#

Connect the defined clusters to the hardware given their identifiers.

Will also supplement the modules to the given hardware description and/or verify them.

property quantum_device: qblox_scheduler.device_under_test.quantum_device.QuantumDevice#

The quantum device active in this hardware.

The quantum device contains the device elements and how the connectivity between them is defined.

property instrument_coordinator: qblox_scheduler.instrument_coordinator.instrument_coordinator.InstrumentCoordinator#

The instrument coordinator active in this hardware.

The instrument coordinator is responsible for executing the (compiled) schedule on the instruments in this backend.

property measurement_control: quantify_core.measurement.control.MeasurementControl#

The instrument coordinator active in this hardware.

The instrument coordinator is responsible for executing the (compiled) schedule on the instruments in this backend.

get_clusters() dict[str, qblox_instruments.Cluster][source]#

Get all the instantiated clusters.

Returns:

A dictionary mapping cluster names to Cluster objects.

property latest_compiled_schedule: qblox_scheduler.schedules.schedule.CompiledSchedule | None#

Get the latest compiled schedule, if one exists.

run(schedule: qblox_scheduler.schedule.Schedule | qblox_scheduler.schedules.schedule.TimeableSchedule | qblox_scheduler.schedules.schedule.CompiledSchedule, *, timeout: int = 10, save_to_experiment: bool = True, save_snapshot: bool = True) xarray.Dataset[source]#

Run a schedule on the hardware.

Parameters:
  • schedule – The schedule to run.

  • timeout – The timeout for retrieving the results, in seconds

  • save_to_experiment – Whether to save the dataset to an experiment directory. The dataset and (optionally) snapshot will be saved in <datadir>/<tuid>/dataset.hdf5 and <datadir>/<tuid>/snapshot.json, where datadir is specified by set_datadir() and get_datadir()

  • save_snapshot – Whether to save a snapshot of the experiment

Returns:

Acquisition result dataset if any acquisitions are used in the schedule. Empty dataset otherwise.

Raises:

TimeoutError – When hardware doesn’t return results in the given timeout.

compile(schedule: qblox_scheduler.schedules.schedule.TimeableSchedule) qblox_scheduler.schedules.schedule.CompiledSchedule[source]#

Compile the schedule to the hardware. Compilation is already done in the run method, so run this method only if the compiled schedule requires to be investigated.

Parameters:

schedule – The TimeableSchedule to compile for this hardware

Returns:

The compiled schedule

static set_output_data_dir(datadir: pathlib.Path | str | None = None) None[source]#

Sets the output data directory.

Parameters:

datadir – Path of the data directory. If set to None, resets the datadir to the default datadir (<top_level>/data).

_verify_hardware_configuration() None[source]#

Verifies if the given hardware configuration can be run on the cluster.

Raises:
  • TypeError – When the hardware_configuration has not been correctly initialized yet.

  • ValueError – When the hardware configuration does not match the modules installed on the cluster.

_create_cluster(cluster_name: str, cluster_description: dict | qblox_scheduler.backends.types.qblox.ClusterDescription) qblox_instruments.Cluster[source]#
_create_dummy_cluster(cluster_name: str, cluster_description: dict | qblox_scheduler.backends.types.qblox.ClusterDescription) qblox_instruments.Cluster[source]#
class SerialCompiler(name: str = 'compiler', quantum_device: qblox_scheduler.device_under_test.quantum_device.QuantumDevice | None = None)[source]#

Bases: ScheduleCompiler

A compiler that executes compilation passes sequentially.

construct_graph(config: SerialCompilationConfig) None[source]#

Construct the compilation graph based on a provided config.

For a serial backend, it is just a list of compilation passes.

_compilation_func(schedule: qblox_scheduler.schedules.schedule.TimeableSchedule, config: SerialCompilationConfig) qblox_scheduler.schedules.schedule.CompiledSchedule[source]#

Compile a schedule using the backend and the information provided in the config.

Parameters:
  • schedule – The schedule to compile.

  • config – A dictionary containing the information needed to compile the schedule. Nodes in this compiler specify what key they need information from in this dictionary.

class BasicElectronicNVElement(/, name, **data: Any)[source]#

Bases: qblox_scheduler.device_under_test.device_element.DeviceElement

A device element representing an electronic qubit in an NV center.

The submodules contain the necessary device element parameters to translate higher-level operations into pulses. Please see the documentation of these classes.

Examples

Qubit parameters can be set through submodule attributes

from qblox_scheduler import BasicElectronicNVElement

device_element = BasicElectronicNVElement("q2")

device_element.rxy.amp180 = 0.1
device_element.measure.pulse_amplitude = 0.25
device_element.measure.pulse_duration = 300e-9
device_element.measure.acq_delay = 430e-9
device_element.measure.acq_duration = 1e-6
...
Ellipsis
element_type: Literal['BasicElectronicNVElement'] = 'BasicElectronicNVElement'#
spectroscopy_operation: SpectroscopyOperationNV#
ports: Ports#
clock_freqs: ClockFrequencies#
reset: ResetSpinpump#
charge_reset: ChargeReset#
measure: Measure#
pulse_compensation: qblox_scheduler.device_under_test.transmon_element.PulseCompensationModule#
cr_count: CRCount#
rxy: RxyNV#
_generate_config() dict[str, dict[str, qblox_scheduler.backends.graph_compilation.OperationCompilationConfig]][source]#

Generate part of the device configuration specific to a single qubit.

This method is intended to be used when this object is part of a device object containing multiple elements.

generate_device_config() qblox_scheduler.backends.graph_compilation.DeviceCompilationConfig[source]#

Generate a valid device config for the qblox-scheduler.

This makes use of the compile_circuit_to_device_with_config_validation() function.

This enables the settings of this qubit to be used in isolation.

class BasicSpinElement(/, name, **data: Any)[source]#

Bases: qblox_scheduler.device_under_test.device_element.DeviceElement

A device element representing a Loss-DiVincenzo Spin qubit. The element refers to the intrinsic spin-1/2 degree of freedom of individual electrons/holes trapped in quantum dots. The charge of the particle is coupled to a resonator.

Examples

Qubit parameters can be set through submodule attributes

from qblox_scheduler import BasicSpinElement

device_element = BasicSpinElement("q1")

device_element.rxy.amp180 = 0.1
device_element.measure.pulse_amp = 0.25
device_element.measure.pulse_duration = 300e-9
device_element.measure.acq_delay = 430e-9
device_element.measure.integration_time = 1e-6
...
Ellipsis
Parameters:
  • name – The name of the spin element.

  • kwargs – Can be used to pass submodule initialization data by using submodule name as keyword and as argument a dictionary containing the submodule parameter names and their value.

element_type: Literal['BasicSpinElement'] = 'BasicSpinElement'#
reset: qblox_scheduler.device_under_test.transmon_element.IdlingReset#
rxy: RxyGaussian#
measure: DispersiveMeasurementSpin#
pulse_compensation: qblox_scheduler.device_under_test.transmon_element.PulseCompensationModule#
ports: PortsSpin#
clock_freqs: ClocksFrequenciesSpin#
_generate_config() dict[str, dict[str, qblox_scheduler.backends.graph_compilation.OperationCompilationConfig]][source]#

Generate part of the device configuration specific to a single qubit trapped in a quantum dot. A resonator to perform dispersive readout is attached to the gate to perform charge sensing.

This method is intended to be used when this object is part of a device object containing multiple elements.

generate_device_config() qblox_scheduler.backends.graph_compilation.DeviceCompilationConfig[source]#

Generate a valid device config.

The config will be used for the qblox-scheduler making use of the compile_circuit_to_device_with_config_validation() function.

This enables the settings of this qubit to be used in isolation.

class BasicTransmonElement(/, name, **data: Any)[source]#

Bases: qblox_scheduler.device_under_test.device_element.DeviceElement

A device element representing a single fixed-frequency transmon qubit.

The qubit is coupled to a readout resonator.

Examples

Qubit parameters can be set through submodule attributes

from qblox_scheduler import BasicTransmonElement

device_element = BasicTransmonElement("q3")

device_element.rxy.amp180 = 0.1
device_element.measure.pulse_amp = 0.25
device_element.measure.pulse_duration = 300e-9
device_element.measure.acq_delay = 430e-9
device_element.measure.integration_time = 1e-6
...
Ellipsis
Parameters:
  • name – The name of the transmon element.

  • kwargs – Can be used to pass submodule initialization data by using submodule name as keyword and as argument a dictionary containing the submodule parameter names and their value.

element_type: Literal['BasicTransmonElement'] = 'BasicTransmonElement'#
reset: IdlingReset#
rxy: RxyDRAG#
measure: DispersiveMeasurement#
pulse_compensation: PulseCompensationModule#
ports: Ports#
clock_freqs: ClocksFrequencies#
_generate_config() dict[str, dict[str, qblox_scheduler.backends.graph_compilation.OperationCompilationConfig]][source]#

Generate part of the device configuration specific to a single qubit.

This method is intended to be used when this object is part of a device object containing multiple elements.

generate_device_config() qblox_scheduler.backends.graph_compilation.DeviceCompilationConfig[source]#

Generate a valid device config.

The config will be used for the qblox-scheduler making use of the compile_circuit_to_device_with_config_validation() function.

This enables the settings of this device element to be used in isolation.

class ChargeSensor(/, name, **data: Any)[source]#

Bases: qblox_scheduler.device_under_test.device_element.DeviceElement

A device element representing a Charge Sensor connected to a tank circuit to perform dispersive readout.

Examples

Sensor parameters can be set through submodule attributes

from qblox_scheduler import ChargeSensor

sensor = ChargeSensor("s1")

sensor.measure.pulse_amp = 0.25
sensor.measure.pulse_duration = 300e-9
sensor.measure.acq_delay = 430e-9
sensor.measure.integration_time = 1e-6
...
Ellipsis
Parameters:
  • name – The name of the spin element.

  • kwargs – Can be used to pass submodule initialization data by using submodule name as keyword and as argument a dictionary containing the submodule parameter names and their value.

element_type: Literal['ChargeSensor'] = 'ChargeSensor'#
measure: DispersiveMeasurementSpin#
pulse_compensation: qblox_scheduler.device_under_test.transmon_element.PulseCompensationModule#
ports: PortsChargeSensor#
clock_freqs: ClocksFrequenciesSensor#
_generate_config() dict[str, dict[str, qblox_scheduler.backends.graph_compilation.OperationCompilationConfig]][source]#

Generate part of the device configuration specific to a single qubit.

This method is intended to be used when this object is part of a device object containing multiple elements.

generate_device_config() qblox_scheduler.backends.graph_compilation.DeviceCompilationConfig[source]#

Generate a valid device config.

The config will be used for the qblox-scheduler making use of the compile_circuit_to_device_with_config_validation() function.

This enables the settings of this qubit to be used in isolation.

class CompositeSquareEdge(parent_element: qblox_scheduler.device_under_test.device_element.DeviceElement | str | None = None, child_element: qblox_scheduler.device_under_test.device_element.DeviceElement | str | None = None, **data: Any)[source]#

Bases: qblox_scheduler.device_under_test.edge.Edge

An example Edge implementation which connects two BasicTransmonElements.

This edge implements a square flux pulse and two virtual z phase corrections for the CZ operation between the two BasicTransmonElements.

edge_type: Literal['CompositeSquareEdge'] = 'CompositeSquareEdge'#
_parent_device_element: qblox_scheduler.device_under_test.transmon_element.BasicTransmonElement | None = None#
_child_device_element: qblox_scheduler.device_under_test.transmon_element.BasicTransmonElement | None = None#
cz: CZ#
generate_edge_config() dict[str, dict[str, qblox_scheduler.backends.graph_compilation.OperationCompilationConfig]][source]#

Generate valid device config.

Fills in the edges information to produce a valid device config for the qblox-scheduler making use of the compile_circuit_to_device_with_config_validation() function.

class QuantumDevice(/, name, **data: Any)[source]#

Bases: qblox_scheduler.structure.model.SchedulerBaseModel

The QuantumDevice directly represents the device under test (DUT).

This contains a description of the connectivity to the control hardware as well as parameters specifying quantities like cross talk, attenuation and calibrated cable-delays. The QuantumDevice also contains references to individual DeviceElements, representations of elements on a device (e.g, a transmon qubit) containing the (calibrated) control-pulse parameters.

This object can be used to generate configuration files for the compilation step from the gate-level to the pulse level description. These configuration files should be compatible with the compile() function.

model_config#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

elements: dict[str, ConcreteDeviceElement] = None#
edges: dict[str, ConcreteEdge] = None#
instr_instrument_coordinator: qblox_scheduler.instrument_coordinator.InstrumentCoordinator | None = None#
cfg_sched_repetitions: pydantic.PositiveInt = None#
keep_original_schedule: bool = None#
hardware_config: qblox_scheduler.backends.types.common.HardwareCompilationConfig | dict | None = None#
scheduling_strategy: qblox_scheduler.enums.SchedulingStrategy = None#
classmethod validate_instrument_coordinator(value: str | qblox_scheduler.instrument_coordinator.InstrumentCoordinator | None) qcodes.instrument.Instrument | None[source]#

Load InstrumentCoordinator instance from its name.

Pydantic doesn’t know how to handle a QCoDeS instrument; thus, we have to allow arbitrary types and manually fetch them with find_or_create_instrument.

classmethod validate_scheduling_strategy(value: str | qblox_scheduler.enums.SchedulingStrategy) qblox_scheduler.enums.SchedulingStrategy[source]#

Force scheduling_strategy into its proper enum value.

classmethod validate_elements_and_edges(data: Any, handler: pydantic.ModelWrapValidatorHandler[typing_extensions.Self]) typing_extensions.Self[source]#

Add elements and edges to the model by calling add_element and add_edge respectively to force our consistency checks.

generate_compilation_config() qblox_scheduler.backends.graph_compilation.SerialCompilationConfig[source]#

Generate a config for use with a ScheduleCompiler.

generate_hardware_config() dict[str, Any][source]#

Generate a valid hardware configuration describing the quantum device.

Returns:

The hardware configuration file used for compiling from the quantum-device layer to a hardware backend.

generate_device_config() qblox_scheduler.backends.graph_compilation.DeviceCompilationConfig[source]#

Generate a device config.

This config is used to compile from the quantum-circuit to the quantum-device layer.

generate_hardware_compilation_config() qblox_scheduler.backends.types.common.HardwareCompilationConfig | None[source]#

Generate a hardware compilation config.

The compilation config is used to compile from the quantum-device to the control-hardware layer.

get_element(name: str) qblox_scheduler.device_under_test.device_element.DeviceElement[source]#

Return a DeviceElement by name.

Parameters:

name – The element name.

Returns:

: The element.

Raises:

KeyError – If key name is not present in self.elements.

add_element(element: qblox_scheduler.device_under_test.device_element.DeviceElement) None[source]#

Add an element to the elements collection.

Parameters:

element – The element to add.

Raises:
  • ValueError – If an element with a duplicated name is added to the collection.

  • TypeError – If element is not an instance of the base element.

remove_element(name: str) None[source]#

Removes an element by name.

Parameters:

name – The element name. Has to follow the convention "{element_0}_{element_1}".

get_edge(name: str) qblox_scheduler.device_under_test.edge.Edge[source]#

Returns an edge by name.

Parameters:

name – The edge name. Has to follow the convention "{element_0}_{element_1}".

Returns:

: The edge.

Raises:

KeyError – If key name is not present in self.edges.

add_edge(edge: qblox_scheduler.device_under_test.edge.Edge) None[source]#

Add the edges.

Parameters:

edge – The edge to add.

remove_edge(name: str) None[source]#

Remove an edge by name.

Parameters:

name – The edge name connecting the elements. Has to follow the convention "{element_0}_{element_1}".

classmethod from_json_file(filename: str | pathlib.Path) typing_extensions.Self[source]#

Read JSON data from a file and convert it to an instance of the attached class.

class SpinEdge(parent_element: qblox_scheduler.device_under_test.device_element.DeviceElement | str | None = None, child_element: qblox_scheduler.device_under_test.device_element.DeviceElement | str | None = None, **data: Any)[source]#

Bases: qblox_scheduler.device_under_test.edge.Edge

Spin edge implementation which connects two BasicSpinElements.

This edge implements some operations between the two BasicSpinElements.

edge_type: Literal['SpinEdge'] = 'SpinEdge'#
_parent_device_element: qblox_scheduler.device_under_test.spin_element.BasicSpinElement | None = None#
_child_device_element: qblox_scheduler.device_under_test.spin_element.BasicSpinElement | None = None#
spin_init: SpinInit#
cz: CZ#
cnot: CNOT#
ports: PortSpinEdge#
generate_edge_config() dict[str, dict[str, qblox_scheduler.backends.graph_compilation.OperationCompilationConfig]][source]#

Generate valid device config.

Fills in the edges information to produce a valid device config for the qblox-scheduler making use of the compile_circuit_to_device_with_config_validation() function.

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 ScheduleGettable(quantum_device: qblox_scheduler.device_under_test.quantum_device.QuantumDevice, schedule_function: collections.abc.Callable[Ellipsis, qblox_scheduler.schedule.Schedule | qblox_scheduler.schedule.TimeableSchedule], schedule_kwargs: dict[str, Any], num_channels: int = 1, data_labels: list[str] | None = None, real_imag: bool = True, batched: bool = False, max_batch_size: int = 1024, always_initialize: bool = True, return_xarray: bool = False)[source]#

Generic gettable for a quantify schedule using vector (I,Q) acquisition.

The gettable evaluates the parameters passed as schedule_kwargs, then generates the qblox_scheduler.schedules.schedule.TimeableSchedule using the schedule_function, this is then compiled and finally executed by the InstrumentCoordinator.

ScheduleGettable can be set to return either static (demodulated) I and Q values or magnitude and phase.

Parameters:
  • quantum_device – The qcodes instrument representing the quantum device under test (DUT) containing quantum device properties and setup configuration information.

  • schedule_function – A function which returns a qblox_scheduler.schedule.Schedule or qblox_scheduler.schedules.schedule.TimeableSchedule. The function is required to have the repetitions keyword argument.

  • schedule_kwargs – The schedule function keyword arguments, when a value in this dictionary is a Parameter, this parameter will be evaluated every time .get() is called before being passed to the schedule_function.

  • num_channels – The number of channels to expect in the acquisition data.

  • data_labels – Allows to specify custom labels. Needs to be precisely 2*num_channels if specified. The order is [Voltage I 0, Voltage Q 0, Voltage I 1, Voltage Q 1, …], in case real_imag==True, otherwise [Magnitude 0, Phase 0, Magnitude 1, Phase 1, …].

  • real_imag – If true, the gettable returns I, Q values. Otherwise, magnitude and phase (degrees) are returned.

  • batched – Used to indicate if the experiment is performed in batches or in an iterative fashion.

  • max_batch_size – Determines the maximum number of points to acquire when acquiring in batched mode. Can be used to split up a program in parts if required due to hardware constraints.

  • always_initialize – If True, then reinitialize the schedule on each invocation of get. If False, then only initialize the first invocation of get.

_data_labels_specified#
always_initialize = True#
is_initialized = False#
_compiled_schedule: qblox_scheduler.schedules.schedule.CompiledSchedule | None = None#
real_imag = True#
batched = False#
batch_size = 1024#
_return_xarray = False#
schedule_function#
schedule_kwargs#
_evaluated_sched_kwargs#
quantum_device#
_backend = None#
_debug_mode: bool = False#
compile() qblox_scheduler.schedules.schedule.CompiledSchedule[source]#

Compile the schedule without preparing and running it. The returned compiled schedule can be used to plot the circuit or pulse diagrams for example.

Returns:

: The compiled schedule.

initialize() None[source]#

Generates the schedule and uploads the compiled instructions to the hardware using the instrument coordinator.

property compiled_schedule: qblox_scheduler.schedules.schedule.CompiledSchedule | None#

Get the latest compiled schedule, or None if nothing has been compiled yet.

get() tuple[numpy.ndarray, Ellipsis][source]#

Start the experimental sequence and retrieve acquisition data.

The data format returned is dependent on the type of acquisitions used in the schedule. These data formats can be found in the user guide.

Returns:

: A tuple of acquisition data per acquisition channel as specified above.

initialize_and_get_with_report() str[source]#

Create a report that saves all information from this experiment in a zipfile.

Run initialize() and get() and capture all information from the experiment in a zipfile in the quantify datadir. The basic information in the report includes the schedule, device config and hardware config. The method attempts to compile the schedule, and if it succeeds, it runs the experiment and adds the compiled schedule, a snapshot of the instruments, and logs from the actual hardware (only Qblox instruments supported currently) to the zipfile. A full error trace is also included if any of these steps fail.

Returns:

: A path to the generated report. Directory name includes a flag indicating at which state the experiment and report retrieval stopped.

Flags (defined in :func: ~._generate_diagnostics_report):

  • failed_initialization: The experiment failed during initialize().

  • failed_exp: The experiment initialized failed during get().

  • failed_connection_to_hw: The experiment initialized but both get() and retrieve_hardware_logs() failed. Connection to hardware was likely interrupted during runtime.

  • failed_hw_log_retrieval: The experiment succeeded but retrieve_hardware_logs() failed.

  • completed_exp: The experiment succeeded.

class MockLocalOscillator(name: str)[source]#

Bases: qcodes.instrument.instrument.Instrument

A class representing a dummy Local Oscillator.

Parameters:

name – QCoDeS name of the instrument.

_add_qcodes_parameters_dummy() None[source]#

Use to fake communications.

class InstrumentCoordinator(name: str, add_default_generic_icc: bool = True)[source]#

Bases: qcodes.instrument.instrument.Instrument

The InstrumentCoordinator serves as the central interface of the hardware abstraction layer.

It provides a standardized interface to execute Schedules on control hardware.

The InstrumentCoordinator has two main functionalities exposed to the user, the ability to configure its components representing physical instruments, and the ability to execute experiments.

Parameters:
  • name – The name for the instrument coordinator instance.

  • add_default_generic_icc – If True, automatically adds a GenericInstrumentCoordinatorComponent to this instrument coordinator with the default name.

components#
timeout#
_last_schedule = None#
_compiled_schedule = None#
property last_schedule: qblox_scheduler.schedules.schedule.CompiledSchedule#

Returns the last schedule used to prepare the instrument coordinator.

This feature is intended to aid users in debugging.

property is_running: bool#

Returns if any of the InstrumentCoordinator components is running.

Returns:

: The InstrumentCoordinator’s running state.

get_component(full_name: str) qblox_scheduler.instrument_coordinator.components.base.InstrumentCoordinatorComponentBase[source]#

Returns the InstrumentCoordinator component by name.

Parameters:

full_name – The component name.

Returns:

: The component.

Raises:

KeyError – If key name is not present in self.components.

add_component(component: qblox_scheduler.instrument_coordinator.components.base.InstrumentCoordinatorComponentBase) None[source]#

Adds a component to the components collection.

Parameters:

component – The component to add.

Raises:
  • ValueError – If a component with a duplicated name is added to the collection.

  • TypeError – If component is not an instance of the base component.

remove_component(name: str) None[source]#

Removes a component by name.

Parameters:

name – The component name.

prepare(compiled_schedule: qblox_scheduler.schedules.schedule.CompiledSchedule) None[source]#

Prepares each component for execution of a schedule.

It attempts to configure all instrument coordinator components for which compiled instructions, typically consisting of a combination of sequence programs, waveforms and other instrument settings, are available in the compiled schedule.

Parameters:

compiled_schedule – A schedule containing the information required to execute the program.

Raises:
  • KeyError – If the compiled schedule contains instructions for a component absent in the instrument coordinator.

  • TypeError – If the schedule provided is not a valid CompiledSchedule.

start() None[source]#

Start all of the components that appear in the compiled instructions.

The instruments will be started in the order in which they were added to the instrument coordinator.

stop(allow_failure: bool = False) None[source]#

Stops all components.

The components are stopped in the order in which they were added.

Parameters:

allow_failure – By default it is set to False. When set to True, the AttributeErrors raised by a component are demoted to warnings to allow other components to stop.

retrieve_acquisition() xarray.Dataset[source]#

Retrieves the latest acquisition results of the components with acquisition capabilities.

Returns:

: The acquisition data in an xarray.Dataset. For each acquisition channel it contains an xarray.DataArray.

wait_done(timeout_sec: int = 10) None[source]#

Awaits each component until it is done.

The timeout in seconds specifies the allowed amount of time to run before it times out.

Parameters:

timeout_sec – The maximum amount of time in seconds before a timeout.

retrieve_hardware_logs() dict[str, dict][source]#

Return the hardware logs of the instruments of each component.

The instruments must be referenced in the CompiledSchedule.

Returns:

: A nested dict containing the components hardware logs

class GenericInstrumentCoordinatorComponent(instrument_reference: str | qcodes.instrument.instrument_base.InstrumentBase = DEFAULT_NAME)[source]#

Bases: qblox_scheduler.instrument_coordinator.components.base.InstrumentCoordinatorComponentBase

A Generic class which can be used for interaction with the InstrumentCoordinator.

The GenericInstrumentCoordinatorComponent should be able to accept any type of qcodes instrument. The component is meant to serve as an interface for simple access to instruments such as the local oscillator, or current source which needs to only set parameters. For now this component is not being used in any of the hardware backends’ compilation step. This will be fixed in the next official release.

_no_gc_instances: ClassVar[dict[str, qcodes.instrument.instrument_base.InstrumentBase]]#
property is_running: bool#

A state whether an instrument is capable of running in a program.

Not to be confused with the on/off state of an instrument.

start() None[source]#

Start the instrument.

stop() None[source]#

Stop the instrument.

prepare(params_config: dict[str, Any]) None[source]#

Prepare the instrument.

params_config has keys which should correspond to parameter names of the instrument and the corresponding values to be set. Always ensure that the key to the params_config is in the format ‘instrument_name.parameter_name’ See example below.

params_config = {
                 "lo_mw_q0.frequency": 6e9,
                 "lo_mw_q0.power": 13, "lo_mw_q0.status": True,
                 "lo_ro_q0.frequency": 8.3e9, "lo_ro_q0.power": 16,
                 "lo_ro_q0.status": True,
                 "lo_spec_q0.status": False,
                }
_set_params_to_devices(params_config: dict) None[source]#

Set the parameters in the params_config dict to the generic devices set in the hardware_config.

The bool force_set_parameters is used to change the lazy_set behavior.

retrieve_acquisition() xarray.Dataset | None[source]#

Retrieve acquisition.

get_hardware_log(compiled_schedule: qblox_scheduler.schedules.schedule.CompiledSchedule) dict | None[source]#

Get the hardware log.

wait_done(timeout_sec: int = 10) None[source]#

Wait till done.

class Operation(name: str)[source]#

Bases: qblox_scheduler.json_utils.JSONSchemaValMixin, collections.UserDict

A representation of quantum circuit operations.

The Operation class is a JSON-compatible data structure that contains information on how to represent the operation on the quantum-circuit and/or the quantum-device layer. It also contains information on where the operation should be applied: the Resource s used.

An operation always has the following attributes:

  • duration (float): duration of the operation in seconds (can be 0).

  • hash (str): an auto generated unique identifier.

  • name (str): a readable identifier, does not have to be unique.

An Operation can contain information on several levels of abstraction. This information is used when different representations are required. Note that when initializing an operation not all of this information needs to be available as operations are typically modified during the compilation steps.

Tip

qblox_scheduler comes with a gate_library and a pulse_library , both containing common operations.

JSON schema of a valid Operation

qblox://operation

JSON schema for a qblox sequencer operation.

type

object

properties

  • name

type

string

  • gate_info

type

object

properties

  • unitary

A unitary matrix describing the operation.

  • operation_type

Defines what class of operations this gate refers to (e.g. Rxy, CZ etc.).

type

string

  • qubits

Deprecated. A list of strings indicating the qubits the gate acts on. Valid qubits are strings that appear in the device_config.json file.

type

array

  • device_elements

A list of strings indicating the device_elements the gate acts on. Valid device_elements are strings that appear in the device_config.json file.

type

array

  • symmetric

A boolean to indicate whether a two device elements is symmetric. This is used in the device config compilation stage. By default, it is set as False

type

boolean

  • tex

latex snippet for plotting

type

string

  • plot_func

reference to a function for plotting this operation. If not specified, defaults to using gate_box().

type

string / null

additionalProperties

True

  • pulse_info

A list containing the pulses that are part of the operation

type

array

items

Info to generate an individual pulse.

type

object

properties

  • port

A string specifying the port used by the pulse.

type

string / null

  • clock

A string specifying the clock used to modulate the pulse.

type

string

  • wf_func

reference to a function to generate the pulse of this operation.

type

string / null

  • t0

Starting time of the pulse with respect to the start of the operation in seconds.

type

number

  • duration

The duration of the pulse in seconds.

type

number

  • acquisition_info

A list containing the acquisitions that are part of the operation

type

array

items

Info to generate an individual acquisition.

type

object

properties

  • port

A string specifying the port used by the acquisition.

type

string

  • clock

A string specifying the clock used to demodulate the acquisition.

type

string

  • t0

Starting time of the pulse with respect to the start of the operation in seconds.

type

number

  • duration

The duration of the acquisition in seconds.

type

number

  • acq_channel

The acquisition channel to use.

type

number

  • acq_index

The acquisition index where to store the result of the acquisition protocol.

type

number / null

  • acq_return_type

Describes the return type of an acquisition performed using this protocol.

additionalProperties

True

  • logic_info

Not Implemented.

  • statement_info

type

object

properties

  • variable

type

object

  • assigned_value

type

object / number

  • drop_variable

type

boolean

  • port-clocks

type

array

additionalProperties

True

additionalProperties

False

Note

Two different Operations containing the same information generate the same hash and are considered identical.

schema_filename = 'operation.json'#
_class_signature = None#
_duration: float = 0#
_update() None[source]#

Update the Operation’s internals.

clone() Operation[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]) Operation[source]#

Substitute matching expressions in operand, possibly evaluating a result.

property name: str#

Return the name of the operation.

property duration: float#

Determine operation duration from pulse_info.

If the operation contains no pulse info, it is assumed to be ideal and have zero duration.

property hash: str#

A hash based on the contents of the Operation.

Needs to be a str for easy compatibility with json.

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:

:

add_gate_info(gate_operation: Operation) None[source]#

Updates self.data[‘gate_info’] with contents of gate_operation.

Parameters:

gate_operation – an operation containing gate_info.

add_device_representation(device_operation: Operation) None[source]#

Adds device-level representation details to the current operation.

Parameters:

device_operation – an operation containing the pulse_info and/or acquisition info describing how to represent the current operation at the quantum-device layer.

add_pulse(pulse_operation: Operation) None[source]#

Adds pulse_info of pulse_operation Operation to this Operation.

Parameters:

pulse_operation – an operation containing pulse_info.

add_acquisition(acquisition_operation: Operation) None[source]#

Adds acquisition_info of acquisition_operation Operation to this Operation.

Parameters:

acquisition_operation – an operation containing acquisition_info.

get_used_port_clocks() set[tuple[str, str]][source]#

Extracts which port-clock combinations are used in this operation.

Returns:

: All (port, clock) combinations this operation uses.

classmethod is_valid(object_to_be_validated: Operation) bool[source]#

Validates the object’s contents against the schema.

Additionally, checks if the hash property of the object evaluates correctly.

property valid_gate: bool#

An operation is a valid gate if it has gate-level representation details.

property valid_pulse: bool#

An operation is a valid pulse if it has pulse-level representation details.

property valid_acquisition: bool#

An operation is a valid acquisition if it has pulse-level acquisition representation details.

property is_conditional_acquisition: bool#

An operation is conditional if one of the following holds, self is an an acquisition with a feedback_trigger_label assigned to it.

property is_control_flow: bool#

Determine if operation is a control flow operation.

Returns:

bool Whether the operation is a control flow operation.

property has_voltage_offset: bool#

Checks if the operation contains information for a voltage offset.

class BasebandClockResource(name: str)[source]#

Bases: Resource

Global identity for a virtual baseband clock.

Baseband signals are assumed to be real-valued and will not be modulated.

Parameters:

name – the name of this clock

IDENTITY = 'cl0.baseband'#
data#
class ClockResource(name: str, freq: float, phase: float = 0)[source]#

Bases: Resource

The ClockResource corresponds to a physical clock used to modulate pulses.

Parameters:
  • name – the name of this clock

  • freq – the frequency of the clock in Hz

  • phase – the starting phase of the clock in deg

data#
class DigitalClockResource(name: str)[source]#

Bases: Resource

Global identity for a virtual digital clock.

Digital clocks can only be associated with digital channels.

Parameters:

name – the name of this clock

IDENTITY = 'digital'#
data#
class Resource(name: str)[source]#

Bases: collections.UserDict

A resource corresponds to a physical resource such as a port or a clock.

Parameters:

name – The resource name.

property name: str#

Returns the name of the Resource.

Returns:

:

property hash: str#

A hash based on the contents of the Operation.

class Schedule(name: str, repetitions: int = 1)[source]#

High-level hybrid schedule.

_experiments#
_resources = []#
_schedule_count = None#
_repetitions = 1#
_uses_timeable_repetitions = False#
_duration = None#
clone() Schedule[source]#

Clone this schedule into a separate independent schedule.

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

Substitute matching expressions of operations in this schedule.

property repetitions: int#

Returns the amount of times this schedule should be repeated.

property _experiment: qblox_scheduler.experiments.experiment.Experiment#

Returns the current experiment.

property name: str#

Returns the name of the schedule.

property _timeable_schedules: list[qblox_scheduler.schedules.schedule.TimeableSchedule]#

Returns a list of timeable schedules in this schedule.

property _last_timeable_schedule: qblox_scheduler.schedules.schedule.TimeableSchedule | None#

Returns the last timeable schedule in this schedule.

property _timeable_schedule: qblox_scheduler.schedules.schedule.TimeableScheduleBase | None#

Returns the single timeable schedule in this schedule, or None.

get_schedule_duration() float[source]#

Return total duration of all timeable schedules.

Returns:

schedule_duration : float Duration of current schedule

property duration: float | None#

Determine the cached duration of the schedule.

Will return None if get_schedule_duration() has not been called before.

property data: dict#

The dictionary data of a single contained timeable schedule.

property operations: dict[str, qblox_scheduler.operations.operation.Operation | qblox_scheduler.schedules.schedule.TimeableSchedule]#

A dictionary of all unique operations used in the schedule.

This specifies information on what operation to apply where.

The keys correspond to the hash and values are instances of qblox_scheduler.operations.operation.Operation.

property schedulables: dict[str, qblox_scheduler.schedules.schedule.Schedulable]#

Ordered dictionary of schedulables describing timing and order of operations.

A schedulable uses timing constraints to constrain the operation in time by specifying the time ("rel_time") between a reference operation and the added operation. The time can be specified with respect to a reference point ("ref_pt"') on the reference operation (:code:”ref_op”) and a reference point on the next added operation (:code:”ref_pt_new”’). A reference point can be either the “start”, “center”, or “end” of an operation. The reference operation ("ref_op") is specified using its label property.

Each item in the list represents a timing constraint and is a dictionary with the following keys:

['label', 'rel_time', 'ref_op', 'ref_pt_new', 'ref_pt', 'operation_id']

The label is used as a unique identifier that can be used as a reference for other operations, the operation_id refers to the hash of an operation in operations.

Note

timing constraints are not intended to be modified directly. Instead use the add()

plot_circuit_diagram(figsize: tuple[int, int] | None = None, ax: matplotlib.axes.Axes | None = None, plot_backend: Literal['mpl'] = 'mpl', timeable_schedule_index: int | None = None) tuple[matplotlib.figure.Figure | None, matplotlib.axes.Axes | list[matplotlib.axes.Axes]][source]#

Create a circuit diagram visualization of the schedule using the specified plotting backend.

The circuit diagram visualization depicts the schedule at the quantum circuit layer. Because qblox-scheduler uses a hybrid gate-pulse paradigm, operations for which no information is specified at the gate level are visualized using an icon (e.g., a stylized wavy pulse) depending on the information specified at the quantum device layer.

Alias of qblox_scheduler.schedules._visualization.circuit_diagram.circuit_diagram_matplotlib().

Parameters:
  • figsize – matplotlib figsize.

  • ax – Axis handle to use for plotting.

  • plot_backend – Plotting backend to use, currently only ‘mpl’ is supported

  • timeable_schedule_index – Index of timeable schedule in schedule to plot. If None (the default), will only plot if the schedule contains a single timeable schedule.

Returns:

fig

matplotlib figure object.

ax

matplotlib axis object.

Each gate, pulse, measurement, and any other operation are plotted in the order of execution, but no timing information is provided.

Example

from qblox_scheduler import Schedule
from qblox_scheduler.operations.gate_library import Reset, X90, CZ, Rxy, Measure

sched = Schedule(f"Bell experiment on q0-q1")

sched.add(Reset("q0", "q1"))
sched.add(X90("q0"))
sched.add(X90("q1"), ref_pt="start", rel_time=0)
sched.add(CZ(qC="q0", qT="q1"))
sched.add(Rxy(theta=45, phi=0, qubit="q0") )
sched.add(Measure("q0", acq_index=0))
sched.add(Measure("q1", acq_index=0), ref_pt="start")

sched.plot_circuit_diagram()
(<Figure size 1000x200 with 1 Axes>,
 <Axes: title={'center': 'Bell experiment on q0-q1 schedule 1'}>)
../../_images/index_4_1.png

Note

Gates that are started simultaneously on the same qubit will overlap.

from qblox_scheduler import Schedule
from qblox_scheduler.operations.gate_library import X90, Measure

sched = Schedule(f"overlapping gates")

sched.add(X90("q0"))
sched.add(Measure("q0"), ref_pt="start", rel_time=0)
sched.plot_circuit_diagram();
../../_images/index_5_0.png

Note

If the pulse’s port address was not found then the pulse will be plotted on the ‘other’ timeline.

plot_pulse_diagram(port_list: list[str] | None = None, sampling_rate: float = 1000000000.0, modulation: Literal['off', 'if', 'clock'] = 'off', modulation_if: float = 0.0, plot_backend: Literal['mpl', 'plotly'] = 'mpl', x_range: tuple[float, float] = (-np.inf, np.inf), combine_waveforms_on_same_port: bool = True, timeable_schedule_index: int | None = None, **backend_kwargs) tuple[matplotlib.figure.Figure, matplotlib.axes.Axes] | plotly.graph_objects.Figure[source]#

Create a visualization of all the pulses in a schedule using the specified plotting backend.

The pulse diagram visualizes the schedule at the quantum device layer. For this visualization to work, all operations need to have the information present (e.g., pulse info) to represent these on the quantum-circuit level and requires the absolute timing to have been determined. This information is typically added when the quantum-device level compilation is performed.

Alias of qblox_scheduler.schedules._visualization.pulse_diagram.pulse_diagram_matplotlib() and qblox_scheduler.schedules._visualization.pulse_diagram.pulse_diagram_plotly().

Parameters:
  • port_list – A list of ports to show. If None (default) the first 8 ports encountered in the sequence are used.

  • modulation – Determines if modulation is included in the visualization.

  • modulation_if – Modulation frequency used when modulation is set to “if”.

  • sampling_rate – The time resolution used to sample the schedule in Hz.

  • plot_backend – Plotting library to use, can either be ‘mpl’ or ‘plotly’.

  • x_range – The range of the x-axis that is plotted, given as a tuple (left limit, right limit). This can be used to reduce memory usage when plotting a small section of a long pulse sequence. By default (-np.inf, np.inf).

  • combine_waveforms_on_same_port – By default True. If True, combines all waveforms on the same port into one single waveform. The resulting waveform is the sum of all waveforms on that port (small inaccuracies may occur due to floating point approximation). If False, the waveforms are shown individually.

  • timeable_schedule_index – Index of timeable schedule in schedule to plot. If None (the default), will only plot if the schedule contains a single timeable schedule.

  • backend_kwargs – Keyword arguments to be passed on to the plotting backend. The arguments that can be used for either backend can be found in the documentation of qblox_scheduler.schedules._visualization.pulse_diagram.pulse_diagram_matplotlib() and qblox_scheduler.schedules._visualization.pulse_diagram.pulse_diagram_plotly().

Returns:

Union[tuple[Figure, Axes], plotly.graph_objects.Figure] the plot

Example

A simple plot with matplotlib can be created as follows:

from qblox_scheduler.backends.graph_compilation import SerialCompiler
from qblox_scheduler.device_under_test.quantum_device import QuantumDevice
from qblox_scheduler.operations.pulse_library import (
    DRAGPulse, SquarePulse, RampPulse, VoltageOffset,
)
from qblox_scheduler.resources import ClockResource

schedule = Schedule("Multiple waveforms")
schedule.add(DRAGPulse(amplitude=0.2, beta=0.2, phase=0, duration=4e-6, port="P", clock="C"))
schedule.add(RampPulse(amp=0.2, offset=0.0, duration=6e-6, port="P"))
schedule.add(SquarePulse(amp=0.1, duration=4e-6, port="Q"), ref_pt='start')
schedule.add_resource(ClockResource(name="C", freq=4e9))

quantum_device = QuantumDevice("quantum_device")
device_compiler = SerialCompiler("Device compiler", quantum_device)
compiled_schedule = device_compiler.compile(schedule)

_ = compiled_schedule.plot_pulse_diagram(sampling_rate=20e6)
../../_images/index_6_0.png

The backend can be changed to the plotly backend by specifying the plot_backend=plotly argument. With the plotly backend, pulse diagrams include a separate plot for each port/clock combination:

_ = compiled_schedule.plot_pulse_diagram(sampling_rate=20e6, plot_backend='plotly')

The same can be achieved in the default plot_backend (matplotlib) by passing the keyword argument multiple_subplots=True:

_ = compiled_schedule.plot_pulse_diagram(sampling_rate=20e6, multiple_subplots=True)
../../_images/index_8_0.png

By default, waveforms overlapping in time on the same port are shown separately:

schedule = Schedule("Overlapping waveforms")
schedule.add(VoltageOffset(offset_path_I=0.25, offset_path_Q=0.0, port="Q"))
schedule.add(SquarePulse(amp=0.1, duration=4e-6, port="Q"), rel_time=2e-6)
schedule.add(VoltageOffset(offset_path_I=0.0, offset_path_Q=0.0, port="Q"), ref_pt="start", rel_time=2e-6)

compiled_schedule = device_compiler.compile(schedule)

_ = compiled_schedule.plot_pulse_diagram(sampling_rate=20e6)
../../_images/index_9_0.png

This behaviour can be changed with the parameter combine_waveforms_on_same_port:

_ = compiled_schedule.plot_pulse_diagram(sampling_rate=20e6, combine_waveforms_on_same_port=True)
../../_images/index_10_0.png
property timing_table: pandas.io.formats.style.Styler#

A styled pandas dataframe containing the absolute timing of pulses and acquisitions in a schedule.

This table is constructed based on the abs_time key in the schedulables. This requires the timing to have been determined.

The table consists of the following columns:

  • operation: a repr of Operation corresponding to the pulse/acquisition.

  • waveform_op_id: an id corresponding to each pulse/acquisition inside an Operation.

  • port: the port the pulse/acquisition is to be played/acquired on.

  • clock: the clock used to (de)modulate the pulse/acquisition.

  • abs_time: the absolute time the pulse/acquisition is scheduled to start.

  • duration: the duration of the pulse/acquisition that is scheduled.

  • is_acquisition: whether the pulse/acquisition is an acquisition or not (type numpy.bool_).

  • wf_idx: the waveform index of the pulse/acquisition belonging to the Operation.

  • operation_hash: the unique hash corresponding to the Schedulable that the pulse/acquisition belongs to.

Example

schedule = Schedule("demo timing table")
schedule.add(Reset("q0", "q4"))
schedule.add(X("q0"))
schedule.add(Y("q4"))
schedule.add(Measure("q0", acq_channel=0))
schedule.add(Measure("q4", acq_channel=1))

compiled_schedule = compiler.compile(schedule)
compiled_schedule.timing_table
  waveform_op_id port clock abs_time duration is_acquisition operation wf_idx operation_hash
0 Reset('q0','q4')_acq_0 None cl0.baseband 0.0 ns 200,000.0 ns False Reset('q0','q4') 0 -509473121742877847
1 Reset('q0','q4')_acq_1 None cl0.baseband 0.0 ns 200,000.0 ns False Reset('q0','q4') 1 -509473121742877847
2 X(qubit='q0')_acq_0 q0:mw q0.01 200,000.0 ns 20.0 ns False X(qubit='q0') 0 734890079659623427
3 Y(qubit='q4')_acq_0 q4:mw q4.01 200,020.0 ns 20.0 ns False Y(qubit='q4') 0 -3395532282175353856
4 ResetClockPhase(clock='q0.ro',t0=0)_acq_0 None q0.ro 200,040.0 ns 0.0 ns False ResetClockPhase(clock='q0.ro',t0=0) 0 -3163014396248067489
5 VoltageOffset(offset_path_I=0.25,offset_path_Q=0,port='q0:res',clock='q0.ro',t0=0,reference_magnitude=None)_acq_0 q0:res q0.ro 200,040.0 ns 0.0 ns False VoltageOffset(offset_path_I=0.25,offset_path_Q=0,port='q0:res',clock='q0.ro',t0=0,reference_magnitude=None) 0 4563201256086305395
8 SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=1e-06,acq_channel=0,coords=None,acq_index=None,bin_mode='average_append',phase=0,t0=1e-07)_acq_0 q0:res q0.ro 200,140.0 ns 1,000.0 ns True SSBIntegrationComplex(port='q0:res',clock='q0.ro',duration=1e-06,acq_channel=0,coords=None,acq_index=None,bin_mode='average_append',phase=0,t0=1e-07) 0 -6985112566291201811
6 VoltageOffset(offset_path_I=0.0,offset_path_Q=0.0,port='q0:res',clock='q0.ro',t0=0,reference_magnitude=None)_acq_0 q0:res q0.ro 200,336.0 ns 0.0 ns False VoltageOffset(offset_path_I=0.0,offset_path_Q=0.0,port='q0:res',clock='q0.ro',t0=0,reference_magnitude=None) 0 2191294735864617671
7 SquarePulse(amp=0.25,duration=4e-09,port='q0:res',clock='q0.ro',reference_magnitude=None,t0=0)_acq_0 q0:res q0.ro 200,336.0 ns 4.0 ns False SquarePulse(amp=0.25,duration=4e-09,port='q0:res',clock='q0.ro',reference_magnitude=None,t0=0) 0 -4052874765446051166
9 ResetClockPhase(clock='q4.ro',t0=0)_acq_0 None q4.ro 201,140.0 ns 0.0 ns False ResetClockPhase(clock='q4.ro',t0=0) 0 -3149910719460552821
10 VoltageOffset(offset_path_I=0.25,offset_path_Q=0,port='q4:res',clock='q4.ro',t0=0,reference_magnitude=None)_acq_0 q4:res q4.ro 201,140.0 ns 0.0 ns False VoltageOffset(offset_path_I=0.25,offset_path_Q=0,port='q4:res',clock='q4.ro',t0=0,reference_magnitude=None) 0 1275914359249642209
13 SSBIntegrationComplex(port='q4:res',clock='q4.ro',duration=1e-06,acq_channel=1,coords=None,acq_index=None,bin_mode='average_append',phase=0,t0=1e-07)_acq_0 q4:res q4.ro 201,240.0 ns 1,000.0 ns True SSBIntegrationComplex(port='q4:res',clock='q4.ro',duration=1e-06,acq_channel=1,coords=None,acq_index=None,bin_mode='average_append',phase=0,t0=1e-07) 0 -4332257025660513890
11 VoltageOffset(offset_path_I=0.0,offset_path_Q=0.0,port='q4:res',clock='q4.ro',t0=0,reference_magnitude=None)_acq_0 q4:res q4.ro 201,436.0 ns 0.0 ns False VoltageOffset(offset_path_I=0.0,offset_path_Q=0.0,port='q4:res',clock='q4.ro',t0=0,reference_magnitude=None) 0 -1049712930198262171
12 SquarePulse(amp=0.25,duration=4e-09,port='q4:res',clock='q4.ro',reference_magnitude=None,t0=0)_acq_0 q4:res q4.ro 201,436.0 ns 4.0 ns False SquarePulse(amp=0.25,duration=4e-09,port='q4:res',clock='q4.ro',reference_magnitude=None,t0=0) 0 7440237781800133936
Returns:

: styled_timing_table, a pandas Styler containing a dataframe with an overview of the timing of the pulses and acquisitions present in the schedule. The dataframe can be accessed through the .data attribute of the Styler.

Raises:

ValueError – When the absolute timing has not been determined during compilation.

_add_timeable_schedule(timeable_schedule: qblox_scheduler.schedules.schedule.TimeableSchedule) None[source]#
_get_current_timeable_schedule() qblox_scheduler.schedules.schedule.TimeableSchedule | None[source]#
_get_timeable_schedule() qblox_scheduler.schedules.schedule.TimeableSchedule[source]#
get_used_port_clocks() set[tuple[str, str]][source]#

Extracts which port-clock combinations are used in this schedule.

Returns:

: All (port, clock) combinations that operations in this schedule uses

add_resources(resources_list: list) None[source]#

Add wrapper for adding multiple resources.

add_resource(resource: qblox_scheduler.resources.Resource) None[source]#

Add a resource such as a channel or device element to the schedule.

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

Declare a new variable.

Parameters:

dtype – The data type of the variable.

add(operation: Schedule | qblox_scheduler.operations.operation.Operation | qblox_scheduler.schedules.schedule.TimeableSchedule | qblox_scheduler.experiments.experiment.Step, rel_time: float | qblox_scheduler.operations.expressions.Expression = 0, ref_op: qblox_scheduler.schedules.schedule.Schedulable | str | None = None, ref_pt: qblox_scheduler.schedules.schedule.OperationReferencePoint | None = None, ref_pt_new: qblox_scheduler.schedules.schedule.OperationReferencePoint | None = None, label: str | None = None) qblox_scheduler.schedules.schedule.Schedulable | None[source]#

Add step, operation or timeable schedule to this schedule.

_add_schedule(schedule: Schedule, rel_time: float | qblox_scheduler.operations.expressions.Expression = 0, ref_op: qblox_scheduler.schedules.schedule.Schedulable | str | None = None, ref_pt: qblox_scheduler.schedules.schedule.OperationReferencePoint | None = None, ref_pt_new: qblox_scheduler.schedules.schedule.OperationReferencePoint | None = None, label: str | None = None) qblox_scheduler.schedules.schedule.Schedulable | None[source]#
loop(domain: qblox_scheduler.operations.loop_domains.LinearDomain, rel_time: float = 0, ref_op: qblox_scheduler.schedules.schedule.Schedulable | str | None = None, ref_pt: qblox_scheduler.schedules.schedule.OperationReferencePoint | None = None, ref_pt_new: qblox_scheduler.schedules.schedule.OperationReferencePoint | None = None, strategy: qblox_scheduler.operations.control_flow_library.LoopStrategy | None = None) collections.abc.Iterator[qblox_scheduler.operations.variables.Variable][source]#
loop(*domains: qblox_scheduler.operations.loop_domains.LinearDomain, rel_time: float = 0, ref_op: qblox_scheduler.schedules.schedule.Schedulable | str | None = None, ref_pt: qblox_scheduler.schedules.schedule.OperationReferencePoint | None = None, ref_pt_new: qblox_scheduler.schedules.schedule.OperationReferencePoint | None = None, strategy: qblox_scheduler.operations.control_flow_library.LoopStrategy | None = None) collections.abc.Iterator[list[qblox_scheduler.operations.variables.Variable]]

Add a loop operation to the schedule, using a with-statement.

Every operation added while the context manager is active, will be added to the loop body.

Example:

sched = Schedule()
with sched.loop(linspace(start_amp, start_amp + 1.0, 11, dtype=DType.AMP)) as amp:
    sched.add(SquarePulse(amp=amp, duration=100e-9, port="q0:mw", clock="q0.01"))
Parameters:
  • domain – The object that describes the domain to be looped over.

  • domains – Optional extra domains that will be looped over in parallel, in a zip-like fashion.

  • rel_time – relative time between the reference operation and the added operation. the time is the time between the “ref_pt” in the reference operation and “ref_pt_new” of the operation that is added.

  • ref_op – reference schedulable. If set to None, will default to the last added operation.

  • ref_pt – reference point in reference operation must be one of "start", "center", "end", or None; in case of None, _determine_absolute_timing() assumes "end".

  • ref_pt_new – reference point in added operation must be one of "start", "center", "end", or None; in case of None, _determine_absolute_timing() assumes "start".

  • strategy – Strategy to use for implementing this loop, will default to None indicating no preference.

Yields:

variables – The Variable objects that are created for each domain.

class TimeableSchedule(name: str = 'schedule', repetitions: int = 1, data: dict | None = None)[source]#

Bases: TimeableScheduleBase

A modifiable schedule.

Operations qblox_scheduler.operations.operation.Operation can be added using the add() method, allowing precise specification when to perform an operation using timing constraints.

When adding an operation, it is not required to specify how to represent this qblox_scheduler.operations.operation.Operation on all layers. Instead, this information can be added later during compilation. This allows the user to effortlessly mix the gate- and pulse-level descriptions as required for many (calibration) experiments.

Parameters:
  • name – The name of the schedule, by default “schedule”

  • repetitions – The amount of times the schedule will be repeated, by default 1

  • data – A dictionary containing a pre-existing schedule, by default None

schema_filename = 'schedule.json'#
property _scope_stack: list[TimeableSchedule]#
add_resources(resources_list: list) None[source]#

Add wrapper for adding multiple resources.

add_resource(resource: qblox_scheduler.resources.Resource) None[source]#

Add a resource such as a channel or device element to the schedule.

add(operation: qblox_scheduler.operations.operation.Operation | TimeableSchedule, rel_time: float | qblox_scheduler.operations.expressions.Expression = 0, ref_op: Schedulable | str | None = None, ref_pt: OperationReferencePoint | None = None, ref_pt_new: OperationReferencePoint | None = None, label: str | None = None) Schedulable[source]#

Add an operation or a subschedule to the schedule.

Parameters:
  • operation – The operation to add to the schedule, or another schedule to add as a subschedule.

  • rel_time – relative time between the reference operation and the added operation. the time is the time between the “ref_pt” in the reference operation and “ref_pt_new” of the operation that is added.

  • ref_op – reference schedulable. If set to None, will default based on the chosen SchedulingStrategy. If ASAP is chosen, the previously added schedulable is the reference schedulable. If ALAP is chose, the reference schedulable is the schedulable added immediately after this schedulable.

  • ref_pt – reference point in reference operation must be one of "start", "center", "end", or None; in case of None, _determine_absolute_timing() assumes "end".

  • ref_pt_new – reference point in added operation must be one of "start", "center", "end", or None; in case of None, _determine_absolute_timing() assumes "start".

  • label – a unique string that can be used as an identifier when adding operations. if set to None, a random hash will be generated instead.

Returns:

: Returns the schedulable created in the schedule.

_add(operation: qblox_scheduler.operations.operation.Operation | TimeableSchedule, rel_time: float | qblox_scheduler.operations.expressions.Expression = 0, ref_op: Schedulable | str | None = None, ref_pt: OperationReferencePoint | None = None, ref_pt_new: OperationReferencePoint | None = None, label: str | None = None) Schedulable[source]#
_validate_add_arguments(operation: qblox_scheduler.operations.operation.Operation | TimeableSchedule, label: str) None[source]#
declare(dtype: qblox_scheduler.operations.expressions.DType) qblox_scheduler.operations.variables.Variable[source]#

Declare a new variable.

Parameters:

dtype – The data type of the variable.

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

Add a declared variable.

Parameters:

var – The variable.

clone() TimeableSchedule[source]#

Clone this schedule into a separate independent schedule.

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

Substitute matching expressions in this schedule.

loop(domain: dict[qblox_scheduler.operations.variables.Variable, qblox_scheduler.operations.loop_domains.LinearDomain], rel_time: float = 0, ref_op: Schedulable | str | None = None, ref_pt: OperationReferencePoint | None = None, ref_pt_new: OperationReferencePoint | None = None, strategy: qblox_scheduler.operations.control_flow_library.LoopStrategy | None = None) collections.abc.Iterator[qblox_scheduler.operations.variables.Variable][source]#
loop(domain: qblox_scheduler.operations.loop_domains.LinearDomain, rel_time: float = 0, ref_op: Schedulable | str | None = None, ref_pt: OperationReferencePoint | None = None, ref_pt_new: OperationReferencePoint | None = None, strategy: qblox_scheduler.operations.control_flow_library.LoopStrategy | None = None) collections.abc.Iterator[qblox_scheduler.operations.variables.Variable]
loop(*domains: qblox_scheduler.operations.loop_domains.LinearDomain, rel_time: float = 0, ref_op: Schedulable | str | None = None, ref_pt: OperationReferencePoint | None = None, ref_pt_new: OperationReferencePoint | None = None, strategy: qblox_scheduler.operations.control_flow_library.LoopStrategy | None = None) collections.abc.Iterator[list[qblox_scheduler.operations.variables.Variable]]

Add a loop operation to the schedule, using a with-statement.

Every operation added while the context manager is active, will be added to the loop body.

Example:

sched = TimeableSchedule()
with sched.loop(linspace(start_amp, start_amp + 1.0, 11, dtype=DType.AMPLITUDE)) as amp:
    sched.add(SquarePulse(amp=amp, duration=100e-9, port="q0:mw", clock="q0.01"))
Parameters:
  • domain – The object that describes the domain to be looped over.

  • domains – Optional extra domains that will be looped over in parallel, in a zip-like fashion.

  • rel_time – relative time between the reference operation and the added operation. the time is the time between the “ref_pt” in the reference operation and “ref_pt_new” of the operation that is added.

  • ref_op – reference schedulable. If set to None, will default to the last added operation.

  • ref_pt – reference point in reference operation must be one of "start", "center", "end", or None; in case of None, _determine_absolute_timing() assumes "end".

  • ref_pt_new – reference point in added operation must be one of "start", "center", "end", or None; in case of None, _determine_absolute_timing() assumes "start".

  • strategy – Strategy to use for implementing this loop, will default to None indicating no preference.

Yields:

variables – The Variable objects that are created for each domain.