comnum.ResourceGrid#
- class comnum.ResourceGrid(n_subcarriers, n_symbols, *, pattern='lattice', period=4, spacing=4, freq=3, time=4, seed=0)#
An OFDM resource grid of
n_subcarriers×n_symbolswith pilots (Coleri et al. 2002). A grid is a(n_subcarriers, n_symbols)array, a column per OFDM symbol, so thatOfdm.modulate(grid.map(data))sends it; the methods that read a grid also take the symbols ofOfdm.demodulate(1-D, symbol after symbol).- Parameters:
n_subcarriers (int) – subcarriers of the grid.
n_symbols (int) – OFDM symbols of the grid.
pattern (str) –
"block"(every subcarrier of one symbol inperiod),"comb"(one subcarrier inspacing, every symbol) or"lattice"(one subcarrier infreqof one symbol intime).period (int) – symbol period of the block pattern.
spacing (int) – subcarrier spacing of the comb pattern.
freq (int) – subcarrier spacing of the lattice pattern.
time (int) – symbol spacing of the lattice pattern.
seed (int) – seed of the pilot symbols.
- Raises:
ValueError – for an invalid parameter (the message names it).
Examples
>>> import comnum >>> grid = comnum.ResourceGrid(12, 4, pattern="comb", spacing=4) >>> grid.n_data, grid.pilot_positions().shape (36, (12, 2))
- extract(grid)#
The data resource elements of a grid.
- Parameters:
grid (array_like) – a whole grid
(n_subcarriers, n_symbols), or its symbols asOfdm.demodulategives them (symbol after symbol).- Returns:
the
n_datadata symbols (complex128).- Return type:
- Raises:
ValueError – for an invalid parameter or input (the message names it).
- is_pilot(k, l)#
Whether a resource element carries a pilot.
- map(data)#
The grid with
dataand the pilots.- Parameters:
data (array_like) –
n_datadata symbols.- Returns:
the grid
(n_subcarriers, n_symbols)(complex128).- Return type:
- Raises:
ValueError – for an invalid parameter or input (the message names it).
- pilot_positions()#
The pilot resource elements.
- Returns:
(n_pilots, 2)(int64), the subcarrierkand the symbollof every pilot.- Return type:
- Raises:
ValueError – for an invalid parameter (the message names it).