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

Circuit serialization as parameters of the tomography #1002

Merged
merged 3 commits into from
Oct 14, 2024

Conversation

Edoardo-Pedicillo
Copy link
Contributor

@Edoardo-Pedicillo Edoardo-Pedicillo commented Oct 8, 2024

This PR is a patch to solve the serialization of Circuit parameters, like in state tomographies (this happens with the scripts). Maybe a better solution would be to define a dump method specific for each parameter class and call it directly in the action dump method.

Checklist:

  • Reviewers confirm new code works as expected.
  • Tests are passing.
  • Coverage does not decrease.
  • Documentation is updated.
  • Compatibility with Qibo modules (Please edit this section if the current pull request is not compatible with the following branches).
    • Qibo: master
    • Qibolab: 0.1.9
    • Qibolab_platforms_qrc: main

Copy link

codecov bot commented Oct 8, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 3 lines in your changes missing coverage. Please review.

Project coverage is 97.45%. Comparing base (2a7062c) to head (14acf17).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
src/qibocal/auto/task.py 66.66% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1002      +/-   ##
==========================================
- Coverage   97.52%   97.45%   -0.07%     
==========================================
  Files         123      123              
  Lines        9714     9723       +9     
==========================================
+ Hits         9474     9476       +2     
- Misses        240      247       +7     
Flag Coverage Δ
unittests 97.45% <66.66%> (-0.07%) ⬇️

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

Files with missing lines Coverage Δ
src/qibocal/auto/task.py 96.31% <66.66%> (-1.74%) ⬇️

... and 2 files with indirect coverage changes

@Edoardo-Pedicillo Edoardo-Pedicillo added this to the Qibocal 0.1.1 milestone Oct 8, 2024
@alecandido
Copy link
Member

@Edoardo-Pedicillo we will eventually move to Pydantic serialization even in Qibocal (it's a waste of time to maintain our own, when there is a high-quality maintained library doing that).

If your solution is working, for the time being is more than enough.

@Edoardo-Pedicillo Edoardo-Pedicillo marked this pull request as ready for review October 8, 2024 09:04
Comment on lines 50 to 51
circuit_file = open(circuit_path, "w")
json.dump(value.raw, circuit_file)
Copy link
Member

Choose a reason for hiding this comment

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

Either use with open(...) as fd: or use circuit_file.write_text(json.dumps(...)). You should close file descriptors, and better doing it automatically than manually.

@Edoardo-Pedicillo Edoardo-Pedicillo added this pull request to the merge queue Oct 14, 2024
Merged via the queue into main with commit 22f62d5 Oct 14, 2024
20 of 21 checks passed
@Edoardo-Pedicillo Edoardo-Pedicillo deleted the params_yaml branch October 14, 2024 05:36
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.

4 participants