qkd_key_rate.base.keyrate module
Base class for KeyRate objects.
- class qkd_key_rate.base.keyrate.AsymptoticKeyRateEstimate(detector, **kwargs)[source]
Bases:
KeyRate
Asymptotic key rate base class
- abstract compute_rate(*, mu, attenuation)[source]
Computes the key-rate given intensity-settings and an attenuation
- Parameters:
mu (
ArrayLike
) – Used intensitiesattenuation (
float
) – Attenuation of the channel
- Return type:
float
- Returns:
key-rate
- Raises:
ValueError – When mu is given with invalid dimensions
- class qkd_key_rate.base.keyrate.FiniteKeyRateEstimate(detector, **kwargs)[source]
Bases:
KeyRate
Finite key rate base class
- abstract compute_rate(*, mu, attenuation, probability_basis_X, probability_basis_Z, n_X=None)[source]
Computes the key-rate given intensity-settings and an attenuation
- Parameters:
mu (
ArrayLike
) – Used intensitiesattenuation (
float
) – Attenuation of the channelprobability_basis_X (
ArrayLike
) – Probabilities for each intensity in the X-basisprobability_basis_Z (
ArrayLike
) – Probabilities for each intensity in the Z-basisn_X (
Optional
[int
]) – Number of pulses in the X-basis. If not provided, will be estimated from gain, probability_basis_X and total number of pules.
- Return type:
float
- Returns:
key-rate
- Raises:
ValueError – When mu is given with invalid dimensions
- class qkd_key_rate.base.keyrate.KeyRate(detector, **kwargs)[source]
Bases:
object
Key rate base class.
- __init__(detector, **kwargs)[source]
- Parameters:
detector (
Detector
) – The detector used at Bob’s sidekwargs (
int
) – Protocol specific input
- abstract compute_rate(mu, attenuation, **kwargs)[source]
Computes the key-rate given intensity-settings and an attenuation
- Parameters:
mu (
ArrayLike
) – Used intensitiesattenuation (
float
) – Attenuation of the channelkwargs (
Any
) – Depending on protocol more arguments can be supplied
- Returns:
key-rate
- Raises:
ValueError – When mu is given with invalid dimensions
- abstract optimize_rate(*, attenuation, x_0=None, bounds=None)[source]
Find the parameter setting that achieves the highest possible key-rate
- Parameters:
attenuation (
float
) – Loss in dB for the channelx_0 (
Optional[ArrayLike]
) – Initial search valuebounds (
Optional
[List
[ArrayLike
]]) – Bounds on search range
- Return type:
Tuple
[float
,float
]- Returns:
Optimized intensity and key-rate
- Raises:
ValueError – when x_0 or bounds are given with invalid dimensions.
ValueError – when the found key-rate is negative.