aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandreas128 <Andreas>2017-05-06 12:43:23 +0100
committerandreas128 <Andreas>2017-05-06 12:43:23 +0100
commit2deeb43ce5d99dafa1556e3fdc1d3a02911614a6 (patch)
treecdeb44d0a7b023982c66d914bb255f22090cead3
parent781d61d6ed7503f2e5b940121dfd0eeced8c1c75 (diff)
downloadODR-StaticPrecorrection-2deeb43ce5d99dafa1556e3fdc1d3a02911614a6.tar.gz
ODR-StaticPrecorrection-2deeb43ce5d99dafa1556e3fdc1d3a02911614a6.tar.bz2
ODR-StaticPrecorrection-2deeb43ce5d99dafa1556e3fdc1d3a02911614a6.zip
Do changes for live analysis
-rw-r--r--dab_tuner.ipynb115
-rw-r--r--grc/amam_ampm.grc6
-rwxr-xr-xgrc/live_analyse_dab_poly.py30
-rw-r--r--grc/live_analyse_poly.grc71
-rw-r--r--receive_tcp.ipynb5
-rw-r--r--src/SendDictTcp.py13
-rw-r--r--src/dab_util.py2
-rw-r--r--sync-measurement-while-sending.ipynb8
-rw-r--r--sync-measurement.ipynb4
9 files changed, 189 insertions, 65 deletions
diff --git a/dab_tuner.ipynb b/dab_tuner.ipynb
index 47bdeec..eb319ec 100644
--- a/dab_tuner.ipynb
+++ b/dab_tuner.ipynb
@@ -3,7 +3,10 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": [
"%matplotlib inline\n",
@@ -24,7 +27,10 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": [
"try:\n",
@@ -42,7 +48,10 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": [
"sync = tcp_sync.UhdSyncMsg(packet_size=4*8192,\n",
@@ -53,7 +62,10 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": [
"top = live_analyse_py()"
@@ -62,7 +74,10 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": [
"top.start()"
@@ -71,7 +86,10 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": [
"top.set_txgain(86)\n",
@@ -81,7 +99,10 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": [
"top.blocks_file_source_0.open(\"./../dab_normalized_c64.dat\", True)"
@@ -90,7 +111,10 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": [
"sync.has_msg()\n",
@@ -100,7 +124,10 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": [
"tt.gen_two_tone(debug = True)"
@@ -109,7 +136,10 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": [
"msgs = sync.get_msgs(1)\n",
@@ -119,7 +149,10 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": [
"def measure(param):\n",
@@ -170,7 +203,10 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": [
"def simple_opt(pars, i, d, func):\n",
@@ -194,7 +230,10 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": [
"top.set_txgain(86)\n",
@@ -210,28 +249,40 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": [
"top.set_txgain(85)\n",
@@ -255,14 +306,20 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": [
"sync.stop()\n",
@@ -274,28 +331,40 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": []
}
diff --git a/grc/amam_ampm.grc b/grc/amam_ampm.grc
index 0118fe1..36257b1 100644
--- a/grc/amam_ampm.grc
+++ b/grc/amam_ampm.grc
@@ -186,7 +186,7 @@
</param>
<param>
<key>value</key>
- <value>84</value>
+ <value>81</value>
</param>
</block>
<block>
@@ -370,7 +370,7 @@
</param>
<param>
<key>file</key>
- <value>/home/andreas/dab/ODR-StaticPrecorrection/input.dat</value>
+ <value>/home/andreas/dab/test_dat/out.iq</value>
</param>
<param>
<key>_coordinate</key>
@@ -551,7 +551,7 @@
</param>
<param>
<key>file</key>
- <value>/home/andreas/dab/ODR-StaticPrecorrection/output.dat</value>
+ <value>/home/andreas/dab/ODR-StaticPrecorrection/recored.dat</value>
</param>
<param>
<key>_coordinate</key>
diff --git a/grc/live_analyse_dab_poly.py b/grc/live_analyse_dab_poly.py
index 402ef17..cc7672b 100755
--- a/grc/live_analyse_dab_poly.py
+++ b/grc/live_analyse_dab_poly.py
@@ -3,7 +3,7 @@
##################################################
# GNU Radio Python Flow Graph
# Title: Live Analyse Dab Poly
-# Generated: Sun Mar 26 13:22:00 2017
+# Generated: Mon Apr 10 14:20:48 2017
##################################################
if __name__ == '__main__':
@@ -67,7 +67,6 @@ class live_analyse_dab_poly(gr.top_block, Qt.QWidget):
self.freq = freq = 222e6
self.f2 = f2 = samp_rate / 3.875
self.f1 = f1 = samp_rate / 4
- self.choose_dist = choose_dist = 1
self.ampl = ampl = 0.4
self.a_8 = a_8 = 0
self.a_7 = a_7 = 0
@@ -76,7 +75,7 @@ class live_analyse_dab_poly(gr.top_block, Qt.QWidget):
self.a_4 = a_4 = 0
self.a_3 = a_3 = 0
self.a_2 = a_2 = 0
- self.a_1 = a_1 = 1
+ self.a_1 = a_1 = 0
##################################################
# Message Queues
@@ -92,9 +91,6 @@ class live_analyse_dab_poly(gr.top_block, Qt.QWidget):
self._rxgain_range = Range(0, 100, 1, 10, 200)
self._rxgain_win = RangeWidget(self._rxgain_range, self.set_rxgain, "rxgain", "counter_slider", float)
self.top_layout.addWidget(self._rxgain_win)
- self._choose_dist_range = Range(0, 1, 1, 1, 200)
- self._choose_dist_win = RangeWidget(self._choose_dist_range, self.set_choose_dist, "a_1", "counter_slider", float)
- self.top_layout.addWidget(self._choose_dist_win)
self._a_8_range = Range(-1, 1, 0.001, 0, 200)
self._a_8_win = RangeWidget(self._a_8_range, self.set_a_8, "a_8", "counter_slider", float)
self.top_layout.addWidget(self._a_8_win)
@@ -116,7 +112,7 @@ class live_analyse_dab_poly(gr.top_block, Qt.QWidget):
self._a_2_range = Range(-1, 1, 0.001, 0, 200)
self._a_2_win = RangeWidget(self._a_2_range, self.set_a_2, "a_2", "counter_slider", float)
self.top_layout.addWidget(self._a_2_win)
- self._a_1_range = Range(-10, 10, 0.001, 1, 200)
+ self._a_1_range = Range(-10, 10, 0.001, 0, 200)
self._a_1_win = RangeWidget(self._a_1_range, self.set_a_1, "a_1", "counter_slider", float)
self.top_layout.addWidget(self._a_1_win)
self.uhd_usrp_source_0 = uhd.usrp_source(
@@ -187,13 +183,9 @@ class live_analyse_dab_poly(gr.top_block, Qt.QWidget):
self.dpd_memless_poly_0 = dpd.memless_poly(a_1, a_2, a_3, a_4, a_5, a_6, a_7, a_8)
self.blocks_null_sink_0_2_0 = blocks.null_sink(gr.sizeof_gr_complex*1)
self.blocks_null_sink_0_2 = blocks.null_sink(gr.sizeof_char*1)
- self.blocks_multiply_const_vxx_2 = blocks.multiply_const_vcc((choose_dist, ))
self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((1, ))
- self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((1-choose_dist, ))
self.blocks_message_burst_source_0 = blocks.message_burst_source(gr.sizeof_char*1, blocks_message_burst_source_0_msgq_in)
- self.blocks_file_source_0_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/andreas/dab/test_dat/out.iq", True)
- self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/andreas/dab/test_dat_dist/out.iq", True)
- self.blocks_add_xx_0 = blocks.add_vcc(1)
+ self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, "/home/andreas/dab/test_dat/out.iq", True)
self._ampl_range = Range(-1, 1, 0.0001, 0.4, 200)
self._ampl_win = RangeWidget(self._ampl_range, self.set_ampl, "ampl", "counter_slider", float)
self.top_layout.addWidget(self._ampl_win)
@@ -201,13 +193,9 @@ class live_analyse_dab_poly(gr.top_block, Qt.QWidget):
##################################################
# Connections
##################################################
- self.connect((self.blocks_add_xx_0, 0), (self.dpd_memless_poly_0, 0))
- self.connect((self.blocks_file_source_0, 0), (self.blocks_multiply_const_vxx_2, 0))
- self.connect((self.blocks_file_source_0_0, 0), (self.blocks_multiply_const_vxx_0, 0))
+ self.connect((self.blocks_file_source_0, 0), (self.dpd_memless_poly_0, 0))
self.connect((self.blocks_message_burst_source_0, 0), (self.blocks_null_sink_0_2, 0))
- self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_add_xx_0, 1))
self.connect((self.blocks_multiply_const_vxx_1, 0), (self.uhd_usrp_sink_0, 0))
- self.connect((self.blocks_multiply_const_vxx_2, 0), (self.blocks_add_xx_0, 0))
self.connect((self.dpd_memless_poly_0, 0), (self.blocks_multiply_const_vxx_1, 0))
self.connect((self.uhd_usrp_source_0, 0), (self.blocks_null_sink_0_2_0, 0))
self.connect((self.uhd_usrp_source_0, 0), (self.qtgui_freq_sink_x_0_0, 0))
@@ -271,14 +259,6 @@ class live_analyse_dab_poly(gr.top_block, Qt.QWidget):
def set_f1(self, f1):
self.f1 = f1
- def get_choose_dist(self):
- return self.choose_dist
-
- def set_choose_dist(self, choose_dist):
- self.choose_dist = choose_dist
- self.blocks_multiply_const_vxx_0.set_k((1-self.choose_dist, ))
- self.blocks_multiply_const_vxx_2.set_k((self.choose_dist, ))
-
def get_ampl(self):
return self.ampl
diff --git a/grc/live_analyse_poly.grc b/grc/live_analyse_poly.grc
index f5419dc..559685a 100644
--- a/grc/live_analyse_poly.grc
+++ b/grc/live_analyse_poly.grc
@@ -649,6 +649,69 @@
</param>
</block>
<block>
+ <key>variable_qtgui_range</key>
+ <param>
+ <key>comment</key>
+ <value></value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(480, 553)</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>id</key>
+ <value>const</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>const</value>
+ </param>
+ <param>
+ <key>min_len</key>
+ <value>200</value>
+ </param>
+ <param>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
+ </param>
+ <param>
+ <key>start</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>step</key>
+ <value>0.001</value>
+ </param>
+ <param>
+ <key>stop</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>rangeType</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>widget</key>
+ <value>counter_slider</value>
+ </param>
+ </block>
+ <block>
<key>variable</key>
<param>
<key>comment</key>
@@ -827,7 +890,7 @@
</param>
<param>
<key>value</key>
- <value>80</value>
+ <value>70</value>
</param>
<param>
<key>_enabled</key>
@@ -1122,7 +1185,7 @@
</param>
<param>
<key>file</key>
- <value>/home/andreas/dab/ODR-StaticPrecorrection/input.dat</value>
+ <value>/home/andreas/dab/out_cut.iq</value>
</param>
<param>
<key>_coordinate</key>
@@ -1216,7 +1279,7 @@
</param>
<param>
<key>const</key>
- <value>1</value>
+ <value>const</value>
</param>
<param>
<key>affinity</key>
@@ -2133,7 +2196,7 @@
</param>
<param>
<key>_enabled</key>
- <value>0</value>
+ <value>1</value>
</param>
<param>
<key>fftsize</key>
diff --git a/receive_tcp.ipynb b/receive_tcp.ipynb
index 5352b50..20ae31b 100644
--- a/receive_tcp.ipynb
+++ b/receive_tcp.ipynb
@@ -200,7 +200,10 @@
{
"cell_type": "code",
"execution_count": null,
- "metadata": {},
+ "metadata": {
+ "deletable": true,
+ "editable": true
+ },
"outputs": [],
"source": []
},
diff --git a/src/SendDictTcp.py b/src/SendDictTcp.py
index 562e36a..d852fd6 100644
--- a/src/SendDictTcp.py
+++ b/src/SendDictTcp.py
@@ -1,3 +1,4 @@
+import time
import socket
import json
@@ -5,9 +6,15 @@ class SendDictTcp(object):
def __init__(self, host, port):
self.host = host
self.port = port
- self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- self.sock.connect((self.host, self.port))
- self.buffer_size = 1024
+ while True:
+ try:
+ self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ self.sock.connect((self.host, self.port))
+ self.buffer_size = 1024
+ break
+ except:
+ print("Waiting for connecetion to %s:%d" %(self.host, self.port))
+ time.sleep(1)
def send(self, msg):
self.sock.send(json.dumps(msg))
diff --git a/src/dab_util.py b/src/dab_util.py
index fbd1cc6..fa52015 100644
--- a/src/dab_util.py
+++ b/src/dab_util.py
@@ -11,7 +11,7 @@ c["frame_2048000"]=c["frame_ms"] * 2048
c["sym_8192000"]=96./76*8192
c["sym_2048000"]=96./76*2048
-def calc_fft(signal, fft_size = 1024, sampling_rate = 1, plot = False):
+def calc_fft(signal, fft_size = 65536, sampling_rate = 8192000, plot = False):
"""returns one numpy array for the frequencies and one for the corresponding fft"""
signal_spectrum = np.fft.fftshift(np.fft.fft(signal, fft_size))
freqs = np.fft.fftshift(np.fft.fftfreq(fft_size, d=1./sampling_rate))
diff --git a/sync-measurement-while-sending.ipynb b/sync-measurement-while-sending.ipynb
index 616df5b..1dd315f 100644
--- a/sync-measurement-while-sending.ipynb
+++ b/sync-measurement-while-sending.ipynb
@@ -156,9 +156,7 @@
"editable": true
},
"outputs": [],
- "source": [
- "top.blocks_file_source_0.open(\"/home/andreas/dab/out_cut.iq\", True)"
- ]
+ "source": []
},
{
"cell_type": "code",
@@ -195,7 +193,9 @@
" if k == \"txgain\":\n",
" top.uhd_usrp_sink_0_0.set_gain(d[k])\n",
" if k == \"rxgain\":\n",
- " top.uhd_usrp_source_0.set_gain(d[k])"
+ " top.uhd_usrp_source_0.set_gain(d[k])\n",
+ " if k == \"input_path\":\n",
+ " top.blocks_file_source_0.open(str(d[k]), True)"
]
},
{
diff --git a/sync-measurement.ipynb b/sync-measurement.ipynb
index 927afe4..176d119 100644
--- a/sync-measurement.ipynb
+++ b/sync-measurement.ipynb
@@ -50,7 +50,9 @@
"txgains = (50, 55, 60, 65, 70, 75, 81, 82, 83, 84, 85, 86, 87, 88, 89)\n",
"rxgains = (50, 40, 40, 25, 25, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20)\n",
"txgains = (75, 81, 84, 85, 88, 89)\n",
- "rxgains = (20, 20, 20, 20, 20, 20)"
+ "rxgains = (20, 20, 20, 20, 20, 20)\n",
+ "txgains = (83,)\n",
+ "rxgains = (20,)"
]
},
{