quantify_scheduler.compilation

Compiler for the quantify_scheduler.

Module Contents

Functions

determine_absolute_timing(...)

Determines the absolute timing of a schedule based on the timing constraints.

_find_edge(device_cfg, q0, q1, op_name)

add_pulse_information_transmon(...)

Adds pulse information specified in the device config to the schedule.

validate_config(→ bool)

Validate a configuration using a schema.

qcompile(...)

Compile and assemble a Schedule into a

device_compile(...)

Add pulse information to operations based on device config file.

hardware_compile(...)

Add compiled instructions to the schedule based on the hardware config file.

Attributes

logger

logger[source]
determine_absolute_timing(schedule: quantify_scheduler.schedules.schedule.Schedule, time_unit: Literal[physical, ideal] = 'physical') quantify_scheduler.schedules.schedule.Schedule[source]

Determines the absolute timing of a schedule based on the timing constraints.

This function determines absolute timings for every operation in the schedulables. It does this by:

  1. iterating over all and elements in the schedulables.

  2. determining the absolute time of the reference operation.

  3. determining the start of the operation based on the rel_time and duration of operations.

Parameters
  • schedule – The schedule for which to determine timings.

  • time_unit – Whether to use physical units to determine the absolute time or ideal time. When time_unit == 'physical' the duration attribute is used. When time_unit == 'ideal' the duration attribute is ignored and treated as if it is 1.

Returns

a new schedule object where the absolute time for each operation has been determined.

_find_edge(device_cfg, q0, q1, op_name)[source]
add_pulse_information_transmon(schedule: quantify_scheduler.schedules.schedule.Schedule, device_cfg: dict) quantify_scheduler.schedules.schedule.Schedule[source]

Adds pulse information specified in the device config to the schedule.

Parameters
  • schedule – The schedule for which to add pulse information.

  • device_cfg – A dictionary specifying the required pulse information.

Returns

a new schedule object where the pulse information has been added.

Supported operations

The following gate type operations are supported by this compilation step.

Configuration specification

JSON schema for a transmon based device configuration.

type

object

properties

  • backend

Specifies the function used for compiling from gate-level to pulse-level description. A valid specification is a period separated string e.g., ‘quantify_scheduler.compilation.add_pulse_information_transmon’.

type

string

  • qubits

A dictionary with qubit names (str) as keys e.g., ‘q0’. The items contain the informtation to compile gates on individual qubits to pulses acting on ports and clocks using the specified backend.

type

object

  • edges

A dictionary with pairs of qubit names separated by a dash (str) as keys e.g., ‘q0-q1’. The items contain the informtation to compile gates on pairs of qubits to pulses acting on ports and clocks using the specified backend.

type

object

additionalProperties

False

validate_config(config: dict, scheme_fn: str) bool[source]

Validate a configuration using a schema.

Parameters
  • config – The configuration to validate

  • scheme_fn – The name of a json schema in the quantify_scheduler.schemas folder.

Returns

True if valid

qcompile(schedule: quantify_scheduler.schedules.schedule.Schedule, device_cfg: Optional[Union[quantify_scheduler.backends.circuit_to_device.DeviceCompilationConfig, dict]] = None, hardware_cfg: Optional[dict] = None) quantify_scheduler.schedules.schedule.CompiledSchedule[source]

Compile and assemble a Schedule into a CompiledSchedule ready for execution using the InstrumentCoordinator.

Parameters
  • schedule – The schedule to be compiled.

  • device_cfg – Device specific configuration, defines the compilation step from the quantum-circuit layer to the quantum-device layer description.

  • hardware_cfg – Hardware configuration, defines the compilation step from the quantum-device to a hardware layer.

Returns

The prepared schedule if no backend is provided, otherwise whatever object returned by the backend

Configuration specification

JSON schema for a transmon based device configuration.

type

object

properties

  • backend

Specifies the function used for compiling from gate-level to pulse-level description. A valid specification is a period separated string e.g., ‘quantify_scheduler.compilation.add_pulse_information_transmon’.

type

string

  • qubits

A dictionary with qubit names (str) as keys e.g., ‘q0’. The items contain the informtation to compile gates on individual qubits to pulses acting on ports and clocks using the specified backend.

type

object

  • edges

A dictionary with pairs of qubit names separated by a dash (str) as keys e.g., ‘q0-q1’. The items contain the informtation to compile gates on pairs of qubits to pulses acting on ports and clocks using the specified backend.

type

object

additionalProperties

False

Todo

Add a schema for the hardware config.

device_compile(schedule: quantify_scheduler.schedules.schedule.Schedule, device_cfg: Union[quantify_scheduler.backends.circuit_to_device.DeviceCompilationConfig, dict]) quantify_scheduler.schedules.schedule.Schedule[source]

Add pulse information to operations based on device config file.

Parameters
  • schedule – To be compiled.

  • device_cfg – Device specific configuration, defines the compilation step from the gate-level to the pulse level description.

Returns

The updated schedule.

hardware_compile(schedule: quantify_scheduler.schedules.schedule.Schedule, hardware_cfg: dict) quantify_scheduler.schedules.schedule.CompiledSchedule[source]

Add compiled instructions to the schedule based on the hardware config file.

Parameters
  • schedule – To be compiled.

  • hardware_cfg – Hardware specific configuration, defines the compilation step from the quantum-device layer to the control-hardware layer.

Returns

The compiled schedule.