Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Schedule Plot reflecting duration of final schedule even if it is not plotted #3418

Merged

Conversation

Matt-Stypulkoski
Copy link
Contributor

Summary

Fixes #3379. The matplotlib figure created from the draw function now has the x-axis max reflect the longest duration of the channels included in channels_to_plot.

Details and comments

The following code (taken from the original issue) would produce the output image below:

import qiskit.pulse as pulse
import qiskit.pulse.pulse_lib as pulse_lib
sched = pulse.Schedule()
sched += pulse_lib.square(1000, 1.0)(pulse.DriveChannel(0))
sched += pulse_lib.square(10, 1.0)(pulse.DriveChannel(1))
sched.draw(channels_to_plot=[pulse.DriveChannel(1)])

Screen Shot 2019-11-06 at 3 52 41 PM

… duration for channels included in channels_to_plot parameter
@taalexander taalexander added this to To do in Pulse via automation Nov 7, 2019
Copy link
Contributor

@taalexander taalexander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea of fix looks good to me.

Do you know why the starting and ending samples of the pulse aren't zero? I see this is the current behaviour on master too. @nkanazawa1989?

edit: created issue #3427 for the above.

qiskit/visualization/pulse/matplotlib.py Outdated Show resolved Hide resolved
@1ucian0 1ucian0 added the Changelog: Bugfix Include in the "Fixed" section of the changelog label Nov 8, 2019
@mergify mergify bot merged commit db9c41c into Qiskit:master Nov 8, 2019
Pulse automation moved this from To do to Done Nov 8, 2019
faisaldebouni pushed a commit to faisaldebouni/qiskit-terra that referenced this pull request Aug 5, 2020
… not plotted (Qiskit#3418)

* In draw function, have x-coordinate max be set by the longest channel duration for channels included in channels_to_plot parameter

* Restructure logic for setting up plot range
@1ucian0 1ucian0 added the mod: pulse Related to the Pulse module label Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Bugfix Include in the "Fixed" section of the changelog mod: pulse Related to the Pulse module
Projects
No open projects
Pulse
  
Done
Development

Successfully merging this pull request may close these issues.

Schedule plot has final duration of final schedule duration even if channels are not plotted
3 participants