-
Notifications
You must be signed in to change notification settings - Fork 1
Add coordinate support for nodes and QUBIT_COORDS in stim output #148
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
This adds the ability to store 2D/3D coordinates for nodes in GraphState and emit QUBIT_COORDS instructions in stim compiler output. Changes: - Add coordinates property and set_coordinate method to GraphState - Add coordinate parameter to add_physical_node and from_graph - Add coordinate field to N command - Add input_coordinates field and coordinates property to Pattern - Inherit coordinates from GraphState to Pattern via qompiler - Emit QUBIT_COORDS instructions in stim_compile (with emit_qubit_coords option) - Add use_graph_coordinates option to visualizer - Add comprehensive tests for coordinate functionality 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #148 +/- ##
==========================================
+ Coverage 76.71% 83.35% +6.64%
==========================================
Files 21 21
Lines 2276 2337 +61
Branches 401 421 +20
==========================================
+ Hits 1746 1948 +202
+ Misses 455 294 -161
- Partials 75 95 +20 🚀 New features to boost your workflow:
|
- Apply ruff format to fix formatting issues - Add test_compose_copies_coordinates to verify compose function copies coordinates from both graphs - Add tests/test_visualizer.py with coordinate tests for: - Graph coordinates usage - Partial coordinates handling - 3D to 2D projection - Empty coordinates fallback 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
- Support 1D coordinates in visualizer (y defaults to 0.0) - Add docstring note about 3D visualization being planned - Add test for set_coordinate with invalid node - Add tests for N command string representation - Add test for 1D coordinates in visualizer 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add coordinate parameter to BaseGraphState.add_physical_node - Rename _get_node_positions to _determine_node_positions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Changes
GraphState (
graphqomb/graphstate.py)coordinatesabstract property toBaseGraphState__coordinatesattribute,coordinatesproperty, andset_coordinatemethod toGraphStatecoordinateparameter toadd_physical_noderemove_physical_nodecoordinatesparameter tofrom_graphfrom_base_graph_statecomposeCommand (
graphqomb/command.py)coordinatefield toNcommandPattern (
graphqomb/pattern.py)input_coordinatesfield andcoordinatesproperty toPatternQompiler (
graphqomb/qompiler.py)_qompileStim Compiler (
graphqomb/stim_compiler.py)_emit_qubit_coordshelper function_initialize_nodesand_prepare_nodeemit_qubit_coordsoption tostim_compile(default True)Visualizer (
graphqomb/visualizer.py)_get_node_positionsfunctionuse_graph_coordinatesoption tovisualizeTest plan
set_coordinate/coordinatesfunctionalityadd_physical_nodefrom_graphfrom_base_graph_stateemit_qubit_coords=Falsecase🤖 Generated with Claude Code