From 6e0b2512e45b7a6ca03187814742cb0fe08964cb Mon Sep 17 00:00:00 2001 From: andreas128 Date: Sun, 29 Jan 2017 15:18:40 +0000 Subject: Add Amp characterization in sync-measurement.ipynb --- .gitignore | 1 + dab_tuner.ipynb | 1 - dab_tuner.py | 1 - gr-dpd/grc/dpd_clut.xml | 18 + gr-dpd/include/dpd/clut.h | 56 + gr-dpd/python/qa_clut.py | 42 + grc/__init__.py | 0 grc/amam_ampm.grc | 2892 +++++++++++++++++++ grc/live_analyse_dab_poly.py | 247 +- grc/live_analyse_two_tone_clut.grc | 5546 ++++++++++++++++++++++++++++++++++++ src/dab_util.py | 69 +- src/signal_gen.py | 68 + sync-measurement.ipynb | 345 +-- sync-measurement.py | 273 ++ 14 files changed, 9270 insertions(+), 289 deletions(-) create mode 100644 gr-dpd/grc/dpd_clut.xml create mode 100644 gr-dpd/include/dpd/clut.h create mode 100755 gr-dpd/python/qa_clut.py create mode 100644 grc/__init__.py create mode 100644 grc/amam_ampm.grc create mode 100644 grc/live_analyse_two_tone_clut.grc create mode 100644 src/signal_gen.py create mode 100644 sync-measurement.py diff --git a/.gitignore b/.gitignore index 0eb1cf3..541808c 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,7 @@ myplot.pickle run.py run.txt two_tone_tuner.py +*.dat diff --git a/dab_tuner.ipynb b/dab_tuner.ipynb index 635ee35..47bdeec 100644 --- a/dab_tuner.ipynb +++ b/dab_tuner.ipynb @@ -18,7 +18,6 @@ "import src.dab_util as du\n", "import src.dab_tuning_lib as dt\n", "\n", - "\n", "from live_analyse_py import live_analyse_py" ] }, diff --git a/dab_tuner.py b/dab_tuner.py index d2d6df4..7b3a215 100644 --- a/dab_tuner.py +++ b/dab_tuner.py @@ -15,7 +15,6 @@ import src.tcp_sync as tcp_sync import src.dab_util as du import src.dab_tuning_lib as dt - from live_analyse_py import live_analyse_py diff --git a/gr-dpd/grc/dpd_clut.xml b/gr-dpd/grc/dpd_clut.xml new file mode 100644 index 0000000..21a37a6 --- /dev/null +++ b/gr-dpd/grc/dpd_clut.xml @@ -0,0 +1,18 @@ + + + clut + dpd_clut + dpd + import dpd + dpd.clut() + + + in + complex + + + out + complex + + + diff --git a/gr-dpd/include/dpd/clut.h b/gr-dpd/include/dpd/clut.h new file mode 100644 index 0000000..f77c100 --- /dev/null +++ b/gr-dpd/include/dpd/clut.h @@ -0,0 +1,56 @@ +/* -*- c++ -*- */ +/* + * Copyright 2017 <+YOU OR YOUR COMPANY+>. + * + * This is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + + +#ifndef INCLUDED_DPD_CLUT_H +#define INCLUDED_DPD_CLUT_H + +#include +#include + +namespace gr { + namespace dpd { + + /*! + * \brief <+description of block+> + * \ingroup dpd + * + */ + class DPD_API clut : virtual public gr::block + { + public: + typedef boost::shared_ptr sptr; + + /*! + * \brief Return a shared_ptr to a new instance of dpd::clut. + * + * To avoid accidental use of raw pointers, dpd::clut's + * constructor is in a private implementation + * class. dpd::clut::make is the public interface for + * creating new instances. + */ + static sptr make(); + }; + + } // namespace dpd +} // namespace gr + +#endif /* INCLUDED_DPD_CLUT_H */ + diff --git a/gr-dpd/python/qa_clut.py b/gr-dpd/python/qa_clut.py new file mode 100755 index 0000000..e1d63f6 --- /dev/null +++ b/gr-dpd/python/qa_clut.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright 2017 <+YOU OR YOUR COMPANY+>. +# +# This is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# This software is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this software; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +from gnuradio import gr, gr_unittest +from gnuradio import blocks +import dpd_swig as dpd + +import matplotlib.pyplot as plt + +class qa_clut (gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block () + + def tearDown (self): + self.tb = None + + def test_001_t (self): + # set up fg + self.tb.run () + # check data + +if __name__ == '__main__': + gr_unittest.run(qa_clut, "qa_clut.xml") diff --git a/grc/__init__.py b/grc/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/grc/amam_ampm.grc b/grc/amam_ampm.grc new file mode 100644 index 0000000..cefa488 --- /dev/null +++ b/grc/amam_ampm.grc @@ -0,0 +1,2892 @@ + + + + Tue Jan 17 15:09:43 2017 + + options + + author + + + + window_size + + + + category + Custom + + + comment + + + + description + + + + _enabled + True + + + _coordinate + (8, 8) + + + _rotation + 0 + + + generate_options + no_gui + + + hier_block_src_path + .: + + + id + amam_amap + + + max_nouts + 0 + + + qt_qss_theme + + + + realtime_scheduling + + + + run_command + {python} -u {filename} + + + run_options + prompt + + + run + True + + + thread_safe_setters + + + + title + + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (8, 229) + + + _rotation + 0 + + + id + freq + + + value + 222e6 + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (8, 293) + + + _rotation + 0 + + + id + rxgain + + + value + 10 + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (8, 160) + + + _rotation + 0 + + + id + samp_rate + + + value + 8000000 + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (8, 357) + + + _rotation + 0 + + + id + txgain + + + value + 84 + + + + blocks_delay + + alias + + + + comment + + + + affinity + + + + delay + 200000 + + + _enabled + True + + + _coordinate + (336, 228) + + + _rotation + 0 + + + id + blocks_delay_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + num_ports + 1 + + + type + complex + + + vlen + 1 + + + + blocks_delay + + alias + + + + comment + + + + affinity + + + + delay + 210000 + + + _enabled + True + + + _coordinate + (688, 124) + + + _rotation + 0 + + + id + blocks_delay_0_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + num_ports + 1 + + + type + complex + + + vlen + 1 + + + + blocks_file_sink + + append + False + + + alias + + + + comment + + + + affinity + + + + _enabled + 0 + + + file + /home/andreas/dab/ODR-StaticPrecorrection/output_orig.dat + + + _coordinate + (808, 406) + + + _rotation + 0 + + + id + blocks_file_sink_0_0 + + + type + complex + + + unbuffered + False + + + vlen + 1 + + + + blocks_file_source + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + file + /home/andreas/dab/ODR-StaticPrecorrection/input.dat + + + _coordinate + (136, 221) + + + _rotation + 0 + + + id + blocks_file_source_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + type + complex + + + repeat + False + + + vlen + 1 + + + + blocks_multiply_const_vxx + + alias + + + + comment + + + + const + 1 + + + affinity + + + + _enabled + 1 + + + _coordinate + (640, 228) + + + _rotation + 0 + + + id + blocks_multiply_const_vxx_0 + + + type + complex + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + vlen + 1 + + + + dpd_memless_poly + + alias + + + + comment + + + + affinity + + + + _enabled + 0 + + + _coordinate + (456, 267) + + + _rotation + 0 + + + id + dpd_memless_poly_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + a1 + 1 + + + a2 + 0.3 + + + a3 + 0.3 + + + a4 + 0.3 + + + a5 + 0 + + + a6 + 0 + + + a7 + 0 + + + a8 + 0 + + + + blocks_file_sink + + append + False + + + alias + + + + comment + + + + affinity + + + + _enabled + 1 + + + file + /home/andreas/dab/ODR-StaticPrecorrection/output.dat + + + _coordinate + (808, 182) + + + _rotation + 0 + + + id + file_sink_out + + + type + complex + + + unbuffered + False + + + vlen + 1 + + + + qtgui_time_sink_x + + autoscale + False + + + alias + + + + comment + + + + ctrlpanel + False + + + affinity + + + + entags + True + + + _enabled + 0 + + + _coordinate + (808, 286) + + + gui_hint + + + + _rotation + 0 + + + grid + False + + + id + qtgui_time_sink_x_0 + + + legend + True + + + alpha1 + 1.0 + + + color1 + "blue" + + + label1 + + + + marker1 + -1 + + + style1 + 1 + + + width1 + 1 + + + alpha10 + 1.0 + + + color10 + "blue" + + + label10 + + + + marker10 + -1 + + + style10 + 1 + + + width10 + 1 + + + alpha2 + 1.0 + + + color2 + "red" + + + label2 + + + + marker2 + -1 + + + style2 + 1 + + + width2 + 1 + + + alpha3 + 1.0 + + + color3 + "green" + + + label3 + + + + marker3 + -1 + + + style3 + 1 + + + width3 + 1 + + + alpha4 + 1.0 + + + color4 + "black" + + + label4 + + + + marker4 + -1 + + + style4 + 1 + + + width4 + 1 + + + alpha5 + 1.0 + + + color5 + "cyan" + + + label5 + + + + marker5 + -1 + + + style5 + 1 + + + width5 + 1 + + + alpha6 + 1.0 + + + color6 + "magenta" + + + label6 + + + + marker6 + -1 + + + style6 + 1 + + + width6 + 1 + + + alpha7 + 1.0 + + + color7 + "yellow" + + + label7 + + + + marker7 + -1 + + + style7 + 1 + + + width7 + 1 + + + alpha8 + 1.0 + + + color8 + "dark red" + + + label8 + + + + marker8 + -1 + + + style8 + 1 + + + width8 + 1 + + + alpha9 + 1.0 + + + color9 + "dark green" + + + label9 + + + + marker9 + -1 + + + style9 + 1 + + + width9 + 1 + + + name + "" + + + nconnections + 1 + + + size + 1024*64 + + + srate + samp_rate + + + tr_chan + 0 + + + tr_delay + 0 + + + tr_level + 0.0 + + + tr_mode + qtgui.TRIG_MODE_FREE + + + tr_slope + qtgui.TRIG_SLOPE_POS + + + tr_tag + "" + + + type + complex + + + update_time + 0.10 + + + ylabel + Amplitude + + + yunit + "" + + + ymax + 1 + + + ymin + -1 + + + + uhd_usrp_sink + + alias + + + + ant0 + + + + bw0 + 0 + + + center_freq0 + freq + + + norm_gain0 + False + + + gain0 + txgain + + + ant10 + + + + bw10 + 0 + + + center_freq10 + 0 + + + norm_gain10 + False + + + gain10 + 0 + + + ant11 + + + + bw11 + 0 + + + center_freq11 + 0 + + + norm_gain11 + False + + + gain11 + 0 + + + ant12 + + + + bw12 + 0 + + + center_freq12 + 0 + + + norm_gain12 + False + + + gain12 + 0 + + + ant13 + + + + bw13 + 0 + + + center_freq13 + 0 + + + norm_gain13 + False + + + gain13 + 0 + + + ant14 + + + + bw14 + 0 + + + center_freq14 + 0 + + + norm_gain14 + False + + + gain14 + 0 + + + ant15 + + + + bw15 + 0 + + + center_freq15 + 0 + + + norm_gain15 + False + + + gain15 + 0 + + + ant16 + + + + bw16 + 0 + + + center_freq16 + 0 + + + norm_gain16 + False + + + gain16 + 0 + + + ant17 + + + + bw17 + 0 + + + center_freq17 + 0 + + + norm_gain17 + False + + + gain17 + 0 + + + ant18 + + + + bw18 + 0 + + + center_freq18 + 0 + + + norm_gain18 + False + + + gain18 + 0 + + + ant19 + + + + bw19 + 0 + + + center_freq19 + 0 + + + norm_gain19 + False + + + gain19 + 0 + + + ant1 + + + + bw1 + 0 + + + center_freq1 + 0 + + + norm_gain1 + False + + + gain1 + 0 + + + ant20 + + + + bw20 + 0 + + + center_freq20 + 0 + + + norm_gain20 + False + + + gain20 + 0 + + + ant21 + + + + bw21 + 0 + + + center_freq21 + 0 + + + norm_gain21 + False + + + gain21 + 0 + + + ant22 + + + + bw22 + 0 + + + center_freq22 + 0 + + + norm_gain22 + False + + + gain22 + 0 + + + ant23 + + + + bw23 + 0 + + + center_freq23 + 0 + + + norm_gain23 + False + + + gain23 + 0 + + + ant24 + + + + bw24 + 0 + + + center_freq24 + 0 + + + norm_gain24 + False + + + gain24 + 0 + + + ant25 + + + + bw25 + 0 + + + center_freq25 + 0 + + + norm_gain25 + False + + + gain25 + 0 + + + ant26 + + + + bw26 + 0 + + + center_freq26 + 0 + + + norm_gain26 + False + + + gain26 + 0 + + + ant27 + + + + bw27 + 0 + + + center_freq27 + 0 + + + norm_gain27 + False + + + gain27 + 0 + + + ant28 + + + + bw28 + 0 + + + center_freq28 + 0 + + + norm_gain28 + False + + + gain28 + 0 + + + ant29 + + + + bw29 + 0 + + + center_freq29 + 0 + + + norm_gain29 + False + + + gain29 + 0 + + + ant2 + + + + bw2 + 0 + + + center_freq2 + 0 + + + norm_gain2 + False + + + gain2 + 0 + + + ant30 + + + + bw30 + 0 + + + center_freq30 + 0 + + + norm_gain30 + False + + + gain30 + 0 + + + ant31 + + + + bw31 + 0 + + + center_freq31 + 0 + + + norm_gain31 + False + + + gain31 + 0 + + + ant3 + + + + bw3 + 0 + + + center_freq3 + 0 + + + norm_gain3 + False + + + gain3 + 0 + + + ant4 + + + + bw4 + 0 + + + center_freq4 + 0 + + + norm_gain4 + False + + + gain4 + 0 + + + ant5 + + + + bw5 + 0 + + + center_freq5 + 0 + + + norm_gain5 + False + + + gain5 + 0 + + + ant6 + + + + bw6 + 0 + + + center_freq6 + 0 + + + norm_gain6 + False + + + gain6 + 0 + + + ant7 + + + + bw7 + 0 + + + center_freq7 + 0 + + + norm_gain7 + False + + + gain7 + 0 + + + ant8 + + + + bw8 + 0 + + + center_freq8 + 0 + + + norm_gain8 + False + + + gain8 + 0 + + + ant9 + + + + bw9 + 0 + + + center_freq9 + 0 + + + norm_gain9 + False + + + gain9 + 0 + + + clock_rate + 0.0 + + + comment + + + + affinity + + + + dev_addr + "" + + + dev_args + "" + + + _enabled + True + + + _coordinate + (472, 7) + + + _rotation + 0 + + + id + uhd_usrp_sink_0_0 + + + type + fc32 + + + clock_source0 + + + + sd_spec0 + + + + time_source0 + + + + clock_source1 + + + + sd_spec1 + + + + time_source1 + + + + clock_source2 + + + + sd_spec2 + + + + time_source2 + + + + clock_source3 + + + + sd_spec3 + + + + time_source3 + + + + clock_source4 + + + + sd_spec4 + + + + time_source4 + + + + clock_source5 + + + + sd_spec5 + + + + time_source5 + + + + clock_source6 + + + + sd_spec6 + + + + time_source6 + + + + clock_source7 + + + + sd_spec7 + + + + time_source7 + + + + nchan + 1 + + + num_mboards + 1 + + + samp_rate + samp_rate + + + hide_cmd_port + False + + + stream_args + + + + stream_chans + [] + + + sync + + + + len_tag_name + + + + otw + + + + + uhd_usrp_source + + alias + + + + ant0 + + + + bw0 + 0 + + + center_freq0 + freq + + + dc_offs_enb0 + "" + + + iq_imbal_enb0 + "" + + + norm_gain0 + False + + + gain0 + rxgain + + + ant10 + + + + bw10 + 0 + + + center_freq10 + 0 + + + dc_offs_enb10 + "" + + + iq_imbal_enb10 + "" + + + norm_gain10 + False + + + gain10 + 0 + + + ant11 + + + + bw11 + 0 + + + center_freq11 + 0 + + + dc_offs_enb11 + "" + + + iq_imbal_enb11 + "" + + + norm_gain11 + False + + + gain11 + 0 + + + ant12 + + + + bw12 + 0 + + + center_freq12 + 0 + + + dc_offs_enb12 + "" + + + iq_imbal_enb12 + "" + + + norm_gain12 + False + + + gain12 + 0 + + + ant13 + + + + bw13 + 0 + + + center_freq13 + 0 + + + dc_offs_enb13 + "" + + + iq_imbal_enb13 + "" + + + norm_gain13 + False + + + gain13 + 0 + + + ant14 + + + + bw14 + 0 + + + center_freq14 + 0 + + + dc_offs_enb14 + "" + + + iq_imbal_enb14 + "" + + + norm_gain14 + False + + + gain14 + 0 + + + ant15 + + + + bw15 + 0 + + + center_freq15 + 0 + + + dc_offs_enb15 + "" + + + iq_imbal_enb15 + "" + + + norm_gain15 + False + + + gain15 + 0 + + + ant16 + + + + bw16 + 0 + + + center_freq16 + 0 + + + dc_offs_enb16 + "" + + + iq_imbal_enb16 + "" + + + norm_gain16 + False + + + gain16 + 0 + + + ant17 + + + + bw17 + 0 + + + center_freq17 + 0 + + + dc_offs_enb17 + "" + + + iq_imbal_enb17 + "" + + + norm_gain17 + False + + + gain17 + 0 + + + ant18 + + + + bw18 + 0 + + + center_freq18 + 0 + + + dc_offs_enb18 + "" + + + iq_imbal_enb18 + "" + + + norm_gain18 + False + + + gain18 + 0 + + + ant19 + + + + bw19 + 0 + + + center_freq19 + 0 + + + dc_offs_enb19 + "" + + + iq_imbal_enb19 + "" + + + norm_gain19 + False + + + gain19 + 0 + + + ant1 + + + + bw1 + 0 + + + center_freq1 + 0 + + + dc_offs_enb1 + "" + + + iq_imbal_enb1 + "" + + + norm_gain1 + False + + + gain1 + 0 + + + ant20 + + + + bw20 + 0 + + + center_freq20 + 0 + + + dc_offs_enb20 + "" + + + iq_imbal_enb20 + "" + + + norm_gain20 + False + + + gain20 + 0 + + + ant21 + + + + bw21 + 0 + + + center_freq21 + 0 + + + dc_offs_enb21 + "" + + + iq_imbal_enb21 + "" + + + norm_gain21 + False + + + gain21 + 0 + + + ant22 + + + + bw22 + 0 + + + center_freq22 + 0 + + + dc_offs_enb22 + "" + + + iq_imbal_enb22 + "" + + + norm_gain22 + False + + + gain22 + 0 + + + ant23 + + + + bw23 + 0 + + + center_freq23 + 0 + + + dc_offs_enb23 + "" + + + iq_imbal_enb23 + "" + + + norm_gain23 + False + + + gain23 + 0 + + + ant24 + + + + bw24 + 0 + + + center_freq24 + 0 + + + dc_offs_enb24 + "" + + + iq_imbal_enb24 + "" + + + norm_gain24 + False + + + gain24 + 0 + + + ant25 + + + + bw25 + 0 + + + center_freq25 + 0 + + + dc_offs_enb25 + "" + + + iq_imbal_enb25 + "" + + + norm_gain25 + False + + + gain25 + 0 + + + ant26 + + + + bw26 + 0 + + + center_freq26 + 0 + + + dc_offs_enb26 + "" + + + iq_imbal_enb26 + "" + + + norm_gain26 + False + + + gain26 + 0 + + + ant27 + + + + bw27 + 0 + + + center_freq27 + 0 + + + dc_offs_enb27 + "" + + + iq_imbal_enb27 + "" + + + norm_gain27 + False + + + gain27 + 0 + + + ant28 + + + + bw28 + 0 + + + center_freq28 + 0 + + + dc_offs_enb28 + "" + + + iq_imbal_enb28 + "" + + + norm_gain28 + False + + + gain28 + 0 + + + ant29 + + + + bw29 + 0 + + + center_freq29 + 0 + + + dc_offs_enb29 + "" + + + iq_imbal_enb29 + "" + + + norm_gain29 + False + + + gain29 + 0 + + + ant2 + + + + bw2 + 0 + + + center_freq2 + 0 + + + dc_offs_enb2 + "" + + + iq_imbal_enb2 + "" + + + norm_gain2 + False + + + gain2 + 0 + + + ant30 + + + + bw30 + 0 + + + center_freq30 + 0 + + + dc_offs_enb30 + "" + + + iq_imbal_enb30 + "" + + + norm_gain30 + False + + + gain30 + 0 + + + ant31 + + + + bw31 + 0 + + + center_freq31 + 0 + + + dc_offs_enb31 + "" + + + iq_imbal_enb31 + "" + + + norm_gain31 + False + + + gain31 + 0 + + + ant3 + + + + bw3 + 0 + + + center_freq3 + 0 + + + dc_offs_enb3 + "" + + + iq_imbal_enb3 + "" + + + norm_gain3 + False + + + gain3 + 0 + + + ant4 + + + + bw4 + 0 + + + center_freq4 + 0 + + + dc_offs_enb4 + "" + + + iq_imbal_enb4 + "" + + + norm_gain4 + False + + + gain4 + 0 + + + ant5 + + + + bw5 + 0 + + + center_freq5 + 0 + + + dc_offs_enb5 + "" + + + iq_imbal_enb5 + "" + + + norm_gain5 + False + + + gain5 + 0 + + + ant6 + + + + bw6 + 0 + + + center_freq6 + 0 + + + dc_offs_enb6 + "" + + + iq_imbal_enb6 + "" + + + norm_gain6 + False + + + gain6 + 0 + + + ant7 + + + + bw7 + 0 + + + center_freq7 + 0 + + + dc_offs_enb7 + "" + + + iq_imbal_enb7 + "" + + + norm_gain7 + False + + + gain7 + 0 + + + ant8 + + + + bw8 + 0 + + + center_freq8 + 0 + + + dc_offs_enb8 + "" + + + iq_imbal_enb8 + "" + + + norm_gain8 + False + + + gain8 + 0 + + + ant9 + + + + bw9 + 0 + + + center_freq9 + 0 + + + dc_offs_enb9 + "" + + + iq_imbal_enb9 + "" + + + norm_gain9 + False + + + gain9 + 0 + + + clock_rate + 0.0 + + + comment + + + + affinity + + + + dev_addr + "" + + + dev_args + "" + + + _enabled + 1 + + + _coordinate + (472, 110) + + + _rotation + 0 + + + id + uhd_usrp_source_0 + + + maxoutbuf + 0 + + + clock_source0 + + + + sd_spec0 + + + + time_source0 + + + + clock_source1 + + + + sd_spec1 + + + + time_source1 + + + + clock_source2 + + + + sd_spec2 + + + + time_source2 + + + + clock_source3 + + + + sd_spec3 + + + + time_source3 + + + + clock_source4 + + + + sd_spec4 + + + + time_source4 + + + + clock_source5 + + + + sd_spec5 + + + + time_source5 + + + + clock_source6 + + + + sd_spec6 + + + + time_source6 + + + + clock_source7 + + + + sd_spec7 + + + + time_source7 + + + + minoutbuf + 0 + + + nchan + 1 + + + num_mboards + 1 + + + type + fc32 + + + samp_rate + samp_rate + + + hide_cmd_port + False + + + stream_args + + + + stream_chans + [] + + + sync + + + + otw + + + + + blocks_delay_0 + blocks_file_sink_0_0 + 0 + 0 + + + blocks_delay_0 + dpd_memless_poly_0 + 0 + 0 + + + blocks_delay_0 + uhd_usrp_sink_0_0 + 0 + 0 + + + blocks_delay_0_0 + blocks_multiply_const_vxx_0 + 0 + 0 + + + blocks_file_source_0 + blocks_delay_0 + 0 + 0 + + + blocks_multiply_const_vxx_0 + file_sink_out + 0 + 0 + + + blocks_multiply_const_vxx_0 + qtgui_time_sink_x_0 + 0 + 0 + + + dpd_memless_poly_0 + blocks_multiply_const_vxx_0 + 0 + 0 + + + uhd_usrp_source_0 + blocks_delay_0_0 + 0 + 0 + + diff --git a/grc/live_analyse_dab_poly.py b/grc/live_analyse_dab_poly.py index 8f1e443..ee6d2f4 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: Mon Jan 16 22:23:29 2017 +# Generated: Sun Jan 29 11:34:39 2017 ################################################## if __name__ == '__main__': @@ -62,17 +62,22 @@ class live_analyse_dab_poly(gr.top_block, Qt.QWidget): # Variables ################################################## self.samp_rate = samp_rate = 8e6 - self.use_lut = use_lut = 1 - self.txgain = txgain = 84 + self.txgain = txgain = 80 self.rxgain = rxgain = 10 - self.real = real = 1 - self.imag = imag = 1 self.freq = freq = 222e6 - self.f_2 = f_2 = 4096000/2 + 66000 - self.f_1 = f_1 = 4096000/2 + self.f_2 = f_2 = 4096000 + self.f_1 = f_1 = 4096000 self.f2 = f2 = samp_rate / 3.875 self.f1 = f1 = samp_rate / 4 - self.ampl = ampl = 1 + self.ampl = ampl = 0.4 + self.a_8 = a_8 = 0 + self.a_7 = a_7 = 0 + self.a_6 = a_6 = 0 + self.a_5 = a_5 = 0 + self.a_4 = a_4 = 0 + self.a_3 = a_3 = 0 + self.a_2 = a_2 = 0 + self.a_1 = a_1 = 0 ################################################## # Message Queues @@ -82,15 +87,45 @@ class live_analyse_dab_poly(gr.top_block, Qt.QWidget): ################################################## # Blocks ################################################## - self._use_lut_range = Range(0, 1, 0.0001, 1, 200) - self._use_lut_win = RangeWidget(self._use_lut_range, self.set_use_lut, "use_lut", "counter_slider", float) - self.top_layout.addWidget(self._use_lut_win) + self._txgain_range = Range(0, 100, 1, 80, 200) + self._txgain_win = RangeWidget(self._txgain_range, self.set_txgain, "txgain", "counter_slider", float) + self.top_layout.addWidget(self._txgain_win) 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._ampl_range = Range(0, 1, 0.0001, 1, 200) + self._f_2_range = Range(1, 8000000, 1, 4096000, 200) + self._f_2_win = RangeWidget(self._f_2_range, self.set_f_2, "f_2", "counter_slider", float) + self.top_layout.addWidget(self._f_2_win) + self._f_1_range = Range(1, 8000000, 1, 4096000, 200) + self._f_1_win = RangeWidget(self._f_1_range, self.set_f_1, "f_1", "counter_slider", float) + self.top_layout.addWidget(self._f_1_win) + 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) + 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) + self._a_7_range = Range(-1, 1, 0.001, 0, 200) + self._a_7_win = RangeWidget(self._a_7_range, self.set_a_7, "a_7", "counter_slider", float) + self.top_layout.addWidget(self._a_7_win) + self._a_6_range = Range(-1, 1, 0.001, 0, 200) + self._a_6_win = RangeWidget(self._a_6_range, self.set_a_6, "a_6", "counter_slider", float) + self.top_layout.addWidget(self._a_6_win) + self._a_5_range = Range(-1, 1, 0.001, 0, 200) + self._a_5_win = RangeWidget(self._a_5_range, self.set_a_5, "a_5", "counter_slider", float) + self.top_layout.addWidget(self._a_5_win) + self._a_4_range = Range(-1, 1, 0.001, 0, 200) + self._a_4_win = RangeWidget(self._a_4_range, self.set_a_4, "a_4", "counter_slider", float) + self.top_layout.addWidget(self._a_4_win) + self._a_3_range = Range(-1, 1, 0.001, 0, 200) + self._a_3_win = RangeWidget(self._a_3_range, self.set_a_3, "a_3", "counter_slider", float) + self.top_layout.addWidget(self._a_3_win) + 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(-1, 1, 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( ",".join(("", "")), uhd.stream_args( @@ -101,62 +136,17 @@ class live_analyse_dab_poly(gr.top_block, Qt.QWidget): self.uhd_usrp_source_0.set_samp_rate(samp_rate) self.uhd_usrp_source_0.set_center_freq(freq, 0) self.uhd_usrp_source_0.set_gain(rxgain, 0) - self.uhd_amsg_source_0 = uhd.amsg_source(device_addr="", msgq=uhd_amsg_source_0_msgq_out) - self._txgain_range = Range(0, 100, 1, 84, 200) - self._txgain_win = RangeWidget(self._txgain_range, self.set_txgain, "txgain", "counter_slider", float) - self.top_layout.addWidget(self._txgain_win) - self._real_range = Range(-1, 1, 0.0001, 1, 200) - self._real_win = RangeWidget(self._real_range, self.set_real, "real", "counter_slider", float) - self.top_layout.addWidget(self._real_win) - self.qtgui_time_sink_x_0 = qtgui.time_sink_c( - 1024, #size - samp_rate, #samp_rate - "", #name - 2 #number of inputs + self.uhd_usrp_sink_0 = uhd.usrp_sink( + ",".join(("", "")), + uhd.stream_args( + cpu_format="fc32", + channels=range(1), + ), ) - self.qtgui_time_sink_x_0.set_update_time(0.10) - self.qtgui_time_sink_x_0.set_y_axis(-1, 1) - - self.qtgui_time_sink_x_0.set_y_label("Amplitude", "") - - self.qtgui_time_sink_x_0.enable_tags(-1, True) - self.qtgui_time_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_NORM, qtgui.TRIG_SLOPE_POS, 0.0, 0, 0, "") - self.qtgui_time_sink_x_0.enable_autoscale(False) - self.qtgui_time_sink_x_0.enable_grid(False) - self.qtgui_time_sink_x_0.enable_control_panel(False) - - if not True: - self.qtgui_time_sink_x_0.disable_legend() - - labels = ["", "", "", "", "", - "", "", "", "", ""] - widths = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - colors = ["blue", "red", "green", "black", "cyan", - "magenta", "yellow", "dark red", "dark green", "blue"] - styles = [1, 1, 1, 1, 1, - 1, 1, 1, 1, 1] - markers = [-1, -1, -1, -1, -1, - -1, -1, -1, -1, -1] - alphas = [1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0] - - for i in xrange(2*2): - if len(labels[i]) == 0: - if(i % 2 == 0): - self.qtgui_time_sink_x_0.set_line_label(i, "Re{{Data {0}}}".format(i/2)) - else: - self.qtgui_time_sink_x_0.set_line_label(i, "Im{{Data {0}}}".format(i/2)) - else: - self.qtgui_time_sink_x_0.set_line_label(i, labels[i]) - self.qtgui_time_sink_x_0.set_line_width(i, widths[i]) - self.qtgui_time_sink_x_0.set_line_color(i, colors[i]) - self.qtgui_time_sink_x_0.set_line_style(i, styles[i]) - self.qtgui_time_sink_x_0.set_line_marker(i, markers[i]) - self.qtgui_time_sink_x_0.set_line_alpha(i, alphas[i]) - - self._qtgui_time_sink_x_0_win = sip.wrapinstance(self.qtgui_time_sink_x_0.pyqwidget(), Qt.QWidget) - self.top_layout.addWidget(self._qtgui_time_sink_x_0_win) + self.uhd_usrp_sink_0.set_samp_rate(samp_rate) + self.uhd_usrp_sink_0.set_center_freq(freq, 0) + self.uhd_usrp_sink_0.set_gain(txgain, 0) + self.uhd_amsg_source_0 = uhd.amsg_source(device_addr="", msgq=uhd_amsg_source_0_msgq_out) self.qtgui_freq_sink_x_0_0 = qtgui.freq_sink_c( 16000, #size firdes.WIN_BLACKMAN_hARRIS, #wintype @@ -198,37 +188,26 @@ class live_analyse_dab_poly(gr.top_block, Qt.QWidget): self._qtgui_freq_sink_x_0_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0_0.pyqwidget(), Qt.QWidget) self.top_layout.addWidget(self._qtgui_freq_sink_x_0_0_win) - self._imag_range = Range(-1, 1, 0.0001, 1, 200) - self._imag_win = RangeWidget(self._imag_range, self.set_imag, "imag", "counter_slider", float) - self.top_layout.addWidget(self._imag_win) - self._f_2_range = Range(1, 8000000, 1, 4096000/2 + 66000, 200) - self._f_2_win = RangeWidget(self._f_2_range, self.set_f_2, "f_2", "counter_slider", float) - self.top_layout.addWidget(self._f_2_win) - self._f_1_range = Range(1, 8000000, 1, 4096000/2, 200) - self._f_1_win = RangeWidget(self._f_1_range, self.set_f_1, "f_1", "counter_slider", float) - self.top_layout.addWidget(self._f_1_win) - self.dpd_clut_0 = dpd.clut() + 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((1-use_lut, )) - self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((ampl, )) - self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((use_lut, )) + self.blocks_multiply_const_vxx_1 = blocks.multiply_const_vcc((1, )) + self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((ampl, )) self.blocks_message_burst_source_0 = blocks.message_burst_source(gr.sizeof_char*1, blocks_message_burst_source_0_msgq_in) - self.blocks_add_xx_1 = blocks.add_vcc(1) - self.analog_sig_source_x_2 = analog.sig_source_c(samp_rate, analog.GR_TRI_WAVE, 1000, 2, -1 + -1j) + self.blocks_add_xx_0 = blocks.add_vcc(1) + self.analog_sig_source_x_1 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, f_1, 0.45, 0) + self.analog_sig_source_x_0 = analog.sig_source_c(samp_rate, analog.GR_COS_WAVE, f_2, 0.45, 0) ################################################## # Connections ################################################## - self.connect((self.analog_sig_source_x_2, 0), (self.blocks_multiply_const_vxx_1, 0)) - self.connect((self.blocks_add_xx_1, 0), (self.qtgui_time_sink_x_0, 0)) + self.connect((self.analog_sig_source_x_0, 0), (self.blocks_add_xx_0, 1)) + self.connect((self.analog_sig_source_x_1, 0), (self.blocks_add_xx_0, 0)) + self.connect((self.blocks_add_xx_0, 0), (self.blocks_multiply_const_vxx_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_1, 1)) - self.connect((self.blocks_multiply_const_vxx_1, 0), (self.blocks_multiply_const_vxx_2, 0)) - self.connect((self.blocks_multiply_const_vxx_1, 0), (self.dpd_clut_0, 0)) - self.connect((self.blocks_multiply_const_vxx_1, 0), (self.qtgui_time_sink_x_0, 1)) - self.connect((self.blocks_multiply_const_vxx_2, 0), (self.blocks_add_xx_1, 0)) - self.connect((self.dpd_clut_0, 0), (self.blocks_multiply_const_vxx_0, 0)) + self.connect((self.blocks_multiply_const_vxx_0, 0), (self.dpd_memless_poly_0, 0)) + self.connect((self.blocks_multiply_const_vxx_1, 0), (self.uhd_usrp_sink_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)) @@ -245,24 +224,19 @@ class live_analyse_dab_poly(gr.top_block, Qt.QWidget): self.samp_rate = samp_rate self.set_f1(self.samp_rate / 4) self.set_f2(self.samp_rate / 3.875) - self.analog_sig_source_x_2.set_sampling_freq(self.samp_rate) + self.analog_sig_source_x_0.set_sampling_freq(self.samp_rate) + self.analog_sig_source_x_1.set_sampling_freq(self.samp_rate) self.qtgui_freq_sink_x_0_0.set_frequency_range(0, self.samp_rate) + self.uhd_usrp_sink_0.set_samp_rate(self.samp_rate) self.uhd_usrp_source_0.set_samp_rate(self.samp_rate) - self.qtgui_time_sink_x_0.set_samp_rate(self.samp_rate) - - def get_use_lut(self): - return self.use_lut - - def set_use_lut(self, use_lut): - self.use_lut = use_lut - self.blocks_multiply_const_vxx_0.set_k((self.use_lut, )) - self.blocks_multiply_const_vxx_2.set_k((1-self.use_lut, )) def get_txgain(self): return self.txgain def set_txgain(self, txgain): self.txgain = txgain + self.uhd_usrp_sink_0.set_gain(self.txgain, 0) + def get_rxgain(self): return self.rxgain @@ -272,23 +246,12 @@ class live_analyse_dab_poly(gr.top_block, Qt.QWidget): self.uhd_usrp_source_0.set_gain(self.rxgain, 0) - def get_real(self): - return self.real - - def set_real(self, real): - self.real = real - - def get_imag(self): - return self.imag - - def set_imag(self, imag): - self.imag = imag - def get_freq(self): return self.freq def set_freq(self, freq): self.freq = freq + self.uhd_usrp_sink_0.set_center_freq(self.freq, 0) self.uhd_usrp_source_0.set_center_freq(self.freq, 0) def get_f_2(self): @@ -296,12 +259,14 @@ class live_analyse_dab_poly(gr.top_block, Qt.QWidget): def set_f_2(self, f_2): self.f_2 = f_2 + self.analog_sig_source_x_0.set_frequency(self.f_2) def get_f_1(self): return self.f_1 def set_f_1(self, f_1): self.f_1 = f_1 + self.analog_sig_source_x_1.set_frequency(self.f_1) def get_f2(self): return self.f2 @@ -320,7 +285,63 @@ class live_analyse_dab_poly(gr.top_block, Qt.QWidget): def set_ampl(self, ampl): self.ampl = ampl - self.blocks_multiply_const_vxx_1.set_k((self.ampl, )) + self.blocks_multiply_const_vxx_0.set_k((self.ampl, )) + + def get_a_8(self): + return self.a_8 + + def set_a_8(self, a_8): + self.a_8 = a_8 + self.dpd_memless_poly_0.set_a8(self.a_8) + + def get_a_7(self): + return self.a_7 + + def set_a_7(self, a_7): + self.a_7 = a_7 + self.dpd_memless_poly_0.set_a7(self.a_7) + + def get_a_6(self): + return self.a_6 + + def set_a_6(self, a_6): + self.a_6 = a_6 + self.dpd_memless_poly_0.set_a6(self.a_6) + + def get_a_5(self): + return self.a_5 + + def set_a_5(self, a_5): + self.a_5 = a_5 + self.dpd_memless_poly_0.set_a5(self.a_5) + + def get_a_4(self): + return self.a_4 + + def set_a_4(self, a_4): + self.a_4 = a_4 + self.dpd_memless_poly_0.set_a4(self.a_4) + + def get_a_3(self): + return self.a_3 + + def set_a_3(self, a_3): + self.a_3 = a_3 + self.dpd_memless_poly_0.set_a3(self.a_3) + + def get_a_2(self): + return self.a_2 + + def set_a_2(self, a_2): + self.a_2 = a_2 + self.dpd_memless_poly_0.set_a2(self.a_2) + + def get_a_1(self): + return self.a_1 + + def set_a_1(self, a_1): + self.a_1 = a_1 + self.dpd_memless_poly_0.set_a1(self.a_1) def main(top_block_cls=live_analyse_dab_poly, options=None): diff --git a/grc/live_analyse_two_tone_clut.grc b/grc/live_analyse_two_tone_clut.grc new file mode 100644 index 0000000..27cdb5e --- /dev/null +++ b/grc/live_analyse_two_tone_clut.grc @@ -0,0 +1,5546 @@ + + + + Wed Oct 28 18:49:28 2015 + + options + + author + + + + window_size + 2000,2000 + + + category + Custom + + + comment + + + + description + + + + _enabled + True + + + _coordinate + (8, 8) + + + _rotation + 0 + + + generate_options + qt_gui + + + hier_block_src_path + .: + + + id + live_analyse_dab_poly + + + max_nouts + 0 + + + qt_qss_theme + + + + realtime_scheduling + + + + run_command + {python} -u {filename} + + + run_options + prompt + + + run + True + + + thread_safe_setters + + + + title + + + + + variable_qtgui_range + + comment + + + + value + 1 + + + _enabled + True + + + _coordinate + (128, 376) + + + gui_hint + + + + _rotation + 0 + + + id + ampl + + + label + + + + min_len + 200 + + + orient + Qt.Horizontal + + + start + 0 + + + step + 0.0001 + + + stop + 1 + + + rangeType + float + + + widget + counter_slider + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (104, 101) + + + _rotation + 0 + + + id + f1 + + + value + samp_rate / 4 + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (1384, 573) + + + _rotation + 0 + + + id + f2 + + + value + samp_rate / 3.875 + + + + variable_qtgui_range + + comment + + + + value + 4096000/2 + + + _enabled + True + + + _coordinate + (40, 536) + + + gui_hint + + + + _rotation + 0 + + + id + f_1 + + + label + + + + min_len + 200 + + + orient + Qt.Horizontal + + + start + 1 + + + step + 1 + + + stop + 8000000 + + + rangeType + float + + + widget + counter_slider + + + + variable_qtgui_range + + comment + + + + value + 4096000/2 + 66000 + + + _enabled + True + + + _coordinate + (40, 648) + + + gui_hint + + + + _rotation + 0 + + + id + f_2 + + + label + + + + min_len + 200 + + + orient + Qt.Horizontal + + + start + 1 + + + step + 1 + + + stop + 8000000 + + + rangeType + float + + + widget + counter_slider + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (8, 157) + + + _rotation + 0 + + + id + freq + + + value + 222e6 + + + + variable_qtgui_range + + comment + + + + value + 1 + + + _enabled + True + + + _coordinate + (800, 536) + + + gui_hint + + + + _rotation + 0 + + + id + imag + + + label + + + + min_len + 200 + + + orient + Qt.Horizontal + + + start + -1 + + + step + 0.0001 + + + stop + 1 + + + rangeType + float + + + widget + counter_slider + + + + variable_qtgui_range + + comment + + + + value + 1 + + + _enabled + True + + + _coordinate + (688, 536) + + + gui_hint + + + + _rotation + 0 + + + id + real + + + label + + + + min_len + 200 + + + orient + Qt.Horizontal + + + start + -1 + + + step + 0.0001 + + + stop + 1 + + + rangeType + float + + + widget + counter_slider + + + + variable_qtgui_range + + comment + + + + value + 10 + + + _enabled + True + + + _coordinate + (8, 225) + + + gui_hint + + + + _rotation + 0 + + + id + rxgain + + + label + rxgain + + + min_len + 200 + + + orient + Qt.Horizontal + + + start + 0 + + + step + 1 + + + stop + 100 + + + rangeType + float + + + widget + counter_slider + + + + variable + + comment + + + + _enabled + True + + + _coordinate + (8, 85) + + + _rotation + 0 + + + id + samp_rate + + + value + 8e6 + + + + variable_qtgui_range + + comment + + + + value + 84 + + + _enabled + True + + + _coordinate + (8, 345) + + + gui_hint + + + + _rotation + 0 + + + id + txgain + + + label + txgain + + + min_len + 200 + + + orient + Qt.Horizontal + + + start + 0 + + + step + 1 + + + stop + 100 + + + rangeType + float + + + widget + counter_slider + + + + variable_qtgui_range + + comment + + + + value + 1 + + + _enabled + True + + + _coordinate + (248, 376) + + + gui_hint + + + + _rotation + 0 + + + id + use_lut + + + label + + + + min_len + 200 + + + orient + Qt.Horizontal + + + start + 0 + + + step + 0.0001 + + + stop + 1 + + + rangeType + float + + + widget + counter_slider + + + + analog_sig_source_x + + amp + 0.5 + + + alias + + + + comment + + + + affinity + + + + _enabled + 0 + + + freq + f_2 + + + _coordinate + (200, 192) + + + _rotation + 0 + + + id + analog_sig_source_x_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + offset + 0 + + + type + complex + + + samp_rate + samp_rate + + + waveform + analog.GR_COS_WAVE + + + + analog_sig_source_x + + amp + 0.5 + + + alias + + + + comment + + + + affinity + + + + _enabled + 0 + + + freq + f_1 + + + _coordinate + (200, 80) + + + _rotation + 0 + + + id + analog_sig_source_x_1 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + offset + 0 + + + type + complex + + + samp_rate + samp_rate + + + waveform + analog.GR_COS_WAVE + + + + analog_sig_source_x + + amp + 2 + + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + freq + 1000 + + + _coordinate + (200, 0) + + + _rotation + 0 + + + id + analog_sig_source_x_2 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + offset + -1 + -1j + + + type + complex + + + samp_rate + samp_rate + + + waveform + analog.GR_TRI_WAVE + + + + blocks_add_xx + + alias + + + + comment + + + + affinity + + + + _enabled + 0 + + + _coordinate + (392, 161) + + + _rotation + 0 + + + id + blocks_add_xx_0 + + + type + complex + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + num_inputs + 2 + + + vlen + 1 + + + + blocks_add_xx + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (1048, 41) + + + _rotation + 0 + + + id + blocks_add_xx_1 + + + type + complex + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + num_inputs + 2 + + + vlen + 1 + + + + blocks_complex_to_real + + alias + + + + comment + + + + affinity + + + + _enabled + 0 + + + _coordinate + (920, 361) + + + _rotation + 0 + + + id + blocks_complex_to_real_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + vlen + 1 + + + + blocks_file_source + + alias + + + + comment + + + + affinity + + + + _enabled + 0 + + + file + /home/andreas/dab/ODR-StaticPrecorrection/input.dat + + + _coordinate + (416, 13) + + + _rotation + 0 + + + id + blocks_file_source_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + type + complex + + + repeat + True + + + vlen + 1 + + + + blocks_file_source + + alias + + + + comment + + + + affinity + + + + _enabled + 0 + + + file + /home/andreas/dab/dab_normalized_c64.dat + + + _coordinate + (200, 301) + + + _rotation + 0 + + + id + blocks_file_source_0_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + type + complex + + + repeat + True + + + vlen + 1 + + + + blocks_message_burst_source + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (824, 449) + + + _rotation + 0 + + + id + blocks_message_burst_source_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + type + byte + + + vlen + 1 + + + + blocks_multiply_const_vxx + + alias + + + + comment + + + + const + use_lut + + + affinity + + + + _enabled + True + + + _coordinate + (816, 124) + + + _rotation + 0 + + + id + blocks_multiply_const_vxx_0 + + + type + complex + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + vlen + 1 + + + + blocks_multiply_const_vxx + + alias + + + + comment + + + + const + ampl + + + affinity + + + + _enabled + True + + + _coordinate + (472, 124) + + + _rotation + 0 + + + id + blocks_multiply_const_vxx_1 + + + type + complex + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + vlen + 1 + + + + blocks_multiply_const_vxx + + alias + + + + comment + + + + const + 1-use_lut + + + affinity + + + + _enabled + True + + + _coordinate + (800, 20) + + + _rotation + 0 + + + id + blocks_multiply_const_vxx_2 + + + type + complex + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + vlen + 1 + + + + blocks_null_sink + + alias + + + + bus_conns + [[0,],] + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (1248, 449) + + + _rotation + 0 + + + id + blocks_null_sink_0_2 + + + type + byte + + + num_inputs + 1 + + + vlen + 1 + + + + blocks_null_sink + + alias + + + + bus_conns + [[0,],] + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (976, 409) + + + _rotation + 0 + + + id + blocks_null_sink_0_2_0 + + + type + complex + + + num_inputs + 1 + + + vlen + 1 + + + + dpd_clut + + alias + + + + comment + + + + affinity + + + + _enabled + True + + + _coordinate + (712, 129) + + + _rotation + 0 + + + id + dpd_clut_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + + qtgui_const_sink_x + + autoscale + False + + + alias + + + + comment + + + + affinity + + + + _enabled + 0 + + + _coordinate + (920, 197) + + + gui_hint + + + + _rotation + 0 + + + grid + False + + + id + qtgui_const_sink_x_0 + + + legend + True + + + alpha1 + 1.0 + + + color1 + "blue" + + + label1 + + + + marker1 + 0 + + + style1 + 0 + + + width1 + 1 + + + alpha10 + 1.0 + + + color10 + "red" + + + label10 + + + + marker10 + 0 + + + style10 + 0 + + + width10 + 1 + + + alpha2 + 1.0 + + + color2 + "red" + + + label2 + + + + marker2 + 0 + + + style2 + 0 + + + width2 + 1 + + + alpha3 + 1.0 + + + color3 + "red" + + + label3 + + + + marker3 + 0 + + + style3 + 0 + + + width3 + 1 + + + alpha4 + 1.0 + + + color4 + "red" + + + label4 + + + + marker4 + 0 + + + style4 + 0 + + + width4 + 1 + + + alpha5 + 1.0 + + + color5 + "red" + + + label5 + + + + marker5 + 0 + + + style5 + 0 + + + width5 + 1 + + + alpha6 + 1.0 + + + color6 + "red" + + + label6 + + + + marker6 + 0 + + + style6 + 0 + + + width6 + 1 + + + alpha7 + 1.0 + + + color7 + "red" + + + label7 + + + + marker7 + 0 + + + style7 + 0 + + + width7 + 1 + + + alpha8 + 1.0 + + + color8 + "red" + + + label8 + + + + marker8 + 0 + + + style8 + 0 + + + width8 + 1 + + + alpha9 + 1.0 + + + color9 + "red" + + + label9 + + + + marker9 + 0 + + + style9 + 0 + + + width9 + 1 + + + name + "" + + + nconnections + 2 + + + size + 1024 + + + tr_chan + 0 + + + tr_level + 0.0 + + + tr_mode + qtgui.TRIG_MODE_FREE + + + tr_slope + qtgui.TRIG_SLOPE_POS + + + tr_tag + "" + + + type + complex + + + update_time + 0.10 + + + xmax + 2 + + + xmin + -2 + + + ymax + 2 + + + ymin + -2 + + + + qtgui_freq_sink_x + + autoscale + False + + + average + 1.0 + + + bw + samp_rate + + + alias + + + + fc + 0 + + + comment + + + + ctrlpanel + False + + + affinity + + + + _enabled + 1 + + + fftsize + 16000 + + + _coordinate + (928, 278) + + + gui_hint + + + + _rotation + 0 + + + grid + False + + + id + qtgui_freq_sink_x_0_0 + + + legend + True + + + alpha1 + 1.0 + + + color1 + "blue" + + + label1 + + + + width1 + 1 + + + alpha10 + 1.0 + + + color10 + "dark blue" + + + label10 + + + + width10 + 1 + + + alpha2 + 1.0 + + + color2 + "red" + + + label2 + + + + width2 + 1 + + + alpha3 + 1.0 + + + color3 + "green" + + + label3 + + + + width3 + 1 + + + alpha4 + 1.0 + + + color4 + "black" + + + label4 + + + + width4 + 1 + + + alpha5 + 1.0 + + + color5 + "cyan" + + + label5 + + + + width5 + 1 + + + alpha6 + 1.0 + + + color6 + "magenta" + + + label6 + + + + width6 + 1 + + + alpha7 + 1.0 + + + color7 + "yellow" + + + label7 + + + + width7 + 1 + + + alpha8 + 1.0 + + + color8 + "dark red" + + + label8 + + + + width8 + 1 + + + alpha9 + 1.0 + + + color9 + "dark green" + + + label9 + + + + width9 + 1 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + name + "" + + + nconnections + 1 + + + showports + True + + + freqhalf + True + + + tr_chan + 0 + + + tr_level + 0.0 + + + tr_mode + qtgui.TRIG_MODE_FREE + + + tr_tag + "" + + + type + complex + + + update_time + 0.1 + + + wintype + firdes.WIN_BLACKMAN_hARRIS + + + ymax + 10 + + + ymin + -140 + + + + qtgui_freq_sink_x + + autoscale + False + + + average + 1.0 + + + bw + samp_rate + + + alias + + + + fc + 0 + + + comment + + + + ctrlpanel + False + + + affinity + + + + _enabled + 0 + + + fftsize + 16000 + + + _coordinate + (1312, 102) + + + gui_hint + + + + _rotation + 0 + + + grid + False + + + id + qtgui_freq_sink_x_0_0_0 + + + legend + True + + + alpha1 + 1.0 + + + color1 + "blue" + + + label1 + + + + width1 + 1 + + + alpha10 + 1.0 + + + color10 + "dark blue" + + + label10 + + + + width10 + 1 + + + alpha2 + 1.0 + + + color2 + "red" + + + label2 + + + + width2 + 1 + + + alpha3 + 1.0 + + + color3 + "green" + + + label3 + + + + width3 + 1 + + + alpha4 + 1.0 + + + color4 + "black" + + + label4 + + + + width4 + 1 + + + alpha5 + 1.0 + + + color5 + "cyan" + + + label5 + + + + width5 + 1 + + + alpha6 + 1.0 + + + color6 + "magenta" + + + label6 + + + + width6 + 1 + + + alpha7 + 1.0 + + + color7 + "yellow" + + + label7 + + + + width7 + 1 + + + alpha8 + 1.0 + + + color8 + "dark red" + + + label8 + + + + width8 + 1 + + + alpha9 + 1.0 + + + color9 + "dark green" + + + label9 + + + + width9 + 1 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + name + "" + + + nconnections + 1 + + + showports + True + + + freqhalf + True + + + tr_chan + 0 + + + tr_level + 0.0 + + + tr_mode + qtgui.TRIG_MODE_FREE + + + tr_tag + "" + + + type + complex + + + update_time + 0.10 + + + wintype + firdes.WIN_BLACKMAN_hARRIS + + + ymax + 10 + + + ymin + -140 + + + + qtgui_time_sink_x + + autoscale + False + + + alias + + + + comment + + + + ctrlpanel + False + + + affinity + + + + entags + True + + + _enabled + 1 + + + _coordinate + (1312, 182) + + + gui_hint + + + + _rotation + 0 + + + grid + False + + + id + qtgui_time_sink_x_0 + + + legend + True + + + alpha1 + 1.0 + + + color1 + "blue" + + + label1 + + + + marker1 + -1 + + + style1 + 1 + + + width1 + 1 + + + alpha10 + 1.0 + + + color10 + "blue" + + + label10 + + + + marker10 + -1 + + + style10 + 1 + + + width10 + 1 + + + alpha2 + 1.0 + + + color2 + "red" + + + label2 + + + + marker2 + -1 + + + style2 + 1 + + + width2 + 1 + + + alpha3 + 1.0 + + + color3 + "green" + + + label3 + + + + marker3 + -1 + + + style3 + 1 + + + width3 + 1 + + + alpha4 + 1.0 + + + color4 + "black" + + + label4 + + + + marker4 + -1 + + + style4 + 1 + + + width4 + 1 + + + alpha5 + 1.0 + + + color5 + "cyan" + + + label5 + + + + marker5 + -1 + + + style5 + 1 + + + width5 + 1 + + + alpha6 + 1.0 + + + color6 + "magenta" + + + label6 + + + + marker6 + -1 + + + style6 + 1 + + + width6 + 1 + + + alpha7 + 1.0 + + + color7 + "yellow" + + + label7 + + + + marker7 + -1 + + + style7 + 1 + + + width7 + 1 + + + alpha8 + 1.0 + + + color8 + "dark red" + + + label8 + + + + marker8 + -1 + + + style8 + 1 + + + width8 + 1 + + + alpha9 + 1.0 + + + color9 + "dark green" + + + label9 + + + + marker9 + -1 + + + style9 + 1 + + + width9 + 1 + + + name + "" + + + nconnections + 2 + + + size + 1024 + + + srate + samp_rate + + + tr_chan + 0 + + + tr_delay + 0 + + + tr_level + 0.0 + + + tr_mode + qtgui.TRIG_MODE_NORM + + + tr_slope + qtgui.TRIG_SLOPE_POS + + + tr_tag + "" + + + type + complex + + + update_time + 0.10 + + + ylabel + Amplitude + + + yunit + "" + + + ymax + 1 + + + ymin + -1 + + + + qtgui_time_sink_x + + autoscale + False + + + alias + + + + comment + + + + ctrlpanel + False + + + affinity + + + + entags + True + + + _enabled + 0 + + + _coordinate + (1112, 342) + + + gui_hint + + + + _rotation + 0 + + + grid + False + + + id + qtgui_time_sink_x_0_0 + + + legend + True + + + alpha1 + 1.0 + + + color1 + "blue" + + + label1 + + + + marker1 + -1 + + + style1 + 1 + + + width1 + 1 + + + alpha10 + 1.0 + + + color10 + "blue" + + + label10 + + + + marker10 + -1 + + + style10 + 1 + + + width10 + 1 + + + alpha2 + 1.0 + + + color2 + "red" + + + label2 + + + + marker2 + -1 + + + style2 + 1 + + + width2 + 1 + + + alpha3 + 1.0 + + + color3 + "green" + + + label3 + + + + marker3 + -1 + + + style3 + 1 + + + width3 + 1 + + + alpha4 + 1.0 + + + color4 + "black" + + + label4 + + + + marker4 + -1 + + + style4 + 1 + + + width4 + 1 + + + alpha5 + 1.0 + + + color5 + "cyan" + + + label5 + + + + marker5 + -1 + + + style5 + 1 + + + width5 + 1 + + + alpha6 + 1.0 + + + color6 + "magenta" + + + label6 + + + + marker6 + -1 + + + style6 + 1 + + + width6 + 1 + + + alpha7 + 1.0 + + + color7 + "yellow" + + + label7 + + + + marker7 + -1 + + + style7 + 1 + + + width7 + 1 + + + alpha8 + 1.0 + + + color8 + "dark red" + + + label8 + + + + marker8 + -1 + + + style8 + 1 + + + width8 + 1 + + + alpha9 + 1.0 + + + color9 + "dark green" + + + label9 + + + + marker9 + -1 + + + style9 + 1 + + + width9 + 1 + + + name + "" + + + nconnections + 1 + + + size + 1024 + + + srate + samp_rate + + + tr_chan + 0 + + + tr_delay + 0 + + + tr_level + 0.0 + + + tr_mode + qtgui.TRIG_MODE_FREE + + + tr_slope + qtgui.TRIG_SLOPE_POS + + + tr_tag + "" + + + type + float + + + update_time + 0.10 + + + ylabel + Amplitude + + + yunit + "" + + + ymax + 1 + + + ymin + -1 + + + + qtgui_time_sink_x + + autoscale + False + + + alias + + + + comment + + + + ctrlpanel + False + + + affinity + + + + entags + True + + + _enabled + 0 + + + _coordinate + (1312, 22) + + + gui_hint + + + + _rotation + 0 + + + grid + False + + + id + qtgui_time_sink_x_1 + + + legend + True + + + alpha1 + 1.0 + + + color1 + "blue" + + + label1 + + + + marker1 + -1 + + + style1 + 1 + + + width1 + 1 + + + alpha10 + 1.0 + + + color10 + "blue" + + + label10 + + + + marker10 + -1 + + + style10 + 1 + + + width10 + 1 + + + alpha2 + 1.0 + + + color2 + "red" + + + label2 + + + + marker2 + -1 + + + style2 + 1 + + + width2 + 1 + + + alpha3 + 1.0 + + + color3 + "green" + + + label3 + + + + marker3 + -1 + + + style3 + 1 + + + width3 + 1 + + + alpha4 + 1.0 + + + color4 + "black" + + + label4 + + + + marker4 + -1 + + + style4 + 1 + + + width4 + 1 + + + alpha5 + 1.0 + + + color5 + "cyan" + + + label5 + + + + marker5 + -1 + + + style5 + 1 + + + width5 + 1 + + + alpha6 + 1.0 + + + color6 + "magenta" + + + label6 + + + + marker6 + -1 + + + style6 + 1 + + + width6 + 1 + + + alpha7 + 1.0 + + + color7 + "yellow" + + + label7 + + + + marker7 + -1 + + + style7 + 1 + + + width7 + 1 + + + alpha8 + 1.0 + + + color8 + "dark red" + + + label8 + + + + marker8 + -1 + + + style8 + 1 + + + width8 + 1 + + + alpha9 + 1.0 + + + color9 + "dark green" + + + label9 + + + + marker9 + -1 + + + style9 + 1 + + + width9 + 1 + + + name + "" + + + nconnections + 1 + + + size + 1024 + + + srate + samp_rate + + + tr_chan + 0 + + + tr_delay + 0 + + + tr_level + 0.0 + + + tr_mode + qtgui.TRIG_MODE_FREE + + + tr_slope + qtgui.TRIG_SLOPE_POS + + + tr_tag + "" + + + type + complex + + + update_time + 0.10 + + + ylabel + Amplitude + + + yunit + "" + + + ymax + 1 + + + ymin + -1 + + + + uhd_amsg_source + + alias + + + + comment + + + + affinity + + + + dev_addr + + + + _enabled + True + + + _coordinate + (528, 449) + + + _rotation + 0 + + + id + uhd_amsg_source_0 + + + maxoutbuf + 0 + + + minoutbuf + 0 + + + + uhd_usrp_sink + + alias + + + + ant0 + + + + bw0 + 0 + + + center_freq0 + freq + + + norm_gain0 + False + + + gain0 + txgain + + + ant10 + + + + bw10 + 0 + + + center_freq10 + 0 + + + norm_gain10 + False + + + gain10 + 0 + + + ant11 + + + + bw11 + 0 + + + center_freq11 + 0 + + + norm_gain11 + False + + + gain11 + 0 + + + ant12 + + + + bw12 + 0 + + + center_freq12 + 0 + + + norm_gain12 + False + + + gain12 + 0 + + + ant13 + + + + bw13 + 0 + + + center_freq13 + 0 + + + norm_gain13 + False + + + gain13 + 0 + + + ant14 + + + + bw14 + 0 + + + center_freq14 + 0 + + + norm_gain14 + False + + + gain14 + 0 + + + ant15 + + + + bw15 + 0 + + + center_freq15 + 0 + + + norm_gain15 + False + + + gain15 + 0 + + + ant16 + + + + bw16 + 0 + + + center_freq16 + 0 + + + norm_gain16 + False + + + gain16 + 0 + + + ant17 + + + + bw17 + 0 + + + center_freq17 + 0 + + + norm_gain17 + False + + + gain17 + 0 + + + ant18 + + + + bw18 + 0 + + + center_freq18 + 0 + + + norm_gain18 + False + + + gain18 + 0 + + + ant19 + + + + bw19 + 0 + + + center_freq19 + 0 + + + norm_gain19 + False + + + gain19 + 0 + + + ant1 + + + + bw1 + 0 + + + center_freq1 + 0 + + + norm_gain1 + False + + + gain1 + 0 + + + ant20 + + + + bw20 + 0 + + + center_freq20 + 0 + + + norm_gain20 + False + + + gain20 + 0 + + + ant21 + + + + bw21 + 0 + + + center_freq21 + 0 + + + norm_gain21 + False + + + gain21 + 0 + + + ant22 + + + + bw22 + 0 + + + center_freq22 + 0 + + + norm_gain22 + False + + + gain22 + 0 + + + ant23 + + + + bw23 + 0 + + + center_freq23 + 0 + + + norm_gain23 + False + + + gain23 + 0 + + + ant24 + + + + bw24 + 0 + + + center_freq24 + 0 + + + norm_gain24 + False + + + gain24 + 0 + + + ant25 + + + + bw25 + 0 + + + center_freq25 + 0 + + + norm_gain25 + False + + + gain25 + 0 + + + ant26 + + + + bw26 + 0 + + + center_freq26 + 0 + + + norm_gain26 + False + + + gain26 + 0 + + + ant27 + + + + bw27 + 0 + + + center_freq27 + 0 + + + norm_gain27 + False + + + gain27 + 0 + + + ant28 + + + + bw28 + 0 + + + center_freq28 + 0 + + + norm_gain28 + False + + + gain28 + 0 + + + ant29 + + + + bw29 + 0 + + + center_freq29 + 0 + + + norm_gain29 + False + + + gain29 + 0 + + + ant2 + + + + bw2 + 0 + + + center_freq2 + 0 + + + norm_gain2 + False + + + gain2 + 0 + + + ant30 + + + + bw30 + 0 + + + center_freq30 + 0 + + + norm_gain30 + False + + + gain30 + 0 + + + ant31 + + + + bw31 + 0 + + + center_freq31 + 0 + + + norm_gain31 + False + + + gain31 + 0 + + + ant3 + + + + bw3 + 0 + + + center_freq3 + 0 + + + norm_gain3 + False + + + gain3 + 0 + + + ant4 + + + + bw4 + 0 + + + center_freq4 + 0 + + + norm_gain4 + False + + + gain4 + 0 + + + ant5 + + + + bw5 + 0 + + + center_freq5 + 0 + + + norm_gain5 + False + + + gain5 + 0 + + + ant6 + + + + bw6 + 0 + + + center_freq6 + 0 + + + norm_gain6 + False + + + gain6 + 0 + + + ant7 + + + + bw7 + 0 + + + center_freq7 + 0 + + + norm_gain7 + False + + + gain7 + 0 + + + ant8 + + + + bw8 + 0 + + + center_freq8 + 0 + + + norm_gain8 + False + + + gain8 + 0 + + + ant9 + + + + bw9 + 0 + + + center_freq9 + 0 + + + norm_gain9 + False + + + gain9 + 0 + + + clock_rate + 0.0 + + + comment + + + + affinity + + + + dev_addr + "" + + + dev_args + "" + + + _enabled + 0 + + + _coordinate + (1312, 271) + + + _rotation + 0 + + + id + uhd_usrp_sink_0 + + + type + fc32 + + + clock_source0 + + + + sd_spec0 + + + + time_source0 + + + + clock_source1 + + + + sd_spec1 + + + + time_source1 + + + + clock_source2 + + + + sd_spec2 + + + + time_source2 + + + + clock_source3 + + + + sd_spec3 + + + + time_source3 + + + + clock_source4 + + + + sd_spec4 + + + + time_source4 + + + + clock_source5 + + + + sd_spec5 + + + + time_source5 + + + + clock_source6 + + + + sd_spec6 + + + + time_source6 + + + + clock_source7 + + + + sd_spec7 + + + + time_source7 + + + + nchan + 1 + + + num_mboards + 1 + + + samp_rate + samp_rate + + + hide_cmd_port + False + + + stream_args + + + + stream_chans + [] + + + sync + + + + len_tag_name + + + + otw + + + + + uhd_usrp_source + + alias + + + + ant0 + + + + bw0 + 0 + + + center_freq0 + freq + + + dc_offs_enb0 + "" + + + iq_imbal_enb0 + "" + + + norm_gain0 + False + + + gain0 + rxgain + + + ant10 + + + + bw10 + 0 + + + center_freq10 + 0 + + + dc_offs_enb10 + "" + + + iq_imbal_enb10 + "" + + + norm_gain10 + False + + + gain10 + 0 + + + ant11 + + + + bw11 + 0 + + + center_freq11 + 0 + + + dc_offs_enb11 + "" + + + iq_imbal_enb11 + "" + + + norm_gain11 + False + + + gain11 + 0 + + + ant12 + + + + bw12 + 0 + + + center_freq12 + 0 + + + dc_offs_enb12 + "" + + + iq_imbal_enb12 + "" + + + norm_gain12 + False + + + gain12 + 0 + + + ant13 + + + + bw13 + 0 + + + center_freq13 + 0 + + + dc_offs_enb13 + "" + + + iq_imbal_enb13 + "" + + + norm_gain13 + False + + + gain13 + 0 + + + ant14 + + + + bw14 + 0 + + + center_freq14 + 0 + + + dc_offs_enb14 + "" + + + iq_imbal_enb14 + "" + + + norm_gain14 + False + + + gain14 + 0 + + + ant15 + + + + bw15 + 0 + + + center_freq15 + 0 + + + dc_offs_enb15 + "" + + + iq_imbal_enb15 + "" + + + norm_gain15 + False + + + gain15 + 0 + + + ant16 + + + + bw16 + 0 + + + center_freq16 + 0 + + + dc_offs_enb16 + "" + + + iq_imbal_enb16 + "" + + + norm_gain16 + False + + + gain16 + 0 + + + ant17 + + + + bw17 + 0 + + + center_freq17 + 0 + + + dc_offs_enb17 + "" + + + iq_imbal_enb17 + "" + + + norm_gain17 + False + + + gain17 + 0 + + + ant18 + + + + bw18 + 0 + + + center_freq18 + 0 + + + dc_offs_enb18 + "" + + + iq_imbal_enb18 + "" + + + norm_gain18 + False + + + gain18 + 0 + + + ant19 + + + + bw19 + 0 + + + center_freq19 + 0 + + + dc_offs_enb19 + "" + + + iq_imbal_enb19 + "" + + + norm_gain19 + False + + + gain19 + 0 + + + ant1 + + + + bw1 + 0 + + + center_freq1 + 0 + + + dc_offs_enb1 + "" + + + iq_imbal_enb1 + "" + + + norm_gain1 + False + + + gain1 + 0 + + + ant20 + + + + bw20 + 0 + + + center_freq20 + 0 + + + dc_offs_enb20 + "" + + + iq_imbal_enb20 + "" + + + norm_gain20 + False + + + gain20 + 0 + + + ant21 + + + + bw21 + 0 + + + center_freq21 + 0 + + + dc_offs_enb21 + "" + + + iq_imbal_enb21 + "" + + + norm_gain21 + False + + + gain21 + 0 + + + ant22 + + + + bw22 + 0 + + + center_freq22 + 0 + + + dc_offs_enb22 + "" + + + iq_imbal_enb22 + "" + + + norm_gain22 + False + + + gain22 + 0 + + + ant23 + + + + bw23 + 0 + + + center_freq23 + 0 + + + dc_offs_enb23 + "" + + + iq_imbal_enb23 + "" + + + norm_gain23 + False + + + gain23 + 0 + + + ant24 + + + + bw24 + 0 + + + center_freq24 + 0 + + + dc_offs_enb24 + "" + + + iq_imbal_enb24 + "" + + + norm_gain24 + False + + + gain24 + 0 + + + ant25 + + + + bw25 + 0 + + + center_freq25 + 0 + + + dc_offs_enb25 + "" + + + iq_imbal_enb25 + "" + + + norm_gain25 + False + + + gain25 + 0 + + + ant26 + + + + bw26 + 0 + + + center_freq26 + 0 + + + dc_offs_enb26 + "" + + + iq_imbal_enb26 + "" + + + norm_gain26 + False + + + gain26 + 0 + + + ant27 + + + + bw27 + 0 + + + center_freq27 + 0 + + + dc_offs_enb27 + "" + + + iq_imbal_enb27 + "" + + + norm_gain27 + False + + + gain27 + 0 + + + ant28 + + + + bw28 + 0 + + + center_freq28 + 0 + + + dc_offs_enb28 + "" + + + iq_imbal_enb28 + "" + + + norm_gain28 + False + + + gain28 + 0 + + + ant29 + + + + bw29 + 0 + + + center_freq29 + 0 + + + dc_offs_enb29 + "" + + + iq_imbal_enb29 + "" + + + norm_gain29 + False + + + gain29 + 0 + + + ant2 + + + + bw2 + 0 + + + center_freq2 + 0 + + + dc_offs_enb2 + "" + + + iq_imbal_enb2 + "" + + + norm_gain2 + False + + + gain2 + 0 + + + ant30 + + + + bw30 + 0 + + + center_freq30 + 0 + + + dc_offs_enb30 + "" + + + iq_imbal_enb30 + "" + + + norm_gain30 + False + + + gain30 + 0 + + + ant31 + + + + bw31 + 0 + + + center_freq31 + 0 + + + dc_offs_enb31 + "" + + + iq_imbal_enb31 + "" + + + norm_gain31 + False + + + gain31 + 0 + + + ant3 + + + + bw3 + 0 + + + center_freq3 + 0 + + + dc_offs_enb3 + "" + + + iq_imbal_enb3 + "" + + + norm_gain3 + False + + + gain3 + 0 + + + ant4 + + + + bw4 + 0 + + + center_freq4 + 0 + + + dc_offs_enb4 + "" + + + iq_imbal_enb4 + "" + + + norm_gain4 + False + + + gain4 + 0 + + + ant5 + + + + bw5 + 0 + + + center_freq5 + 0 + + + dc_offs_enb5 + "" + + + iq_imbal_enb5 + "" + + + norm_gain5 + False + + + gain5 + 0 + + + ant6 + + + + bw6 + 0 + + + center_freq6 + 0 + + + dc_offs_enb6 + "" + + + iq_imbal_enb6 + "" + + + norm_gain6 + False + + + gain6 + 0 + + + ant7 + + + + bw7 + 0 + + + center_freq7 + 0 + + + dc_offs_enb7 + "" + + + iq_imbal_enb7 + "" + + + norm_gain7 + False + + + gain7 + 0 + + + ant8 + + + + bw8 + 0 + + + center_freq8 + 0 + + + dc_offs_enb8 + "" + + + iq_imbal_enb8 + "" + + + norm_gain8 + False + + + gain8 + 0 + + + ant9 + + + + bw9 + 0 + + + center_freq9 + 0 + + + dc_offs_enb9 + "" + + + iq_imbal_enb9 + "" + + + norm_gain9 + False + + + gain9 + 0 + + + clock_rate + 0.0 + + + comment + + + + affinity + + + + dev_addr + "" + + + dev_args + "" + + + _enabled + 1 + + + _coordinate + (640, 342) + + + _rotation + 0 + + + id + uhd_usrp_source_0 + + + maxoutbuf + 0 + + + clock_source0 + + + + sd_spec0 + + + + time_source0 + + + + clock_source1 + + + + sd_spec1 + + + + time_source1 + + + + clock_source2 + + + + sd_spec2 + + + + time_source2 + + + + clock_source3 + + + + sd_spec3 + + + + time_source3 + + + + clock_source4 + + + + sd_spec4 + + + + time_source4 + + + + clock_source5 + + + + sd_spec5 + + + + time_source5 + + + + clock_source6 + + + + sd_spec6 + + + + time_source6 + + + + clock_source7 + + + + sd_spec7 + + + + time_source7 + + + + minoutbuf + 0 + + + nchan + 1 + + + num_mboards + 1 + + + type + fc32 + + + samp_rate + samp_rate + + + hide_cmd_port + False + + + stream_args + + + + stream_chans + [] + + + sync + + + + otw + + + + + analog_sig_source_x_0 + blocks_add_xx_0 + 0 + 1 + + + analog_sig_source_x_1 + blocks_add_xx_0 + 0 + 0 + + + analog_sig_source_x_2 + blocks_multiply_const_vxx_1 + 0 + 0 + + + blocks_add_xx_0 + blocks_multiply_const_vxx_1 + 0 + 0 + + + blocks_add_xx_1 + qtgui_freq_sink_x_0_0_0 + 0 + 0 + + + blocks_add_xx_1 + qtgui_time_sink_x_0 + 0 + 0 + + + blocks_add_xx_1 + qtgui_time_sink_x_1 + 0 + 0 + + + blocks_add_xx_1 + uhd_usrp_sink_0 + 0 + 0 + + + blocks_complex_to_real_0 + qtgui_time_sink_x_0_0 + 0 + 0 + + + blocks_file_source_0 + blocks_multiply_const_vxx_1 + 0 + 0 + + + blocks_file_source_0_0 + blocks_multiply_const_vxx_1 + 0 + 0 + + + blocks_message_burst_source_0 + blocks_null_sink_0_2 + 0 + 0 + + + blocks_multiply_const_vxx_0 + blocks_add_xx_1 + 0 + 1 + + + blocks_multiply_const_vxx_1 + blocks_multiply_const_vxx_2 + 0 + 0 + + + blocks_multiply_const_vxx_1 + dpd_clut_0 + 0 + 0 + + + blocks_multiply_const_vxx_1 + qtgui_time_sink_x_0 + 0 + 1 + + + blocks_multiply_const_vxx_2 + blocks_add_xx_1 + 0 + 0 + + + dpd_clut_0 + blocks_multiply_const_vxx_0 + 0 + 0 + + + uhd_amsg_source_0 + blocks_message_burst_source_0 + msg + msg + + + uhd_usrp_source_0 + blocks_complex_to_real_0 + 0 + 0 + + + uhd_usrp_source_0 + blocks_null_sink_0_2_0 + 0 + 0 + + + uhd_usrp_source_0 + qtgui_const_sink_x_0 + 0 + 0 + + + uhd_usrp_source_0 + qtgui_freq_sink_x_0_0 + 0 + 0 + + diff --git a/src/dab_util.py b/src/dab_util.py index 2ad2af6..aa2030f 100644 --- a/src/dab_util.py +++ b/src/dab_util.py @@ -25,7 +25,7 @@ def freq_to_fft_sample(freq, fft_size, sampling_rate): freq_ratio = 1.0 * fft_size / sampling_rate return int(freq * freq_ratio + fft_size / 2) -def crop_signal(signal, n_window = 1000, n_zeros = 1000, debug = False): +def crop_signal(signal, n_window = 1000, n_zeros = 120000, debug = False): #signal = signal[-10:-1] mag = abs(signal) window = np.ones(n_window) / float(n_window) @@ -38,5 +38,70 @@ def crop_signal(signal, n_window = 1000, n_zeros = 1000, debug = False): plt.plot(mag < thr) plt.plot((idx_start,idx_start), (0,0.1), color='g', linewidth=2) plt.plot((idx_end,idx_end), (0,0.1), color='r', linewidth=2) - signal = signal[idx_start - n_zeros: idx_end + n_zeros] + signal = signal[max(0,idx_start - n_zeros): min(idx_end + n_zeros, signal.shape[0] -1)] return signal + +def lagcorr(x,y,lag=None,verbose=False): + '''Compute lead-lag correlations between 2 time series. + + ,: 1-D time series. + : lag option, could take different forms of : + if 0 or None, compute ordinary correlation and p-value; + if positive integer, compute lagged correlation with lag + upto ; + if negative integer, compute lead correlation with lead + upto <-lag>; + if pass in an list or tuple or array of integers, compute + lead/lag correlations at different leads/lags. + + Note: when talking about lead/lag, uses as a reference. + Therefore positive lag means lags by , computation is + done by shifting to the left hand side by with respect to + . + Similarly negative lag means leads by , computation is + done by shifting to the right hand side by with respect to + . + + Return : a (n*2) array, with 1st column the correlation + coefficients, 2nd column correpsonding p values. + + Currently only works for 1-D arrays. + ''' + + import numpy + from scipy.stats import pearsonr + + if len(x)!=len(y): + raise Exception('Input variables of different lengths.') + + #--------Unify types of ------------- + if numpy.isscalar(lag): + if abs(lag)>=len(x): + raise Exception('Maximum lag equal or larger than array.') + if lag<0: + lag=-numpy.arange(abs(lag)+1) + elif lag==0: + lag=[0,] + else: + lag=numpy.arange(lag+1) + elif lag is None: + lag=[0,] + else: + lag=numpy.asarray(lag) + + #-------Loop over lags--------------------- + result=[] + if verbose: + print '\n#: Computing lagged-correlations at lags:',lag + + for ii in lag: + if ii<0: + result.append(pearsonr(x[:ii],y[-ii:])) + elif ii==0: + result.append(pearsonr(x,y)) + elif ii>0: + result.append(pearsonr(x[ii:],y[:-ii])) + + result=numpy.asarray(result) + + return result diff --git a/src/signal_gen.py b/src/signal_gen.py new file mode 100644 index 0000000..66306f3 --- /dev/null +++ b/src/signal_gen.py @@ -0,0 +1,68 @@ +import numpy as np +import matplotlib.pyplot as plt + +def gen_single_tone_with_silence(path = "./input.dat", n_periods=100, predist = None, par = None, debug = False): + period = 128 + length = period * n_periods * 3 + + t = np.arange(0,length / 3) + sig = np.zeros(length, dtype=np.complex64) + sig[length/3:length*2/3] = np.exp(t * 2j * np.pi * 1./period) + #sin1 = np.cos(t * np.pi * 1./period) + + if predist is None: + res = sig + else: + res = predist(sig, par) + + res = res / np.max(res) * 0.95 + + res = res.astype(np.complex64) + res.tofile(path) + + a_load = np.fromfile(path, dtype=np.complex64) + assert(np.isclose(a_load, res).all()), "Inconsistent stored file" + + if debug == True: + plt.plot(np.abs(np.concatenate((a_load, a_load)))) + plt.savefig(path + ".png") + plt.clf() + + plt.plot(np.abs(np.fft.fftshift(np.fft.fft(np.concatenate((a_load, a_load))))), 'ro') + plt.savefig(path + "_fft.png") + plt.clf() + + return path + +def gen_ramps(path = "./input.dat", n_periods=128, pause = 64, amplitudes = [1], predist = None, par = None, debug = False): + period = 128 + l_pause = period * pause + l_sig = period * n_periods + length = l_pause + l_sig + + t = np.arange(0, l_sig) + sig = np.zeros(length * len(amplitudes), dtype=np.complex64) + for i, amplitude in enumerate(amplitudes): + sig[length * i + l_pause : length * (i + 1)] = complex(amplitude) * np.exp(t * 2j * np.pi * 1./period) + + if predist is None: + res = sig + else: + res = predist(sig, par) + + res = res.astype(np.complex64) + res.tofile(path) + + a_load = np.fromfile(path, dtype=np.complex64) + assert(np.isclose(a_load, res).all()), "Inconsistent stored file" + + if debug == True: + plt.plot(np.abs(np.concatenate((a_load, a_load)))) + plt.savefig(path + ".png") + plt.clf() + + plt.plot(np.abs(np.fft.fftshift(np.fft.fft(np.concatenate((a_load, a_load))))), 'ro') + plt.savefig(path + "_fft.png") + plt.clf() + + return path diff --git a/sync-measurement.ipynb b/sync-measurement.ipynb index 5b713e7..0221c3c 100644 --- a/sync-measurement.ipynb +++ b/sync-measurement.ipynb @@ -8,8 +8,10 @@ "source": [ "%matplotlib inline\n", "import numpy as np\n", + "import time;\n", "from scipy import signal\n", "import matplotlib.pyplot as plt\n", + "import matplotlib.colors as mpcol\n", "import src.dab_util as du" ] }, @@ -30,7 +32,13 @@ "metadata": {}, "outputs": [], "source": [ - "sg.gen_ramps(amplitudes=np.linspace(0.001, 0.95, num = 20))" + "path_in = \"./input.dat\"\n", + "path_out = \"./output.dat\"\n", + "a_max = 0.95\n", + "n_steps = 64\n", + "amps = np.linspace(0.001, a_max, num = n_steps)\n", + "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)" ] }, { @@ -39,8 +47,7 @@ "metadata": {}, "outputs": [], "source": [ - "a_in = np.fromfile(\"./input.dat\", dtype=np.complex64)\n", - "a_out = np.fromfile(\"./output.dat\", dtype=np.complex64)" + "from grc.amam_amap import amam_amap" ] }, { @@ -49,21 +56,7 @@ "metadata": {}, "outputs": [], "source": [ - "def crop_signal(signal, n_window = 1000, n_zeros = 50000, debug = False):\n", - " #signal = signal[-10:-1]\n", - " mag = abs(signal)\n", - " window = np.ones(n_window) / float(n_window)\n", - " mag = scipy.signal.convolve(window, mag)\n", - " mag = scipy.signal.convolve(window, mag)\n", - " thr = 0.01 * np.max(mag)\n", - " idx_start = np.argmax(mag > thr)\n", - " idx_end = mag.shape[0] - np.argmax(np.flipud(mag > thr))\n", - " if debug:\n", - " plt.plot(mag < thr)\n", - " plt.plot((idx_start,idx_start), (0,0.1), color='g', linewidth=2)\n", - " plt.plot((idx_end,idx_end), (0,0.1), color='r', linewidth=2)\n", - " signal = signal[idx_start - n_zeros: idx_end + n_zeros]\n", - " return signal" + "top = amam_amap()\n" ] }, { @@ -72,7 +65,7 @@ "metadata": {}, "outputs": [], "source": [ - "a_in = du.crop_signal(a_in)" + "sg.gen_ramps(amplitudes=amps)" ] }, { @@ -81,7 +74,31 @@ "metadata": {}, "outputs": [], "source": [ - "a_out = du.crop_signal(a_out)" + "def fftlag(signal_original, signal_rec):\n", + " \"\"\"\n", + " Efficient way to find lag between two signals\n", + " Args:\n", + " signal_original: The signal that has been sent\n", + " signal_rec: The signal that has been recored\n", + " \"\"\"\n", + " c = np.flipud(signal.fftconvolve(signal_original,np.flipud(signal_rec)))\n", + " #plt.plot(c)\n", + " return np.argmax(c) - signal_original.shape[0] + 1\n", + " \n", + "#pattern = np.array([-2,2,-1,+3,-5,+7])\n", + "#delays = [0,1,2,3,4]\n", + "#padding = [0]\n", + "#padding_fil = [0]\n", + "#\n", + "#res = []\n", + "#for d in delays:\n", + "# for p in padding:\n", + "# for p2 in padding_fil:\n", + "# a = np.concatenate((pattern, np.zeros(p2)))\n", + "# b = np.concatenate((np.zeros(d), pattern, np.zeros(p)))\n", + "# res.append((d,conv(a,b)))\n", + "#res = np.array(res)\n", + "#plt.plot(zip(*res)[0], zip(*res)[1], 'p')" ] }, { @@ -91,18 +108,6 @@ "outputs": [], "source": [] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "#plt.plot(a_in.real[780000 + 230000:2000000]+1, color='b');\n", - "#plt.plot(a_out.real[780000:2000000], color='g');\n", - "plt.plot(a_in.real+1, color='b');\n", - "plt.plot(a_out.real, color='g');" - ] - }, { "cell_type": "code", "execution_count": null, @@ -116,70 +121,15 @@ "metadata": {}, "outputs": [], "source": [ - "def lagcorr(x,y,lag=None,verbose=True):\n", - " '''Compute lead-lag correlations between 2 time series.\n", - "\n", - " ,: 1-D time series.\n", - " : lag option, could take different forms of :\n", - " if 0 or None, compute ordinary correlation and p-value;\n", - " if positive integer, compute lagged correlation with lag\n", - " upto ;\n", - " if negative integer, compute lead correlation with lead\n", - " upto <-lag>;\n", - " if pass in an list or tuple or array of integers, compute \n", - " lead/lag correlations at different leads/lags.\n", - "\n", - " Note: when talking about lead/lag, uses as a reference.\n", - " Therefore positive lag means lags by , computation is\n", - " done by shifting to the left hand side by with respect to\n", - " .\n", - " Similarly negative lag means leads by , computation is\n", - " done by shifting to the right hand side by with respect to\n", - " .\n", - "\n", - " Return : a (n*2) array, with 1st column the correlation \n", - " coefficients, 2nd column correpsonding p values.\n", - "\n", - " Currently only works for 1-D arrays.\n", - " '''\n", - "\n", - " import numpy\n", - " from scipy.stats import pearsonr\n", - "\n", - " if len(x)!=len(y):\n", - " raise Exception('Input variables of different lengths.')\n", - "\n", - " #--------Unify types of -------------\n", - " if numpy.isscalar(lag):\n", - " if abs(lag)>=len(x):\n", - " raise Exception('Maximum lag equal or larger than array.')\n", - " if lag<0:\n", - " lag=-numpy.arange(abs(lag)+1)\n", - " elif lag==0:\n", - " lag=[0,]\n", - " else:\n", - " lag=numpy.arange(lag+1) \n", - " elif lag is None:\n", - " lag=[0,]\n", - " else:\n", - " lag=numpy.asarray(lag)\n", - "\n", - " #-------Loop over lags---------------------\n", - " result=[]\n", - " if verbose:\n", - " print '\\n#: Computing lagged-correlations at lags:',lag\n", - "\n", - " for ii in lag:\n", - " if ii<0:\n", - " result.append(pearsonr(x[:ii],y[-ii:]))\n", - " elif ii==0:\n", - " result.append(pearsonr(x,y))\n", - " elif ii>0:\n", - " result.append(pearsonr(x[ii:],y[:-ii]))\n", - "\n", - " result=numpy.asarray(result)\n", + "def get_amp_ratio(ampl_1, ampl_2, a_out_abs, a_in_abs):\n", + " idxs = (a_in_abs > ampl_1) & (a_in_abs < ampl_2)\n", + " ratio = a_out_abs[idxs] / a_in_abs[idxs]\n", + " return ratio.mean(), ratio.var()\n", "\n", - " return result" + "def get_phase(ampl_1, ampl_2, a_out, a_in):\n", + " idxs = (np.abs(a_in) > ampl_1) & (np.abs(a_in) < ampl_2)\n", + " ratio = np.angle(a_out[idxs], deg=True) - np.angle(a_in[idxs], deg=True)\n", + " return ratio.mean(), ratio.var()" ] }, { @@ -188,11 +138,52 @@ "metadata": {}, "outputs": [], "source": [ - "l = min(a_out.shape[0], a_in.shape[0])\n", - "a_out = a_out[0:l]\n", - "a_in = a_in[0:l]\n", - "\n", - "c = lagcorr(abs(a_out), abs(a_in), 1000)[:,0]" + "def extract_measurement(a_in, a_out, db, a_max, n_steps, debug = False):\n", + " a_in = du.crop_signal(a_in)\n", + " a_out = du.crop_signal(a_out)\n", + " \n", + " if debug:\n", + " plt.plot(np.abs(a_in.real) + 1, color='b');\n", + " plt.plot(np.abs(a_out.real), color='g');\n", + " plt.show()\n", + " \n", + " #l = min(a_out.shape[0], a_in.shape[0])\n", + " #a_out = a_out[0:l]\n", + " #a_in = a_in[0:l]\n", + " \n", + " #c = du.lagcorr(np.abs(a_out), np.abs(a_in), 120000)[:,0]\n", + " #c = signal.fftconvolve(a_in, a_out) - a_out.shape[0]\n", + " delay = fftlag(np.abs(a_in), np.abs(a_out))\n", + " \n", + " \n", + " #delay = np.argmax(c)\n", + " a_out = a_out[delay - 1:]\n", + " \n", + " l = min(a_out.shape[0], a_in.shape[0])\n", + " a_out = a_out[0:l]\n", + " a_in = a_in[0:l]\n", + " \n", + " if debug:\n", + " print (\"delay = \" + str(delay))\n", + " plt.plot(np.abs(a_in), color='g');\n", + " plt.plot(np.abs(a_out) - 0.5, color='y');\n", + " plt.show()\n", + " \n", + " bins = np.linspace(+0.5/n_steps,a_max + 0.5/n_steps,num=n_steps)\n", + " res = []\n", + " a_out_abs = np.abs(a_out)\n", + " a_in_abs = np.abs(a_in)\n", + " for ampl_1, ampl_2 in zip(bins, bins[1:]):\n", + " res.append(get_amp_ratio(ampl_1, ampl_2, a_out_abs, a_in_abs))\n", + " del a_out_abs\n", + " del a_in_abs\n", + " mean_amp, var_amp = zip(*res)\n", + " \n", + " res = []\n", + " for ampl_1, ampl_2 in zip(bins, bins[1:]):\n", + " res.append(get_phase(ampl_1, ampl_2, a_out, a_in))\n", + " mean_phase, var_phase = zip(*res)\n", + " return mean_amp, var_amp, mean_phase, var_phase, db" ] }, { @@ -208,48 +199,40 @@ "metadata": {}, "outputs": [], "source": [ - "#def corr(a_out, a_in):\n", - "# import scipy\n", - "# corr = np.correlate(\n", - "# a_out,\n", - "# a_in,\n", - "# 'full')\n", - "# delay = np.argmax(corr) - a_in.shape[0] + 1\n", - "# #plt.plot(range(-corr.shape[0]/2, corr.shape[0]/2),corr)\n", - "# return delay" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "#delay = corr(a_out, a_in)\n", - "delay = np.argmax(c)\n", - "a_out = a_out[delay - 1:]\n", - "delay" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "l = min(a_out.shape[0], a_in.shape[0])\n", - "a_out = a_out[0:l]\n", - "a_in = a_in[0:l]" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "plt.plot(a_in, color='g');\n", - "plt.plot(a_out - 1, color='y');" + "res = []\n", + "\n", + "for txgain, rxgain in zip(txgains, rxgains):\n", + " print (txgain, rxgain)\n", + " res_tmp = None\n", + " for i in range(10):\n", + " top.uhd_usrp_sink_0_0.set_gain(txgain)\n", + " top.uhd_usrp_source_0.set_gain(rxgain)\n", + " \n", + " top.file_sink_out.close()\n", + " top.blocks_file_source_0.close()\n", + " \n", + " top.file_sink_out.open(path_out)\n", + " top.blocks_file_source_0.open(path_in, False)\n", + " top.start()\n", + " \n", + " time.sleep(1)\n", + " \n", + " top.stop()\n", + " top.wait()\n", + " \n", + " a_in = np.fromfile(path_in, dtype=np.complex64)\n", + " a_out = np.fromfile(path_out, dtype=np.complex64)\n", + " res_tmp = extract_measurement(a_in, a_out, txgain, a_max, n_steps, debug=True)\n", + " \n", + " def is_finite(r): return np.all([np.all(np.isfinite(c)) for c in r])\n", + " def has_small_jumps(mean_amp): return np.max(np.abs(np.diff(mean_amp))) / np.median(np.abs(np.diff(mean_amp))) < 100\n", + " \n", + " if is_finite(res_tmp) and has_small_jumps(res_tmp[0]):\n", + " break\n", + " else:\n", + " print (is_finite(res_tmp), has_small_jumps(res_tmp[0]))\n", + " \n", + " res.append(res_tmp)" ] }, { @@ -257,12 +240,7 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [ - "def get_amp_ratio(ampl_1, ampl_2):\n", - " idxs = (a_in > ampl_1) & (a_in < ampl_2)\n", - " ratio = (a_out[idxs] / a_in[idxs])\n", - " return ratio.mean(), ratio.var()" - ] + "source": [] }, { "cell_type": "code", @@ -270,10 +248,49 @@ "metadata": {}, "outputs": [], "source": [ - "def get_phase(ampl_1, ampl_2):\n", - " idxs = (a_in > ampl_1) & (a_in < ampl_2)\n", - " ratio = np.angle(a_out[idxs]) - np.angle(a_in[idxs])\n", - " return ratio.mean(), ratio.var()" + "fig = plt.figure(figsize=(10,10))\n", + "ax1 = plt.subplot(211)\n", + "\n", + "def plot_with_label(x, y, color, label):\n", + " ax1.plot(x, y, color=color, label=txgain)\n", + " \n", + "for idx, (txgain, rxgain) in enumerate(zip(*(txgains, rxgains))):\n", + " plot_with_label(\n", + " x = amps[1:], \n", + " y = 10*np.log(res[idx][0])/np.log(10) - rxgain + 102,\n", + " color = mpcol.hsv_to_rgb((idx * 0.75 / len(txgains), 0.6, 1)),\n", + " label = txgain\n", + " )\n", + "ax1.set_ylabel(\"Gain [dB]\")\n", + "\n", + "ax2 = plt.subplot(212)\n", + "\n", + "def plot_with_label(x, y, color, label):\n", + " ax2.plot(x, y, color=color, label=txgain)\n", + " \n", + "for idx, (txgain, rxgain) in enumerate(zip(*(txgains, rxgains))):\n", + " plot_with_label(\n", + " x = amps[1:],\n", + " y = res[idx][2],\n", + " color = mpcol.hsv_to_rgb((idx * 0.75 / len(txgains), 0.6, 1)),\n", + " label = txgain\n", + " )\n", + "\n", + "ax2.set_ylabel(\"Pase [degree]\")\n", + "ax2.set_xlabel(\"Amplitude\")\n", + "\n", + "#legend\n", + "# Shrink current axis by 20%\n", + "box = ax1.get_position()\n", + "ax1.set_position([box.x0, box.y0, box.width * 0.8, box.height])\n", + "box = ax2.get_position()\n", + "ax2.set_position([box.x0, box.y0, box.width * 0.8, box.height])\n", + "\n", + "# Put a legend to the right of the current axis\n", + "ax1.legend(loc='center left', bbox_to_anchor=(1.05, -0.3))\n", + "\n", + "\n", + "plt.show()" ] }, { @@ -281,44 +298,28 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [ - "bins = np.linspace(0.1,1,num=10)\n", - "res = []\n", - "for ampl_1, ampl_2 in zip(bins, bins[1:]):\n", - " res.append(get_amp_ratio(ampl_1, ampl_2))\n", - "mean, var = zip(*res)" - ] + "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], - "source": [ - "plt.plot(mean)" - ] + "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], - "source": [ - "bins = np.linspace(0.1,1,num=10)\n", - "res = []\n", - "for ampl_1, ampl_2 in zip(bins, bins[1:]):\n", - " res.append(get_phase(ampl_1, ampl_2))\n", - "mean, var = zip(*res)" - ] + "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], - "source": [ - "plt.plot(mean)" - ] + "source": [] }, { "cell_type": "code", diff --git a/sync-measurement.py b/sync-measurement.py new file mode 100644 index 0000000..8cf97fd --- /dev/null +++ b/sync-measurement.py @@ -0,0 +1,273 @@ + +# coding: utf-8 + +# In[1]: + +get_ipython().magic('matplotlib inline') +import numpy as np +import time; +from scipy import signal +import matplotlib.pyplot as plt +import matplotlib.colors as mpcol +import src.dab_util as du + + +# In[2]: + +import src.signal_gen as sg +reload(sg) +reload(du) + + +# In[3]: + +path_in = "./input.dat" +path_out = "./output.dat" +a_max = 0.95 +n_steps = 64 +amps = np.linspace(0.001, a_max, num = n_steps) +txgains = (50, 55, 60, 65, 70, 75, 81, 82, 83, 84, 85, 86, 87, 88, 89) +rxgains = (50, 40, 40, 25, 25, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20) + + +# In[4]: + +from grc.amam_amap import amam_amap + + +# In[5]: + +top = amam_amap() + + +# In[6]: + +sg.gen_ramps(amplitudes=amps) + + +# In[7]: + +def fftlag(signal_original, signal_rec): + """ + Efficient way to find lag between two signals + Args: + signal_original: The signal that has been sent + signal_rec: The signal that has been recored + """ + c = np.flipud(signal.fftconvolve(signal_original,np.flipud(signal_rec))) + #plt.plot(c) + return np.argmax(c) - signal_original.shape[0] + 1 + +#pattern = np.array([-2,2,-1,+3,-5,+7]) +#delays = [0,1,2,3,4] +#padding = [0] +#padding_fil = [0] +# +#res = [] +#for d in delays: +# for p in padding: +# for p2 in padding_fil: +# a = np.concatenate((pattern, np.zeros(p2))) +# b = np.concatenate((np.zeros(d), pattern, np.zeros(p))) +# res.append((d,conv(a,b))) +#res = np.array(res) +#plt.plot(zip(*res)[0], zip(*res)[1], 'p') + + +# In[ ]: + + + + +# In[ ]: + + + + +# In[8]: + +def get_amp_ratio(ampl_1, ampl_2, a_out_abs, a_in_abs): + idxs = (a_in_abs > ampl_1) & (a_in_abs < ampl_2) + ratio = a_out_abs[idxs] / a_in_abs[idxs] + return ratio.mean(), ratio.var() + +def get_phase(ampl_1, ampl_2, a_out, a_in): + idxs = (np.abs(a_in) > ampl_1) & (np.abs(a_in) < ampl_2) + ratio = np.angle(a_out[idxs], deg=True) - np.angle(a_in[idxs], deg=True) + return ratio.mean(), ratio.var() + + +# In[9]: + +def extract_measurement(a_in, a_out, db, a_max, n_steps, debug = False): + a_in = du.crop_signal(a_in) + a_out = du.crop_signal(a_out) + + if debug: + plt.plot(np.abs(a_in.real) + 1, color='b'); + plt.plot(np.abs(a_out.real), color='g'); + plt.show() + + #l = min(a_out.shape[0], a_in.shape[0]) + #a_out = a_out[0:l] + #a_in = a_in[0:l] + + #c = du.lagcorr(np.abs(a_out), np.abs(a_in), 120000)[:,0] + #c = signal.fftconvolve(a_in, a_out) - a_out.shape[0] + delay = fftlag(np.abs(a_in), np.abs(a_out)) + + + #delay = np.argmax(c) + a_out = a_out[delay - 1:] + + l = min(a_out.shape[0], a_in.shape[0]) + a_out = a_out[0:l] + a_in = a_in[0:l] + + if debug: + print ("delay = " + str(delay)) + plt.plot(np.abs(a_in), color='g'); + plt.plot(np.abs(a_out) - 0.5, color='y'); + plt.show() + + bins = np.linspace(+0.5/n_steps,a_max + 0.5/n_steps,num=n_steps) + res = [] + a_out_abs = np.abs(a_out) + a_in_abs = np.abs(a_in) + for ampl_1, ampl_2 in zip(bins, bins[1:]): + res.append(get_amp_ratio(ampl_1, ampl_2, a_out_abs, a_in_abs)) + del a_out_abs + del a_in_abs + mean_amp, var_amp = zip(*res) + + res = [] + for ampl_1, ampl_2 in zip(bins, bins[1:]): + res.append(get_phase(ampl_1, ampl_2, a_out, a_in)) + mean_phase, var_phase = zip(*res) + return mean_amp, var_amp, mean_phase, var_phase, db + + +# In[ ]: + + + + +# In[10]: + +res = [] + +for txgain, rxgain in zip(txgains, rxgains): + print (txgain, rxgain) + res_tmp = None + for i in range(10): + top.uhd_usrp_sink_0_0.set_gain(txgain) + top.uhd_usrp_source_0.set_gain(rxgain) + + top.file_sink_out.close() + top.blocks_file_source_0.close() + + top.file_sink_out.open(path_out) + top.blocks_file_source_0.open(path_in, False) + top.start() + + time.sleep(1) + + top.stop() + top.wait() + + a_in = np.fromfile(path_in, dtype=np.complex64) + a_out = np.fromfile(path_out, dtype=np.complex64) + res_tmp = extract_measurement(a_in, a_out, txgain, a_max, n_steps, debug=True) + + def is_finite(r): return np.all([np.all(np.isfinite(c)) for c in r]) + def has_small_jumps(mean_amp): return np.max(np.abs(np.diff(mean_amp))) / np.median(np.abs(np.diff(mean_amp))) < 100 + + if is_finite(res_tmp) and has_small_jumps(res_tmp[0]): + break + else: + print (is_finite(res_tmp), has_small_jumps(res_tmp[0])) + + res.append(res_tmp) + + +# In[ ]: + + + + +# In[47]: + +fig = plt.figure(figsize=(10,10)) +ax1 = plt.subplot(211) + +def plot_with_label(x, y, color, label): + ax1.plot(x, y, color=color, label=txgain) + +for idx, (txgain, rxgain) in enumerate(zip(*(txgains, rxgains))): + plot_with_label( + x = amps[1:], + y = 10*np.log(res[idx][0])/np.log(10) - rxgain + 102, + color = mpcol.hsv_to_rgb((idx * 0.75 / len(txgains), 0.6, 1)), + label = txgain + ) +ax1.set_ylabel("Gain [dB]") + +ax2 = plt.subplot(212) + +def plot_with_label(x, y, color, label): + ax2.plot(x, y, color=color, label=txgain) + +for idx, (txgain, rxgain) in enumerate(zip(*(txgains, rxgains))): + plot_with_label( + x = amps[1:], + y = res[idx][2], + color = mpcol.hsv_to_rgb((idx * 0.75 / len(txgains), 0.6, 1)), + label = txgain + ) + +ax2.set_ylabel("Pase [degree]") +ax2.set_xlabel("Amplitude") + +#legend +# Shrink current axis by 20% +box = ax1.get_position() +ax1.set_position([box.x0, box.y0, box.width * 0.8, box.height]) +box = ax2.get_position() +ax2.set_position([box.x0, box.y0, box.width * 0.8, box.height]) + +# Put a legend to the right of the current axis +ax1.legend(loc='center left', bbox_to_anchor=(1.05, -0.3)) + + +plt.show() + + +# In[ ]: + + + + +# In[ ]: + + + + +# In[205]: + + + + +# In[ ]: + + + + +# In[ ]: + + + + +# In[ ]: + + + -- cgit v1.2.3