pyadess
Python distribution matcher module implemented in Rust.
This module matches strings of bits to strings of amplitudes. While the marginal distributions of the bits are assumed to be uniform, the distribution of the amplitudes can be adapted to a channel.
Amplitudes are denoted $a \in \{1, 3, 5, 7, \dots\}$ in the following.
For a usage example see the example.py script in the repo (https://github.com/kit-cel/ad-ess)
Encoder/decoder capable of arbitrary distributions
threshold: Maximum weight level in the trellisn_max: Number of symbols/amplitudesweights: Array of weights,weights[0]is the weight for $a=1$,weights[1]for $a=3$, ...
Returns a new instance for a given distribution and threshold
threshold: Maximum weight level in the trellisn_max: Number of symbols/amplitudesdistribution: Array of probabilities $[P(a=1), P(a=3), P(a=5), ...]$- The
res_factorcontrols a trade off between trellis size and distribution quantisation. Highres_factorleads to fine quantisation but a potentially large trellis.
Returns a new instance for a given distribution and minimum number of encoded bits
num_bits: Number of data bits that can be encodedn_max: Number of symbols/amplitudesdistribution: Array of probabilities $[P(a=1), P(a=3), P(a=5), ...]$- The
res_factorcontrols a trade off between trellis size and distribution quantisation. Highres_factorleads to fine quantisation but a potentially large trellis.
Returns a new instance for a given distribution using the optimal threshold
According to formulas (13) and (14) in https://doi.org/10.1109/LWC.2018.2890595
n_max: Number of symbols/amplitudesdistribution: Array of probabilities $[P(a=1), P(a=3), P(a=5), ...]$- The
res_factorcontrols a trade off between trellis size and distribution quantisation. Highres_factorleads to fine quantisation but a potentially large trellis. search_width: Number of weight levels to check below and above the initial estimated optimal thresholdrev_trellis_calculation_fraction: The fraction of the reverse trellis that should be calculated. If the calculated fraction is to small, the optimal threshold can not be found.
Calculates the trellis weights for a given distribution
distribution: Array of probabilities $[P(a=1), P(a=3), P(a=5), ...]$- The
res_factorcontrols a trade off between trellis size and distribution quantisation. Highres_factorleads to fine quantisation but a potentially large trellis.
Returns the amplitude sequence for the given bits as a numpy array
The values in index_bits should be either 1 or 0. (Currently other values
are possible but this may change.)
This function raises an exception if index_bits is invalid.
index_bits- numpy array or list of lengthnum_data_bits()
Returns the amplitude sequences for multiple given bit strings as a 2D numpy array
The values in multi_index_bits should be either 1 or 0.
This function raises an exception if one of the index bit strings in multi_index_bits is invalid.
index_bits- 2D numpy array of dimension [arbitrary,num_data_bits()]
Returns the index corresponding to the provided amplitude sequence as a numpy
array of 1s and 0s
Raises an exception if sequence is invalid.
sequence- numpy array or list of lengthn_max(as passed to constructor)
Returns the indexes corresponding to the provided amplitude sequence as a 2D numpy
array of 1s and 0s
Raises an exception if any amplitude sequence in sequences is invalid.
sequences- 2D numpy array of dimension [arbitrary,n_max(as passed to constructor)]
Returns the weights used by the internal trellis
Returns the distribution AdEss is optimizing for