Basic examples#
Here are a few short basic how to examples.
How to execute a pulse sequence on a given platform?#
First, we create the pulse sequence that will be executed.
We can do this by defining a PulseSequence
object and adding different
pulses (qibolab.pulses.Pulse
) through the PulseSequence.add()
method:
from qibolab.pulses import Pulse, ReadoutPulse, PulseSequence
from qibolab.pulse_shapes import Rectangular, Gaussian
# Define PulseSequence
sequence = PulseSequence()
# Add some pulses to the pulse sequence
sequence.add(Pulse(start=0,
frequency=200000000.0,
amplitude=0.3,
duration=60,
phase=0,
shape=Gaussian(5))) # Gaussian shape with std = duration / 5
sequence.add(ReadoutPulse(start=70,
frequency=20000000.0,
amplitude=0.5,
duration=3000,
phase=0,
shape=Rectangular()))
The next step consists in connecting to a specific lab in which
the pulse sequence will be executed. In order to do this we
allocate a platform object Platform("name")
where name
is
the name of the platform that will be used. The Platform
constructor
also takes care of loading the runcard containing all the calibration
settings for that specific platform.
After connecting and setting up the platform’s instruments using the
connect()
and setup()
methods, the start
method will turn on
the local oscillators and the execute
method will execute
the previous defined pulse sequence according to the number of shots nshots
specified.
from qibolab import Platform
# Define platform and load specific runcard
platform = Platform("tii1q")
# Connects to lab instruments using the details specified in the calibration settings.
platform.connect()
# Configures instruments using the loaded calibration settings.
platform.setup()
# Turns on the local oscillators
platform.start()
# Executes a pulse sequence.
results = platform.execute(ps, nshots=10)
# Turn off lab instruments
platform.stop()
# Disconnect from the instruments
platform.disconnect()
Remember to turn off the instruments and disconnect from the lab using the
stop()
and disconnect()
methods of the platform.