Module containing the core concepts of the scheduler.
A modifiable schedule.
This class represents an element on a schedule. All elements on a schedule are
A schedule that contains compiled instructions ready for execution using
Class to provide a description of the shape and type of data that a schedule will
- class ScheduleBase(**kwargs)
ScheduleBaseis a data structure that is at the core of the Quantify-scheduler and describes when what operations are applied where.
The schedule data structure is based on a dictionary. This dictionary contains:
- operation_dict - a hash table containing the unique
quantify_scheduler.operations.operation.Operations added to the schedule.
- schedulables - a dictionary of all timing constraints added
Schedulecontains information on the
operationsis a dictionary of all unique operations used in the schedule and contain the information on what operation to apply where. The
schedulablesis a dictionary of Schedulables describing timing constraints between operations, i.e. when to apply an operation.
JSON schema of a valid Schedule
JSON schema for a quantify schedule.
Name of the schedule.
The amount of times the schedule will be repeated.
A dictionary containing schedulables.
A dictionary of operations. Keys correspond to the hash attribute of operations.
A dictionary of resources.
A containing compiled instructions.
- property repetitions: int
Returns the amount of times this Schedule will be repeated.
The repetitions count.
- property operations: Dict[str, quantify_scheduler.operations.operation.Operation]
A dictionary of all unique operations used in the schedule. This specifies information on what operation to apply where.
- property schedulables: Dict[str, Any]
A list of schedulables describing the timing 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_repr']
The label is used as a unique identifier that can be used as a reference for other operations, the operation_repr refers to the string representation of a operation in
timing constraints are not intended to be modified directly. Instead use the
- property resources: Dict[str, quantify_scheduler.resources.Resource]
A dictionary containing resources. Keys are names (str), values are instances of
- 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.
schedule – a schedule for which the absolute timing has been determined.
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 data frame can be accessed through the .data attribute of the Styler.
ValueError – When the absolute timing has not been determined during compilation.
- to_json() str
Converts the Schedule data structure to a JSON string.
The json string result.
- classmethod from_json(data: str) Schedule
Converts the JSON data to a Schedule.
data – The JSON data.
The Schedule object.
- plot_circuit_diagram(figsize: Tuple[int, int] = None, ax: Optional[matplotlib.axes.Axes] = None, plot_backend: Literal[mpl] = 'mpl') Tuple[matplotlib.figure.Figure, Union[matplotlib.axes.Axes, List[matplotlib.axes.Axes]]]
Creates a circuit diagram visualization of the schedule using the specified plotting backend.
The circuit diagram visualization visualizes the schedule at the quantum circuit layer. This visualization provides no timing information, only showing the order of operations. Because quantify-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.
schedule – the schedule to render.
figsize – matplotlib figsize.
ax – Axis handle to use for plotting.
plot_backend – Plotting backend to use, currently only ‘mpl’ is supported
fig – matplotlib figure object.
ax – matplotlib axis object.
- plot_pulse_diagram(port_list: Optional[List[str]] = None, sampling_rate: float = 1000000000.0, modulation: Literal[off, if, clock] = 'off', modulation_if: float = 0.0, plot_backend: Literal[mpl, plotly] = 'mpl', plot_kwargs: Optional[dict] = None) Union[Tuple[matplotlib.figure.Figure, matplotlib.axes.Axes], plotly.graph_objects.Figure]
Creates 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.
- port_list :
A list of ports to show. if set to None will use the first 8 ports it encounters in the sequence.
- 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.
Plotting library to use, can either be ‘mpl’ or ‘plotly’.
Dictionary of keyword arguments to pass to the plotting backend
- Return type
- class Schedule(name: str, repetitions: int = 1, data: dict = None)
A modifiable schedule.
When adding an operation, it is not required to specify how to represent this
quantify_scheduler.operations.operation.Operationon 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.
- schema_filename = schedule.json
- add(operation: quantify_scheduler.operations.operation.Operation, rel_time: float = 0, ref_op: Schedulable = None, ref_pt: Literal[start, center, end] = 'end', ref_pt_new: Literal[start, center, end] = 'start', label: str = None) Schedulable
quantify_scheduler.operations.operation.Operationto the schedule.
operation – The operation to add to the schedule
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’).
ref_pt_new – reference point in added operation must be one of (‘start’, ‘center’, ‘end’).
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 the schedulable created on the schedule
- class Schedulable(name, operation_repr, schedule, data: dict = None)
This class represents an element on a schedule. All elements on a schedule are schedulables. A schedulable contains all information regarding the timing of this element as well as the operation being executing by this element. This operation is currently represented by an operation ID.
Schedulables can contain an arbitrary number of timing constraints to determine the timing. Multiple different constraints are currently resolved by delaying the element until after all timing constraints have been met, to aid compatibility. To specify an exact timing between two schedulables, please ensure to only specify exactly one timing constraint.
- schema_filename = schedulable.json
- add_timing_constraint(rel_time: float = 0, ref_schedulable: Schedulable = None, ref_pt: Literal[start, center, end] = 'end', ref_pt_new: Literal[start, center, end] = 'start')
A timing constraint constrains the operation in time by specifying the time (
"rel_time") between a reference schedulable and the added schedulable. The time can be specified with respect to the “start”, “center”, or “end” of the operations. The reference schedulable (
"ref_schedulable") is specified using its name property. See also
rel_time – relative time between the reference schedulable and the added schedulable. the time is the time between the “ref_pt” in the reference operation and “ref_pt_new” of the operation that is added.
ref_schedulable – name of the reference schedulable. If set to
None, will default to the last added operation.
ref_pt – reference point in reference schedulable must be one of (‘start’, ‘center’, ‘end’).
ref_pt_new – reference point in added schedulable must be one of (‘start’, ‘center’, ‘end’).
- class CompiledSchedule(schedule: Schedule)
A schedule that contains compiled instructions ready for execution using the
- property compiled_instructions: Dict[str, quantify_scheduler.resources.Resource]
A dictionary containing compiled instructions.
The contents of this dictionary depend on the backend it was compiled for. However, we assume that the general format consists of a dictionary in which the keys are instrument names corresponding to components added to a
InstrumentCoordinator, and the values are the instructions for that component.
These values typically contain a combination of sequence files, waveform definitions, and parameters to configure on the instrument.
- property hardware_timing_table: pandas.io.formats.style.Styler
Returns a timing table representing all operations at the Control-hardware layer.
Note that this timing table is typically different from the .timing_table in that it contains more hardware specific information such as channels, clock cycles and samples and corrections for things such as gain.
This hardware timing table is intended to provide a more
This table is constructed based on the timing_table and modified during compilation in one of the hardware back ends and optionally added to the schedule. Not all back ends support this feature.
- property hardware_waveform_dict: Dict[str, numpy.ndarray]
Returns a waveform dictionary representing all waveforms at the Control-hardware layer.
Where the waveforms are represented as abstract waveforms in the Operations, this dictionary contains the numerical arrays that are uploaded to the hardware.
- This dictionary is constructed during compilation in the hardware back ends and
optionally added to the schedule. Not all back ends support this feature.
- schema_filename = schedule.json
- class AcquisitionMetadata
Class to provide a description of the shape and type of data that a schedule will return when executed.
The acquisition protocol, bin-mode and return types are assumed to be the same for all acquisitions in a schedule.
- acq_protocol :str
The acquisition protocol that is used for all acquisitions in the schedule.
- bin_mode :quantify_scheduler.enums.BinMode
How the data is stored in the bins indexed by acq_channel and acq_index.
- acq_return_type :Type
The datatype returned by the individual acquisitions.
- acq_indices :Dict[int, List[int]]
A dictionary containing the acquisition channel as key and a list of acquisition indices that are used for every channel.