Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ jobs:
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
pages-base-url: studious-adventure-r67917v.pages.github.io
pages-base-url: queracomputing.github.io/tsim
source-dir: ./site
2 changes: 1 addition & 1 deletion docs/demos/draft/decoding_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
"metadata": {},
"outputs": [],
"source": [
"import pyzx as zx\n",
"import pyzx_param as zx\n",
"from tsim.graph_util import transform_error_basis, squash_graph\n",
"\n",
"g = c.get_sampling_graph(sample_detectors=True)\n",
Expand Down
4 changes: 2 additions & 2 deletions docs/demos/tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"import sinter\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pyzx as zx\n",
"import pyzx_param as zx\n",
"from fractions import Fraction\n",
"from pyzx.graph.scalar import cexp\n",
"from pyzx_param.graph.scalar import cexp\n",
"import math"
]
},
Expand Down
5 changes: 5 additions & 0 deletions docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
:root {
--md-primary-fg-color: #00ba7c;
--md-accent-fg-color: #ff8208;
}

/* Hide the header and sidebar logo/icon */
.md-header__button.md-logo,
.md-nav__button.md-logo {
display: none;
}


Expand Down
6 changes: 1 addition & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dependencies = [
"lxml>=6.0.2",
"numpy>=2.2.6",
"pyperclip>=1.11.0",
"pyzx",
"pyzx-param>=0.9.0",
"stim>=1.15.0",
"sympy>=1.14.0",
"tqdm>=4.67.1",
Expand Down Expand Up @@ -136,11 +136,7 @@ omit = ["src/tsim/external/*"]

[tool.pytest.ini_options]
testpaths = "test/"
norecursedirs = ["pyzx"]

[tool.pyright]
include = ["src", "test"]
exclude = ["src/tsim/external"]

[tool.uv.sources]
pyzx = { git = "https://github.com/rafaelha/pyzx.git", rev = "paramzx" }
4 changes: 2 additions & 2 deletions src/tsim/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

from typing import Any, Iterable, Literal, cast, overload

import pyzx as zx
import pyzx_param as zx
import stim
from pyzx.graph.base import BaseGraph
from pyzx_param.graph.base import BaseGraph

from tsim.core.graph import build_sampling_graph
from tsim.core.parse import parse_parametric_tag, parse_stim_circuit
Expand Down
4 changes: 2 additions & 2 deletions src/tsim/compile/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import jax.numpy as jnp
import numpy as np
from jax import Array
from pyzx.graph.base import BaseGraph
from pyzx.graph.scalar import DyadicNumber
from pyzx_param.graph.base import BaseGraph
from pyzx_param.graph.scalar import DyadicNumber


class CompiledScalarGraphs(eqx.Module):
Expand Down
4 changes: 2 additions & 2 deletions src/tsim/compile/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from typing import Literal

import jax.numpy as jnp
import pyzx as zx
from pyzx.graph.base import BaseGraph
import pyzx_param as zx
from pyzx_param.graph.base import BaseGraph

from tsim.compile.compile import CompiledScalarGraphs, compile_scalar_graphs
from tsim.compile.stabrank import find_stab
Expand Down
4 changes: 2 additions & 2 deletions src/tsim/compile/stabrank.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from typing import Iterable, Sequence

import pyzx as zx
from pyzx.graph.base import BaseGraph
import pyzx_param as zx
from pyzx_param.graph.base import BaseGraph


def _decompose(
Expand Down
12 changes: 6 additions & 6 deletions src/tsim/core/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
from typing import TYPE_CHECKING, Any, Sequence

import numpy as np
import pyzx as zx
from pyzx.graph.base import BaseGraph
from pyzx.graph.graph import Graph
from pyzx.graph.graph_s import GraphS
from pyzx.graph.scalar import Scalar
from pyzx.utils import VertexType
import pyzx_param as zx
from pyzx_param.graph.base import BaseGraph
from pyzx_param.graph.graph import Graph
from pyzx_param.graph.graph_s import GraphS
from pyzx_param.graph.scalar import Scalar
from pyzx_param.utils import VertexType

from tsim.core.instructions import GraphRepresentation
from tsim.core.parse import parse_stim_circuit
Expand Down
4 changes: 2 additions & 2 deletions src/tsim/core/instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from typing import Callable, Literal

import numpy as np
from pyzx.graph.graph_s import GraphS
from pyzx.utils import EdgeType, VertexType
from pyzx_param.graph.graph_s import GraphS
from pyzx_param.utils import EdgeType, VertexType

from tsim.noise.channels import (
correlated_error_probs,
Expand Down
2 changes: 1 addition & 1 deletion src/tsim/core/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from jax import Array

if TYPE_CHECKING:
from pyzx.graph.base import BaseGraph
from pyzx_param.graph.base import BaseGraph

from tsim.compile.compile import CompiledScalarGraphs

Expand Down
2 changes: 1 addition & 1 deletion test/helpers/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def plot_comparison(
Args:
stim_state: Probabilities from VecSampler.
tsim_state: Probabilities from tsim.
exact_state: Probabilities from pyzx tensor contraction.
exact_state: Probabilities from pyzx_param tensor contraction.
plot_difference: If True, plot differences relative to tsim_state.
xlim: Optional x-axis limits for the plot.
"""
Expand Down
2 changes: 1 addition & 1 deletion test/integration/test_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import pymatching
import pytest
import pyzx as zx
import pyzx_param as zx
import stim
from tqdm import tqdm

Expand Down
10 changes: 5 additions & 5 deletions test/unit/test_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ def test_diagram_timeslice_svg():

def test_diagram_pyzx():
c = Circuit("H 0\nCNOT 0 1")
with patch("pyzx.draw") as mock_draw:
with patch("pyzx_param.draw") as mock_draw:
g = c.diagram(type="pyzx")
mock_draw.assert_called_once()
assert hasattr(g, "vertices")
Expand All @@ -597,23 +597,23 @@ def test_diagram_pyzx():

def test_diagram_pyzx_empty():
c = Circuit()
with patch("pyzx.draw") as mock_draw:
with patch("pyzx_param.draw") as mock_draw:
g = c.diagram(type="pyzx")
mock_draw.assert_not_called()
assert len(g.vertices()) == 0


def test_diagram_pyzx_meas():
c = Circuit("H 0\nM 0")
with patch("pyzx.draw") as mock_draw:
with patch("pyzx_param.draw") as mock_draw:
g = c.diagram(type="pyzx-meas")
mock_draw.assert_called_once()
assert hasattr(g, "vertices")


def test_diagram_pyzx_dets():
c = Circuit("H 0\nM 0\nDETECTOR rec[-1]")
with patch("pyzx.draw") as mock_draw:
with patch("pyzx_param.draw") as mock_draw:
g = c.diagram(type="pyzx-dets")
mock_draw.assert_called_once()
assert hasattr(g, "vertices")
Expand All @@ -624,7 +624,7 @@ def test_diagram_pyzx_scale_horizontally(
type: Literal["pyzx", "pyzx-meas", "pyzx-dets"],
):
c = Circuit("H 0\nCNOT 0 1")
with patch("pyzx.draw") as mock_draw:
with patch("pyzx_param.draw") as mock_draw:
g = c.diagram(type=type, scale_horizontally=2)
mock_draw.assert_called_once()
assert hasattr(g, "vertices")
2 changes: 1 addition & 1 deletion test/unit/utils/test_dyadic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import random

import numpy as np
from pyzx.graph.scalar import DyadicNumber
from pyzx_param.graph.scalar import DyadicNumber


def test_mul():
Expand Down
12 changes: 8 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.