diff options
Diffstat (limited to 'dpd')
-rw-r--r-- | dpd/dpd.ini | 6 | ||||
-rw-r--r-- | dpd/poly.coef | 11 | ||||
-rwxr-xr-x | dpd/show_spectrum.py | 20 |
3 files changed, 32 insertions, 5 deletions
diff --git a/dpd/dpd.ini b/dpd/dpd.ini index 64b7918..f11964e 100644 --- a/dpd/dpd.ini +++ b/dpd/dpd.ini @@ -22,7 +22,11 @@ enabled=1 [poly] enabled=1 -polycoeffile=dpdpoly.coef +polycoeffile=dpd/poly.coef + +# How many threads to use for the predistorter. +# If not set, detect automatically. +#num_threads=2 [output] # to prepare a file for the dpd/iq_file_server.py script, diff --git a/dpd/poly.coef b/dpd/poly.coef new file mode 100644 index 0000000..b29fa26 --- /dev/null +++ b/dpd/poly.coef @@ -0,0 +1,11 @@ +5 +0 +0 +0.8 +0 +0 +0 +0 +0 +0 +0 diff --git a/dpd/show_spectrum.py b/dpd/show_spectrum.py index 95dbef9..f23dba2 100755 --- a/dpd/show_spectrum.py +++ b/dpd/show_spectrum.py @@ -169,14 +169,26 @@ def plot_constellation_once(options): num_syms = int(len(frame) / n) print("frame {} has {} symbols".format(len(frame), num_syms)) spectrums = np.array([np.fft.fftshift(np.fft.fft(frame[n*i:n*(i+1)], n)) for i in range(num_syms)]) - #imsave("spectrums.png", np.abs(spectrums)) + + def normalise(x): + """Normalise a real-valued array x to the range [0,1]""" + y = x + np.min(x) + return x / np.max(x) + + imsave("spectrums.png", np.concatenate([ + normalise(np.abs(spectrums)), + normalise(np.angle(spectrums))])) # Only take bins that are supposed to contain energy - #TODO this is only valid for 2048000 sample rate! - spectrums = np.concatenate([spectrums[...,256:1024], spectrums[...,1025:1793]], axis=1) + # i.e. the middle 1536 bins, excluding the bin at n/2 + assert(n % 2 == 0) + n_half = int(n/2) + spectrums = np.concatenate( + [spectrums[...,n_half-768:n_half], + spectrums[...,n_half + 1:n_half + 769]], axis=1) sym_indices = (np.tile(np.arange(num_syms-1).reshape(num_syms-1,1), (1,NbCarriers)) + - np.tile(np.linspace(-0.25, 0.25, NbCarriers), (num_syms-1, 1) ) ) + np.tile(np.linspace(-0.4, 0.4, NbCarriers), (num_syms-1, 1) ) ) sym_indices = sym_indices.reshape(-1) diff_angles = np.mod(np.diff(np.angle(spectrums, deg=1), axis=0), 360) #sym_points = spectrums[:-1].reshape(-1) |