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

Qhc 736 bug wrong array output for qbloxresult from qprogram #853

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

Conversation

jjmartinezQT
Copy link
Collaborator

This PR reshapes QBlox acquisitions so they are standard with other vendors acquisitions when having nested loops, i.e.:

outer_loop = 51
inner_loop = 11

old_acquisitions.shape(561, 2)
new_acquisitions.shape(51, 11, 2)

Copy link

linear bot commented Dec 13, 2024

Copy link

🔗Pullpo.io Slack channel

Copy link

pullpo-for-slack bot commented Dec 13, 2024

AI Analysis

Review:

The code changes in qblox_qrm.py and qblox_measurement_result.py to add a new 'shape' attribute seem consistent and useful for reshaping data. The fix for the typo in qblox_qrm.py is straightforward and improves code readability. The changes in qblox_compiler.py to calculate and store the shape of acquisition data appear well-implemented and enhance the functionality of the class.

Detailed file changes

(dropdown):

In qblox_qrm.py:

  • Fixed a typo in a variable name from 'acquistion' to 'acquisition'.
  • Updated the logic to save ADC data based on the corrected 'acquisition_data' variable.
  • Added a new attribute 'shape' to the QbloxMeasurementResult class.

In qblox_compiler.py:

  • Added a new attribute 'shape' to the AcquisitionData class.
  • Calculated and stored the shape of the acquisition data based on loop iterations.
  • Updated the logic to store the shape attribute when handling an 'acquire' element.

In qblox_measurement_result.py:

  • Added a new attribute 'shape' to the QbloxMeasurementResult class.
  • Updated the 'array' property to reshape the data based on the stored shape attribute.

@pullpo-for-slack pullpo-for-slack bot requested a review from fedonman December 13, 2024 09:58
@fedonman fedonman removed their request for review December 13, 2024 10:05
@jjmartinezQT jjmartinezQT marked this pull request as draft December 13, 2024 10:07
@jjmartinezQT jjmartinezQT marked this pull request as ready for review December 13, 2024 11:35
Copy link

Hello. You may have forgotten to update the changelog!
Please edit changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.

Copy link

codecov bot commented Dec 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.67%. Comparing base (6d040c0) to head (1fb3077).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #853   +/-   ##
=======================================
  Coverage   96.67%   96.67%           
=======================================
  Files         221      221           
  Lines        7729     7739   +10     
=======================================
+ Hits         7472     7482   +10     
  Misses        257      257           
Flag Coverage Δ
unittests 96.67% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Collaborator

@fedonman fedonman left a comment

Choose a reason for hiding this comment

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

Left some comments.

src/qililab/result/qprogram/measurement_result.py Outdated Show resolved Hide resolved
src/qililab/result/qprogram/qblox_measurement_result.py Outdated Show resolved Hide resolved
src/qililab/result/qprogram/qblox_measurement_result.py Outdated Show resolved Hide resolved
src/qililab/result/qprogram/qblox_measurement_result.py Outdated Show resolved Hide resolved
tests/result/qprogram/test_qblox_measurement_result.py Outdated Show resolved Hide resolved
tests/instruments/qblox/test_qblox_qrm.py Show resolved Hide resolved
@fedonman
Copy link
Collaborator

fedonman commented Dec 13, 2024

Another remark: Take note that QuantumMachines in case there is 1 loop let's say 10 iterations, returns an array with shape (2, 1, 10) and not (2, 10)

@jjmartinezQT
Copy link
Collaborator Author

Another remark: Take note that QuantumMachines in case there is 1 loop let's say 10 iterations, returns an array with shape (2, 1, 10) and not (2, 10)

Then we should adopt this format right? So both results have the same one.

@fedonman
Copy link
Collaborator

Another remark: Take note that QuantumMachines in case there is 1 loop let's say 10 iterations, returns an array with shape (2, 1, 10) and not (2, 10)

Then we should adopt this format right? So both results have the same one.

Yes, we should have the same shapes for both vendors.

@jjmartinezQT
Copy link
Collaborator Author

Another remark: Take note that QuantumMachines in case there is 1 loop let's say 10 iterations, returns an array with shape (2, 1, 10) and not (2, 10)

Then we should adopt this format right? So both results have the same one.

Yes, we should have the same shapes for both vendors.

Cool, I will re-adapt QBlox then, thanks.

@fedonman
Copy link
Collaborator

Another remark: Take note that QuantumMachines in case there is 1 loop let's say 10 iterations, returns an array with shape (2, 1, 10) and not (2, 10)

Then we should adopt this format right? So both results have the same one.

Yes, we should have the same shapes for both vendors.

Cool, I will re-adapt QBlox then, thanks.

I double checked and is the same as you have it now. sorry for the confusion

@fedonman
Copy link
Collaborator

Another remark: Take note that QuantumMachines in case there is 1 loop let's say 10 iterations, returns an array with shape (2, 1, 10) and not (2, 10)

Then we should adopt this format right? So both results have the same one.

Yes, we should have the same shapes for both vendors.

Cool, I will re-adapt QBlox then, thanks.

I double checked and is the same as you have it now. sorry for the confusion

So (2, N) for one loop, (2, M, N) for nested loop etc.

@jjmartinezQT
Copy link
Collaborator Author

Another remark: Take note that QuantumMachines in case there is 1 loop let's say 10 iterations, returns an array with shape (2, 1, 10) and not (2, 10)

Then we should adopt this format right? So both results have the same one.

Yes, we should have the same shapes for both vendors.

Cool, I will re-adapt QBlox then, thanks.

I double checked and is the same as you have it now. sorry for the confusion

So (2, N) for one loop, (2, M, N) for nested loop etc.

Music to my ears then! Will fix the unittest failing then.

@jjmartinezQT
Copy link
Collaborator Author

This might need to wait until January to be merged as I really want to test it on real hardware before merging, and we will be warming up on Friday and need to give Adrián some measurement room before then.

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