qibolab.instruments.qblox package#
Submodules#
qibolab.instruments.qblox.cluster module#
Qblox instruments driver.
Supports the following Instruments:
-Cluster -Cluster QRM-RF -Cluster QCM-RF -Cluster QCM
Compatible with qblox-instruments driver 0.9.0 (28/2/2023). It supports:
multiplexed readout of up to 6 qubits
hardware modulation, demodulation, and classification
software modulation, with support for arbitrary pulses
software demodulation
binned acquisition
- real-time sweepers of
pulse frequency (requires hardware modulation)
pulse relative phase (requires hardware modulation)
pulse amplitude
pulse start
pulse duration
port gain
port offset
multiple readouts for the same qubit (sequence unrolling)
max iq pulse length 8_192ns
waveforms cache, uses additional free sequencers if the memory of one sequencer (16384) is exhausted
instrument parameters cache
safe disconnection of offsets on termination
The operation of multiple clusters simultaneously is not supported yet. https://qblox-qblox-instruments.readthedocs-hosted.com/en/master/
- class qibolab.instruments.qblox.cluster.ReferenceClockSource(value)[source]#
Bases:
Enum
An enumeration.
- INTERNAL = 'internal'#
- EXTERNAL = 'external'#
- class qibolab.instruments.qblox.cluster.Cluster_Settings(reference_clock_source: ReferenceClockSource = ReferenceClockSource.INTERNAL)[source]#
Bases:
object
Settings of the Cluster instrument.
- reference_clock_source: ReferenceClockSource = 'internal'#
Instruct the cluster to use the internal clock source or an external source.
- class qibolab.instruments.qblox.cluster.Cluster(name: str, address: str, settings: ~qibolab.instruments.qblox.cluster.Cluster_Settings = Cluster_Settings(reference_clock_source=<ReferenceClockSource.INTERNAL: 'internal'>))[source]#
Bases:
Instrument
A class to extend the functionality of qblox_instruments Cluster.
The class exposes the attribute reference_clock_source to enable the selection of an internal or external clock source.
- The class inherits from
qibolab.instruments.abstract.Instrument
and implements its interface methods: __init__() connect() setup() start() stop() disconnect()
- device: QbloxCluster#
Reference to the underlying qblox_instruments.qcodes_drivers.cluster.Cluster object.
- settings: Cluster_Settings#
Instrument settings.
- property reference_clock_source: ReferenceClockSource#
- The class inherits from
qibolab.instruments.qblox.cluster_qcm_bb module#
Qblox Cluster QCM driver.
- class qibolab.instruments.qblox.cluster_qcm_bb.ClusterQCM_BB_Settings(ports=None)[source]#
Bases:
object
- class qibolab.instruments.qblox.cluster_qcm_bb.ClusterQCM_BB(name: str, address: str, settings: dict)[source]#
Bases:
Instrument
Qblox Cluster Qubit Control Module Baseband driver.
Qubit Control Module (QCM) is an arbitratry wave generator with two DACs connected to four output ports. It can sinthesise either four independent real signals or two complex signals, using ports 0 and 2 to output the i(in-phase) component and ports 1 and 3 the q(quadrature) component. The sampling rate of its DAC is 1 GSPS. https://www.qblox.com/cluster
The class aims to simplify the configuration of the instrument, exposing only those parameters most frequencly used and hiding other more complex components.
A reference to the underlying qblox_instruments.qcodes_drivers.qcm_qrm.QRM_QCM object is provided via the attribute device, allowing the advanced user to gain access to the features that are not exposed directly by the class.
In order to accelerate the execution, the instrument settings are cached, so that the communication with the instrument only happens when the parameters change. This caching is done with the method _set_device_parameter(target, *parameters, value).
ports: o1: channel : L4-1 gain : 0.2 # -1.0<=v<=1.0 offset : 0 # -2.5<=v<=2.5 o2: channel : L4-2 gain : 0.2 # -1.0<=v<=1.0 offset : 0 # -2.5<=v<=2.5 o3: channel : L4-3 gain : 0.2 # -1.0<=v<=1.0 offset : 0 # -2.5<=v<=2.5 o4: channel : L4-4 gain : 0.2 # -1.0<=v<=1.0 offset : 0 # -2.5<=v<=2.5
- device#
A reference to the underlying qblox_instruments.qcodes_drivers.qcm_qrm.QcmQrm object. It can be used to access other features not directly exposed by this wrapper. https://qblox-qblox-instruments.readthedocs-hosted.com/en/master/api_reference/qcm_qrm.html
- Type:
QbloxQrmQcm
- ports = A dictionary giving access to the output ports objects.
ports[‘o1’]
ports[‘o2’]
ports[‘o3’]
ports[‘o4’]
ports[‘oX’].channel (int | str): the id of the refrigerator channel the port is connected to.
- ports[‘oX’].gain (float): (mapped to qrm.sequencers[0].gain_awg_path0 and qrm.sequencers[0].gain_awg_path1)
Sets the gain on both paths of the output port.
- ports[‘oX’].offset (float): (mapped to qrm.outX_offset)
Sets the offset on the output port.
- ports[‘oX’].hardware_mod_en (bool): (mapped to qrm.sequencers[0].mod_en_awg) Enables pulse
modulation in hardware. When set to False, pulse modulation is done at the host computer and a modulated pulse waveform should be uploaded to the instrument. When set to True, the envelope of the pulse should be uploaded to the instrument and it modulates it in real time by its FPGA using the sequencer nco (numerically controlled oscillator).
ports[‘oX’].nco_freq (int): (mapped to qrm.sequencers[0].nco_freq) # TODO mapped, but not configurable from the runcard
ports[‘oX’].nco_phase_offs = (mapped to qrm.sequencers[0].nco_phase_offs) # TODO mapped, but not configurable from the runcard
Sequencer 0 is always the first sequencer used to synthesise pulses on port o1.
Sequencer 1 is always the first sequencer used to synthesise pulses on port o2.
Sequencer 2 is always the first sequencer used to synthesise pulses on port o3.
Sequencer 3 is always the first sequencer used to synthesise pulses on port o4.
Sequencer 4 to 6 are used as needed to sinthesise simultaneous pulses on the same channel or when the memory of the default sequencers rans out.
- DEFAULT_SEQUENCERS = {'o1': 0, 'o2': 1, 'o3': 2, 'o4': 3}#
- FREQUENCY_LIMIT = 500000000.0#
- property_wrapper(*parameter)#
- sequencer_property_wrapper(sequencer, *parameter)#
- connect(cluster: Cluster)[source]#
Connects to the instrument using the instrument settings in the runcard.
Once connected, it creates port classes with properties mapped to various instrument parameters, and initialises the the underlying device parameters.
- setup()[source]#
Configures the instrument with the settings of the runcard.
A connection to the instrument needs to be established beforehand. :param **kwargs: dict = A dictionary of settings loaded from the runcard:
oX: [‘o1’, ‘o2’, ‘o3’, ‘o4’]
kwargs[‘ports’][‘oX’][‘channel’] (int | str): the id of the refrigerator channel the port is connected to.
kwargs[‘ports’][oX][‘gain’] (float): [0.0 - 1.0 unitless] gain applied prior to up-conversion. Qblox recommends to keep pulse_amplitude * gain below 0.3 to ensure the mixers are working in their linear regime, if necessary, lowering the attenuation applied at the output.
kwargs[‘ports’][oX][‘offset’] (float): [-2.5 - 2.5 V] offset in volts applied to the output port.
kwargs[‘ports’][oX][‘hardware_mod_en’] (bool): enables Hardware Modulation. In this mode, pulses are modulated to the intermediate frequency using the numerically controlled oscillator within the fpga. It only requires the upload of the pulse envelope waveform.
- Raises:
Exception = If attempting to set a parameter without a connection to the instrument. –
- get_if(pulse)[source]#
Returns the intermediate frequency needed to synthesise a pulse based on the port lo frequency.
- process_pulse_sequence(qubits: dict, instrument_pulses: PulseSequence, navgs: int, nshots: int, repetition_duration: int, sweepers=None)[source]#
Processes a list of pulses, generating the waveforms and sequence program required by the instrument to synthesise them.
The output of the process is a list of sequencers used for each port, configured with the information required to play the sequence. The following features are supported:
overlapping pulses
hardware modulation
software modulation, with support for arbitrary pulses
real-time sweepers of
pulse frequency (requires hardware modulation)
pulse relative phase (requires hardware modulation)
pulse amplitude
pulse start
pulse duration
port gain
port offset
sequencer memory optimisation (waveforms cache)
extended waveform memory with the use of multiple sequencers
pulses of up to 8192 pairs of i, q samples
intrument parameters cache
- Parameters:
instrument_pulses (PulseSequence) – A collection of Pulse objects to be played by the instrument.
navgs (int) – The number of times the sequence of pulses should be executed averaging the results.
nshots (int) – The number of times the sequence of pulses should be executed without averaging.
repetition_duration (int) – The total duration of the pulse sequence execution plus the reset/relaxation time.
sweepers (list(Sweeper)) – A list of Sweeper objects to be implemented.
- upload()[source]#
Uploads waveforms and programs of all sequencers and arms them in preparation for execution.
This method should be called after process_pulse_sequence(). It configures certain parameters of the instrument based on the needs of resources determined while processing the pulse sequence.
qibolab.instruments.qblox.cluster_qcm_rf module#
Qblox Cluster QCM-RF driver.
- class qibolab.instruments.qblox.cluster_qcm_rf.ClusterQCM_RF_Settings(ports=None)[source]#
Bases:
object
- class qibolab.instruments.qblox.cluster_qcm_rf.ClusterQCM_RF(name: str, address: str, settings: ClusterQCM_RF_Settings)[source]#
Bases:
Instrument
Qblox Cluster Qubit Control Module RF driver.
Qubit Control Module RF (QCM-RF) is an instrument that integrates an arbitratry wave generator, with a local oscillator and a mixer. It has two output ports Each port has a path0 and path1 for the i(in-phase) and q(quadrature) components of the RF signal. The sampling rate of its ADC/DAC is 1 GSPS. https://www.qblox.com/cluster
The class aims to simplify the configuration of the instrument, exposing only those parameters most frequencly used and hiding other more complex components.
A reference to the underlying qblox_instruments.qcodes_drivers.qcm_qrm.QRM_QCM object is provided via the attribute device, allowing the advanced user to gain access to the features that are not exposed directly by the class.
In order to accelerate the execution, the instrument settings are cached, so that the communication with the instrument only happens when the parameters change. This caching is done with the method _set_device_parameter(target, *parameters, value).
ports: o1: # output port settings channel : L3-11 attenuation : 24 # (dB) 0 to 60, must be multiple of 2 lo_enabled : true lo_frequency : 4_042_590_000 # (Hz) from 2e9 to 18e9 gain : 0.17 # for path0 and path1 -1.0<=v<=1.0 o2: channel : L3-12 attenuation : 24 # (dB) 0 to 60, must be multiple of 2 lo_enabled : true lo_frequency : 5_091_155_529 # (Hz) from 2e9 to 18e9 gain : 0.28 # for path0 and path1 -1.0<=v<=1.0
- device#
A reference to the underlying qblox_instruments.qcodes_drivers.qcm_qrm.QcmQrm object. It can be used to access other features not directly exposed by this wrapper. https://qblox-qblox-instruments.readthedocs-hosted.com/en/master/api_reference/qcm_qrm.html
- Type:
QbloxQrmQcm
- ports = A dictionary giving access to the output ports objects.
ports[‘o1’]
ports[‘o2’]
ports[‘o1’].channel (int | str): the id of the refrigerator channel the port is connected to.
ports[‘o1’].attenuation (int): (mapped to qrm.out0_att) Controls the attenuation applied to the output port. Must be a multiple of 2
ports[‘o1’].lo_enabled (bool): (mapped to qrm.out0_in0_lo_en) Enables or disables the local oscillator.
ports[‘o1’].lo_frequency (int): (mapped to qrm.out0_in0_lo_freq) Sets the frequency of the local oscillator.
ports[‘o1’].gain (float): (mapped to qrm.sequencers[0].gain_awg_path0 and qrm.sequencers[0].gain_awg_path1) Sets the gain on both paths of the output port.
ports[‘o1’].hardware_mod_en (bool): (mapped to qrm.sequencers[0].mod_en_awg) Enables pulse modulation in hardware. When set to False, pulse modulation is done at the host computer and a modulated pulse waveform should be uploaded to the instrument. When set to True, the envelope of the pulse should be uploaded to the instrument and it modulates it in real time by its FPGA using the sequencer nco (numerically controlled oscillator).
ports[‘o1’].nco_freq (int): (mapped to qrm.sequencers[0].nco_freq) # TODO mapped, but not configurable from the runcard
ports[‘o1’].nco_phase_offs = (mapped to qrm.sequencers[0].nco_phase_offs) # TODO mapped, but not configurable from the runcard
ports[‘o2’].channel (int | str): the id of the refrigerator channel the port is connected to.
ports[‘o2’].attenuation (int): (mapped to qrm.out1_att) Controls the attenuation applied to the output port. Must be a multiple of 2
ports[‘o2’].lo_enabled (bool): (mapped to qrm.out1_lo_en) Enables or disables the local oscillator.
ports[‘o2’].lo_frequency (int): (mapped to qrm.out1_lo_freq) Sets the frequency of the local oscillator.
ports[‘o2’].gain (float): (mapped to qrm.sequencers[1].gain_awg_path0 and qrm.sequencers[0].gain_awg_path1) Sets the gain on both paths of the output port.
ports[‘o2’].hardware_mod_en (bool): (mapped to qrm.sequencers[1].mod_en_awg) Enables pulse modulation in hardware. When set to False, pulse modulation is done at the host computer and a modulated pulse waveform should be uploaded to the instrument. When set to True, the envelope of the pulse should be uploaded to the instrument and it modulates it in real time by its FPGA using the sequencer nco (numerically controlled oscillator).
ports[‘o2’].nco_freq (int): (mapped to qrm.sequencers[1].nco_freq) # TODO mapped, but not configurable from the runcard
ports[‘o2’].nco_phase_offs = (mapped to qrm.sequencers[1].nco_phase_offs) # TODO mapped, but not configurable from the runcard
Sequencer 0 is always the first sequencer used to synthesise pulses on port o1.
Sequencer 1 is always the first sequencer used to synthesise pulses on port o2.
Sequencer 2 to 6 are used as needed to sinthesise simultaneous pulses on the same channel or when the memory of the default sequencers rans out.
- DEFAULT_SEQUENCERS = {'o1': 0, 'o2': 1}#
- FREQUENCY_LIMIT = 500000000.0#
- property_wrapper(*parameter)#
A lambda function used to create properties that wrap around the device parameters and caches their value using _set_device_parameter().
- sequencer_property_wrapper(sequencer, *parameter)#
A lambda function used to create properties that wrap around the device sequencer parameters and caches their value using _set_device_parameter().
- connect(cluster: Cluster)[source]#
Connects to the instrument using the instrument settings in the runcard.
Once connected, it creates port classes with properties mapped to various instrument parameters, and initialises the the underlying device parameters.
- setup()[source]#
Configures the instrument with the settings of the runcard.
A connection to the instrument needs to be established beforehand. :param **kwargs: dict = A dictionary of settings loaded from the runcard:
kwargs[‘ports’][‘o1’][‘channel’] (int | str): the id of the refrigerator channel the output port o1 is connected to.
kwargs[‘ports’][‘o1’][‘attenuation’] (int): [0 to 60 dBm, in multiples of 2] attenuation at the output.
kwargs[‘ports’][‘o1’][‘lo_enabled’] (bool): enable or disable local oscillator for up-conversion.
kwargs[‘ports’][‘o1’][‘lo_frequency’] (int): [2_000_000_000 to 18_000_000_000 Hz] local oscillator frequency.
kwargs[‘ports’][‘o1’][‘gain’] (float): [0.0 - 1.0 unitless] gain applied prior to up-conversion. Qblox recommends to keep pulse_amplitude * gain below 0.3 to ensure the mixers are working in their linear regime, if necessary, lowering the attenuation applied at the output.
kwargs[‘ports’][‘o1’][‘hardware_mod_en’] (bool): enables Hardware Modulation. In this mode, pulses are modulated to the intermediate frequency using the numerically controlled oscillator within the fpga. It only requires the upload of the pulse envelope waveform.
kwargs[‘ports’][‘o2’][‘channel’] (int | str): the id of the refrigerator channel the output port o2 is connected to.
kwargs[‘ports’][‘o2’][‘attenuation’] (int): [0 to 60 dBm, in multiples of 2] attenuation at the output.
kwargs[‘ports’][‘o2’][‘lo_enabled’] (bool): enable or disable local oscillator for up-conversion.
kwargs[‘ports’][‘o2’][‘lo_frequency’] (int): [2_000_000_000 to 18_000_000_000 Hz] local oscillator frequency.
kwargs[‘ports’][‘o2’][‘gain’] (float): [0.0 - 1.0 unitless] gain applied prior to up-conversion. Qblox recommends to keep pulse_amplitude * gain below 0.3 to ensure the mixers are working in their linear regime, if necessary, lowering the attenuation applied at the output.
kwargs[‘ports’][‘o2’][‘hardware_mod_en’] (bool): enables Hardware Modulation. In this mode, pulses are modulated to the intermediate frequency using the numerically controlled oscillator within the fpga. It only requires the upload of the pulse envelope waveform.
- Raises:
Exception = If attempting to set a parameter without a connection to the instrument. –
- get_if(pulse)[source]#
Returns the intermediate frequency needed to synthesise a pulse based on the port lo frequency.
- process_pulse_sequence(qubits: dict, instrument_pulses: PulseSequence, navgs: int, nshots: int, repetition_duration: int, sweepers=None)[source]#
Processes a sequence of pulses and sweepers, generating the waveforms and program required by the instrument to synthesise them.
The output of the process is a list of sequencers used for each port, configured with the information required to play the sequence. The following features are supported:
overlapping pulses
hardware modulation
software modulation, with support for arbitrary pulses
real-time sweepers of
pulse frequency (requires hardware modulation)
pulse relative phase (requires hardware modulation)
pulse amplitude
pulse start
pulse duration
port gain
port offset
sequencer memory optimisation (waveforms cache)
extended waveform memory with the use of multiple sequencers
pulses of up to 8192 pairs of i, q samples
intrument parameters cache
- Parameters:
instrument_pulses (PulseSequence) – A collection of Pulse objects to be played by the instrument.
navgs (int) – The number of times the sequence of pulses should be executed averaging the results.
nshots (int) – The number of times the sequence of pulses should be executed without averaging.
repetition_duration (int) – The total duration of the pulse sequence execution plus the reset/relaxation time.
sweepers (list(Sweeper)) – A list of Sweeper objects to be implemented.
- upload()[source]#
Uploads waveforms and programs of all sequencers and arms them in preparation for execution.
This method should be called after process_pulse_sequence(). It configures certain parameters of the instrument based on the needs of resources determined while processing the pulse sequence.
qibolab.instruments.qblox.cluster_qrm_rf module#
Qblox Cluster QRM-RF driver.
- class qibolab.instruments.qblox.cluster_qrm_rf.ClusterQRM_RF_Settings(ports=None)[source]#
Bases:
object
- class qibolab.instruments.qblox.cluster_qrm_rf.ClusterQRM_RF(name: str, address: str, settings: ClusterQRM_RF_Settings)[source]#
Bases:
Instrument
Qblox Cluster Qubit Readout Module RF driver.
Qubit Readout Module RF (QRM-RF) is an instrument that integrates an arbitrary wave generator, a digitizer, a local oscillator and a mixer. It has one output and one input port. Each port has a path0 and path1 for the i(in-phase) and q(quadrature) components of the RF signal. The sampling rate of its ADC/DAC is 1 GSPS. https://www.qblox.com/cluster
The class aims to simplify the configuration of the instrument, exposing only those parameters most frequently used and hiding other more complex settings.
A reference to the underlying qblox_instruments.qcodes_drivers.qcm_qrm.QRM_QCM object is provided via the attribute device, allowing the advanced user to gain access to the features that are not exposed directly by the class.
In order to accelerate the execution, the instrument settings are cached, so that the communication with the instrument only happens when the parameters change. This caching is done with the method _set_device_parameter(target, *parameters, value).
ports: o1: # output port settings channel : L3-25a attenuation : 30 # (dB) 0 to 60, must be multiple of 2 lo_enabled : true lo_frequency : 6_000_000_000 # (Hz) from 2e9 to 18e9 gain : 1 # for path0 and path1 -1.0<=v<=1.0 i1: # input port settings channel : L2-5a acquisition_hold_off : 130 # minimum 4ns acquisition_duration : 1800 classification_parameters: 0: # qubit id rotation_angle : 0 # in degrees 0.0<=v<=360.0 threshold : 0 # in V 1: rotation_angle : 194.272 threshold : 0.011197 2: rotation_angle : 104.002 threshold : 0.012745
- device#
A reference to the underlying qblox_instruments.qcodes_drivers.qcm_qrm.QcmQrm object. It can be used to access other features not directly exposed by this wrapper. https://qblox-qblox-instruments.readthedocs-hosted.com/en/master/api_reference/qcm_qrm.html
- Type:
QbloxQrmQcm
- ports = A dictionary giving access to the input and output ports objects.
ports[‘o1’]: Output port
ports[‘i1’]: Input port
ports[‘o1’].channel (int | str): the id of the refrigerator channel the output port o1 is connected to.
ports[‘o1’].attenuation (int): (mapped to qrm.out0_att) Controls the attenuation applied to the output port. It must be a multiple of 2.
ports[‘o1’].lo_enabled (bool): (mapped to qrm.out0_in0_lo_en) Enables or disables the local oscillator.
ports[‘o1’].lo_frequency (int): (mapped to qrm.out0_in0_lo_freq) Sets the frequency of the local oscillator.
ports[‘o1’].gain (float): (mapped to qrm.sequencers[0].gain_awg_path0 and qrm.sequencers[0].gain_awg_path1) Sets the gain on both paths of the output port.
ports[‘o1’].hardware_mod_en (bool): (mapped to qrm.sequencers[0].mod_en_awg) Enables pulse modulation in hardware. When set to False, pulse modulation is done in software, at the host computer, and the modulated pulse waveform is uploaded to the instrument. When set to True, the envelope of the pulse is uploaded to the instrument and it is modulated in real time by the FPGA of the instrument, using the sequencer nco (numerically controlled oscillator).
ports[‘o1’].nco_freq (int): (mapped to qrm.sequencers[0].nco_freq). Mapped, but not configurable from the runcard.
ports[‘o1’].nco_phase_offs = (mapped to qrm.sequencers[0].nco_phase_offs). Mapped, but not configurable from the runcard.
ports[‘i1’].channel (int | str): the id of the refrigerator channel the input port o1 is connected to.
ports[‘i1’].acquisition_hold_off (int): Delay between the moment the readout pulse starts to be played and the start of the acquisition, in ns. It must be > 0 and multiple of 4.
ports[‘i1’].acquisition_duration (int): (mapped to qrm.sequencers[0].integration_length_acq) Duration of the pulse acquisition, in ns. It must be > 0 and multiple of 4.
ports[‘i1’].hardware_demod_en (bool): (mapped to qrm.sequencers[0].demod_en_acq) Enables demodulation and integration of the acquired pulses in hardware. When set to False, the filtration, demodulation and integration of the acquired pulses is done at the host computer. When set to True, the demodulation, integration and discretization of the pulse is done in real time at the FPGA of the instrument.
Sequencer 0 is used always for acquisitions and it is the first sequencer used to synthesise pulses.
Sequencer 1 to 6 are used as needed to synthesise simultaneous pulses on the same channel (required in multiplexed readout) or when the memory of the default sequencers rans out.
- classification_parameters#
A dictionary containing the parameters needed classify the state of each qubit. from a single shot measurement:
- Type:
- qubit_id#
the id of the qubit rotation_angle (float): 0 # in degrees 0.0<=v<=360.0. The angle of the rotation applied at the origin of the i q plane, that put the centroids of the state
|0>
and state|1>
in a horizontal line. The rotation puts the centroid of state|1>
to the right side of centroid of state|0>
.- Type:
- threshold#
0 # in V. The real component of the point along the horizontal line connecting both state centroids (after being rotated), that maximises the fidelity of the classification.
- Type:
- FREQUENCY_LIMIT = 500000000.0#
- property_wrapper(*parameter)#
A lambda function used to create properties that wrap around the device parameters and caches their value using _set_device_parameter().
- sequencer_property_wrapper(sequencer, *parameter)#
A lambda function used to create properties that wrap around the device sequencer parameters and caches their value using _set_device_parameter().
- connect(cluster: Cluster)[source]#
Connects to the instrument using the instrument settings in the runcard.
Once connected, it creates port classes with properties mapped to various instrument parameters, and initialises the the underlying device parameters.
- setup()[source]#
Configures the instrument with the settings of the runcard.
A connection to the instrument needs to be established beforehand. :param **kwargs: dict = A dictionary of settings loaded from the runcard:
kwargs[‘ports’][‘o1’][‘channel’] (int | str): the id of the refrigerator channel the output port o1 is connected to.
kwargs[‘ports’][‘o1’][‘attenuation’] (int): [0 to 60 dBm, in multiples of 2] attenuation at the output.
kwargs[‘ports’][‘o1’][‘lo_enabled’] (bool): enable or disable local oscillator for up-conversion.
kwargs[‘ports’][‘o1’][‘lo_frequency’] (int): [2_000_000_000 to 18_000_000_000 Hz] local oscillator frequency.
kwargs[‘ports’][‘o1’][‘gain’] (float): [0.0 - 1.0 unitless] gain applied prior to up-conversion. Qblox recommends to keep pulse_amplitude * gain below 0.3 to ensure the mixers are working in their linear regime, if necessary, lowering the attenuation applied at the output.
kwargs[‘ports’][‘o1’][‘hardware_mod_en’] (bool): enables Hardware Modulation. In this mode, pulses are modulated to the intermediate frequency using the numerically controlled oscillator within the fpga. It only requires the upload of the pulse envelope waveform.
kwargs[‘ports’][‘i1’][‘channel’] (int | str): the id of the refrigerator channel the input port i1 is connected to.
kwargs[‘ports’][‘i1’][‘hardware_demod_en’] (bool): enables Hardware Demodulation. In this mode, the sequencers of the fpga demodulate, integrate and classify the results for every shot. Once integrated, the i and q values and the result of the classification requires much less memory, so they can be stored for every shot in separate bins and retrieved later. Hardware Demodulation also allows making multiple readouts on the same qubit at different points in the circuit, which is not possible with Software Demodulation.
kwargs[‘acquisition_hold_off’] (int): [0 to 16834 ns, in multiples of 4] the time between the moment the start of the readout pulse begins to be played, and the start of the acquisition. This is used to account for the time of flight of the pulses from the output port to the input port.
kwargs[‘acquisition_duration’] (int): [0 to 8192 ns] the duration of the acquisition. It is limited by the amount of memory available in the fpga to store i q samples.
kwargs[‘classification_parameters’][qubit_id][rotation_angle] (float): [0.0 to 359.999 deg] the angle to rotate the results so that the projection on the real axis renders the maximum fidelity.
kwargs[‘classification_parameters’][qubit_id][threshold] (float): [-1.0 to 1.0 Volt] the voltage to be used as threshold to classify the state of each shot.
- Raises:
Exception = If attempting to set a parameter without a connection to the instrument. –
- get_if(pulse: Pulse)[source]#
Returns the intermediate frequency needed to synthesise a pulse based on the port lo frequency.
- process_pulse_sequence(qubits: dict, instrument_pulses: PulseSequence, navgs: int, nshots: int, repetition_duration: int, sweepers=None)[source]#
Processes a sequence of pulses and sweepers, generating the waveforms and program required by the instrument to synthesise them.
The output of the process is a list of sequencers used for each port, configured with the information required to play the sequence. The following features are supported:
multiplexed readout of up to 6 qubits
overlapping pulses
hardware modulation, demodulation, and classification
software modulation, with support for arbitrary pulses
software demodulation
binned acquisition
real-time sweepers of
pulse frequency (requires hardware modulation)
pulse relative phase (requires hardware modulation)
pulse amplitude
pulse start
pulse duration
port gain
port offset
multiple readouts for the same qubit (sequence unrolling)
pulses of up to 8192 pairs of i, q samples
sequencer memory optimisation (waveforms cache)
extended waveform memory with the use of multiple sequencers
intrument parameters cache
- Parameters:
instrument_pulses (PulseSequence) – A collection of Pulse objects to be played by the instrument.
navgs (int) – The number of times the sequence of pulses should be executed averaging the results.
nshots (int) – The number of times the sequence of pulses should be executed without averaging.
repetition_duration (int) – The total duration of the pulse sequence execution plus the reset/relaxation time.
sweepers (list(Sweeper)) – A list of Sweeper objects to be implemented.
- upload()[source]#
Uploads waveforms and programs of all sequencers and arms them in preparation for execution.
This method should be called after process_pulse_sequence(). It configures certain parameters of the instrument based on the needs of resources determined while processing the pulse sequence.
- play_sequence()[source]#
Plays the sequence of pulses.
Starts the sequencers needed to play the sequence of pulses.
- acquire()[source]#
Retrieves the readout results.
- Returns:
Software Demodulation: Every readout pulse triggers an acquisition, where the 16384 i and q samples of the waveform acquired by the ADC are saved into a dedicated memory within the FPGA. This is what qblox calls scoped acquisition. The results of multiple shots are averaged in this memory, and cannot be retrieved independently. The resulting waveforms averages (i and q) are then demodulated and integrated in software (and finally divided by the number of samples). Since Software Demodulation relies on the data of the scoped acquisition and that data is the average of all acquisitions, only one readout pulse per qubit is supported, so that the averages all correspond to reading the same quantum state. Multiple symultaneous readout pulses on different qubits are supported. The results returned are:
acquisition_results[“averaged_raw”] (dict): a dictionary containing tuples with the averages of the i and q waveforms for every readout pulse: ([i samples], [q samples]) The data for a specific reaout pulse can be obtained either with:
acquisition_results[“averaged_raw”][ro_pulse.serial]
acquisition_results[“averaged_raw”][ro_pulse.qubit]
acquisition_results[“averaged_demodulated_integrated”] (dict): a dictionary containing tuples with the results of demodulating and integrating (averaging over time) the average of the waveforms for every pulse:
(amplitude[V], phase[rad], i[V], q[V])
The data for a specific readout pulse can be obtained either with:
acquisition_results[“averaged_demodulated_integrated”][ro_pulse.serial]
acquisition_results[“averaged_demodulated_integrated”][ro_pulse.qubit]
Or directly with:
acquisition_results[ro_pulse.serial]
acquisition_results[ro_pulse.qubit]
Hardware Demodulation: With hardware demodulation activated, the FPGA can demodulate, integrate (average over time), and classify each shot individually, saving the results on separate bins. The raw data of each acquisition continues to be averaged as with software modulation, so there is no way to access the raw data of each shot (unless executed one shot at a time). The FPGA uses fixed point arithmetic for the demodulation and integration; if the power level of the signal at the input port is low (the minimum resolution of the ADC is 240uV) rounding precission errors can accumulate and render wrong results. It is advisable to have a power level at least higher than 5mV. The results returned are:
acquisition_results[“demodulated_integrated_averaged”] (dict): a dictionary containing tuples with the results of demodulating and integrating (averaging over time) each shot waveform and then averaging of the many shots:
(amplitude[V], phase[rad], i[V], q[V])
acquisition_results[“demodulated_integrated_binned”] (dict): a dictionary containing tuples of lists with the results of demodulating and integrating every shot waveform:
([amplitudes[V]], [phases[rad]], [is[V]], [qs[V]])
acquisition_results[“demodulated_integrated_classified_binned”] (dict): a dictionary containing lists with the results of demodulating, integrating and classifying every shot:
([states[0 or 1]])
- acquisition_results[“probability”] (dict): a dictionary containing the frequency of state 1 measurements:
total number of shots classified as 1 / number of shots
If the number of readout pulses per qubit is only one, then the following is also provided:
acquisition_results[“averaged_raw”] (dict): a dictionary containing tuples with the averages of the i and q waveforms for every readout pulse:
([i samples], [q samples])
acquisition_results[“averaged_demodulated_integrated”] (dict): a dictionary containing tuples with the results of demodulating and integrating (averaging over time) the average of the waveforms for every pulse:
(amplitude[V], phase[rad], i[V], q[V])
The data within each of the above dictionaries, for a specific readout pulse or for the last readout pulse of a qubit can be retrieved either with:
acquisition_results[dictionary_name][ro_pulse.serial]
acquisition_results[dictionary_name][ro_pulse.qubit]
And acquisition_results[“averaged_demodulated_integrated”] directly with:
acquisition_results[ro_pulse.serial]
acquisition_results[ro_pulse.qubit]
- Return type:
The results returned vary depending on whether demodulation is performed in software or hardware
qibolab.instruments.qblox.controller module#
- class qibolab.instruments.qblox.controller.QbloxController(name, cluster, modules)[source]#
Bases:
Controller
A controller to manage qblox devices.
- play(qubits, 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.
- 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.
- sweep(qubits: dict, sequence: PulseSequence, options: ExecutionParameters, *sweepers)[source]#
Executes a sequence of pulses while sweeping one or more parameters.
The parameters to be swept are defined in
qibolab.sweeper.Sweeper
object. :param sequence: The sequence of pulses to execute. :type sequence:qibolab.pulses.PulseSequence
:param options: Object holding the execution options. :type options:qibolab.platforms.platform.ExecutionParameters
:param sweepers: A list of Sweeper objects defining parameter sweeps. :type sweepers: list(Sweeper)
qibolab.instruments.qblox.debug module#
- qibolab.instruments.qblox.debug.print_readable_snapshot(device, file, update: bool = False, max_chars: int = 80) None [source]#
Prints a readable version of the snapshot. The readable snapshot includes the name, value and unit of each parameter. A convenience function to quickly get an overview of the status of an instrument.
- Parameters:
update – If
True
, update the state by querying the instrument. IfFalse
, just use the latest values in memory. This argument gets passed to the snapshot function.max_chars – the maximum number of characters per line. The readable snapshot will be cropped if this value is exceeded. Defaults to 80 to be consistent with default terminal width.
qibolab.instruments.qblox.port module#
- class qibolab.instruments.qblox.port.QbloxOutputPort_Settings(channel: str = None, qubit: str = None, attenuation: int = 60, offset: float = 0.0, hardware_mod_en: bool = True, gain: float = 1.0, nco_freq: int = 0, nco_phase_offs: float = 0)[source]#
Bases:
object
- class qibolab.instruments.qblox.port.ClusterRF_OutputPort_Settings(channel: str = None, qubit: str = None, attenuation: int = 60, offset: float = 0.0, hardware_mod_en: bool = True, gain: float = 1.0, nco_freq: int = 0, nco_phase_offs: float = 0, lo_enabled: bool = True, lo_frequency: int = 2000000000)[source]#
Bases:
QbloxOutputPort_Settings
- class qibolab.instruments.qblox.port.ClusterBB_OutputPort_Settings(channel: str = None, qubit: str = None, attenuation: int = 60, offset: float = 0.0, hardware_mod_en: bool = True, gain: float = 1.0, nco_freq: int = 0, nco_phase_offs: float = 0)[source]#
Bases:
QbloxOutputPort_Settings
- class qibolab.instruments.qblox.port.QbloxInputPort_Settings(channel: str = None, acquisition_hold_off: int = 0, acquisition_duration: int = 1000, hardware_demod_en: bool = True)[source]#
Bases:
object
- class qibolab.instruments.qblox.port.QbloxOutputPort(module, sequencer_number: int, number: int)[source]#
Bases:
Port
qibolab.instruments.port.Port interface implementation for Qblox instruments
- property offset#
DC offset that is applied to this port.
- property hardware_mod_en#
Flag to enable hardware modulation.
- property nco_freq#
nco_freq that is applied to this port.
- property nco_phase_offs#
nco_phase_offs that is applied to this port.
- class qibolab.instruments.qblox.port.ClusterRF_OutputPort(module, sequencer_number: int, number: int)[source]#
Bases:
QbloxOutputPort
- property lo_enabled#
Flag to enable local oscillator.
- property lo_frequency#
Local oscillator frequency for the given port.
- property gain#
Gain that is applied to this port.
- class qibolab.instruments.qblox.port.ClusterBB_OutputPort(module, sequencer_number: int, number: int)[source]#
Bases:
QbloxOutputPort
- property gain#
Gain that is applied to this port.
- class qibolab.instruments.qblox.port.QbloxInputPort(module, output_sequencer_number: int, input_sequencer_number: int, number: int)[source]#
Bases:
object
- property hardware_demod_en#
Flag to enable hardware demodulation.
- property acquisition_duration#
Duration of the pulse acquisition, in ns. It must be > 0 and multiple of 4.
qibolab.instruments.qblox.q1asm module#
A library to support generating qblox q1asm programs.
- class qibolab.instruments.qblox.q1asm.Program[source]#
Bases:
object
A class to represent a sequencer q1asm assembly program.
A q1asm program is made of blocks of code (
qibolab.instruments.qblox.qblox_q1asm.Block
). Real time registers (variables) are necessary to implement sweeps in real time. This class keeps track of the registers used and has a method to provide the next available register.- MAX_REGISTERS = 64#
- class qibolab.instruments.qblox.q1asm.Block(name='')[source]#
Bases:
object
A class to represent a block of q1asm assembly code.
A block is comprised of code lines. .. attribute:: name
A name for the block of code.
- type:
str
- GLOBAL_INDENTATION_LEVEL = 3#
- SPACES_PER_LEVEL = 4#
- SPACES_BEFORE_COMMENT = 4#
- property indentation#
- class qibolab.instruments.qblox.q1asm.Register(program: Program, name: str = '')[source]#
Bases:
object
A class to represent a q1asm program register.
Registers are used as variables in real time FPGA code. .. attribute:: name
a name to identify the register
- type:
str
- property name#
- qibolab.instruments.qblox.q1asm.wait_block(wait_time: int, register: Register, force_multiples_of_four: bool = False)[source]#
Generates blocks of code to implement long delays.
- qibolab.instruments.qblox.q1asm.loop_block(start: int, stop: int, step: int, register: Register, block: Block)[source]#
Generates blocks of code to implement loops.
Its behaviour is similar to range(): it includes the first value, but never the last.
- Parameters:
start (int) – the initial value.
stop (int) – the final value (excluded).
step (int) – the step in which the register is incremented.
register (
qibolab.instruments.qblox.qblox_q1asm.Register
) – the register modified within the loop.block (
qibolab.instruments.qblox.qblox_q1asm.Register
) – the block of code to be iterated.
- qibolab.instruments.qblox.q1asm.convert_phase(phase_rad: float)[source]#
Converts phase values in radiants to the encoding used in qblox FPGAs.
The phase is divided into 1e9 steps between 0° and 360°, expressed as an integer between 0 and 1e9 (e.g 45°=125e6). https://qblox-qblox-instruments.readthedocs-hosted.com/en/master/api_reference/sequencer.html
- qibolab.instruments.qblox.q1asm.convert_frequency(freq: float)[source]#
Converts frequency values to the encoding used in qblox FPGAs.
The frequency is divided into 4e9 steps between -500 and 500 MHz and expressed as an integer between -2e9 and 2e9. (e.g. 1 MHz=4e6). https://qblox-qblox-instruments.readthedocs-hosted.com/en/master/api_reference/sequencer.html
- qibolab.instruments.qblox.q1asm.convert_gain(gain: float)[source]#
Converts gain values to the encoding used in qblox FPGAs.
Both gain values are divided in 2**sample path width steps. QCM DACs resolution 16bits, QRM DACs and ADCs 12 bit https://qblox-qblox-instruments.readthedocs-hosted.com/en/master/api_reference/sequencer.html
- qibolab.instruments.qblox.q1asm.convert_offset(offset: float)[source]#
Converts offset values to the encoding used in qblox FPGAs.
Both offset values are divided in 2**sample path width steps. QCM DACs resolution 16bits, QRM DACs and ADCs 12 bit QCM 5Vpp, QRM 2Vpp https://qblox-qblox-instruments.readthedocs-hosted.com/en/master/api_reference/sequencer.html
qibolab.instruments.qblox.sequencer module#
- class qibolab.instruments.qblox.sequencer.WaveformsBuffer[source]#
Bases:
object
A class to represent a buffer that holds the unique waveforms used by a sequencer.
- exception NotEnoughMemory[source]#
Bases:
Exception
An error raised when there is not enough memory left to add more waveforms.
- exception NotEnoughMemoryForBaking[source]#
Bases:
Exception
An error raised when there is not enough memory left to bake pulses.
- add_waveforms(pulse: Pulse, hardware_mod_en: bool, sweepers: list[qibolab.sweeper.Sweeper])[source]#
Adds a pair of i and q waveforms to the list of unique waveforms.
Waveforms are added to the list if they were not there before. Each of the waveforms (i and q) is processed individually.
- Parameters:
- Raises:
NotEnoughMemory – If the memory needed to store the waveforms in more than the memory avalible.
- bake_pulse_waveforms(pulse: Pulse, values: [], hardware_mod_en: bool)[source]#
Generates and stores a set of i and q waveforms required for a pulse duration sweep.
These waveforms are generated and stored in a predefined order so that they can later be retrieved within the sweeper q1asm code. It bakes pulses from as short as 1ns, padding them at the end with 0s if required so that their length is a multiple of 4ns. It also supports the modulation of the pulse both in hardware (default) or software. With no other pulses stored in the sequencer memory, it supports values up to range(1, 126) for regular pulses and range(1, 180) for flux pulses.
- Parameters:
pulse (
qibolab.pulses.Pulse
) – The pulse to be swept.values (list(int)) – The list of values to sweep the pulse duration with.
hardware_mod_en (bool) – If set to True the pulses are assumed to be modulated in hardware and their envelope waveforms are uploaded; if False, software modulated waveforms are uploaded.
- Returns:
- An array with the indices of the set of pulses. For each pulse duration in
values the i component is saved in the next avalable index, followed by the q component. For flux pulses, since both i and q components are equal, they are only saved once.
- Return type:
idx_range (numpy.ndarray)
- Raises:
NotEnoughMemory – If the memory needed to store the waveforms in more than the memory avalible.
- class qibolab.instruments.qblox.sequencer.Sequencer(number: int)[source]#
Bases:
object
A class to extend the functionality of qblox_instruments Sequencer.
A sequencer is a hardware component synthesised in the instrument FPGA, responsible for fetching waveforms from memory, pre-processing them, sending them to the DACs, and processing the acquisitions from the ADCs (QRM modules). https://qblox-qblox-instruments.readthedocs-hosted.com/en/master/documentation/sequencer.html
This class extends the sequencer functionality by holding additional data required when processing a pulse sequence:
the sequencer number,
the sequence of pulses to be played,
a buffer of unique waveforms, and
the four components of the sequence file:
waveforms dictionary
acquisition dictionary
weights dictionary
program
- device#
A reference to the underlying qblox_instruments.qcodes_drivers.sequencer.Sequencer object. It can be used to access other features not directly exposed by this wrapper. https://qblox-qblox-instruments.readthedocs-hosted.com/en/master/documentation/sequencer.html
- Type:
QbloxSequencer
- pulses#
The sequence of pulses to be played by the sequencer.
- Type:
- waveforms_buffer#
A buffer of unique waveforms to be played by the sequencer.
- Type:
- waveforms#
A dictionary containing the waveforms to be played by the sequencer in qblox format.
- Type:
- acquisitions#
A dictionary containing the list of acquisitions to be made by the sequencer in qblox format.
- Type:
- weights#
A dictionary containing the list of weights to be used by the sequencer when demodulating and integrating the response, in qblox format.
- Type:
- program#
The pseudo assembly (q1asm) program to be executed by the sequencer. https://qblox-qblox-instruments.readthedocs-hosted.com/en/master/documentation/sequencer.html#instructions
- Type:
qibolab.instruments.qblox.sweeper module#
- class qibolab.instruments.qblox.sweeper.QbloxSweeperType(value)[source]#
Bases:
Enum
An enumeration for the different types of sweepers supported by qblox.
frequency: sweeps pulse frequency by adjusting the sequencer nco_freq with q1asm command set_freq.
gain: sweeps sequencer gain by adjusting the sequencer gain_awg_path0 and gain_awg_path1 with q1asm command set_awg_gain. Since the gain is a parameter between -1 and 1 that multiplies the samples of the waveforms before they are fed to the DACs, it can be used to sweep the pulse amplitude.
offset: sweeps sequencer offset by adjusting the sequencer offset_awg_path0 and offset_awg_path1 with q1asm command set_awg_offs
start: sweeps pulse start.
duration: sweeps pulse duration.
- frequency = 1#
- gain = 2#
- offset = 3#
- start = 4#
- duration = 5#
- number = 6#
- relative_phase = 7#
- time = 8#
- class qibolab.instruments.qblox.sweeper.QbloxSweeper(program: Program, rel_values: list, type: QbloxSweeperType = QbloxSweeperType.number, add_to: float = 0, multiply_to: float = 1, name: str = '')[source]#
Bases:
object
A custom sweeper object with the data and functionality required by qblox instruments.
It is responsible for generating the q1asm code required to execute sweeps in a sequencer. The object can be initialised with either:
a
qibolab.sweepers.Sweeper
using theqibolab.instruments.qblox.QbloxSweeper.from_sweeper()
, ora range of values and a sweeper type (
qibolab.instruments.qblox.QbloxSweeperType
)
Like most FPGAs, qblox FPGAs do not support floating point arithmetics. All parameters that can be manipulated in real time within the FPGA are represented as two’s complement integers.
- type#
the type of sweeper
- Type:
qibolab.instruments.qblox.QbloxSweeperType
- name#
a name given for the sweep that is later used within the q1asm code to identify the loops.
- Type:
- register#
the main Register (q1asm variable) used in the loop.
- Type:
qibolab.instruments.qblox_q1asm.Register
- aux_register#
an auxialiry Register requried in duration sweeps.
- Type:
qibolab.instruments.qblox_q1asm.Register
- update_parameters#
a flag to instruct the sweeper to update the paramters or not depending on whether a parameter of the sequencer needs to be swept or not.
- Type:
Bool
- block(inner_block
qibolab.instruments.qblox_q1asm.Block
): generates the block of q1asm code that implements the sweep.
- FREQUENCY_LIMIT = 500000000.0#
- classmethod from_sweeper(program: Program, sweeper: Sweeper, add_to: float = 0, multiply_to: float = 1, name: str = '')[source]#
Creates an instance form a
qibolab.sweepers.Sweeper
object.- Parameters:
program (
qibolab.instruments.qblox_q1asm.Program
) – a program object representing the q1asm program of a sequencer.sweeper (
qibolab.sweepers.Sweeper
) – the original qibolab sweeper. associated with the sweep. If no name is provided it uses the sweeper type as name.add_to (float) – a value to be added to each value of the range of values defined in sweeper.values, rel_values.
multiply_to (float) – a value to be multiplied by each value of the range of values defined in sweeper.values, rel_values.
name (str) – a name given for the sweep that is later used within the q1asm code to identify the loops.
- block(inner_block: Block)[source]#
Generates the block of q1asm code that implements the sweep.
The q1asm code for a sweeper has the following structure:
# header_block # initialise register with start value move 0, R0 # 0 = start value, R0 = register name nop # wait an instruction cycle (4ns) for the register to be updated with its value loop_R0: # loop label # update_parameter_block # update parameters, in this case pulse frequency set_freq R0 # sets the frequency of the sequencer nco to the value stored in R0 upd_param 100 # makes the change effective and wait 100ns # inner block play 0,1,4 # play waveforms with index 0 and 1 (i and q) and wait 4ns # footer_block # increment or decrement register with step value add R0, 2500, R0 # R0 = R0 + 2500 nop # wait an instruction cycle (4ns) for the register to be updated with its value # check condition and loop jlt R0, 10001, @loop_R0 # while R0 is less than the stop value loop to loop_R0 # in this example it would loop 5 times # with R0 values of 0, 2500, 5000, 7500 and 10000
- Parameters:
inner_block (
qibolab.instruments.qblox_q1asm.Block
) – the block of q1asm code to be repeated within the loop.