Skip to content

Commit 1b453aa

Browse files
authored
add documentation for the strip_undecomposable_errors=False flag (#219)
1 parent 012770f commit 1b453aa

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/py/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,11 +574,12 @@ print(f"Logical error rate: {result.errors / result.shots}")
574574
The `tesseract_decoder.demutil` module provides utilities for manipulating `stim.DetectorErrorModel` objects, specifically for decomposing complex error mechanisms into simpler components and regeneralizing spatial error models.
575575

576576
#### Functions
577-
* `demutil.decompose_errors(dem: stim.DetectorErrorModel, method: str) -> stim.DetectorErrorModel`
577+
* `demutil.decompose_errors(dem: stim.DetectorErrorModel, method: str, strip_undecomposable_errors: bool = False) -> stim.DetectorErrorModel`
578578
* Decomposes error mechanisms in a DEM into simpler components based on the specified method.
579579
* Supported methods:
580580
* `"stim-surfacecode-coords"`: Decomposes errors based on the spatial coordinates of detectors, assuming a surface code layout where coordinates indicate X or Z basis.
581581
* `"last-coordinate-index"`: Decomposes errors using the last coordinate of the detector as the component identifier.
582+
* `strip_undecomposable_errors`: If `False` (default), raises an error when a complex error cannot be decomposed into known atomic component errors. If `True`, silently drops undecomposable complex errors and continues.
582583
* **Note:** For decomposition to work, the DEM must contain "atomic" errors (errors involving only one component) that explain the components of the complex errors.
583584

584585
**Example Usage**:
@@ -602,6 +603,13 @@ nice_matchable_dem = demutil.decompose_errors(dem, method='stim-surfacecode-coor
602603

603604
# Re-decompose the errors assuming the last-coordinate index indicates the component:
604605
nice_matchable_dem2 = demutil.decompose_errors(dem, method='last-coordinate-index')
606+
607+
# Optionally drop undecomposable complex errors instead of raising.
608+
nice_matchable_dem3 = demutil.decompose_errors(
609+
dem,
610+
method='last-coordinate-index',
611+
strip_undecomposable_errors=True,
612+
)
605613
```
606614

607615
* `demutil.regeneralize_spatial_dem(templates: list[stim.DetectorErrorModel], scaffold: stim.DetectorErrorModel, verbose: bool = False) -> stim.DetectorErrorModel`

0 commit comments

Comments
 (0)