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.
- Fidelity Calculation: Compute the exact fidelity of the heralded link state.
- 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. Compute the exact fidelity of the heralded link state
fidelity = ql.FidelityModel(elink).get_fidelity()
print(f"Link fidelity: {fidelity:.4f}")
# 7. 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/fidelity/model.py: ContainsFidelityModelfor computing the exact fidelity of the heralded link state.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.
License
Licensed under the Apache License, Version 2.0 - see the LICENSE file for details.
Metadata
Release files for q-elink 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| q_elink-0.1.2.tar.gz | 58.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| q_elink-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 86.7 kB
Release files / q_elink-0.1.2.tar.gz
| Download URL | q_elink-0.1.2.tar.gz |
|---|---|
| Size | 58.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cf0268898fd2d2e457c214581b76d8e27bd3f5bed0d3ed0337ad5b828dd041ad
|
|
BLAKE2b-256 checksum How to use checksums |
7b84f564196cd85e734292dc3290a453149e4c6f9bf925a1af884d394c9021ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / q_elink-0.1.2-py3-none-any.whl
| Download URL | q_elink-0.1.2-py3-none-any.whl |
|---|---|
| Size | 28.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ceb3e353a8d18afe223e4f214aa174464813330551b66bdbc9a129174a1cf042
|
|
BLAKE2b-256 checksum How to use checksums |
64cb31d0b8b1989670a3b26edf53cbeaa6408b7917521d7072e72deb25560105
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Security for q-elink 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.