Metadata-Version: 2.4
Name: deltakit-analyse
Version: 0.1.0
Summary: Deltakit (component deltakit-analyse)
Author-email: Deltakit Team <deltakit@riverlane.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/riverlane/deltakit-analyse
Project-URL: Source, https://github.com/riverlane/deltakit-analyse
Project-URL: Documentation, https://deltakit.riverlane.com/
Project-URL: Issues, https://github.com/riverlane/deltakit-analyse/issues
Project-URL: Changelog, https://github.com/riverlane/deltakit-analyse/releases
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Quantum Computing
Classifier: Typing :: Typed
Requires-Python: <3.16,>=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: deltakit-core>=0.9.0
Requires-Dist: deltakit-circuit>=0.9.0
Requires-Dist: deltakit-decode>=0.9.2
Requires-Dist: numpy<3,>=2
Requires-Dist: numpy<3,>=2.1; python_version >= "3.13"
Requires-Dist: numpy<3,>=2.3.2; python_version >= "3.14"
Requires-Dist: numpy<3,>=2.5.2; python_version >= "3.15"
Requires-Dist: scipy<2,>=1.15.3
Requires-Dist: scipy<2,>=1.16.2; python_version >= "3.14"
Requires-Dist: pandas<4,>=2.2.2
Requires-Dist: pandas<4,>=2.3.3; python_version >= "3.13"
Requires-Dist: pandas<4,>=3.0.6; python_version >= "3.15"
Requires-Dist: uncertainties<4,>=3.2.3
Requires-Dist: adjustText<2,>=1.3
Requires-Dist: matplotlib<4,>=3.9.2; python_version < "3.14"
Requires-Dist: matplotlib<4,>=3.10.5; python_version >= "3.14"
Requires-Dist: matplotlib<4,>=3.11.2; python_version >= "3.15"
Requires-Dist: tqdm<5,>=4.66.3
Provides-Extra: vis
Requires-Dist: seaborn<0.14,>=0.13; extra == "vis"
Dynamic: license-file

# Deltakit-analyse

[![PyPI](https://img.shields.io/pypi/v/deltakit-analyse.svg)](https://pypi.org/project/deltakit-analyse/)
[![Python versions](https://img.shields.io/pypi/pyversions/deltakit-analyse)](https://pypi.org/project/deltakit-analyse/)
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)

## Introduction

`deltakit-analyse` helps analyse quantum error correction (QEC) experiments by providing tools to post-process data from simulations or real quantum hardware execution and visualise the results. 

> [!NOTE]  
> `deltakit-analyse` is part of [Deltakit](https://github.com/Deltakit/deltakit), [Riverlane](https://www.riverlane.com)'s open-source quantum error correction SDK.  

## Install

The `deltakit-analyse` package requires a Python version between `3.11` and `3.15`.

You can install is as a stand-alone package with `pip`:

```bash
python -m pip install deltakit-analyse
```

If you use `uv`, you can install it in your current virtual environment with:
```bash
uv pip install deltakit-analyse
```

Alternatively, it is distributed with Deltakit together with other companion packages (`pip install deltakit`).  

## Quick Start

Below is an example of how `deltakit-analyse` can be used. Given logical failure data from a QEC experiment, the goal is to estimate the logical error probability per round, often called logical error rate (LER).  

```python
import matplotlib.pyplot as plt

from deltakit_analyse import (
    calculate_lep_and_lep_stddev,
    compute_logical_error_per_round,
)
from deltakit_analyse.plotting import interpolate_leppr, plot_leppr

# Synthetic data for the example, replace this with results obtained from
# simulations or real hardware execution.
failed_shots = [9949, 8434, 9649, 9926]
total_shots = [50_000, 20_000, 20_000, 20_000]
rounds = [5, 10, 15, 20]

# LER computation requires to compute the logical error probability (LEP) first.
lep, lep_stddev = calculate_lep_and_lep_stddev(failed_shots, total_shots)
estimate = compute_logical_error_per_round(rounds, lep, lep_stddev)

print(
    f"Logical error probability per round: {estimate.leppr:.2%} ± {estimate.leppr_stddev:.2%}"
)

fig, _ = plot_leppr(interpolate_leppr(estimate))
plt.show()
```

Example output:

```text
Logical error probability per round: 11.91% ± 0.31%
```

with the following plot generated:

![Example logical error probability per round plot](docs/ler_example.png)

## Contributing

See the [Deltakit contributing guide](https://github.com/Deltakit/deltakit/#contributing).

## License

This project is licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
