aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsara <sara.halter@gmx.ch>2021-12-11 19:00:34 +0100
committersara <sara.halter@gmx.ch>2021-12-11 19:00:34 +0100
commit964778b423b722fa9777d59dcf58612a2b59b855 (patch)
treeccc5fcb07225c0e97380c6a84e5a3fe3d34c3469 /src
parentHardware file angepasst (diff)
downloadFading-964778b423b722fa9777d59dcf58612a2b59b855.tar.gz
Fading-964778b423b722fa9777d59dcf58612a2b59b855.zip
Corrections for QPSK on hardware
Diffstat (limited to '')
-rw-r--r--src/gr-fadingui/python/ber.py14
-rw-r--r--src/gr-fadingui/python/phasecorrection.py5
2 files changed, 11 insertions, 8 deletions
diff --git a/src/gr-fadingui/python/ber.py b/src/gr-fadingui/python/ber.py
index e966f17..5b71f35 100644
--- a/src/gr-fadingui/python/ber.py
+++ b/src/gr-fadingui/python/ber.py
@@ -26,6 +26,8 @@ from gnuradio import gr
from fadingui.logger import get_logger
log = get_logger("ber")
+np.set_printoptions(formatter={'int': hex})
+
class ber(gr.sync_block):
"""
docstring for block ber
@@ -41,18 +43,16 @@ class ber(gr.sync_block):
def work(self, input_items, output_items):
inp = input_items[0]
- ber_tot = 0
log.debug(f"Length: {len(inp)}")
log.debug(f"Inp_vector:{inp}")
for i in inp:
- log.debug(f"In Schlaufe{i}")
- v = np.array(self.vgl, dtype=np.uint8)^np.array(i, dtype=np.uint8)
+ i = np.array(i, dtype=np.uint8)
+ v = np.array(self.vgl, dtype=np.uint8) ^ i
ber = sum(np.unpackbits(v))
- log.debug(f"BER {ber} in Paket {i}")
- ber_tot+=ber
- log.debug(f"BER Total{ber_tot}")
-
+
+ trueber = ber - 32
+ log.debug(f"BER {trueber if trueber > 0 else 0} in Paket {i}")
return len(input_items[0])
diff --git a/src/gr-fadingui/python/phasecorrection.py b/src/gr-fadingui/python/phasecorrection.py
index cd3fa37..9acf563 100644
--- a/src/gr-fadingui/python/phasecorrection.py
+++ b/src/gr-fadingui/python/phasecorrection.py
@@ -68,12 +68,15 @@ class phasecorrection(gr.sync_block):
phasediff = (ephase - sphase) % (2 * np.pi)
freq = phasediff / nsamples
+ if freq < 1e-3:
+ freq = 0
+
# save this one for the last block (see variable `end' in self.work)
self.lastfreq = freq
# debugging
log.debug(f"Correction for chunk of {nsamples:2d} samples is " \
- f"sphase={sphase: .4f} rad and freq={freq*1e3: .4f}e-3 rad / sample")
+ f"sphase={sphase: .4f} rad, ephase={ephase: .4f} rad and freq={freq*1e3: .4f}e-3 rad / sample")
self.lastnsamples = nsamples
# compute chunk values