-
Notifications
You must be signed in to change notification settings - Fork 26
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
[SDS-307] Now able to get calibration data from result #103
Conversation
QFer
commented
Jun 3, 2021
- Added method to get calibration info to api
- Added unit tests
src/quantuminspire/api.py
Outdated
@@ -676,6 +676,32 @@ def get_measurement_register_from_result(self, result_id: int) -> List[Any]: | |||
raise ApiError(f'Measurement register for result with id {result_id} does not exist!') from err_msg | |||
return measurement_register | |||
|
|||
def get_calibration_from_result(self, result_id: int) -> Optional[Any]: | |||
""" Gets the calibration information of the executed cQASM code, given the result_id. |
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.
""" Gets the calibration information of the executed cQASM code, given the result_id. | |
""" Gets the calibration information of the executed code, given the result_id. |
We also submit qiskit code (right that that is converted to cqasm internally, but that might change)
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.
Changed it to executed job. Also changed some other instances of cQASM (where it is not needed to be called cQASM explicitly)
result = self.get_result(result_id) | ||
calibration_url = result.get('calibration') | ||
if calibration_url is not None: | ||
try: |
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 guess this code works, but is the parsing of the url needed? One can just do
result = requests.get(c, auth=authentication)
calibration = result.json()
(the authentication
and .json
can be wrapped in something off course)
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.
Yes, you can directly use request package to send a get for this url,, but I think it is better to use the already authenticated coreapi consistently for all communication with the backend api as it is now done in SDK.
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.
Functionality here is good. There is still the issue of documenting the (possible) confusion between the job_id and project_id, but that should be done in another PR.
31f8983
to
5228be3
Compare
Had to force push after rebase |