qiskit-tutorials
qiskit-tutorials copied to clipboard
Add documentation on using Parameters with Schedules
Step 1: Update "Building Pulse Schedules" docs
In tutorials/circuits_advanced/06_building_pulse_schedules.ipynb
(see here) add a new section titled "Schedule
s with Parameters".
In this section, answer these questions for your reader:
- What is a
Parameter
? documentation here- Mention something about
ParameterExpression
s: parameters can be used in algebraic expressions
- Mention something about
- How do you use a parameter in a Pulse instruction?
- This is simple. Should be enough to show some examples with a brief explanation, such as
Gaussian(duration=128, amp=1j*amp, sigma=16)
where the variableamp
is aParameter
instance (amp = Parameter('amp')
)
- This is simple. Should be enough to show some examples with a brief explanation, such as
- How do you assign parameters?
- For instance,
schedule.assign_parameters({amp: 0.5})
- You might want to draw your parameterized schedule before and after assigning parameters, to show how assignment has set the free parameters to specific values
- For instance,
Step 2: Update "Pulse Gates" docs
In tutorials/circuits_advanced/05_pulse_gates.html
(see here) add a new section titled "Pulse Gates with parameterized Schedule
s"
Now that you've explained how to create Schedules with Parameters, we should answer "How does this work with Pulse gates"? There are some examples already for how to add a Pulse gate where the gate has parameters, but none of the examples have parameterized schedules. I will leave the explanation to the implementer, but to get you started, I'll write up an example which you may want to use in this section. Play around with this to make sure you understand how it is working.

Note that the parameter drive_amp
is the same object shared between the circuit and schedule. Is this required? What happens if they're not the same?
Also take care to notice that parameters are referenced by object, so even if you instantiate two different parameters with the same name, they won't be treated as the same parameter. (I.e., I can create a = Parameter('test')
and b = Parameter('test')
, but if I use a
in my circuit, and try to execute assign_parameters({b: val})
, this will have no effect.)
Nice to have:
-
06_building_pulse_schedules.ipynb
could benefit from a simple table of contents to dispatch readers to the three main sections: "Schedule
Instructions", "Pulse Builder", and the new one "Schedule
s with Parameters". This can be a manual TOC (i.e., a bulleted list with three items, linking to the three headers[text](#link-to-header)
)
Dear @lcapelluto , can I have a look at this?