Download

Download this file as Jupyter notebook: channel_mappers.ipynb.

Channel mappers

ChannelMappers can be used to map Channels to PhysicalChannels, which represent the physical channels on hardware. In this tutorial, we show how to write a ChannelMapper, including a multiplexing example. General purpose ChannelMappers can be defined for a given device, and are meant to be saved to file with save(), then loaded with load() and used to map program instructions to that device.

In the examples below, we use a chassis with an AWG in slot 4, a digitizer in slot 3, and a downconverter in slot 2. The IF channels of the downconverter should be connected to corresponding channels of the digitizer for downconversion, while the RF channels should be connected to the qudit.

[2]:
import keysight.qcs as qcs

# define channels representing different AWGs and digitizers
awgs = qcs.Channels(range(2), "xy_pulse")
readout_awgs = qcs.Channels(range(1), "readout_pulse", absolute_phase=True)
dig = qcs.Channels(range(1), "readout_acquisition", absolute_phase=True)

# define the addresses of physical channels of 2 awgs, a digitizer, and a downconverter
awg_1x4x1 = qcs.Address(chassis=1, slot=4, channel=1)
awg_1x4x3 = qcs.Address(1, 4, 3)
awg_1x4x4 = qcs.Address(1, 4, 4)
dig_1x3x4 = qcs.Address(1, 3, 4)
dc_1x2x4 = qcs.Address(1, 2, 4)

We can then initialize the channel mapper and define the correspondence between virtual and physical channels.

[3]:
mapper = qcs.ChannelMapper()

# specify the mapping between virtual and physical channels
mapper.add_channel_mapping(awgs, [awg_1x4x1, awg_1x4x3], qcs.InstrumentEnum.M5300AWG)
mapper.add_channel_mapping(readout_awgs, awg_1x4x4, qcs.InstrumentEnum.M5300AWG)
mapper.add_channel_mapping(dig, dig_1x3x4, qcs.InstrumentEnum.M5200Digitizer)

# specify the IF channel of the downconverter connected to `dig_1x3x4`
mapper.add_downconverters(dig_1x3x4, dc_1x2x4)

# set the LO frequency of the AWG and downconverter channels to be the same value by
# passing in a range of possible RF frequencies
mapper.constrain_lo_frequencies(
    [awg_1x4x1, awg_1x4x3, awg_1x4x4, dc_1x2x4], 5.5e9, 6.0e9
)

# save the mapper
save_and_load = False
if save_and_load:
    qcs.save(mapper, "channel_mapper.qcs")

# then we can load the mapper from file to re-use later
if save_and_load:
    mapper_loaded = qcs.load("channel_mapper.qcs")
    assert mapper == mapper_loaded

Multiplexing with channel mappers

ChannelMappers support multiplexing, i.e., mapping of different Channels to the same PhysicalChannel. The pulse sent or retrieved through the physical channel during execution is the sum of the pulses on the virtual channels.

[4]:
# define channels object representing AWGs
awgs = qcs.Channels(range(3), "awgs")

# define the address of a physical channel
awg_1x4x1 = qcs.Address(1, 4, 1)

# initialize a mapper and specify the mapping
mapper = qcs.ChannelMapper()
mapper.add_channel_mapping(awgs, [awg_1x4x1] * 3, qcs.InstrumentEnum.M5300AWG)

The Multiplexing RF waveforms tutorial puts this to work and demonstrates multiplexed control and readout pulses.


Download

Download this file as Jupyter notebook: channel_mappers.ipynb.

On this page