qiskit/releasenotes/notes/0.16/support-parameterexpression...

37 lines
1.2 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
features:
- |
Pulse :py:class:`~qiskit.pulse.Schedule` objects now support
using :py:class:`~qiskit.circuit.ParameterExpression` objects
for parameters.
For example::
from qiskit.circuit import Parameter
from qiskit import pulse
alpha = Parameter('')
phi = Parameter('ϕ')
qubit = Parameter('q')
amp = Parameter('amp')
schedule = pulse.Schedule()
schedule += SetFrequency(alpha, DriveChannel(qubit))
schedule += ShiftPhase(phi, DriveChannel(qubit))
schedule += Play(Gaussian(duration=128, sigma=4, amp=amp),
DriveChannel(qubit))
schedule += ShiftPhase(-phi, DriveChannel(qubit))
Parameter assignment is done via the
:meth:`~qiskit.pulse.Schedule.assign_parameters` method::
schedule.assign_parameters({alpha: 4.5e9, phi: 1.57,
qubit: 0, amp: 0.2})
Expressions and partial assignment also work, such as::
beta = Parameter('b')
schedule += SetFrequency(alpha + beta, DriveChannel(0))
schedule.assign_parameters({alpha: 4.5e9})
schedule.assign_parameters({beta: phi / 6.28})