Skip to content

Commit

Permalink
Add pulses
Browse files Browse the repository at this point in the history
  • Loading branch information
rscircus committed Jul 2, 2024
1 parent 56ce771 commit 446e6e1
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 53 deletions.
36 changes: 36 additions & 0 deletions doc/source/tutorials/includes/pulses/pulses0.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# pulses0.py

from qibolab.pulses import (
DrivePulse,
ReadoutPulse,
PulseSequence,
Rectangular,
Gaussian,
)

# Define PulseSequence
sequence = PulseSequence()

# Add some pulses to the pulse sequence
sequence.add(
DrivePulse(
start=0,
frequency=200000000,
amplitude=0.3,
duration=60,
relative_phase=0,
shape=Gaussian(5),
qubit=0,
)
)
sequence.add(
ReadoutPulse(
start=70,
frequency=20000000.0,
amplitude=0.5,
duration=3000,
relative_phase=0,
shape=Rectangular(),
qubit=0,
)
)
16 changes: 16 additions & 0 deletions doc/source/tutorials/includes/pulses/pulses1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from qibolab import create_platform
from qibolab.execution_parameters import ExecutionParameters
from pulses0 import sequence

# Define platform and load specific runcard
platform = create_platform("dummy")

# Connects to lab instruments using the details specified in the calibration settings.
platform.connect()

# Executes a pulse sequence.
options = ExecutionParameters(nshots=1000, relaxation_time=100)
results = platform.execute_pulse_sequence(sequence, options=options)

# Disconnect from the instruments
platform.disconnect()
55 changes: 2 additions & 53 deletions doc/source/tutorials/pulses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,7 @@ defining a :class:`qibolab.pulses.PulseSequence` object and adding different
pulses (:class:`qibolab.pulses.Pulse`) through the
:func:`qibolab.pulses.PulseSequence.add()` method:

.. testcode:: python

from qibolab.pulses import (
DrivePulse,
ReadoutPulse,
PulseSequence,
Rectangular,
Gaussian,
)

# Define PulseSequence
sequence = PulseSequence()

# Add some pulses to the pulse sequence
sequence.add(
DrivePulse(
start=0,
frequency=200000000,
amplitude=0.3,
duration=60,
relative_phase=0,
shape=Gaussian(5),
qubit=0,
)
)
sequence.add(
ReadoutPulse(
start=70,
frequency=20000000.0,
amplitude=0.5,
duration=3000,
relative_phase=0,
shape=Rectangular(),
qubit=0,
)
)
.. literalinclude:: ./includes/pulses/pulses0.py

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
Expand All @@ -55,23 +20,7 @@ After connecting and setting up the platform's instruments using the
local oscillators and the ``execute`` method will execute the previous defined
pulse sequence according to the number of shots ``nshots`` specified.

.. testcode:: python

from qibolab import create_platform
from qibolab.execution_parameters import ExecutionParameters

# Define platform and load specific runcard
platform = create_platform("dummy")

# Connects to lab instruments using the details specified in the calibration settings.
platform.connect()

# Executes a pulse sequence.
options = ExecutionParameters(nshots=1000, relaxation_time=100)
results = platform.execute_pulse_sequence(sequence, options=options)

# Disconnect from the instruments
platform.disconnect()
.. literalinclude:: ./includes/pulses/pulses1.py

Remember to turn off the instruments and disconnect from the lab using the
``stop()`` and ``disconnect()`` methods of the platform.

0 comments on commit 446e6e1

Please sign in to comment.