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

feat: support erf_square and swap_phases #1019

Merged
merged 4 commits into from
Jul 29, 2024

Conversation

yitchen-tim
Copy link
Contributor

@yitchen-tim yitchen-tim commented Jul 26, 2024

Issue #, if available:
closes #1018

Description of changes:
Add support to two pulse instructions:

  • swap phases
  • erf_square

Note: The code was reviewed in internal PR346

Testing done:
unit tests

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

codecov bot commented Jul 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (bbdbfa6) to head (4e4f7b3).
Report is 30 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1019   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          135       135           
  Lines         8950      9004   +54     
  Branches      2014      2019    +5     
=========================================
+ Hits          8950      9004   +54     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yitchen-tim yitchen-tim marked this pull request as ready for review July 26, 2024 20:55
@yitchen-tim yitchen-tim requested a review from a team as a code owner July 26, 2024 20:55
@yitchen-tim yitchen-tim assigned AbeCoull and yitchen-tim and unassigned AbeCoull Jul 26, 2024
@yitchen-tim yitchen-tim requested a review from AbeCoull July 26, 2024 20:56
src/braket/pulse/waveforms.py Outdated Show resolved Hide resolved
src/braket/pulse/pulse_sequence.py Outdated Show resolved Hide resolved
Comment on lines +548 to +550
f"ErfSquareWaveform('id': {self.id}, 'length': {self.length}, "
f"'width': {self.width}, 'sigma': {self.sigma}, 'amplitude': {self.amplitude}, "
f"'zero_at_edges': {self.zero_at_edges})"
Copy link
Contributor

@rmshaffer rmshaffer Jul 26, 2024

Choose a reason for hiding this comment

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

__repr__() is supposed to return a valid Python string which can be used to construct the object:

Suggested change
f"ErfSquareWaveform('id': {self.id}, 'length': {self.length}, "
f"'width': {self.width}, 'sigma': {self.sigma}, 'amplitude': {self.amplitude}, "
f"'zero_at_edges': {self.zero_at_edges})"
f"ErfSquareWaveform(id='{self.id}', length={self.length}, "
f"width={self.width}, sigma={self.sigma}, amplitude={self.amplitude}, "
f"zero_at_edges={self.zero_at_edges})"

but I see that existing classes in this file also have this problem. Are there unit tests that validate the output of these __repr__ functions?

Copy link
Contributor Author

@yitchen-tim yitchen-tim Jul 28, 2024

Choose a reason for hiding this comment

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

The repr of all existing waveforms all use the the same convention. I will keep erf square the same for now.

rmshaffer
rmshaffer previously approved these changes Jul 26, 2024
Copy link
Contributor

@rmshaffer rmshaffer left a comment

Choose a reason for hiding this comment

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

Couple of minor comments - feel free to defer them to a later PR if you'd like.

Co-authored-by: Ryan Shaffer <[email protected]>
@yitchen-tim yitchen-tim merged commit 66fec48 into main Jul 29, 2024
26 checks passed
@yitchen-tim yitchen-tim deleted the yitchen/erf_square_swap_phases branch July 29, 2024 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for ERF Square waveforms
3 participants