qibolab.instruments.qm package#

Submodules#

qibolab.instruments.qm.acquisition module#

class qibolab.instruments.qm.acquisition.Acquisition(name: str, qubit: str | int, average: bool, keys: list[str] = <factory>)[source]#

Bases: ABC

QUA variables used for saving of acquisition results.

This class can be instantiated only within a QUA program scope. Each readout pulse is associated with its own set of acquisition variables.

name: str#

Name of the acquisition used as identifier to download results from the instruments.

qubit: str | int#
average: bool#
keys: list[str]#
RESULT_CLS#

Result object type that corresponds to this acquisition type.

alias of IntegratedResults

AVERAGED_RESULT_CLS#

Averaged result object type that corresponds to this acquisition type.

alias of AveragedIntegratedResults

property npulses#
abstract assign_element(element)[source]#

Assign acquisition variables to the corresponding QM controlled.

Proposed to do by QM to avoid crashes.

Parameters:

element (str) – Element (from config) that the pulse will be applied on.

abstract measure(operation, element)[source]#

Send measurement pulse and acquire results.

Parameters:
  • operation (str) – Operation (from config) corresponding to the pulse to be played.

  • element (str) – Element (from config) that the pulse will be applied on.

abstract download(*dimensions)[source]#

Save streams to prepare for fetching from host device.

Parameters:

dimensions (int) – Dimensions to use for buffer of data.

abstract fetch()[source]#

Fetch downloaded streams to host device.

result(data)[source]#

Creates Qibolab result object that is returned to the platform.

class qibolab.instruments.qm.acquisition.RawAcquisition(name: str, qubit: str | int, average: bool, keys: list[str] = <factory>, adc_stream: qm.qua._dsl._ResultSource = <factory>)[source]#

Bases: Acquisition

QUA variables used for raw waveform acquisition.

adc_stream: qm.qua._dsl._ResultSource#

Stream to collect raw ADC data.

RESULT_CLS#

alias of RawWaveformResults

AVERAGED_RESULT_CLS#

alias of AveragedRawWaveformResults

assign_element(element)[source]#

Assign acquisition variables to the corresponding QM controlled.

Proposed to do by QM to avoid crashes.

Parameters:

element (str) – Element (from config) that the pulse will be applied on.

measure(operation, element)[source]#

Send measurement pulse and acquire results.

Parameters:
  • operation (str) – Operation (from config) corresponding to the pulse to be played.

  • element (str) – Element (from config) that the pulse will be applied on.

download(*dimensions)[source]#

Save streams to prepare for fetching from host device.

Parameters:

dimensions (int) – Dimensions to use for buffer of data.

fetch(handles)[source]#

Fetch downloaded streams to host device.

class qibolab.instruments.qm.acquisition.IntegratedAcquisition(name: str, qubit: str | int, average: bool, keys: list[str] = <factory>, i: qm.qua._dsl._Variable = <factory>, q: qm.qua._dsl._Variable = <factory>, istream: qm.qua._dsl._ResultSource = <factory>, qstream: qm.qua._dsl._ResultSource = <factory>)[source]#

Bases: Acquisition

QUA variables used for integrated acquisition.

i: qm.qua._dsl._Variable#
q: qm.qua._dsl._Variable#

Variables to save the (I, Q) values acquired from a single shot.

istream: qm.qua._dsl._ResultSource#
qstream: qm.qua._dsl._ResultSource#

Streams to collect the results of all shots.

RESULT_CLS#

alias of IntegratedResults

AVERAGED_RESULT_CLS#

alias of AveragedIntegratedResults

assign_element(element)[source]#

Assign acquisition variables to the corresponding QM controlled.

Proposed to do by QM to avoid crashes.

Parameters:

element (str) – Element (from config) that the pulse will be applied on.

measure(operation, element)[source]#

Send measurement pulse and acquire results.

Parameters:
  • operation (str) – Operation (from config) corresponding to the pulse to be played.

  • element (str) – Element (from config) that the pulse will be applied on.

download(*dimensions)[source]#

Save streams to prepare for fetching from host device.

Parameters:

dimensions (int) – Dimensions to use for buffer of data.

fetch(handles)[source]#

Fetch downloaded streams to host device.

class qibolab.instruments.qm.acquisition.ShotsAcquisition(name: str, qubit: str | int, average: bool, keys: list[str] = <factory>, threshold: float | None = None, angle: float | None = None, i: qm.qua._dsl._Variable = <factory>, q: qm.qua._dsl._Variable = <factory>, shot: qm.qua._dsl._Variable = <factory>, shots: qm.qua._dsl._ResultSource = <factory>)[source]#

Bases: Acquisition

QUA variables used for shot classification.

Threshold and angle must be given in order to classify shots.

threshold: float | None = None#

Threshold to be used for classification of single shots.

angle: float | None = None#

Angle in the IQ plane to be used for classification of single shots.

i: qm.qua._dsl._Variable#
q: qm.qua._dsl._Variable#

Variables to save the (I, Q) values acquired from a single shot.

shot: qm.qua._dsl._Variable#

Variable for calculating an individual shots.

shots: qm.qua._dsl._ResultSource#

Stream to collect multiple shots.

RESULT_CLS#

alias of SampleResults

AVERAGED_RESULT_CLS#

alias of AveragedSampleResults

assign_element(element)[source]#

Assign acquisition variables to the corresponding QM controlled.

Proposed to do by QM to avoid crashes.

Parameters:

element (str) – Element (from config) that the pulse will be applied on.

measure(operation, element)[source]#

Send measurement pulse and acquire results.

Parameters:
  • operation (str) – Operation (from config) corresponding to the pulse to be played.

  • element (str) – Element (from config) that the pulse will be applied on.

download(*dimensions)[source]#

Save streams to prepare for fetching from host device.

Parameters:

dimensions (int) – Dimensions to use for buffer of data.

fetch(handles)[source]#

Fetch downloaded streams to host device.

qibolab.instruments.qm.acquisition.declare_acquisitions(ro_pulses, qubits, options)[source]#

Declares variables for saving acquisition in the QUA program.

Parameters:
Returns:

List of all qibolab.instruments.qm.acquisition.Acquisition objects.

qibolab.instruments.qm.acquisition.fetch_results(result, acquisitions)[source]#

Fetches results from an executed experiment.

Parameters:
Returns:

Dictionary with the results in the format required by the platform.

qibolab.instruments.qm.config module#

qibolab.instruments.qm.config.SAMPLING_RATE = 1#

Sampling rate of Quantum Machines OPX in GSps.

qibolab.instruments.qm.config.DEFAULT_INPUTS = {1: {}, 2: {}}#

Default controller config section.

Inputs are always registered to avoid issues with automatic mixer calibration when using Octaves.

class qibolab.instruments.qm.config.QMConfig(version: int = 1, controllers: dict = <factory>, octaves: dict = <factory>, elements: dict = <factory>, pulses: dict = <factory>, waveforms: dict = <factory>, digital_waveforms: dict = <factory>, integration_weights: dict = <factory>, mixers: dict = <factory>)[source]#

Bases: object

Configuration for communicating with the QuantumMachinesManager.

version: int = 1#
controllers: dict#
octaves: dict#
elements: dict#
pulses: dict#
waveforms: dict#
digital_waveforms: dict#
integration_weights: dict#
mixers: dict#
register_port(port)[source]#

Register controllers and octaves sections in the config.

Parameters:

ports (QMPort) – Port we are registering. Contains information about the controller and port number and some parameters, such as offset, gain, filter, etc.).

static iq_imbalance(g, phi)[source]#

Creates the correction matrix for the mixer imbalance caused by the gain and phase imbalances.

More information here: https://docs.qualang.io/libs/examples/mixer-calibration/#non-ideal-mixer

Parameters:
  • g (float) – relative gain imbalance between the I & Q ports (unit-less). Set to 0 for no gain imbalance.

  • phi (float) – relative phase imbalance between the I & Q ports (radians). Set to 0 for no phase imbalance.

register_drive_element(qubit, intermediate_frequency=0)[source]#

Register qubit drive elements and controllers in the QM config.

Parameters:
  • qubit (qibolab.platforms.utils.Qubit) – Qubit to add elements for.

  • intermediate_frequency (int) – Intermediate frequency that the OPX will send to this qubit. This frequency will be mixed with the LO connected to the same channel.

register_readout_element(qubit, intermediate_frequency=0, time_of_flight=0, smearing=0)[source]#

Register resonator elements and controllers in the QM config.

Parameters:
  • qubit (qibolab.platforms.utils.Qubit) – Qubit to add elements for.

  • intermediate_frequency (int) – Intermediate frequency that the OPX will send to this qubit. This frequency will be mixed with the LO connected to the same channel.

