-
Notifications
You must be signed in to change notification settings - Fork 17
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 fidelities #906
Add fidelities #906
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #906 +/- ##
==========================================
+ Coverage 66.64% 66.72% +0.07%
==========================================
Files 55 55
Lines 5954 5968 +14
==========================================
+ Hits 3968 3982 +14
Misses 1986 1986
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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 agree with @stavros11 comments. I'm adding a few style-related comments.
However, in general I'd try to have a fixed layout, and instead of making operations conditional on something (like the if pairs:
branchings) I'd rather try to design the code to work smoothly in limit cases (i.e. if you get an empty dictionary, you just do nothing, and you shouldn't need any further conditional). Moreover, keeping a fixed layout makes it simpler to avoid branching.
However, in this case maintaining compatibility is likely more relevant, so please follow @stavros11 advice.
"qubit1", | ||
"qubit2", |
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.
Where are these names coming from?
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.
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 now wonder whether it would be a better option to have one each...
Btw, we don't even strictly need the EXCLUDED_FIELDS
constant, but we could use field(..., metadata={"excluded": True})
or use Annotated[..., EXCLUDED]
as type hint (defining an EXCLUDED
constant), to keep it local to the ignored field.
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.
(a possible way of defining unique constants can be found in the standard library https://github.com/python/cpython/blob/b03d71d0d8415281e71ae4f1455222db4b4b66d2/Lib/dataclasses.py#L184-L186)
(at runtime, you could filter dataclass.fields()
by using EXCLUDED not in field.type.__metadata__
)
src/qibolab/serialize.py
Outdated
@@ -163,6 +172,11 @@ def dump_characterization(qubits: QubitMap, couplers: CouplerMap = None) -> dict | |||
}, | |||
} | |||
|
|||
if pairs: |
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.
if pairs: | |
if pairs is not None: |
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.
pairs
is an empty dictionary, if I make it a None
when there is no qubit pairs it will start complaining in several places when it gets asked for values. So could I keep this to check for empty dictionaries ?
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 he meant len(pairs) > 0
.
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.
Ah sure, that I can do
Co-authored-by: Stavros Efthymiou <[email protected]> Co-authored-by: Alessandro Candido <[email protected]>
Thanks @stavros11 |
Add fidelitiy attributes
Checklist: