-
Notifications
You must be signed in to change notification settings - Fork 41
Replacement of parametric angles in OpenGraph, PauliFlow and XZCorrections
#410
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #410 +/- ##
==========================================
- Coverage 85.03% 84.99% -0.04%
==========================================
Files 46 46
Lines 6654 6677 +23
==========================================
+ Hits 5658 5675 +17
- Misses 996 1002 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| """ | ||
| return self.og.measurements[node].to_plane_or_axis() | ||
|
|
||
| def subs( # noqa: PYI019 Annotating with `Self` is not possible since `self` must be of parametric type `Measurement`. |
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.
Why is self: PauliFlow[Measurement] not enough? I think both PauliFlow and Measurement could be considered final classes.
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 had an issue with the return type: if it is PauliFlow[Measurement] the following code is problematic:
alpha = Placeholder("alpha")
value = 0.3
og = OpenGraph(graph=nx.Graph([(0, 1)]), input_nodes=[0], output_nodes=[], measurements={0: Measurement(alpha, Plane.XY), 1: Measurement(0.3, Plane.YZ)})
gflow = og.extract_gflow()
gflow_new: GFlow[Measurement] = gflow.subs(alpha, value) # mypy complains about the annotation.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.
Oh, indeed! Sorry, I forgot that PauliFlow was not final.
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.
Oh, indeed! Sorry, I forgot that PauliFlow was not final.
thierry-martinez
left a comment
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.
LGTM! Thanks.
This commit adds the necessary methods to replace parametric angles by numerical values in
OpenGraph,PauliFlowandXZCorrectionsinstances.