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

Add pulse instruction and schedule equality testing #2873

Merged
merged 15 commits into from
Aug 14, 2019

Conversation

taalexander
Copy link
Contributor

@taalexander taalexander commented Jul 28, 2019

Summary

This PR adds pulse instruction and schedule equality testing. This will make writing Schedule tests easier.

I also added a small change to return instructions with a fixed ordering. This was required for the initial way I implemented equality testing, but have since refactored so that it is not necessary. This feature may still be desired so I have left it in, please let me know if I should remove.

Details and comments

Instruction testing verifies that the lhs and rhs have the same Command on the same channels.

Schedule testing first ensures that the lhs and rhs each have the same channels and the same number of instructions. Then it verifies that each instruction at each time in the rhs is contained within the rhs.

Copy link
Contributor

@lcapelluto lcapelluto left a comment

Choose a reason for hiding this comment

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

I see your test at the end, so I know it works fine, but where is the comparison for start times of Instructions happening? The test I'm looking at is test_differnet_time_not_equal

qiskit/pulse/commands/acquire.py Outdated Show resolved Hide resolved
qiskit/pulse/commands/command.py Outdated Show resolved Hide resolved
qiskit/pulse/commands/persistent_value.py Outdated Show resolved Hide resolved
qiskit/pulse/commands/sample_pulse.py Show resolved Hide resolved
qiskit/pulse/commands/sample_pulse.py Outdated Show resolved Hide resolved
qiskit/pulse/schedule.py Outdated Show resolved Hide resolved
test/python/pulse/test_schedule.py Outdated Show resolved Hide resolved
@taalexander
Copy link
Contributor Author

taalexander commented Aug 6, 2019

I see your test at the end, so I know it works fine, but where is the comparison for start times of Instructions happening? The test I'm looking at is test_differnet_time_not_equal

This test happening in checking that the underlying tuple is equal. It has a form of Tuple[int, Instruction].

@taalexander
Copy link
Contributor Author

This should be good to go now.

lcapelluto
lcapelluto previously approved these changes Aug 13, 2019
lcapelluto
lcapelluto previously approved these changes Aug 13, 2019
@mtreinish
Copy link
Member

Azure returned successfully on all jobs: https://dev.azure.com/qiskit-ci/qiskit-terra/_build/results?buildId=1822 it's just the recent issue where the azure<->github communication fails and nothing gets updated. Since the jobs all succeeded I'm going to go ahead and merge this

@mtreinish mtreinish merged commit 87de275 into Qiskit:master Aug 14, 2019
faisaldebouni pushed a commit to faisaldebouni/qiskit-terra that referenced this pull request Aug 5, 2020
This adds pulse instruction and schedule equality testing. This will make writing Schedule tests easier.

I also added a small change to return instructions with a fixed ordering. This was required for the initial way I implemented equality testing, but have since refactored so that it is not necessary. 

Instruction testing verifies that the lhs and rhs have the same Command on the same channels.

Schedule testing first ensures that the lhs and rhs each have the same channels and the same number of instructions. Then it verifies that each instruction at each time in the rhs is contained within the rhs.

* Add schedule and instruction equality testing.

* Modify equality check to be more straight forward.

* Updated changelog.

* refactor equality checking of Commands to not check name and also use the super class of eq.

* Update qiskit/pulse/commands/command.py

Co-Authored-By: Lauren Capelluto <laurencapelluto@gmail.com>

* Fix unpythonic equality checks.

* Add proper hashes for commands.

* Update test/python/pulse/test_schedule.py

Co-Authored-By: Lauren Capelluto <laurencapelluto@gmail.com>

* Change equality check to be based on position in .
@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
mod: pulse Related to the Pulse module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants