erado 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- erado-1.0.0/.github/CODEOWNERS +1 -0
- erado-1.0.0/.github/actions/init/action.yaml +7 -0
- erado-1.0.0/.github/pull_request_template.md +8 -0
- erado-1.0.0/.github/workflows/build.yaml +99 -0
- erado-1.0.0/.github/workflows/docs.yaml +58 -0
- erado-1.0.0/.gitignore +199 -0
- erado-1.0.0/.pre-commit-config.yaml +20 -0
- erado-1.0.0/.python-version +1 -0
- erado-1.0.0/.vscode/extensions.json +8 -0
- erado-1.0.0/.vscode/settings.json +14 -0
- erado-1.0.0/.vscode/tasks.json +27 -0
- erado-1.0.0/LICENSE +28 -0
- erado-1.0.0/PKG-INFO +110 -0
- erado-1.0.0/docs/CONTRIBUTING.md +38 -0
- erado-1.0.0/docs/Makefile +20 -0
- erado-1.0.0/docs/README.md +90 -0
- erado-1.0.0/docs/__init__.py +0 -0
- erado-1.0.0/docs/_static/OQC-Logo-Black.svg +1 -0
- erado-1.0.0/docs/_static/OQC-Logo-White.svg +1 -0
- erado-1.0.0/docs/_templates/versioning.html +33 -0
- erado-1.0.0/docs/conf.py +167 -0
- erado-1.0.0/docs/getting-started.rst +167 -0
- erado-1.0.0/docs/index.rst +18 -0
- erado-1.0.0/docs/lic-page.md +4 -0
- erado-1.0.0/docs/make.bat +35 -0
- erado-1.0.0/docs/util/__init__.py +0 -0
- erado-1.0.0/docs/util/core.py +6 -0
- erado-1.0.0/docs/util/index.html +10 -0
- erado-1.0.0/docs/util/redirect.py +33 -0
- erado-1.0.0/docs/util/version.py +32 -0
- erado-1.0.0/examples/models_and_frontend.py +146 -0
- erado-1.0.0/pyproject.toml +148 -0
- erado-1.0.0/src/erado/__init__.py +1 -0
- erado-1.0.0/src/erado/circuits.py +52 -0
- erado-1.0.0/src/erado/fidelity.py +142 -0
- erado-1.0.0/src/erado/frontend.py +242 -0
- erado-1.0.0/src/erado/models/__init__.py +5 -0
- erado-1.0.0/src/erado/models/circuit_sampler.py +324 -0
- erado-1.0.0/src/erado/models/core.py +212 -0
- erado-1.0.0/src/erado/models/transpiler_pass.py +322 -0
- erado-1.0.0/src/erado/py.typed +0 -0
- erado-1.0.0/src/erado/util.py +196 -0
- erado-1.0.0/src/make_stubs.py +220 -0
- erado-1.0.0/tests/__init__.py +1 -0
- erado-1.0.0/tests/conftest.py +17 -0
- erado-1.0.0/tests/test_CircuitState.py +51 -0
- erado-1.0.0/tests/test_frontend.py +84 -0
- erado-1.0.0/typings/qiskit/_accelerate/circuit.pyi +5721 -0
- erado-1.0.0/uv.lock +1509 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* sgriffiths@oqc.tech
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
[Replace this with a description of the PR as appropriate, and please tick off the 'Due diligence' tasks below ready for review.]
|
|
2
|
+
|
|
3
|
+
## Due diligence
|
|
4
|
+
|
|
5
|
+
- [ ] Assign PR to author.
|
|
6
|
+
- [ ] Ensure status checks are passing (linting, type checking and unit tests can all be run locally with `poe checks`).
|
|
7
|
+
- [ ] Add a label(s) to the PR to indicate its broad intention.
|
|
8
|
+
- [ ] Add unit tests for the new fix/feature (if applicable).
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
name: build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
tags:
|
|
8
|
+
- '**'
|
|
9
|
+
pull_request:
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
type-checking:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v6
|
|
18
|
+
|
|
19
|
+
- uses: ./.github/actions/init
|
|
20
|
+
|
|
21
|
+
- name: Type checking with Pyright
|
|
22
|
+
run: |
|
|
23
|
+
uv run --all-groups poe types
|
|
24
|
+
|
|
25
|
+
pre-commit-hooks:
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v6
|
|
30
|
+
|
|
31
|
+
- uses: ./.github/actions/init
|
|
32
|
+
|
|
33
|
+
- name: Check all pre-commit hooks
|
|
34
|
+
run: |
|
|
35
|
+
uv run poe pre-commit
|
|
36
|
+
|
|
37
|
+
unit-tests:
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v6
|
|
42
|
+
|
|
43
|
+
- uses: ./.github/actions/init
|
|
44
|
+
|
|
45
|
+
- name: Run all unit tests
|
|
46
|
+
run: |
|
|
47
|
+
uv run poe unit-tests
|
|
48
|
+
|
|
49
|
+
lint:
|
|
50
|
+
runs-on: ubuntu-latest
|
|
51
|
+
|
|
52
|
+
steps:
|
|
53
|
+
- uses: actions/checkout@v6
|
|
54
|
+
|
|
55
|
+
- uses: ./.github/actions/init
|
|
56
|
+
|
|
57
|
+
- name: Lint Python with Ruff
|
|
58
|
+
run: |
|
|
59
|
+
uv run poe lint
|
|
60
|
+
|
|
61
|
+
secrets:
|
|
62
|
+
runs-on: ubuntu-latest
|
|
63
|
+
|
|
64
|
+
steps:
|
|
65
|
+
- uses: actions/checkout@v6
|
|
66
|
+
with:
|
|
67
|
+
fetch-depth: 0
|
|
68
|
+
|
|
69
|
+
- uses: gitleaks/gitleaks-action@v2
|
|
70
|
+
env:
|
|
71
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
72
|
+
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
|
|
73
|
+
|
|
74
|
+
publish:
|
|
75
|
+
runs-on: ubuntu-latest
|
|
76
|
+
|
|
77
|
+
# Only publish if this is a passing version-tag push to main OR a manual workflow_dispatch
|
|
78
|
+
needs: [type-checking, pre-commit-hooks, unit-tests, lint, secrets]
|
|
79
|
+
if: startsWith(github.ref, 'refs/tags/v') && github.event_name != 'pull_request'
|
|
80
|
+
|
|
81
|
+
permissions:
|
|
82
|
+
contents: read
|
|
83
|
+
id-token: write
|
|
84
|
+
|
|
85
|
+
steps:
|
|
86
|
+
- uses: actions/checkout@v6
|
|
87
|
+
with:
|
|
88
|
+
fetch-depth: 0
|
|
89
|
+
fetch-tags: true
|
|
90
|
+
|
|
91
|
+
- uses: ./.github/actions/init
|
|
92
|
+
|
|
93
|
+
- name: Build package
|
|
94
|
+
run: |
|
|
95
|
+
uv build
|
|
96
|
+
|
|
97
|
+
- name: Publish to internal PyPI
|
|
98
|
+
run: |
|
|
99
|
+
uv publish
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
name: docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
pages: write
|
|
12
|
+
id-token: write
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: pages
|
|
16
|
+
cancel-in-progress: false
|
|
17
|
+
|
|
18
|
+
env:
|
|
19
|
+
BUILD_DIR: docs/_build
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
build:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- name: Checkout repository
|
|
27
|
+
uses: actions/checkout@v6
|
|
28
|
+
with:
|
|
29
|
+
fetch-depth: 0
|
|
30
|
+
|
|
31
|
+
- name: Setup github pages
|
|
32
|
+
uses: actions/configure-pages@v5
|
|
33
|
+
|
|
34
|
+
- uses: ./.github/actions/init
|
|
35
|
+
|
|
36
|
+
- name: Build docs with Sphinx
|
|
37
|
+
run: |
|
|
38
|
+
uv run --group docs poe docs-build ${{ env.BUILD_DIR }}
|
|
39
|
+
|
|
40
|
+
- name: Disable Jekyll processing to correctly serve static folders
|
|
41
|
+
run: |
|
|
42
|
+
touch ${{ env.BUILD_DIR }}/.nojekyll
|
|
43
|
+
|
|
44
|
+
- name: Upload artifact
|
|
45
|
+
uses: actions/upload-pages-artifact@v3
|
|
46
|
+
with:
|
|
47
|
+
path: ${{ env.BUILD_DIR }}
|
|
48
|
+
|
|
49
|
+
deploy:
|
|
50
|
+
environment:
|
|
51
|
+
name: github-pages
|
|
52
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
needs: build
|
|
55
|
+
steps:
|
|
56
|
+
- name: Deploy to GitHub Pages
|
|
57
|
+
id: deployment
|
|
58
|
+
uses: actions/deploy-pages@v4
|
erado-1.0.0/.gitignore
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Created by https://www.toptal.com/developers/gitignore/api/python,visualstudiocode
|
|
2
|
+
# Edit at https://www.toptal.com/developers/gitignore?templates=python,visualstudiocode
|
|
3
|
+
|
|
4
|
+
### Python ###
|
|
5
|
+
# Byte-compiled / optimized / DLL files
|
|
6
|
+
__pycache__/
|
|
7
|
+
*.py[cod]
|
|
8
|
+
*$py.class
|
|
9
|
+
|
|
10
|
+
# C extensions
|
|
11
|
+
*.so
|
|
12
|
+
|
|
13
|
+
# Distribution / packaging
|
|
14
|
+
.Python
|
|
15
|
+
build/
|
|
16
|
+
develop-eggs/
|
|
17
|
+
dist/
|
|
18
|
+
downloads/
|
|
19
|
+
eggs/
|
|
20
|
+
.eggs/
|
|
21
|
+
lib/
|
|
22
|
+
lib64/
|
|
23
|
+
parts/
|
|
24
|
+
sdist/
|
|
25
|
+
var/
|
|
26
|
+
wheels/
|
|
27
|
+
share/python-wheels/
|
|
28
|
+
*.egg-info/
|
|
29
|
+
.installed.cfg
|
|
30
|
+
*.egg
|
|
31
|
+
MANIFEST
|
|
32
|
+
|
|
33
|
+
# PyInstaller
|
|
34
|
+
# Usually these files are written by a python script from a template
|
|
35
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
36
|
+
*.manifest
|
|
37
|
+
*.spec
|
|
38
|
+
|
|
39
|
+
# Installer logs
|
|
40
|
+
pip-log.txt
|
|
41
|
+
pip-delete-this-directory.txt
|
|
42
|
+
|
|
43
|
+
# Unit test / coverage reports
|
|
44
|
+
htmlcov/
|
|
45
|
+
.tox/
|
|
46
|
+
.nox/
|
|
47
|
+
.coverage
|
|
48
|
+
.coverage.*
|
|
49
|
+
.cache
|
|
50
|
+
nosetests.xml
|
|
51
|
+
coverage.xml
|
|
52
|
+
*.cover
|
|
53
|
+
*.py,cover
|
|
54
|
+
.hypothesis/
|
|
55
|
+
.pytest_cache/
|
|
56
|
+
cover/
|
|
57
|
+
|
|
58
|
+
# Translations
|
|
59
|
+
*.mo
|
|
60
|
+
*.pot
|
|
61
|
+
|
|
62
|
+
# Django stuff:
|
|
63
|
+
*.log
|
|
64
|
+
local_settings.py
|
|
65
|
+
db.sqlite3
|
|
66
|
+
db.sqlite3-journal
|
|
67
|
+
|
|
68
|
+
# Flask stuff:
|
|
69
|
+
instance/
|
|
70
|
+
.webassets-cache
|
|
71
|
+
|
|
72
|
+
# Scrapy stuff:
|
|
73
|
+
.scrapy
|
|
74
|
+
|
|
75
|
+
# Sphinx documentation
|
|
76
|
+
docs/_build/
|
|
77
|
+
|
|
78
|
+
# PyBuilder
|
|
79
|
+
.pybuilder/
|
|
80
|
+
target/
|
|
81
|
+
|
|
82
|
+
# Jupyter Notebook
|
|
83
|
+
.ipynb_checkpoints
|
|
84
|
+
|
|
85
|
+
# IPython
|
|
86
|
+
profile_default/
|
|
87
|
+
ipython_config.py
|
|
88
|
+
|
|
89
|
+
# pyenv
|
|
90
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
91
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
92
|
+
# .python-version
|
|
93
|
+
|
|
94
|
+
# pipenv
|
|
95
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
96
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
97
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
98
|
+
# install all needed dependencies.
|
|
99
|
+
#Pipfile.lock
|
|
100
|
+
|
|
101
|
+
# poetry
|
|
102
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
103
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
104
|
+
# commonly ignored for libraries.
|
|
105
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
106
|
+
#poetry.lock
|
|
107
|
+
|
|
108
|
+
# pdm
|
|
109
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
110
|
+
#pdm.lock
|
|
111
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
112
|
+
# in version control.
|
|
113
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
114
|
+
.pdm.toml
|
|
115
|
+
|
|
116
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
117
|
+
__pypackages__/
|
|
118
|
+
|
|
119
|
+
# Celery stuff
|
|
120
|
+
celerybeat-schedule
|
|
121
|
+
celerybeat.pid
|
|
122
|
+
|
|
123
|
+
# SageMath parsed files
|
|
124
|
+
*.sage.py
|
|
125
|
+
|
|
126
|
+
# Environments
|
|
127
|
+
.env
|
|
128
|
+
.venv
|
|
129
|
+
env/
|
|
130
|
+
venv/
|
|
131
|
+
ENV/
|
|
132
|
+
env.bak/
|
|
133
|
+
venv.bak/
|
|
134
|
+
|
|
135
|
+
# Spyder project settings
|
|
136
|
+
.spyderproject
|
|
137
|
+
.spyproject
|
|
138
|
+
|
|
139
|
+
# Rope project settings
|
|
140
|
+
.ropeproject
|
|
141
|
+
|
|
142
|
+
# mkdocs documentation
|
|
143
|
+
/site
|
|
144
|
+
|
|
145
|
+
# mypy
|
|
146
|
+
.mypy_cache/
|
|
147
|
+
.dmypy.json
|
|
148
|
+
dmypy.json
|
|
149
|
+
|
|
150
|
+
# Pyre type checker
|
|
151
|
+
.pyre/
|
|
152
|
+
|
|
153
|
+
# pytype static type analyzer
|
|
154
|
+
.pytype/
|
|
155
|
+
|
|
156
|
+
# Cython debug symbols
|
|
157
|
+
cython_debug/
|
|
158
|
+
|
|
159
|
+
# PyCharm
|
|
160
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
161
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
162
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
163
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
164
|
+
#.idea/
|
|
165
|
+
|
|
166
|
+
### Python Patch ###
|
|
167
|
+
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
|
|
168
|
+
poetry.toml
|
|
169
|
+
|
|
170
|
+
# ruff
|
|
171
|
+
.ruff_cache/
|
|
172
|
+
|
|
173
|
+
# LSP config files
|
|
174
|
+
pyrightconfig.json
|
|
175
|
+
|
|
176
|
+
### VisualStudioCode ###
|
|
177
|
+
.vscode/*
|
|
178
|
+
!.vscode/settings.json
|
|
179
|
+
!.vscode/tasks.json
|
|
180
|
+
!.vscode/launch.json
|
|
181
|
+
!.vscode/extensions.json
|
|
182
|
+
!.vscode/*.code-snippets
|
|
183
|
+
|
|
184
|
+
# Local History for Visual Studio Code
|
|
185
|
+
.history/
|
|
186
|
+
|
|
187
|
+
# Built Visual Studio Code Extensions
|
|
188
|
+
*.vsix
|
|
189
|
+
|
|
190
|
+
### VisualStudioCode Patch ###
|
|
191
|
+
# Ignore all local history of files
|
|
192
|
+
.history
|
|
193
|
+
.ionide
|
|
194
|
+
|
|
195
|
+
# End of https://www.toptal.com/developers/gitignore/api/python,visualstudiocode
|
|
196
|
+
|
|
197
|
+
# erado-specific ignores
|
|
198
|
+
data/
|
|
199
|
+
version.env
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v6.0.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: check-yaml
|
|
8
|
+
- id: check-added-large-files
|
|
9
|
+
- id: fix-byte-order-marker
|
|
10
|
+
- id: mixed-line-ending
|
|
11
|
+
- id: name-tests-test
|
|
12
|
+
args: [--pytest-test-first]
|
|
13
|
+
- repo: https://github.com/astral-sh/uv-pre-commit
|
|
14
|
+
rev: 0.10.9
|
|
15
|
+
hooks:
|
|
16
|
+
- id: uv-lock
|
|
17
|
+
- repo: https://github.com/gitleaks/gitleaks
|
|
18
|
+
rev: v8.30.0
|
|
19
|
+
hooks:
|
|
20
|
+
- id: gitleaks
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files.trimTrailingWhitespace": true,
|
|
3
|
+
"files.trimFinalNewlines": true,
|
|
4
|
+
"python.testing.pytestArgs": [
|
|
5
|
+
"tests",
|
|
6
|
+
],
|
|
7
|
+
"python.testing.unittestEnabled": false,
|
|
8
|
+
"python.testing.pytestEnabled": true,
|
|
9
|
+
"autoDocstring.docstringFormat": "google-notypes",
|
|
10
|
+
"todo-tree.filtering.excludeGlobs": [
|
|
11
|
+
"**/node_modules/*/**",
|
|
12
|
+
"typings/",
|
|
13
|
+
],
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
|
3
|
+
// for the documentation about the tasks.json format
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"tasks": [
|
|
6
|
+
{
|
|
7
|
+
"label": "Docs: build",
|
|
8
|
+
"type": "shell",
|
|
9
|
+
"command": "uv run --group docs poe docs-build",
|
|
10
|
+
"problemMatcher": [],
|
|
11
|
+
"group": {
|
|
12
|
+
"kind": "build",
|
|
13
|
+
"isDefault": true
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"label": "Docs: preview",
|
|
18
|
+
"type": "shell",
|
|
19
|
+
"command": "uv run --group docs poe docs-preview",
|
|
20
|
+
"problemMatcher": [],
|
|
21
|
+
"group": {
|
|
22
|
+
"kind": "build",
|
|
23
|
+
"isDefault": false
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
erado-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Oxford Quantum Circuits
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
erado-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: erado
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Simulation suite for erasure noise and postselection as quantum error mitigation.
|
|
5
|
+
Project-URL: homepage, https://oqc.tech
|
|
6
|
+
Project-URL: repository, https://github.com/oqc-community/erado
|
|
7
|
+
Project-URL: documentation, https://oqc-community.github.io/erado
|
|
8
|
+
Author-email: Sam Griffiths <sgriffiths@oqc.tech>
|
|
9
|
+
License-Expression: BSD-3-Clause
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Python: >=3.13
|
|
12
|
+
Requires-Dist: matplotlib>=3.10.6
|
|
13
|
+
Requires-Dist: numpy>=2.3.3
|
|
14
|
+
Requires-Dist: pydantic>=2.12.0
|
|
15
|
+
Requires-Dist: qiskit-aer-gpu-cu11>=0.17.2; sys_platform == 'linux'
|
|
16
|
+
Requires-Dist: qiskit-aer>=0.17.2; sys_platform != 'linux'
|
|
17
|
+
Requires-Dist: qiskit>=2.2.1
|
|
18
|
+
Requires-Dist: scipy>=1.16.2
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# erado
|
|
22
|
+
|
|
23
|
+
Simulation suite for erasure noise and postselection as quantum error mitigation.
|
|
24
|
+
|
|
25
|
+
[](https://github.com/oqc-community/erado/actions/workflows/build.yaml) [](https://github.com/pre-commit/pre-commit) [](https://pypi.org/project/erado/) [](https://oqc-community.github.io/erado)
|
|
26
|
+
|
|
27
|
+
[**ērādō**](https://en.wiktionary.org/wiki/erado) \
|
|
28
|
+
Latin verb; *third conjugation*
|
|
29
|
+
|
|
30
|
+
1. to scrape away, pare
|
|
31
|
+
2. to abolish, eradicate, remove
|
|
32
|
+
3. to ***erase***, delete
|
|
33
|
+
|
|
34
|
+
## Overview
|
|
35
|
+
|
|
36
|
+
[`erado`](https://github.com/oqc-community/erado) is [OQC](https://oqc.tech/)'s [Qiskit](https://github.com/Qiskit/qiskit)-based Python library for the simulation of circuit-level erasure noise and postselection, with arbitrary quantum circuits.
|
|
37
|
+
|
|
38
|
+
For a conceptual introduction, usage instructions and API reference, please see [the library documentation](https://oqc-community.github.io/erado/latest/getting-started).
|
|
39
|
+
|
|
40
|
+
For theoretical background and numerical details, see our corresponding paper: *coming very soon!*
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
### Published package
|
|
45
|
+
|
|
46
|
+
The `erado` Python package is published to PyPI (<https://pypi.org/project/erado>), so you can install it easily via pip (or any similar package manager), e.g.:
|
|
47
|
+
|
|
48
|
+
```shell
|
|
49
|
+
pip install erado
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
or add it as a dependency in your `pyproject.toml` file (automatically or manually) if using a package manager such as uv or Poetry, e.g.:
|
|
53
|
+
|
|
54
|
+
```shell
|
|
55
|
+
uv add erado
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
> ⚠️ **NOTE:**
|
|
59
|
+
> GPU capabilities are provided by the [`qiskit-aer-gpu-cu11`](https://pypi.org/project/qiskit-aer-gpu-cu11/) package, which is only available on x86_64 Linux. Therefore, `qiskit-aer-gpu-cu11` will be installed if `sys.platform() == "linux"`, otherwise `qiskit-aer` will be installed (i.e. if on Windows etc.).
|
|
60
|
+
|
|
61
|
+
### From source (uv)
|
|
62
|
+
|
|
63
|
+
This package uses [uv](https://docs.astral.sh/uv) for Python project management. For more information on installation from source and development/testing utilities, please see our [contribution guidelines](./CONTRIBUTING.md).
|
|
64
|
+
|
|
65
|
+
## Example usage
|
|
66
|
+
|
|
67
|
+
A motivating example for a simulation running a Qiskit circuit with erasure noise, imperfect erasure checks and postselection (including per-shot circuit fidelity) is as follows:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from erado import (
|
|
71
|
+
circuits,
|
|
72
|
+
models,
|
|
73
|
+
fidelity,
|
|
74
|
+
frontend,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
import qiskit_aer
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
n_qubits = 5
|
|
81
|
+
circuit = circuits.qft_linear(n_qubits)
|
|
82
|
+
circuit.save_statevector(label=fidelity.STATE_LABEL, pershot=True)
|
|
83
|
+
circuit.measure_all()
|
|
84
|
+
|
|
85
|
+
erasure_model = models.ErasureCircuitSampler(
|
|
86
|
+
circuit=circuit,
|
|
87
|
+
erasure_rate=0.01,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
backend = qiskit_aer.AerSimulator(method="statevector")
|
|
91
|
+
|
|
92
|
+
sim_frontend = frontend.ErasureSimFrontend(
|
|
93
|
+
model=erasure_model,
|
|
94
|
+
false_positive_rate=0.005,
|
|
95
|
+
false_negative_rate=0.010,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
results = sim_frontend.run(
|
|
99
|
+
backend=backend,
|
|
100
|
+
shots=1000,
|
|
101
|
+
postselect=True,
|
|
102
|
+
get_fidelities=True,
|
|
103
|
+
)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
For a more detailed introduction as to how and why to use this library, see our ['Getting Started'](https://oqc-community.github.io/erado/latest/getting-started) page.
|
|
107
|
+
|
|
108
|
+
## Acknowledgements
|
|
109
|
+
|
|
110
|
+
This work was supported by the Innovate UK Quantum Missions pilot competition 10148061 DECIDE: Dimon error correction integrated into a data-centre environment.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
*This codebase broadly follows the [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html), with some variations. Specific rule definitions can be found in [pyproject.toml](../pyproject.toml).*
|
|
4
|
+
|
|
5
|
+
## Installation from source
|
|
6
|
+
|
|
7
|
+
This package uses [uv](https://docs.astral.sh/uv) for Python project management; after cloning the repo, you can explicitly configure the project in a fresh virtual environment with
|
|
8
|
+
|
|
9
|
+
```shell
|
|
10
|
+
uv sync
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
> ⚠️ **NOTE:**
|
|
14
|
+
> GPU capabilities are provided by the [`qiskit-aer-gpu-cu11`](https://pypi.org/project/qiskit-aer-gpu-cu11/) package, which is only available on x86_64 Linux. Therefore, `qiskit-aer-gpu-cu11` will be installed if `sys.platform() == "linux"`, otherwise `qiskit-aer` will be installed (i.e. if on Windows etc.).
|
|
15
|
+
|
|
16
|
+
## Pre-commit hooks
|
|
17
|
+
|
|
18
|
+
This repo uses [pre-commit hooks](https://github.com/pre-commit/pre-commit) to ensure basic code quality (e.g. whitespace, line endings etc.); if you intend to contribute after cloning, it's best to set up pre-commits (to avoid failing PR checks) once with
|
|
19
|
+
|
|
20
|
+
```shell
|
|
21
|
+
uv run pre-commit install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Pre-commit hooks automatically check against changed files only. If you want to manually invoke the pre-commit rules on all files in the repo (although, by design, you generally won't need to do that), simply run
|
|
25
|
+
|
|
26
|
+
```shell
|
|
27
|
+
uv run poe pre-commit
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Static analysis and unit tests
|
|
31
|
+
|
|
32
|
+
The [`poe`](https://poethepoet.natn.io/index.html) command can also be used to run other common tasks. For example, all codebase checks (i.e. [linting (Ruff)](https://docs.astral.sh/ruff), [static type checking (Pyright)](https://github.com/microsoft/pyright) and [unit tests (pytest)](https://docs.pytest.org/en/stable)) can be performed with
|
|
33
|
+
|
|
34
|
+
```shell
|
|
35
|
+
uv run poe checks
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
You can consult the output of `uv run poe --help` for more information on other tasks also defined via the `poe` utility.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Minimal makefile for Sphinx documentation
|
|
2
|
+
#
|
|
3
|
+
|
|
4
|
+
# You can set these variables from the command line, and also
|
|
5
|
+
# from the environment for the first two.
|
|
6
|
+
SPHINXOPTS ?=
|
|
7
|
+
SPHINXBUILD ?= sphinx-build
|
|
8
|
+
SOURCEDIR = .
|
|
9
|
+
BUILDDIR = _build
|
|
10
|
+
|
|
11
|
+
# Put it first so that "make" without argument is like "make help".
|
|
12
|
+
help:
|
|
13
|
+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
14
|
+
|
|
15
|
+
.PHONY: help Makefile
|
|
16
|
+
|
|
17
|
+
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
18
|
+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
19
|
+
%: Makefile
|
|
20
|
+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|