Skip to main content

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:

  1. Clone the repository:
    git clone https://github.com/your-username/q-elink.git
    cd q-elink
  1. 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 structure ElementaryLink for the quantum elementary link model.
  • src/q_elink/local_probabilities/model.py: Contains LocalProbabilityModel and CoincidenceProbabilityModel for calculating detection probabilities and coincidences.
  • src/q_elink/local_probabilities/fitter.py: Contains LocalProbabilityFitter and LocalProbabilityExperiment classes for fitting the theoretical model to experimental data.
  • src/q_elink/local_probabilities/handler.py: Contains FitResultAnalyzer for processing and analyzing fit results.
  • src/q_elink/visibility/model.py: Contains InterferenceModel for visibility and interference calculations.
  • src/q_elink/witness/model.py: Provides the EntanglementWitness class 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

q_elink-0.1.1.tar.gz (57.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

q_elink-0.1.1-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page