File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
src/py/_tesseract_py_util Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,8 @@ def decompose_errors_using_detector_assignment(
185185 )
186186
187187 if consistent_obs_by_component is None :
188+ if strip_undecomposable_errors :
189+ continue
188190 raise ValueError (
189191 f"The error instruction `{ instruction } ` could not be decomposed, due to its "
190192 "observables not being consistent with the observables of any available "
Original file line number Diff line number Diff line change @@ -211,6 +211,34 @@ def test_decompose_errors_strip_undecomposable_errors():
211211 assert str (decomposed_dem ) == str (expected_dem )
212212
213213
214+
215+
216+ def test_decompose_errors_strip_inconsistent_observables ():
217+ dem = stim .DetectorErrorModel ("""
218+ detector(0) D0
219+ detector(1) D1
220+ # Standalone components fix observable choices for each detector.
221+ error(0.1) D0 L0
222+ error(0.1) D1 L1
223+ # Cross-component error has observables that cannot be matched by available components.
224+ error(0.1) D0 D1 L0
225+ """ )
226+
227+ with pytest .raises (ValueError , match = "could not be decomposed" ):
228+ decompose_errors_using_last_coordinate_index (dem )
229+
230+ decomposed_dem = decompose_errors_using_last_coordinate_index (
231+ dem , strip_undecomposable_errors = True
232+ )
233+
234+ expected_dem = stim .DetectorErrorModel ("""
235+ detector(0) D0
236+ detector(1) D1
237+ error(0.1) D0 L0
238+ error(0.1) D1 L1
239+ """ )
240+ assert str (decomposed_dem ) == str (expected_dem )
241+
214242def test_undecompose_errors_with_repeat_block ():
215243 dem = stim .DetectorErrorModel ("""error(0.1) D2 D5 ^ D10 L1
216244repeat 10 {
You can’t perform that action at this time.
0 commit comments