comnum.Dvbt#
- class comnum.Dvbt(mode='8K', guard='1/4', constellation='QPSK', rate='1/2')#
A DVB-T transmitter and receiver (ETSI EN 300 744 V1.6.2) of one non-hierarchical configuration.
The transmitter takes a burst of whole MPEG-2 transport packets (see
dvb_packets()): the energy dispersal, RS(204, 188) and the outer interleaver of DVB-S (flushed by 11 packets of zeros), the inner code (171, 133, octal) punctured by Table 2, the inner interleaver (six bit interleavers of 126 bits and the symbol interleaver of the mode), the constellation of Figure 9 normalised by Table 6, the OFDM frame with its scattered and continual pilots (boosted to 4/3) and its TPS (signalling the mode, the guard interval, the constellation and the rate, BCH-protected, differentially modulated), and the OFDM modulation with the guard interval, one sample per elementary period T (7/64 µs at 8 MHz). The burst starts with the first symbol of a super-frame. The receiver works on the cells of the symbols, given the noise variance of a carrier and, if any, the gain of every carrier (a static channel known to the receiver, as in Annex A).The cells are arrays of shape
(K, n_symbols), K = 1705 (2K) or 6817 (8K) carriers.- Parameters:
- Raises:
ValueError – for an invalid parameter (the message names it).
Examples
>>> import comnum, numpy as np >>> link = comnum.Dvbt("2K", "1/4", "16-QAM", "2/3") >>> link.packets_per_superframe # Table 16 672 >>> round(link.useful_bit_rate(8e6) / 1e6, 2) # Table 17 13.27 >>> packets = comnum.dvb_packets(30, comnum.Rng(1)) >>> cells = link.demodulate(link.modulate(packets)) >>> cells.shape == (1705, link.symbols_len(30)) True >>> bool(np.array_equal(link.decode(cells, 30, 1e-3)[0], packets)) True
- carrier_frequencies(bandwidth_hz=8000000.0)#
The baseband frequency of every carrier,
k' / TUwithk' = k - (K - 1)/2.- Parameters:
bandwidth_hz (float) – the channel bandwidth (Hz).
- Returns:
K frequencies (Hz).
- Return type:
- carrier_noise_var(cn_db)#
The noise variance of a carrier at a C/N calculated over the K carriers (Annex A): the mean power of the carriers, pilots boosted, over the C/N.
- cells(data)#
The cells of the symbols of the bytes of a burst (see
Dvbs.outer()).- Parameters:
data (array_like) – the bytes of the outer coding of a burst (uint8).
- Returns:
the cells, shape
(K, n_symbols)(complex128).- Return type:
- Raises:
ValueError – for a value outside 0 to 255.
- decode(cells, n_packets, noise_var, channel=None)#
The packets of the cells of a burst.
- Parameters:
- Returns:
the packets (uint8), the bytes corrected by RS(204, 188) and the packets it could not correct.
- Return type:
tuple[numpy.ndarray, int, int]
- Raises:
ValueError – if the cells are not those of a burst of
n_packetspackets.
- decode_tps(cells, channel=None)#
The TPS of a received frame (its 68 symbols, the first one first).
- Parameters:
cells (array_like) – the cells of the 68 symbols, shape
(K, 68).channel (array_like, optional) – the gain of every carrier (K values).
- Returns:
frame,mode,guard,constellation,hierarchy(alpha, 0 for non-hierarchical),rate_hp,rate_lp(Nonewhen non-hierarchical) andcell_id(Noneif not transmitted).- Return type:
- Raises:
ValueError – for another number of symbols, a TPS that does not decode, or a
reserved value. –
- demodulate(samples)#
The cells of the received samples of whole symbols (guard intervals removed).
- Parameters:
samples (array_like) – the received samples.
- Returns:
the cells, shape
(K, n_symbols)(complex128).- Return type:
- Raises:
ValueError – unless the samples hold whole symbols.
- inner_decode(cells, n_packets, noise_var, channel=None)#
The bytes decided by the soft Viterbi decoder from the cells of a burst.
- Parameters:
- Returns:
the bytes (uint8).
- Return type:
- Raises:
ValueError – if the cells are not those of a burst of
n_packetspackets.
- modulate(packets)#
The samples of a burst of whole transport packets (one sample per T, the guard intervals included).
- Parameters:
packets (array_like) – whole transport packets (uint8, 188 bytes each).
- Returns:
the samples (complex128).
- Return type:
- Raises:
ValueError – for a packet that does not start with 0x47 or a partial packet.
- sample_noise_var(carrier_noise_var)#
The noise variance of a sample of
modulate()that gives a noise variance on every carrier.
- symbols_len(n_packets)#
The OFDM symbols of a burst of
n_packetspackets.- Parameters:
n_packets (int) – packets of the burst.
- Returns:
the symbols of
modulate().- Return type:
- useful_bit_rate(bandwidth_hz=8000000.0)#
The useful bit rate in a channel of a bandwidth (Table 17).
- constellation#
The points of the data cells (label
y0 y1 ... y(v-1), Figure 9).- Type: