qibolab.instruments package#

Subpackages#

Submodules#

qibolab.instruments.abstract module#

class qibolab.instruments.abstract.Instrument(name, address)[source]#

Bases: ABC

Parent class for all the instruments connected via TCPIP.

Parameters:
  • name (str) – Instrument name.

  • address (str) – Instrument network address.

abstract connect()[source]#

Establish connection to the physical instrument.

abstract setup(*args, **kwargs)[source]#

Upload settings to the physical instrument.

abstract start()[source]#

Turn on the physical instrument.

abstract stop()[source]#

Turn off the physical instrument.

abstract disconnect()[source]#

Close connection to the physical instrument.

class qibolab.instruments.abstract.Controller(name, address)[source]#

Bases: Instrument

Instrument that can play pulses (using waveform generator).

PortType#

Class used by the instrument to instantiate ports.

alias of Port

ports(port_name)[source]#

Get ports associated to this controller.

Parameters:

port_name – Identifier for the port. The type of the identifier depends on the specialized port defined for each instrument.

Returns:

qibolab.instruments.port.Port object providing the interface for setting instrument parameters.

abstract play(*args, **kwargs)[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.

abstract play_sequences(*args, **kwargs)[source]#

Play pulses sequences by unrolling and retrieve feedback.

Returns:

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

abstract sweep(*args, **kwargs)[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.

exception qibolab.instruments.abstract.InstrumentException(instrument: Instrument, message: str)[source]#

Bases: Exception

qibolab.instruments.dummy module#

class qibolab.instruments.dummy.DummyPort(name: str, offset: float = 0.0, lo_frequency: int = 0, lo_power: int = 0, gain: int = 0, attenuation: int = 0, power_range: int = 0, filters: dict | None = None)[source]#

Bases: Port

name: str#

Name of the port that acts as its identifier.

offset: float = 0.0#

DC offset that is applied to this port.

lo_frequency: int = 0#

Local oscillator frequency for the given port. Relevant only for controllers with internal local oscillators.

lo_power: int = 0#

Local oscillator power for the given port. Relevant only for controllers with internal local oscillators.

gain: int = 0#

Gain that is applied to this port.

attenuation: int = 0#

Attenuation that is applied to this port.

power_range: int = 0#

Similar to attenuation (negative) and gain (positive) for (Zurich instruments).

filters: dict | None = None#

Filters to be applied to the channel to reduce the distortions when sending flux pulses.

Useful for two-qubit gates. Quantum Machines (qibolab.instruments.qm.QMOPX) associate filters to channels but this may not be the case in other instruments.

class qibolab.instruments.dummy.DummyInstrument(name, address)[source]#

Bases: Controller

Dummy instrument that returns random voltage values.

Useful for testing code without requiring access to hardware.

Parameters:
  • name (str) – name of the instrument.

  • address (int) – address to connect to the instrument. Not used since the instrument is dummy, it only exists to keep the same interface with other instruments.

PortType#

alias of DummyPort

sampling_rate = 1#
connect()[source]#

Establish connection to the physical instrument.

setup(*args, **kwargs)[source]#

Upload settings to the physical instrument.

start()[source]#

Turn on the physical instrument.

stop()[source]#

Turn off the physical instrument.

disconnect()[source]#

Close connection to the physical instrument.

get_values(options, sequence, shape)[source]#
play(qubits: Dict[str | int, Qubit], sequence: PulseSequence, options: ExecutionParameters)[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.

play_sequences(qubits: Dict[str | int, Qubit], sequences: List[PulseSequence], options: ExecutionParameters)[source]#

Play pulses sequences by unrolling and retrieve feedback.

Returns:

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

sweep(qubits: Dict[str | int, Qubit], sequence: PulseSequence, options: ExecutionParameters, *sweepers: List[Sweeper])[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.erasynth module#

ERAsynth drivers.

Supports the ERAsynth ++.

https://qcodes.github.io/Qcodes_contrib_drivers/_modules/qcodes_contrib_drivers/drivers/ERAInstruments/erasynth.html#ERASynthBase.clear_read_buffer

class qibolab.instruments.erasynth.ERA(name, address, ethernet=True, reference_clock_source='internal')[source]#

Bases: LocalOscillator

property frequency#
property power#
connect()[source]#

Connects to the instrument using the IP address set in the runcard.

setup(frequency=None, power=None, **kwargs)[source]#

Configures the instrument.

A connection to the instrument needs to be established beforehand.

Parameters:

**kwargs – dict = A dictionary of settings loaded from the runcard: kwargs[“power”] kwargs[“frequency”]

Raises:

Exception = If attempting to set a parameter without a connection to the instrument.

start()[source]#

Turn on the physical instrument.

stop()[source]#

Turn off the physical instrument.

disconnect()[source]#

Close connection to the physical instrument.

on()[source]#
off()[source]#
close()[source]#

qibolab.instruments.icarusq module#

class qibolab.instruments.icarusq.TektronixAWG5204(name, address)[source]#

Bases: Instrument

rw_property_wrapper()#
connect()[source]#

Establish connection to the physical instrument.

setup(**kwargs)[source]#

Upload settings to the physical instrument.

generate_waveforms_from_pulse(pulse: Pulse, time_array: ndarray)[source]#

Generates a numpy array based on the pulse parameters

Parameters:
translate(sequence: List[Pulse], nshots=None)[source]#

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

Uploads a nchannels X nsamples array to the AWG, load it into memory and assign it to the channels for playback.

start()[source]#

Turn on the physical instrument.

play_sequence()[source]#
stop()[source]#

Turn off the physical instrument.

disconnect()[source]#

Close connection to the physical instrument.

close()[source]#
class qibolab.instruments.icarusq.MCAttenuator(name, address)[source]#

Bases: Instrument

Driver for the MiniCircuit RCDAT-8000-30 variable attenuator.

connect()[source]#

Establish connection to the physical instrument.

setup(attenuation: float, **kwargs)[source]#

Assigns the attenuation level on the attenuator.

Parameters:
  • attenuation(float

  • ) – Attenuation setting in dB. Ranges from 0 to 35.

start()[source]#

Turn on the physical instrument.

stop()[source]#

Turn off the physical instrument.

disconnect()[source]#

Close connection to the physical instrument.

class qibolab.instruments.icarusq.QuicSyn(name, address)[source]#

Bases: Instrument

Driver for the National Instrument QuicSyn Lite local oscillator.

connect()[source]#

Establish connection to the physical instrument.

setup(frequency: float, **kwargs)[source]#

Sets the frequency in Hz.

frequency(frequency)[source]#
start()[source]#

Starts the instrument.

stop()[source]#

Stops the instrument.

disconnect()[source]#

Close connection to the physical instrument.

class qibolab.instruments.icarusq.AlazarADC(name, address)[source]#

Bases: Instrument

Driver for the AlazarTech ATS9371 ADC.

connect()[source]#

Establish connection to the physical instrument.

setup(trigger_volts, **kwargs)[source]#

Sets the frequency in Hz.

arm(nshots, readout_start)[source]#
play_sequence_and_acquire()[source]#

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

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

Starts the instrument.

stop()[source]#

Stops the instrument.

disconnect()[source]#

Close connection to the physical instrument.

qibolab.instruments.icarusqfpga module#

class qibolab.instruments.icarusqfpga.PulseBlaster(name, address, port=5000)[source]#

Bases: Instrument

Driver for the 24-pin PulseBlaster TTL signal generator.

setup(holdtime_ns, pins=None, **kwargs)[source]#

Setup the PulseBlaster.

Parameters:
  • holdtime_ns (int) – TTL pulse length and delay between TTL pulses. The experiment repetition frequency is 1 / (2 * holdtime_ns).

  • pins (int) – Pins to trigger in hex, defaults to all pins.

arm(nshots, readout_start=0)[source]#

Arm the PulseBlaster for playback. Sends a signal to the instrument to setup the pulse sequence and repetition.

Parameters:

nshots (int) – Number of TTL triggers to repeat.

fire()[source]#

Starts the PulseBlaster.

start()[source]#

Turn on the physical instrument.

stop()[source]#

Turn off the physical instrument.

status()[source]#
play_sequence()[source]#
connect()[source]#

Establish connection to the physical instrument.

disconnect()[source]#

Close connection to the physical instrument.

class qibolab.instruments.icarusqfpga.IcarusQFPGA(name, address, port=8080)[source]#

Bases: Instrument

Driver for the IcarusQ RFSoC socket-based implementation.

setup(dac_sampling_rate, adcs_to_read, **kwargs)[source]#

Sets the sampling rate of the RFSoC. May need to be repeated several times due to multi-tile sync error.

Parameters:
  • dac_sampling_rate_id (int) – Sampling rate ID to be set on the RFSoC.

  • dac_sampling_rate_6g_id (int) – Optional sampling rate ID for the 6GS/s mode if used.

translate(sequence: List[Pulse], nshots)[source]#

Translates the pulse sequence into a numpy array.

upload(waveform)[source]#

Uploads a numpy array of size DAC_CHANNELS X DAC_SAMPLE_SIZE to the PL memory.

Parameters:

waveform (numpy.ndarray) – Numpy array of size DAC_CHANNELS X DAC_SAMPLE_SIZE with type signed short.

play_sequence()[source]#

DACs are automatically armed for playbacked when waveforms are loaded, no need to signal

play_sequence_and_acquire()[source]#

Signal the RFSoC to arm the ADC and start data transfer into PS memory. Starts a thread to listen for ADC data from the RFSoC.

Parameters:

nshots (int) – Number of shots.

result(readout_frequency, readout_channel)[source]#

Returns the processed signal result from the ADC.

Parameters:
  • readout_frequency (float) – Frequency to be used for signal processing.

  • readout_channel (int) – Channel 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()[source]#

Turn on the physical instrument.

connect()[source]#

Establish connection to the physical instrument.

stop()[source]#

Turn off the physical instrument.

disconnect()[source]#

Close connection to the physical instrument.

qibolab.instruments.oscillator module#

class qibolab.instruments.oscillator.LocalOscillator(name, address)[source]#

Bases: Instrument

Abstraction for local oscillator instruments.

Local oscillators are used to upconvert signals, when the controllers cannot send sufficiently high frequencies to address the qubits and resonators. They cannot be used to play or sweep pulses.

property frequency#
property power#
connect()[source]#

Establish connection to the physical instrument.

setup(power=None, frequency=None, **kwargs)[source]#

Upload settings to the physical instrument.

start()[source]#

Turn on the physical instrument.

stop()[source]#

Turn off the physical instrument.

disconnect()[source]#

Close connection to the physical instrument.

qibolab.instruments.port module#

class qibolab.instruments.port.Port[source]#

Bases: object

Abstract interface for instrument parameters.

These parameters are exposed to the user through qibolab.channels.Channel.

Drivers should subclass this interface and implement the getters and setters for all the parameters that are available for the corresponding instruments.

Each port is identified by the name attribute. Note that the type of the identifier can be different of each port implementation.

name: str#

Name of the port that acts as its identifier.

offset: float#

DC offset that is applied to this port.

lo_frequency: float#

Local oscillator frequency for the given port. Relevant only for controllers with internal local oscillators.

lo_power: float#

Local oscillator power for the given port. Relevant only for controllers with internal local oscillators.

gain: float#

Gain that is applied to this port.

attenuation: float#

Attenuation that is applied to this port.

power_range: int#

Similar to attenuation (negative) and gain (positive) for (Zurich instruments).

filters: dict#

Filters to be applied to the channel to reduce the distortions when sending flux pulses.

Useful for two-qubit gates. Quantum Machines (qibolab.instruments.qm.QMOPX) associate filters to channels but this may not be the case in other instruments.

qibolab.instruments.qutech module#

Class to interface with the SPI Rack Qutech Delft.

class qibolab.instruments.qutech.SPI(name, address)[source]#

Bases: Instrument

property_wrapper(device, *parameter)#
connect()[source]#

Connects to the instrument using the IP address set in the runcard.

setup(**kwargs)[source]#

Upload settings to the physical instrument.

set_SPI_DACS_to_cero()[source]#
get_SPI_IDN()[source]#
get_SPI_temperature()[source]#
get_SPI_battery_voltage()[source]#
disconnect()[source]#

Close connection to the physical instrument.

close()[source]#
start()[source]#

Turn on the physical instrument.

stop()[source]#

Turn off the physical instrument.

qibolab.instruments.rohde_schwarz module#

RohdeSchwarz driver.

Supports the following Instruments:

SGS100A

https://qcodes.github.io/Qcodes/api/generated/qcodes.instrument_drivers.rohde_schwarz.html#module-qcodes.instrument_drivers.rohde_schwarz.SGS100A

class qibolab.instruments.rohde_schwarz.SGS100A(name, address, ref_osc_source='EXT')[source]#

Bases: LocalOscillator

property frequency#
property power#
property ref_osc_source#
connect()[source]#

Connects to the instrument using the IP address set in the runcard.

setup(frequency=None, power=None, ref_osc_source=None, **kwargs)[source]#

Configures the instrument.

A connection to the instrument needs to be established beforehand.

Parameters:

**kwargs – dict = A dictionary of settings loaded from the runcard: kwargs[“power”] kwargs[“frequency”]

Raises:

Exception = If attempting to set a parameter without a connection to the instrument.

start()[source]#

Turn on the physical instrument.

stop()[source]#

Turn off the physical instrument.

disconnect()[source]#

Close connection to the physical instrument.

on()[source]#
off()[source]#
close()[source]#

qibolab.instruments.zhinst module#

Instrument for using the Zurich Instruments (Zhinst) devices.

qibolab.instruments.zhinst.COMPILER_SETTINGS = {'SHFSG_FORCE_COMMAND_TABLE': True, 'SHFSG_MIN_PLAYWAVE_HINT': 32, 'SHFSG_MIN_PLAYZERO_HINT': 32}#

Translating to Zurich ExecutionParameters

qibolab.instruments.zhinst.select_pulse(pulse, pulse_type)[source]#

Pulse translation

class qibolab.instruments.zhinst.ZhPort(name: Tuple[str, str], offset: float = 0.0, power_range: int = 0)[source]#

Bases: Port

name: Tuple[str, str]#

Name of the port that acts as its identifier.

offset: float = 0.0#

DC offset that is applied to this port.

power_range: int = 0#

Similar to attenuation (negative) and gain (positive) for (Zurich instruments).

class qibolab.instruments.zhinst.ZhPulse(pulse)[source]#

Bases: object

Zurich pulse from qibolab pulse translation.

pulse#

Qibolab pulse

signal#

Line associated with the pulse

zhpulse#

Zurich pulse

class qibolab.instruments.zhinst.ZhSweeper(pulse, sweeper, qubit)[source]#

Bases: object

Zurich sweeper from qibolab sweeper for pulse parameters Amplitude, Duration, Frequency (and maybe Phase)

sweeper#

Qibolab sweeper

pulse#

Qibolab pulse associated to the sweeper

signal#

Line associated with the pulse

zhpulse#

Zurich pulse associated to the sweeper

zhsweeper#

Zurich sweeper

zhsweepers#

Zurich sweepers, Need something better to store multiple sweeps on the same pulse

Not properly implemented as it was only used on Rabi amplitude vs lenght and it was an unused routine.

static select_sweeper(ptype, sweeper, qubit)[source]#

Sweeper translation

add_sweeper(sweeper, qubit)[source]#

Add sweeper to list of sweepers

class qibolab.instruments.zhinst.ZhSweeperLine(sweeper, qubit=None, sequence=None)[source]#

Bases: object

Zurich sweeper from qibolab sweeper for non pulse parameters Bias, Delay (, power_range, local_oscillator frequency, offset ???)

For now Parameter.bias sweepers are implemented as Parameter.Amplitude on a flux pulse. We may want to keep this class separate for future Near Time sweeps

sweeper#

Qibolab sweeper

static select_sweeper(sweeper)[source]#

Sweeper translation

class qibolab.instruments.zhinst.Zurich(name, descriptor, use_emulation=False, time_of_flight=0.0, smearing=0.0)[source]#

Bases: Controller

Zurich driver main class

PortType#

alias of ZhPort

name: InstrumentId#

Setup name (str)

descriptor#

Port and device mapping in yaml text (str)

It should be used as a template by adding extra lines for each of the different frequency pulses played thought the same port after parsing the sequence.

emulation#

Enable emulation mode (bool)

is_connected: bool#

Is the device connected ? (bool)

signal_map#

Signals to lines mapping

calibration#

Zurich calibration object)

device#

Zurich device parameters for connection

chip#

Parameters read from the runcard not part of ExecutionParameters

results#

Zurich experiment definitions

acquisition_type#

To store if the AcquisitionType.SPECTROSCOPY needs to be enabled by parsing the sequence

sequence#

Zurich pulse sequence

nt_sweeps#

Storing sweepers

connect()[source]#

Establish connection to the physical instrument.

create_device_setup()[source]#

Loads the device setup to address the instruments

start()[source]#

Empty method to comply with Instrument interface.

stop()[source]#

Empty method to comply with Instrument interface.

disconnect()[source]#

Close connection to the physical instrument.

setup(*args, **kwargs)[source]#

Empty method to comply with Instrument interface.

calibration_step(qubits, options)[source]#

Zurich general pre experiment calibration definitions

Change to get frequencies from sequence

register_readout_line(qubit, intermediate_frequency)[source]#

Registers qubit measure and acquire lines to calibration and signal map.

Note

To allow debugging with and oscilloscope, just set the following:

self.calibration[f"/logical_signal_groups/q{q}/measure_line"] = lo.SignalCalibration(
    ...,
    local_oscillator=lo.Oscillator(
        ...
        frequency=0.0,
    ),
    ...,
    port_mode=lo.PortMode.LF,
    ...,
)
register_drive_line(qubit, intermediate_frequency)[source]#

Registers qubit drive line to calibration and signal map.

register_flux_line(qubit)[source]#

Registers qubit flux line to calibration and signal map.

run_exp()[source]#

Compilation settings, compilation step, execution step and data retrival

static frequency_from_pulses(qubits, sequence)[source]#

Gets the frequencies from the pulses to the qubits

experiment_flow(qubits, sequence, options, sweepers=[])[source]#

Create the experiment object for the devices, following the steps separated one on each method: Translation, Calibration, Experiment Definition.

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

Play pulse sequence

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

Qibo sequence to Zurich sequence

create_exp(qubits, options)[source]#

Zurich experiment initialization usig their Experiment class

define_exp(qubits, exp_options, exp, exp_calib)[source]#

Real time definition

select_exp(exp, qubits, exp_options)[source]#

Build Zurich Experiment selecting the relevant sections

static play_sweep_select_single(exp, qubit, pulse, section, parameters, partial_sweep)[source]#

Play Zurich pulse when a single sweeper is involved

static play_sweep_select_dual(exp, qubit, pulse, section, parameters)[source]#

Play Zurich pulse when a two sweepers are involved on the same pulse

play_sweep(exp, qubit, pulse, section)[source]#

Takes care of playing the sweepers and involved pulses for different options

flux(exp, qubits)[source]#

qubit flux or qubit coupler flux for bias sweep or pulses

drive(exp, qubits)[source]#

qubit driving pulses

static play_after_set(sequence, ptype)[source]#

Selects after which section the measurement goes

measure_relax(exp, qubits, relaxation_time, acquisition_type)[source]#

qubit readout pulse, data acquisition and qubit relaxation

fast_reset(exp, qubits, fast_reset)[source]#

Conditional fast reset after readout - small delay for signal processing This is a very naive approach that can be improved by repeating this step until we reach non fast reset fidelity https://quantum-computing.ibm.com/lab/docs/iql/manage/systems/reset/backend_reset

static rearrange_sweepers(sweepers)[source]#

Rearranges sweepers from qibocal based on device hardware limitations

offsets_off()[source]#

Sets the offsets from the HDAWGs to 0 after each experiment

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

Play pulse and sweepers sequence

sweep_recursion(qubits, exp, exp_calib, exp_options)[source]#

Sweepers recursion for multiple nested Real Time sweepers

sweep_recursion_nt(qubits, options, exp, exp_calib)[source]#

Sweepers recursion for Near Time sweepers. Faster than regular software sweepers as they are executed on the actual device by (software ? or slower hardware ones)

You want to avoid them so for now they are implement for a specific sweep.

play_sequences(qubits, sequence, options)[source]#

Play pulses sequences by unrolling and retrieve feedback.

Returns:

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

play_sim(qubits, sequence, options, sim_time)[source]#

Play pulse sequence

run_sim(sim_time)[source]#

Run the simulation

Parameters:

sim_time (float) – Time[s] to simulate starting from 0