Platforms#
Qibolab provides support to different quantum laboratories.
Each lab is implemented using a custom Platform
class
which inherits the qibolab.platforms.abstract.AbstractPlatform
which implements basic features including how to connect to the platform,
how to start the instruments and how to run your model on the platform.
Therefore, the Platform
enables the user to interface with all
the required lab instruments at the same time with minimum effort.
Abstract platform#
- class qibolab.platforms.abstract.AbstractPlatform(name, runcard)#
Abstract platform for controlling quantum devices.
- Parameters:
name (str) – name of the platform.
runcard (str) – path to the yaml file containing the platform setup.
- abstract run_calibration(show_plots=False)#
Executes calibration routines and updates the settings yml file
- connect()#
Connects to lab instruments using the details specified in the calibration settings.
- transpile(circuit: Circuit)#
Transforms a circuit to pulse sequence.
- Parameters:
circuit (qibo.models.Circuit) – Qibo circuit that respects the platform’s connectivity and native gates.
- Returns:
- Pulse sequence that implements the
circuit on the qubit.
- Return type:
sequence (qibolab.pulses.PulseSequence)
- abstract execute_pulse_sequence(sequence, nshots=None)#
Executes a pulse sequence.
- Parameters:
sequence (
qibolab.pulses.PulseSequence
) – Pulse sequence to execute.nshots (int) – Number of shots to sample from the experiment. If
None
the default value provided as hardware_avg in the calibration yml will be used.
- Returns:
Readout results acquired by after execution.
QBloxPlatform#
ICPlatform#
- class qibolab.platforms.icplatform.ICPlatform(name, runcard)#
Platform for controlling quantum devices with IC.
Example
from qibolab import Platform platform = Platform("icarusq")
- run_calibration()#
Executes calibration routines and updates the settings yml file
- execute_pulse_sequence(sequence, nshots=None)#
- Executes a pulse sequence. Pulses are being cached so that are not reuploaded
if they are the same as the ones sent previously. This greatly accelerates some characterization routines that recurrently use the same set of pulses, i.e. qubit and resonator spectroscopy, spin echo, and future circuits based on fixed gates.
- Parameters:
sequence (
qibolab.pulses.PulseSequence
) – Pulse sequence to execute.nshots (int) – Number of shots to sample from the experiment. If
None
the default value provided as hardware_avg in the calibration json will be used.
- Returns:
Readout results acquired by the assigned readout instrument after execution.
- fetch_instrument(name)#
Returns a reference to an instrument.
- fetch_qubit(qubit_id=0) Qubit #
Fetches the qubit based on the id.
- start_experiment()#
Starts the instrument to start the experiment sequence.
- fetch_qubit_pi_pulse(qubit_id=0) dict #
Fetches the qubit pi-pulse.
- fetch_qubit_readout_pulse(qubit_id=0) dict #
Fetches the qubit readout pulse.
Pulses#
In Qibolab we have a dedicated API to pulses and pulses sequence, which at the moment works for both qblox and FPGAs setups.
The main component of the API is the qibolab.pulses.Pulse
object,
which enables the user to code a pulse with specific parameters. We provide
also a special object for the ReadoutPulse
given its importance when dealing
with a quantum hardware. Moreover, we supports different kinds of Pulse shape.
The qibolab.circuit.PulseSequence
class enables to combine different pulses
into a sequence through the add
method.
Basic Pulse#
- class qibolab.pulses.Pulse(start, duration, amplitude, frequency, relative_phase, shape, channel, type=PulseType.DRIVE, qubit=0)#
A class to represent a pulse to be sent to the QPU.
- Parameters:
start (int | intSymbolicExpression) – Start time of pulse in ns.
duration (int | intSymbolicExpression) – Pulse duration in ns.
amplitude (float) – Pulse digital amplitude (unitless) [-1 to 1].
frequency (int) – Pulse Intermediate Frequency in Hz [10e6 to 300e6].
relative_phase (float) – To be added.
shape – (PulseShape | str): {‘Rectangular()’, ‘Gaussian(rel_sigma)’, ‘DRAG(rel_sigma, beta)’} Pulse shape. See
qibolab.pulses
for list of available shapes.channel (int | str) – the channel on which the pulse should be synthesised.
type (PulseType | str) – {‘ro’, ‘qd’, ‘qf’} type of pulse {ReadOut, Qubit Drive, Qubit Flux}
qubit (int) – qubit associated with the pulse
Example
from qibolab.pulses import Pulse, Gaussian # define Gaussian drive pulse drive_pulse = Pulse(start=0, duration=60, amplitude=0.3, frequency=-200_000_000, relative_phase=0.0, shape=Gaussian(5), channel=1, type=PulseType.DRIVE, qubit=0) # define Rectangular readout pulse readout_pulse = Pulse(start=intSymbolicExpression(60), duration=2000, amplitude=0.3, frequency=20_000_000, relative_phase=0.0, shape=Rectangular(), channel=2, type=PulseType.READOUT, qubit=0)
- property start: int#
Returns the time when the pulse is scheduled to be played, in ns.
- property duration: int#
Returns the duration of the pulse, in ns.
- property finish: int#
Returns the time when the pulse is scheduled to finish.
Calculated as pulse.start - pulse finish.
- property se_start: intSymbolicExpression#
Returns a symbolic expression for the pulse start.
- property se_duration: intSymbolicExpression#
Returns a symbolic expression for the pulse duration.
- property se_finish: intSymbolicExpression#
Returns a symbolic expression for the pulse finish.
- property amplitude: float#
Returns the amplitude of the pulse.
Pulse amplitudes are normalised between -1 and 1.
- property frequency: int#
Returns the frequency of the pulse, in Hz.
- property global_phase#
Returns the global phase of the pulse, in radians.
This phase is calculated from the pulse start time and frequency as 2 * pi * frequency * start.
- property relative_phase: float#
Returns the relative phase of the pulse, in radians.
- property phase: float#
Returns the total phase of the pulse, in radians.
The total phase is computed as the sum of the global and relative phases.
- property shape: PulseShape#
Returns the shape of the pulse, as a PulseShape object.
- property channel#
Returns the channel on which the pulse should be played.
When a sequence of pulses is sent to the platform for execution, each pulse is sent to the instrument responsible for playing pulses the pulse channel. The connection of instruments with channels is defined in the platform runcard.
- property type: PulseType#
Returns the pulse type, as an element of PulseType enumeration.
- property qubit#
Returns the qubit addressed by the pulse.
- property serial: str#
Returns a string representation of the pulse.
- property envelope_waveform_i: Waveform#
The envelope waveform of the i component of the pulse.
- property envelope_waveform_q: Waveform#
The envelope waveform of the q component of the pulse.
- property envelope_waveforms#
A tuple with the i and q envelope waveforms of the pulse.
- property modulated_waveform_i: Waveform#
The waveform of the i component of the pulse, modulated with its frequency.
- property modulated_waveform_q: Waveform#
The waveform of the q component of the pulse, modulated with its frequency.
- property modulated_waveforms#
A tuple with the i and q waveforms of the pulse, modulated with its frequency.
- copy()#
Returns a new Pulse object with the same attributes.
- plot(savefig_filename=None)#
Plots the pulse envelope and modulated waveforms.
- Parameters:
savefig_filename (str) – a file path. If provided the plot is save to a file.
Readout Pulse#
- class qibolab.pulses.ReadoutPulse(start, duration, amplitude, frequency, relative_phase, shape, channel, qubit=0)#
Bases:
Pulse
Describes a readout pulse.
See
qibolab.pulses.Pulse
for argument desciption.- property serial#
Returns a string representation of the pulse.
- property global_phase#
Returns the global phase of the pulse, in radians.
This phase is calculated from the pulse start time and frequency as 2 * pi * frequency * start.
Pulse Sequence#
Pulse shape#
Rectangular#
Gaussian#
Drag#
SWIPHT#
Instruments supported#
Qibolab currently supports different instruments including local oscillators, qblox and FPGAs.
Qblox#
GenericPulsar#
PulsarQCM#
PulsarQRM#
QuicSyn#
RohdeSchwarz SGS100A#
Tektronix AWG5204#
- class qibolab.instruments.icarusq.TektronixAWG5204(name, address)#
- generate_waveforms_from_pulse(pulse: Pulse, time_array: ndarray)#
Generates a numpy array based on the pulse parameters
- Parameters:
pulse (qibolab.pulses.Pulse | qibolab.pulses.ReadoutPulse) – Pulse to be compiled
time_array (numpy.ndarray) – Array corresponding to the global time
- translate(sequence: List[Pulse], nshots=None)#
Translates the pulse sequence into a numpy array.
- Parameters:
sequence (qibolab.pulses.Pulse[]) – Array containing pulses to be fired on this instrument.
nshots (int) – Number of repetitions.
- upload(waveform: ndarray)#
Uploads a nchannels X nsamples array to the AWG, load it into memory and assign it to the channels for playback.
MiniCircuit RCDAT-8000-30#
FPGA#
ATS9371#
- class qibolab.instruments.icarusq.AlazarADC(name, address)#
Driver for the AlazarTech ATS9371 ADC.
- setup(trigger_volts, **kwargs)#
Sets the frequency in Hz
- play_sequence_and_acquire()#
this method performs an acquisition, which is the get_cmd for the acquisiion parameter of this instrument :return:
- process_result(readout_frequency=100000000.0, readout_channels=[0, 1])#
Returns the processed signal result from the ADC.
- Parameters:
readout_frequency (float) – Frequency to be used for signal processing.
readout_channels (int[]) – Channels to be used for signal processing.
- Returns:
Amplitude of the processed signal. phase (float): Phase shift of the processed signal in degrees. it (float): I component of the processed signal. qt (float): Q component of the processed signal.
- Return type:
ampl (float)
- start()#
Starts the instrument.
- stop()#
Stops the instrument.