Skip to content

Conversation

@matulni
Copy link
Contributor

@matulni matulni commented Jan 6, 2026

This commit adds the necessary methods to replace parametric angles by numerical values in OpenGraph, PauliFlow and XZCorrections instances.

@codecov
Copy link

codecov bot commented Jan 6, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.99%. Comparing base (14a05b1) to head (864fb66).

Files with missing lines Patch % Lines
graphix/flow/core.py 46.66% 8 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

"""
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`.
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Copy link
Collaborator

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.

Copy link
Collaborator

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.

Copy link
Collaborator

@thierry-martinez thierry-martinez left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks.

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