sinter 1.12.dev1690241034__tar.gz → 1.12.dev1690946907__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.
Potentially problematic release.
This version of sinter might be problematic. Click here for more details.
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/PKG-INFO +1 -1
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/setup.py +3 -3
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/__init__.py +1 -1
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_decoding_all_built_in_decoders.py +0 -5
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_decoding_test.py +82 -65
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter.egg-info/PKG-INFO +1 -1
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter.egg-info/SOURCES.txt +0 -1
- sinter-1.12.dev1690946907/src/sinter.egg-info/requires.txt +4 -0
- sinter-1.12.dev1690241034/src/sinter/_decoding_internal.py +0 -49
- sinter-1.12.dev1690241034/src/sinter.egg-info/requires.txt +0 -4
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/README.md +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/readme_example_plot.png +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/requirements.txt +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/setup.cfg +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_anon_task_stats.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_anon_task_stats_test.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_collection.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_collection_options.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_collection_options_test.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_collection_test.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_collection_tracker_for_single_task.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_collection_work_manager.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_csv_out.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_decoding.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_decoding_decoder_class.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_decoding_fusion_blossom.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_decoding_pymatching.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_decoding_vacuous.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_existing_data.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_existing_data_test.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_main.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_main_collect.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_main_collect_test.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_main_combine.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_main_combine_test.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_main_plot.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_main_plot_test.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_main_predict.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_main_predict_test.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_plotting.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_plotting_test.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_predict.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_predict_test.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_printer.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_probability_util.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_probability_util_test.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_task.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_task_stats.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_task_stats_test.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_task_test.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_worker.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_worker_test.py +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter.egg-info/dependency_links.txt +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter.egg-info/entry_points.txt +0 -0
- {sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter.egg-info/top_level.txt +0 -0
|
@@ -17,9 +17,9 @@ from setuptools import setup
|
|
|
17
17
|
with open('README.md', encoding='UTF-8') as f:
|
|
18
18
|
long_description = f.read()
|
|
19
19
|
with open('requirements.txt', encoding='UTF-8') as f:
|
|
20
|
-
requirements =
|
|
20
|
+
requirements = f.read().splitlines()
|
|
21
21
|
|
|
22
|
-
__version__ = '1.12.
|
|
22
|
+
__version__ = '1.12.dev1690946907'
|
|
23
23
|
|
|
24
24
|
setup(
|
|
25
25
|
name='sinter',
|
|
@@ -35,7 +35,7 @@ setup(
|
|
|
35
35
|
python_requires='>=3.7.0',
|
|
36
36
|
data_files=['README.md', 'requirements.txt', 'readme_example_plot.png'],
|
|
37
37
|
install_requires=requirements,
|
|
38
|
-
tests_require=['pytest'],
|
|
38
|
+
tests_require=['pytest', 'pymatching'],
|
|
39
39
|
entry_points={
|
|
40
40
|
'console_scripts': ['sinter=sinter._main:main'],
|
|
41
41
|
},
|
|
@@ -2,7 +2,6 @@ from typing import Dict
|
|
|
2
2
|
|
|
3
3
|
from sinter._decoding_decoder_class import Decoder
|
|
4
4
|
from sinter._decoding_fusion_blossom import FusionBlossomDecoder
|
|
5
|
-
from sinter._decoding_internal import InternalDecoder
|
|
6
5
|
from sinter._decoding_pymatching import PyMatchingDecoder
|
|
7
6
|
from sinter._decoding_vacuous import VacuousDecoder
|
|
8
7
|
|
|
@@ -10,8 +9,4 @@ BUILT_IN_DECODERS: Dict[str, Decoder] = {
|
|
|
10
9
|
'vacuous': VacuousDecoder(),
|
|
11
10
|
'pymatching': PyMatchingDecoder(),
|
|
12
11
|
'fusion_blossom': FusionBlossomDecoder(),
|
|
13
|
-
'internal': InternalDecoder('internal'),
|
|
14
|
-
'internal_correlated': InternalDecoder('internal_correlated'),
|
|
15
|
-
'internal_2': InternalDecoder('internal_2'),
|
|
16
|
-
'internal_correlated_2': InternalDecoder('internal_correlated_2'),
|
|
17
12
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
1
3
|
import pathlib
|
|
2
4
|
import tempfile
|
|
3
|
-
from typing import Optional
|
|
5
|
+
from typing import Dict, List, Optional, Tuple
|
|
4
6
|
|
|
5
7
|
import numpy as np
|
|
6
8
|
import pytest
|
|
@@ -11,28 +13,44 @@ import stim
|
|
|
11
13
|
from sinter._collection import post_selection_mask_from_4th_coord
|
|
12
14
|
from sinter._decoding import sample_decode
|
|
13
15
|
from sinter._decoding_all_built_in_decoders import BUILT_IN_DECODERS
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
from sinter._decoding_vacuous import VacuousDecoder
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def get_test_decoders() -> Tuple[List[str], Dict[str, sinter.Decoder]]:
|
|
20
|
+
available_decoders = list(BUILT_IN_DECODERS.keys())
|
|
21
|
+
custom_decoders = {}
|
|
22
|
+
try:
|
|
23
|
+
import pymatching
|
|
24
|
+
except ImportError:
|
|
25
|
+
available_decoders.remove('pymatching')
|
|
26
|
+
try:
|
|
27
|
+
import fusion_blossom
|
|
28
|
+
except ImportError:
|
|
29
|
+
available_decoders.remove('fusion_blossom')
|
|
30
|
+
|
|
31
|
+
e = os.environ.get('SINTER_PYTEST_CUSTOM_DECODERS')
|
|
32
|
+
if e is not None:
|
|
33
|
+
for term in e.split(';'):
|
|
34
|
+
module, method = term.split(':')
|
|
35
|
+
for name, obj in getattr(__import__(module), method)().items():
|
|
36
|
+
custom_decoders[name] = obj
|
|
37
|
+
available_decoders.append(name)
|
|
38
|
+
|
|
39
|
+
available_decoders.append("also_vacuous")
|
|
40
|
+
custom_decoders["also_vacuous"] = VacuousDecoder()
|
|
41
|
+
return available_decoders, custom_decoders
|
|
42
|
+
|
|
43
|
+
TEST_DECODER_NAMES, TEST_CUSTOM_DECODERS = get_test_decoders()
|
|
24
44
|
|
|
25
45
|
DECODER_CASES = [
|
|
26
|
-
(
|
|
27
|
-
for
|
|
28
|
-
for
|
|
46
|
+
(decoder, force_streaming)
|
|
47
|
+
for decoder in TEST_DECODER_NAMES
|
|
48
|
+
for force_streaming in [None, True]
|
|
29
49
|
]
|
|
30
50
|
|
|
31
51
|
|
|
32
|
-
@pytest.mark.parametrize('decoder,
|
|
33
|
-
def test_decode_repetition_code(decoder: str,
|
|
34
|
-
pytest.importorskip(required_import)
|
|
35
|
-
|
|
52
|
+
@pytest.mark.parametrize('decoder,force_streaming', DECODER_CASES)
|
|
53
|
+
def test_decode_repetition_code(decoder: str, force_streaming: Optional[bool]):
|
|
36
54
|
circuit = stim.Circuit.generated('repetition_code:memory',
|
|
37
55
|
rounds=3,
|
|
38
56
|
distance=3,
|
|
@@ -44,17 +62,17 @@ def test_decode_repetition_code(decoder: str, required_import: str, force_stream
|
|
|
44
62
|
dem_path=None,
|
|
45
63
|
num_shots=1000,
|
|
46
64
|
decoder=decoder,
|
|
65
|
+
__private__unstable__force_decode_on_disk=force_streaming,
|
|
66
|
+
custom_decoders=TEST_CUSTOM_DECODERS,
|
|
47
67
|
)
|
|
48
68
|
assert result.discards == 0
|
|
49
|
-
if
|
|
69
|
+
if 'vacuous' not in decoder:
|
|
50
70
|
assert 1 <= result.errors <= 100
|
|
51
71
|
assert result.shots == 1000
|
|
52
72
|
|
|
53
73
|
|
|
54
|
-
@pytest.mark.parametrize('decoder,
|
|
55
|
-
def test_decode_surface_code(decoder: str,
|
|
56
|
-
pytest.importorskip(required_import)
|
|
57
|
-
|
|
74
|
+
@pytest.mark.parametrize('decoder,force_streaming', DECODER_CASES)
|
|
75
|
+
def test_decode_surface_code(decoder: str, force_streaming: Optional[bool]):
|
|
58
76
|
circuit = stim.Circuit.generated(
|
|
59
77
|
"surface_code:rotated_memory_x",
|
|
60
78
|
distance=3,
|
|
@@ -69,14 +87,14 @@ def test_decode_surface_code(decoder: str, required_import: str, force_streaming
|
|
|
69
87
|
dem_path=None,
|
|
70
88
|
decoder=decoder,
|
|
71
89
|
__private__unstable__force_decode_on_disk=force_streaming,
|
|
90
|
+
custom_decoders=TEST_CUSTOM_DECODERS,
|
|
72
91
|
)
|
|
73
|
-
if
|
|
92
|
+
if 'vacuous' not in decoder:
|
|
74
93
|
assert 0 <= stats.errors <= 50
|
|
75
94
|
|
|
76
95
|
|
|
77
|
-
@pytest.mark.parametrize('decoder,
|
|
78
|
-
def test_empty(decoder: str,
|
|
79
|
-
pytest.importorskip(required_import)
|
|
96
|
+
@pytest.mark.parametrize('decoder,force_streaming', DECODER_CASES)
|
|
97
|
+
def test_empty(decoder: str, force_streaming: Optional[bool]):
|
|
80
98
|
circuit = stim.Circuit()
|
|
81
99
|
result = sample_decode(
|
|
82
100
|
circuit_obj=circuit,
|
|
@@ -86,15 +104,15 @@ def test_empty(decoder: str, required_import: str, force_streaming: Optional[boo
|
|
|
86
104
|
num_shots=1000,
|
|
87
105
|
decoder=decoder,
|
|
88
106
|
__private__unstable__force_decode_on_disk=force_streaming,
|
|
107
|
+
custom_decoders=TEST_CUSTOM_DECODERS,
|
|
89
108
|
)
|
|
90
109
|
assert result.discards == 0
|
|
91
110
|
assert result.shots == 1000
|
|
92
111
|
assert result.errors == 0
|
|
93
112
|
|
|
94
113
|
|
|
95
|
-
@pytest.mark.parametrize('decoder,
|
|
96
|
-
def test_no_observables(decoder: str,
|
|
97
|
-
pytest.importorskip(required_import)
|
|
114
|
+
@pytest.mark.parametrize('decoder,force_streaming', DECODER_CASES)
|
|
115
|
+
def test_no_observables(decoder: str, force_streaming: Optional[bool]):
|
|
98
116
|
circuit = stim.Circuit("""
|
|
99
117
|
X_ERROR(0.1) 0
|
|
100
118
|
M 0
|
|
@@ -108,15 +126,15 @@ def test_no_observables(decoder: str, required_import: str, force_streaming: Opt
|
|
|
108
126
|
num_shots=1000,
|
|
109
127
|
decoder=decoder,
|
|
110
128
|
__private__unstable__force_decode_on_disk=force_streaming,
|
|
129
|
+
custom_decoders=TEST_CUSTOM_DECODERS,
|
|
111
130
|
)
|
|
112
131
|
assert result.discards == 0
|
|
113
132
|
assert result.shots == 1000
|
|
114
133
|
assert result.errors == 0
|
|
115
134
|
|
|
116
135
|
|
|
117
|
-
@pytest.mark.parametrize('decoder,
|
|
118
|
-
def test_invincible_observables(decoder: str,
|
|
119
|
-
pytest.importorskip(required_import)
|
|
136
|
+
@pytest.mark.parametrize('decoder,force_streaming', DECODER_CASES)
|
|
137
|
+
def test_invincible_observables(decoder: str, force_streaming: Optional[bool]):
|
|
120
138
|
circuit = stim.Circuit("""
|
|
121
139
|
X_ERROR(0.1) 0
|
|
122
140
|
M 0 1
|
|
@@ -131,15 +149,15 @@ def test_invincible_observables(decoder: str, required_import: str, force_stream
|
|
|
131
149
|
num_shots=1000,
|
|
132
150
|
decoder=decoder,
|
|
133
151
|
__private__unstable__force_decode_on_disk=force_streaming,
|
|
152
|
+
custom_decoders=TEST_CUSTOM_DECODERS,
|
|
134
153
|
)
|
|
135
154
|
assert result.discards == 0
|
|
136
155
|
assert result.shots == 1000
|
|
137
156
|
assert result.errors == 0
|
|
138
157
|
|
|
139
158
|
|
|
140
|
-
@pytest.mark.parametrize('decoder,
|
|
141
|
-
def test_observable_offsets_mod8(decoder: str,
|
|
142
|
-
pytest.importorskip(required_import)
|
|
159
|
+
@pytest.mark.parametrize('decoder,force_streaming,offset', [(a, b, c) for a, b in DECODER_CASES for c in range(8)])
|
|
160
|
+
def test_observable_offsets_mod8(decoder: str, force_streaming: bool, offset: int):
|
|
143
161
|
circuit = stim.Circuit("""
|
|
144
162
|
X_ERROR(0.1) 0
|
|
145
163
|
MR 0
|
|
@@ -157,15 +175,15 @@ def test_observable_offsets_mod8(decoder: str, required_import: str, force_strea
|
|
|
157
175
|
num_shots=1000,
|
|
158
176
|
decoder=decoder,
|
|
159
177
|
__private__unstable__force_decode_on_disk=force_streaming,
|
|
178
|
+
custom_decoders=TEST_CUSTOM_DECODERS,
|
|
160
179
|
)
|
|
161
180
|
assert result.discards == 0
|
|
162
181
|
assert result.shots == 1000
|
|
163
182
|
assert 50 <= result.errors <= 150
|
|
164
183
|
|
|
165
184
|
|
|
166
|
-
@pytest.mark.parametrize('decoder,
|
|
167
|
-
def test_no_detectors(decoder: str,
|
|
168
|
-
pytest.importorskip(required_import)
|
|
185
|
+
@pytest.mark.parametrize('decoder,force_streaming', DECODER_CASES)
|
|
186
|
+
def test_no_detectors(decoder: str, force_streaming: Optional[bool]):
|
|
169
187
|
circuit = stim.Circuit("""
|
|
170
188
|
X_ERROR(0.1) 0
|
|
171
189
|
M 0
|
|
@@ -179,14 +197,14 @@ def test_no_detectors(decoder: str, required_import: str, force_streaming: Optio
|
|
|
179
197
|
num_shots=1000,
|
|
180
198
|
decoder=decoder,
|
|
181
199
|
__private__unstable__force_decode_on_disk=force_streaming,
|
|
200
|
+
custom_decoders=TEST_CUSTOM_DECODERS,
|
|
182
201
|
)
|
|
183
202
|
assert result.discards == 0
|
|
184
203
|
assert 50 <= result.errors <= 150
|
|
185
204
|
|
|
186
205
|
|
|
187
|
-
@pytest.mark.parametrize('decoder,
|
|
188
|
-
def test_no_detectors_with_post_mask(decoder: str,
|
|
189
|
-
pytest.importorskip(required_import)
|
|
206
|
+
@pytest.mark.parametrize('decoder,force_streaming', DECODER_CASES)
|
|
207
|
+
def test_no_detectors_with_post_mask(decoder: str, force_streaming: Optional[bool]):
|
|
190
208
|
circuit = stim.Circuit("""
|
|
191
209
|
X_ERROR(0.1) 0
|
|
192
210
|
M 0
|
|
@@ -201,14 +219,14 @@ def test_no_detectors_with_post_mask(decoder: str, required_import: str, force_s
|
|
|
201
219
|
num_shots=1000,
|
|
202
220
|
decoder=decoder,
|
|
203
221
|
__private__unstable__force_decode_on_disk=force_streaming,
|
|
222
|
+
custom_decoders=TEST_CUSTOM_DECODERS,
|
|
204
223
|
)
|
|
205
224
|
assert result.discards == 0
|
|
206
225
|
assert 50 <= result.errors <= 150
|
|
207
226
|
|
|
208
227
|
|
|
209
|
-
@pytest.mark.parametrize('decoder,
|
|
210
|
-
def test_post_selection(decoder: str,
|
|
211
|
-
pytest.importorskip(required_import)
|
|
228
|
+
@pytest.mark.parametrize('decoder,force_streaming', DECODER_CASES)
|
|
229
|
+
def test_post_selection(decoder: str, force_streaming: Optional[bool]):
|
|
212
230
|
circuit = stim.Circuit("""
|
|
213
231
|
X_ERROR(0.6) 0
|
|
214
232
|
M 0
|
|
@@ -233,15 +251,15 @@ def test_post_selection(decoder: str, required_import: str, force_streaming: Opt
|
|
|
233
251
|
num_shots=2000,
|
|
234
252
|
decoder=decoder,
|
|
235
253
|
__private__unstable__force_decode_on_disk=force_streaming,
|
|
254
|
+
custom_decoders=TEST_CUSTOM_DECODERS,
|
|
236
255
|
)
|
|
237
256
|
assert 1050 <= result.discards <= 1350
|
|
238
|
-
if
|
|
257
|
+
if 'vacuous' not in decoder:
|
|
239
258
|
assert 40 <= result.errors <= 160
|
|
240
259
|
|
|
241
260
|
|
|
242
|
-
@pytest.mark.parametrize('decoder,
|
|
243
|
-
def test_observable_post_selection(decoder: str,
|
|
244
|
-
pytest.importorskip(required_import)
|
|
261
|
+
@pytest.mark.parametrize('decoder,force_streaming', DECODER_CASES)
|
|
262
|
+
def test_observable_post_selection(decoder: str, force_streaming: Optional[bool]):
|
|
245
263
|
circuit = stim.Circuit("""
|
|
246
264
|
X_ERROR(0.1) 0
|
|
247
265
|
X_ERROR(0.2) 1
|
|
@@ -259,15 +277,15 @@ def test_observable_post_selection(decoder: str, required_import: str, force_str
|
|
|
259
277
|
num_shots=10000,
|
|
260
278
|
decoder=decoder,
|
|
261
279
|
__private__unstable__force_decode_on_disk=force_streaming,
|
|
280
|
+
custom_decoders=TEST_CUSTOM_DECODERS,
|
|
262
281
|
)
|
|
263
282
|
np.testing.assert_allclose(result.discards / result.shots, 0.2, atol=0.1)
|
|
264
|
-
if
|
|
283
|
+
if 'vacuous' not in decoder:
|
|
265
284
|
np.testing.assert_allclose(result.errors / (result.shots - result.discards), 0.1, atol=0.05)
|
|
266
285
|
|
|
267
286
|
|
|
268
|
-
@pytest.mark.parametrize('decoder,
|
|
269
|
-
def test_error_splitting(decoder: str,
|
|
270
|
-
pytest.importorskip(required_import)
|
|
287
|
+
@pytest.mark.parametrize('decoder,force_streaming', DECODER_CASES)
|
|
288
|
+
def test_error_splitting(decoder: str, force_streaming: Optional[bool]):
|
|
271
289
|
circuit = stim.Circuit("""
|
|
272
290
|
X_ERROR(0.1) 0
|
|
273
291
|
X_ERROR(0.2) 1
|
|
@@ -285,19 +303,19 @@ def test_error_splitting(decoder: str, required_import: str, force_streaming: Op
|
|
|
285
303
|
decoder=decoder,
|
|
286
304
|
count_observable_error_combos=True,
|
|
287
305
|
__private__unstable__force_decode_on_disk=force_streaming,
|
|
306
|
+
custom_decoders=TEST_CUSTOM_DECODERS,
|
|
288
307
|
)
|
|
289
308
|
assert result.discards == 0
|
|
290
309
|
assert set(result.custom_counts.keys()) == {'obs_mistake_mask=E_', 'obs_mistake_mask=_E', 'obs_mistake_mask=EE'}
|
|
291
|
-
if
|
|
310
|
+
if 'vacuous' not in decoder:
|
|
292
311
|
np.testing.assert_allclose(result.errors / result.shots, 1 - 0.8 * 0.9, atol=0.05)
|
|
293
312
|
np.testing.assert_allclose(result.custom_counts['obs_mistake_mask=E_'] / result.shots, 0.1 * 0.2, atol=0.05)
|
|
294
313
|
np.testing.assert_allclose(result.custom_counts['obs_mistake_mask=_E'] / result.shots, 0.1 * 0.8, atol=0.05)
|
|
295
314
|
np.testing.assert_allclose(result.custom_counts['obs_mistake_mask=EE'] / result.shots, 0.9 * 0.2, atol=0.05)
|
|
296
315
|
|
|
297
316
|
|
|
298
|
-
@pytest.mark.parametrize('decoder,
|
|
299
|
-
def test_detector_counting(decoder: str,
|
|
300
|
-
pytest.importorskip(required_import)
|
|
317
|
+
@pytest.mark.parametrize('decoder,force_streaming', DECODER_CASES)
|
|
318
|
+
def test_detector_counting(decoder: str, force_streaming: Optional[bool]):
|
|
301
319
|
circuit = stim.Circuit("""
|
|
302
320
|
X_ERROR(0.1) 0
|
|
303
321
|
X_ERROR(0.2) 1
|
|
@@ -317,6 +335,7 @@ def test_detector_counting(decoder: str, required_import: str, force_streaming:
|
|
|
317
335
|
decoder=decoder,
|
|
318
336
|
count_detection_events=True,
|
|
319
337
|
__private__unstable__force_decode_on_disk=force_streaming,
|
|
338
|
+
custom_decoders=TEST_CUSTOM_DECODERS,
|
|
320
339
|
)
|
|
321
340
|
assert result.discards == 0
|
|
322
341
|
assert result.custom_counts['detectors_checked'] == 20000
|
|
@@ -324,10 +343,8 @@ def test_detector_counting(decoder: str, required_import: str, force_streaming:
|
|
|
324
343
|
assert set(result.custom_counts.keys()) == {'detectors_checked', 'detection_events'}
|
|
325
344
|
|
|
326
345
|
|
|
327
|
-
@pytest.mark.parametrize('decoder,
|
|
328
|
-
def test_decode_fails_correctly(decoder: str,
|
|
329
|
-
pytest.importorskip(required_import)
|
|
330
|
-
|
|
346
|
+
@pytest.mark.parametrize('decoder,force_streaming', DECODER_CASES)
|
|
347
|
+
def test_decode_fails_correctly(decoder: str, force_streaming: Optional[bool]):
|
|
331
348
|
decoder_obj = BUILT_IN_DECODERS.get(decoder)
|
|
332
349
|
with tempfile.TemporaryDirectory() as d:
|
|
333
350
|
d = pathlib.Path(d)
|
|
@@ -344,7 +361,7 @@ def test_decode_fails_correctly(decoder: str, required_import: str, force_stream
|
|
|
344
361
|
with open(d / 'bad_dets.b8', 'wb') as f:
|
|
345
362
|
f.write(b'!')
|
|
346
363
|
|
|
347
|
-
if
|
|
364
|
+
if 'vacuous' not in decoder:
|
|
348
365
|
with pytest.raises(Exception):
|
|
349
366
|
decoder_obj.decode_via_files(
|
|
350
367
|
num_shots=1,
|
|
@@ -357,14 +374,14 @@ def test_decode_fails_correctly(decoder: str, required_import: str, force_stream
|
|
|
357
374
|
)
|
|
358
375
|
|
|
359
376
|
|
|
360
|
-
@pytest.mark.parametrize('decoder
|
|
361
|
-
def test_full_scale(decoder: str
|
|
362
|
-
pytest.importorskip(required_import)
|
|
377
|
+
@pytest.mark.parametrize('decoder', TEST_DECODER_NAMES)
|
|
378
|
+
def test_full_scale(decoder: str):
|
|
363
379
|
result, = sinter.collect(
|
|
364
380
|
num_workers=2,
|
|
365
381
|
tasks=[sinter.Task(circuit=stim.Circuit())],
|
|
366
382
|
decoders=[decoder],
|
|
367
383
|
max_shots=1000,
|
|
384
|
+
custom_decoders=TEST_CUSTOM_DECODERS,
|
|
368
385
|
)
|
|
369
386
|
assert result.discards == 0
|
|
370
387
|
assert result.shots == 1000
|
|
@@ -16,7 +16,6 @@ src/sinter/_decoding.py
|
|
|
16
16
|
src/sinter/_decoding_all_built_in_decoders.py
|
|
17
17
|
src/sinter/_decoding_decoder_class.py
|
|
18
18
|
src/sinter/_decoding_fusion_blossom.py
|
|
19
|
-
src/sinter/_decoding_internal.py
|
|
20
19
|
src/sinter/_decoding_pymatching.py
|
|
21
20
|
src/sinter/_decoding_test.py
|
|
22
21
|
src/sinter/_decoding_vacuous.py
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import pathlib
|
|
2
|
-
|
|
3
|
-
from sinter._decoding_decoder_class import Decoder, CompiledDecoder
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class InternalDecoder(Decoder):
|
|
7
|
-
"""Use internal decoders to predict observables from detection events."""
|
|
8
|
-
|
|
9
|
-
def __init__(self, name: str):
|
|
10
|
-
self.name = name
|
|
11
|
-
|
|
12
|
-
def compile_decoder_for_dem(self, *, dem: 'stim.DetectorErrorModel') -> CompiledDecoder:
|
|
13
|
-
try:
|
|
14
|
-
import gqec # Internal python wheel.
|
|
15
|
-
except ImportError as ex:
|
|
16
|
-
raise ImportError(
|
|
17
|
-
"The decoder 'internal*' isn't installed.\n"
|
|
18
|
-
"These decoders aren't publicly available.\n"
|
|
19
|
-
) from ex
|
|
20
|
-
|
|
21
|
-
if not hasattr(gqec, 'compile_decoder_for_sinter'):
|
|
22
|
-
raise NotImplementedError()
|
|
23
|
-
return gqec.compile_decoder_for_sinter(dem)
|
|
24
|
-
|
|
25
|
-
def decode_via_files(self,
|
|
26
|
-
*,
|
|
27
|
-
num_shots: int,
|
|
28
|
-
num_dets: int,
|
|
29
|
-
num_obs: int,
|
|
30
|
-
dem_path: pathlib.Path,
|
|
31
|
-
dets_b8_in_path: pathlib.Path,
|
|
32
|
-
obs_predictions_b8_out_path: pathlib.Path,
|
|
33
|
-
tmp_dir: pathlib.Path,
|
|
34
|
-
) -> None:
|
|
35
|
-
|
|
36
|
-
try:
|
|
37
|
-
import gqec # Internal python wheel.
|
|
38
|
-
except ImportError as ex:
|
|
39
|
-
raise ImportError(
|
|
40
|
-
"The decoder 'internal*' isn't installed.\n"
|
|
41
|
-
"These decoders aren't publicly available.\n"
|
|
42
|
-
) from ex
|
|
43
|
-
|
|
44
|
-
if num_dets == 0:
|
|
45
|
-
with open(obs_predictions_b8_out_path, 'wb') as f:
|
|
46
|
-
f.write(b'\0' * (num_obs * num_shots))
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
gqec.run_for_sinter(str(dem_path), str(dets_b8_in_path), "b8", str(obs_predictions_b8_out_path), self.name)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_collection_options_test.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_collection_work_manager.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_decoding_decoder_class.py
RENAMED
|
File without changes
|
{sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_decoding_fusion_blossom.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter/_probability_util_test.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{sinter-1.12.dev1690241034 → sinter-1.12.dev1690946907}/src/sinter.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|