aboutsummaryrefslogtreecommitdiffstats
path: root/tests/BER
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/BER/Bit_error.grc66
-rwxr-xr-xtests/BER/Test_Bit_Errorrate.py26
2 files changed, 84 insertions, 8 deletions
diff --git a/tests/BER/Bit_error.grc b/tests/BER/Bit_error.grc
index 04c624b..1a1a891 100644
--- a/tests/BER/Bit_error.grc
+++ b/tests/BER/Bit_error.grc
@@ -56,6 +56,49 @@ blocks:
coordinate: [216, 396.0]
rotation: 0
state: enabled
+- name: vlen
+ id: variable
+ parameters:
+ comment: ''
+ value: '10'
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [216, 196.0]
+ rotation: 0
+ state: true
+- name: wrong
+ id: variable
+ parameters:
+ comment: ''
+ value: list(np.random.randint(0, 255, dtype=np.uint8, size=10))
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [216, 460.0]
+ rotation: 0
+ state: true
+- name: blocks_throttle_0
+ id: blocks_throttle
+ parameters:
+ affinity: ''
+ alias: ''
+ comment: ''
+ ignoretag: 'True'
+ maxoutbuf: '0'
+ minoutbuf: '0'
+ samples_per_second: samp_rate
+ type: byte
+ vlen: vlen
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [448, 292.0]
+ rotation: 0
+ state: true
- name: blocks_vector_source_x_0
id: blocks_vector_source_x
parameters:
@@ -67,8 +110,8 @@ blocks:
repeat: 'True'
tags: '[]'
type: byte
- vector: testvec * 1600
- vlen: '1'
+ vector: testvec + list(np.random.randint(0, 255, dtype=np.uint8, size=10))
+ vlen: vlen
states:
bus_sink: false
bus_source: false
@@ -83,16 +126,31 @@ blocks:
alias: ''
comment: ''
vgl: testvec
+ vlen: vlen
+ states:
+ bus_sink: false
+ bus_source: false
+ bus_structure: null
+ coordinate: [672, 292.0]
+ rotation: 0
+ state: true
+- name: import_0
+ id: import
+ parameters:
+ alias: ''
+ comment: ''
+ imports: import numpy as np
states:
bus_sink: false
bus_source: false
bus_structure: null
- coordinate: [704, 296.0]
+ coordinate: [328, 20.0]
rotation: 0
state: true
connections:
-- [blocks_vector_source_x_0, '0', fadingui_ber_0, '0']
+- [blocks_throttle_0, '0', fadingui_ber_0, '0']
+- [blocks_vector_source_x_0, '0', blocks_throttle_0, '0']
metadata:
file_format: 1
diff --git a/tests/BER/Test_Bit_Errorrate.py b/tests/BER/Test_Bit_Errorrate.py
index 4022997..a861ae7 100755
--- a/tests/BER/Test_Bit_Errorrate.py
+++ b/tests/BER/Test_Bit_Errorrate.py
@@ -31,6 +31,7 @@ from argparse import ArgumentParser
from gnuradio.eng_arg import eng_float, intx
from gnuradio import eng_notation
import fadingui
+import numpy as np
from gnuradio import qtgui
@@ -70,21 +71,25 @@ class Test_Bit_Errorrate(gr.top_block, Qt.QWidget):
##################################################
# Variables
##################################################
+ self.wrong = wrong = list(np.random.randint(0, 255, dtype=np.uint8, size=10))
+ self.vlen = vlen = 10
self.testvec = testvec = [31, 53] + [0x12, 0xe3, 0x9b, 0xee, 0x84, 0x23, 0x41, 0xf3]
self.samp_rate = samp_rate = 32000
##################################################
# Blocks
##################################################
- self.fadingui_ber_0 = fadingui.ber(vgl=testvec)
- self.blocks_vector_source_x_0 = blocks.vector_source_b(testvec * 1600, True, 1, [])
+ self.fadingui_ber_0 = fadingui.ber(vgl=testvec, vlen=vlen)
+ self.blocks_vector_source_x_0 = blocks.vector_source_b(testvec + list(np.random.randint(0, 255, dtype=np.uint8, size=10)), True, vlen, [])
+ self.blocks_throttle_0 = blocks.throttle(gr.sizeof_char*vlen, samp_rate,True)
##################################################
# Connections
##################################################
- self.connect((self.blocks_vector_source_x_0, 0), (self.fadingui_ber_0, 0))
+ self.connect((self.blocks_throttle_0, 0), (self.fadingui_ber_0, 0))
+ self.connect((self.blocks_vector_source_x_0, 0), (self.blocks_throttle_0, 0))
def closeEvent(self, event):
@@ -92,18 +97,31 @@ class Test_Bit_Errorrate(gr.top_block, Qt.QWidget):
self.settings.setValue("geometry", self.saveGeometry())
event.accept()
+ def get_wrong(self):
+ return self.wrong
+
+ def set_wrong(self, wrong):
+ self.wrong = wrong
+
+ def get_vlen(self):
+ return self.vlen
+
+ def set_vlen(self, vlen):
+ self.vlen = vlen
+
def get_testvec(self):
return self.testvec
def set_testvec(self, testvec):
self.testvec = testvec
- self.blocks_vector_source_x_0.set_data(self.testvec * 1600, [])
+ self.blocks_vector_source_x_0.set_data(self.testvec + list(np.random.randint(0, 255, dtype=np.uint8, size=10)), [])
def get_samp_rate(self):
return self.samp_rate
def set_samp_rate(self, samp_rate):
self.samp_rate = samp_rate
+ self.blocks_throttle_0.set_sample_rate(self.samp_rate)