-
Notifications
You must be signed in to change notification settings - Fork 117
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
src/braket/devices/device.py
Outdated
if noise_model: | ||
self._validate_device_noise_model_support(noise_model) | ||
self._noise_model = noise_model |
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.
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.
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.
updated!
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.
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 |
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.
The validation still makes sense here
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 callingAwsDevice.get_devices()
. In order to enable more general usage of adding noise model to a device, this PR add aset_noise_model
method.set_noise_model
method to Device class.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
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.