mirror of
https://github.com/romanz/amodem.git
synced 2026-05-10 05:17:38 +08:00
config: use hexagonal grid for better SNR
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
Fs = 32000.0 # sampling frequency [Hz]
|
Fs = 32000.0 # sampling frequency [Hz]
|
||||||
Tsym = 0.001 # symbol duration [seconds]
|
Tsym = 0.001 # symbol duration [seconds]
|
||||||
Nfreq = 8 # number of frequencies used
|
Nfreq = 8 # number of frequencies used
|
||||||
Nx = 8
|
Npoints = 64
|
||||||
Ny = 8
|
|
||||||
F0 = 1e3
|
F0 = 1e3
|
||||||
|
|
||||||
# Update default configuration from environment variables
|
# Update default configuration from environment variables
|
||||||
@@ -23,12 +22,13 @@ carrier_index = 0
|
|||||||
Fc = frequencies[carrier_index]
|
Fc = frequencies[carrier_index]
|
||||||
Tc = 1.0 / Fc
|
Tc = 1.0 / Fc
|
||||||
|
|
||||||
assert Nx == 2 ** round(np.log2(Nx))
|
# Hexagonal symbol constellation (optimal "sphere packing")
|
||||||
assert Ny == 2 ** round(np.log2(Ny))
|
I = np.arange(-Npoints, Npoints+1)
|
||||||
|
imag_factor = np.exp(1j * np.pi / 3.0)
|
||||||
xs = np.linspace(-1, 1, Nx) if Nx > 1 else [0.0]
|
offset = 0.5
|
||||||
ys = np.linspace(-1, 1, Ny) if Ny > 1 else [0.0]
|
symbols = [(x + y*imag_factor + offset) for x in I for y in I]
|
||||||
symbols = np.array([complex(x, y) for x in xs for y in ys])
|
symbols.sort(key=lambda z: (z*z.conjugate()).real)
|
||||||
|
symbols = np.array(symbols[:Npoints])
|
||||||
symbols = symbols / np.max(np.abs(symbols))
|
symbols = symbols / np.max(np.abs(symbols))
|
||||||
|
|
||||||
Nsym = int(Tsym / Ts)
|
Nsym = int(Tsym / Ts)
|
||||||
|
|||||||
Reference in New Issue
Block a user