-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fixes #7078: Change prefix of MemorySlot channel in Qasm Instructions #8166
Merged
mergify
merged 15 commits into
Qiskit:main
from
pollyshaw:#7078-change-prefix-for-MemorySlot
Jul 27, 2022
Merged
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f05d4b4
Fixes #7078: Add is_schedulable property to qiskit.pulse.Channel and …
pollyshaw 0b1a111
Fixes #7078: Introduce ClassicalIOChannel as a subclass of pulse.Channel
pollyshaw 34ffb0b
Fixes #7078: Make Acquire.channels only return the channel
pollyshaw 40aba71
Fixes #7078: Execute black
pollyshaw 3395b5e
Fixes #7078: Put slots in new tuple in acquire
pollyshaw 9bf6e09
Fixes #7078: Add is_schedulable property to qiskit.pulse.Channel and …
pollyshaw a217879
Fixes #7078: Remove is_schedulable property from qiskit.pulse.channel
pollyshaw cfd81c7
Fixes #7078: Put checks in SetPhase, ShiftPhase and SetPhase. Remove …
pollyshaw c66a6e3
Fixes #7078: Add unit tests for restrictions on Classical IO channels
pollyshaw 87f0b27
Fixes #7078: Add unit tests for abstract nature of ClassicalIOChannel
pollyshaw e3f7634
Fixes #7078: Tidying after self-review.
pollyshaw 9208063
Fixes #7078: Add release note.
pollyshaw 7abc2ca
Fixes #7078: remove typo
pollyshaw 207490f
Merge branch 'main' into #7078-change-prefix-for-MemorySlot
pollyshaw b7f93c3
Merge branch 'main' into #7078-change-prefix-for-MemorySlot
nkanazawa1989 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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/introduce-classical-io-channel-0a616e6ca75b7687.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: | ||
- | | ||
In the qiskit.pulse.channels package, ClassicalIOChannel class has been added | ||
as an abstract base class of MemorySlot, RegisterSlot, and SnapshotChannel. | ||
|
||
The qiskit.pulse.transforms.canonicalization.pad method does not introduce | ||
delays to any channels which are instances of ClassicalIOChannel. | ||
|
||
In qiskit.pulse.instructions, the constructors to SetPhase, ShiftPhase, | ||
SetFrequency and ShiftFrequency now throw a PulseError if the channel parameter | ||
is not of type PulseChannel. | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,6 +156,64 @@ def test_freq(self): | |
) | ||
self.assertEqual(repr(set_freq), "SetFrequency(4500000000.0, DriveChannel(1), name='test')") | ||
|
||
def test_freq_non_pulse_channel(self): | ||
"""Test set frequency constructor with illegal channel""" | ||
with self.assertRaises(exceptions.PulseError): | ||
instructions.SetFrequency(4.5e9, channels.RegisterSlot(1), name="test") | ||
|
||
|
||
class TestShiftFrequency(QiskitTestCase): | ||
"""Shift frequency tests.""" | ||
|
||
def test_shift_freq(self): | ||
"""Test shift frequency basic functionality.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I couldn't see a test for happy-path constructor for ShiftFrequency or SetPhase so I put them in. |
||
shift_freq = instructions.ShiftFrequency(4.5e9, channels.DriveChannel(1), name="test") | ||
|
||
self.assertIsInstance(shift_freq.id, int) | ||
self.assertEqual(shift_freq.duration, 0) | ||
self.assertEqual(shift_freq.frequency, 4.5e9) | ||
self.assertEqual(shift_freq.operands, (4.5e9, channels.DriveChannel(1))) | ||
self.assertEqual( | ||
shift_freq, instructions.ShiftFrequency(4.5e9, channels.DriveChannel(1), name="test") | ||
) | ||
self.assertNotEqual( | ||
shift_freq, instructions.ShiftFrequency(4.5e8, channels.DriveChannel(1), name="test") | ||
) | ||
self.assertEqual( | ||
repr(shift_freq), "ShiftFrequency(4500000000.0, DriveChannel(1), name='test')" | ||
) | ||
|
||
def test_freq_non_pulse_channel(self): | ||
"""Test shift frequency constructor with illegal channel""" | ||
with self.assertRaises(exceptions.PulseError): | ||
instructions.ShiftFrequency(4.5e9, channels.RegisterSlot(1), name="test") | ||
|
||
|
||
class TestSetPhase(QiskitTestCase): | ||
"""Test the instruction construction.""" | ||
|
||
def test_default(self): | ||
"""Test basic SetPhase.""" | ||
set_phase = instructions.SetPhase(1.57, channels.DriveChannel(0)) | ||
|
||
self.assertIsInstance(set_phase.id, int) | ||
self.assertEqual(set_phase.name, None) | ||
self.assertEqual(set_phase.duration, 0) | ||
self.assertEqual(set_phase.phase, 1.57) | ||
self.assertEqual(set_phase.operands, (1.57, channels.DriveChannel(0))) | ||
self.assertEqual( | ||
set_phase, instructions.SetPhase(1.57, channels.DriveChannel(0), name="test") | ||
) | ||
self.assertNotEqual( | ||
set_phase, instructions.SetPhase(1.57j, channels.DriveChannel(0), name="test") | ||
) | ||
self.assertEqual(repr(set_phase), "SetPhase(1.57, DriveChannel(0))") | ||
|
||
def test_set_phase_non_pulse_channel(self): | ||
"""Test shift phase constructor with illegal channel""" | ||
with self.assertRaises(exceptions.PulseError): | ||
instructions.SetPhase(1.57, channels.RegisterSlot(1), name="test") | ||
|
||
|
||
class TestShiftPhase(QiskitTestCase): | ||
"""Test the instruction construction.""" | ||
|
@@ -177,6 +235,11 @@ def test_default(self): | |
) | ||
self.assertEqual(repr(shift_phase), "ShiftPhase(1.57, DriveChannel(0))") | ||
|
||
def test_shift_phase_non_pulse_channel(self): | ||
"""Test shift phase constructor with illegal channel""" | ||
with self.assertRaises(exceptions.PulseError): | ||
instructions.ShiftPhase(1.57, channels.RegisterSlot(1), name="test") | ||
|
||
|
||
class TestSnapshot(QiskitTestCase): | ||
"""Snapshot tests.""" | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put this list in alphabetical order.