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

fix: Added json extension to results for singleshot classification #747

Merged
merged 3 commits into from
Mar 12, 2024

Conversation

GabrielePalazzo
Copy link
Contributor

Closes #746.

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: main
    • Qibolab_platforms_qrc: main

Copy link
Contributor

@andrea-pasquale andrea-pasquale left a comment

Choose a reason for hiding this comment

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

Thanks @GabrielePalazzo, do you know why tests are failing?

The problem was related to this line:

(path / RESULTSFILE).write_text(json.dumps(serialize(asdict_class)))

An alternative solution would be to add .json directly in this line.
Maybe it is better to put the extension directly in the top-level-constant.
I believe that tests should pass if you do so.

Let me know what you think.

@andrea-pasquale andrea-pasquale added this to the Qibocal 0.0.8 milestone Mar 5, 2024
@GabrielePalazzo
Copy link
Contributor Author

If I revert this line, tests are passing.

(path / f"{filename}").write_text(

The cause is here (when we read json):
file = path / f"{filename}.json"

I think the safest approach is what you suggested (explicitly adding .json in singleshot), considering that, for example, DATAFILE cannot have its extension (it can be both json and npz).
What do you think?

@andrea-pasquale
Copy link
Contributor

If I revert this line, tests are passing.

(path / f"{filename}").write_text(

The cause is here (when we read json):

file = path / f"{filename}.json"

I think the safest approach is what you suggested (explicitly adding .json in singleshot), considering that, for example, DATAFILE cannot have its extension (it can be both json and npz).
What do you think?

Sure, let's add .json in singleshot I forgot to update it when we refactored the data structure in #690.

Copy link

codecov bot commented Mar 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.44%. Comparing base (ddba2d3) to head (8e73b6c).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #747   +/-   ##
=======================================
  Coverage   96.44%   96.44%           
=======================================
  Files         108      108           
  Lines        7509     7509           
=======================================
  Hits         7242     7242           
  Misses        267      267           
Flag Coverage Δ
unittests 96.44% <100.00%> (ø)

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

Files Coverage Δ
...bocal/protocols/characterization/classification.py 100.00% <100.00%> (ø)

Copy link
Contributor

@andrea-pasquale andrea-pasquale left a comment

Choose a reason for hiding this comment

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

@Edoardo-Pedicillo Edoardo-Pedicillo added this pull request to the merge queue Mar 12, 2024
Merged via the queue into main with commit bc2e1e7 Mar 12, 2024
21 checks passed
@Edoardo-Pedicillo Edoardo-Pedicillo deleted the results_json_extension branch March 12, 2024 14:34
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.

Missing extension to the results filename for singleshot classification
3 participants