forked from Qiskit/qiskit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix deprecated behaviour in timeline drawer
This removes the year-old deprecation of attempting to use the timeline drawer to draw an unscheduled circuit. Internally, it also removes all use of the deprecated `Bit` properties `Bit.index` and `Bit.register`. This is achieved by making it possible for generator functions to accept the complete `QuantumCircuit` program as a keyword argument, if they advertise that they can handle this by setting a special `accepts_program` attribute on themselves to `True`. This somewhat convoluted setup is because the generator functions are supposed to be arbitrary and user-defininable in custom stylesheets, so we cannot unilaterally change the call signature. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # On branch fix-timeline-deprecated-bit # Your branch is up to date with 'ibm/main'. # # Changes to be committed: # modified: qiskit/visualization/timeline/core.py # modified: qiskit/visualization/timeline/generators.py # new file: releasenotes/notes/timeline-visualisation-deprecated-bit-index-7277aa6e2a903cb7.yaml # modified: test/python/visualization/timeline/test_core.py # modified: test/python/visualization/timeline/test_generators.py #
- Loading branch information
1 parent
7d9d32e
commit 33fc0a6
Showing
5 changed files
with
82 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
releasenotes/notes/timeline-visualisation-deprecated-bit-index-7277aa6e2a903cb7.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
features: | ||
- | | ||
When defining a custom stylesheet for the pulse timeline drawer :func:`qiskit.visualization.timeline_drawer`, | ||
"generator" functions that have the object attribute ``accepts_program`` set to ``True`` will | ||
receive an extra keyword argument ``program`` containing the full scheduled | ||
:class:`.QuantumCircuit` being drawn. | ||
upgrade: | ||
- | | ||
Using the timeline drawer :func:`qiskit.visualization.timeline_drawer` with an unscheduled | ||
circuit will now raise a :exc:`.VisualizationError`, rather than silently attempting to schedule | ||
with no known instruction durations. This behaviour had been deprecated since Qiskit 0.37 in | ||
June 2022. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters