From 5f9f84ede343bccefa476073991964e0318aed21 Mon Sep 17 00:00:00 2001 From: Arnau Casau Date: Tue, 3 Oct 2023 17:56:19 +0200 Subject: [PATCH 1/8] Fix tox -e docs and build docs in CI Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com> --- .github/workflows/tests.yml | 20 +++++++++++++++++++- MANIFEST.in | 1 + docs/conf.py | 2 +- requirements-dev.txt | 1 - src/qiskit_qec/operators/pauli_list.py | 6 ++++-- tox.ini | 2 +- 6 files changed, 26 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3494f3b5..6fe539cd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -48,4 +48,22 @@ jobs: pip install tox - name: Run styles check run: tox -elint - + docs: + name: Docs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: '3.9' + - name: Install tox + run: | + python -m pip install --upgrade pip + pip install tox + - name: Build Docs + run: tox -edocs + - uses: actions/upload-artifact@v3 + with: + name: html_docs + path: docs/_build/html diff --git a/MANIFEST.in b/MANIFEST.in index 5b7d79b9..054e0fa8 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,5 @@ include LICENSE.txt +include requirements.txt # Include the tests files. #recursive-include test *.py diff --git a/docs/conf.py b/docs/conf.py index f3b43aaf..d7e0f509 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -34,10 +34,10 @@ "sphinx.ext.mathjax", "sphinx.ext.viewcode", "sphinx.ext.extlinks", - "jupyter_sphinx", "sphinx_autodoc_typehints", "reno.sphinxext", "nbsphinx", + "matplotlib.sphinxext.plot_directive", ] templates_path = ["_templates"] numfig = True diff --git a/requirements-dev.txt b/requirements-dev.txt index 3702faed..4b472774 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,7 +3,6 @@ coverage==6.1.1 cmake!=3.17.1,!=3.17.0 qiskit-sphinx-theme>=1.6 sphinx-autodoc-typehints -jupyter-sphinx reno>=3.4.0 nbsphinx ddt~=1.4.2 diff --git a/src/qiskit_qec/operators/pauli_list.py b/src/qiskit_qec/operators/pauli_list.py index 60661a2b..3f0fab58 100644 --- a/src/qiskit_qec/operators/pauli_list.py +++ b/src/qiskit_qec/operators/pauli_list.py @@ -534,7 +534,8 @@ def sort(self, weight=False, phase=False): Consider sorting all a random ordering of all 2-qubit Paulis - .. jupyter-execute:: + .. plot:: + :include-source: from numpy.random import shuffle from qiskit.quantum_info.operators import PauliList @@ -573,7 +574,8 @@ def unique(self, return_index=False, return_counts=False): **Example** - .. jupyter-execute:: + .. plot:: + :include-source: from qiskit.quantum_info.operators import PauliList diff --git a/tox.ini b/tox.ini index 958c0931..3a8d37d1 100644 --- a/tox.ini +++ b/tox.ini @@ -37,4 +37,4 @@ deps = jax jaxlib commands = - sphinx-build -b html -W {posargs} docs/ docs/_build/html \ No newline at end of file + sphinx-build -b html docs/ docs/_build/html \ No newline at end of file From 53972c0e4e8ca4b7db91680a9fb2df4710dbab7e Mon Sep 17 00:00:00 2001 From: Arnau Casau Date: Tue, 3 Oct 2023 18:10:33 +0200 Subject: [PATCH 2/8] pandoc dependency added in docs test --- .github/workflows/tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6fe539cd..075ccfb6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -57,10 +57,12 @@ jobs: uses: actions/setup-python@v2 with: python-version: '3.9' - - name: Install tox + - name: Install dependencies run: | python -m pip install --upgrade pip pip install tox + sudo apt-get update + sudo apt-get install -y pandoc - name: Build Docs run: tox -edocs - uses: actions/upload-artifact@v3 From afea3487cac6b41654a951878dc67ddbeb58dcf7 Mon Sep 17 00:00:00 2001 From: Arnau Casau Date: Tue, 3 Oct 2023 19:18:14 +0200 Subject: [PATCH 3/8] remove duplicated currentmodule --- src/qiskit_qec/utils/__init__.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/qiskit_qec/utils/__init__.py b/src/qiskit_qec/utils/__init__.py index 11c4c162..326fadfd 100644 --- a/src/qiskit_qec/utils/__init__.py +++ b/src/qiskit_qec/utils/__init__.py @@ -16,9 +16,6 @@ =============================== .. currentmodule:: qiskit_qec.utils -======= -.. currentmodule:: qiskit_qec.utils - Utils module classes and functions ================================== From 5e9ae2f98063728fd84f520df3bbd9214747d32d Mon Sep 17 00:00:00 2001 From: Arnau Casau Date: Tue, 3 Oct 2023 21:28:47 +0200 Subject: [PATCH 4/8] remove import module errors --- docs/apidocs/extensions.rst | 4 ---- docs/apidocs/index.rst | 2 -- docs/apidocs/models.rst | 4 ---- requirements-dev.txt | 2 +- 4 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 docs/apidocs/extensions.rst delete mode 100644 docs/apidocs/models.rst diff --git a/docs/apidocs/extensions.rst b/docs/apidocs/extensions.rst deleted file mode 100644 index d0ca590f..00000000 --- a/docs/apidocs/extensions.rst +++ /dev/null @@ -1,4 +0,0 @@ -.. automodule:: qiskit_qec.extensions - :no-members: - :no-inherited-members: - :no-special-members: diff --git a/docs/apidocs/index.rst b/docs/apidocs/index.rst index 1094bc9f..95fef3da 100644 --- a/docs/apidocs/index.rst +++ b/docs/apidocs/index.rst @@ -13,11 +13,9 @@ Qiskit QEC API Reference circuits codes decoders - extensions geometry info linear - models operators structures utils diff --git a/docs/apidocs/models.rst b/docs/apidocs/models.rst deleted file mode 100644 index be76a833..00000000 --- a/docs/apidocs/models.rst +++ /dev/null @@ -1,4 +0,0 @@ -.. automodule:: qiskit_qec.models - :no-members: - :no-inherited-members: - :no-special-members: diff --git a/requirements-dev.txt b/requirements-dev.txt index 4b472774..f59cfc32 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,7 +1,7 @@ pylint coverage==6.1.1 cmake!=3.17.1,!=3.17.0 -qiskit-sphinx-theme>=1.6 +qiskit-sphinx-theme>=1.16 sphinx-autodoc-typehints reno>=3.4.0 nbsphinx From 4c416866b9680843a7c6d9cd9bf37c66d90d1c12 Mon Sep 17 00:00:00 2001 From: Arnau Casau Date: Tue, 3 Oct 2023 21:33:26 +0200 Subject: [PATCH 5/8] requirements qiskit-sphinx-theme back --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index f59cfc32..4b472774 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,7 +1,7 @@ pylint coverage==6.1.1 cmake!=3.17.1,!=3.17.0 -qiskit-sphinx-theme>=1.16 +qiskit-sphinx-theme>=1.6 sphinx-autodoc-typehints reno>=3.4.0 nbsphinx From 10fd0db096cdb3796b7aa39ecbe773f2b3a2f719 Mon Sep 17 00:00:00 2001 From: Arnau Casau Date: Thu, 5 Oct 2023 17:47:49 +0200 Subject: [PATCH 6/8] Some errors fixed --- docs/tutorials/QEC_Framework_IEEE_2022.ipynb | 35 ++++++++++---------- src/qiskit_qec/linear/__init__.py | 5 --- src/qiskit_qec/utils/stim_tools.py | 1 + 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/docs/tutorials/QEC_Framework_IEEE_2022.ipynb b/docs/tutorials/QEC_Framework_IEEE_2022.ipynb index 26023b7b..0b89fb11 100644 --- a/docs/tutorials/QEC_Framework_IEEE_2022.ipynb +++ b/docs/tutorials/QEC_Framework_IEEE_2022.ipynb @@ -118,8 +118,7 @@ "id": "4c797a9b-3e5b-421c-a377-241499ba3cb3", "metadata": {}, "source": [ - "Installation guide\n", - "==================\n", + "# Installation guide\n", "\n", "## Content\n", "* [Setting up python environment](#setting-up-python-environment)\n", @@ -248,7 +247,7 @@ "\n", "**Error correction** is a central topic in information theory and is concerned with the **detection** and **correction** of errors in information.\n", "\n", - "![image.png](attachment:d2c217dd-6426-4aad-a4fd-2b667fb7d53c.png)\n", + "![image2.png](attachment:d2c217dd-6426-4aad-a4fd-2b667fb7d53c.png)\n", "\n", "Here the bit flip channel is an error channel that flips individual bits independently with a given fixed probability. In this example we see that the funcdmental unit of storage is the bit - the two state space $\\mathbb{F}_2$. Here a message is therefore a string of bits and so an element of $\\mathbb{F}^n_2$ for some integer $n$." ] @@ -270,7 +269,7 @@ "id": "06a04858-2c82-4f72-a489-88c70d0209f9", "metadata": {}, "source": [ - "### Repitition Code (Classicial)\n", + "## Repitition Code (Classicial)\n", "\n", "The simplist approach to (classical) error correction is that of repitition: That is a 0 bit is replaced by a fixed number of 0 bits (say 3) 000 and a 1 bit is replaced by the same number of 1 bits 111. The then binary information before can be encoded as follows:\n", "\n", @@ -331,7 +330,7 @@ "\n", "In classical error correction the simplest fundamental unit is the bit ($\\mathbb{F}_2$) where as in the quantum world the simplest fundamental unit is the qubit ($\\mathbb{C}^2$). Consider the differences:\n", "\n", - "![image.png](attachment:5821844f-a69e-4b82-8b3e-a63b1da78c17.png)\n", + "![image3.png](attachment:5821844f-a69e-4b82-8b3e-a63b1da78c17.png)\n", "\n", "We consider $\\mathbb{C}^2$ as a complex Hilbert space (think complex vector space with an inner product $\\langle,\\rangle>$ such that the induced norm makes the space a complete metric space).\n", "\n" @@ -507,7 +506,7 @@ "\n", "$$X|0\\rangle = |1\\rangle, \\quad X|1\\rangle = |0\\rangle \\quad \\textrm{(Bit Flip)} \\qquad\\qquad Z|0\\rangle = |0\\rangle, \\quad Z|1\\rangle = -|1\\rangle \\quad \\textrm{(Phase Flip)}$$\n", "\n", - "![image.png](attachment:d84d4c58-c10c-42e3-ba94-1eac80ac53fc.png)" + "![image4.png](attachment:d84d4c58-c10c-42e3-ba94-1eac80ac53fc.png)" ] }, { @@ -1095,15 +1094,15 @@ "\n", "#### The Toric Code (Dual Representation - Qubits on edges)\n", "\n", - "![image.png](attachment:40af3476-0e19-4eb3-9af7-1af9c8a73e51.png)\n", + "![image5.png](attachment:40af3476-0e19-4eb3-9af7-1af9c8a73e51.png)\n", "\n", "#### The Toric Code (Face Representation Qubits on vertices)\n", "\n", - "![image.png](attachment:39fef1a3-8443-40ab-91a9-aa3e848a050f.png)\n", + "![image6.png](attachment:39fef1a3-8443-40ab-91a9-aa3e848a050f.png)\n", "\n", "#### Rorated Surface Code (Face Representation - Qubits on vertices)\n", "\n", - "![image.png](attachment:a6a7e099-4400-402e-abbf-1494e7756fb8.png)\n", + "![image7.png](attachment:a6a7e099-4400-402e-abbf-1494e7756fb8.png)\n", "\n", "\n", "\n", @@ -1922,7 +1921,7 @@ "id": "02e206b2-ac12-4cd3-a46f-d5aeb3153540", "metadata": {}, "source": [ - "![image.png](attachment:14b32718-5ccc-4bae-aa32-29ed41723b26.png)" + "![image8.png](attachment:14b32718-5ccc-4bae-aa32-29ed41723b26.png)" ] }, { @@ -2064,15 +2063,15 @@ "\n", "### The Toric Code (Dual Representation - Qubits on edges)\n", "\n", - "![image.png](attachment:aa883dea-3abf-4afc-ba62-82bd5a9bdcd1.png)\n", + "![image9.png](attachment:aa883dea-3abf-4afc-ba62-82bd5a9bdcd1.png)\n", "\n", "### The Toric Code (Face Representation Qubits on vertices)\n", "\n", - "![image.png](attachment:153ccb81-3281-42d9-8a39-1a9441777669.png)\n", + "![image10.png](attachment:153ccb81-3281-42d9-8a39-1a9441777669.png)\n", "\n", "### Rorated Surface Code (Face Representation - Qubits on vertices)\n", "\n", - "![image.png](attachment:10177f45-d543-4dfe-950a-f708a7c2785b.png)\n" + "![image11.png](attachment:10177f45-d543-4dfe-950a-f708a7c2785b.png)\n" ] }, { @@ -2092,9 +2091,9 @@ "\n", "The general concept that TileFactories uses relates to tiling/celluation of a region of some surface of which gauge operators are assigned to the cells inside the region along with the associated qubits. The operators/cells that are on the boundary are then modified according to some given appraoch to end up with a set of gauge group generators for a stabilizer subsystem code.\n", "\n", - "![image.png](attachment:76b2a019-704f-44c5-8c1e-f4502da91dd7.png)\n", + "![image12.png](attachment:76b2a019-704f-44c5-8c1e-f4502da91dd7.png)\n", "\n", - "![image.png](attachment:0e37e976-1396-41e9-9f73-d1be2788bc48.png)\n", + "![image13.png](attachment:0e37e976-1396-41e9-9f73-d1be2788bc48.png)\n", "\n", "\n", "TileFactories use a simplified approach where by the region on the surface is tiled using a choosen tile relative to a lattice on that region. For example the second tiling above used the four square tile bedlow with the regulat lattive $\\mathbb{Z}^2$:" @@ -2135,7 +2134,7 @@ "source": [ "A tile is a small collection of gauge operators layed out in a planar region that can be used to tile a region. The Tile contains data on the operators as well as geometric data.\n", "\n", - "![image.png](attachment:13de2438-058c-4d0f-a619-7b909f17399f.png)\n", + "![image14.png](attachment:13de2438-058c-4d0f-a619-7b909f17399f.png)\n", "\n", "
\n", " Update: The current structure for storing these geometries has been updated slightly to allow for collections of operators to create one larger single operator.\n", @@ -2985,7 +2984,7 @@ "\n", "Let's build a $YZX^2$ Hexagonal stabilizer code by Basudha Srivastava, Anton Frisk Kockum, and Mats Granath [https://doi.org/10.22331/q-2022-04-27-698]\n", "\n", - "![image.png](attachment:735545cb-5835-4ff4-b1fc-0c4537912337.png)" + "![image15.png](attachment:735545cb-5835-4ff4-b1fc-0c4537912337.png)" ] }, { @@ -3303,7 +3302,7 @@ "\n", "Let $\\mathcal{E}$ be a completely positive trace preserving (CPTP) linear map $\\mathcal{E}:D(\\mathcal{H})\\rightarrow D(\\mathcal{H})$ that is correctable with respect to the subsystem code $\\mathcal{H} = (A\\otimes{B})\\oplus{C}$. Then a set up for a simple quantum memory experiment would be as follows:\n", "\n", - "![image.png](attachment:c45c9495-da83-4720-be64-8c40d1dd9172.png)\n", + "![image16.png](attachment:c45c9495-da83-4720-be64-8c40d1dd9172.png)\n", "\n", "Here the signatures are eigenvalues for each of the stabilizer/gauge/check/flag/etc operators measured. For QEC experiments the eigenvalues are usually translated into 0s or 1s with a 0 indicating the the +1 eigenstate - i.e. no error detected and a 1 indicating the detection of an error. Ideal syndrome extraction in which no errors occur during the QEC cycle. The more general case is when errors can occur during the QEC cycle. \n", "\n", diff --git a/src/qiskit_qec/linear/__init__.py b/src/qiskit_qec/linear/__init__.py index 6442cc4b..291e03f3 100644 --- a/src/qiskit_qec/linear/__init__.py +++ b/src/qiskit_qec/linear/__init__.py @@ -21,11 +21,6 @@ Linear module classes and functions =================================== -.. autosummary:: - :toctree: ../stubs/ - - Bit - SMatrix Linear matrix functions ======================= diff --git a/src/qiskit_qec/utils/stim_tools.py b/src/qiskit_qec/utils/stim_tools.py index 17015ab4..ba1a05d5 100644 --- a/src/qiskit_qec/utils/stim_tools.py +++ b/src/qiskit_qec/utils/stim_tools.py @@ -36,6 +36,7 @@ def get_stim_circuits(circuit_dict: Dict[int, QuantumCircuit]): """Converts compatible qiskit circuits to stim circuits. Dictionaries are not complete. For the stim definitions see: https://github.com/quantumlib/Stim/blob/main/doc/gates.md + Args: circuit_dict: Compatible gates are paulis, controlled paulis, h, s, and sdg, swap, reset, measure and barrier. Compatible noise operators From f8b9f3f5c20701c62c5665385dc93d74fc11b56e Mon Sep 17 00:00:00 2001 From: Arnau Casau Date: Thu, 5 Oct 2023 19:17:04 +0200 Subject: [PATCH 7/8] Reno removed & lint fixed --- docs/conf.py | 1 - docs/index.rst | 1 - docs/release_notes.rst | 1 - requirements-dev.txt | 1 - src/qiskit_qec/utils/stim_tools.py | 2 +- 5 files changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index ca7d3491..b593fd90 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -35,7 +35,6 @@ "sphinx.ext.viewcode", "sphinx.ext.extlinks", "sphinx_autodoc_typehints", - "reno.sphinxext", "nbsphinx", "matplotlib.sphinxext.plot_directive", ] diff --git a/docs/index.rst b/docs/index.rst index 9d6e4921..f6ffe5fc 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -18,7 +18,6 @@ Qiskit QEC is an open-source framework for developers, experimentalist and theor How-to Guides API References Discussions - Release Notes .. Hiding - Indices and tables :ref:`genindex` diff --git a/docs/release_notes.rst b/docs/release_notes.rst index ec77acc3..e69de29b 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -1 +0,0 @@ -.. release-notes:: Release Notes diff --git a/requirements-dev.txt b/requirements-dev.txt index 4b472774..01be5d73 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,7 +3,6 @@ coverage==6.1.1 cmake!=3.17.1,!=3.17.0 qiskit-sphinx-theme>=1.6 sphinx-autodoc-typehints -reno>=3.4.0 nbsphinx ddt~=1.4.2 matplotlib>=3.3.0 diff --git a/src/qiskit_qec/utils/stim_tools.py b/src/qiskit_qec/utils/stim_tools.py index ba1a05d5..5c8285ea 100644 --- a/src/qiskit_qec/utils/stim_tools.py +++ b/src/qiskit_qec/utils/stim_tools.py @@ -36,7 +36,7 @@ def get_stim_circuits(circuit_dict: Dict[int, QuantumCircuit]): """Converts compatible qiskit circuits to stim circuits. Dictionaries are not complete. For the stim definitions see: https://github.com/quantumlib/Stim/blob/main/doc/gates.md - + Args: circuit_dict: Compatible gates are paulis, controlled paulis, h, s, and sdg, swap, reset, measure and barrier. Compatible noise operators From b971882aadd4020780fe29b80bf9ee326cb2f2bb Mon Sep 17 00:00:00 2001 From: Arnau Casau Date: Thu, 5 Oct 2023 19:37:31 +0200 Subject: [PATCH 8/8] release_notes removed --- docs/release_notes.rst | 0 releasenotes/config.yaml | 3 - .../notes/example-d4b1c2dbc14a89bd.yaml | 65 ------------------- 3 files changed, 68 deletions(-) delete mode 100644 docs/release_notes.rst delete mode 100644 releasenotes/config.yaml delete mode 100644 releasenotes/notes/example-d4b1c2dbc14a89bd.yaml diff --git a/docs/release_notes.rst b/docs/release_notes.rst deleted file mode 100644 index e69de29b..00000000 diff --git a/releasenotes/config.yaml b/releasenotes/config.yaml deleted file mode 100644 index 141d552c..00000000 --- a/releasenotes/config.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -encoding: utf8 -default_branch: main diff --git a/releasenotes/notes/example-d4b1c2dbc14a89bd.yaml b/releasenotes/notes/example-d4b1c2dbc14a89bd.yaml deleted file mode 100644 index 5e93448a..00000000 --- a/releasenotes/notes/example-d4b1c2dbc14a89bd.yaml +++ /dev/null @@ -1,65 +0,0 @@ ---- -prelude: > - Replace this text with content to appear at the top of the section for this - release. All of the prelude content is merged together and then rendered - separately from the items listed in other parts of the file, so the text - needs to be worded so that both the prelude and the other items make sense - when read independently. This may mean repeating some details. Not every - release note requires a prelude. Usually only notes describing major - features or adding release theme details should have a prelude. -features: - - | - List new features here, or remove this section. All of the list items in - this section are combined when the release notes are rendered, so the text - needs to be worded so that it does not depend on any information only - available in another section, such as the prelude. This may mean repeating - some details. -issues: - - | - List known issues here, or remove this section. All of the list items in - this section are combined when the release notes are rendered, so the text - needs to be worded so that it does not depend on any information only - available in another section, such as the prelude. This may mean repeating - some details. -upgrade: - - | - List upgrade notes here, or remove this section. All of the list items in - this section are combined when the release notes are rendered, so the text - needs to be worded so that it does not depend on any information only - available in another section, such as the prelude. This may mean repeating - some details. -deprecations: - - | - List deprecations notes here, or remove this section. All of the list - items in this section are combined when the release notes are rendered, so - the text needs to be worded so that it does not depend on any information - only available in another section, such as the prelude. This may mean - repeating some details. -critical: - - | - Add critical notes here, or remove this section. All of the list items in - this section are combined when the release notes are rendered, so the text - needs to be worded so that it does not depend on any information only - available in another section, such as the prelude. This may mean repeating - some details. -security: - - | - Add security notes here, or remove this section. All of the list items in - this section are combined when the release notes are rendered, so the text - needs to be worded so that it does not depend on any information only - available in another section, such as the prelude. This may mean repeating - some details. -fixes: - - | - Add normal bug fixes here, or remove this section. All of the list items - in this section are combined when the release notes are rendered, so the - text needs to be worded so that it does not depend on any information only - available in another section, such as the prelude. This may mean repeating - some details. -other: - - | - Add other notes here, or remove this section. All of the list items in - this section are combined when the release notes are rendered, so the text - needs to be worded so that it does not depend on any information only - available in another section, such as the prelude. This may mean repeating - some details.