register_flux_element(qubit, intermediate_frequency=0)[source]#

Register qubit flux elements and controllers in the QM config.

Parameters:
  • qubit (qibolab.platforms.utils.Qubit) – Qubit to add elements for.

  • intermediate_frequency (int) – Intermediate frequency that the OPX will send to this qubit. This frequency will be mixed with the LO connected to the same channel.

register_element(qubit, pulse, time_of_flight=0, smearing=0)[source]#
register_pulse(qubit, qmpulse)[source]#

Registers pulse, waveforms and integration weights in QM config.

Parameters:
  • qubit (qibolab.platforms.utils.Qubit) – Qubit that the pulse acts on.

  • pulse (qibolab.pulses.Pulse) – Pulse object to register.

Returns:

Name of the element this pulse will be played on.

Elements are a part of the QM config and are generated during instantiation of the Qubit objects. They are named as “drive0”, “drive1”, “flux0”, “readout0”, …

Return type:

element (str)

register_waveform(pulse, mode='i')[source]#

Registers waveforms in QM config.

QM supports two kinds of waveforms, examples:

“zero_wf”: {“type”: “constant”, “sample”: 0.0} “x90_wf”: {“type”: “arbitrary”, “samples”: x90_wf.tolist()}

Parameters:
  • pulse (qibolab.pulses.Pulse) – Pulse object to read the waveform from.

  • mode (str) – “i” or “q” specifying which channel the waveform will be played.

Returns:

String with a serialization of the waveform.

Used as key to identify the waveform in the config.

Return type:

serial (str)

register_integration_weights(qubit, readout_len)[source]#

Registers integration weights in QM config.

Parameters:
  • qubit (qibolab.platforms.quantum_machines.Qubit) – Qubit object that the integration weights will be used for.

  • readout_len (int) – Duration of the readout pulse in ns.

qibolab.instruments.qm.controller module#

qibolab.instruments.qm.controller.OCTAVE_ADDRESS_OFFSET = 11000#

Offset to be added to Octave addresses, because they must be 11xxx, where xxx are the last three digits of the Octave IP address.

qibolab.instruments.qm.controller.declare_octaves(octaves, host, calibration_path=None)[source]#

Initiate Octave configuration and add octaves info.

Parameters:
  • octaves (dict) – Dictionary containing qibolab.instruments.qm.devices.Octave objects for each Octave device in the experiment configuration.

  • host (str) – IP of the Quantum Machines controller.

  • calibration_path (str) – Path to the JSON file with the mixer calibration.

qibolab.instruments.qm.controller.find_baking_pulses(sweepers)[source]#

Find pulses that require baking because we are sweeping their duration.

Parameters:

sweepers (list) – List of qibolab.sweeper.Sweeper objects.

qibolab.instruments.qm.controller.controllers_config(qubits, time_of_flight, smearing=0)[source]#

Create a Quantum Machines configuration without pulses.

This contains the readout and drive elements and controllers and is used by qibolab.instruments.qm.controller.QMController.calibrate_mixers().

Parameters:
  • qubits (list) – List of qibolab.qubits.Qubit objects to be included in the config.

  • time_of_flight (int) – Time of flight used on readout elements.

  • smearing (int) – Smearing used on readout elements.

class qibolab.instruments.qm.controller.QMController(name: str, address: str, opxs: ~typing.Dict[int, ~qibolab.instruments.qm.devices.OPXplus] = <factory>, octaves: ~typing.Dict[int, ~qibolab.instruments.qm.devices.Octave] = <factory>, time_of_flight: int = 0, smearing: int = 0, bounds: ~qibolab.unrolling.Bounds = Bounds(waveforms=0, readout=0, instructions=0), calibration_path: str | None = None, script_file_name: str | None = None, manager: qm.QuantumMachinesManager | None = None, config: ~qibolab.instruments.qm.config.QMConfig = <factory>, is_connected: bool = False, simulation_duration: int | None = None, cloud: bool = False)[source]#

Bases: Controller

qibolab.instruments.abstract.Controller object for controlling a Quantum Machines cluster.

A cluster consists of multiple qibolab.instruments.qm.devices.QMDevice devices.

