Expand description
Sources of bits and symbols (OptiCommPy optic.comm.sources).
bits: independent fair bits from a seeded generator, andqpsk, one unit-energy QPSK point (the pilots and preambles drawn from a seed);prbs: maximal-length pseudo-random binary sequences with the polynomials of ITU-T O.150 (orders 9, 11, 15, 20, 23, 29, 31, and 7), produced by a Fibonacci linear-feedback shift register from any register state: the sequence of ordernhas period2ⁿ - 1and contains every non-zeron-bit word exactly once per period;O150Sequence: the eight test sequences of ITU-T O.150 (05/96), Sec. 5, exactly: the polynomial, the inversion of the output (Sec. 4), the zero suppression of the second sequence of period $2^{20} - 1$ (Sec. 5.5) and the starting phase of the 511-bit sequence (Sec. 5.1), the sequences of the error-rate test sets;symbols: random symbols of a constellation with a given probability mass function, uniform by default, or Maxwell–Boltzmann shaped withmaxwell_boltzmann(probabilistic shaping,p(x) ∝ exp(-λ|x|²)).
§Examples
use comnum_mapping::source;
use comnum_core::rng::Rng;
let b = source::bits(1000, &mut Rng::new(3));
assert!(b.iter().all(|&v| v <= 1));
let p = source::prbs(7, 127 * 2, 1).unwrap();
assert_eq!(&p[..127], &p[127..]); // period 2⁷ - 1
assert_eq!(p[..127].iter().filter(|&&v| v == 1).count(), 64);
// the 2¹⁵ − 1 sequence of the O.151 test sets: inverted, it starts with 15 zeros
let t = source::O150Sequence::Prbs15.bits(16);
assert_eq!(&t[..15], &[0; 15]);
assert_eq!(t[15], 1);§References
- ITU-T Recommendation O.150 (05/96), General requirements for instrumentation for performance measurements on digital transmission equipment, Sec. 3 to 5 and Table 1.
Structs§
- O150
Bits - The bits of an
O150Sequence(O150Sequence::iter).
Enums§
- O150
Sequence - The pseudo-random test sequences of ITU-T O.150 (05/96), Sec. 5 and Table 1.
Functions§
- bits
nindependent fair bits (0or1).- maxwell_
boltzmann - Maxwell–Boltzmann probabilities
p_i ∝ exp(-λ |x_i|²)over the points ofc. - prbs
lengthbits of the PRBS of orderorder, from the register stateseed.- qpsk
- One unit-energy QPSK point $e^{j\pi(2i + 1)/4}$, $i$ uniform in
0..4(one draw ofRng::below): the pilots and preambles drawn from a seed. - symbols
nrandom symbols ofcdrawn with the probabilitiespx(uniform ifNone, normalised to a sum of 1 otherwise, asConstellation::priors).