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 set_noise_model method to Device #893

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

yitchen-tim
Copy link
Contributor

@yitchen-tim yitchen-tim commented Feb 22, 2024

Issue #, if available:
qiskit-community/qiskit-braket-provider#89

Description of changes:
There are different ways to initiate a device beside initializing AwsDevice, such as calling AwsDevice.get_devices(). In order to enable more general usage of adding noise model to a device, this PR add a set_noise_model method.

  • Add set_noise_model method to Device class.
  • Add tests and repurpose some tests.

Testing done:
tox

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.

@yitchen-tim yitchen-tim requested a review from a team as a code owner February 22, 2024 21:18
Copy link

codecov bot commented Feb 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (7ba54ce) to head (3ba5ea4).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #893   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          135       135           
  Lines         8917      8916    -1     
  Branches      2002      2000    -2     
=========================================
- Hits          8917      8916    -1     

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

Comment on lines 127 to 129
if noise_model:
self._validate_device_noise_model_support(noise_model)
self._noise_model = noise_model
Copy link
Member

Choose a reason for hiding this comment

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

No need to do the if check if the method explicitly takes a noise model. As well, should this raise a warning if there's already a noise model attached? Alternatively, the method can be update_noise_model, in which case it will be pretty clear that the model will be overwritten.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @speller26 could you review this PR again? I think it'd be good to get it merged before UnitaryHack

@@ -113,8 +113,6 @@ def __init__(
self._aws_session = self._get_session_and_initialize(aws_session or AwsSession())
self._ports = None
self._frames = None
if noise_model:
self._validate_device_noise_model_support(noise_model)
self._noise_model = noise_model
Copy link
Member

Choose a reason for hiding this comment

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

The validation still makes sense here

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.

2 participants