Playing pulses on QM controllers requires a config dictionary and a program written in QUA language. The config file is generated in parts in qibolab.instruments.qm.config.QMConfig. Controllers, elements and pulses are all registered after a pulse sequence is given, so that the config contains only elements related to the participating qubits. The QUA program for executing an arbitrary qibolab.pulses.PulseSequence is written in qibolab.instruments.qm.controller.QMController.play() and executed in qibolab.instruments.qm.controller.QMController.execute_program().

name: str#

Name of the instrument instance.

address: str#

IP address and port for connecting to the OPX instruments.

Has the form XXX.XXX.XXX.XXX:XXX.

opxs: Dict[int, OPXplus]#

Dictionary containing the qibolab.instruments.qm.devices.OPXplus instruments being used.

octaves: Dict[int, Octave]#

Dictionary containing the qibolab.instruments.qm.devices.Octave instruments being used.

time_of_flight: int = 0#

Time of flight used for hardware signal integration.

smearing: int = 0#

Smearing used for hardware signal integration.

bounds: Bounds = Bounds(waveforms=0, readout=0, instructions=0)#

Maximum bounds used for batching in sequence unrolling.

calibration_path: str | None = None#

Path to the JSON file that contains the mixer calibration.

script_file_name: str | None = None#

Name of the file that the QUA program will dumped in that after every execution.

If None the program will not be dumped.

manager: qm.QuantumMachinesManager | None = None#

Manager object used for controlling the Quantum Machines cluster.

config: QMConfig#

Configuration dictionary required for pulse execution on the OPXs.

is_connected: bool = False#

Boolean that shows whether we are connected to the QM manager.

simulation_duration: int | None = None#

Duration for the simulation in ns.

If given the simulator will be used instead of actual hardware execution.

cloud: bool = False#

If True the QM cloud simulator is used which does not require access to physical instruments.

This assumes that a proper cloud address has been given. If False and simulation_duration was given, then the built-in simulator of the instruments is used. This requires connection to instruments. Default is False.

ports(name, output=True)[source]#

Provides instrument ports to the user.

Note that individual ports can also be accessed from the corresponding devices using qibolab.instruments.qm.devices.QMDevice.ports().

Parameters:
  • name (tuple) – Contains the numbers of controller and port to be obtained. For example ((conX, Y),) returns port-Y of OPX+ controller X. ((conX, Y), (conX, Z)) returns port-Y and Z of OPX+ controller X as an qibolab.instruments.qm.ports.OPXIQ port pair.

  • output (bool) – True for obtaining an output port, otherwise an input port is returned. Default is True.

property sampling_rate#

Sampling rate of Quantum Machines instruments.

connect()[source]#

Connect to the Quantum Machines manager.

disconnect()[source]#

Disconnect from QM manager.

calibrate_mixers(qubits)[source]#

Calibrate Octave mixers for readout and drive lines of given qubits.

Parameters:

qubits (list) – List of qibolab.qubits.Qubit objects for which mixers will be calibrated.

execute_program(program)[source]#

Executes an arbitrary program written in QUA language.

Parameters:

program – QUA program.

simulate_program(program)[source]#

Simulates an arbitrary program written in QUA language.

Parameters:

program – QUA program.

create_sequence(qubits, sequence, sweepers)[source]#

Translates a qibolab.pulses.PulseSequence to a qibolab.instruments.qm.sequence.Sequence.

Parameters:
  • qubits (list) – List of qibolab.platforms.abstract.Qubit objects passed from the platform.

  • sequence (qibolab.pulses.PulseSequence) –

  • sweepers (list) – List of sweeper objects so that pulses that require baking are identified.

Returns:

(qibolab.instruments.qm.sequence.Sequence) containing the pulses from given pulse sequence.

play(qubits, couplers, sequence, options)[source]#

Play a pulse sequence and retrieve feedback.

Returns:

(Dict[ResultType]) mapping the serial of the readout pulses used to the acquired qibolab.result.ExecutionResults object.

sweep(qubits, couplers, sequence, options, *sweepers)[source]#

Play a pulse sequence while sweeping one or more parameters.

Returns:

(dict) mapping the serial of the readout pulses used to the acquired qibolab.result.ExecutionResults object.

qibolab.instruments.qm.devices module#

class qibolab.instruments.qm.devices.PortsDefaultdict[source]#

Bases: defaultdict

Dictionary mapping port numbers to qibolab.instruments.qm.ports.QMPort objects.

Automatically instantiates ports that have not yet been created. Used by qibolab.instruments.qm.devices.QMDevice

https://stackoverflow.com/questions/2912231/is-there-a-clever-way-to-pass-the-key-to-defaultdicts-default-factory

class qibolab.instruments.qm.devices.QMDevice(name: str)[source]#

Bases: Instrument

Abstract class for an individual Quantum Machines devices.

name: str#

Name of the device.

outputs: Dict[int, QMOutput]#

Dictionary containing the instrument’s output ports.

inputs: Dict[int, QMInput]#

Dictionary containing the instrument’s input ports.

ports(number, output=True)[source]#

Provides instrument’s ports to the user.

Parameters:
connect()[source]#

Only applicable for qibolab.instruments.qm.controller.QMController, not individual devices.

setup(**kwargs)[source]#

Set instrument settings.

disconnect()[source]#

Only applicable for qibolab.instruments.qm.controller.QMController, not individual devices.

dump()[source]#

Serializes device settings to a dictionary for dumping to the runcard YAML.

class qibolab.instruments.qm.devices.OPXplus(name: str)[source]#

Bases: QMDevice

Device handling OPX+ controllers.

class qibolab.instruments.qm.devices.Octave(name: str, port: int, connectivity: OPXplus)[source]#

Bases: QMDevice

Device handling Octaves.

port: int#

Network port of the Octave in the cluster configuration.

connectivity: OPXplus#

OPXplus that acts as the waveform generator for the Octave.

ports(number, output=True)[source]#

Provides Octave ports.

Extension of the abstract qibolab.instruments.qm.devices.QMDevice.ports() because Octave ports are used for mixing two existing (I, Q) OPX+ ports.

qibolab.instruments.qm.ports module#

qibolab.instruments.qm.ports.DIGITAL_BUFFER = 18#

Default calibration parameters for digital pulses.

https://docs.quantum-machines.co/1.1.7/qm-qua-sdk/docs/Guides/octave/#calibrating-the-digital-pulse

Digital markers are used for LO triggering.

class qibolab.instruments.qm.ports.QMPort(device: str, number: int)[source]#

Bases: object

Abstract representation of Quantum Machine instrument ports.

Contains the ports settings for each device.

device: str#

Name of the device holding this port.

number: int#

Number of this port in the device.

key: ClassVar[str | None] = None#

Key corresponding to this port type in the Quantum Machines config.

Used in qibolab.instruments.qm.config.QMConfig.register_port().

property pair#

Representation of the port in the Quantum Machines config.

setup(**kwargs)[source]#

Updates port settings.

property settings#

Serialization of the port settings to dump in the runcard YAML.

Only fields that provide the metadata['settings'] flag are dumped in the serialization.

property config#

Port settings in the format of the Quantum Machines config.

Field metadata['config'] are used to translate qibolab port setting names to the corresponding Quantum Machine config properties.

class qibolab.instruments.qm.ports.QMOutput(device: str, number: int)[source]#

Bases: QMPort

Abstract Quantum Machines output port.

property name#

Name of the port when dumping instrument settings on the runcard YAML.

class qibolab.instruments.qm.ports.QMInput(device: str, number: int)[source]#

Bases: QMPort

Abstract Quantum Machines input port.

property name#

Name of the port when dumping instrument settings on the runcard YAML.

class qibolab.instruments.qm.ports.OPXOutput(device: str, number: int, offset: float = 0.0, filter: Dict[str, float] = <factory>)[source]#

Bases: QMOutput

key: ClassVar[str] = 'analog_outputs'#

Key corresponding to this port type in the Quantum Machines config.

Used in qibolab.instruments.qm.config.QMConfig.register_port().

offset: float = 0.0#

Constant voltage to be applied on the output.

filter: Dict[str, float]#

FIR and IIR filters to be applied to correct signal distortions.

property settings#

OPX+ output settings to be dumped to the runcard YAML.

Filter is removed if empty to simplify the runcard.

class qibolab.instruments.qm.ports.OPXInput(device: str, number: int, offset: float = 0.0, gain: int = 0)[source]#

Bases: QMInput

key: ClassVar[str] = 'analog_inputs'#

Key corresponding to this port type in the Quantum Machines config.

Used in qibolab.instruments.qm.config.QMConfig.register_port().

offset: float = 0.0#

Constant voltage to be applied on the output.

gain: int = 0#

Gain applied to amplify the input.

