Numerical characterization of an elementary link of a quantum repeater: local probabilities, visibility, entanglement witness, etc.
Project description
q-elink
A Python library for the modelization of quantum elementary links. It provides tools to simulate, analyze, and fit experimental data related to quantum entanglement and quantum communication.
Features
- Quantum Elementary Link Modeling: Core classes to define and parameterize a quantum elementary link.
- Local Probability Calculation: Compute heralded and local detection probabilities.
- Entanglement Witnessing: Tools for entanglement witnessing analysis.
- Data Fitting: Functionality to fit the theoretical model to experimental data.
- Visualization: Built-in plotting functions to visualize results.
Installation
From PyPI
Using uv:
uv add q-elink
Or with pip:
pip install q-elink
From source
For development or to run the examples:
- Clone the repository:
git clone https://github.com/your-username/q-elink.git
cd q-elink
- Install dependencies using uv:
uv sync
Basic Usage
Here is a minimal example of how to use the library to define an elementary link, set its parameters, and calculate local probabilities.
import q_elink as ql
# 1. Define the parameters for the elementary link
param_elink = {
'p_A': 0.01,
'p_B': 0.08,
'eta_0': 1e-3,
'eta_A': 0.01,
'eta_B': 0.01,
'dc_0': 1e-4,
'dc_A': 1e-4,
'dc_B': 1e-4,
}
# 2. Create an ElementaryLink instance and set its parameters
elink = ql.ElementaryLink()
elink.set_param(param_elink)
# 3. Create a LocalProbabilityModel for calculations
local_proba = ql.LocalProbabilityModel(elink)
# Optional: Set parameters for local detection stages
param_detect = {
'eta_A': 1.0,
'eta_B': 1.0,
'dc_A': 0.0,
'dc_B': 0.0,
}
local_proba.set_param(param_detect)
# 4. Calculate probabilities
proba_herald = local_proba.get_p_herald()
p00, p01, p10, p11 = local_proba.get_proba()
# 5. Print the results
print("=== Probabilities ===")
print(f"Heralding probability: {proba_herald}")
print(f"Local probabilities:")
print(f"p00 (no-click | no-click) = {p00}")
print(f"p01 (no-click | click) = {p01}")
print(f"p10 (click | no-click) = {p10}")
print(f"p11 (click | click) = {p11}")
# 6. Plot the probabilities against pump values
# fig, ax = local_proba.plot_proba()
# fig.show()
Modules
The library is organized into the following main modules:
src/q_elink/core/link.py: Contains the core data structureElementaryLinkfor the quantum elementary link model.src/q_elink/local_probabilities/model.py: ContainsLocalProbabilityModelandCoincidenceProbabilityModelfor calculating detection probabilities and coincidences.src/q_elink/local_probabilities/fitter.py: ContainsLocalProbabilityFitterandLocalProbabilityExperimentclasses for fitting the theoretical model to experimental data.src/q_elink/local_probabilities/handler.py: ContainsFitResultAnalyzerfor processing and analyzing fit results.src/q_elink/visibility/model.py: ContainsInterferenceModelfor visibility and interference calculations.src/q_elink/witness/model.py: Provides theEntanglementWitnessclass and related tools for entanglement witnessing.
Running the Examples
The examples/ directory contains scripts that demonstrate various features of the library. Each example is meant to be run as-is from the repository root with uv run.
For example, to run the elementary link example:
uv run python examples/elementary_link/elemnetary_link.py
To run the coincidence measurement example:
uv run python examples/local_proba/proba_coincidence.py
To run the local probability fitting example, first generate a synthetic
dataset (written to local/dataset/), then fit and analyze it (figures are
written to local/fig/):
uv run python examples/dataset/create_dataset_local_proba.py
uv run python examples/local_proba/fit_proba.py
uv run python examples/local_proba/fit_analyzer.py
Core Dependencies
Standard python dependencies:
- NumPy: For numerical operations.
- SciPy: For scientific computing, particularly for data fitting.
- Matplotlib: For plotting and visualizations.
- tqdm: For progress bars.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file q_elink-0.1.1.tar.gz.
File metadata
- Download URL: q_elink-0.1.1.tar.gz
- Upload date:
- Size: 57.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"42","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e7b77c581c8e10a866c2aba9052b7461a1d6724a47d9b1c9310f83cb07026cc
|
|
| MD5 |
033f6511871f797c02a1543006560372
|
|
| BLAKE2b-256 |
c9488c6ef55876611b052e2b20668034f9f328280c6a2862fc6b78e81dc693f0
|
File details
Details for the file q_elink-0.1.1-py3-none-any.whl.
File metadata
- Download URL: q_elink-0.1.1-py3-none-any.whl
- Upload date:
- Size: 27.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"42","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5556f9ba2fd9502ef0279519d5d025e4dbe85ab034a88db453f354f7e213caba
|
|
| MD5 |
ce9e477e7f5c0508b3842c3926458fca
|
|
| BLAKE2b-256 |
91612a4c751fde08067630e0cf6e680bce9621a4a49afba9e56730d7863a2ab7
|