class qibolab.instruments.qm.ports.OPXIQ(i: OPXOutput | OPXInput, q: OPXOutput | OPXInput)[source]#

Bases: object

Pair of I-Q ports.

i: OPXOutput | OPXInput#

Port implementing the I-component of the signal.

q: OPXOutput | OPXInput#

Port implementing the Q-component of the signal.

class qibolab.instruments.qm.ports.OctaveOutput(device: str, number: int, lo_frequency: float = 0.0, gain: int = 0, lo_source: str = 'internal', output_mode: str = 'triggered', digital_delay: int = 57, digital_buffer: int = 18, opx_port: qibolab.instruments.qm.ports.OPXOutput | None = None)[source]#

Bases: QMOutput

key: ClassVar[str] = 'RF_outputs'#

Key corresponding to this port type in the Quantum Machines config.

Used in qibolab.instruments.qm.config.QMConfig.register_port().

lo_frequency: float = 0.0#

Local oscillator frequency.

gain: int = 0#

Local oscillator gain.

Can be in the range [-20 : 0.5 : 20] dB.

lo_source: str = 'internal'#

Local oscillator clock source.

Can be external or internal.

output_mode: str = 'triggered'#

“always_on” / “always_off”/ “triggered” / “triggered_reversed”.

Type:

Can be

digital_delay: int = 57#

Delay for digital output channel.

digital_buffer: int = 18#

Buffer for digital output channel.

opx_port: OPXOutput | None = None#

OPX+ port that is connected to the Octave port.

property digital_inputs#

Generates digitalInputs entry for elements in QM config.

Digital markers are used to switch LOs on in triggered mode.

class qibolab.instruments.qm.ports.OctaveInput(device: str, number: int, lo_frequency: float = 0.0, lo_source: str = 'internal', IF_mode_I: str = 'direct', IF_mode_Q: str = 'direct', opx_port: qibolab.instruments.qm.ports.OPXIQ | None = None)[source]#

Bases: QMInput

key: ClassVar[str] = 'RF_inputs'#

Key corresponding to this port type in the Quantum Machines config.

Used in qibolab.instruments.qm.config.QMConfig.register_port().

lo_frequency: float = 0.0#

Local oscillator frequency.

lo_source: str = 'internal'#

Local oscillator clock source.

Can be external or internal.

IF_mode_I: str = 'direct'#
IF_mode_Q: str = 'direct'#
opx_port: OPXIQ | None = None#

OPX+ port that is connected to the Octave port.

qibolab.instruments.qm.sequence module#

qibolab.instruments.qm.sequence.DurationsType#

Type of values that can be accepted in a duration sweeper.

alias of Union[List[int], ndarray[Any, dtype[int]]]

class qibolab.instruments.qm.sequence.QMPulse(pulse: ~qibolab.pulses.Pulse, element: str | None = None, operation: str | None = None, relative_phase: float | None = None, wait_time: int = 0, wait_time_variable: qm.qua._dsl._Variable | None = None, swept_duration: qm.qua._dsl._Variable | None = None, acquisition: ~qibolab.instruments.qm.acquisition.Acquisition | None = None, next_: ~typing.Set[~qibolab.instruments.qm.sequence.QMPulse] = <factory>, elements_to_align: ~typing.Set[str] = <factory>)[source]#

Bases: object

Wrapper around qibolab.pulses.Pulse for easier translation to QUA program.

These pulses are defined when qibolab.instruments.qm.QMOPX.play() is called and hold attributes for the element and operation that corresponds to each pulse, as defined in the QM config.

pulse: Pulse#

qibolab.pulses.Pulse corresponding to the QMPulse.

element: str | None = None#

Element that the pulse will be played on, as defined in the QM config.

operation: str | None = None#

Name of the operation that is implementing the pulse in the QM config.

relative_phase: float | None = None#

Relative phase of the pulse normalized to follow QM convention.

May be overwritten when sweeping phase.

wait_time: int = 0#

Time (in clock cycles) to wait before playing this pulse.

Calculated and assigned by :meth: qibolab.instruments.qm.Sequence.add.

wait_time_variable: qm.qua._dsl._Variable | None = None#

Time (in clock cycles) to wait before playing this pulse when we are sweeping start.

swept_duration: qm.qua._dsl._Variable | None = None#

Pulse duration when sweeping it.

acquisition: Acquisition | None = None#

Data class containing the variables required for data acquisition for the instrument.

next_: Set[QMPulse]#

Pulses that will be played after the current pulse.

These pulses need to be re-aligned if we are sweeping the start or duration.

elements_to_align: Set[str]#
property duration#

Duration of the pulse as defined in the qibolab.pulses.PulseSequence.

Remains constant even when we are sweeping the duration of this pulse.

property wait_cycles#

Instrument clock cycles (1 cycle = 4ns) to wait before playing the pulse.

This property will be used in the QUA wait command, so that it is compatible with and without start sweepers.

play()[source]#

Play the pulse.

Relevant only in the context of a QUA program.

class qibolab.instruments.qm.sequence.BakedPulse(pulse: ~qibolab.pulses.Pulse, element: str | None = None, operation: str | None = None, relative_phase: float | None = None, wait_time: int = 0, wait_time_variable: qm.qua._dsl._Variable | None = None, swept_duration: qm.qua._dsl._Variable | None = None, acquisition: ~qibolab.instruments.qm.acquisition.Acquisition | None = None, next_: ~typing.Set[~qibolab.instruments.qm.sequence.QMPulse] = <factory>, elements_to_align: ~typing.Set[str] = <factory>, segments: ~typing.List[~qualang_tools.bakery.bakery.Baking] = <factory>, amplitude: float | None = None, durations: ~typing.List[int] | ~numpy.ndarray[~typing.Any, ~numpy.dtype[int]] | None = None)[source]#

Bases: QMPulse

Baking allows 1ns resolution in the pulse waveforms.

segments: List[Baking]#

Baked segments implementing the pulse.

amplitude: float | None = None#

Amplitude of the baked pulse.

Relevant only when sweeping amplitude.

durations: List[int] | ndarray[Any, dtype[int]] | None = None#
property duration#

Duration of the pulse as defined in the qibolab.pulses.PulseSequence.

Remains constant even when we are sweeping the duration of this pulse.

static calculate_waveform(original_waveform, t)[source]#
bake(config: QMConfig, durations: List[int] | ndarray[Any, dtype[int]])[source]#
property amplitude_array#
play()[source]#

Play the pulse.

Relevant only in the context of a QUA program.

class qibolab.instruments.qm.sequence.Sequence(qmpulses: ~typing.List[~qibolab.instruments.qm.sequence.QMPulse] = <factory>, pulse_to_qmpulse: ~typing.Dict[~qibolab.pulses.Pulse, ~qibolab.instruments.qm.sequence.QMPulse] = <factory>, clock: ~typing.Dict[str, int] = <factory>, pulse_finish: ~typing.Dict[int, ~typing.List[~qibolab.instruments.qm.sequence.QMPulse]] = <factory>)[source]#

Bases: object

Pulse sequence containing QM specific pulses (qmpulse).

Defined in qibolab.instruments.qm.QMOPX.play(). Holds attributes for the element and operation that corresponds to each pulse, as defined in the QM config.

qmpulses: List[QMPulse]#

List of qibolab.instruments.qm.QMPulse objects corresponding to the original pulses.

pulse_to_qmpulse: Dict[Pulse, QMPulse]#

Map from qibolab pulses to QMPulses (useful when sweeping).

clock: Dict[str, int]#

Dictionary used to keep track of times of each element, in order to calculate wait times.

pulse_finish: Dict[int, List[QMPulse]]#

Map to find all pulses that finish at a given time (useful for _find_previous).

add(qmpulse: QMPulse)[source]#
shift()[source]#

Shift all pulses that come after a BakedPulse a bit to avoid overlapping pulses.

play(relaxation_time=0)[source]#

Part of QUA program that plays an arbitrary pulse sequence.

Should be used inside a program() context.

qibolab.instruments.qm.sweepers module#

qibolab.instruments.qm.sweepers.maximum_sweep_value(values, value0)[source]#

Calculates maximum value that is reached during a sweep.

Useful to check whether a sweep exceeds the range of allowed values. Note that both the array of values we sweep and the center value can be negative, so we need to make sure that the maximum absolute value is within range.

Parameters:
  • values (np.ndarray) – Array of values we will sweep over.

  • value0 (float, int) – Center value of the sweep.

qibolab.instruments.qm.sweepers.sweep(sweepers, qubits, qmsequence, relaxation_time, config)[source]#

Public sweep function that is called by the driver.