aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt12
-rw-r--r--cmake/Modules/GrMiscUtils.cmake10
-rw-r--r--cmake/Modules/GrPython.cmake164
-rw-r--r--cmake/Modules/GrSwig.cmake13
-rw-r--r--cmake/Modules/UseSWIG.cmake2
-rw-r--r--docs/doxygen/doxyxml/__init__.py3
-rw-r--r--docs/doxygen/doxyxml/base.py19
-rw-r--r--docs/doxygen/doxyxml/doxyindex.py7
-rw-r--r--docs/doxygen/doxyxml/generated/__init__.py1
-rw-r--r--docs/doxygen/doxyxml/generated/compound.py9
-rw-r--r--docs/doxygen/doxyxml/generated/compoundsuper.py39
-rw-r--r--docs/doxygen/doxyxml/generated/index.py5
-rw-r--r--docs/doxygen/doxyxml/generated/indexsuper.py21
-rw-r--r--docs/doxygen/doxyxml/text.py3
-rw-r--r--[-rwxr-xr-x]docs/doxygen/other/doxypy.py717
-rw-r--r--docs/doxygen/swig_doc.py9
-rw-r--r--[-rwxr-xr-x]docs/exploring-gnuradio/dial_tone.py3
-rw-r--r--[-rwxr-xr-x]docs/exploring-gnuradio/fm_demod.py6
-rw-r--r--docs/sphinx/gnuradio_sphinx.py1
-rw-r--r--docs/sphinx/hieroglyph/__init__.py3
-rw-r--r--docs/sphinx/hieroglyph/errors.py3
-rw-r--r--docs/sphinx/hieroglyph/hieroglyph.py6
-rw-r--r--docs/sphinx/hieroglyph/nodes.py1
-rw-r--r--docs/sphinx/hieroglyph/test/__init__.py1
-rw-r--r--docs/sphinx/hieroglyph/test/test_comments.py1
-rw-r--r--docs/sphinx/hieroglyph/test/test_hierglyph.py1
-rw-r--r--docs/sphinx/hieroglyph/test/test_nodes.py1
-rw-r--r--docs/sphinx/hieroglyph/version.py1
-rw-r--r--gnuradio-runtime/apps/evaluation_random_numbers.py23
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/examples/mp-sched/affinity_set.py6
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/examples/mp-sched/plot_flops.py1
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/examples/mp-sched/run_synthetic.py4
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/examples/mp-sched/synthetic.py31
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/examples/mp-sched/wfm_rcv_pll_to_wav.py8
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/examples/network/audio_sink.py1
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/examples/network/audio_source.py1
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/examples/network/dial_tone_sink.py1
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/examples/network/dial_tone_source.py1
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/examples/network/vector_sink.py1
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/examples/network/vector_source.py1
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/examples/volk_benchmark/volk_math.py12
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/examples/volk_benchmark/volk_plot.py8
-rw-r--r--gnuradio-runtime/examples/volk_benchmark/volk_test_funcs.py14
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/examples/volk_benchmark/volk_types.py12
-rw-r--r--gnuradio-runtime/include/gnuradio/sptr_magic.h2
-rw-r--r--gnuradio-runtime/lib/CMakeLists.txt6
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/lib/math/gen_sine_table.py6
-rw-r--r--gnuradio-runtime/lib/pmt/CMakeLists.txt2
-rw-r--r--gnuradio-runtime/lib/pmt/gen-serial-tags.py5
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/lib/pmt/generate_unv.py3
-rw-r--r--gnuradio-runtime/lib/sptr_magic.cc2
-rw-r--r--gnuradio-runtime/python/build_utils.py9
-rw-r--r--gnuradio-runtime/python/build_utils_codes.py1
-rw-r--r--gnuradio-runtime/python/gnuradio/__init__.py1
-rw-r--r--gnuradio-runtime/python/gnuradio/ctrlport/GNURadioControlPortClient.py8
-rw-r--r--gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py23
-rw-r--r--gnuradio-runtime/python/gnuradio/ctrlport/RPCConnection.py1
-rw-r--r--gnuradio-runtime/python/gnuradio/ctrlport/RPCConnectionThrift.py17
-rw-r--r--gnuradio-runtime/python/gnuradio/ctrlport/__init__.py4
-rw-r--r--gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx16
-rw-r--r--gnuradio-runtime/python/gnuradio/ctrlport/monitor.py21
-rw-r--r--gnuradio-runtime/python/gnuradio/eng_arg.py1
-rw-r--r--gnuradio-runtime/python/gnuradio/eng_notation.py3
-rw-r--r--gnuradio-runtime/python/gnuradio/eng_option.py4
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt3
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/__init__.py18
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/exceptions.py1
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/gateway.py21
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/gr_threading.py6
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/gr_threading_23.py26
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/gr_threading_24.py26
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/hier_block2.py3
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/packet_utils.py13
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/pubsub.py89
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/python/gnuradio/gr/qa_feval.py1
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/python/gnuradio/gr/qa_flowgraph.py1
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/qa_hier_block2.py8
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/python/gnuradio/gr/qa_kludged_imports.py1
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/qa_random.py1
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/python/gnuradio/gr/qa_tag_utils.py10
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/tag_utils.py17
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/top_block.py15
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/python/gnuradio/gr_unittest.py61
-rw-r--r--gnuradio-runtime/python/gnuradio/gr_xmlrunner.py86
-rw-r--r--gnuradio-runtime/python/gnuradio/gru/__init__.py22
-rw-r--r--gnuradio-runtime/python/gnuradio/gru/daemon.py46
-rw-r--r--gnuradio-runtime/python/gnuradio/gru/freqz.py32
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/python/gnuradio/gru/gnuplot_freqz.py8
-rw-r--r--gnuradio-runtime/python/gnuradio/gru/hexint.py1
-rw-r--r--gnuradio-runtime/python/gnuradio/gru/listmisc.py1
-rw-r--r--gnuradio-runtime/python/gnuradio/gru/mathmisc.py4
-rw-r--r--gnuradio-runtime/python/gnuradio/gru/msgq_runner.py3
-rw-r--r--gnuradio-runtime/python/gnuradio/gru/os_read_exactly.py1
-rw-r--r--gnuradio-runtime/python/gnuradio/gru/seq_with_cursor.py13
-rw-r--r--gnuradio-runtime/python/gnuradio/gru/socket_stuff.py5
-rw-r--r--gnuradio-runtime/python/pmt/CMakeLists.txt2
-rw-r--r--gnuradio-runtime/python/pmt/__init__.py11
-rw-r--r--gnuradio-runtime/python/pmt/pmt_to_python.py29
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/python/pmt/qa_pmt.py4
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/python/pmt/qa_pmt_to_python.py7
-rw-r--r--gnuradio-runtime/swig/CMakeLists.txt1
-rw-r--r--gnuradio-runtime/swig/basic_block.i6
-rw-r--r--gnuradio-runtime/swig/gnuradio.i11
-rw-r--r--gnuradio-runtime/swig/pmt_swig.i6
-rw-r--r--gnuradio-runtime/swig/py3compat.i7
-rw-r--r--[-rwxr-xr-x]gr-analog/examples/fmtest.py37
-rw-r--r--[-rwxr-xr-x]gr-analog/examples/tags/uhd_burst_detector.py1
-rw-r--r--gr-analog/grc/CMakeLists.txt4
-rw-r--r--gr-analog/grc/analog.tree.yml39
-rw-r--r--gr-analog/grc/analog_agc2_xx.block.yml53
-rw-r--r--gr-analog/grc/analog_agc2_xx.xml71
-rw-r--r--gr-analog/grc/analog_agc3_xx.block.yml57
-rw-r--r--gr-analog/grc/analog_agc3_xx.xml77
-rw-r--r--gr-analog/grc/analog_agc_xx.block.yml48
-rw-r--r--gr-analog/grc/analog_agc_xx.xml64
-rw-r--r--gr-analog/grc/analog_am_demod_cf.block.yml33
-rw-r--r--gr-analog/grc/analog_am_demod_cf.xml47
-rw-r--r--gr-analog/grc/analog_block_tree.xml81
-rw-r--r--gr-analog/grc/analog_const_source_x.block.yml28
-rw-r--r--gr-analog/grc/analog_const_source_x.xml52
-rw-r--r--gr-analog/grc/analog_cpfsk_bc.block.yml31
-rw-r--r--gr-analog/grc/analog_cpfsk_bc.xml38
-rw-r--r--gr-analog/grc/analog_ctcss_squelch_ff.block.yml45
-rw-r--r--gr-analog/grc/analog_ctcss_squelch_ff.xml80
-rw-r--r--gr-analog/grc/analog_dpll_bb.block.yml26
-rw-r--r--gr-analog/grc/analog_dpll_bb.xml31
-rw-r--r--gr-analog/grc/analog_fastnoise_source_x.block.yml45
-rw-r--r--gr-analog/grc/analog_fastnoise_source_x.xml86
-rw-r--r--gr-analog/grc/analog_feedforward_agc_cc.block.yml26
-rw-r--r--gr-analog/grc/analog_feedforward_agc_cc.xml32
-rw-r--r--gr-analog/grc/analog_fm_deemph.block.yml25
-rw-r--r--gr-analog/grc/analog_fm_deemph.xml31
-rw-r--r--gr-analog/grc/analog_fm_demod_cf.block.yml46
-rw-r--r--gr-analog/grc/analog_fm_demod_cf.xml68
-rw-r--r--gr-analog/grc/analog_fm_preemph.block.yml29
-rw-r--r--gr-analog/grc/analog_fm_preemph.xml37
-rw-r--r--gr-analog/grc/analog_fmdet_cf.block.yml31
-rw-r--r--gr-analog/grc/analog_fmdet_cf.xml45
-rw-r--r--gr-analog/grc/analog_frequency_modulator_fc.block.yml23
-rw-r--r--gr-analog/grc/analog_frequency_modulator_fc.xml26
-rw-r--r--gr-analog/grc/analog_nbfm_rx.block.yml38
-rw-r--r--gr-analog/grc/analog_nbfm_rx.xml56
-rw-r--r--gr-analog/grc/analog_nbfm_tx.block.yml42
-rw-r--r--gr-analog/grc/analog_nbfm_tx.xml64
-rw-r--r--gr-analog/grc/analog_noise_source_x.block.yml38
-rw-r--r--gr-analog/grc/analog_noise_source_x.xml77
-rw-r--r--gr-analog/grc/analog_phase_modulator_fc.block.yml23
-rw-r--r--gr-analog/grc/analog_phase_modulator_fc.xml26
-rw-r--r--gr-analog/grc/analog_pll_carriertracking_cc.block.yml31
-rw-r--r--gr-analog/grc/analog_pll_carriertracking_cc.xml38
-rw-r--r--gr-analog/grc/analog_pll_freqdet_cf.block.yml31
-rw-r--r--gr-analog/grc/analog_pll_freqdet_cf.xml38
-rw-r--r--gr-analog/grc/analog_pll_refout_cc.block.yml31
-rw-r--r--gr-analog/grc/analog_pll_refout_cc.xml38
-rw-r--r--gr-analog/grc/analog_probe_avg_mag_sqrd_x.block.yml47
-rw-r--r--gr-analog/grc/analog_probe_avg_mag_sqrd_x.xml68
-rw-r--r--gr-analog/grc/analog_pwr_squelch_xx.block.yml44
-rw-r--r--gr-analog/grc/analog_pwr_squelch_xx.xml67
-rw-r--r--gr-analog/grc/analog_quadrature_demod_cf.block.yml47
-rw-r--r--gr-analog/grc/analog_quadrature_demod_cf.xml55
-rw-r--r--gr-analog/grc/analog_rail_ff.block.yml27
-rw-r--r--gr-analog/grc/analog_rail_ff.xml54
-rw-r--r--gr-analog/grc/analog_random_source_x.block.yml47
-rw-r--r--gr-analog/grc/analog_random_source_x.xml75
-rw-r--r--gr-analog/grc/analog_random_uniform_source_x.block.yml32
-rw-r--r--gr-analog/grc/analog_random_uniform_source_x.xml55
-rw-r--r--gr-analog/grc/analog_sig_source_x.block.yml57
-rw-r--r--gr-analog/grc/analog_sig_source_x.xml109
-rw-r--r--gr-analog/grc/analog_simple_squelch_cc.block.yml27
-rw-r--r--gr-analog/grc/analog_simple_squelch_cc.xml32
-rw-r--r--gr-analog/grc/analog_standard_squelch.block.yml28
-rw-r--r--gr-analog/grc/analog_standard_squelch.xml32
-rw-r--r--gr-analog/grc/analog_wfm_rcv.block.yml25
-rw-r--r--gr-analog/grc/analog_wfm_rcv.xml33
-rw-r--r--gr-analog/grc/analog_wfm_rcv_pll.block.yml29
-rw-r--r--gr-analog/grc/analog_wfm_rcv_pll.xml37
-rw-r--r--gr-analog/grc/analog_wfm_tx.block.yml40
-rw-r--r--gr-analog/grc/analog_wfm_tx.xml55
-rw-r--r--gr-analog/python/analog/CMakeLists.txt2
-rw-r--r--gr-analog/python/analog/__init__.py26
-rw-r--r--gr-analog/python/analog/am_demod.py27
-rw-r--r--gr-analog/python/analog/fm_demod.py13
-rw-r--r--gr-analog/python/analog/fm_emph.py73
-rw-r--r--gr-analog/python/analog/nbfm_rx.py30
-rw-r--r--gr-analog/python/analog/nbfm_tx.py34
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_agc.py47
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_cpfsk.py3
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_ctcss_squelch.py6
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_dpll.py4
-rw-r--r--gr-analog/python/analog/qa_fastnoise.py1
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_fmdet.py1
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_frequency_modulator.py8
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_noise.py1
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_phase_modulator.py6
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_pll_carriertracking.py4
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_pll_freqdet.py6
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_pll_refout.py4
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_probe_avg_mag_sqrd.py1
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_pwr_squelch.py6
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_quadrature_demod.py8
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_rail_ff.py3
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_random_uniform_source.py1
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_sig_source.py2
-rw-r--r--[-rwxr-xr-x]gr-analog/python/analog/qa_simple_squelch.py4
-rw-r--r--gr-analog/python/analog/standard_squelch.py20
-rw-r--r--gr-analog/python/analog/wfm_rcv.py25
-rw-r--r--gr-analog/python/analog/wfm_rcv_fmdet.py55
-rw-r--r--gr-analog/python/analog/wfm_rcv_pll.py47
-rw-r--r--gr-analog/python/analog/wfm_tx.py26
-rw-r--r--[-rwxr-xr-x]gr-audio/examples/python/audio_copy.py1
-rw-r--r--[-rwxr-xr-x]gr-audio/examples/python/audio_play.py1
-rw-r--r--[-rwxr-xr-x]gr-audio/examples/python/audio_to_file.py1
-rw-r--r--[-rwxr-xr-x]gr-audio/examples/python/dial_tone.py1
-rw-r--r--[-rwxr-xr-x]gr-audio/examples/python/dial_tone_daemon.py4
-rw-r--r--[-rwxr-xr-x]gr-audio/examples/python/dial_tone_wav.py1
-rw-r--r--[-rwxr-xr-x]gr-audio/examples/python/mono_tone.py1
-rw-r--r--[-rwxr-xr-x]gr-audio/examples/python/multi_tone.py12
-rw-r--r--[-rwxr-xr-x]gr-audio/examples/python/noise.py1
-rw-r--r--[-rwxr-xr-x]gr-audio/examples/python/spectrum_inversion.py1
-rw-r--r--[-rwxr-xr-x]gr-audio/examples/python/test_resampler.py11
-rw-r--r--gr-audio/grc/CMakeLists.txt4
-rw-r--r--gr-audio/grc/audio_sink.block.yml49
-rw-r--r--gr-audio/grc/audio_sink.xml87
-rw-r--r--gr-audio/grc/audio_source.block.yml49
-rw-r--r--gr-audio/grc/audio_source.xml87
-rw-r--r--gr-audio/python/audio/CMakeLists.txt2
-rw-r--r--gr-audio/python/audio/__init__.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/examples/ctrlport/simple_copy_controller.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/examples/ctrlport/usrp_sink_controller.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/examples/ctrlport/usrp_source_controller.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/examples/tags/test_file_tags.py7
-rw-r--r--gr-blocks/grc/CMakeLists.txt10
-rw-r--r--gr-blocks/grc/blocks.tree.yml171
-rw-r--r--gr-blocks/grc/blocks_abs_xx.block.yml32
-rw-r--r--gr-blocks/grc/blocks_abs_xx.xml48
-rw-r--r--gr-blocks/grc/blocks_add_const_vxx.block.yml43
-rw-r--r--gr-blocks/grc/blocks_add_const_vxx.xml67
-rw-r--r--gr-blocks/grc/blocks_add_xx.block.yml42
-rw-r--r--gr-blocks/grc/blocks_add_xx.xml63
-rw-r--r--gr-blocks/grc/blocks_and_const_xx.block.yml31
-rw-r--r--gr-blocks/grc/blocks_and_const_xx.xml48
-rw-r--r--gr-blocks/grc/blocks_and_xx.block.yml34
-rw-r--r--gr-blocks/grc/blocks_and_xx.xml48
-rw-r--r--gr-blocks/grc/blocks_argmax_xx.block.yml45
-rw-r--r--gr-blocks/grc/blocks_argmax_xx.xml61
-rw-r--r--gr-blocks/grc/blocks_block_tree.xml239
-rw-r--r--gr-blocks/grc/blocks_burst_tagger.block.yml52
-rw-r--r--gr-blocks/grc/blocks_burst_tagger.xml87
-rw-r--r--gr-blocks/grc/blocks_char_to_float.block.yml31
-rw-r--r--gr-blocks/grc/blocks_char_to_float.xml35
-rw-r--r--gr-blocks/grc/blocks_char_to_short.block.yml25
-rw-r--r--gr-blocks/grc/blocks_char_to_short.xml28
-rw-r--r--gr-blocks/grc/blocks_complex_to_arg.block.yml28
-rw-r--r--gr-blocks/grc/blocks_complex_to_arg.xml29
-rw-r--r--gr-blocks/grc/blocks_complex_to_float.block.yml34
-rw-r--r--gr-blocks/grc/blocks_complex_to_float.xml36
-rw-r--r--gr-blocks/grc/blocks_complex_to_imag.block.yml28
-rw-r--r--gr-blocks/grc/blocks_complex_to_imag.xml29
-rw-r--r--gr-blocks/grc/blocks_complex_to_interleaved_char.block.yml28
-rw-r--r--gr-blocks/grc/blocks_complex_to_interleaved_char.xml37
-rw-r--r--gr-blocks/grc/blocks_complex_to_interleaved_short.block.yml28
-rw-r--r--gr-blocks/grc/blocks_complex_to_interleaved_short.xml37
-rw-r--r--gr-blocks/grc/blocks_complex_to_mag.block.yml28
-rw-r--r--gr-blocks/grc/blocks_complex_to_mag.xml29
-rw-r--r--gr-blocks/grc/blocks_complex_to_mag_squared.block.yml28
-rw-r--r--gr-blocks/grc/blocks_complex_to_mag_squared.xml29
-rw-r--r--gr-blocks/grc/blocks_complex_to_magphase.block.yml34
-rw-r--r--gr-blocks/grc/blocks_complex_to_magphase.xml36
-rw-r--r--gr-blocks/grc/blocks_complex_to_real.block.yml29
-rw-r--r--gr-blocks/grc/blocks_complex_to_real.xml30
-rw-r--r--gr-blocks/grc/blocks_conjugate_cc.block.yml16
-rw-r--r--gr-blocks/grc/blocks_conjugate_cc.xml20
-rw-r--r--gr-blocks/grc/blocks_copy.block.yml57
-rw-r--r--gr-blocks/grc/blocks_copy.xml104
-rw-r--r--gr-blocks/grc/blocks_ctrlport_performance.block.yml17
-rw-r--r--gr-blocks/grc/blocks_ctrlport_performance.xml48
-rw-r--r--gr-blocks/grc/blocks_ctrlport_probe2_c.block.yml41
-rw-r--r--gr-blocks/grc/blocks_ctrlport_probe2_c.xml92
-rw-r--r--gr-blocks/grc/blocks_ctrlport_probe2_x.block.yml48
-rw-r--r--gr-blocks/grc/blocks_ctrlport_probe2_x.xml123
-rw-r--r--gr-blocks/grc/blocks_ctrlport_probe_c.block.yml25
-rw-r--r--gr-blocks/grc/blocks_ctrlport_probe_c.xml55
-rw-r--r--gr-blocks/grc/blocks_ctrlport_viewer.block.yml17
-rw-r--r--gr-blocks/grc/blocks_ctrlport_viewer.xml48
-rw-r--r--gr-blocks/grc/blocks_deinterleave.block.yml48
-rw-r--r--gr-blocks/grc/blocks_deinterleave.xml74
-rw-r--r--gr-blocks/grc/blocks_delay.block.yml50
-rw-r--r--gr-blocks/grc/blocks_delay.xml75
-rw-r--r--gr-blocks/grc/blocks_divide_XX.block.yml42
-rw-r--r--gr-blocks/grc/blocks_divide_XX.xml63
-rw-r--r--gr-blocks/grc/blocks_endian_swap.block.yml26
-rw-r--r--gr-blocks/grc/blocks_endian_swap.xml41
-rw-r--r--gr-blocks/grc/blocks_exponentiate_const_cci.block.yml43
-rw-r--r--gr-blocks/grc/blocks_exponentiate_const_cci.xml45
-rw-r--r--gr-blocks/grc/blocks_file_descriptor_sink.block.yml34
-rw-r--r--gr-blocks/grc/blocks_file_descriptor_sink.xml59
-rw-r--r--gr-blocks/grc/blocks_file_descriptor_source.block.yml37
-rw-r--r--gr-blocks/grc/blocks_file_descriptor_source.xml73
-rw-r--r--gr-blocks/grc/blocks_file_meta_sink.block.yml70
-rw-r--r--gr-blocks/grc/blocks_file_meta_sink.xml124
-rw-r--r--gr-blocks/grc/blocks_file_meta_source.block.yml48
-rw-r--r--gr-blocks/grc/blocks_file_meta_source.xml94
-rw-r--r--gr-blocks/grc/blocks_file_sink.block.yml51
-rw-r--r--gr-blocks/grc/blocks_file_sink.xml92
-rw-r--r--gr-blocks/grc/blocks_file_source.block.yml59
-rw-r--r--gr-blocks/grc/blocks_file_source.xml97
-rw-r--r--gr-blocks/grc/blocks_float_to_char.block.yml31
-rw-r--r--gr-blocks/grc/blocks_float_to_char.xml35
-rw-r--r--gr-blocks/grc/blocks_float_to_complex.block.yml34
-rw-r--r--gr-blocks/grc/blocks_float_to_complex.xml36
-rw-r--r--gr-blocks/grc/blocks_float_to_int.block.yml31
-rw-r--r--gr-blocks/grc/blocks_float_to_int.xml35
-rw-r--r--gr-blocks/grc/blocks_float_to_short.block.yml31
-rw-r--r--gr-blocks/grc/blocks_float_to_short.xml35
-rw-r--r--gr-blocks/grc/blocks_float_uchar.block.yml16
-rw-r--r--gr-blocks/grc/blocks_float_uchar.xml20
-rw-r--r--gr-blocks/grc/blocks_head.block.yml42
-rw-r--r--gr-blocks/grc/blocks_head.xml66
-rw-r--r--gr-blocks/grc/blocks_int_to_float.block.yml31
-rw-r--r--gr-blocks/grc/blocks_int_to_float.xml35
-rw-r--r--gr-blocks/grc/blocks_integrate_xx.block.yml35
-rw-r--r--gr-blocks/grc/blocks_integrate_xx.xml58
-rw-r--r--gr-blocks/grc/blocks_interleave.block.yml48
-rw-r--r--gr-blocks/grc/blocks_interleave.xml74
-rw-r--r--gr-blocks/grc/blocks_interleaved_char_to_complex.block.yml28
-rw-r--r--gr-blocks/grc/blocks_interleaved_char_to_complex.xml37
-rw-r--r--gr-blocks/grc/blocks_interleaved_short_to_complex.block.yml37
-rw-r--r--gr-blocks/grc/blocks_interleaved_short_to_complex.xml53
-rw-r--r--gr-blocks/grc/blocks_keep_m_in_n.block.yml49
-rw-r--r--gr-blocks/grc/blocks_keep_m_in_n.xml76
-rw-r--r--gr-blocks/grc/blocks_keep_one_in_n.block.yml44
-rw-r--r--gr-blocks/grc/blocks_keep_one_in_n.xml67
-rw-r--r--gr-blocks/grc/blocks_magphase_to_complex.block.yml34
-rw-r--r--gr-blocks/grc/blocks_magphase_to_complex.xml36
-rw-r--r--gr-blocks/grc/blocks_max_xx.block.yml47
-rw-r--r--gr-blocks/grc/blocks_max_xx.xml64
-rw-r--r--gr-blocks/grc/blocks_message_debug.block.yml19
-rw-r--r--gr-blocks/grc/blocks_message_debug.xml27
-rw-r--r--gr-blocks/grc/blocks_message_strobe.block.yml33
-rw-r--r--gr-blocks/grc/blocks_message_strobe.xml37
-rw-r--r--gr-blocks/grc/blocks_message_strobe_random.block.yml50
-rw-r--r--gr-blocks/grc/blocks_message_strobe_random.xml69
-rw-r--r--gr-blocks/grc/blocks_min_xx.block.yml47
-rw-r--r--gr-blocks/grc/blocks_min_xx.xml64
-rw-r--r--gr-blocks/grc/blocks_moving_average_xx.block.yml49
-rw-r--r--gr-blocks/grc/blocks_moving_average_xx.xml77
-rw-r--r--gr-blocks/grc/blocks_multiply_by_tag_value_cc.block.yml25
-rw-r--r--gr-blocks/grc/blocks_multiply_by_tag_value_cc.xml32
-rw-r--r--gr-blocks/grc/blocks_multiply_conjugate_cc.block.yml33
-rw-r--r--gr-blocks/grc/blocks_multiply_conjugate_cc.xml35
-rw-r--r--gr-blocks/grc/blocks_multiply_const_vxx.block.yml43
-rw-r--r--gr-blocks/grc/blocks_multiply_const_vxx.xml67
-rw-r--r--gr-blocks/grc/blocks_multiply_const_xx.block.yml41
-rw-r--r--gr-blocks/grc/blocks_multiply_const_xx.xml62
-rw-r--r--gr-blocks/grc/blocks_multiply_matrix_xx.block.yml47
-rw-r--r--gr-blocks/grc/blocks_multiply_matrix_xx.xml68
-rw-r--r--gr-blocks/grc/blocks_multiply_xx.block.yml42
-rw-r--r--gr-blocks/grc/blocks_multiply_xx.xml63
-rw-r--r--gr-blocks/grc/blocks_mute_xx.block.yml35
-rw-r--r--gr-blocks/grc/blocks_mute_xx.xml66
-rw-r--r--gr-blocks/grc/blocks_nlog10_ff.block.yml37
-rw-r--r--gr-blocks/grc/blocks_nlog10_ff.xml42
-rw-r--r--gr-blocks/grc/blocks_nop.block.yml44
-rw-r--r--gr-blocks/grc/blocks_nop.xml68
-rw-r--r--gr-blocks/grc/blocks_not_xx.block.yml25
-rw-r--r--gr-blocks/grc/blocks_not_xx.xml40
-rw-r--r--gr-blocks/grc/blocks_null_sink.block.yml43
-rw-r--r--gr-blocks/grc/blocks_null_sink.xml71
-rw-r--r--gr-blocks/grc/blocks_null_source.block.yml39
-rw-r--r--gr-blocks/grc/blocks_null_source.xml70
-rw-r--r--gr-blocks/grc/blocks_or_xx.block.yml34
-rw-r--r--gr-blocks/grc/blocks_or_xx.xml48
-rw-r--r--gr-blocks/grc/blocks_pack_k_bits_bb.block.yml24
-rw-r--r--gr-blocks/grc/blocks_pack_k_bits_bb.xml30
-rw-r--r--gr-blocks/grc/blocks_packed_to_unpacked_xx.block.yml44
-rw-r--r--gr-blocks/grc/blocks_packed_to_unpacked_xx.xml68
-rw-r--r--gr-blocks/grc/blocks_patterned_interleaver.block.yml42
-rw-r--r--gr-blocks/grc/blocks_patterned_interleaver.xml66
-rw-r--r--gr-blocks/grc/blocks_pdu_filter.block.yml40
-rw-r--r--gr-blocks/grc/blocks_pdu_filter.xml52
-rw-r--r--gr-blocks/grc/blocks_pdu_remove.block.yml28
-rw-r--r--gr-blocks/grc/blocks_pdu_remove.xml30
-rw-r--r--gr-blocks/grc/blocks_pdu_set.block.yml33
-rw-r--r--gr-blocks/grc/blocks_pdu_set.xml37
-rw-r--r--gr-blocks/grc/blocks_pdu_to_tagged_stream.block.yml29
-rw-r--r--gr-blocks/grc/blocks_pdu_to_tagged_stream.xml46
-rw-r--r--gr-blocks/grc/blocks_peak_detector2_fb.block.yml38
-rw-r--r--gr-blocks/grc/blocks_peak_detector2_fb.xml46
-rw-r--r--gr-blocks/grc/blocks_peak_detector_xb.block.yml47
-rw-r--r--gr-blocks/grc/blocks_peak_detector_xb.xml68
-rw-r--r--gr-blocks/grc/blocks_plateau_detector_fb.block.yml25
-rw-r--r--gr-blocks/grc/blocks_plateau_detector_fb.xml26
-rw-r--r--gr-blocks/grc/blocks_probe_rate.block.yml44
-rw-r--r--gr-blocks/grc/blocks_probe_rate.xml71
-rw-r--r--gr-blocks/grc/blocks_probe_signal_vx.block.yml35
-rw-r--r--gr-blocks/grc/blocks_probe_signal_vx.xml59
-rw-r--r--gr-blocks/grc/blocks_probe_signal_x.block.yml26
-rw-r--r--gr-blocks/grc/blocks_probe_signal_x.xml51
-rw-r--r--gr-blocks/grc/blocks_random_pdu.block.yml38
-rw-r--r--gr-blocks/grc/blocks_random_pdu.xml47
-rw-r--r--gr-blocks/grc/blocks_regenerate_bb.block.yml25
-rw-r--r--gr-blocks/grc/blocks_regenerate_bb.xml32
-rw-r--r--gr-blocks/grc/blocks_repack_bits_bb.block.yml47
-rw-r--r--gr-blocks/grc/blocks_repack_bits_bb.xml70
-rw-r--r--gr-blocks/grc/blocks_repeat.block.yml41
-rw-r--r--gr-blocks/grc/blocks_repeat.xml65
-rw-r--r--gr-blocks/grc/blocks_rms_xx.block.yml31
-rw-r--r--gr-blocks/grc/blocks_rms_xx.xml42
-rw-r--r--gr-blocks/grc/blocks_rotator_cc.block.yml24
-rw-r--r--gr-blocks/grc/blocks_rotator_cc.xml27
-rw-r--r--gr-blocks/grc/blocks_sample_and_hold_xx.block.yml28
-rw-r--r--gr-blocks/grc/blocks_sample_and_hold_xx.xml49
-rw-r--r--gr-blocks/grc/blocks_short_to_char.block.yml25
-rw-r--r--gr-blocks/grc/blocks_short_to_char.xml28
-rw-r--r--gr-blocks/grc/blocks_short_to_float.block.yml31
-rw-r--r--gr-blocks/grc/blocks_short_to_float.xml35
-rw-r--r--gr-blocks/grc/blocks_skiphead.block.yml40
-rw-r--r--gr-blocks/grc/blocks_skiphead.xml65
-rw-r--r--gr-blocks/grc/blocks_socket_pdu.block.yml63
-rw-r--r--gr-blocks/grc/blocks_socket_pdu.xml88
-rw-r--r--gr-blocks/grc/blocks_stream_mux.block.yml48
-rw-r--r--gr-blocks/grc/blocks_stream_mux.xml75
-rw-r--r--gr-blocks/grc/blocks_stream_to_streams.block.yml43
-rw-r--r--gr-blocks/grc/blocks_stream_to_streams.xml67
-rw-r--r--gr-blocks/grc/blocks_stream_to_tagged_stream.block.yml43
-rw-r--r--gr-blocks/grc/blocks_stream_to_tagged_stream.xml66
-rw-r--r--gr-blocks/grc/blocks_stream_to_vector.block.yml42
-rw-r--r--gr-blocks/grc/blocks_stream_to_vector.xml66
-rw-r--r--gr-blocks/grc/blocks_stream_to_vector_decimator.block.yml47
-rw-r--r--gr-blocks/grc/blocks_stream_to_vector_decimator.xml77
-rw-r--r--gr-blocks/grc/blocks_streams_to_stream.block.yml43
-rw-r--r--gr-blocks/grc/blocks_streams_to_stream.xml67
-rw-r--r--gr-blocks/grc/blocks_streams_to_vector.block.yml43
-rw-r--r--gr-blocks/grc/blocks_streams_to_vector.xml67
-rw-r--r--gr-blocks/grc/blocks_stretch_ff.block.yml28
-rw-r--r--gr-blocks/grc/blocks_stretch_ff.xml34
-rw-r--r--gr-blocks/grc/blocks_sub_xx.block.yml42
-rw-r--r--gr-blocks/grc/blocks_sub_xx.xml63
-rw-r--r--gr-blocks/grc/blocks_tag_debug.block.yml53
-rw-r--r--gr-blocks/grc/blocks_tag_debug.xml88
-rw-r--r--gr-blocks/grc/blocks_tag_gate.block.yml50
-rw-r--r--gr-blocks/grc/blocks_tag_gate.xml78
-rw-r--r--gr-blocks/grc/blocks_tag_object.block.yml44
-rw-r--r--gr-blocks/grc/blocks_tag_object.xml52
-rw-r--r--gr-blocks/grc/blocks_tag_share.block.yml48
-rw-r--r--gr-blocks/grc/blocks_tag_share.xml96
-rw-r--r--gr-blocks/grc/blocks_tagged_file_sink.block.yml35
-rw-r--r--gr-blocks/grc/blocks_tagged_file_sink.xml60
-rw-r--r--gr-blocks/grc/blocks_tagged_stream_align.block.yml37
-rw-r--r--gr-blocks/grc/blocks_tagged_stream_align.xml59
-rw-r--r--gr-blocks/grc/blocks_tagged_stream_multiply_length.block.yml46
-rw-r--r--gr-blocks/grc/blocks_tagged_stream_multiply_length.xml70
-rw-r--r--gr-blocks/grc/blocks_tagged_stream_mux.block.yml46
-rw-r--r--gr-blocks/grc/blocks_tagged_stream_mux.xml71
-rw-r--r--gr-blocks/grc/blocks_tagged_stream_to_pdu.block.yml30
-rw-r--r--gr-blocks/grc/blocks_tagged_stream_to_pdu.xml47
-rw-r--r--gr-blocks/grc/blocks_tags_strobe.block.yml49
-rw-r--r--gr-blocks/grc/blocks_tags_strobe.xml76
-rw-r--r--gr-blocks/grc/blocks_tcp_server_sink.block.yml42
-rw-r--r--gr-blocks/grc/blocks_tcp_server_sink.xml77
-rw-r--r--gr-blocks/grc/blocks_test_tag_variable_rate_ff.block.yml29
-rw-r--r--gr-blocks/grc/blocks_test_tag_variable_rate_ff.xml47
-rw-r--r--gr-blocks/grc/blocks_threshold_ff.block.yml33
-rw-r--r--gr-blocks/grc/blocks_threshold_ff.xml40
-rw-r--r--gr-blocks/grc/blocks_throttle.block.yml48
-rw-r--r--gr-blocks/grc/blocks_throttle.xml74
-rw-r--r--gr-blocks/grc/blocks_transcendental.block.yml30
-rw-r--r--gr-blocks/grc/blocks_transcendental.xml41
-rw-r--r--gr-blocks/grc/blocks_tuntap_pdu.block.yml34
-rw-r--r--gr-blocks/grc/blocks_tuntap_pdu.xml48
-rw-r--r--gr-blocks/grc/blocks_uchar_to_float.block.yml16
-rw-r--r--gr-blocks/grc/blocks_uchar_to_float.xml20
-rw-r--r--gr-blocks/grc/blocks_udp_sink.block.yml45
-rw-r--r--gr-blocks/grc/blocks_udp_sink.xml76
-rw-r--r--gr-blocks/grc/blocks_udp_source.block.yml48
-rw-r--r--gr-blocks/grc/blocks_udp_source.xml79
-rw-r--r--gr-blocks/grc/blocks_unpack_k_bits_bb.block.yml21
-rw-r--r--gr-blocks/grc/blocks_unpack_k_bits_bb.xml25
-rw-r--r--gr-blocks/grc/blocks_unpacked_to_packed_xx.block.yml44
-rw-r--r--gr-blocks/grc/blocks_unpacked_to_packed_xx.xml68
-rw-r--r--gr-blocks/grc/blocks_vco_c.block.yml27
-rw-r--r--gr-blocks/grc/blocks_vco_c.xml35
-rw-r--r--gr-blocks/grc/blocks_vco_f.block.yml27
-rw-r--r--gr-blocks/grc/blocks_vco_f.xml35
-rw-r--r--gr-blocks/grc/blocks_vector_insert_x.block.yml44
-rw-r--r--gr-blocks/grc/blocks_vector_insert_x.xml80
-rw-r--r--gr-blocks/grc/blocks_vector_sink_x.block.yml30
-rw-r--r--gr-blocks/grc/blocks_vector_sink_x.xml54
-rw-r--r--gr-blocks/grc/blocks_vector_source_x.block.yml47
-rw-r--r--gr-blocks/grc/blocks_vector_source_x.xml86
-rw-r--r--gr-blocks/grc/blocks_vector_to_stream.block.yml42
-rw-r--r--gr-blocks/grc/blocks_vector_to_stream.xml66
-rw-r--r--gr-blocks/grc/blocks_vector_to_streams.block.yml43
-rw-r--r--gr-blocks/grc/blocks_vector_to_streams.xml67
-rw-r--r--gr-blocks/grc/blocks_wavfile_sink.block.yml36
-rw-r--r--gr-blocks/grc/blocks_wavfile_sink.xml43
-rw-r--r--gr-blocks/grc/blocks_wavfile_source.block.yml32
-rw-r--r--gr-blocks/grc/blocks_wavfile_source.xml44
-rw-r--r--gr-blocks/grc/blocks_xor_xx.block.yml34
-rw-r--r--gr-blocks/grc/blocks_xor_xx.xml48
-rw-r--r--gr-blocks/grc/xmlrpc_client.block.yml30
-rw-r--r--gr-blocks/grc/xmlrpc_client.xml42
-rw-r--r--gr-blocks/grc/xmlrpc_server.block.yml34
-rw-r--r--gr-blocks/grc/xmlrpc_server.xml41
-rw-r--r--gr-blocks/python/blocks/CMakeLists.txt2
-rw-r--r--gr-blocks/python/blocks/__init__.py10
-rw-r--r--gr-blocks/python/blocks/parse_file_metadata.py32
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_add_mult_div_sub.py9
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_add_mult_v.py381
-rw-r--r--gr-blocks/python/blocks/qa_affinity.py1
-rw-r--r--gr-blocks/python/blocks/qa_argmax.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_bin_statistics.py25
-rw-r--r--gr-blocks/python/blocks/qa_block_behavior.py1
-rw-r--r--gr-blocks/python/blocks/qa_block_gateway.py8
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_boolean_operators.py7
-rw-r--r--gr-blocks/python/blocks/qa_burst_tagger.py1
-rw-r--r--gr-blocks/python/blocks/qa_conjugate.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_copy.py3
-rw-r--r--gr-blocks/python/blocks/qa_cpp_py_binding.py7
-rw-r--r--gr-blocks/python/blocks/qa_cpp_py_binding_set.py5
-rw-r--r--gr-blocks/python/blocks/qa_ctrlport_probes.py21
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_delay.py1
-rw-r--r--gr-blocks/python/blocks/qa_endian_swap.py1
-rw-r--r--gr-blocks/python/blocks/qa_file_metadata.py29
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_head.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_hier_block2.py237
-rw-r--r--gr-blocks/python/blocks/qa_hier_block2_message_connections.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_integrate.py101
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_interleave.py38
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_keep_m_in_n.py14
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_keep_one_in_n.py1
-rw-r--r--gr-blocks/python/blocks/qa_logger.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_max.py46
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_message.py5
-rw-r--r--gr-blocks/python/blocks/qa_min.py46
-rw-r--r--gr-blocks/python/blocks/qa_moving_average.py1
-rw-r--r--gr-blocks/python/blocks/qa_multiply_conjugate.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_multiply_matrix_xx.py9
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_mute.py7
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_nlog10.py1
-rw-r--r--gr-blocks/python/blocks/qa_null_sink_source.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_pack_k_bits.py3
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_packed_to_unpacked.py23
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_patterned_interleaver.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_pdu.py5
-rw-r--r--gr-blocks/python/blocks/qa_peak_detector.py1
-rw-r--r--gr-blocks/python/blocks/qa_peak_detector2.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_pipe_fittings.py5
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_plateau_detector_fb.py1
-rw-r--r--gr-blocks/python/blocks/qa_probe_signal.py1
-rw-r--r--gr-blocks/python/blocks/qa_python_message_passing.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_regenerate.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_repack_bits_bb.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_repeat.py23
-rw-r--r--gr-blocks/python/blocks/qa_rms.py14
-rw-r--r--gr-blocks/python/blocks/qa_sample_and_hold.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_skiphead.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_socket_pdu.py7
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_stream_mux.py5
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_stream_to_tagged_stream.py5
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_stretch.py6
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_tag_debug.py1
-rw-r--r--gr-blocks/python/blocks/qa_tag_file_sink.py13
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_tag_gate.py3
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_tagged_stream_mux.py7
-rw-r--r--gr-blocks/python/blocks/qa_tags_strobe.py4
-rw-r--r--gr-blocks/python/blocks/qa_tcp_server_sink.py1
-rw-r--r--gr-blocks/python/blocks/qa_threshold.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_throttle.py1
-rw-r--r--gr-blocks/python/blocks/qa_transcendental.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_tsb_vector_sink_X.py3
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_type_conversions.py1
-rw-r--r--gr-blocks/python/blocks/qa_udp_source_sink.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_unpack_k_bits.py1
-rw-r--r--gr-blocks/python/blocks/qa_vco.py16
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_vector_insert.py1
-rw-r--r--gr-blocks/python/blocks/qa_vector_map.py7
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_vector_sink_source.py1
-rw-r--r--[-rwxr-xr-x]gr-blocks/python/blocks/qa_wavfile.py39
-rw-r--r--gr-blocks/python/blocks/stream_to_vector_decimator.py5
-rw-r--r--gr-blocks/swig/blocks_swig.py.in24
-rw-r--r--gr-channels/grc/CMakeLists.txt4
-rw-r--r--gr-channels/grc/channels.tree.yml20
-rw-r--r--gr-channels/grc/channels_amp_bal.block.yml24
-rw-r--r--gr-channels/grc/channels_amp_bal.xml27
-rw-r--r--gr-channels/grc/channels_block_tree.xml55
-rw-r--r--gr-channels/grc/channels_cfo_model.block.yml44
-rw-r--r--gr-channels/grc/channels_cfo_model.xml52
-rw-r--r--gr-channels/grc/channels_channel_model.block.yml56
-rw-r--r--gr-channels/grc/channels_channel_model.xml79
-rw-r--r--gr-channels/grc/channels_channel_model2.block.yml56
-rw-r--r--gr-channels/grc/channels_channel_model2.xml79
-rw-r--r--gr-channels/grc/channels_conj_fs_iqcorr.block.yml29
-rw-r--r--gr-channels/grc/channels_conj_fs_iqcorr.xml34
-rw-r--r--gr-channels/grc/channels_distortion_2_gen.block.yml24
-rw-r--r--gr-channels/grc/channels_distortion_2_gen.xml27
-rw-r--r--gr-channels/grc/channels_distortion_3_gen.block.yml24
-rw-r--r--gr-channels/grc/channels_distortion_3_gen.xml27
-rw-r--r--gr-channels/grc/channels_dynamic_channel_model.block.yml98
-rw-r--r--gr-channels/grc/channels_dynamic_channel_model.xml136
-rw-r--r--gr-channels/grc/channels_fading_model.block.yml57
-rw-r--r--gr-channels/grc/channels_fading_model.xml75
-rw-r--r--gr-channels/grc/channels_impairments.block.yml60
-rw-r--r--gr-channels/grc/channels_impairments.xml76
-rw-r--r--gr-channels/grc/channels_iqbal_gen.block.yml29
-rw-r--r--gr-channels/grc/channels_iqbal_gen.xml34
-rw-r--r--gr-channels/grc/channels_phase_bal.block.yml24
-rw-r--r--gr-channels/grc/channels_phase_bal.xml27
-rw-r--r--gr-channels/grc/channels_phase_noise_gen.block.yml29
-rw-r--r--gr-channels/grc/channels_phase_noise_gen.xml34
-rw-r--r--gr-channels/grc/channels_quantizer.block.yml24
-rw-r--r--gr-channels/grc/channels_quantizer.xml27
-rw-r--r--gr-channels/grc/channels_selective_fading_model.block.yml87
-rw-r--r--gr-channels/grc/channels_selective_fading_model.xml109
-rw-r--r--gr-channels/grc/channels_selective_fading_model2.block.yml100
-rw-r--r--gr-channels/grc/channels_selective_fading_model2.xml128
-rw-r--r--gr-channels/grc/channels_sro_model.block.yml44
-rw-r--r--gr-channels/grc/channels_sro_model.xml52
-rw-r--r--gr-channels/python/channels/CMakeLists.txt2
-rw-r--r--gr-channels/python/channels/__init__.py24
-rw-r--r--gr-channels/python/channels/amp_bal.py1
-rw-r--r--gr-channels/python/channels/conj_fs_iqcorr.py1
-rw-r--r--gr-channels/python/channels/distortion_2_gen.py1
-rw-r--r--gr-channels/python/channels/distortion_3_gen.py1
-rw-r--r--gr-channels/python/channels/impairments.py15
-rw-r--r--gr-channels/python/channels/iqbal_gen.py6
-rw-r--r--gr-channels/python/channels/phase_bal.py1
-rw-r--r--gr-channels/python/channels/phase_noise_gen.py1
-rw-r--r--[-rwxr-xr-x]gr-channels/python/channels/qa_channel_model.py1
-rw-r--r--gr-channels/python/channels/qa_fading_model.py1
-rw-r--r--gr-channels/python/channels/quantizer.py6
-rw-r--r--gr-comedi/python/comedi/CMakeLists.txt2
-rw-r--r--gr-comedi/python/comedi/__init__.py5
-rw-r--r--[-rwxr-xr-x]gr-comedi/python/comedi/qa_comedi.py1
-rw-r--r--[-rwxr-xr-x]gr-digital/examples/berawgn.py23
-rw-r--r--gr-digital/examples/demod/pam_timing.grc2459
-rw-r--r--[-rwxr-xr-x]gr-digital/examples/example_costas.py8
-rw-r--r--[-rwxr-xr-x]gr-digital/examples/example_fll.py8
-rw-r--r--[-rwxr-xr-x]gr-digital/examples/example_timing.py12
-rw-r--r--[-rwxr-xr-x]gr-digital/examples/gen_whitener.py1
-rw-r--r--[-rwxr-xr-x]gr-digital/examples/narrowband/benchmark_add_channel.py26
-rw-r--r--[-rwxr-xr-x]gr-digital/examples/narrowband/benchmark_rx.py36
-rw-r--r--[-rwxr-xr-x]gr-digital/examples/narrowband/benchmark_tx.py38
-rw-r--r--[-rwxr-xr-x]gr-digital/examples/narrowband/digital_bert_rx.py56
-rw-r--r--[-rwxr-xr-x]gr-digital/examples/narrowband/digital_bert_tx.py8
-rw-r--r--gr-digital/examples/narrowband/receive_path.py44
-rw-r--r--[-rwxr-xr-x]gr-digital/examples/narrowband/rx_voice.py47
-rw-r--r--gr-digital/examples/narrowband/transmit_path.py43
-rw-r--r--[-rwxr-xr-x]gr-digital/examples/narrowband/tunnel.py78
-rw-r--r--[-rwxr-xr-x]gr-digital/examples/narrowband/tx_voice.py48
-rw-r--r--gr-digital/examples/narrowband/uhd_interface.py100
-rw-r--r--[-rwxr-xr-x]gr-digital/examples/ofdm/benchmark_add_channel.py28
-rw-r--r--gr-digital/examples/ofdm/receive_path.py1
-rw-r--r--gr-digital/examples/ofdm/transmit_path.py29
-rw-r--r--gr-digital/examples/ofdm/uhd_interface.py76
-rw-r--r--[-rwxr-xr-x]gr-digital/examples/run_length.py37
-rw-r--r--[-rwxr-xr-x]gr-digital/examples/snr_estimators.py36
-rw-r--r--gr-digital/grc/CMakeLists.txt4
-rw-r--r--gr-digital/grc/digital.tree.yml85
-rw-r--r--gr-digital/grc/digital_additive_scrambler_bb.block.yml43
-rw-r--r--gr-digital/grc/digital_additive_scrambler_bb.xml56
-rw-r--r--gr-digital/grc/digital_binary_slicer_fb.block.yml16
-rw-r--r--gr-digital/grc/digital_binary_slicer_fb.xml20
-rw-r--r--gr-digital/grc/digital_block_tree.xml134
-rw-r--r--gr-digital/grc/digital_burst_shaper.block.yml50
-rw-r--r--gr-digital/grc/digital_burst_shaper.xml71
-rw-r--r--gr-digital/grc/digital_chunks_to_symbols.block.yml53
-rw-r--r--gr-digital/grc/digital_chunks_to_symbols.xml78
-rw-r--r--gr-digital/grc/digital_clock_recovery_mm_xx.block.yml51
-rw-r--r--gr-digital/grc/digital_clock_recovery_mm_xx.xml69
-rw-r--r--gr-digital/grc/digital_cma_equalizer_cc.block.yml33
-rw-r--r--gr-digital/grc/digital_cma_equalizer_cc.xml42
-rw-r--r--gr-digital/grc/digital_constellation.block.yml72
-rw-r--r--gr-digital/grc/digital_constellation.xml113
-rw-r--r--gr-digital/grc/digital_constellation_decoder_cb.block.yml21
-rw-r--r--gr-digital/grc/digital_constellation_decoder_cb.xml25
-rw-r--r--gr-digital/grc/digital_constellation_modulator.block.yml58
-rw-r--r--gr-digital/grc/digital_constellation_modulator.xml111
-rw-r--r--gr-digital/grc/digital_constellation_receiver_cb.block.yml62
-rw-r--r--gr-digital/grc/digital_constellation_receiver_cb.xml92
-rw-r--r--gr-digital/grc/digital_constellation_rect.block.yml65
-rw-r--r--gr-digital/grc/digital_constellation_rect.xml89
-rw-r--r--gr-digital/grc/digital_constellation_soft_decoder_cf.block.yml21
-rw-r--r--gr-digital/grc/digital_constellation_soft_decoder_cf.xml25
-rw-r--r--gr-digital/grc/digital_corr_est_cc.block.yml38
-rw-r--r--gr-digital/grc/digital_corr_est_cc.xml50
-rw-r--r--gr-digital/grc/digital_correlate_access_code_bb.block.yml25
-rw-r--r--gr-digital/grc/digital_correlate_access_code_bb.xml31
-rw-r--r--gr-digital/grc/digital_correlate_access_code_tag_xx.block.yml40
-rw-r--r--gr-digital/grc/digital_correlate_access_code_tag_xx.xml55
-rw-r--r--gr-digital/grc/digital_correlate_access_code_xx_ts.block.yml37
-rw-r--r--gr-digital/grc/digital_correlate_access_code_xx_ts.xml58
-rw-r--r--gr-digital/grc/digital_costas_loop_cc.block.yml48
-rw-r--r--gr-digital/grc/digital_costas_loop_cc.xml74
-rw-r--r--gr-digital/grc/digital_cpmmod_bc.block.yml40
-rw-r--r--gr-digital/grc/digital_cpmmod_bc.xml69
-rw-r--r--gr-digital/grc/digital_crc32_async_bb.block.yml25
-rw-r--r--gr-digital/grc/digital_crc32_async_bb.xml32
-rw-r--r--gr-digital/grc/digital_crc32_bb.block.yml33
-rw-r--r--gr-digital/grc/digital_crc32_bb.xml47
-rw-r--r--gr-digital/grc/digital_descrambler_bb.block.yml30
-rw-r--r--gr-digital/grc/digital_descrambler_bb.xml38
-rw-r--r--gr-digital/grc/digital_diff_decoder_bb.block.yml21
-rw-r--r--gr-digital/grc/digital_diff_decoder_bb.xml25
-rw-r--r--gr-digital/grc/digital_diff_encoder_bb.block.yml21
-rw-r--r--gr-digital/grc/digital_diff_encoder_bb.xml25
-rw-r--r--gr-digital/grc/digital_diff_phasor_cc.block.yml16
-rw-r--r--gr-digital/grc/digital_diff_phasor_cc.xml20
-rw-r--r--gr-digital/grc/digital_dxpsk_demod.block.yml75
-rw-r--r--gr-digital/grc/digital_dxpsk_demod.xml154
-rw-r--r--gr-digital/grc/digital_dxpsk_mod.block.yml52
-rw-r--r--gr-digital/grc/digital_dxpsk_mod.xml117
-rw-r--r--gr-digital/grc/digital_fll_band_edge_cc.block.yml53
-rw-r--r--gr-digital/grc/digital_fll_band_edge_cc.xml70
-rw-r--r--gr-digital/grc/digital_framer_sink_1.block.yml17
-rw-r--r--gr-digital/grc/digital_framer_sink_1.xml21
-rw-r--r--gr-digital/grc/digital_gfsk_demod.block.yml58
-rw-r--r--gr-digital/grc/digital_gfsk_demod.xml95
-rw-r--r--gr-digital/grc/digital_gfsk_mod.block.yml45
-rw-r--r--gr-digital/grc/digital_gfsk_mod.xml74
-rw-r--r--gr-digital/grc/digital_glfsr_source_x.block.yml37
-rw-r--r--gr-digital/grc/digital_glfsr_source_x.xml61
-rw-r--r--gr-digital/grc/digital_gmsk_demod.block.yml54
-rw-r--r--gr-digital/grc/digital_gmsk_demod.xml88
-rw-r--r--gr-digital/grc/digital_gmsk_mod.block.yml41
-rw-r--r--gr-digital/grc/digital_gmsk_mod.xml67
-rw-r--r--gr-digital/grc/digital_gmskmod_bc.block.yml30
-rw-r--r--gr-digital/grc/digital_gmskmod_bc.xml38
-rw-r--r--gr-digital/grc/digital_hdlc_deframer_bp.block.yml26
-rw-r--r--gr-digital/grc/digital_hdlc_deframer_bp.xml27
-rw-r--r--gr-digital/grc/digital_hdlc_framer_pb.block.yml21
-rw-r--r--gr-digital/grc/digital_hdlc_framer_pb.xml20
-rw-r--r--gr-digital/grc/digital_header_payload_demux.block.yml85
-rw-r--r--gr-digital/grc/digital_header_payload_demux.xml138
-rw-r--r--gr-digital/grc/digital_kurtotic_equalizer_cc.block.yml26
-rw-r--r--gr-digital/grc/digital_kurtotic_equalizer_cc.xml31
-rw-r--r--gr-digital/grc/digital_lms_dd_equalizer_cc.block.yml32
-rw-r--r--gr-digital/grc/digital_lms_dd_equalizer_cc.xml41
-rw-r--r--gr-digital/grc/digital_map_bb.block.yml21
-rw-r--r--gr-digital/grc/digital_map_bb.xml25
-rw-r--r--gr-digital/grc/digital_modulate_vector.block.yml22
-rw-r--r--gr-digital/grc/digital_modulate_vector.xml34
-rw-r--r--gr-digital/grc/digital_mpsk_snr_est_cc.block.yml35
-rw-r--r--gr-digital/grc/digital_mpsk_snr_est_cc.xml56
-rw-r--r--gr-digital/grc/digital_msk_timing_recovery_cc.block.yml42
-rw-r--r--gr-digital/grc/digital_msk_timing_recovery_cc.xml49
-rw-r--r--gr-digital/grc/digital_ofdm_carrier_allocator_cvc.block.yml44
-rw-r--r--gr-digital/grc/digital_ofdm_carrier_allocator_cvc.xml51
-rw-r--r--gr-digital/grc/digital_ofdm_chanest_vcvc.block.yml53
-rw-r--r--gr-digital/grc/digital_ofdm_chanest_vcvc.xml64
-rw-r--r--gr-digital/grc/digital_ofdm_cyclic_prefixer.block.yml38
-rw-r--r--gr-digital/grc/digital_ofdm_cyclic_prefixer.xml67
-rw-r--r--gr-digital/grc/digital_ofdm_frame_equalizer_vcvc.block.yml46
-rw-r--r--gr-digital/grc/digital_ofdm_frame_equalizer_vcvc.xml58
-rw-r--r--gr-digital/grc/digital_ofdm_rx.block.yml95
-rw-r--r--gr-digital/grc/digital_ofdm_rx.xml190
-rw-r--r--gr-digital/grc/digital_ofdm_serializer_vcc.block.yml51
-rw-r--r--gr-digital/grc/digital_ofdm_serializer_vcc.xml60
-rw-r--r--gr-digital/grc/digital_ofdm_sync_sc_cfb.block.yml35
-rw-r--r--gr-digital/grc/digital_ofdm_sync_sc_cfb.xml44
-rw-r--r--gr-digital/grc/digital_ofdm_tx.block.yml100
-rw-r--r--gr-digital/grc/digital_ofdm_tx.xml196
-rw-r--r--gr-digital/grc/digital_packet_headergenerator_bb.block.yml27
-rw-r--r--gr-digital/grc/digital_packet_headergenerator_bb.xml26
-rw-r--r--gr-digital/grc/digital_packet_headergenerator_bb_default.block.yml25
-rw-r--r--gr-digital/grc/digital_packet_headergenerator_bb_default.xml26
-rw-r--r--gr-digital/grc/digital_packet_headerparser_b.block.yml21
-rw-r--r--gr-digital/grc/digital_packet_headerparser_b.xml19
-rw-r--r--gr-digital/grc/digital_packet_headerparser_b_default.block.yml25
-rw-r--r--gr-digital/grc/digital_packet_headerparser_b_default.xml26
-rw-r--r--gr-digital/grc/digital_packet_sink.block.yml24
-rw-r--r--gr-digital/grc/digital_packet_sink.xml32
-rw-r--r--gr-digital/grc/digital_pfb_clock_sync.block.yml69
-rw-r--r--gr-digital/grc/digital_pfb_clock_sync.xml97
-rw-r--r--gr-digital/grc/digital_pn_correlator_cc.block.yml29
-rw-r--r--gr-digital/grc/digital_pn_correlator_cc.xml37
-rw-r--r--gr-digital/grc/digital_probe_density_b.block.yml24
-rw-r--r--gr-digital/grc/digital_probe_density_b.xml29
-rw-r--r--gr-digital/grc/digital_probe_mpsk_snr_est_c.block.yml42
-rw-r--r--gr-digital/grc/digital_probe_mpsk_snr_est_c.xml67
-rw-r--r--gr-digital/grc/digital_protocol_formatter_async.block.yml26
-rw-r--r--gr-digital/grc/digital_protocol_formatter_async.xml33
-rw-r--r--gr-digital/grc/digital_protocol_formatter_bb.block.yml25
-rw-r--r--gr-digital/grc/digital_protocol_formatter_bb.xml32
-rw-r--r--gr-digital/grc/digital_protocol_parser_b.block.yml22
-rw-r--r--gr-digital/grc/digital_protocol_parser_b.xml25
-rw-r--r--gr-digital/grc/digital_psk_demod.block.yml79
-rw-r--r--gr-digital/grc/digital_psk_demod.xml146
-rw-r--r--gr-digital/grc/digital_psk_mod.block.yml65
-rw-r--r--gr-digital/grc/digital_psk_mod.xml126
-rw-r--r--gr-digital/grc/digital_qam_demod.block.yml80
-rw-r--r--gr-digital/grc/digital_qam_demod.xml147
-rw-r--r--gr-digital/grc/digital_qam_mod.block.yml65
-rw-r--r--gr-digital/grc/digital_qam_mod.xml126
-rw-r--r--gr-digital/grc/digital_scrambler_bb.block.yml30
-rw-r--r--gr-digital/grc/digital_scrambler_bb.xml38
-rw-r--r--gr-digital/grc/digital_simple_correlator.block.yml21
-rw-r--r--gr-digital/grc/digital_simple_correlator.xml25
-rw-r--r--gr-digital/grc/digital_simple_framer.block.yml21
-rw-r--r--gr-digital/grc/digital_simple_framer.xml25
-rw-r--r--gr-digital/grc/digital_symbol_sync_xx.block.yml108
-rw-r--r--gr-digital/grc/digital_symbol_sync_xx.xml207
-rw-r--r--gr-digital/grc/variable_header_format_default.block.yml25
-rw-r--r--gr-digital/grc/variable_header_format_default.xml42
-rw-r--r--gr-digital/python/digital/CMakeLists.txt2
-rw-r--r--gr-digital/python/digital/__init__.py66
-rw-r--r--gr-digital/python/digital/bpsk.py7
-rw-r--r--gr-digital/python/digital/constellation_map_generator.py1
-rw-r--r--gr-digital/python/digital/cpm.py121
-rw-r--r--gr-digital/python/digital/crc.py13
-rw-r--r--gr-digital/python/digital/generic_mod_demod.py68
-rw-r--r--gr-digital/python/digital/gfsk.py167
-rw-r--r--gr-digital/python/digital/gmsk.py135
-rw-r--r--gr-digital/python/digital/modulation_utils.py1
-rw-r--r--gr-digital/python/digital/ofdm.py109
-rw-r--r--gr-digital/python/digital/ofdm_packet_utils.py31
-rw-r--r--gr-digital/python/digital/ofdm_receiver.py58
-rw-r--r--gr-digital/python/digital/ofdm_sync_fixed.py1
-rw-r--r--gr-digital/python/digital/ofdm_sync_ml.py50
-rw-r--r--gr-digital/python/digital/ofdm_sync_pn.py31
-rw-r--r--gr-digital/python/digital/ofdm_sync_pnac.py31
-rw-r--r--gr-digital/python/digital/ofdm_txrx.py27
-rw-r--r--gr-digital/python/digital/packet_utils.py52
-rw-r--r--gr-digital/python/digital/pkt.py64
-rw-r--r--gr-digital/python/digital/psk.py32
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/psk_constellations.py4
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_binary_slicer_fb.py20
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_burst_shaper.py9
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_chunks_to_symbols.py7
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_clock_recovery_mm.py1
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_cma_equalizer.py37
-rw-r--r--gr-digital/python/digital/qa_constellation.py18
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_constellation_decoder_cb.py30
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_constellation_receiver.py31
-rw-r--r--gr-digital/python/digital/qa_constellation_soft_decoder_cf.py13
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_correlate_access_code.py3
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_correlate_access_code_XX_ts.py5
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_correlate_access_code_tag.py3
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_costas_loop_cc.py12
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_cpm.py1
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_crc32.py1
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_crc32_bb.py13
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_diff_encoder.py1
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_diff_phasor_cc.py1
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_digital.py1
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_fll_band_edge.py4
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_framer_sink.py3
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_glfsr_source.py19
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_hdlc_framer.py5
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_header_payload_demux.py29
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_lfsr.py3
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_lms_equalizer.py37
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_map.py3
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_mpsk_snr_est.py19
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_ofdm_carrier_allocator_cvc.py17
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_ofdm_chanest_vcvc.py10
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_ofdm_cyclic_prefixer.py16
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_ofdm_frame_equalizer_vcvc.py18
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_ofdm_serializer_vcc.py26
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_ofdm_sync_sc_cfb.py28
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_ofdm_txrx.py1
-rw-r--r--gr-digital/python/digital/qa_packet_format.py19
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_packet_headergenerator_bb.py1
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_packet_headerparser_b.py11
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_pfb_clock_sync.py18
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_pn_correlator_cc.py1
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_probe_density.py4
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_scrambler.py5
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_simple_correlator.py1
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qa_simple_framer.py1
-rw-r--r--gr-digital/python/digital/qam.py77
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/qam_constellations.py11
-rw-r--r--gr-digital/python/digital/qamlike.py19
-rw-r--r--gr-digital/python/digital/qpsk.py8
-rw-r--r--gr-digital/python/digital/soft_dec_lut_gen.py19
-rw-r--r--[-rwxr-xr-x]gr-digital/python/digital/test_soft_decisions.py35
-rw-r--r--gr-digital/python/digital/utils/alignment.py12
-rw-r--r--gr-digital/python/digital/utils/gray_code.py16
-rw-r--r--gr-digital/python/digital/utils/mod_codes.py1
-rw-r--r--gr-digital/python/digital/utils/tagged_streams.py23
-rw-r--r--gr-digital/swig/digital_swig.py.in8
-rw-r--r--[-rwxr-xr-x]gr-dtv/examples/atsc_ctrlport_monitor.py14
-rw-r--r--gr-dtv/grc/CMakeLists.txt109
-rw-r--r--gr-dtv/grc/dtv.tree.yml62
-rw-r--r--gr-dtv/grc/dtv_atsc_deinterleaver.block.yml18
-rw-r--r--gr-dtv/grc/dtv_atsc_deinterleaver.xml25
-rw-r--r--gr-dtv/grc/dtv_atsc_depad.block.yml17
-rw-r--r--gr-dtv/grc/dtv_atsc_depad.xml24
-rw-r--r--gr-dtv/grc/dtv_atsc_derandomizer.block.yml18
-rw-r--r--gr-dtv/grc/dtv_atsc_derandomizer.xml25
-rw-r--r--gr-dtv/grc/dtv_atsc_equalizer.block.yml18
-rw-r--r--gr-dtv/grc/dtv_atsc_equalizer.xml25
-rw-r--r--gr-dtv/grc/dtv_atsc_field_sync_mux.block.yml18
-rw-r--r--gr-dtv/grc/dtv_atsc_field_sync_mux.xml22
-rw-r--r--gr-dtv/grc/dtv_atsc_fpll.block.yml21
-rw-r--r--gr-dtv/grc/dtv_atsc_fpll.xml29
-rw-r--r--gr-dtv/grc/dtv_atsc_fs_checker.block.yml18
-rw-r--r--gr-dtv/grc/dtv_atsc_fs_checker.xml25
-rw-r--r--gr-dtv/grc/dtv_atsc_interleaver.block.yml18
-rw-r--r--gr-dtv/grc/dtv_atsc_interleaver.xml22
-rw-r--r--gr-dtv/grc/dtv_atsc_pad.block.yml17
-rw-r--r--gr-dtv/grc/dtv_atsc_pad.xml21
-rw-r--r--gr-dtv/grc/dtv_atsc_randomizer.block.yml18
-rw-r--r--gr-dtv/grc/dtv_atsc_randomizer.xml22
-rw-r--r--gr-dtv/grc/dtv_atsc_rs_decoder.block.yml18
-rw-r--r--gr-dtv/grc/dtv_atsc_rs_decoder.xml25
-rw-r--r--gr-dtv/grc/dtv_atsc_rs_encoder.block.yml18
-rw-r--r--gr-dtv/grc/dtv_atsc_rs_encoder.xml22
-rw-r--r--gr-dtv/grc/dtv_atsc_rx.block.yml24
-rw-r--r--gr-dtv/grc/dtv_atsc_rx.xml35
-rw-r--r--gr-dtv/grc/dtv_atsc_rx_filter.block.yml24
-rw-r--r--gr-dtv/grc/dtv_atsc_rx_filter.xml35
-rw-r--r--gr-dtv/grc/dtv_atsc_sync.block.yml22
-rw-r--r--gr-dtv/grc/dtv_atsc_sync.xml30
-rw-r--r--gr-dtv/grc/dtv_atsc_trellis_encoder.block.yml18
-rw-r--r--gr-dtv/grc/dtv_atsc_trellis_encoder.xml22
-rw-r--r--gr-dtv/grc/dtv_atsc_viterbi_decoder.block.yml18
-rw-r--r--gr-dtv/grc/dtv_atsc_viterbi_decoder.xml25
-rw-r--r--gr-dtv/grc/dtv_block_tree.xml106
-rw-r--r--gr-dtv/grc/dtv_catv_frame_sync_enc_bb.block.yml29
-rw-r--r--gr-dtv/grc/dtv_catv_frame_sync_enc_bb.xml41
-rw-r--r--gr-dtv/grc/dtv_catv_randomizer_bb.block.yml25
-rw-r--r--gr-dtv/grc/dtv_catv_randomizer_bb.xml35
-rw-r--r--gr-dtv/grc/dtv_catv_reed_solomon_enc_bb.block.yml16
-rw-r--r--gr-dtv/grc/dtv_catv_reed_solomon_enc_bb.xml20
-rw-r--r--gr-dtv/grc/dtv_catv_transport_framing_enc_bb.block.yml16
-rw-r--r--gr-dtv/grc/dtv_catv_transport_framing_enc_bb.xml20
-rw-r--r--gr-dtv/grc/dtv_catv_trellis_enc_bb.block.yml25
-rw-r--r--gr-dtv/grc/dtv_catv_trellis_enc_bb.xml35
-rw-r--r--gr-dtv/grc/dtv_dvb_bbheader_bb.block.yml154
-rw-r--r--gr-dtv/grc/dtv_dvb_bbheader_bb.xml596
-rw-r--r--gr-dtv/grc/dtv_dvb_bbscrambler_bb.block.yml118
-rw-r--r--gr-dtv/grc/dtv_dvb_bbscrambler_bb.xml512
-rw-r--r--gr-dtv/grc/dtv_dvb_bch_bb.block.yml118
-rw-r--r--gr-dtv/grc/dtv_dvb_bch_bb.xml512
-rw-r--r--gr-dtv/grc/dtv_dvb_ldpc_bb.block.yml126
-rw-r--r--gr-dtv/grc/dtv_dvb_ldpc_bb.xml528
-rw-r--r--gr-dtv/grc/dtv_dvbs2_interleaver_bb.block.yml86
-rw-r--r--gr-dtv/grc/dtv_dvbs2_interleaver_bb.xml455
-rw-r--r--gr-dtv/grc/dtv_dvbs2_modulator_bc.block.yml102
-rw-r--r--gr-dtv/grc/dtv_dvbs2_modulator_bc.xml504
-rw-r--r--gr-dtv/grc/dtv_dvbs2_physical_cc.block.yml98
-rw-r--r--gr-dtv/grc/dtv_dvbs2_physical_cc.xml476
-rw-r--r--gr-dtv/grc/dtv_dvbt2_cellinterleaver_cc.block.yml41
-rw-r--r--gr-dtv/grc/dtv_dvbt2_cellinterleaver_cc.xml72
-rw-r--r--gr-dtv/grc/dtv_dvbt2_framemapper_cc.block.yml203
-rw-r--r--gr-dtv/grc/dtv_dvbt2_framemapper_cc.xml562
-rw-r--r--gr-dtv/grc/dtv_dvbt2_freqinterleaver_cc.block.yml104
-rw-r--r--gr-dtv/grc/dtv_dvbt2_freqinterleaver_cc.xml301
-rw-r--r--gr-dtv/grc/dtv_dvbt2_interleaver_bb.block.yml40
-rw-r--r--gr-dtv/grc/dtv_dvbt2_interleaver_bb.xml105
-rw-r--r--gr-dtv/grc/dtv_dvbt2_miso_cc.block.yml86
-rw-r--r--gr-dtv/grc/dtv_dvbt2_miso_cc.xml254
-rw-r--r--gr-dtv/grc/dtv_dvbt2_modulator_bc.block.yml39
-rw-r--r--gr-dtv/grc/dtv_dvbt2_modulator_bc.xml75
-rw-r--r--gr-dtv/grc/dtv_dvbt2_p1insertion_cc.block.yml106
-rw-r--r--gr-dtv/grc/dtv_dvbt2_p1insertion_cc.xml276
-rw-r--r--gr-dtv/grc/dtv_dvbt2_paprtr_cc.block.yml105
-rw-r--r--gr-dtv/grc/dtv_dvbt2_paprtr_cc.xml286
-rw-r--r--gr-dtv/grc/dtv_dvbt2_pilotgenerator_cc.block.yml137
-rw-r--r--gr-dtv/grc/dtv_dvbt2_pilotgenerator_cc.xml386
-rw-r--r--gr-dtv/grc/dtv_dvbt_bit_inner_deinterleaver.block.yml47
-rw-r--r--gr-dtv/grc/dtv_dvbt_bit_inner_deinterleaver.xml89
-rw-r--r--gr-dtv/grc/dtv_dvbt_bit_inner_interleaver.block.yml47
-rw-r--r--gr-dtv/grc/dtv_dvbt_bit_inner_interleaver.xml89
-rw-r--r--gr-dtv/grc/dtv_dvbt_convolutional_deinterleaver.block.yml39
-rw-r--r--gr-dtv/grc/dtv_dvbt_convolutional_deinterleaver.xml43
-rw-r--r--gr-dtv/grc/dtv_dvbt_convolutional_interleaver.block.yml39
-rw-r--r--gr-dtv/grc/dtv_dvbt_convolutional_interleaver.xml43
-rw-r--r--gr-dtv/grc/dtv_dvbt_demap.block.yml48
-rw-r--r--gr-dtv/grc/dtv_dvbt_demap.xml90
-rw-r--r--gr-dtv/grc/dtv_dvbt_demod_reference_signals.block.yml86
-rw-r--r--gr-dtv/grc/dtv_dvbt_demod_reference_signals.xml222
-rw-r--r--gr-dtv/grc/dtv_dvbt_energy_descramble.block.yml27
-rw-r--r--gr-dtv/grc/dtv_dvbt_energy_descramble.xml29
-rw-r--r--gr-dtv/grc/dtv_dvbt_energy_dispersal.block.yml28
-rw-r--r--gr-dtv/grc/dtv_dvbt_energy_dispersal.xml29
-rw-r--r--gr-dtv/grc/dtv_dvbt_inner_coder.block.yml57
-rw-r--r--gr-dtv/grc/dtv_dvbt_inner_coder.xml112
-rw-r--r--gr-dtv/grc/dtv_dvbt_map.block.yml48
-rw-r--r--gr-dtv/grc/dtv_dvbt_map.xml90
-rw-r--r--gr-dtv/grc/dtv_dvbt_ofdm_sym_acquisition.block.yml45
-rw-r--r--gr-dtv/grc/dtv_dvbt_ofdm_sym_acquisition.xml76
-rw-r--r--gr-dtv/grc/dtv_dvbt_reed_solomon_dec.block.yml57
-rw-r--r--gr-dtv/grc/dtv_dvbt_reed_solomon_dec.xml70
-rw-r--r--gr-dtv/grc/dtv_dvbt_reed_solomon_enc.block.yml57
-rw-r--r--gr-dtv/grc/dtv_dvbt_reed_solomon_enc.xml70
-rw-r--r--gr-dtv/grc/dtv_dvbt_reference_signals.block.yml86
-rw-r--r--gr-dtv/grc/dtv_dvbt_reference_signals.xml222
-rw-r--r--gr-dtv/grc/dtv_dvbt_symbol_inner_interleaver.block.yml37
-rw-r--r--gr-dtv/grc/dtv_dvbt_symbol_inner_interleaver.xml56
-rw-r--r--gr-dtv/grc/dtv_dvbt_viterbi_decoder.block.yml51
-rw-r--r--gr-dtv/grc/dtv_dvbt_viterbi_decoder.xml120
-rw-r--r--gr-dtv/python/dtv/CMakeLists.txt2
-rw-r--r--gr-dtv/python/dtv/__init__.py9
-rw-r--r--gr-dtv/python/dtv/atsc_rx.py20
-rw-r--r--gr-dtv/python/dtv/atsc_rx_filter.py8
-rw-r--r--[-rwxr-xr-x]gr-dtv/python/dtv/qa_dtv.py1
-rw-r--r--gr-fec/grc/CMakeLists.txt4
-rw-r--r--gr-fec/grc/fec.tree.yml43
-rw-r--r--gr-fec/grc/fec_async_decoder.block.yml43
-rw-r--r--gr-fec/grc/fec_async_decoder.xml68
-rw-r--r--gr-fec/grc/fec_async_encoder.block.yml50
-rw-r--r--gr-fec/grc/fec_async_encoder.xml84
-rw-r--r--gr-fec/grc/fec_ber_bf.block.yml37
-rw-r--r--gr-fec/grc/fec_ber_bf.xml54
-rw-r--r--gr-fec/grc/fec_bercurve_generator.block.yml63
-rw-r--r--gr-fec/grc/fec_bercurve_generator.xml104
-rw-r--r--gr-fec/grc/fec_block_tree.xml57
-rw-r--r--gr-fec/grc/fec_decode_ccsds_27_bb.block.yml16
-rw-r--r--gr-fec/grc/fec_decode_ccsds_27_bb.xml20
-rw-r--r--gr-fec/grc/fec_decode_ccsds_27_fb.block.yml16
-rw-r--r--gr-fec/grc/fec_decode_ccsds_27_fb.xml20
-rw-r--r--gr-fec/grc/fec_decoder.block.yml41
-rw-r--r--gr-fec/grc/fec_decoder.xml91
-rw-r--r--gr-fec/grc/fec_depuncture_bb.block.yml33
-rw-r--r--gr-fec/grc/fec_depuncture_bb.xml45
-rw-r--r--gr-fec/grc/fec_encoder.block.yml41
-rw-r--r--gr-fec/grc/fec_encoder.xml91
-rw-r--r--gr-fec/grc/fec_extended_async_encoder.block.yml30
-rw-r--r--gr-fec/grc/fec_extended_async_encoder.xml38
-rw-r--r--gr-fec/grc/fec_extended_decoder.block.yml44
-rw-r--r--gr-fec/grc/fec_extended_decoder.xml72
-rw-r--r--gr-fec/grc/fec_extended_encoder.block.yml35
-rw-r--r--gr-fec/grc/fec_extended_encoder.xml57
-rw-r--r--gr-fec/grc/fec_extended_tagged_decoder.block.yml47
-rw-r--r--gr-fec/grc/fec_extended_tagged_decoder.xml65
-rw-r--r--gr-fec/grc/fec_extended_tagged_encoder.block.yml37
-rw-r--r--gr-fec/grc/fec_extended_tagged_encoder.xml50
-rw-r--r--gr-fec/grc/fec_puncture_xx.block.yml35
-rw-r--r--gr-fec/grc/fec_puncture_xx.xml53
-rw-r--r--gr-fec/grc/fec_tagged_decoder.block.yml47
-rw-r--r--gr-fec/grc/fec_tagged_decoder.xml74
-rw-r--r--gr-fec/grc/fec_tagged_encoder.block.yml47
-rw-r--r--gr-fec/grc/fec_tagged_encoder.xml74
-rw-r--r--gr-fec/grc/ldpc_decoder_def_list.block.yml53
-rw-r--r--gr-fec/grc/ldpc_decoder_def_list.xml87
-rw-r--r--gr-fec/grc/ldpc_encoder_def_list.block.yml38
-rwxr-xr-xgr-fec/grc/ldpc_encoder_def_list.xml68
-rw-r--r--gr-fec/grc/tpc_decoder_def_list.block.yml77
-rw-r--r--gr-fec/grc/tpc_decoder_def_list.xml142
-rw-r--r--gr-fec/grc/tpc_encoder_def_list.block.yml66
-rwxr-xr-xgr-fec/grc/tpc_encoder_def_list.xml107
-rw-r--r--gr-fec/grc/variable_cc_decoder_def_list.block.yml76
-rw-r--r--gr-fec/grc/variable_cc_decoder_def_list.xml148
-rw-r--r--gr-fec/grc/variable_cc_encoder_def_list.block.yml66
-rw-r--r--gr-fec/grc/variable_cc_encoder_def_list.xml133
-rw-r--r--gr-fec/grc/variable_ccsds_encoder_def_list.block.yml46
-rw-r--r--gr-fec/grc/variable_ccsds_encoder_def_list.xml97
-rw-r--r--gr-fec/grc/variable_dummy_decoder_def_list.block.yml40
-rw-r--r--gr-fec/grc/variable_dummy_decoder_def_list.xml75
-rw-r--r--gr-fec/grc/variable_dummy_encoder_def_list.block.yml36
-rw-r--r--gr-fec/grc/variable_dummy_encoder_def_list.xml67
-rw-r--r--gr-fec/grc/variable_ldpc_G_matrix_object.block.yml31
-rw-r--r--gr-fec/grc/variable_ldpc_G_matrix_object.xml43
-rw-r--r--gr-fec/grc/variable_ldpc_H_matrix_object.block.yml40
-rw-r--r--gr-fec/grc/variable_ldpc_H_matrix_object.xml55
-rw-r--r--gr-fec/grc/variable_ldpc_bit_flip_decoder.block.yml51
-rw-r--r--gr-fec/grc/variable_ldpc_bit_flip_decoder.xml86
-rw-r--r--gr-fec/grc/variable_ldpc_encoder_G.block.yml42
-rw-r--r--gr-fec/grc/variable_ldpc_encoder_G.xml77
-rw-r--r--gr-fec/grc/variable_ldpc_encoder_H.block.yml42
-rw-r--r--gr-fec/grc/variable_ldpc_encoder_H.xml75
-rw-r--r--gr-fec/grc/variable_polar_code_configurator.block.yml42
-rw-r--r--gr-fec/grc/variable_polar_code_configurator.xml59
-rw-r--r--gr-fec/grc/variable_polar_decoder_sc.block.yml45
-rw-r--r--gr-fec/grc/variable_polar_decoder_sc.xml74
-rw-r--r--gr-fec/grc/variable_polar_decoder_sc_list.block.yml49
-rw-r--r--gr-fec/grc/variable_polar_decoder_sc_list.xml80
-rw-r--r--gr-fec/grc/variable_polar_decoder_sc_systematic.block.yml42
-rw-r--r--gr-fec/grc/variable_polar_decoder_sc_systematic.xml68
-rw-r--r--gr-fec/grc/variable_polar_encoder.block.yml52
-rw-r--r--gr-fec/grc/variable_polar_encoder.xml89
-rw-r--r--gr-fec/grc/variable_polar_encoder_systematic.block.yml42
-rw-r--r--gr-fec/grc/variable_polar_encoder_systematic.xml68
-rw-r--r--gr-fec/grc/variable_repetition_decoder_def_list.block.yml49
-rw-r--r--gr-fec/grc/variable_repetition_decoder_def_list.xml89
-rw-r--r--gr-fec/grc/variable_repetition_encoder_def_list.block.yml39
-rw-r--r--gr-fec/grc/variable_repetition_encoder_def_list.xml74
-rw-r--r--gr-fec/include/gnuradio/fec/polar_common.h2
-rw-r--r--gr-fec/python/fec/CMakeLists.txt2
-rw-r--r--gr-fec/python/fec/LDPC/Generate_LDPC_matrix.py25
-rw-r--r--gr-fec/python/fec/LDPC/Generate_LDPC_matrix_functions.py150
-rw-r--r--gr-fec/python/fec/LDPC/__init__.py4
-rw-r--r--gr-fec/python/fec/__init__.py31
-rw-r--r--[-rwxr-xr-x]gr-fec/python/fec/_qa_helper.py23
-rw-r--r--gr-fec/python/fec/bercurve_generator.py6
-rw-r--r--gr-fec/python/fec/bitflip.py13
-rw-r--r--gr-fec/python/fec/capillary_threaded_decoder.py13
-rw-r--r--gr-fec/python/fec/capillary_threaded_encoder.py17
-rw-r--r--gr-fec/python/fec/extended_async_encoder.py13
-rw-r--r--gr-fec/python/fec/extended_decoder.py31
-rw-r--r--gr-fec/python/fec/extended_encoder.py12
-rw-r--r--gr-fec/python/fec/extended_tagged_decoder.py28
-rw-r--r--gr-fec/python/fec/extended_tagged_encoder.py10
-rw-r--r--gr-fec/python/fec/fec_test.py11
-rw-r--r--gr-fec/python/fec/polar/CMakeLists.txt3
-rw-r--r--gr-fec/python/fec/polar/__init__.py9
-rw-r--r--gr-fec/python/fec/polar/channel_construction.py14
-rw-r--r--[-rwxr-xr-x]gr-fec/python/fec/polar/channel_construction_awgn.py18
-rw-r--r--gr-fec/python/fec/polar/channel_construction_bec.py9
-rw-r--r--gr-fec/python/fec/polar/common.py10
-rw-r--r--gr-fec/python/fec/polar/decoder.py37
-rw-r--r--gr-fec/python/fec/polar/encoder.py16
-rw-r--r--gr-fec/python/fec/polar/helper_functions.py10
-rw-r--r--[-rwxr-xr-x]gr-fec/python/fec/polar/testbed.py21
-rw-r--r--gr-fec/python/fec/qa_ber_bf.py12
-rw-r--r--gr-fec/python/fec/qa_depuncture.py83
-rw-r--r--[-rwxr-xr-x]gr-fec/python/fec/qa_ecc_ccsds_27.py27
-rw-r--r--gr-fec/python/fec/qa_fecapi_cc.py32
-rw-r--r--gr-fec/python/fec/qa_fecapi_dummy.py41
-rw-r--r--gr-fec/python/fec/qa_fecapi_ldpc.py40
-rw-r--r--gr-fec/python/fec/qa_fecapi_repetition.py29
-rw-r--r--gr-fec/python/fec/qa_polar_decoder_sc.py15
-rw-r--r--gr-fec/python/fec/qa_polar_decoder_sc_list.py18
-rw-r--r--gr-fec/python/fec/qa_polar_decoder_sc_systematic.py15
-rw-r--r--gr-fec/python/fec/qa_polar_encoder.py13
-rw-r--r--gr-fec/python/fec/qa_polar_encoder_systematic.py14
-rw-r--r--gr-fec/python/fec/qa_puncture.py122
-rw-r--r--gr-fec/python/fec/threaded_decoder.py4
-rw-r--r--gr-fec/python/fec/threaded_encoder.py5
-rw-r--r--gr-fft/grc/CMakeLists.txt10
-rw-r--r--gr-fft/grc/fft.tree.yml7
-rw-r--r--gr-fft/grc/fft_block_tree.xml41
-rw-r--r--gr-fft/grc/fft_ctrlport_probe_psd.block.yml31
-rw-r--r--gr-fft/grc/fft_ctrlport_probe_psd.xml63
-rw-r--r--gr-fft/grc/fft_fft_vxx.block.yml60
-rw-r--r--gr-fft/grc/fft_fft_vxx.xml88
-rw-r--r--gr-fft/grc/fft_goertzel_fc.block.yml30
-rw-r--r--gr-fft/grc/fft_goertzel_fc.xml37
-rw-r--r--gr-fft/grc/fft_logpwrfft_x.block.yml59
-rw-r--r--gr-fft/grc/fft_logpwrfft_x.xml90
-rw-r--r--gr-fft/python/fft/CMakeLists.txt2
-rw-r--r--gr-fft/python/fft/__init__.py8
-rw-r--r--gr-fft/python/fft/logpwrfft.py13
-rw-r--r--[-rwxr-xr-x]gr-fft/python/fft/qa_fft.py2
-rw-r--r--[-rwxr-xr-x]gr-fft/python/fft/qa_goertzel.py40
-rw-r--r--[-rwxr-xr-x]gr-filter/examples/benchmark_filters.py6
-rw-r--r--[-rwxr-xr-x]gr-filter/examples/channelize.py33
-rw-r--r--[-rwxr-xr-x]gr-filter/examples/chirp_channelize.py29
-rw-r--r--[-rwxr-xr-x]gr-filter/examples/decimate.py27
-rw-r--r--[-rwxr-xr-x]gr-filter/examples/fft_filter_ccc.py13
-rw-r--r--[-rwxr-xr-x]gr-filter/examples/fir_filter_ccc.py13
-rw-r--r--[-rwxr-xr-x]gr-filter/examples/fir_filter_fff.py13
-rw-r--r--[-rwxr-xr-x]gr-filter/examples/gr_filtdes_api.py10
-rw-r--r--[-rwxr-xr-x]gr-filter/examples/gr_filtdes_callback.py14
-rw-r--r--[-rwxr-xr-x]gr-filter/examples/gr_filtdes_live_upd.py6
-rw-r--r--[-rwxr-xr-x]gr-filter/examples/gr_filtdes_restrict.py14
-rw-r--r--[-rwxr-xr-x]gr-filter/examples/interpolate.py31
-rw-r--r--[-rwxr-xr-x]gr-filter/examples/reconstruction.py19
-rw-r--r--[-rwxr-xr-x]gr-filter/examples/resampler.py29
-rw-r--r--[-rwxr-xr-x]gr-filter/examples/synth_filter.py9
-rw-r--r--[-rwxr-xr-x]gr-filter/examples/synth_to_chan.py17
-rw-r--r--gr-filter/grc/CMakeLists.txt64
-rw-r--r--gr-filter/grc/filter.tree.yml35
-rw-r--r--gr-filter/grc/filter_band_pass_filter.block.yml85
-rw-r--r--gr-filter/grc/filter_band_pass_filter.xml166
-rw-r--r--gr-filter/grc/filter_band_reject_filter.block.yml80
-rw-r--r--gr-filter/grc/filter_band_reject_filter.xml132
-rw-r--r--gr-filter/grc/filter_block_tree.xml74
-rw-r--r--gr-filter/grc/filter_dc_blocker_xx.block.yml35
-rw-r--r--gr-filter/grc/filter_dc_blocker_xx.xml51
-rw-r--r--gr-filter/grc/filter_fft_filter_xxx.block.yml52
-rw-r--r--gr-filter/grc/filter_fft_filter_xxx.xml75
-rw-r--r--gr-filter/grc/filter_filter_delay_fc.block.yml26
-rw-r--r--gr-filter/grc/filter_filter_delay_fc.xml31
-rw-r--r--gr-filter/grc/filter_filterbank_vcvcf.block.yml26
-rw-r--r--gr-filter/grc/filter_filterbank_vcvcf.xml29
-rw-r--r--gr-filter/grc/filter_fir_filter_xxx.block.yml49
-rw-r--r--gr-filter/grc/filter_fir_filter_xxx.xml89
-rw-r--r--gr-filter/grc/filter_freq_xlating_fft_filter_ccc.block.yml51
-rw-r--r--gr-filter/grc/filter_freq_xlating_fft_filter_ccc.xml62
-rw-r--r--gr-filter/grc/filter_freq_xlating_fir_filter_xxx.block.yml55
-rw-r--r--gr-filter/grc/filter_freq_xlating_fir_filter_xxx.xml100
-rw-r--r--gr-filter/grc/filter_high_pass_filter.block.yml77
-rw-r--r--gr-filter/grc/filter_high_pass_filter.xml127
-rw-r--r--gr-filter/grc/filter_hilbert_fc.block.yml35
-rw-r--r--gr-filter/grc/filter_hilbert_fc.xml64
-rw-r--r--gr-filter/grc/filter_iir_filter_xxx.block.yml44
-rw-r--r--gr-filter/grc/filter_iir_filter_xxx.xml93
-rw-r--r--gr-filter/grc/filter_interp_fir_filter_xxx.block.yml49
-rw-r--r--gr-filter/grc/filter_interp_fir_filter_xxx.xml89
-rw-r--r--gr-filter/grc/filter_low_pass_filter.block.yml77
-rw-r--r--gr-filter/grc/filter_low_pass_filter.xml127
-rw-r--r--gr-filter/grc/filter_low_pass_xlating_filter.block.yml79
-rw-r--r--gr-filter/grc/filter_low_pass_xlating_filter.xml144
-rw-r--r--gr-filter/grc/filter_mmse_interpolator_xx.block.yml33
-rw-r--r--gr-filter/grc/filter_mmse_interpolator_xx.xml46
-rw-r--r--gr-filter/grc/filter_mmse_resampler_xx.block.yml40
-rw-r--r--gr-filter/grc/filter_mmse_resampler_xx.xml56
-rw-r--r--gr-filter/grc/filter_pfb_arb_resampler.block.yml55
-rw-r--r--gr-filter/grc/filter_pfb_arb_resampler.xml87
-rw-r--r--gr-filter/grc/filter_pfb_channelizer.block.yml56
-rw-r--r--gr-filter/grc/filter_pfb_channelizer.xml77
-rw-r--r--gr-filter/grc/filter_pfb_channelizer_hier.block.yml55
-rw-r--r--gr-filter/grc/filter_pfb_channelizer_hier.xml80
-rw-r--r--gr-filter/grc/filter_pfb_decimator.block.yml56
-rw-r--r--gr-filter/grc/filter_pfb_decimator.xml91
-rw-r--r--gr-filter/grc/filter_pfb_interpolator.block.yml38
-rw-r--r--gr-filter/grc/filter_pfb_interpolator.xml51
-rw-r--r--gr-filter/grc/filter_pfb_synthesizer.block.yml55
-rw-r--r--gr-filter/grc/filter_pfb_synthesizer.xml73
-rw-r--r--gr-filter/grc/filter_rational_resampler_base_xxx.block.yml46
-rw-r--r--gr-filter/grc/filter_rational_resampler_base_xxx.xml86
-rw-r--r--gr-filter/grc/filter_rational_resampler_xxx.block.yml62
-rw-r--r--gr-filter/grc/filter_rational_resampler_xxx.xml92
-rw-r--r--gr-filter/grc/filter_root_raised_cosine_filter.block.yml70
-rw-r--r--gr-filter/grc/filter_root_raised_cosine_filter.xml101
-rw-r--r--gr-filter/grc/filter_single_pole_iir_filter_xx.block.yml38
-rw-r--r--gr-filter/grc/filter_single_pole_iir_filter_xx.xml51
-rw-r--r--gr-filter/grc/variable_band_pass_filter_taps.block.yml53
-rw-r--r--gr-filter/grc/variable_band_pass_filter_taps.xml97
-rw-r--r--gr-filter/grc/variable_band_reject_filter_taps.block.yml46
-rw-r--r--gr-filter/grc/variable_band_reject_filter_taps.xml81
-rw-r--r--gr-filter/grc/variable_high_pass_filter_taps.block.yml42
-rw-r--r--gr-filter/grc/variable_high_pass_filter_taps.xml75
-rw-r--r--gr-filter/grc/variable_low_pass_filter_taps.block.yml42
-rw-r--r--gr-filter/grc/variable_low_pass_filter_taps.xml75
-rw-r--r--gr-filter/grc/variable_rrc_filter_taps.block.yml34
-rw-r--r--gr-filter/grc/variable_rrc_filter_taps.xml50
-rw-r--r--gr-filter/lib/iir_filter_ffd_impl.cc28
-rw-r--r--gr-filter/lib/single_pole_iir_filter_ff_impl.cc36
-rw-r--r--gr-filter/python/filter/CMakeLists.txt2
-rw-r--r--gr-filter/python/filter/__init__.py18
-rw-r--r--gr-filter/python/filter/design/api_object.py3
-rw-r--r--gr-filter/python/filter/design/filter_design.py572
-rw-r--r--gr-filter/python/filter/design/fir_design.py30
-rw-r--r--gr-filter/python/filter/filterbank.py12
-rw-r--r--gr-filter/python/filter/freq_xlating_fft_filter.py4
-rw-r--r--gr-filter/python/filter/gui/bandgraphicsview.py1
-rw-r--r--gr-filter/python/filter/gui/banditems.py7
-rw-r--r--gr-filter/python/filter/gui/icons_rc.py1
-rw-r--r--gr-filter/python/filter/gui/idealbanditems.py53
-rw-r--r--gr-filter/python/filter/gui/polezero_plot.py1
-rw-r--r--gr-filter/python/filter/gui/pyqt_filter_stacked.py1
-rw-r--r--gr-filter/python/filter/optfir.py20
-rw-r--r--gr-filter/python/filter/pfb.py44
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_dc_blocker.py1
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_fft_filter.py78
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_filter_delay_fc.py16
-rw-r--r--gr-filter/python/filter/qa_filterbank.py1
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_fir_filter.py1
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_firdes.py6
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_fractional_interpolator.py22
-rw-r--r--gr-filter/python/filter/qa_fractional_resampler.py32
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_freq_xlating_fft_filter.py24
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_freq_xlating_fir_filter.py48
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_hilbert.py8
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_iir_filter.py1
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_interp_fir_filter.py1
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_pfb_arb_resampler.py50
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_pfb_channelizer.py30
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_pfb_decimator.py24
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_pfb_interpolator.py16
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_pfb_synthesizer.py18
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_pm_remez.py15
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_rational_resampler.py38
-rw-r--r--[-rwxr-xr-x]gr-filter/python/filter/qa_single_pole_iir.py1
-rw-r--r--gr-filter/python/filter/rational_resampler.py29
-rwxr-xr-xgr-qtgui/apps/gr_constellation_plot8
-rw-r--r--gr-qtgui/apps/plot_base.py34
-rw-r--r--gr-qtgui/apps/plot_constellation_form.py10
-rw-r--r--gr-qtgui/apps/plot_form.py14
-rw-r--r--gr-qtgui/apps/plot_psd_base.py15
-rw-r--r--gr-qtgui/apps/plot_psd_form.py5
-rw-r--r--gr-qtgui/apps/plot_spectrogram_base.py20
-rw-r--r--gr-qtgui/apps/plot_spectrogram_form.py7
-rw-r--r--gr-qtgui/apps/plot_time_base.py15
-rw-r--r--gr-qtgui/apps/plot_time_form.py7
-rw-r--r--gr-qtgui/apps/plot_time_raster_base.py15
-rw-r--r--gr-qtgui/apps/plot_time_raster_form.py9
-rw-r--r--[-rwxr-xr-x]gr-qtgui/apps/uhd_display.py19
-rw-r--r--gr-qtgui/apps/usrp_display_qtgui.py1
-rw-r--r--[-rwxr-xr-x]gr-qtgui/examples/pyqt_const_c.py10
-rw-r--r--[-rwxr-xr-x]gr-qtgui/examples/pyqt_example_c.py10
-rw-r--r--[-rwxr-xr-x]gr-qtgui/examples/pyqt_example_f.py10
-rw-r--r--[-rwxr-xr-x]gr-qtgui/examples/pyqt_freq_c.py10
-rw-r--r--[-rwxr-xr-x]gr-qtgui/examples/pyqt_freq_f.py10
-rw-r--r--[-rwxr-xr-x]gr-qtgui/examples/pyqt_histogram_f.py8
-rw-r--r--[-rwxr-xr-x]gr-qtgui/examples/pyqt_time_c.py10
-rw-r--r--[-rwxr-xr-x]gr-qtgui/examples/pyqt_time_f.py10
-rw-r--r--[-rwxr-xr-x]gr-qtgui/examples/pyqt_time_raster_b.py4
-rw-r--r--[-rwxr-xr-x]gr-qtgui/examples/pyqt_time_raster_f.py4
-rw-r--r--[-rwxr-xr-x]gr-qtgui/examples/pyqt_waterfall_c.py10
-rw-r--r--[-rwxr-xr-x]gr-qtgui/examples/pyqt_waterfall_f.py10
-rw-r--r--gr-qtgui/grc/CMakeLists.txt26
-rw-r--r--gr-qtgui/grc/qtgui.tree.yml23
-rw-r--r--gr-qtgui/grc/qtgui_ber_sink_b.block.yml366
-rw-r--r--gr-qtgui/grc/qtgui_ber_sink_b.xml684
-rw-r--r--gr-qtgui/grc/qtgui_block_tree.xml61
-rw-r--r--gr-qtgui/grc/qtgui_check_box.block.yml66
-rw-r--r--gr-qtgui/grc/qtgui_check_box.xml82
-rw-r--r--gr-qtgui/grc/qtgui_chooser.block.yml191
-rw-r--r--gr-qtgui/grc/qtgui_chooser.xml257
-rw-r--r--gr-qtgui/grc/qtgui_const_sink_x.block.yml457
-rw-r--r--gr-qtgui/grc/qtgui_const_sink_x.xml859
-rw-r--r--gr-qtgui/grc/qtgui_edit_box_msg.block.yml69
-rw-r--r--gr-qtgui/grc/qtgui_edit_box_msg.xml152
-rw-r--r--gr-qtgui/grc/qtgui_entry.block.yml57
-rw-r--r--gr-qtgui/grc/qtgui_entry.xml67
-rw-r--r--gr-qtgui/grc/qtgui_freq_sink_x.block.yml447
-rw-r--r--gr-qtgui/grc/qtgui_freq_sink_x.xml791
-rw-r--r--gr-qtgui/grc/qtgui_histogram_sink_x.block.yml419
-rw-r--r--gr-qtgui/grc/qtgui_histogram_sink_x.xml794
-rw-r--r--gr-qtgui/grc/qtgui_label.block.yml66
-rw-r--r--gr-qtgui/grc/qtgui_label.xml87
-rw-r--r--gr-qtgui/grc/qtgui_number_sink.block.yml283
-rw-r--r--gr-qtgui/grc/qtgui_number_sink.xml496
-rw-r--r--gr-qtgui/grc/qtgui_push_button.block.yml60
-rw-r--r--gr-qtgui/grc/qtgui_push_button.xml79
-rw-r--r--gr-qtgui/grc/qtgui_range.block.yml86
-rw-r--r--gr-qtgui/grc/qtgui_range.xml131
-rw-r--r--gr-qtgui/grc/qtgui_sink_x.block.yml148
-rw-r--r--gr-qtgui/grc/qtgui_sink_x.xml232
-rw-r--r--gr-qtgui/grc/qtgui_tab_widget.block.yml141
-rw-r--r--gr-qtgui/grc/qtgui_tab_widget.xml206
-rw-r--r--gr-qtgui/grc/qtgui_time_raster_x.block.yml266
-rw-r--r--gr-qtgui/grc/qtgui_time_raster_x.xml466
-rw-r--r--gr-qtgui/grc/qtgui_time_sink_x.block.yml568
-rw-r--r--gr-qtgui/grc/qtgui_time_sink_x.xml966
-rw-r--r--gr-qtgui/grc/qtgui_vector_sink_f.block.yml352
-rw-r--r--gr-qtgui/grc/qtgui_vector_sink_f.xml603
-rw-r--r--gr-qtgui/grc/qtgui_waterfall_sink_x.block.yml303
-rw-r--r--gr-qtgui/grc/qtgui_waterfall_sink_x.xml557
-rw-r--r--gr-qtgui/python/qtgui/CMakeLists.txt2
-rw-r--r--gr-qtgui/python/qtgui/__init__.py9
-rw-r--r--[-rwxr-xr-x]gr-qtgui/python/qtgui/qa_qtgui.py1
-rwxr-xr-xgr-qtgui/python/qtgui/range.py.cmakein4
-rw-r--r--gr-qtgui/python/qtgui/util.py.cmakein5
-rw-r--r--[-rwxr-xr-x]gr-trellis/docs/make_numbered_listing.py1
-rw-r--r--gr-trellis/docs/test_tcm.py23
-rw-r--r--[-rwxr-xr-x]gr-trellis/docs/test_viterbi_equalization1.py19
-rw-r--r--[-rwxr-xr-x]gr-trellis/examples/python/test_tcm.py27
-rw-r--r--gr-trellis/grc/CMakeLists.txt26
-rw-r--r--gr-trellis/grc/trellis_encoder_xx.block.yml59
-rw-r--r--gr-trellis/grc/trellis_encoder_xx.xml103
-rw-r--r--gr-trellis/grc/trellis_metrics_x.block.yml50
-rw-r--r--gr-trellis/grc/trellis_metrics_x.xml91
-rw-r--r--gr-trellis/grc/trellis_pccc_decoder_combined_xx.block.yml102
-rw-r--r--gr-trellis/grc/trellis_pccc_decoder_combined_xx.xml172
-rw-r--r--gr-trellis/grc/trellis_pccc_decoder_x.block.yml75
-rw-r--r--gr-trellis/grc/trellis_pccc_decoder_x.xml119
-rw-r--r--gr-trellis/grc/trellis_pccc_encoder_xx.block.yml58
-rw-r--r--gr-trellis/grc/trellis_pccc_encoder_xx.xml100
-rw-r--r--gr-trellis/grc/trellis_permutation.block.yml54
-rw-r--r--gr-trellis/grc/trellis_permutation.xml85
-rw-r--r--gr-trellis/grc/trellis_sccc_decoder_combined_xx.block.yml102
-rw-r--r--gr-trellis/grc/trellis_sccc_decoder_combined_xx.xml172
-rw-r--r--gr-trellis/grc/trellis_sccc_decoder_x.block.yml75
-rw-r--r--gr-trellis/grc/trellis_sccc_decoder_x.xml119
-rw-r--r--gr-trellis/grc/trellis_sccc_encoder_xx.block.yml58
-rw-r--r--gr-trellis/grc/trellis_sccc_encoder_xx.xml100
-rw-r--r--gr-trellis/grc/trellis_siso_combined_f.block.yml79
-rw-r--r--gr-trellis/grc/trellis_siso_combined_f.xml129
-rw-r--r--gr-trellis/grc/trellis_siso_f.block.yml67
-rw-r--r--gr-trellis/grc/trellis_siso_f.xml100
-rw-r--r--gr-trellis/grc/trellis_viterbi_combined_xx.block.yml76
-rw-r--r--gr-trellis/grc/trellis_viterbi_combined_xx.xml133
-rw-r--r--gr-trellis/grc/trellis_viterbi_x.block.yml53
-rw-r--r--gr-trellis/grc/trellis_viterbi_x.xml74
-rw-r--r--gr-trellis/python/trellis/CMakeLists.txt2
-rw-r--r--gr-trellis/python/trellis/__init__.py5
-rw-r--r--[-rwxr-xr-x]gr-trellis/python/trellis/fsm_utils.py56
-rw-r--r--[-rwxr-xr-x]gr-trellis/python/trellis/qa_trellis.py14
-rw-r--r--gr-trellis/swig/trellis_swig.py.in6
-rw-r--r--gr-uhd/CMakeLists.txt2
-rw-r--r--gr-uhd/apps/uhd_app.py21
-rwxr-xr-xgr-uhd/apps/uhd_fft8
-rwxr-xr-xgr-uhd/apps/uhd_rx_cfile6
-rw-r--r--gr-uhd/apps/uhd_siggen_base.py20
-rw-r--r--gr-uhd/grc/CMakeLists.txt26
-rw-r--r--gr-uhd/grc/gen_uhd_usrp_blocks.py1012
-rw-r--r--gr-uhd/grc/uhd.tree.yml5
-rw-r--r--gr-uhd/grc/uhd_amsg_source.block.yml18
-rw-r--r--gr-uhd/grc/uhd_amsg_source.xml24
-rw-r--r--gr-uhd/grc/uhd_block_tree.xml15
-rw-r--r--gr-uhd/python/uhd/CMakeLists.txt2
-rw-r--r--gr-uhd/python/uhd/__init__.py21
-rw-r--r--gr-uhd/python/uhd/qa_uhd.py4
-rw-r--r--gr-utils/CMakeLists.txt2
-rw-r--r--gr-utils/python/modtool/__init__.py28
-rw-r--r--gr-utils/python/modtool/cmakefile_editor.py7
-rw-r--r--gr-utils/python/modtool/code_generator.py14
-rw-r--r--gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake10
-rw-r--r--gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake11
-rw-r--r--gr-utils/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake2
-rw-r--r--gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py3
-rw-r--r--gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py18
-rw-r--r--gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py8
-rw-r--r--gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/__init__.py1
-rw-r--r--gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compound.py8
-rw-r--r--gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py40
-rw-r--r--gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/index.py6
-rw-r--r--gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py21
-rw-r--r--gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py5
-rw-r--r--gr-utils/python/modtool/gr-newmod/docs/doxygen/swig_doc.py3
-rw-r--r--gr-utils/python/modtool/gr-newmod/python/__init__.py1
-rw-r--r--gr-utils/python/modtool/gr-newmod/python/build_utils.py12
-rw-r--r--gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py1
-rw-r--r--gr-utils/python/modtool/grc_xml_generator.py3
-rw-r--r--gr-utils/python/modtool/modtool_add.py55
-rw-r--r--gr-utils/python/modtool/modtool_base.py18
-rw-r--r--gr-utils/python/modtool/modtool_disable.py24
-rw-r--r--gr-utils/python/modtool/modtool_info.py27
-rw-r--r--gr-utils/python/modtool/modtool_makexml.py28
-rw-r--r--gr-utils/python/modtool/modtool_newmod.py18
-rw-r--r--gr-utils/python/modtool/modtool_rename.py42
-rw-r--r--gr-utils/python/modtool/modtool_rm.py22
-rw-r--r--gr-utils/python/modtool/parser_cc_block.py16
-rw-r--r--gr-utils/python/modtool/scm.py9
-rw-r--r--gr-utils/python/modtool/templates.py1
-rw-r--r--gr-utils/python/modtool/util_functions.py8
-rwxr-xr-xgr-utils/python/utils/gr_modtool4
-rwxr-xr-xgr-utils/python/utils/gr_plot_char6
-rwxr-xr-xgr-utils/python/utils/gr_plot_const21
-rwxr-xr-xgr-utils/python/utils/gr_plot_float6
-rwxr-xr-xgr-utils/python/utils/gr_plot_int4
-rwxr-xr-xgr-utils/python/utils/gr_plot_iq19
-rwxr-xr-xgr-utils/python/utils/gr_plot_qt26
-rwxr-xr-xgr-utils/python/utils/gr_plot_short6
-rw-r--r--gr-utils/python/utils/gr_read_file_metadata8
-rw-r--r--gr-utils/python/utils/plot_data.py22
-rw-r--r--[-rwxr-xr-x]gr-utils/python/utils/plot_fft_base.py35
-rw-r--r--[-rwxr-xr-x]gr-utils/python/utils/plot_psd_base.py35
-rw-r--r--gr-utils/python/utils/pyqt_filter.py1
-rw-r--r--gr-utils/python/utils/pyqt_plot.py1
-rw-r--r--gr-video-sdl/grc/CMakeLists.txt4
-rw-r--r--gr-video-sdl/grc/video.tree.yml3
-rw-r--r--gr-video-sdl/grc/video_block_tree.xml13
-rw-r--r--gr-video-sdl/grc/video_sdl_sink.block.yml61
-rw-r--r--gr-video-sdl/grc/video_sdl_sink.xml86
-rw-r--r--gr-video-sdl/python/video_sdl/CMakeLists.txt2
-rw-r--r--gr-video-sdl/python/video_sdl/__init__.py1
-rw-r--r--[-rwxr-xr-x]gr-video-sdl/python/video_sdl/qa_video_sdl.py1
-rw-r--r--[-rwxr-xr-x]gr-vocoder/examples/alaw_audio_loopback.py6
-rw-r--r--[-rwxr-xr-x]gr-vocoder/examples/codec2_audio_loopback.py6
-rw-r--r--[-rwxr-xr-x]gr-vocoder/examples/cvsd_audio_loopback.py6
-rw-r--r--[-rwxr-xr-x]gr-vocoder/examples/g721_audio_loopback.py6
-rw-r--r--[-rwxr-xr-x]gr-vocoder/examples/g723_24_audio_loopback.py6
-rw-r--r--[-rwxr-xr-x]gr-vocoder/examples/g723_40_audio_loopback.py6
-rw-r--r--[-rwxr-xr-x]gr-vocoder/examples/gsm_audio_loopback.py6
-rw-r--r--[-rwxr-xr-x]gr-vocoder/examples/ulaw_audio_loopback.py6
-rw-r--r--gr-vocoder/grc/CMakeLists.txt41
-rw-r--r--gr-vocoder/grc/vocoder.tree.yml22
-rw-r--r--gr-vocoder/grc/vocoder_alaw_decode_bs.block.yml16
-rw-r--r--gr-vocoder/grc/vocoder_alaw_decode_bs.xml20
-rw-r--r--gr-vocoder/grc/vocoder_alaw_encode_sb.block.yml16
-rw-r--r--gr-vocoder/grc/vocoder_alaw_encode_sb.xml22
-rw-r--r--gr-vocoder/grc/vocoder_block_tree.xml54
-rw-r--r--gr-vocoder/grc/vocoder_codec2_decode_ps.block.yml30
-rw-r--r--gr-vocoder/grc/vocoder_codec2_decode_ps.xml60
-rw-r--r--gr-vocoder/grc/vocoder_codec2_encode_sp.block.yml30
-rw-r--r--gr-vocoder/grc/vocoder_codec2_encode_sp.xml61
-rw-r--r--gr-vocoder/grc/vocoder_cvsd_decode.block.yml26
-rw-r--r--gr-vocoder/grc/vocoder_cvsd_decode.xml32
-rw-r--r--gr-vocoder/grc/vocoder_cvsd_decode_bs.block.yml16
-rw-r--r--gr-vocoder/grc/vocoder_cvsd_decode_bs.xml21
-rw-r--r--gr-vocoder/grc/vocoder_cvsd_encode.block.yml26
-rw-r--r--gr-vocoder/grc/vocoder_cvsd_encode.xml32
-rw-r--r--gr-vocoder/grc/vocoder_cvsd_encode_sb.block.yml16
-rw-r--r--gr-vocoder/grc/vocoder_cvsd_encode_sb.xml22
-rw-r--r--gr-vocoder/grc/vocoder_freedv_rx_ss.block.yml33
-rw-r--r--gr-vocoder/grc/vocoder_freedv_rx_ss.xml58
-rw-r--r--gr-vocoder/grc/vocoder_freedv_tx_ss.block.yml31
-rw-r--r--gr-vocoder/grc/vocoder_freedv_tx_ss.xml57
-rw-r--r--gr-vocoder/grc/vocoder_g721_decode_bs.block.yml16
-rw-r--r--gr-vocoder/grc/vocoder_g721_decode_bs.xml20
-rw-r--r--gr-vocoder/grc/vocoder_g721_encode_sb.block.yml16
-rw-r--r--gr-vocoder/grc/vocoder_g721_encode_sb.xml22
-rw-r--r--gr-vocoder/grc/vocoder_g723_24_decode_bs.block.yml16
-rw-r--r--gr-vocoder/grc/vocoder_g723_24_decode_bs.xml20
-rw-r--r--gr-vocoder/grc/vocoder_g723_24_encode_sb.block.yml16
-rw-r--r--gr-vocoder/grc/vocoder_g723_24_encode_sb.xml22
-rw-r--r--gr-vocoder/grc/vocoder_g723_40_decode_bs.block.yml16
-rw-r--r--gr-vocoder/grc/vocoder_g723_40_decode_bs.xml20
-rw-r--r--gr-vocoder/grc/vocoder_g723_40_encode_sb.block.yml16
-rw-r--r--gr-vocoder/grc/vocoder_g723_40_encode_sb.xml22
-rw-r--r--gr-vocoder/grc/vocoder_gsm_fr_decode_ps.block.yml17
-rw-r--r--gr-vocoder/grc/vocoder_gsm_fr_decode_ps.xml21
-rw-r--r--gr-vocoder/grc/vocoder_gsm_fr_encode_sp.block.yml17
-rw-r--r--gr-vocoder/grc/vocoder_gsm_fr_encode_sp.xml23
-rw-r--r--gr-vocoder/grc/vocoder_ulaw_decode_bs.block.yml16
-rw-r--r--gr-vocoder/grc/vocoder_ulaw_decode_bs.xml20
-rw-r--r--gr-vocoder/grc/vocoder_ulaw_encode_sb.block.yml16
-rw-r--r--gr-vocoder/grc/vocoder_ulaw_encode_sb.xml22
-rw-r--r--gr-vocoder/python/vocoder/CMakeLists.txt2
-rw-r--r--gr-vocoder/python/vocoder/__init__.py9
-rw-r--r--gr-vocoder/python/vocoder/cvsd.py19
-rw-r--r--[-rwxr-xr-x]gr-vocoder/python/vocoder/qa_alaw_vocoder.py1
-rw-r--r--[-rwxr-xr-x]gr-vocoder/python/vocoder/qa_codec2_vocoder.py1
-rw-r--r--[-rwxr-xr-x]gr-vocoder/python/vocoder/qa_cvsd_vocoder.py1
-rw-r--r--[-rwxr-xr-x]gr-vocoder/python/vocoder/qa_g721_vocoder.py1
-rw-r--r--[-rwxr-xr-x]gr-vocoder/python/vocoder/qa_g723_24_vocoder.py1
-rw-r--r--[-rwxr-xr-x]gr-vocoder/python/vocoder/qa_g723_40_vocoder.py1
-rw-r--r--[-rwxr-xr-x]gr-vocoder/python/vocoder/qa_gsm_full_rate.py1
-rw-r--r--[-rwxr-xr-x]gr-vocoder/python/vocoder/qa_ulaw_vocoder.py1
-rw-r--r--gr-wavelet/python/wavelet/CMakeLists.txt2
-rw-r--r--gr-wavelet/python/wavelet/__init__.py5
-rw-r--r--[-rwxr-xr-x]gr-wavelet/python/wavelet/qa_classify.py18
-rw-r--r--[-rwxr-xr-x]gr-zeromq/examples/python/client.py10
-rw-r--r--[-rwxr-xr-x]gr-zeromq/examples/python/gui.py3
-rw-r--r--[-rwxr-xr-x]gr-zeromq/examples/python/server.py10
-rw-r--r--gr-zeromq/grc/CMakeLists.txt24
-rw-r--r--gr-zeromq/grc/zeromq_pub_msg_sink.block.yml23
-rw-r--r--gr-zeromq/grc/zeromq_pub_msg_sink.xml28
-rw-r--r--gr-zeromq/grc/zeromq_pub_sink.block.yml48
-rw-r--r--gr-zeromq/grc/zeromq_pub_sink.xml89
-rw-r--r--gr-zeromq/grc/zeromq_pull_msg_source.block.yml23
-rw-r--r--gr-zeromq/grc/zeromq_pull_msg_source.xml28
-rw-r--r--gr-zeromq/grc/zeromq_pull_source.block.yml48
-rw-r--r--gr-zeromq/grc/zeromq_pull_source.xml89
-rw-r--r--gr-zeromq/grc/zeromq_push_msg_sink.block.yml23
-rw-r--r--gr-zeromq/grc/zeromq_push_msg_sink.xml28
-rw-r--r--gr-zeromq/grc/zeromq_push_sink.block.yml48
-rw-r--r--gr-zeromq/grc/zeromq_push_sink.xml89
-rw-r--r--gr-zeromq/grc/zeromq_rep_msg_sink.block.yml23
-rw-r--r--gr-zeromq/grc/zeromq_rep_msg_sink.xml28
-rw-r--r--gr-zeromq/grc/zeromq_rep_sink.block.yml49
-rw-r--r--gr-zeromq/grc/zeromq_rep_sink.xml89
-rw-r--r--gr-zeromq/grc/zeromq_req_msg_source.block.yml23
-rw-r--r--gr-zeromq/grc/zeromq_req_msg_source.xml28
-rw-r--r--gr-zeromq/grc/zeromq_req_source.block.yml48
-rw-r--r--gr-zeromq/grc/zeromq_req_source.xml89
-rw-r--r--gr-zeromq/grc/zeromq_sub_msg_source.block.yml23
-rw-r--r--gr-zeromq/grc/zeromq_sub_msg_source.xml28
-rw-r--r--gr-zeromq/grc/zeromq_sub_source.block.yml48
-rw-r--r--gr-zeromq/grc/zeromq_sub_source.xml89
-rw-r--r--gr-zeromq/python/zeromq/CMakeLists.txt2
-rw-r--r--gr-zeromq/python/zeromq/__init__.py10
-rw-r--r--gr-zeromq/python/zeromq/probe_manager.py6
-rw-r--r--[-rwxr-xr-x]gr-zeromq/python/zeromq/qa_zeromq_pub.py3
-rw-r--r--[-rwxr-xr-x]gr-zeromq/python/zeromq/qa_zeromq_pubsub.py3
-rw-r--r--[-rwxr-xr-x]gr-zeromq/python/zeromq/qa_zeromq_pushpull.py3
-rw-r--r--[-rwxr-xr-x]gr-zeromq/python/zeromq/qa_zeromq_reqrep.py3
-rwxr-xr-xgr-zeromq/python/zeromq/qa_zeromq_sub.py4
-rw-r--r--gr-zeromq/python/zeromq/rpc_manager.py23
-rw-r--r--grc/CMakeLists.txt92
-rw-r--r--grc/blocks/CMakeLists.txt36
-rw-r--r--grc/blocks/block_tree.xml30
-rw-r--r--grc/blocks/bus_sink.xml27
-rw-r--r--grc/blocks/bus_source.xml27
-rw-r--r--grc/blocks/bus_structure_sink.xml18
-rw-r--r--grc/blocks/bus_structure_source.xml18
-rw-r--r--grc/blocks/dummy.xml11
-rw-r--r--grc/blocks/epy_block.xml58
-rw-r--r--grc/blocks/epy_module.xml32
-rw-r--r--grc/blocks/gr_message_domain.xml19
-rw-r--r--grc/blocks/gr_stream_domain.xml18
-rw-r--r--grc/blocks/grc.tree.yml15
-rw-r--r--grc/blocks/import.block.yml20
-rw-r--r--grc/blocks/import.xml26
-rw-r--r--grc/blocks/message.domain.yml10
-rw-r--r--grc/blocks/note.block.yml9
-rw-r--r--grc/blocks/note.xml17
-rw-r--r--grc/blocks/options.block.yml146
-rw-r--r--grc/blocks/options.xml250
-rw-r--r--grc/blocks/pad_sink.block.yml51
-rw-r--r--grc/blocks/pad_sink.xml103
-rw-r--r--grc/blocks/pad_source.block.yml51
-rw-r--r--grc/blocks/pad_source.xml104
-rw-r--r--grc/blocks/parameter.block.yml55
-rw-r--r--grc/blocks/parameter.xml116
-rw-r--r--grc/blocks/stream.domain.yml10
-rw-r--r--grc/blocks/variable.block.yml19
-rw-r--r--grc/blocks/variable.xml23
-rw-r--r--grc/blocks/variable_config.block.yml58
-rw-r--r--grc/blocks/variable_config.xml88
-rw-r--r--grc/blocks/variable_function_probe.block.yml54
-rw-r--r--grc/blocks/variable_function_probe.xml78
-rw-r--r--grc/blocks/variable_struct.block.yml.py105
-rw-r--r--grc/blocks/variable_struct.xml.py97
-rw-r--r--grc/blocks/virtual_sink.xml21
-rw-r--r--grc/blocks/virtual_source.xml21
-rwxr-xr-xgrc/compiler.py6
-rw-r--r--grc/converter/__init__.py20
-rw-r--r--grc/converter/__main__.py21
-rw-r--r--grc/converter/block.dtd (renamed from grc/core/block.dtd)0
-rw-r--r--grc/converter/block.py219
-rw-r--r--grc/converter/block_tree.dtd (renamed from grc/core/block_tree.dtd)0
-rw-r--r--grc/converter/block_tree.py56
-rw-r--r--grc/converter/cheetah_converter.py277
-rw-r--r--grc/converter/flow_graph.dtd38
-rw-r--r--grc/converter/flow_graph.py131
-rw-r--r--grc/converter/main.py165
-rw-r--r--grc/converter/xml.py82
-rw-r--r--grc/core/Block.py852
-rw-r--r--grc/core/CMakeLists.txt35
-rw-r--r--grc/core/Config.py32
-rw-r--r--grc/core/Connection.py155
-rw-r--r--grc/core/Constants.py121
-rw-r--r--grc/core/Element.py114
-rw-r--r--grc/core/FlowGraph.py450
-rw-r--r--grc/core/Messages.py7
-rw-r--r--grc/core/Param.py691
-rw-r--r--grc/core/ParseXML.py69
-rw-r--r--grc/core/Platform.py309
-rw-r--r--grc/core/Port.py414
-rw-r--r--grc/core/base.py164
-rw-r--r--grc/core/blocks/__init__.py38
-rw-r--r--grc/core/blocks/_build.py135
-rw-r--r--grc/core/blocks/_flags.py39
-rw-r--r--grc/core/blocks/_templates.py77
-rw-r--r--grc/core/blocks/block.py359
-rw-r--r--grc/core/blocks/dummy.py54
-rw-r--r--grc/core/blocks/embedded_python.py242
-rw-r--r--grc/core/blocks/virtual.py76
-rw-r--r--grc/core/cache.py99
-rw-r--r--grc/core/default_flow_graph.grc71
-rw-r--r--grc/core/errors.py30
-rw-r--r--grc/core/generator/CMakeLists.txt30
-rw-r--r--grc/core/generator/FlowGraphProxy.py80
-rw-r--r--grc/core/generator/Generator.py354
-rw-r--r--grc/core/generator/__init__.py3
-rw-r--r--grc/core/generator/flow_graph.py.mako415
-rw-r--r--grc/core/generator/flow_graph.tmpl475
-rw-r--r--grc/core/generator/hier_block.py193
-rw-r--r--grc/core/generator/top_block.py284
-rw-r--r--grc/core/io/__init__.py16
-rw-r--r--grc/core/io/yaml.py91
-rw-r--r--grc/core/params/__init__.py18
-rw-r--r--grc/core/params/dtypes.py103
-rw-r--r--grc/core/params/param.py407
-rw-r--r--grc/core/params/template_arg.py50
-rw-r--r--grc/core/platform.py421
-rw-r--r--grc/core/ports/__init__.py (renamed from grc/core/domain.dtd)28
-rw-r--r--grc/core/ports/_virtual_connections.py126
-rw-r--r--grc/core/ports/clone.py38
-rw-r--r--grc/core/ports/port.py207
-rw-r--r--grc/core/schema_checker/__init__.py5
-rw-r--r--grc/core/schema_checker/block.py57
-rw-r--r--grc/core/schema_checker/domain.py16
-rw-r--r--grc/core/schema_checker/flow_graph.py23
-rw-r--r--grc/core/schema_checker/utils.py27
-rw-r--r--grc/core/schema_checker/validator.py102
-rw-r--r--grc/core/utils/__init__.py22
-rw-r--r--grc/core/utils/backports/__init__.py (renamed from grc/core/utils/CMakeLists.txt)12
-rw-r--r--grc/core/utils/backports/chainmap.py106
-rw-r--r--grc/core/utils/backports/shlex.py (renamed from grc/core/utils/shlex.py)0
-rw-r--r--grc/core/utils/complexity.py49
-rw-r--r--grc/core/utils/descriptors/__init__.py26
-rw-r--r--grc/core/utils/descriptors/_lazy.py39
-rw-r--r--grc/core/utils/descriptors/evaluated.py117
-rw-r--r--grc/core/utils/epy_block_io.py11
-rw-r--r--grc/core/utils/expr_utils.py175
-rw-r--r--grc/core/utils/extract_docs.py34
-rw-r--r--grc/core/utils/flow_graph_complexity.py54
-rw-r--r--grc/core/utils/hide_bokeh_gui_options_if_not_installed.py13
-rw-r--r--grc/core/utils/odict.py115
-rw-r--r--grc/gui/Actions.py645
-rw-r--r--grc/gui/Application.py (renamed from grc/gui/ActionHandler.py)653
-rw-r--r--grc/gui/Bars.py529
-rw-r--r--grc/gui/Block.py350
-rw-r--r--grc/gui/BlockTreeWindow.py219
-rw-r--r--grc/gui/CMakeLists.txt32
-rw-r--r--grc/gui/Colors.py50
-rw-r--r--grc/gui/Config.py156
-rw-r--r--grc/gui/Connection.py181
-rw-r--r--grc/gui/Console.py57
-rw-r--r--grc/gui/Constants.py37
-rw-r--r--grc/gui/Dialogs.py458
-rw-r--r--grc/gui/DrawingArea.py253
-rw-r--r--grc/gui/Element.py278
-rw-r--r--grc/gui/Executor.py24
-rw-r--r--grc/gui/FileDialogs.py293
-rw-r--r--grc/gui/FlowGraph.py765
-rw-r--r--grc/gui/MainWindow.py321
-rw-r--r--grc/gui/Notebook.py187
-rw-r--r--grc/gui/NotebookPage.py244
-rw-r--r--grc/gui/Param.py442
-rw-r--r--grc/gui/ParamWidgets.py330
-rw-r--r--grc/gui/ParserErrorsDialog.py36
-rw-r--r--grc/gui/Platform.py48
-rw-r--r--grc/gui/Port.py277
-rw-r--r--grc/gui/Preferences.py173
-rw-r--r--grc/gui/PropsDialog.py260
-rw-r--r--grc/gui/StateCache.py9
-rw-r--r--grc/gui/Utils.py141
-rw-r--r--grc/gui/VariableEditor.py183
-rw-r--r--grc/gui/canvas/__init__.py22
-rw-r--r--grc/gui/canvas/block.py400
-rw-r--r--grc/gui/canvas/colors.py78
-rw-r--r--grc/gui/canvas/connection.py253
-rw-r--r--grc/gui/canvas/drawable.py183
-rw-r--r--grc/gui/canvas/flowgraph.py772
-rw-r--r--grc/gui/canvas/param.py162
-rw-r--r--grc/gui/canvas/port.py227
-rw-r--r--grc/gui/external_editor.py9
-rwxr-xr-xgrc/main.py58
-rwxr-xr-xgrc/scripts/gnuradio-companion23
-rw-r--r--grc/tests/__init__.py0
-rw-r--r--grc/tests/resources/file1.block.yml38
-rw-r--r--grc/tests/resources/file2.block.yml31
-rw-r--r--grc/tests/resources/file3.block.yml66
-rw-r--r--grc/tests/test_block_flags.py26
-rw-r--r--grc/tests/test_block_templates.py45
-rw-r--r--grc/tests/test_cheetah_converter.py132
-rw-r--r--grc/tests/test_evaled_property.py104
-rw-r--r--grc/tests/test_expr_utils.py41
-rw-r--r--grc/tests/test_generator.py46
-rw-r--r--grc/tests/test_xml_parser.py (renamed from grc/core/Element.pyi)41
-rw-r--r--grc/tests/test_yaml_checker.py84
m---------volk0
1702 files changed, 43270 insertions, 57090 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9ca5f4f3f..48e0adc21 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -218,11 +218,10 @@ if(MSVC)
endif(MSVC)
if(WIN32)
- add_definitions(-D_USE_MATH_DEFINES)
-
- if (CMAKE_SIZEOF_VOID_P EQUAL 8)
- add_definitions(-DMS_WIN64)
- endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ add_definitions(-D_USE_MATH_DEFINES)
+ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
+ add_definitions(-DMS_WIN64)
+ endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
endif(WIN32)
# Record Compiler Info for record
@@ -355,7 +354,9 @@ include(GrBoost)
########################################################################
# Enable python component
########################################################################
+include(GrPython)
find_package(PythonLibs ${GR_PYTHON_MIN_VERSION})
+GR_PYTHON_CHECK_MODULE("six - python 2 and 3 compatibility library" six "True" SIX_FOUND)
find_package(SWIG)
if(SWIG_FOUND)
@@ -371,6 +372,7 @@ GR_REGISTER_COMPONENT("python-support" ENABLE_PYTHON
PYTHONLIBS_FOUND
SWIG_FOUND
SWIG_VERSION_CHECK
+ SIX_FOUND
)
find_package(CppUnit ${GR_CPPUNIT_MIN_VERSION})
diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake
index 79bb70c03..6f0c8ac27 100644
--- a/cmake/Modules/GrMiscUtils.cmake
+++ b/cmake/Modules/GrMiscUtils.cmake
@@ -339,7 +339,7 @@ if __name__ == '__main__':
add_custom_command(
OUTPUT ${expanded_files_h}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ COMMAND ${PYTHON_EXECUTABLE} -B
${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
${root} ${root}.h.t ${ARGN}
)
@@ -384,7 +384,7 @@ if __name__ == '__main__':
add_custom_command(
OUTPUT ${expanded_files_cc}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ COMMAND ${PYTHON_EXECUTABLE} -B
${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
${root} ${root}.cc.t ${ARGN}
)
@@ -393,7 +393,7 @@ if __name__ == '__main__':
add_custom_command(
OUTPUT ${expanded_files_h}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ COMMAND ${PYTHON_EXECUTABLE} -B
${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
${root} ${root}.h.t ${ARGN}
)
@@ -446,7 +446,7 @@ if __name__ == '__main__':
add_custom_command(
OUTPUT ${expanded_files_cc_impl}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.cc.t
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ COMMAND ${PYTHON_EXECUTABLE} -B
${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
${root} ${root}_impl.cc.t ${ARGN}
)
@@ -455,7 +455,7 @@ if __name__ == '__main__':
add_custom_command(
OUTPUT ${expanded_files_h_impl}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.h.t
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ COMMAND ${PYTHON_EXECUTABLE} -B
${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
${root} ${root}_impl.h.t ${ARGN}
)
diff --git a/cmake/Modules/GrPython.cmake b/cmake/Modules/GrPython.cmake
index 0bfa92db8..49a351d3a 100644
--- a/cmake/Modules/GrPython.cmake
+++ b/cmake/Modules/GrPython.cmake
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Free Software Foundation, Inc.
+# Copyright 2010-2016 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -27,26 +27,21 @@ set(__INCLUDED_GR_PYTHON_CMAKE TRUE)
# This allows the user to specify a specific interpreter,
# or finds the interpreter via the built-in cmake module.
########################################################################
-#this allows the user to override PYTHON_EXECUTABLE
-if(PYTHON_EXECUTABLE)
- set(PYTHONINTERP_FOUND TRUE)
+if (PYTHON_EXECUTABLE)
+ message(STATUS "User set python executable ${PYTHON_EXECUTABLE}")
+ find_package(PythonInterp ${GR_PYTHON_MIN_VERSION} REQUIRED)
+else (PYTHON_EXECUTABLE)
+ message(STATUS "PYTHON_EXECUTABLE not set - using default python3")
+ message(STATUS "Use -DPYTHON_EXECUTABLE=/path/to/python2 to build for python2.")
+ find_package(PythonInterp ${GR_PYTHON3_MIN_VERSION} REQUIRED)
+endif (PYTHON_EXECUTABLE)
-#otherwise if not set, try to automatically find it
-else(PYTHON_EXECUTABLE)
+if (${PYTHON_VERSION_MAJOR} VERSION_EQUAL 3)
+ set(PYTHON3 TRUE)
+endif ()
- #use the built-in find script
- find_package(PythonInterp 2)
-
- #and if that fails use the find program routine
- if(NOT PYTHONINTERP_FOUND)
- find_program(PYTHON_EXECUTABLE NAMES python python2 python2.7 python2.6 python2.5)
- if(PYTHON_EXECUTABLE)
- set(PYTHONINTERP_FOUND TRUE)
- endif(PYTHON_EXECUTABLE)
- endif(NOT PYTHONINTERP_FOUND)
-
-endif(PYTHON_EXECUTABLE)
+find_package(PythonLibs ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} EXACT)
if (CMAKE_CROSSCOMPILING)
set(QA_PYTHON_EXECUTABLE "/usr/bin/python")
@@ -58,18 +53,6 @@ endif(CMAKE_CROSSCOMPILING)
set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter")
set(QA_PYTHON_EXECUTABLE ${QA_PYTHON_EXECUTABLE} CACHE FILEPATH "python interpreter for QA tests")
-#make sure we can use -B with python (introduced in 2.6)
-if(PYTHON_EXECUTABLE)
- execute_process(
- COMMAND ${PYTHON_EXECUTABLE} -B -c ""
- OUTPUT_QUIET ERROR_QUIET
- RESULT_VARIABLE PYTHON_HAS_DASH_B_RESULT
- )
- if(PYTHON_HAS_DASH_B_RESULT EQUAL 0)
- set(PYTHON_DASH_B "-B")
- endif()
-endif(PYTHON_EXECUTABLE)
-
########################################################################
# Check for the existence of a python module:
# - desc a string description of the check
@@ -77,27 +60,32 @@ endif(PYTHON_EXECUTABLE)
# - cmd an additional command to run
# - have the result variable to set
########################################################################
-macro(GR_PYTHON_CHECK_MODULE desc mod cmd have)
- message(STATUS "")
- message(STATUS "Python checking for ${desc}")
+macro(GR_PYTHON_CHECK_MODULE_RAW desc python_code have)
execute_process(
- COMMAND ${PYTHON_EXECUTABLE} -c "
+ COMMAND ${PYTHON_EXECUTABLE} -c "${python_code}"
+ OUTPUT_QUIET ERROR_QUIET
+ RESULT_VARIABLE return_code
+ )
+ if(return_code EQUAL 0)
+ message(STATUS "Python checking for ${desc} - found")
+ set(${have} TRUE)
+ else()
+ message(STATUS "Python checking for ${desc} - not found")
+ set(${have} FALSE)
+ endif()
+endmacro(GR_PYTHON_CHECK_MODULE_RAW)
+
+macro(GR_PYTHON_CHECK_MODULE desc mod cmd have)
+ GR_PYTHON_CHECK_MODULE_RAW(
+ "${desc}" "
#########################################
try:
import ${mod}
assert ${cmd}
-except ImportError, AssertionError: exit(-1)
+except (ImportError, AssertionError): exit(-1)
except: pass
#########################################"
- RESULT_VARIABLE ${have}
- )
- if(${have} EQUAL 0)
- message(STATUS "Python checking for ${desc} - found")
- set(${have} TRUE)
- else(${have} EQUAL 0)
- message(STATUS "Python checking for ${desc} - not found")
- set(${have} FALSE)
- endif(${have} EQUAL 0)
+ "${have}")
endmacro(GR_PYTHON_CHECK_MODULE)
########################################################################
@@ -105,8 +93,12 @@ endmacro(GR_PYTHON_CHECK_MODULE)
########################################################################
if(NOT DEFINED GR_PYTHON_DIR)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "
-from distutils import sysconfig
-print sysconfig.get_python_lib(plat_specific=True, prefix='')
+import os
+import sys
+if os.name == 'posix':
+ print(os.path.join('lib', 'python' + sys.version[:3], 'dist-packages'))
+if os.name == 'nt':
+ print(os.path.join('Lib', 'site-packages'))
" OUTPUT_VARIABLE GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
@@ -119,7 +111,7 @@ file(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR)
function(GR_UNIQUE_TARGET desc)
file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib
-unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5]
+unique = hashlib.md5(b'${reldir}${ARGN}').hexdigest()[:5]
print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))"
OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE)
add_custom_target(${_target} ALL DEPENDS ${ARGN})
@@ -130,7 +122,7 @@ endfunction(GR_UNIQUE_TARGET)
########################################################################
function(GR_PYTHON_INSTALL)
include(CMakeParseArgumentsCopy)
- CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION" "FILES;PROGRAMS" ${ARGN})
+ CMAKE_PARSE_ARGUMENTS(GR_PYTHON_INSTALL "" "DESTINATION" "FILES;PROGRAMS;DIRECTORY" ${ARGN})
####################################################################
if(GR_PYTHON_INSTALL_FILES)
@@ -185,6 +177,80 @@ function(GR_PYTHON_INSTALL)
)
####################################################################
+ elseif(GR_PYTHON_INSTALL_DIRECTORY)
+ ####################################################################
+ install(${ARGN}) #installs regular python files
+
+ # collect all python files in given directories
+ # #############################################
+ unset(pysrcfiles)
+ foreach(pydir ${GR_PYTHON_INSTALL_DIRECTORY})
+ file(GLOB_RECURSE pysrcfiles_tmp "${pydir}/*.py")
+ list(APPEND pysrcfiles ${pysrcfiles_tmp})
+ endforeach(pydir)
+
+ # build target lists
+ # ##################
+ unset(pycfiles) # pyc targets
+ unset(pyofiles) # pyo targets
+ unset(pygen_paths) # all paths of py[oc] targets
+ foreach(pyfile ${pysrcfiles})
+ # determine if this file is in the source or binary directory
+ file(RELATIVE_PATH source_rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${pyfile})
+ string(LENGTH "${source_rel_path}" source_rel_path_len)
+ file(RELATIVE_PATH binary_rel_path ${CMAKE_CURRENT_BINARY_DIR} ${pyfile})
+ string(LENGTH "${binary_rel_path}" binary_rel_path_len)
+
+ # and set the generated path appropriately
+ if(${source_rel_path_len} GREATER ${binary_rel_path_len})
+ set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${binary_rel_path})
+ else()
+ set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${source_rel_path})
+ endif()
+ list(APPEND pycfiles "${pygenfile}c")
+ list(APPEND pyofiles "${pygenfile}o")
+
+ get_filename_component(pygen_path "${pygenfile}" DIRECTORY)
+ list(APPEND pygen_paths "${pygen_path}")
+ file(MAKE_DIRECTORY "${pygen_path}")
+ endforeach(pyfile)
+ list(REMOVE_DUPLICATES pygen_paths)
+ list(SORT pygen_paths)
+
+ # generate the py[oc] files
+ # #########################
+ add_custom_command(
+ DEPENDS ${pysrcfiles} OUTPUT ${pycfiles}
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pycfiles}
+ )
+ add_custom_command(
+ DEPENDS ${pysrcfiles} OUTPUT ${pyofiles}
+ COMMAND ${PYTHON_EXECUTABLE} -O ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pyofiles}
+ )
+ set(python_install_gen_targets ${pycfiles} ${pyofiles})
+
+ # per-directory install rules
+ # ###########################
+ foreach(pygen_path ${pygen_paths})
+ # find all targets in that directory (no "list(FILTER ...)")
+ unset(pygen_path_targets)
+ foreach(pyget_target ${python_install_gen_targets})
+ get_filename_component(pyget_target_path "${pyget_target}" PATH)
+ if(pygen_path STREQUAL pyget_target_path)
+ list(APPEND pygen_path_targets "${pyget_target}")
+ endif()
+ endforeach(pyget_target)
+
+ # install relative to current binary dir
+ file(RELATIVE_PATH pygen_path_rel "${CMAKE_CURRENT_BINARY_DIR}" "${pygen_path}")
+ list(SORT pygen_path_targets)
+ install(
+ FILES ${pygen_path_targets}
+ DESTINATION "${GR_PYTHON_INSTALL_DESTINATION}/${pygen_path_rel}"
+ )
+ endforeach(pygen_path)
+
+ ####################################################################
elseif(GR_PYTHON_INSTALL_PROGRAMS)
####################################################################
file(TO_NATIVE_PATH ${PYTHON_EXECUTABLE} pyexe_native)
@@ -233,7 +299,7 @@ endfunction(GR_PYTHON_INSTALL)
file(WRITE ${CMAKE_BINARY_DIR}/python_compile_helper.py "
import sys, py_compile
files = sys.argv[1:]
-srcs, gens = files[:len(files)/2], files[len(files)/2:]
+srcs, gens = files[:len(files)//2], files[len(files)//2:]
for src, gen in zip(srcs, gens):
py_compile.compile(file=src, cfile=gen, doraise=True)
")
diff --git a/cmake/Modules/GrSwig.cmake b/cmake/Modules/GrSwig.cmake
index 0115c4da9..87d5e60d8 100644
--- a/cmake/Modules/GrSwig.cmake
+++ b/cmake/Modules/GrSwig.cmake
@@ -76,7 +76,7 @@ function(GR_SWIG_MAKE_DOCS output_file)
add_custom_command(
OUTPUT ${output_file}
DEPENDS ${input_files} ${stamp-file} ${OUTPUT_DIRECTORY}/xml/index.xml
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ COMMAND ${PYTHON_EXECUTABLE} -B
${CMAKE_SOURCE_DIR}/docs/doxygen/swig_doc.py
${OUTPUT_DIRECTORY}/xml
${output_file}
@@ -146,7 +146,6 @@ macro(GR_SWIG_MAKE name)
endif()
#append additional include directories
- find_package(PythonLibs 2)
list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH}) #deprecated name (now dirs)
list(APPEND GR_SWIG_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
@@ -178,8 +177,12 @@ macro(GR_SWIG_MAKE name)
include_directories(${GR_SWIG_INCLUDE_DIRS})
list(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${tag_file})
+ if (PYTHON3)
+ set(py3 "-py3")
+ endif (PYTHON3)
+
#setup the swig flags with flags and include directories
- set(CMAKE_SWIG_FLAGS -fvirtual -modern -keyword -w511 -w314 -module ${name} ${GR_SWIG_FLAGS})
+ set(CMAKE_SWIG_FLAGS -fvirtual -modern -keyword -w511 -w314 -relativeimport ${py3} -module ${name} ${GR_SWIG_FLAGS})
#set the C++ property on the swig .i file so it builds
set_source_files_properties(${ifiles} PROPERTIES CPLUSPLUS ON)
@@ -238,7 +241,7 @@ endmacro(GR_SWIG_INSTALL)
########################################################################
file(WRITE ${CMAKE_BINARY_DIR}/get_swig_deps.py "
-import os, sys, re
+import os, sys, re, io
i_include_matcher = re.compile('%(include|import)\\s*[<|\"](.*)[>|\"]')
h_include_matcher = re.compile('#(include)\\s*[<|\"](.*)[>|\"]')
@@ -247,7 +250,7 @@ include_dirs = sys.argv[2].split(';')
def get_swig_incs(file_path):
if file_path.endswith('.i'): matcher = i_include_matcher
else: matcher = h_include_matcher
- file_contents = open(file_path, 'r').read()
+ file_contents = io.open(file_path, 'r', encoding='utf-8').read()
return matcher.findall(file_contents, re.MULTILINE)
def get_swig_deps(file_path, level):
diff --git a/cmake/Modules/UseSWIG.cmake b/cmake/Modules/UseSWIG.cmake
index e55543532..a37cc41ae 100644
--- a/cmake/Modules/UseSWIG.cmake
+++ b/cmake/Modules/UseSWIG.cmake
@@ -176,7 +176,7 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib
-unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5]
+unique = hashlib.md5(b'${reldir}${ARGN}').hexdigest()[:5]
print(re.sub('\\W', '_', '${name} ${reldir} ' + unique))"
OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE
)
diff --git a/docs/doxygen/doxyxml/__init__.py b/docs/doxygen/doxyxml/__init__.py
index 5cd0b3c6c..b7a888451 100644
--- a/docs/doxygen/doxyxml/__init__.py
+++ b/docs/doxygen/doxyxml/__init__.py
@@ -63,8 +63,9 @@ This line is uninformative and is only to test line breaks in the comments.
u'Outputs the vital aadvark statistics.'
"""
+from __future__ import unicode_literals
-from doxyindex import DoxyIndex, DoxyFunction, DoxyParam, DoxyClass, DoxyFile, DoxyNamespace, DoxyGroup, DoxyFriend, DoxyOther
+from .doxyindex import DoxyIndex, DoxyFunction, DoxyParam, DoxyClass, DoxyFile, DoxyNamespace, DoxyGroup, DoxyFriend, DoxyOther
def _test():
import os
diff --git a/docs/doxygen/doxyxml/base.py b/docs/doxygen/doxyxml/base.py
index e8f026ab9..f6f2b8e19 100644
--- a/docs/doxygen/doxyxml/base.py
+++ b/docs/doxygen/doxyxml/base.py
@@ -25,23 +25,26 @@ Classes based upon this are used to make more user-friendly interfaces
to the doxygen xml docs than the generated classes provide.
"""
+from __future__ import print_function
+from __future__ import unicode_literals
+
import os
import pdb
from xml.parsers.expat import ExpatError
-from generated import compound
+from .generated import compound
class Base(object):
- class Duplicate(StandardError):
+ class Duplicate(Exception):
pass
- class NoSuchMember(StandardError):
+ class NoSuchMember(Exception):
pass
- class ParsingError(StandardError):
+ class ParsingError(Exception):
pass
def __init__(self, parse_data, top=None):
@@ -94,7 +97,7 @@ class Base(object):
for cls in self.mem_classes:
if cls.can_parse(mem):
return cls
- raise StandardError(("Did not find a class for object '%s'." \
+ raise Exception(("Did not find a class for object '%s'." \
% (mem.get_name())))
def convert_mem(self, mem):
@@ -102,11 +105,11 @@ class Base(object):
cls = self.get_cls(mem)
converted = cls.from_parse_data(mem, self.top)
if converted is None:
- raise StandardError('No class matched this object.')
+ raise Exception('No class matched this object.')
self.add_ref(converted)
return converted
- except StandardError, e:
- print e
+ except Exception as e:
+ print(e)
@classmethod
def includes(cls, inst):
diff --git a/docs/doxygen/doxyxml/doxyindex.py b/docs/doxygen/doxyxml/doxyindex.py
index e03973771..083550bdf 100644
--- a/docs/doxygen/doxyxml/doxyindex.py
+++ b/docs/doxygen/doxyxml/doxyindex.py
@@ -22,12 +22,13 @@
Classes providing more user-friendly interfaces to the doxygen xml
docs than the generated classes provide.
"""
+from __future__ import unicode_literals
import os
-from generated import index
-from base import Base
-from text import description
+from .generated import index
+from .base import Base
+from .text import description
class DoxyIndex(Base):
"""
diff --git a/docs/doxygen/doxyxml/generated/__init__.py b/docs/doxygen/doxyxml/generated/__init__.py
index 39823979f..23095c1f3 100644
--- a/docs/doxygen/doxyxml/generated/__init__.py
+++ b/docs/doxygen/doxyxml/generated/__init__.py
@@ -5,3 +5,4 @@ These do the real work of parsing the doxygen xml files but the
resultant classes are not very friendly to navigate so the rest of the
doxyxml module processes them further.
"""
+from __future__ import unicode_literals
diff --git a/docs/doxygen/doxyxml/generated/compound.py b/docs/doxygen/doxyxml/generated/compound.py
index 1522ac23f..cd3cd1f96 100644
--- a/docs/doxygen/doxyxml/generated/compound.py
+++ b/docs/doxygen/doxyxml/generated/compound.py
@@ -3,15 +3,16 @@
"""
Generated Mon Feb 9 19:08:05 2009 by generateDS.py.
"""
+from __future__ import unicode_literals
+
-from string import lower as str_lower
from xml.dom import minidom
from xml.dom import Node
import sys
-import compoundsuper as supermod
-from compoundsuper import MixedContainer
+from . import compoundsuper as supermod
+from .compoundsuper import MixedContainer
class DoxygenTypeSub(supermod.DoxygenType):
@@ -499,5 +500,3 @@ def parse(inFilename):
rootObj = supermod.DoxygenType.factory()
rootObj.build(rootNode)
return rootObj
-
-
diff --git a/docs/doxygen/doxyxml/generated/compoundsuper.py b/docs/doxygen/doxyxml/generated/compoundsuper.py
index 6255dda16..f18ec6cda 100644
--- a/docs/doxygen/doxyxml/generated/compoundsuper.py
+++ b/docs/doxygen/doxyxml/generated/compoundsuper.py
@@ -4,12 +4,16 @@
# Generated Thu Jun 11 18:44:25 2009 by generateDS.py.
#
+from __future__ import print_function
+from __future__ import unicode_literals
+
import sys
-import getopt
-from string import lower as str_lower
+
from xml.dom import minidom
from xml.dom import Node
+import six
+
#
# User methods
#
@@ -19,9 +23,9 @@ from xml.dom import Node
try:
from generatedssuper import GeneratedsSuper
-except ImportError, exp:
+except ImportError as exp:
- class GeneratedsSuper:
+ class GeneratedsSuper(object):
def format_string(self, input_data, input_name=''):
return input_data
def format_integer(self, input_data, input_name=''):
@@ -64,7 +68,7 @@ def showIndent(outfile, level):
outfile.write(' ')
def quote_xml(inStr):
- s1 = (isinstance(inStr, basestring) and inStr or
+ s1 = (isinstance(inStr, six.string_types) and inStr or
'%s' % inStr)
s1 = s1.replace('&', '&amp;')
s1 = s1.replace('<', '&lt;')
@@ -72,7 +76,7 @@ def quote_xml(inStr):
return s1
def quote_attrib(inStr):
- s1 = (isinstance(inStr, basestring) and inStr or
+ s1 = (isinstance(inStr, six.string_types) and inStr or
'%s' % inStr)
s1 = s1.replace('&', '&amp;')
s1 = s1.replace('<', '&lt;')
@@ -102,7 +106,7 @@ def quote_python(inStr):
return '"""%s"""' % s1
-class MixedContainer:
+class MixedContainer(object):
# Constants for category:
CategoryNone = 0
CategoryText = 1
@@ -4221,7 +4225,7 @@ class codelineType(GeneratedsSuper):
if attrs.get('lineno'):
try:
self.lineno = int(attrs.get('lineno').value)
- except ValueError, exp:
+ except ValueError as exp:
raise ValueError('Bad integer attribute (lineno): %s' % exp)
if attrs.get('refkind'):
self.refkind = attrs.get('refkind').value
@@ -4504,12 +4508,12 @@ class referenceType(GeneratedsSuper):
if attrs.get('endline'):
try:
self.endline = int(attrs.get('endline').value)
- except ValueError, exp:
+ except ValueError as exp:
raise ValueError('Bad integer attribute (endline): %s' % exp)
if attrs.get('startline'):
try:
self.startline = int(attrs.get('startline').value)
- except ValueError, exp:
+ except ValueError as exp:
raise ValueError('Bad integer attribute (startline): %s' % exp)
if attrs.get('refid'):
self.refid = attrs.get('refid').value
@@ -4627,17 +4631,17 @@ class locationType(GeneratedsSuper):
if attrs.get('bodystart'):
try:
self.bodystart = int(attrs.get('bodystart').value)
- except ValueError, exp:
+ except ValueError as exp:
raise ValueError('Bad integer attribute (bodystart): %s' % exp)
if attrs.get('line'):
try:
self.line = int(attrs.get('line').value)
- except ValueError, exp:
+ except ValueError as exp:
raise ValueError('Bad integer attribute (line): %s' % exp)
if attrs.get('bodyend'):
try:
self.bodyend = int(attrs.get('bodyend').value)
- except ValueError, exp:
+ except ValueError as exp:
raise ValueError('Bad integer attribute (bodyend): %s' % exp)
if attrs.get('bodyfile'):
self.bodyfile = attrs.get('bodyfile').value
@@ -6778,12 +6782,12 @@ class docTableType(GeneratedsSuper):
if attrs.get('rows'):
try:
self.rows = int(attrs.get('rows').value)
- except ValueError, exp:
+ except ValueError as exp:
raise ValueError('Bad integer attribute (rows): %s' % exp)
if attrs.get('cols'):
try:
self.cols = int(attrs.get('cols').value)
- except ValueError, exp:
+ except ValueError as exp:
raise ValueError('Bad integer attribute (cols): %s' % exp)
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.ELEMENT_NODE and \
@@ -7108,7 +7112,7 @@ class docHeadingType(GeneratedsSuper):
if attrs.get('level'):
try:
self.level = int(attrs.get('level').value)
- except ValueError, exp:
+ except ValueError as exp:
raise ValueError('Bad integer attribute (level): %s' % exp)
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.TEXT_NODE:
@@ -8283,7 +8287,7 @@ Options:
"""
def usage():
- print USAGE_TEXT
+ print(USAGE_TEXT)
sys.exit(1)
@@ -8339,4 +8343,3 @@ if __name__ == '__main__':
main()
#import pdb
#pdb.run('main()')
-
diff --git a/docs/doxygen/doxyxml/generated/index.py b/docs/doxygen/doxyxml/generated/index.py
index 7a70e14a1..eb9a9048b 100644
--- a/docs/doxygen/doxyxml/generated/index.py
+++ b/docs/doxygen/doxyxml/generated/index.py
@@ -3,14 +3,15 @@
"""
Generated Mon Feb 9 19:08:05 2009 by generateDS.py.
"""
+from __future__ import unicode_literals
from xml.dom import minidom
import os
import sys
-import compound
+from . import compound
-import indexsuper as supermod
+from . import indexsuper as supermod
class DoxygenTypeSub(supermod.DoxygenType):
def __init__(self, version=None, compound=None):
diff --git a/docs/doxygen/doxyxml/generated/indexsuper.py b/docs/doxygen/doxyxml/generated/indexsuper.py
index a99153019..11312db63 100644
--- a/docs/doxygen/doxyxml/generated/indexsuper.py
+++ b/docs/doxygen/doxyxml/generated/indexsuper.py
@@ -4,12 +4,16 @@
# Generated Thu Jun 11 18:43:54 2009 by generateDS.py.
#
+from __future__ import print_function
+from __future__ import unicode_literals
+
import sys
-import getopt
-from string import lower as str_lower
+
from xml.dom import minidom
from xml.dom import Node
+import six
+
#
# User methods
#
@@ -19,9 +23,9 @@ from xml.dom import Node
try:
from generatedssuper import GeneratedsSuper
-except ImportError, exp:
+except ImportError as exp:
- class GeneratedsSuper:
+ class GeneratedsSuper(object):
def format_string(self, input_data, input_name=''):
return input_data
def format_integer(self, input_data, input_name=''):
@@ -64,7 +68,7 @@ def showIndent(outfile, level):
outfile.write(' ')
def quote_xml(inStr):
- s1 = (isinstance(inStr, basestring) and inStr or
+ s1 = (isinstance(inStr, six.string_types) and inStr or
'%s' % inStr)
s1 = s1.replace('&', '&amp;')
s1 = s1.replace('<', '&lt;')
@@ -72,7 +76,7 @@ def quote_xml(inStr):
return s1
def quote_attrib(inStr):
- s1 = (isinstance(inStr, basestring) and inStr or
+ s1 = (isinstance(inStr, six.string_types) and inStr or
'%s' % inStr)
s1 = s1.replace('&', '&amp;')
s1 = s1.replace('<', '&lt;')
@@ -102,7 +106,7 @@ def quote_python(inStr):
return '"""%s"""' % s1
-class MixedContainer:
+class MixedContainer(object):
# Constants for category:
CategoryNone = 0
CategoryText = 1
@@ -462,7 +466,7 @@ Options:
"""
def usage():
- print USAGE_TEXT
+ print(USAGE_TEXT)
sys.exit(1)
@@ -520,4 +524,3 @@ if __name__ == '__main__':
main()
#import pdb
#pdb.run('main()')
-
diff --git a/docs/doxygen/doxyxml/text.py b/docs/doxygen/doxyxml/text.py
index 629edd180..f0322f623 100644
--- a/docs/doxygen/doxyxml/text.py
+++ b/docs/doxygen/doxyxml/text.py
@@ -21,6 +21,7 @@
"""
Utilities for extracting text from generated classes.
"""
+from __future__ import unicode_literals
def is_string(txt):
if isinstance(txt, str):
@@ -49,7 +50,7 @@ def description_bit(obj):
elif is_string(obj):
return obj
else:
- raise StandardError('Expecting a string or something with content, content_ or value attribute')
+ raise Exception('Expecting a string or something with content, content_ or value attribute')
# If this bit is a paragraph then add one some line breaks.
if hasattr(obj, 'name') and obj.name == 'para':
result += "\n\n"
diff --git a/docs/doxygen/other/doxypy.py b/docs/doxygen/other/doxypy.py
index a9af32ab5..e474a9694 100755..100644
--- a/docs/doxygen/other/doxypy.py
+++ b/docs/doxygen/other/doxypy.py
@@ -1,5 +1,8 @@
#!/usr/bin/env python
+from __future__ import print_function
+from __future__ import unicode_literals
+
__applicationName__ = "doxypy"
__blurb__ = """
doxypy is an input filter for Doxygen. It preprocesses python
@@ -11,8 +14,8 @@ __doc__ = __blurb__ + \
"""
In order to make Doxygen preprocess files through doxypy, simply
add the following lines to your Doxyfile:
- FILTER_SOURCE_FILES = YES
- INPUT_FILTER = "python /path/to/doxypy.py"
+ FILTER_SOURCE_FILES = YES
+ INPUT_FILTER = "python /path/to/doxypy.py"
"""
__version__ = "0.4.2"
@@ -20,8 +23,8 @@ __date__ = "5th December 2008"
__website__ = "http://code.foosel.org/doxypy"
__author__ = (
- "Philippe 'demod' Neumann (doxypy at demod dot org)",
- "Gina 'foosel' Haeussge (gina at foosel dot net)"
+ "Philippe 'demod' Neumann (doxypy at demod dot org)",
+ "Gina 'foosel' Haeussge (gina at foosel dot net)"
)
__licenseName__ = "GPL v2"
@@ -45,364 +48,364 @@ import re
from argparse import ArgumentParser
class FSM(object):
- """Implements a finite state machine.
-
- Transitions are given as 4-tuples, consisting of an origin state, a target
- state, a condition for the transition (given as a reference to a function
- which gets called with a given piece of input) and a pointer to a function
- to be called upon the execution of the given transition.
- """
-
- """
- @var transitions holds the transitions
- @var current_state holds the current state
- @var current_input holds the current input
- @var current_transition hold the currently active transition
- """
-
- def __init__(self, start_state=None, transitions=[]):
- self.transitions = transitions
- self.current_state = start_state
- self.current_input = None
- self.current_transition = None
-
- def setStartState(self, state):
- self.current_state = state
-
- def addTransition(self, from_state, to_state, condition, callback):
- self.transitions.append([from_state, to_state, condition, callback])
-
- def makeTransition(self, input):
- """ Makes a transition based on the given input.
-
- @param input input to parse by the FSM
- """
- for transition in self.transitions:
- [from_state, to_state, condition, callback] = transition
- if from_state == self.current_state:
- match = condition(input)
- if match:
- self.current_state = to_state
- self.current_input = input
- self.current_transition = transition
- if args.debug:
- print >>sys.stderr, "# FSM: executing (%s -> %s) for line '%s'" % (from_state, to_state, input)
- callback(match)
- return
+ """Implements a finite state machine.
+
+ Transitions are given as 4-tuples, consisting of an origin state, a target
+ state, a condition for the transition (given as a reference to a function
+ which gets called with a given piece of input) and a pointer to a function
+ to be called upon the execution of the given transition.
+ """
+
+ """
+ @var transitions holds the transitions
+ @var current_state holds the current state
+ @var current_input holds the current input
+ @var current_transition hold the currently active transition
+ """
+
+ def __init__(self, start_state=None, transitions=[]):
+ self.transitions = transitions
+ self.current_state = start_state
+ self.current_input = None
+ self.current_transition = None
+
+ def setStartState(self, state):
+ self.current_state = state
+
+ def addTransition(self, from_state, to_state, condition, callback):
+ self.transitions.append([from_state, to_state, condition, callback])
+
+ def makeTransition(self, input):
+ """ Makes a transition based on the given input.
+
+ @param input input to parse by the FSM
+ """
+ for transition in self.transitions:
+ [from_state, to_state, condition, callback] = transition
+ if from_state == self.current_state:
+ match = condition(input)
+ if match:
+ self.current_state = to_state
+ self.current_input = input
+ self.current_transition = transition
+ if args.debug:
+ print("# FSM: executing (%s -> %s) for line '%s'" % (from_state, to_state, input), file=sys.stderr)
+ callback(match)
+ return
class Doxypy(object):
- def __init__(self):
- string_prefixes = "[uU]?[rR]?"
-
- self.start_single_comment_re = re.compile("^\s*%s(''')" % string_prefixes)
- self.end_single_comment_re = re.compile("(''')\s*$")
-
- self.start_double_comment_re = re.compile("^\s*%s(\"\"\")" % string_prefixes)
- self.end_double_comment_re = re.compile("(\"\"\")\s*$")
-
- self.single_comment_re = re.compile("^\s*%s(''').*(''')\s*$" % string_prefixes)
- self.double_comment_re = re.compile("^\s*%s(\"\"\").*(\"\"\")\s*$" % string_prefixes)
-
- self.defclass_re = re.compile("^(\s*)(def .+:|class .+:)")
- self.empty_re = re.compile("^\s*$")
- self.hashline_re = re.compile("^\s*#.*$")
- self.importline_re = re.compile("^\s*(import |from .+ import)")
-
- self.multiline_defclass_start_re = re.compile("^(\s*)(def|class)(\s.*)?$")
- self.multiline_defclass_end_re = re.compile(":\s*$")
-
- ## Transition list format
- # ["FROM", "TO", condition, action]
- transitions = [
- ### FILEHEAD
-
- # single line comments
- ["FILEHEAD", "FILEHEAD", self.single_comment_re.search, self.appendCommentLine],
- ["FILEHEAD", "FILEHEAD", self.double_comment_re.search, self.appendCommentLine],
-
- # multiline comments
- ["FILEHEAD", "FILEHEAD_COMMENT_SINGLE", self.start_single_comment_re.search, self.appendCommentLine],
- ["FILEHEAD_COMMENT_SINGLE", "FILEHEAD", self.end_single_comment_re.search, self.appendCommentLine],
- ["FILEHEAD_COMMENT_SINGLE", "FILEHEAD_COMMENT_SINGLE", self.catchall, self.appendCommentLine],
- ["FILEHEAD", "FILEHEAD_COMMENT_DOUBLE", self.start_double_comment_re.search, self.appendCommentLine],
- ["FILEHEAD_COMMENT_DOUBLE", "FILEHEAD", self.end_double_comment_re.search, self.appendCommentLine],
- ["FILEHEAD_COMMENT_DOUBLE", "FILEHEAD_COMMENT_DOUBLE", self.catchall, self.appendCommentLine],
-
- # other lines
- ["FILEHEAD", "FILEHEAD", self.empty_re.search, self.appendFileheadLine],
- ["FILEHEAD", "FILEHEAD", self.hashline_re.search, self.appendFileheadLine],
- ["FILEHEAD", "FILEHEAD", self.importline_re.search, self.appendFileheadLine],
- ["FILEHEAD", "DEFCLASS", self.defclass_re.search, self.resetCommentSearch],
- ["FILEHEAD", "DEFCLASS_MULTI", self.multiline_defclass_start_re.search, self.resetCommentSearch],
- ["FILEHEAD", "DEFCLASS_BODY", self.catchall, self.appendFileheadLine],
-
- ### DEFCLASS
-
- # single line comments
- ["DEFCLASS", "DEFCLASS_BODY", self.single_comment_re.search, self.appendCommentLine],
- ["DEFCLASS", "DEFCLASS_BODY", self.double_comment_re.search, self.appendCommentLine],
-
- # multiline comments
- ["DEFCLASS", "COMMENT_SINGLE", self.start_single_comment_re.search, self.appendCommentLine],
- ["COMMENT_SINGLE", "DEFCLASS_BODY", self.end_single_comment_re.search, self.appendCommentLine],
- ["COMMENT_SINGLE", "COMMENT_SINGLE", self.catchall, self.appendCommentLine],
- ["DEFCLASS", "COMMENT_DOUBLE", self.start_double_comment_re.search, self.appendCommentLine],
- ["COMMENT_DOUBLE", "DEFCLASS_BODY", self.end_double_comment_re.search, self.appendCommentLine],
- ["COMMENT_DOUBLE", "COMMENT_DOUBLE", self.catchall, self.appendCommentLine],
-
- # other lines
- ["DEFCLASS", "DEFCLASS", self.empty_re.search, self.appendDefclassLine],
- ["DEFCLASS", "DEFCLASS", self.defclass_re.search, self.resetCommentSearch],
- ["DEFCLASS", "DEFCLASS_MULTI", self.multiline_defclass_start_re.search, self.resetCommentSearch],
- ["DEFCLASS", "DEFCLASS_BODY", self.catchall, self.stopCommentSearch],
-
- ### DEFCLASS_BODY
-
- ["DEFCLASS_BODY", "DEFCLASS", self.defclass_re.search, self.startCommentSearch],
- ["DEFCLASS_BODY", "DEFCLASS_MULTI", self.multiline_defclass_start_re.search, self.startCommentSearch],
- ["DEFCLASS_BODY", "DEFCLASS_BODY", self.catchall, self.appendNormalLine],
-
- ### DEFCLASS_MULTI
- ["DEFCLASS_MULTI", "DEFCLASS", self.multiline_defclass_end_re.search, self.appendDefclassLine],
- ["DEFCLASS_MULTI", "DEFCLASS_MULTI", self.catchall, self.appendDefclassLine],
- ]
-
- self.fsm = FSM("FILEHEAD", transitions)
- self.outstream = sys.stdout
-
- self.output = []
- self.comment = []
- self.filehead = []
- self.defclass = []
- self.indent = ""
-
- def __closeComment(self):
- """Appends any open comment block and triggering block to the output."""
-
- if args.autobrief:
- if len(self.comment) == 1 \
- or (len(self.comment) > 2 and self.comment[1].strip() == ''):
- self.comment[0] = self.__docstringSummaryToBrief(self.comment[0])
-
- if self.comment:
- block = self.makeCommentBlock()
- self.output.extend(block)
-
- if self.defclass:
- self.output.extend(self.defclass)
-
- def __docstringSummaryToBrief(self, line):
- """Adds \\brief to the docstrings summary line.
-
- A \\brief is prepended, provided no other doxygen command is at the
- start of the line.
- """
- stripped = line.strip()
- if stripped and not stripped[0] in ('@', '\\'):
- return "\\brief " + line
- else:
- return line
-
- def __flushBuffer(self):
- """Flushes the current outputbuffer to the outstream."""
- if self.output:
- try:
- if args.debug:
- print >>sys.stderr, "# OUTPUT: ", self.output
- print >>self.outstream, "\n".join(self.output)
- self.outstream.flush()
- except IOError:
- # Fix for FS#33. Catches "broken pipe" when doxygen closes
- # stdout prematurely upon usage of INPUT_FILTER, INLINE_SOURCES
- # and FILTER_SOURCE_FILES.
- pass
- self.output = []
-
- def catchall(self, input):
- """The catchall-condition, always returns true."""
- return True
-
- def resetCommentSearch(self, match):
- """Restarts a new comment search for a different triggering line.
-
- Closes the current commentblock and starts a new comment search.
- """
- if args.debug:
- print >>sys.stderr, "# CALLBACK: resetCommentSearch"
- self.__closeComment()
- self.startCommentSearch(match)
-
- def startCommentSearch(self, match):
- """Starts a new comment search.
-
- Saves the triggering line, resets the current comment and saves
- the current indentation.
- """
- if args.debug:
- print >>sys.stderr, "# CALLBACK: startCommentSearch"
- self.defclass = [self.fsm.current_input]
- self.comment = []
- self.indent = match.group(1)
-
- def stopCommentSearch(self, match):
- """Stops a comment search.
-
- Closes the current commentblock, resets the triggering line and
- appends the current line to the output.
- """
- if args.debug:
- print >>sys.stderr, "# CALLBACK: stopCommentSearch"
- self.__closeComment()
-
- self.defclass = []
- self.output.append(self.fsm.current_input)
-
- def appendFileheadLine(self, match):
- """Appends a line in the FILEHEAD state.
-
- Closes the open comment block, resets it and appends the current line.
- """
- if args.debug:
- print >>sys.stderr, "# CALLBACK: appendFileheadLine"
- self.__closeComment()
- self.comment = []
- self.output.append(self.fsm.current_input)
-
- def appendCommentLine(self, match):
- """Appends a comment line.
-
- The comment delimiter is removed from multiline start and ends as
- well as singleline comments.
- """
- if args.debug:
- print >>sys.stderr, "# CALLBACK: appendCommentLine"
- (from_state, to_state, condition, callback) = self.fsm.current_transition
-
- # single line comment
- if (from_state == "DEFCLASS" and to_state == "DEFCLASS_BODY") \
- or (from_state == "FILEHEAD" and to_state == "FILEHEAD"):
- # remove comment delimiter from begin and end of the line
- activeCommentDelim = match.group(1)
- line = self.fsm.current_input
- self.comment.append(line[line.find(activeCommentDelim)+len(activeCommentDelim):line.rfind(activeCommentDelim)])
-
- if (to_state == "DEFCLASS_BODY"):
- self.__closeComment()
- self.defclass = []
- # multiline start
- elif from_state == "DEFCLASS" or from_state == "FILEHEAD":
- # remove comment delimiter from begin of the line
- activeCommentDelim = match.group(1)
- line = self.fsm.current_input
- self.comment.append(line[line.find(activeCommentDelim)+len(activeCommentDelim):])
- # multiline end
- elif to_state == "DEFCLASS_BODY" or to_state == "FILEHEAD":
- # remove comment delimiter from end of the line
- activeCommentDelim = match.group(1)
- line = self.fsm.current_input
- self.comment.append(line[0:line.rfind(activeCommentDelim)])
- if (to_state == "DEFCLASS_BODY"):
- self.__closeComment()
- self.defclass = []
- # in multiline comment
- else:
- # just append the comment line
- self.comment.append(self.fsm.current_input)
-
- def appendNormalLine(self, match):
- """Appends a line to the output."""
- if args.debug:
- print >>sys.stderr, "# CALLBACK: appendNormalLine"
- self.output.append(self.fsm.current_input)
-
- def appendDefclassLine(self, match):
- """Appends a line to the triggering block."""
- if args.debug:
- print >>sys.stderr, "# CALLBACK: appendDefclassLine"
- self.defclass.append(self.fsm.current_input)
-
- def makeCommentBlock(self):
- """Indents the current comment block with respect to the current
- indentation level.
-
- @returns a list of indented comment lines
- """
- doxyStart = "##"
- commentLines = self.comment
-
- commentLines = map(lambda x: "%s# %s" % (self.indent, x), commentLines)
- l = [self.indent + doxyStart]
- l.extend(commentLines)
-
- return l
-
- def parse(self, input):
- """Parses a python file given as input string and returns the doxygen-
- compatible representation.
-
- @param input the python code to parse
- @returns the modified python code
- """
- lines = input.split("\n")
-
- for line in lines:
- self.fsm.makeTransition(line)
-
- if self.fsm.current_state == "DEFCLASS":
- self.__closeComment()
-
- return "\n".join(self.output)
-
- def parseFile(self, filename):
- """Parses a python file given as input string and returns the doxygen-
- compatible representation.
-
- @param input the python code to parse
- @returns the modified python code
- """
- f = open(filename, 'r')
-
- for line in f:
- self.parseLine(line.rstrip('\r\n'))
- if self.fsm.current_state == "DEFCLASS":
- self.__closeComment()
- self.__flushBuffer()
- f.close()
-
- def parseLine(self, line):
- """Parse one line of python and flush the resulting output to the
- outstream.
-
- @param line the python code line to parse
- """
- self.fsm.makeTransition(line)
- self.__flushBuffer()
+ def __init__(self):
+ string_prefixes = "[uU]?[rR]?"
+
+ self.start_single_comment_re = re.compile("^\s*%s(''')" % string_prefixes)
+ self.end_single_comment_re = re.compile("(''')\s*$")
+
+ self.start_double_comment_re = re.compile("^\s*%s(\"\"\")" % string_prefixes)
+ self.end_double_comment_re = re.compile("(\"\"\")\s*$")
+
+ self.single_comment_re = re.compile("^\s*%s(''').*(''')\s*$" % string_prefixes)
+ self.double_comment_re = re.compile("^\s*%s(\"\"\").*(\"\"\")\s*$" % string_prefixes)
+
+ self.defclass_re = re.compile("^(\s*)(def .+:|class .+:)")
+ self.empty_re = re.compile("^\s*$")
+ self.hashline_re = re.compile("^\s*#.*$")
+ self.importline_re = re.compile("^\s*(import |from .+ import)")
+
+ self.multiline_defclass_start_re = re.compile("^(\s*)(def|class)(\s.*)?$")
+ self.multiline_defclass_end_re = re.compile(":\s*$")
+
+ ## Transition list format
+ # ["FROM", "TO", condition, action]
+ transitions = [
+ ### FILEHEAD
+
+ # single line comments
+ ["FILEHEAD", "FILEHEAD", self.single_comment_re.search, self.appendCommentLine],
+ ["FILEHEAD", "FILEHEAD", self.double_comment_re.search, self.appendCommentLine],
+
+ # multiline comments
+ ["FILEHEAD", "FILEHEAD_COMMENT_SINGLE", self.start_single_comment_re.search, self.appendCommentLine],
+ ["FILEHEAD_COMMENT_SINGLE", "FILEHEAD", self.end_single_comment_re.search, self.appendCommentLine],
+ ["FILEHEAD_COMMENT_SINGLE", "FILEHEAD_COMMENT_SINGLE", self.catchall, self.appendCommentLine],
+ ["FILEHEAD", "FILEHEAD_COMMENT_DOUBLE", self.start_double_comment_re.search, self.appendCommentLine],
+ ["FILEHEAD_COMMENT_DOUBLE", "FILEHEAD", self.end_double_comment_re.search, self.appendCommentLine],
+ ["FILEHEAD_COMMENT_DOUBLE", "FILEHEAD_COMMENT_DOUBLE", self.catchall, self.appendCommentLine],
+
+ # other lines
+ ["FILEHEAD", "FILEHEAD", self.empty_re.search, self.appendFileheadLine],
+ ["FILEHEAD", "FILEHEAD", self.hashline_re.search, self.appendFileheadLine],
+ ["FILEHEAD", "FILEHEAD", self.importline_re.search, self.appendFileheadLine],
+ ["FILEHEAD", "DEFCLASS", self.defclass_re.search, self.resetCommentSearch],
+ ["FILEHEAD", "DEFCLASS_MULTI", self.multiline_defclass_start_re.search, self.resetCommentSearch],
+ ["FILEHEAD", "DEFCLASS_BODY", self.catchall, self.appendFileheadLine],
+
+ ### DEFCLASS
+
+ # single line comments
+ ["DEFCLASS", "DEFCLASS_BODY", self.single_comment_re.search, self.appendCommentLine],
+ ["DEFCLASS", "DEFCLASS_BODY", self.double_comment_re.search, self.appendCommentLine],
+
+ # multiline comments
+ ["DEFCLASS", "COMMENT_SINGLE", self.start_single_comment_re.search, self.appendCommentLine],
+ ["COMMENT_SINGLE", "DEFCLASS_BODY", self.end_single_comment_re.search, self.appendCommentLine],
+ ["COMMENT_SINGLE", "COMMENT_SINGLE", self.catchall, self.appendCommentLine],
+ ["DEFCLASS", "COMMENT_DOUBLE", self.start_double_comment_re.search, self.appendCommentLine],
+ ["COMMENT_DOUBLE", "DEFCLASS_BODY", self.end_double_comment_re.search, self.appendCommentLine],
+ ["COMMENT_DOUBLE", "COMMENT_DOUBLE", self.catchall, self.appendCommentLine],
+
+ # other lines
+ ["DEFCLASS", "DEFCLASS", self.empty_re.search, self.appendDefclassLine],
+ ["DEFCLASS", "DEFCLASS", self.defclass_re.search, self.resetCommentSearch],
+ ["DEFCLASS", "DEFCLASS_MULTI", self.multiline_defclass_start_re.search, self.resetCommentSearch],
+ ["DEFCLASS", "DEFCLASS_BODY", self.catchall, self.stopCommentSearch],
+
+ ### DEFCLASS_BODY
+
+ ["DEFCLASS_BODY", "DEFCLASS", self.defclass_re.search, self.startCommentSearch],
+ ["DEFCLASS_BODY", "DEFCLASS_MULTI", self.multiline_defclass_start_re.search, self.startCommentSearch],
+ ["DEFCLASS_BODY", "DEFCLASS_BODY", self.catchall, self.appendNormalLine],
+
+ ### DEFCLASS_MULTI
+ ["DEFCLASS_MULTI", "DEFCLASS", self.multiline_defclass_end_re.search, self.appendDefclassLine],
+ ["DEFCLASS_MULTI", "DEFCLASS_MULTI", self.catchall, self.appendDefclassLine],
+ ]
+
+ self.fsm = FSM("FILEHEAD", transitions)
+ self.outstream = sys.stdout
+
+ self.output = []
+ self.comment = []
+ self.filehead = []
+ self.defclass = []
+ self.indent = ""
+
+ def __closeComment(self):
+ """Appends any open comment block and triggering block to the output."""
+
+ if args.autobrief:
+ if len(self.comment) == 1 \
+ or (len(self.comment) > 2 and self.comment[1].strip() == ''):
+ self.comment[0] = self.__docstringSummaryToBrief(self.comment[0])
+
+ if self.comment:
+ block = self.makeCommentBlock()
+ self.output.extend(block)
+
+ if self.defclass:
+ self.output.extend(self.defclass)
+
+ def __docstringSummaryToBrief(self, line):
+ """Adds \\brief to the docstrings summary line.
+
+ A \\brief is prepended, provided no other doxygen command is at the
+ start of the line.
+ """
+ stripped = line.strip()
+ if stripped and not stripped[0] in ('@', '\\'):
+ return "\\brief " + line
+ else:
+ return line
+
+ def __flushBuffer(self):
+ """Flushes the current outputbuffer to the outstream."""
+ if self.output:
+ try:
+ if args.debug:
+ print("# OUTPUT: ", self.output, file=sys.stderr)
+ print("\n".join(self.output), file=self.outstream)
+ self.outstream.flush()
+ except IOError:
+ # Fix for FS#33. Catches "broken pipe" when doxygen closes
+ # stdout prematurely upon usage of INPUT_FILTER, INLINE_SOURCES
+ # and FILTER_SOURCE_FILES.
+ pass
+ self.output = []
+
+ def catchall(self, input):
+ """The catchall-condition, always returns true."""
+ return True
+
+ def resetCommentSearch(self, match):
+ """Restarts a new comment search for a different triggering line.
+
+ Closes the current commentblock and starts a new comment search.
+ """
+ if args.debug:
+ print("# CALLBACK: resetCommentSearch", file=sys.stderr)
+ self.__closeComment()
+ self.startCommentSearch(match)
+
+ def startCommentSearch(self, match):
+ """Starts a new comment search.
+
+ Saves the triggering line, resets the current comment and saves
+ the current indentation.
+ """
+ if args.debug:
+ print("# CALLBACK: startCommentSearch", file=sys.stderr)
+ self.defclass = [self.fsm.current_input]
+ self.comment = []
+ self.indent = match.group(1)
+
+ def stopCommentSearch(self, match):
+ """Stops a comment search.
+
+ Closes the current commentblock, resets the triggering line and
+ appends the current line to the output.
+ """
+ if args.debug:
+ print("# CALLBACK: stopCommentSearch", file=sys.stderr)
+ self.__closeComment()
+
+ self.defclass = []
+ self.output.append(self.fsm.current_input)
+
+ def appendFileheadLine(self, match):
+ """Appends a line in the FILEHEAD state.
+
+ Closes the open comment block, resets it and appends the current line.
+ """
+ if args.debug:
+ print("# CALLBACK: appendFileheadLine", file=sys.stderr)
+ self.__closeComment()
+ self.comment = []
+ self.output.append(self.fsm.current_input)
+
+ def appendCommentLine(self, match):
+ """Appends a comment line.
+
+ The comment delimiter is removed from multiline start and ends as
+ well as singleline comments.
+ """
+ if args.debug:
+ print("# CALLBACK: appendCommentLine", file=sys.stderr)
+ (from_state, to_state, condition, callback) = self.fsm.current_transition
+
+ # single line comment
+ if (from_state == "DEFCLASS" and to_state == "DEFCLASS_BODY") \
+ or (from_state == "FILEHEAD" and to_state == "FILEHEAD"):
+ # remove comment delimiter from begin and end of the line
+ activeCommentDelim = match.group(1)
+ line = self.fsm.current_input
+ self.comment.append(line[line.find(activeCommentDelim)+len(activeCommentDelim):line.rfind(activeCommentDelim)])
+
+ if (to_state == "DEFCLASS_BODY"):
+ self.__closeComment()
+ self.defclass = []
+ # multiline start
+ elif from_state == "DEFCLASS" or from_state == "FILEHEAD":
+ # remove comment delimiter from begin of the line
+ activeCommentDelim = match.group(1)
+ line = self.fsm.current_input
+ self.comment.append(line[line.find(activeCommentDelim)+len(activeCommentDelim):])
+ # multiline end
+ elif to_state == "DEFCLASS_BODY" or to_state == "FILEHEAD":
+ # remove comment delimiter from end of the line
+ activeCommentDelim = match.group(1)
+ line = self.fsm.current_input
+ self.comment.append(line[0:line.rfind(activeCommentDelim)])
+ if (to_state == "DEFCLASS_BODY"):
+ self.__closeComment()
+ self.defclass = []
+ # in multiline comment
+ else:
+ # just append the comment line
+ self.comment.append(self.fsm.current_input)
+
+ def appendNormalLine(self, match):
+ """Appends a line to the output."""
+ if args.debug:
+ print("# CALLBACK: appendNormalLine", file=sys.stderr)
+ self.output.append(self.fsm.current_input)
+
+ def appendDefclassLine(self, match):
+ """Appends a line to the triggering block."""
+ if args.debug:
+ print("# CALLBACK: appendDefclassLine", file=sys.stderr)
+ self.defclass.append(self.fsm.current_input)
+
+ def makeCommentBlock(self):
+ """Indents the current comment block with respect to the current
+ indentation level.
+
+ @returns a list of indented comment lines
+ """
+ doxyStart = "##"
+ commentLines = self.comment
+
+ commentLines = ["%s# %s" % (self.indent, x) for x in commentLines]
+ l = [self.indent + doxyStart]
+ l.extend(commentLines)
+
+ return l
+
+ def parse(self, input):
+ """Parses a python file given as input string and returns the doxygen-
+ compatible representation.
+
+ @param input the python code to parse
+ @returns the modified python code
+ """
+ lines = input.split("\n")
+
+ for line in lines:
+ self.fsm.makeTransition(line)
+
+ if self.fsm.current_state == "DEFCLASS":
+ self.__closeComment()
+
+ return "\n".join(self.output)
+
+ def parseFile(self, filename):
+ """Parses a python file given as input string and returns the doxygen-
+ compatible representation.
+
+ @param input the python code to parse
+ @returns the modified python code
+ """
+ f = open(filename, 'r')
+
+ for line in f:
+ self.parseLine(line.rstrip('\r\n'))
+ if self.fsm.current_state == "DEFCLASS":
+ self.__closeComment()
+ self.__flushBuffer()
+ f.close()
+
+ def parseLine(self, line):
+ """Parse one line of python and flush the resulting output to the
+ outstream.
+
+ @param line the python code line to parse
+ """
+ self.fsm.makeTransition(line)
+ self.__flushBuffer()
def argParse():
- """Parses commandline args."""
- parser = ArgumentParser(prog=__applicationName__)
-
- parser.add_argument("--version", action="version",
- version="%(prog)s " + __version__
- )
- parser.add_argument("--autobrief", action="store_true",
- help="use the docstring summary line as \\brief description"
- )
- parser.add_argument("--debug", action="store_true",
- help="enable debug output on stderr"
- )
- parser.add_argument("filename", metavar="FILENAME")
-
- return parser.parse_args()
+ """Parses commandline args."""
+ parser = ArgumentParser(prog=__applicationName__)
+
+ parser.add_argument("--version", action="version",
+ version="%(prog)s " + __version__
+ )
+ parser.add_argument("--autobrief", action="store_true",
+ help="use the docstring summary line as \\brief description"
+ )
+ parser.add_argument("--debug", action="store_true",
+ help="enable debug output on stderr"
+ )
+ parser.add_argument("filename", metavar="FILENAME")
+
+ return parser.parse_args()
def main():
- """Starts the parser on the file given by the filename as the first
- argument on the commandline.
- """
- global args
- args = argParse()
- fsm = Doxypy()
- fsm.parseFile(args.filename)
+ """Starts the parser on the file given by the filename as the first
+ argument on the commandline.
+ """
+ global args
+ args = argParse()
+ fsm = Doxypy()
+ fsm.parseFile(args.filename)
if __name__ == "__main__":
- main()
+ main()
diff --git a/docs/doxygen/swig_doc.py b/docs/doxygen/swig_doc.py
index c9e89aec1..307920d77 100644
--- a/docs/doxygen/swig_doc.py
+++ b/docs/doxygen/swig_doc.py
@@ -26,6 +26,7 @@ The file instructs SWIG to transfer the doxygen comments into the
python docstrings.
"""
+from __future__ import unicode_literals
import sys, time
@@ -84,8 +85,8 @@ def utoascii(text):
if text is None:
return ''
out = text.encode('ascii', 'replace')
- out = out.replace('"', '\\"')
- return out
+ out = out.replace(b'"', b'\\"').decode('ascii')
+ return str(out)
def combine_descriptions(obj):
@@ -301,7 +302,7 @@ def make_swig_interface_file(di, swigdocfilename, custom_output=None):
output = "\n\n".join(output)
- swig_doc = file(swigdocfilename, 'w')
+ swig_doc = open(swigdocfilename, 'w')
swig_doc.write(output)
swig_doc.close()
@@ -309,7 +310,7 @@ if __name__ == "__main__":
# Parse command line options and set up doxyxml.
err_msg = "Execute using: python swig_doc.py xml_path outputfilename"
if len(sys.argv) != 3:
- raise StandardError(err_msg)
+ raise Exception(err_msg)
xml_path = sys.argv[1]
swigdocfilename = sys.argv[2]
di = DoxyIndex(xml_path)
diff --git a/docs/exploring-gnuradio/dial_tone.py b/docs/exploring-gnuradio/dial_tone.py
index ba43c43bf..08498a84e 100755..100644
--- a/docs/exploring-gnuradio/dial_tone.py
+++ b/docs/exploring-gnuradio/dial_tone.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio import analog
@@ -40,5 +41,5 @@ def build_graph():
if __name__ == '__main__':
tb = build_graph()
tb.start()
- raw_input('Press Enter to quit: ')
+ input('Press Enter to quit: ')
tb.stop()
diff --git a/docs/exploring-gnuradio/fm_demod.py b/docs/exploring-gnuradio/fm_demod.py
index 8e8b6425f..a297e78a7 100755..100644
--- a/docs/exploring-gnuradio/fm_demod.py
+++ b/docs/exploring-gnuradio/fm_demod.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
from gnuradio import filter
@@ -46,7 +48,7 @@ class build_graph(gr.top_block):
# Set the demodulator using the same deviation as the receiver.
max_dev = 75e3
- fm_demod_gain = input_rate/(2*math.pi*max_dev/8.0)
+ fm_demod_gain = input_rate / (2*math.pi*max_dev/8.0)
fm_demod = analog.quadrature_demod_cf(fm_demod_gain)
# Create a filter for the resampler and filter the audio
@@ -80,7 +82,7 @@ class build_graph(gr.top_block):
def main(args):
tb = build_graph()
tb.start() # fork thread and return
- raw_input('Press Enter to quit: ')
+ input('Press Enter to quit: ')
tb.stop()
if __name__ == '__main__':
diff --git a/docs/sphinx/gnuradio_sphinx.py b/docs/sphinx/gnuradio_sphinx.py
index 22b96c32e..cdfd46cec 100644
--- a/docs/sphinx/gnuradio_sphinx.py
+++ b/docs/sphinx/gnuradio_sphinx.py
@@ -1,6 +1,7 @@
"""
Customizations of sphinx for gnuradio use.
"""
+from __future__ import unicode_literals
from sphinx.ext.autodoc import py_ext_sig_re
from sphinx.ext.autodoc import ClassDocumenter, FunctionDocumenter, members_option
diff --git a/docs/sphinx/hieroglyph/__init__.py b/docs/sphinx/hieroglyph/__init__.py
index 25dea27fb..d6b00fc04 100644
--- a/docs/sphinx/hieroglyph/__init__.py
+++ b/docs/sphinx/hieroglyph/__init__.py
@@ -1,6 +1,7 @@
+from __future__ import unicode_literals
# We only need to expose the setup function to Sphinx
from .hieroglyph import setup
from .version import __version__
-__author__ = 'Robert Smallshire' \ No newline at end of file
+__author__ = 'Robert Smallshire'
diff --git a/docs/sphinx/hieroglyph/errors.py b/docs/sphinx/hieroglyph/errors.py
index 9c1d2213b..9f7cde957 100644
--- a/docs/sphinx/hieroglyph/errors.py
+++ b/docs/sphinx/hieroglyph/errors.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
from sphinx.errors import ExtensionError
@@ -7,4 +8,4 @@ class HieroglyphError(ExtensionError):
'''
An exception type specific to the Hieroglyph Sphinx extension.
'''
- pass \ No newline at end of file
+ pass
diff --git a/docs/sphinx/hieroglyph/hieroglyph.py b/docs/sphinx/hieroglyph/hieroglyph.py
index 0056d9ab8..bb58a6e04 100644
--- a/docs/sphinx/hieroglyph/hieroglyph.py
+++ b/docs/sphinx/hieroglyph/hieroglyph.py
@@ -1,9 +1,11 @@
from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import unicode_literals
import re
-from errors import HieroglyphError
-from nodes import (Node, Raises, Except, Note, Warning, Returns, Arg,
+from .errors import HieroglyphError
+from .nodes import (Node, Raises, Except, Note, Warning, Returns, Arg,
ensure_terminal_blank)
__author__ = 'Robert Smallshire'
diff --git a/docs/sphinx/hieroglyph/nodes.py b/docs/sphinx/hieroglyph/nodes.py
index f0c08b562..1c091ab6a 100644
--- a/docs/sphinx/hieroglyph/nodes.py
+++ b/docs/sphinx/hieroglyph/nodes.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
__author__ = 'Robert Smallshire'
class Node(object):
diff --git a/docs/sphinx/hieroglyph/test/__init__.py b/docs/sphinx/hieroglyph/test/__init__.py
index c9b674ead..c568b0851 100644
--- a/docs/sphinx/hieroglyph/test/__init__.py
+++ b/docs/sphinx/hieroglyph/test/__init__.py
@@ -1 +1,2 @@
+from __future__ import unicode_literals
__author__ = 'rjs'
diff --git a/docs/sphinx/hieroglyph/test/test_comments.py b/docs/sphinx/hieroglyph/test/test_comments.py
index d1a1453ee..1cc569605 100644
--- a/docs/sphinx/hieroglyph/test/test_comments.py
+++ b/docs/sphinx/hieroglyph/test/test_comments.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
import unittest
from hieroglyph.hieroglyph import parse_hieroglyph_text
diff --git a/docs/sphinx/hieroglyph/test/test_hierglyph.py b/docs/sphinx/hieroglyph/test/test_hierglyph.py
index 4f86db578..781596090 100644
--- a/docs/sphinx/hieroglyph/test/test_hierglyph.py
+++ b/docs/sphinx/hieroglyph/test/test_hierglyph.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
import unittest
from hieroglyph.hieroglyph import first_paragraph_indent, gather_lines, unindent
diff --git a/docs/sphinx/hieroglyph/test/test_nodes.py b/docs/sphinx/hieroglyph/test/test_nodes.py
index 12cd25a03..4b6003c91 100644
--- a/docs/sphinx/hieroglyph/test/test_nodes.py
+++ b/docs/sphinx/hieroglyph/test/test_nodes.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
import unittest
from hieroglyph.nodes import Node, Arg, Raises, Except, Returns, Warning, Note
diff --git a/docs/sphinx/hieroglyph/version.py b/docs/sphinx/hieroglyph/version.py
index b35385b6b..f823af436 100644
--- a/docs/sphinx/hieroglyph/version.py
+++ b/docs/sphinx/hieroglyph/version.py
@@ -1,3 +1,4 @@
'''Specification of the hieroglyph version'''
+from __future__ import unicode_literals
__version__ = '0.6'
diff --git a/gnuradio-runtime/apps/evaluation_random_numbers.py b/gnuradio-runtime/apps/evaluation_random_numbers.py
index 069493c73..30b61be85 100644
--- a/gnuradio-runtime/apps/evaluation_random_numbers.py
+++ b/gnuradio-runtime/apps/evaluation_random_numbers.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
import numpy as np
from scipy.stats import norm, laplace, rayleigh
@@ -40,7 +43,7 @@ laplace_num_bins = 31
rndm = gr.random() # instance of gnuradio random class (gr::random)
-print 'All histograms contain',num_tests,'realisations.'
+print('All histograms contain',num_tests,'realisations.')
#*** GENERATE DATA ***#
@@ -73,7 +76,7 @@ rayleigh_expected = np.zeros(rayleigh_num_bins-1)
laplace_expected = np.zeros(laplace_num_bins-1)
for k in range(len(uniform_hist[0])):
- uniform_expected[k] = num_tests/float(uniform_num_bins-1)
+ uniform_expected[k] = num_tests / float(uniform_num_bins-1)
for k in range(len(gauss_hist[0])):
gauss_expected[k] = float(norm.cdf(gauss_hist[1][k+1])-norm.cdf(gauss_hist[1][k]))*num_tests
@@ -86,10 +89,10 @@ for k in range(len(laplace_hist[0])):
#*** PLOT HISTOGRAMS AND EXPECTATIONS TAKEN FROM SCIPY ***#
-uniform_bins_center = uniform_bins[0:-1]+(uniform_bins[1]-uniform_bins[0])/2.0
-gauss_bins_center = gauss_bins[0:-1]+(gauss_bins[1]-gauss_bins[0])/2.0
-rayleigh_bins_center = rayleigh_bins[0:-1]+(rayleigh_bins[1]-rayleigh_bins[0])/2.0
-laplace_bins_center = laplace_bins[0:-1]+(laplace_bins[1]-laplace_bins[0])/2.0
+uniform_bins_center = uniform_bins[0:-1]+(uniform_bins[1]-uniform_bins[0]) / 2.0
+gauss_bins_center = gauss_bins[0:-1]+(gauss_bins[1]-gauss_bins[0]) / 2.0
+rayleigh_bins_center = rayleigh_bins[0:-1]+(rayleigh_bins[1]-rayleigh_bins[0]) / 2.0
+laplace_bins_center = laplace_bins[0:-1]+(laplace_bins[1]-laplace_bins[0]) / 2.0
plt.figure(1)
@@ -99,7 +102,7 @@ plt.xlabel('Bins'), plt.ylabel('Count'), plt.title('Uniform: Distribution')
plt.legend(['histogram gr::random','calculation scipy'],loc=1)
plt.subplot(2,1,2)
-plt.plot(uniform_bins_center,uniform_hist[0]/uniform_expected,'rs--')
+plt.plot(uniform_bins_center,uniform_hist[0] / uniform_expected,'rs--')
plt.xlabel('Bins'), plt.ylabel('Relative deviation'), plt.title('Uniform: Relative deviation to scipy')
plt.figure(2)
@@ -110,7 +113,7 @@ plt.xlabel('Bins'), plt.ylabel('Count'), plt.title('Gauss: Distribution')
plt.legend(['histogram gr::random','calculation scipy'],loc=1)
plt.subplot(2,1,2)
-plt.plot(gauss_bins_center,gauss_hist[0]/gauss_expected,'rs--')
+plt.plot(gauss_bins_center,gauss_hist[0] / gauss_expected,'rs--')
plt.xlabel('Bins'), plt.ylabel('Relative deviation'), plt.title('Gauss: Relative deviation to scipy')
plt.figure(3)
@@ -122,7 +125,7 @@ plt.legend(['histogram gr::random','calculation scipy'],loc=1)
plt.subplot(2,1,2)
-plt.plot(rayleigh_bins_center,rayleigh_hist[0]/rayleigh_expected,'rs--')
+plt.plot(rayleigh_bins_center,rayleigh_hist[0] / rayleigh_expected,'rs--')
plt.xlabel('Bins'), plt.ylabel('Relative deviation'), plt.title('Rayleigh: Relative deviation to scipy')
plt.figure(4)
@@ -133,7 +136,7 @@ plt.xlabel('Bins'), plt.ylabel('Count'), plt.title('Laplace: Distribution')
plt.legend(['histogram gr::random','calculation scipy'],loc=1)
plt.subplot(2,1,2)
-plt.plot(laplace_bins_center,laplace_hist[0]/laplace_expected,'rs--')
+plt.plot(laplace_bins_center,laplace_hist[0] / laplace_expected,'rs--')
plt.xlabel('Bins'), plt.ylabel('Relative deviation'), plt.title('Laplace: Relative deviation to scipy')
plt.show()
diff --git a/gnuradio-runtime/examples/mp-sched/affinity_set.py b/gnuradio-runtime/examples/mp-sched/affinity_set.py
index e6637b44b..a253c8081 100755..100644
--- a/gnuradio-runtime/examples/mp-sched/affinity_set.py
+++ b/gnuradio-runtime/examples/mp-sched/affinity_set.py
@@ -4,6 +4,8 @@
# Title: Affinity Set Test
##################################################
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import blocks
@@ -57,7 +59,7 @@ if __name__ == '__main__':
tb.start()
while(1):
- ret = raw_input('Enter a new Core # or Press Enter to quit: ')
+ ret = input('Enter a new Core # or Press Enter to quit: ')
if(len(ret) == 0):
tb.stop()
sys.exit(0)
@@ -67,6 +69,6 @@ if __name__ == '__main__':
try:
n = int(ret)
except ValueError:
- print "Invalid number"
+ print("Invalid number")
else:
tb.filter_filt_0.set_processor_affinity([n,])
diff --git a/gnuradio-runtime/examples/mp-sched/plot_flops.py b/gnuradio-runtime/examples/mp-sched/plot_flops.py
index 9bd2ff12b..e71770aee 100755..100644
--- a/gnuradio-runtime/examples/mp-sched/plot_flops.py
+++ b/gnuradio-runtime/examples/mp-sched/plot_flops.py
@@ -23,6 +23,7 @@
Reads output from run_synthetic.py and runs gnuplot showing
GFLOPS as f(npipes, nstages)
"""
+from __future__ import unicode_literals
import re
import sys
diff --git a/gnuradio-runtime/examples/mp-sched/run_synthetic.py b/gnuradio-runtime/examples/mp-sched/run_synthetic.py
index 802fb9fd3..684f95bd8 100755..100644
--- a/gnuradio-runtime/examples/mp-sched/run_synthetic.py
+++ b/gnuradio-runtime/examples/mp-sched/run_synthetic.py
@@ -22,6 +22,8 @@
"""
Run synthetic.py for npipes in [1,16], nstages in [1,16]
"""
+from __future__ import division
+from __future__ import unicode_literals
import re
import sys
@@ -49,7 +51,7 @@ def write_shell_script(f, data_filename, description, ncores, gflops, max_pipes_
# We'd like each run of synthetic to take ~10 seconds
desired_time_per_run = 10
est_gflops_avail = min(nstages * npipes, ncores) * gflops
- nsamples = (est_gflops_avail * desired_time_per_run)/(512.0 * nstages * npipes)
+ nsamples = (est_gflops_avail * desired_time_per_run) / (512.0 * nstages * npipes)
nsamples = int(nsamples * 1e9)
cmd = "./synthetic.py -m -s %d -p %d -N %d\n" % (nstages, npipes, nsamples)
diff --git a/gnuradio-runtime/examples/mp-sched/synthetic.py b/gnuradio-runtime/examples/mp-sched/synthetic.py
index 16e39734a..0f0b7b37c 100755..100644
--- a/gnuradio-runtime/examples/mp-sched/synthetic.py
+++ b/gnuradio-runtime/examples/mp-sched/synthetic.py
@@ -19,6 +19,9 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr, eng_notation
from gnuradio import blocks, filter
from gnuradio.eng_arg import eng_float, intx
@@ -35,7 +38,7 @@ class pipeline(gr.hier_block2):
gr.hier_block2.__init__(self, "pipeline",
gr.io_signature(1, 1, gr.sizeof_float),
gr.io_signature(0, 0, 0))
- taps = ntaps*[1.0/ntaps]
+ taps = ntaps*[1.0 / ntaps]
upstream = self
for i in range(nstages):
op = filter.fir_filter_fff(1, taps)
@@ -85,23 +88,23 @@ def time_it(tb):
start = os.times()
tb.run()
stop = os.times()
- delta = map((lambda a, b: a-b), stop, start)
+ delta = list(map((lambda a, b: a-b), stop, start))
user, sys, childrens_user, childrens_sys, real = delta
total_user = user + childrens_user
total_sys = sys + childrens_sys
if tb.machine_readable:
- print "%3d %3d %.3e %7.3f %7.3f %7.3f %7.3f %.6e %.3e" % (
- tb.npipes, tb.nstages, tb.nsamples, real, total_user, total_sys, (total_user+total_sys)/real, tb.flop, tb.flop/real)
+ print("%3d %3d %.3e %7.3f %7.3f %7.3f %7.3f %.6e %.3e" % (
+ tb.npipes, tb.nstages, tb.nsamples, real, total_user, total_sys, (total_user+total_sys) / real, tb.flop, tb.flop / real))
else:
- print "npipes %7d" % (tb.npipes,)
- print "nstages %7d" % (tb.nstages,)
- print "nsamples %s" % (eng_notation.num_to_str(tb.nsamples),)
- print "real %7.3f" % (real,)
- print "user %7.3f" % (total_user,)
- print "sys %7.3f" % (total_sys,)
- print "(user+sys)/real %7.3f" % ((total_user + total_sys)/real,)
- print "pseudo_flop %s" % (eng_notation.num_to_str(tb.flop),)
- print "pseudo_flop/real %s" % (eng_notation.num_to_str(tb.flop/real),)
+ print("npipes %7d" % (tb.npipes,))
+ print("nstages %7d" % (tb.nstages,))
+ print("nsamples %s" % (eng_notation.num_to_str(tb.nsamples),))
+ print("real %7.3f" % (real,))
+ print("user %7.3f" % (total_user,))
+ print("sys %7.3f" % (total_sys,))
+ print("(user+sys)/real %7.3f" % ((total_user + total_sys) / real,))
+ print("pseudo_flop %s" % (eng_notation.num_to_str(tb.flop),))
+ print("pseudo_flop/real %s" % (eng_notation.num_to_str(tb.flop / real),))
if __name__ == "__main__":
@@ -109,7 +112,7 @@ if __name__ == "__main__":
tb = top()
time_it(tb)
except KeyboardInterrupt:
- raise SystemExit, 128
+ raise SystemExit(128)
diff --git a/gnuradio-runtime/examples/mp-sched/wfm_rcv_pll_to_wav.py b/gnuradio-runtime/examples/mp-sched/wfm_rcv_pll_to_wav.py
index bb3296d42..93f26c663 100755..100644
--- a/gnuradio-runtime/examples/mp-sched/wfm_rcv_pll_to_wav.py
+++ b/gnuradio-runtime/examples/mp-sched/wfm_rcv_pll_to_wav.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr, gru, eng_notation, filter
from gnuradio import audio
from gnuradio import analog
@@ -94,7 +96,7 @@ class wfm_rx_block (gr.top_block):
if args.volume is None:
g = self.volume_range()
- args.volume = float(g[0]+g[1])/2
+ args.volume = float(g[0]+g[1]) / 2
# set initial values
@@ -109,8 +111,8 @@ class wfm_rx_block (gr.top_block):
def set_vol (self, vol):
g = self.volume_range()
self.vol = max(g[0], min(g[1], vol))
- self.volume_control_l.set_k(10**(self.vol/10))
- self.volume_control_r.set_k(10**(self.vol/10))
+ self.volume_control_l.set_k(10**(self.vol / 10))
+ self.volume_control_r.set_k(10**(self.vol / 10))
def volume_range(self):
return (-20.0, 0.0, 0.5)
diff --git a/gnuradio-runtime/examples/network/audio_sink.py b/gnuradio-runtime/examples/network/audio_sink.py
index 9b91db5d1..9ebe8a4c8 100755..100644
--- a/gnuradio-runtime/examples/network/audio_sink.py
+++ b/gnuradio-runtime/examples/network/audio_sink.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
from argparse import ArgumentParser
diff --git a/gnuradio-runtime/examples/network/audio_source.py b/gnuradio-runtime/examples/network/audio_source.py
index 6a464a8f2..cc4a34c63 100755..100644
--- a/gnuradio-runtime/examples/network/audio_source.py
+++ b/gnuradio-runtime/examples/network/audio_source.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
from argparse import ArgumentParser
diff --git a/gnuradio-runtime/examples/network/dial_tone_sink.py b/gnuradio-runtime/examples/network/dial_tone_sink.py
index 4b1db9864..e6acbb08d 100755..100644
--- a/gnuradio-runtime/examples/network/dial_tone_sink.py
+++ b/gnuradio-runtime/examples/network/dial_tone_sink.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from gnuradio import gr, audio
from gnuradio import blocks
from argparse import ArgumentParser
diff --git a/gnuradio-runtime/examples/network/dial_tone_source.py b/gnuradio-runtime/examples/network/dial_tone_source.py
index ee2bc9529..aa3ab9954 100755..100644
--- a/gnuradio-runtime/examples/network/dial_tone_source.py
+++ b/gnuradio-runtime/examples/network/dial_tone_source.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from gnuradio import gr
from argparse import ArgumentParser
import sys
diff --git a/gnuradio-runtime/examples/network/vector_sink.py b/gnuradio-runtime/examples/network/vector_sink.py
index 362f63138..a8850d8a0 100755..100644
--- a/gnuradio-runtime/examples/network/vector_sink.py
+++ b/gnuradio-runtime/examples/network/vector_sink.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
from gnuradio.eng_arg import eng_float, intx
diff --git a/gnuradio-runtime/examples/network/vector_source.py b/gnuradio-runtime/examples/network/vector_source.py
index be40134bc..cf8d0000c 100755..100644
--- a/gnuradio-runtime/examples/network/vector_source.py
+++ b/gnuradio-runtime/examples/network/vector_source.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
from argparse import ArgumentParser
diff --git a/gnuradio-runtime/examples/volk_benchmark/volk_math.py b/gnuradio-runtime/examples/volk_benchmark/volk_math.py
index 753257c23..6fc6cfa78 100755..100644
--- a/gnuradio-runtime/examples/volk_benchmark/volk_math.py
+++ b/gnuradio-runtime/examples/volk_benchmark/volk_math.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
import argparse
@@ -87,7 +89,7 @@ def run_tests(func, N, iters):
res = format_results(func.__name__, t)
return res
except AttributeError:
- print "\tCould not run test. Skipping."
+ print("\tCould not run test. Skipping.")
return None
def main():
@@ -119,7 +121,7 @@ def main():
default=20,
help='Number of iterations [default: %(default)s]')
parser.add_argument('--tests', type=int, nargs='*',
- choices=xrange(len(avail_tests)),
+ choices=list(range(len(avail_tests))),
help='A list of tests to run; can be a single test or a \
space-separated list.')
parser.add_argument('--list', action='store_true',
@@ -129,8 +131,8 @@ def main():
args = parser.parse_args()
if(args.list):
- print "Available Tests to Run:"
- print "\n".join(["\t{0}: {1}".format(i,f.__name__) for i,f in enumerate(avail_tests)])
+ print("Available Tests to Run:")
+ print("\n".join(["\t{0}: {1}".format(i,f.__name__) for i,f in enumerate(avail_tests)]))
sys.exit(0)
N = int(args.nitems)
@@ -141,7 +143,7 @@ def main():
new_table(conn, label)
if args.all:
- tests = xrange(len(avail_tests))
+ tests = list(range(len(avail_tests)))
else:
tests = args.tests
diff --git a/gnuradio-runtime/examples/volk_benchmark/volk_plot.py b/gnuradio-runtime/examples/volk_benchmark/volk_plot.py
index 48f992205..2e02773e0 100755..100644
--- a/gnuradio-runtime/examples/volk_benchmark/volk_plot.py
+++ b/gnuradio-runtime/examples/volk_benchmark/volk_plot.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python
+from __future__ import division
+from __future__ import unicode_literals
import sys, math
import argparse
from volk_test_funcs import *
@@ -100,7 +102,7 @@ def main():
# Plot the results
- x0 = xrange(len(name_reg))
+ x0 = list(range(len(name_reg)))
i = 0
for t in (table_data):
ydata = []
@@ -119,7 +121,7 @@ def main():
if(args.percent != t):
# makes x values for this data set placement
# width of bars depends on number of comparisons
- wdth = 0.80/(M-1)
+ wdth = 0.80 / (M-1)
x1 = [x + i*wdth for x in x0]
i += 1
@@ -130,7 +132,7 @@ def main():
else:
# makes x values for this data set placement
# width of bars depends on number of comparisons
- wdth = 0.80/M
+ wdth = 0.80 / M
x1 = [x + i*wdth for x in x0]
i += 1
diff --git a/gnuradio-runtime/examples/volk_benchmark/volk_test_funcs.py b/gnuradio-runtime/examples/volk_benchmark/volk_test_funcs.py
index a7dd7b705..603c2ae5c 100644
--- a/gnuradio-runtime/examples/volk_benchmark/volk_test_funcs.py
+++ b/gnuradio-runtime/examples/volk_benchmark/volk_test_funcs.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
import math, sys, os, time
@@ -122,18 +124,18 @@ class helper(gr.top_block):
self.snks = []
self.head = blocks.head(isizeof, N)
- for n in xrange(nsrcs):
+ for n in range(nsrcs):
self.srcs.append(blocks.null_source(isizeof))
- for n in xrange(nsnks):
+ for n in range(nsnks):
self.snks.append(blocks.null_sink(osizeof))
self.connect(self.srcs[0], self.head, (self.op,0))
- for n in xrange(1, nsrcs):
+ for n in range(1, nsrcs):
self.connect(self.srcs[n], (self.op,n))
- for n in xrange(nsnks):
+ for n in range(nsnks):
self.connect((self.op,n), self.snks[n])
def timeit(tb, iterations):
@@ -143,10 +145,10 @@ def timeit(tb, iterations):
'''
r = gr.enable_realtime_scheduling()
if r != gr.RT_OK:
- print "Warning: failed to enable realtime scheduling"
+ print("Warning: failed to enable realtime scheduling")
times = []
- for i in xrange(iterations):
+ for i in range(iterations):
start_time = time.time()
tb.run()
end_time = time.time()
diff --git a/gnuradio-runtime/examples/volk_benchmark/volk_types.py b/gnuradio-runtime/examples/volk_benchmark/volk_types.py
index 546e9629c..697ec213c 100755..100644
--- a/gnuradio-runtime/examples/volk_benchmark/volk_types.py
+++ b/gnuradio-runtime/examples/volk_benchmark/volk_types.py
@@ -1,5 +1,7 @@
#!/usr/bin/env python
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
import argparse
@@ -105,7 +107,7 @@ def run_tests(func, N, iters):
res = format_results(func.__name__, t)
return res
except AttributeError:
- print "\tCould not run test. Skipping."
+ print("\tCould not run test. Skipping.")
return None
def main():
@@ -143,7 +145,7 @@ def main():
default=20,
help='Number of iterations [default: %(default)s]')
parser.add_argument('--tests', type=int, nargs='*',
- choices=xrange(len(avail_tests)),
+ choices=list(range(len(avail_tests))),
help='A list of tests to run; can be a single test or a \
space-separated list.')
parser.add_argument('--list', action='store_true',
@@ -153,8 +155,8 @@ def main():
args = parser.parse_args()
if(args.list):
- print "Available Tests to Run:"
- print "\n".join(["\t{0}: {1}".format(i,f.__name__) for i,f in enumerate(avail_tests)])
+ print("Available Tests to Run:")
+ print("\n".join(["\t{0}: {1}".format(i,f.__name__) for i,f in enumerate(avail_tests)]))
sys.exit(0)
N = int(args.nitems)
@@ -165,7 +167,7 @@ def main():
new_table(conn, label)
if args.all:
- tests = xrange(len(avail_tests))
+ tests = list(range(len(avail_tests)))
else:
tests = args.tests
diff --git a/gnuradio-runtime/include/gnuradio/sptr_magic.h b/gnuradio-runtime/include/gnuradio/sptr_magic.h
index 6deb3062a..d5e587186 100644
--- a/gnuradio-runtime/include/gnuradio/sptr_magic.h
+++ b/gnuradio-runtime/include/gnuradio/sptr_magic.h
@@ -40,7 +40,7 @@ namespace gnuradio {
static void create_and_stash_initial_sptr(gr::hier_block2 *p);
static void cancel_initial_sptr(gr::hier_block2 *p);
};
- };
+ }
/*
* \brief New! Improved! Standard method to get/create the
diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt
index 5e414164f..4fd5a610f 100644
--- a/gnuradio-runtime/lib/CMakeLists.txt
+++ b/gnuradio-runtime/lib/CMakeLists.txt
@@ -24,7 +24,7 @@ GR_CHECK_HDR_N_DEF(sys/resource.h HAVE_SYS_RESOURCE_H)
# Handle the generated constants
########################################################################
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
- "import time;print time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime())"
+ "import time;print(time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime()))"
OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "Loading build date ${BUILD_DATE} into constants...")
@@ -48,8 +48,8 @@ list(APPEND gnuradio_runtime_sources ${CMAKE_CURRENT_BINARY_DIR}/constants.cc)
########################################################################
include_directories(${GNURADIO_RUNTIME_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}/../include/
- ${VOLK_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}/../include/
+ ${VOLK_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
diff --git a/gnuradio-runtime/lib/math/gen_sine_table.py b/gnuradio-runtime/lib/math/gen_sine_table.py
index d7d11eff1..75e3a0c58 100755..100644
--- a/gnuradio-runtime/lib/math/gen_sine_table.py
+++ b/gnuradio-runtime/lib/math/gen_sine_table.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+from __future__ import unicode_literals
import math
import sys
@@ -38,8 +40,8 @@ def gen_approx_table (f, nentries, min_x, max_x):
for i in range (nentries):
a = (i * incx) + min_x
b = ((i + 1) * incx) + min_x
- m = (f(b)-f(a))/(b-a)
- c = (3*a+b)*(f(a)-f(b))/(4*(b-a)) + (f((a+b)/2) + f(a))/2
+ m = (f(b)-f(a)) / (b-a)
+ c = (3*a+b)*(f(a)-f(b))/(4*(b-a)) + (f(old_div((a+b) / 2) + f(a)),2)
abs_error = c+m*a-f(a)
r.append ((m, c, abs_error))
return r
diff --git a/gnuradio-runtime/lib/pmt/CMakeLists.txt b/gnuradio-runtime/lib/pmt/CMakeLists.txt
index e5c8f2f47..85b2a4d6e 100644
--- a/gnuradio-runtime/lib/pmt/CMakeLists.txt
+++ b/gnuradio-runtime/lib/pmt/CMakeLists.txt
@@ -66,7 +66,7 @@ add_custom_command(
${CMAKE_CURRENT_SOURCE_DIR}/unv_template.h.t
${CMAKE_CURRENT_SOURCE_DIR}/unv_template.cc.t
${CMAKE_CURRENT_SOURCE_DIR}/unv_qa_template.cc.t
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} -c
+ COMMAND ${PYTHON_EXECUTABLE} -B -c
"import os, sys; srcdir='${CMAKE_CURRENT_SOURCE_DIR}'; sys.path.append(srcdir); os.environ['srcdir']=srcdir; from generate_unv import main; main()"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
VERBATIM
diff --git a/gnuradio-runtime/lib/pmt/gen-serial-tags.py b/gnuradio-runtime/lib/pmt/gen-serial-tags.py
index 18e927beb..2ff2240a4 100644
--- a/gnuradio-runtime/lib/pmt/gen-serial-tags.py
+++ b/gnuradio-runtime/lib/pmt/gen-serial-tags.py
@@ -32,11 +32,14 @@ enum pst_tags {
#endif /* INCLUDED_PMT_SERIAL_TAGS_H */
"""
+from __future__ import print_function
+from __future__ import unicode_literals
+
import sys, os, re
if __name__ == '__main__':
if len(sys.argv) != 3:
- print "Usage %s <input_scm_file> <output_hdr_file>"%__file__
+ print("Usage %s <input_scm_file> <output_hdr_file>"%__file__)
exit()
input_scm_file, output_hdr_file = sys.argv[1:]
enums = list()
diff --git a/gnuradio-runtime/lib/pmt/generate_unv.py b/gnuradio-runtime/lib/pmt/generate_unv.py
index 6218099fc..45c57a3fb 100755..100644
--- a/gnuradio-runtime/lib/pmt/generate_unv.py
+++ b/gnuradio-runtime/lib/pmt/generate_unv.py
@@ -23,6 +23,7 @@
"""
Generate code for uniform numeric vectors
"""
+from __future__ import unicode_literals
import re, os, os.path
@@ -93,7 +94,7 @@ using namespace pmt;
# set srcdir to the directory that contains Makefile.am
try:
srcdir = os.environ['srcdir']
-except KeyError, e:
+except KeyError as e:
srcdir = "."
srcdir = srcdir + '/'
diff --git a/gnuradio-runtime/lib/sptr_magic.cc b/gnuradio-runtime/lib/sptr_magic.cc
index e5e83722f..bffef0475 100644
--- a/gnuradio-runtime/lib/sptr_magic.cc
+++ b/gnuradio-runtime/lib/sptr_magic.cc
@@ -102,4 +102,4 @@ namespace gnuradio {
s_map.erase(pos);
return sptr;
}
-};
+}
diff --git a/gnuradio-runtime/python/build_utils.py b/gnuradio-runtime/python/build_utils.py
index cf58a9763..82a2265cc 100644
--- a/gnuradio-runtime/python/build_utils.py
+++ b/gnuradio-runtime/python/build_utils.py
@@ -21,6 +21,7 @@
"""Misc utilities used at build time
"""
+from __future__ import unicode_literals
import re, os, os.path
from build_utils_codes import *
@@ -29,7 +30,7 @@ from build_utils_codes import *
# set srcdir to the directory that contains Makefile.am
try:
srcdir = os.environ['srcdir']
-except KeyError, e:
+except KeyError as e:
srcdir = "."
srcdir = srcdir + '/'
@@ -39,7 +40,7 @@ try:
do_makefile = False
else:
do_makefile = True
-except KeyError, e:
+except KeyError as e:
do_makefile = False
# set do_sources to either true or false dependeing on the environment
@@ -48,7 +49,7 @@ try:
do_sources = False
else:
do_sources = True
-except KeyError, e:
+except KeyError as e:
do_sources = True
name_dict = {}
@@ -127,7 +128,7 @@ def extract_extension (template_name):
# we return everything between the penultimate . and .t
mo = re.search (r'\.([a-z]+)\.t$', template_name)
if not mo:
- raise ValueError, "Incorrectly formed template_name '%s'" % (template_name,)
+ raise ValueError("Incorrectly formed template_name '%s'" % (template_name,))
return mo.group (1)
def open_src (name, mode):
diff --git a/gnuradio-runtime/python/build_utils_codes.py b/gnuradio-runtime/python/build_utils_codes.py
index 9ea96baae..22a6bdb99 100644
--- a/gnuradio-runtime/python/build_utils_codes.py
+++ b/gnuradio-runtime/python/build_utils_codes.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
#
# Copyright 2004 Free Software Foundation, Inc.
#
diff --git a/gnuradio-runtime/python/gnuradio/__init__.py b/gnuradio-runtime/python/gnuradio/__init__.py
index 062450cb5..c1735c3d8 100644
--- a/gnuradio-runtime/python/gnuradio/__init__.py
+++ b/gnuradio-runtime/python/gnuradio/__init__.py
@@ -7,6 +7,7 @@ While not primarily a simulation tool, GNU Radio does support development of sig
GNU Radio is licensed under the GNU General Public License (GPL) version 3. All of the code is copyright of the Free Software Foundation.
"""
+from __future__ import unicode_literals
# This file makes gnuradio a package
# The docstring will be associated with the top level of the package.
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/GNURadioControlPortClient.py b/gnuradio-runtime/python/gnuradio/ctrlport/GNURadioControlPortClient.py
index 87d2cf565..beec50002 100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/GNURadioControlPortClient.py
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/GNURadioControlPortClient.py
@@ -27,6 +27,8 @@ Remote Procedure Call (RPC) transports, the Apache Thrift middle-ware RPC
is currently the only supported transport.
"""
+from __future__ import print_function
+from __future__ import unicode_literals
import exceptions
@@ -38,7 +40,7 @@ Two constructors are provided for creating a connection to ControlPort.
"""
-class GNURadioControlPortClient():
+class GNURadioControlPortClient(object):
"""
Constructor for creating a ControlPort connection to a specified host / port
@@ -113,7 +115,7 @@ class GNURadioControlPortClient():
self.client = None
from gnuradio.ctrlport.RPCConnection import RPCMethods
- if RPCMethods.has_key(rpcmethod):
+ if rpcmethod in RPCMethods:
from gnuradio.ctrlport.RPCConnectionThrift import RPCConnectionThrift
if rpcmethod == 'thrift':
#print("making RPCConnectionThrift")
@@ -128,5 +130,5 @@ class GNURadioControlPortClient():
if not blockingcallback is None:
blockingcallback()
else:
- print("Unsupported RPC method: ", rpcmethod)
+ print(("Unsupported RPC method: ", rpcmethod))
raise exceptions.ValueError()
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py b/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py
index e0499c5eb..cb66baebb 100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
+
from gnuradio import gr
from gnuradio import blocks
from gnuradio import filter
@@ -31,7 +34,7 @@ try:
from PyQt4 import QtGui, QtCore
import sip
except ImportError:
- print "Error: Program requires PyQt4 and gr-qtgui."
+ print("Error: Program requires PyQt4 and gr-qtgui.")
sys.exit(1)
class GrDataPlotParent(gr.top_block, QtGui.QWidget):
@@ -62,7 +65,7 @@ class GrDataPlotParent(gr.top_block, QtGui.QWidget):
self.layout.removeWidget(self.py_window)
self.disconnect(self.thr, (self.snk, 0))
self.disconnect(self.src[0], self.thr)
- for n in xrange(1, self._ncons):
+ for n in range(1, self._ncons):
self.disconnect(self.src[n], (self.snk,n))
self._ncons = nconnections
@@ -75,7 +78,7 @@ class GrDataPlotParent(gr.top_block, QtGui.QWidget):
self._last_data = []
self.src = []
- for n in xrange(self._ncons):
+ for n in range(self._ncons):
self.set_line_label(n, self.knobnames[n])
self._last_data.append(int(self._npts)*[0,])
@@ -142,7 +145,7 @@ class GrDataPlotParent(gr.top_block, QtGui.QWidget):
if(self._npts != npts):
# Adjust buffers to accommodate new settings
- for n in xrange(self._ncons):
+ for n in range(self._ncons):
if(npts < self._npts):
if(self._data_len[n] < npts):
self._last_data[n] = self._last_data[n][0:npts]
@@ -156,7 +159,7 @@ class GrDataPlotParent(gr.top_block, QtGui.QWidget):
if(self._stripchart):
# Update the plot data depending on type
- for n in xrange(self._ncons):
+ for n in range(self._ncons):
if(type(data[n]) == list):
data[n] = self.data_to_complex(data[n])
if(len(data[n]) > self._npts):
@@ -179,7 +182,7 @@ class GrDataPlotParent(gr.top_block, QtGui.QWidget):
self._last_data[n].append(data[n])
self.src[n].set_data(self._last_data[n])
else:
- for n in xrange(self._ncons):
+ for n in range(self._ncons):
if(type(data[n]) != list):
data[n] = [data[n],]
data[n] = self.data_to_complex(data[n])
@@ -407,11 +410,11 @@ class GrTimeRasterB(GrDataPlotParent):
self.snk.set_line_label(n, self.knobnames[n])
-class GrDataPlotterValueTable:
+class GrDataPlotterValueTable(object):
def __init__(self, uid, parent, x, y, xsize, ysize,
headers=['Statistic Key ( Source Block :: Stat Name ) ',
'Curent Value', 'Units', 'Description']):
- # must encapsulate, cuz Qt's bases are not classes
+ # must encapsulate, cuz Qt's bases are not classes
self.uid = uid
self.treeWidget = QtGui.QTreeWidget(parent)
self.treeWidget.setColumnCount(len(headers))
@@ -434,7 +437,7 @@ class GrDataPlotterValueTable:
# itemKey is the text in the first column of a QTreeWidgetItem
itemKey = str(item.text(0))
- if itemKey in knobs.keys():
+ if itemKey in list(knobs.keys()):
# This key was found in the tree, update its values.
foundKeys.append(itemKey)
@@ -465,7 +468,7 @@ class GrDataPlotterValueTable:
deleteKeys.append(itemKey)
# Add items to tree that are not currently in the tree.
- for k in knobs.keys():
+ for k in list(knobs.keys()):
if k not in foundKeys:
v = knobs[k].value
if(type(v) == ControlPort.complex):
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnection.py b/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnection.py
index 1b129534c..b85c827f7 100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnection.py
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnection.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
#
# Copyright 2015 Free Software Foundation, Inc.
#
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnectionThrift.py b/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnectionThrift.py
index 522c74117..466fc9fc0 100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnectionThrift.py
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/RPCConnectionThrift.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
@@ -30,7 +31,7 @@ from gnuradio import gr
import pmt
import sys
-class ThriftRadioClient:
+class ThriftRadioClient(object):
def __init__(self, host, port):
self.tsocket = TSocket.TSocket(host, port)
self.transport = TTransport.TBufferedTransport(self.tsocket)
@@ -55,7 +56,7 @@ Args:
"""
class RPCConnectionThrift(RPCConnection.RPCConnection):
- class Knob():
+ class Knob(object):
def __init__(self, key, value=None, ktype=0):
(self.key, self.value, self.ktype) = (key, value, ktype)
@@ -144,7 +145,7 @@ class RPCConnectionThrift(RPCConnection.RPCConnection):
def properties(self, *args):
knobprops = self.thriftclient.radio.properties(*args)
- for key, knobprop in knobprops.iteritems():
+ for key, knobprop in list(knobprops.items()):
#print("key:", key, "value:", knobprop, "type:", knobprop.type)
knobprops[key].min = self.unpackKnob(key, knobprop.min)
knobprops[key].max = self.unpackKnob(key, knobprop.max)
@@ -153,28 +154,28 @@ class RPCConnectionThrift(RPCConnection.RPCConnection):
def getKnobs(self, *args):
result = {}
- for key, knob in self.thriftclient.radio.getKnobs(*args).iteritems():
+ for key, knob in list(self.thriftclient.radio.getKnobs(*args).items()):
#print("key:", key, "value:", knob, "type:", knob.type)
result[key] = self.unpackKnob(key, knob)
# If complex, convert to Python complex
# FIXME: better list iterator way to handle this?
if(knob.type == self.BaseTypes.C32VECTOR):
- for i in xrange(len(result[key].value)):
+ for i in range(len(result[key].value)):
result[key].value[i] = complex(result[key].value[i].re,
result[key].value[i].im)
return result
def getKnobsRaw(self, *args):
result = {}
- for key, knob in self.thriftclient.radio.getKnobs(*args).iteritems():
+ for key, knob in list(self.thriftclient.radio.getKnobs(*args).items()):
#print("key:", key, "value:", knob, "type:", knob.type)
result[key] = knob
return result
def getRe(self,*args):
result = {}
- for key, knob in self.thriftclient.radio.getRe(*args).iteritems():
+ for key, knob in list(self.thriftclient.radio.getRe(*args).items()):
result[key] = self.unpackKnob(key, knob)
return result
@@ -182,7 +183,7 @@ class RPCConnectionThrift(RPCConnection.RPCConnection):
if(type(*args) == dict):
a = dict(*args)
result = {}
- for key, knob in a.iteritems():
+ for key, knob in list(a.items()):
result[key] = self.packKnob(knob)
self.thriftclient.radio.setKnobs(result)
elif(type(*args) == list or type(*args) == tuple):
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/__init__.py b/gnuradio-runtime/python/gnuradio/ctrlport/__init__.py
index 8f33d65bb..363d42a68 100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/__init__.py
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/__init__.py
@@ -1,3 +1,5 @@
+from __future__ import absolute_import
+from __future__ import unicode_literals
#
# Copyright 2012 Free Software Foundation, Inc.
#
@@ -22,7 +24,7 @@
# import swig generated symbols into the ctrlport namespace
#from ctrlport_swig import *
-from monitor import *
+from .monitor import *
# import any pure python here
#import GNURadio
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx b/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx
index 15a2153a0..302275feb 100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+
import sys, time, re, pprint
import random,math,operator
try:
@@ -36,14 +38,14 @@ try:
try:
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
except ImportError:
- print sys.argv[0], "could not load QTAgg backend."
+ print(sys.argv[0], "could not load QTAgg backend.")
sys.exit(1)
from matplotlib.figure import Figure
except ImportError:
- print sys.argv[0], "requires networkx and matplotlib.", \
- "Please check that they are installed and try again."
+ print(sys.argv[0], "requires networkx and matplotlib.",
+ "Please check that they are installed and try again.")
sys.exit(1)
from PyQt4 import QtCore,Qt
@@ -282,7 +284,7 @@ class ConInfoDialog(QtGui.QDialog):
class DataTable(QtGui.QWidget):
def update(self):
- print "update"
+ print("update")
def closeEvent(self, event):
self.timer = None
@@ -498,7 +500,7 @@ class MForm(QtGui.QWidget):
self.clockSel.setCurrentIndex(self.clockSelIdx)
self.prevent_clock_change = False
except:
- print "WARNING: Failed to get current clock setting!"
+ print("WARNING: Failed to get current clock setting!")
nodes_stream = self.G_stream.nodes()
nodes_msg = self.G_msg.nodes()
@@ -571,7 +573,7 @@ class MForm(QtGui.QWidget):
self.parent.statusBar().showMessage("Current GNU Radio Control Port Query Latency: %f ms"%\
(latency*1000))
- except Exception, e:
+ except Exception as e:
sys.stderr.write("gr-perf-monitorx: radio.getKnobs threw exception ({0}).\n".format(e))
if(type(self.parent) is MAINWindow):
# Find window of connection
@@ -625,7 +627,7 @@ class MForm(QtGui.QWidget):
return;
idx = self.clockSel.currentIndex();
clk = self.clocks.values()[idx]
-# print "UPDATE CLOCK!!! %d -> %d"%(idx,clk);
+# print("UPDATE CLOCK!!! %d -> %d"%(idx,clk);)
k = self.radioclient.getKnobs([self.clockKey]);
k[self.clockKey].value = clk;
km = {};
diff --git a/gnuradio-runtime/python/gnuradio/ctrlport/monitor.py b/gnuradio-runtime/python/gnuradio/ctrlport/monitor.py
index f651be244..49b66e983 100644
--- a/gnuradio-runtime/python/gnuradio/ctrlport/monitor.py
+++ b/gnuradio-runtime/python/gnuradio/ctrlport/monitor.py
@@ -20,12 +20,15 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
+
import sys, subprocess, re, signal, time, atexit, os
from gnuradio import gr
-class monitor:
+class monitor(object):
def __init__(self,tool="gr-ctrlport-monitor"):
- print "ControlPort Monitor running."
+ print("ControlPort Monitor running.")
self.started = False
self.tool = tool
atexit.register(self.shutdown)
@@ -38,35 +41,35 @@ class monitor:
gr.prefs().singleton().set_bool("PerfCounters","on",True);
gr.prefs().singleton().set_bool("PerfCounters","export",True);
except:
- print "no support for gr.prefs setting"
+ print("no support for gr.prefs setting")
def __del__(self):
if(self.started):
self.stop()
def start(self):
- print "monitor::endpoints() = %s" % (gr.rpcmanager_get().endpoints())
+ print("monitor::endpoints() = %s" % (gr.rpcmanager_get().endpoints()))
try:
cmd = map(lambda a: [self.tool,
re.search("-h (\S+|\d+\.\d+\.\d+\.\d+)",a).group(1),
re.search("-p (\d+)",a).group(1)],
gr.rpcmanager_get().endpoints())[0]
- print "running: %s"%(str(cmd))
+ print("running: %s"%(str(cmd)))
self.proc = subprocess.Popen(cmd);
self.started = True
except:
self.proc = None
- print "failed to to start ControlPort Monitor on specified port"
+ print("failed to to start ControlPort Monitor on specified port")
def stop(self):
if(self.proc):
if(self.proc.returncode == None):
- print "\tcalling stop on shutdown"
+ print("\tcalling stop on shutdown")
self.proc.terminate()
else:
- print "\tno proc to shut down, exiting"
+ print("\tno proc to shut down, exiting")
def shutdown(self):
- print "ctrlport.monitor received shutdown signal"
+ print("ctrlport.monitor received shutdown signal")
if(self.started):
self.stop()
diff --git a/gnuradio-runtime/python/gnuradio/eng_arg.py b/gnuradio-runtime/python/gnuradio/eng_arg.py
index 05cd8a1f2..598335244 100644
--- a/gnuradio-runtime/python/gnuradio/eng_arg.py
+++ b/gnuradio-runtime/python/gnuradio/eng_arg.py
@@ -22,6 +22,7 @@
'''
Add support for engineering notation to argparse.ArgumentParser
'''
+from __future__ import unicode_literals
import argparse
from gnuradio import eng_notation
diff --git a/gnuradio-runtime/python/gnuradio/eng_notation.py b/gnuradio-runtime/python/gnuradio/eng_notation.py
index d23f9005f..5a3a216ee 100644
--- a/gnuradio-runtime/python/gnuradio/eng_notation.py
+++ b/gnuradio-runtime/python/gnuradio/eng_notation.py
@@ -21,6 +21,7 @@
"""
Display numbers as strings using engineering notation.
"""
+from __future__ import unicode_literals
scale_factor = {}
scale_factor['E'] = 1e18
@@ -66,7 +67,7 @@ def str_to_num (value):
try:
scale = 1.0
suffix = value[-1]
- if scale_factor.has_key (suffix):
+ if suffix in scale_factor:
return float (value[0:-1]) * scale_factor[suffix]
return float (value)
except:
diff --git a/gnuradio-runtime/python/gnuradio/eng_option.py b/gnuradio-runtime/python/gnuradio/eng_option.py
index ae000fe44..565780be2 100644
--- a/gnuradio-runtime/python/gnuradio/eng_option.py
+++ b/gnuradio-runtime/python/gnuradio/eng_option.py
@@ -20,10 +20,12 @@
#
'''Add support for engineering notation to optparse.OptionParser'''
+from __future__ import absolute_import
+from __future__ import unicode_literals
from copy import copy
from optparse import Option, OptionValueError
-import eng_notation
+from . import eng_notation
def check_eng_float (option, opt, value):
try:
diff --git a/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt b/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt
index fc966b8ec..7c82b1df3 100644
--- a/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt
+++ b/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt
@@ -22,6 +22,7 @@ include(GrPython)
GR_PYTHON_INSTALL(FILES
__init__.py
+ exceptions.py
tag_utils.py
packet_utils.py
gateway.py
@@ -48,6 +49,6 @@ if(ENABLE_TESTING)
file(GLOB py_qa_test_files "qa_*.py")
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gnuradio-runtime/python/gnuradio/gr/__init__.py b/gnuradio-runtime/python/gnuradio/gr/__init__.py
index 9717390e3..72f54e9f4 100644
--- a/gnuradio-runtime/python/gnuradio/gr/__init__.py
+++ b/gnuradio-runtime/python/gnuradio/gr/__init__.py
@@ -24,6 +24,8 @@
"""
Core contents.
"""
+from __future__ import absolute_import
+from __future__ import unicode_literals
# This is the main GNU Radio python module.
# We pull the swig output and the other modules into the gnuradio.gr namespace
@@ -31,20 +33,20 @@ Core contents.
# If gnuradio is installed then the swig output will be in this directory.
# Otherwise it will reside in ../../../swig.
-import os
+import os, sys
try:
- from runtime_swig import *
+ from .runtime_swig import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "..", "swig"))
- from runtime_swig import *
+ from .runtime_swig import *
-from exceptions import *
-from top_block import *
-from hier_block2 import *
-from tag_utils import *
-from gateway import basic_block, sync_block, decim_block, interp_block
+from .exceptions import *
+from .top_block import *
+from .hier_block2 import *
+from .tag_utils import *
+from .gateway import basic_block, sync_block, decim_block, interp_block
# Force the preference database to be initialized
prefs = prefs.singleton
diff --git a/gnuradio-runtime/python/gnuradio/gr/exceptions.py b/gnuradio-runtime/python/gnuradio/gr/exceptions.py
index dba04750b..1b7fd025b 100644
--- a/gnuradio-runtime/python/gnuradio/gr/exceptions.py
+++ b/gnuradio-runtime/python/gnuradio/gr/exceptions.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
#
# Copyright 2004 Free Software Foundation, Inc.
#
diff --git a/gnuradio-runtime/python/gnuradio/gr/gateway.py b/gnuradio-runtime/python/gnuradio/gr/gateway.py
index 8403421dd..1acf900f8 100644
--- a/gnuradio-runtime/python/gnuradio/gr/gateway.py
+++ b/gnuradio-runtime/python/gnuradio/gr/gateway.py
@@ -19,18 +19,23 @@
# Boston, MA 02110-1301, USA.
#
-import runtime_swig as gr
-from runtime_swig import io_signature, io_signaturev
-from runtime_swig import block_gw_message_type
-from runtime_swig import block_gateway
+from __future__ import print_function
+from __future__ import unicode_literals
+
+
import numpy
+from . import runtime_swig as gr
+from .runtime_swig import io_signature, io_signaturev
+from .runtime_swig import block_gw_message_type
+from .runtime_swig import block_gateway
+
########################################################################
# Magic to turn pointers into numpy arrays
# http://docs.scipy.org/doc/numpy/reference/arrays.interface.html
########################################################################
def pointer_to_ndarray(addr, dtype, nitems):
- class array_like:
+ class array_like(object):
__array_interface__ = {
'data' : (int(addr), False),
'typestr' : dtype.base.str,
@@ -87,13 +92,13 @@ class gateway_block(object):
#ensure that the sigs are iterable dtypes
def sig_to_dtype_sig(sig):
if sig is None: sig = ()
- return map(numpy.dtype, sig)
+ return list(map(numpy.dtype, sig))
self.__in_sig = sig_to_dtype_sig(in_sig)
self.__out_sig = sig_to_dtype_sig(out_sig)
#cache the ranges to iterate when dispatching work
- self.__in_indexes = range(len(self.__in_sig))
- self.__out_indexes = range(len(self.__out_sig))
+ self.__in_indexes = list(range(len(self.__in_sig)))
+ self.__out_indexes = list(range(len(self.__out_sig)))
#convert the signatures into gr.io_signatures
def sig_to_gr_io_sigv(sig):
diff --git a/gnuradio-runtime/python/gnuradio/gr/gr_threading.py b/gnuradio-runtime/python/gnuradio/gr/gr_threading.py
index 5d6f0fdaf..cb0519f6f 100644
--- a/gnuradio-runtime/python/gnuradio/gr/gr_threading.py
+++ b/gnuradio-runtime/python/gnuradio/gr/gr_threading.py
@@ -1,3 +1,5 @@
+from __future__ import absolute_import
+from __future__ import unicode_literals
#
# Copyright 2005 Free Software Foundation, Inc.
#
@@ -25,10 +27,10 @@ from sys import version_info as _version_info
if _version_info[0:2] == (2, 3):
#print "Importing gr_threading_23"
- from gr_threading_23 import *
+ from .gr_threading_23 import *
elif _version_info[0:2] == (2, 4):
#print "Importing gr_threading_24"
- from gr_threading_24 import *
+ from .gr_threading_24 import *
else:
# assume the patch was applied...
#print "Importing system provided threading"
diff --git a/gnuradio-runtime/python/gnuradio/gr/gr_threading_23.py b/gnuradio-runtime/python/gnuradio/gr/gr_threading_23.py
index 795c1593d..f4f062f71 100644
--- a/gnuradio-runtime/python/gnuradio/gr/gr_threading_23.py
+++ b/gnuradio-runtime/python/gnuradio/gr/gr_threading_23.py
@@ -4,15 +4,18 @@
# It's been patched to fix a problem with join, where a KeyboardInterrupt
# caused a lock to be left in the acquired state.
+from __future__ import print_function
+from __future__ import unicode_literals
+
import sys as _sys
try:
- import thread
+ import _thread
except ImportError:
del _sys.modules[__name__]
raise
-from StringIO import StringIO as _StringIO
+from io import StringIO as _StringIO
from time import time as _time, sleep as _sleep
from traceback import print_exc as _print_exc
@@ -21,11 +24,11 @@ __all__ = ['activeCount', 'Condition', 'currentThread', 'enumerate', 'Event',
'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread',
'Timer', 'setprofile', 'settrace']
-_start_new_thread = thread.start_new_thread
-_allocate_lock = thread.allocate_lock
-_get_ident = thread.get_ident
-ThreadError = thread.error
-del thread
+_start_new_thread = _thread.start_new_thread
+_allocate_lock = _thread.allocate_lock
+_get_ident = _thread.get_ident
+ThreadError = _thread.error
+del _thread
# Debug support (adapted from ihooks.py).
@@ -127,8 +130,9 @@ class _RLock(_Verbose):
# Internal methods used by condition variables
- def _acquire_restore(self, (count, owner)):
+ def _acquire_restore(self, lock):
self.__block.acquire()
+ count, owner = lock
self.__count = count
self.__owner = owner
if __debug__:
@@ -313,7 +317,7 @@ class _BoundedSemaphore(_Semaphore):
def release(self):
if self._Semaphore__value >= self._initial_value:
- raise ValueError, "Semaphore released too many times"
+ raise ValueError("Semaphore released too many times")
return _Semaphore.release(self)
@@ -627,7 +631,7 @@ def activeCount():
def enumerate():
_active_limbo_lock.acquire()
- active = _active.values() + _limbo.values()
+ active = list(_active.values()) + list(_limbo.values())
_active_limbo_lock.release()
return active
@@ -698,7 +702,7 @@ def _test():
def run(self):
while self.count > 0:
item = self.queue.get()
- print item
+ print(item)
self.count = self.count - 1
NP = 3
diff --git a/gnuradio-runtime/python/gnuradio/gr/gr_threading_24.py b/gnuradio-runtime/python/gnuradio/gr/gr_threading_24.py
index 8ad880b09..6dddce7e2 100644
--- a/gnuradio-runtime/python/gnuradio/gr/gr_threading_24.py
+++ b/gnuradio-runtime/python/gnuradio/gr/gr_threading_24.py
@@ -4,10 +4,13 @@
# It's been patched to fix a problem with join, where a KeyboardInterrupt
# caused a lock to be left in the acquired state.
+from __future__ import print_function
+from __future__ import unicode_literals
+
import sys as _sys
try:
- import thread
+ import _thread
except ImportError:
del _sys.modules[__name__]
raise
@@ -21,11 +24,11 @@ __all__ = ['activeCount', 'Condition', 'currentThread', 'enumerate', 'Event',
'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread',
'Timer', 'setprofile', 'settrace', 'local']
-_start_new_thread = thread.start_new_thread
-_allocate_lock = thread.allocate_lock
-_get_ident = thread.get_ident
-ThreadError = thread.error
-del thread
+_start_new_thread = _thread.start_new_thread
+_allocate_lock = _thread.allocate_lock
+_get_ident = _thread.get_ident
+ThreadError = _thread.error
+del _thread
# Debug support (adapted from ihooks.py).
@@ -127,8 +130,9 @@ class _RLock(_Verbose):
# Internal methods used by condition variables
- def _acquire_restore(self, (count, owner)):
+ def _acquire_restore(self, lock):
self.__block.acquire()
+ count, owner = lock
self.__count = count
self.__owner = owner
if __debug__:
@@ -311,7 +315,7 @@ class _BoundedSemaphore(_Semaphore):
def release(self):
if self._Semaphore__value >= self._initial_value:
- raise ValueError, "Semaphore released too many times"
+ raise ValueError("Semaphore released too many times")
return _Semaphore.release(self)
@@ -688,7 +692,7 @@ def activeCount():
def enumerate():
_active_limbo_lock.acquire()
- active = _active.values() + _limbo.values()
+ active = list(_active.values()) + list(_limbo.values())
_active_limbo_lock.release()
return active
@@ -700,7 +704,7 @@ _MainThread()
# module, or from the python fallback
try:
- from thread import _local as local
+ from _thread import _local as local
except ImportError:
from _threading_local import local
@@ -767,7 +771,7 @@ def _test():
def run(self):
while self.count > 0:
item = self.queue.get()
- print item
+ print(item)
self.count = self.count - 1
NP = 3
diff --git a/gnuradio-runtime/python/gnuradio/gr/hier_block2.py b/gnuradio-runtime/python/gnuradio/gr/hier_block2.py
index 3f4c6aa9c..8d0533c71 100644
--- a/gnuradio-runtime/python/gnuradio/gr/hier_block2.py
+++ b/gnuradio-runtime/python/gnuradio/gr/hier_block2.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
#
# Copyright 2006,2007,2014 Free Software Foundation, Inc.
#
@@ -21,7 +22,7 @@
import functools
-from runtime_swig import hier_block2_swig, dot_graph
+from .runtime_swig import hier_block2_swig, dot_graph
import pmt
diff --git a/gnuradio-runtime/python/gnuradio/gr/packet_utils.py b/gnuradio-runtime/python/gnuradio/gr/packet_utils.py
index 720cfd962..770a5c0b3 100644
--- a/gnuradio-runtime/python/gnuradio/gr/packet_utils.py
+++ b/gnuradio-runtime/python/gnuradio/gr/packet_utils.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
import pmt
@@ -28,9 +31,9 @@ def make_lengthtags(lengths, offsets, tagname='length', vlen=1):
assert(len(offsets) == len(lengths))
for offset, length in zip(offsets, lengths):
tag = gr.tag_t()
- tag.offset = offset/vlen
+ tag.offset = offset // vlen
tag.key = pmt.string_to_symbol(tagname)
- tag.value = pmt.from_long(length/vlen)
+ tag.value = pmt.from_long(length // vlen)
tags.append(tag)
return tags
@@ -73,7 +76,7 @@ def count_bursts(data, tags, tsb_tag_key, vlen=1):
if pos in lengths:
if in_packet:
print("Got tag at pos {0} current packet_pos is {1}".format(pos, packet_pos))
- raise StandardError("Received packet tag while in packet.")
+ raise Exception("Received packet tag while in packet.")
packet_pos = -1
packet_length = lengths[pos]
in_packet = True
@@ -128,9 +131,9 @@ def packets_to_vectors(packets, tsb_tag_key, vlen=1):
for packet in packets:
data.extend(packet)
tag = gr.tag_t()
- tag.offset = offset/vlen
+ tag.offset = offset // vlen
tag.key = pmt.string_to_symbol(tsb_tag_key)
- tag.value = pmt.from_long(len(packet)/vlen)
+ tag.value = pmt.from_long(len(packet) // vlen)
tags.append(tag)
offset = offset + len(packet)
return data, tags
diff --git a/gnuradio-runtime/python/gnuradio/gr/pubsub.py b/gnuradio-runtime/python/gnuradio/gr/pubsub.py
index 90568418f..25108b8f7 100644
--- a/gnuradio-runtime/python/gnuradio/gr/pubsub.py
+++ b/gnuradio-runtime/python/gnuradio/gr/pubsub.py
@@ -26,43 +26,46 @@ Abstract GNU Radio publisher/subscriber interface
This is a proof of concept implementation, will likely change significantly.
"""
+from __future__ import print_function
+from __future__ import unicode_literals
+
class pubsub(dict):
def __init__(self):
- self._publishers = { }
- self._subscribers = { }
- self._proxies = { }
+ self._publishers = { }
+ self._subscribers = { }
+ self._proxies = { }
def __missing__(self, key, value=None):
- dict.__setitem__(self, key, value)
- self._publishers[key] = None
- self._subscribers[key] = []
- self._proxies[key] = None
+ dict.__setitem__(self, key, value)
+ self._publishers[key] = None
+ self._subscribers[key] = []
+ self._proxies[key] = None
def __setitem__(self, key, val):
- if not self.has_key(key):
- self.__missing__(key, val)
- elif self._proxies[key] is not None:
- (p, newkey) = self._proxies[key]
- p[newkey] = val
- else:
- dict.__setitem__(self, key, val)
- for sub in self._subscribers[key]:
- # Note this means subscribers will get called in the thread
- # context of the 'set' caller.
- sub(val)
+ if key not in self:
+ self.__missing__(key, val)
+ elif self._proxies[key] is not None:
+ (p, newkey) = self._proxies[key]
+ p[newkey] = val
+ else:
+ dict.__setitem__(self, key, val)
+ for sub in self._subscribers[key]:
+ # Note this means subscribers will get called in the thread
+ # context of the 'set' caller.
+ sub(val)
def __getitem__(self, key):
- if not self.has_key(key): self.__missing__(key)
- if self._proxies[key] is not None:
- (p, newkey) = self._proxies[key]
- return p[newkey]
- elif self._publishers[key] is not None:
- return self._publishers[key]()
- else:
- return dict.__getitem__(self, key)
+ if key not in self: self.__missing__(key)
+ if self._proxies[key] is not None:
+ (p, newkey) = self._proxies[key]
+ return p[newkey]
+ elif self._publishers[key] is not None:
+ return self._publishers[key]()
+ else:
+ return dict.__getitem__(self, key)
def publish(self, key, publisher):
- if not self.has_key(key): self.__missing__(key)
+ if key not in self: self.__missing__(key)
if self._proxies[key] is not None:
(p, newkey) = self._proxies[key]
p.publish(newkey, publisher)
@@ -70,7 +73,7 @@ class pubsub(dict):
self._publishers[key] = publisher
def subscribe(self, key, subscriber):
- if not self.has_key(key): self.__missing__(key)
+ if key not in self: self.__missing__(key)
if self._proxies[key] is not None:
(p, newkey) = self._proxies[key]
p.subscribe(newkey, subscriber)
@@ -92,9 +95,9 @@ class pubsub(dict):
self._subscribers[key].remove(subscriber)
def proxy(self, key, p, newkey=None):
- if not self.has_key(key): self.__missing__(key)
- if newkey is None: newkey = key
- self._proxies[key] = (p, newkey)
+ if key not in self: self.__missing__(key)
+ if newkey is None: newkey = key
+ self._proxies[key] = (p, newkey)
def unproxy(self, key):
self._proxies[key] = None
@@ -105,49 +108,49 @@ if __name__ == "__main__":
o = pubsub()
# Non-existent key gets auto-created with None value
- print "Auto-created key 'foo' value:", o['foo']
+ print("Auto-created key 'foo' value:", o['foo'])
# Add some subscribers
# First is a bare function
def print_len(x):
- print "len=%i" % (len(x), )
+ print("len=%i" % (len(x), ))
o.subscribe('foo', print_len)
# The second is a class member function
class subber(object):
- def __init__(self, param):
- self._param = param
- def printer(self, x):
- print self._param, `x`
+ def __init__(self, param):
+ self._param = param
+ def printer(self, x):
+ print(self._param, repr(x))
s = subber('param')
o.subscribe('foo', s.printer)
# The third is a lambda function
- o.subscribe('foo', lambda x: sys.stdout.write('val='+`x`+'\n'))
+ o.subscribe('foo', lambda x: sys.stdout.write('val='+repr(x)+'\n'))
# Update key 'foo', will notify subscribers
- print "Updating 'foo' with three subscribers:"
+ print("Updating 'foo' with three subscribers:")
o['foo'] = 'bar';
# Remove first subscriber
o.unsubscribe('foo', print_len)
# Update now will only trigger second and third subscriber
- print "Updating 'foo' after removing a subscriber:"
+ print("Updating 'foo' after removing a subscriber:")
o['foo'] = 'bar2';
# Publish a key as a function, in this case, a lambda function
o.publish('baz', lambda : 42)
- print "Published value of 'baz':", o['baz']
+ print("Published value of 'baz':", o['baz'])
# Unpublish the key
o.unpublish('baz')
# This will return None, as there is no publisher
- print "Value of 'baz' with no publisher:", o['baz']
+ print("Value of 'baz' with no publisher:", o['baz'])
# Set 'baz' key, it gets cached
o['baz'] = 'bazzz'
# Now will return cached value, since no provider
- print "Cached value of 'baz' after being set:", o['baz']
+ print("Cached value of 'baz' after being set:", o['baz'])
diff --git a/gnuradio-runtime/python/gnuradio/gr/qa_feval.py b/gnuradio-runtime/python/gnuradio/gr/qa_feval.py
index 9018e12f3..078e2bf78 100755..100644
--- a/gnuradio-runtime/python/gnuradio/gr/qa_feval.py
+++ b/gnuradio-runtime/python/gnuradio/gr/qa_feval.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest
class my_add2_dd(gr.feval_dd):
diff --git a/gnuradio-runtime/python/gnuradio/gr/qa_flowgraph.py b/gnuradio-runtime/python/gnuradio/gr/qa_flowgraph.py
index fa4fd4910..f5802c51b 100755..100644
--- a/gnuradio-runtime/python/gnuradio/gr/qa_flowgraph.py
+++ b/gnuradio-runtime/python/gnuradio/gr/qa_flowgraph.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import time
import pmt
from gnuradio import gr, gr_unittest, blocks
diff --git a/gnuradio-runtime/python/gnuradio/gr/qa_hier_block2.py b/gnuradio-runtime/python/gnuradio/gr/qa_hier_block2.py
index 005331c2e..c8f3d1a5f 100644
--- a/gnuradio-runtime/python/gnuradio/gr/qa_hier_block2.py
+++ b/gnuradio-runtime/python/gnuradio/gr/qa_hier_block2.py
@@ -19,9 +19,12 @@
# Boston, MA 02110-1301, USA.
#
-import pmt, time
+import time
+
from gnuradio import gr_unittest, blocks, gr, analog
from gnuradio.gr.hier_block2 import _multiple_endpoints, _optional_endpoints
+import pmt
+
class test_hblk(gr.hier_block2):
def __init__(self, io_sig=1*[gr.sizeof_gr_complex], ndebug=2):
@@ -126,7 +129,7 @@ class test_hier_block2(gr_unittest.TestCase):
time.sleep(1)
tb.stop()
tb.wait()
-
+
def test_012(self):
s, st, h, k = analog.sig_source_c(44100, analog.GR_COS_WAVE, 440, 1.0, 0.0), blocks.message_strobe(pmt.PMT_NIL, 100), blocks.head(gr.sizeof_gr_complex, 1000), test_hblk([gr.sizeof_gr_complex], 16)
tb = gr.top_block()
@@ -139,4 +142,3 @@ class test_hier_block2(gr_unittest.TestCase):
if __name__ == '__main__':
gr_unittest.run(test_hier_block2, "test_hier_block2.xml")
-
diff --git a/gnuradio-runtime/python/gnuradio/gr/qa_kludged_imports.py b/gnuradio-runtime/python/gnuradio/gr/qa_kludged_imports.py
index f80188c9f..e2e9047c9 100755..100644
--- a/gnuradio-runtime/python/gnuradio/gr/qa_kludged_imports.py
+++ b/gnuradio-runtime/python/gnuradio/gr/qa_kludged_imports.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest
class test_kludged_imports (gr_unittest.TestCase):
diff --git a/gnuradio-runtime/python/gnuradio/gr/qa_random.py b/gnuradio-runtime/python/gnuradio/gr/qa_random.py
index d3e541045..6fbf5e478 100644
--- a/gnuradio-runtime/python/gnuradio/gr/qa_random.py
+++ b/gnuradio-runtime/python/gnuradio/gr/qa_random.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest
import numpy as np
diff --git a/gnuradio-runtime/python/gnuradio/gr/qa_tag_utils.py b/gnuradio-runtime/python/gnuradio/gr/qa_tag_utils.py
index 55b62a12a..3d7b99d12 100755..100644
--- a/gnuradio-runtime/python/gnuradio/gr/qa_tag_utils.py
+++ b/gnuradio-runtime/python/gnuradio/gr/qa_tag_utils.py
@@ -20,12 +20,12 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+
+
from gnuradio import gr, gr_unittest
+import pmt
-try:
- import pmt_swig as pmt
-except ImportError:
- import pmt
class test_tag_utils (gr_unittest.TestCase):
@@ -111,6 +111,6 @@ class test_tag_utils (gr_unittest.TestCase):
if __name__ == '__main__':
- print 'hi'
+ print('hi')
gr_unittest.run(test_tag_utils, "test_tag_utils.xml")
diff --git a/gnuradio-runtime/python/gnuradio/gr/tag_utils.py b/gnuradio-runtime/python/gnuradio/gr/tag_utils.py
index 0d4805a8b..d054865c2 100644
--- a/gnuradio-runtime/python/gnuradio/gr/tag_utils.py
+++ b/gnuradio-runtime/python/gnuradio/gr/tag_utils.py
@@ -1,6 +1,7 @@
+from __future__ import unicode_literals
import pmt
-import runtime_swig as gr
+from . import runtime_swig as gr
class PythonTag(object):
" Python container for tags "
@@ -51,29 +52,29 @@ def python_to_tag(tag_struct):
good = False
tag = gr.tag_t()
if(type(tag_struct) == dict):
- if(tag_struct.has_key('offset')):
- if(isinstance(tag_struct['offset'], (int,long))):
+ if('offset' in tag_struct):
+ if(isinstance(tag_struct['offset'], int)):
tag.offset = tag_struct['offset']
good = True
- if(tag_struct.has_key('key')):
+ if('key' in tag_struct):
if(isinstance(tag_struct['key'], pmt.swig_int_ptr)):
tag.key = tag_struct['key']
good = True
- if(tag_struct.has_key('value')):
+ if('value' in tag_struct):
if(isinstance(tag_struct['value'], pmt.swig_int_ptr)):
tag.value = tag_struct['value']
good = True
- if(tag_struct.has_key('srcid')):
+ if('srcid' in tag_struct):
if(isinstance(tag_struct['srcid'], pmt.swig_int_ptr)):
tag.srcid = tag_struct['srcid']
good = True
elif(type(tag_struct) == list or type(tag_struct) == tuple):
if(len(tag_struct) == 4):
- if(isinstance(tag_struct[0], (int,long))):
+ if(isinstance(tag_struct[0], int)):
tag.offset = tag_struct[0]
good = True
@@ -90,7 +91,7 @@ def python_to_tag(tag_struct):
good = True
elif(len(tag_struct) == 3):
- if(isinstance(tag_struct[0], (int,long))):
+ if(isinstance(tag_struct[0], int)):
tag.offset = tag_struct[0]
good = True
diff --git a/gnuradio-runtime/python/gnuradio/gr/top_block.py b/gnuradio-runtime/python/gnuradio/gr/top_block.py
index 2efcbd9aa..e7608bf5e 100644
--- a/gnuradio-runtime/python/gnuradio/gr/top_block.py
+++ b/gnuradio-runtime/python/gnuradio/gr/top_block.py
@@ -19,15 +19,18 @@
# Boston, MA 02110-1301, USA.
#
-from runtime_swig import top_block_swig, \
- top_block_wait_unlocked, top_block_run_unlocked, \
- top_block_start_unlocked, top_block_stop_unlocked, \
- top_block_unlock_unlocked, dot_graph_tb
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
+from .runtime_swig import (top_block_swig,
+ top_block_wait_unlocked, top_block_run_unlocked,
+ top_block_start_unlocked, top_block_stop_unlocked,
+ top_block_unlock_unlocked, dot_graph_tb)
#import gnuradio.gr.gr_threading as _threading
-import gr_threading as _threading
+from . import gr_threading as _threading
-from hier_block2 import hier_block2
+from .hier_block2 import hier_block2
class _top_block_waiter(_threading.Thread):
"""
diff --git a/gnuradio-runtime/python/gnuradio/gr_unittest.py b/gnuradio-runtime/python/gnuradio/gr_unittest.py
index b20fa076d..1b8323ad7 100755..100644
--- a/gnuradio-runtime/python/gnuradio/gr_unittest.py
+++ b/gnuradio-runtime/python/gnuradio/gr_unittest.py
@@ -22,10 +22,16 @@
"""
GNU radio specific extension of unittest.
"""
+from __future__ import absolute_import
+from __future__ import unicode_literals
+from __future__ import division
+
+import os
+import stat
import unittest
-import gr_xmlrunner
-import sys, os, stat
+from . import gr_xmlrunner
+
class TestCase(unittest.TestCase):
"""A subclass of unittest.TestCase that adds additional assertions
@@ -43,11 +49,12 @@ class TestCase(unittest.TestCase):
as significant digits (measured from the most significant digit).
"""
if round(second.real-first.real, places) != 0:
- raise self.failureException, \
- (msg or '%s != %s within %s places' % (`first`, `second`, `places` ))
+ raise self.failureException(
+ msg or '%r != %r within %r places' % (first, second, places))
if round(second.imag-first.imag, places) != 0:
- raise self.failureException, \
- (msg or '%s != %s within %s places' % (`first`, `second`, `places` ))
+ raise self.failureException(
+ msg or '%r != %r within %r places' % (first, second, places)
+ )
def assertComplexAlmostEqual2 (self, ref, x, abs_eps=1e-12, rel_eps=1e-6, msg=None):
"""
@@ -57,48 +64,52 @@ class TestCase(unittest.TestCase):
return
if abs(ref) > abs_eps:
- if abs(ref-x)/abs(ref) > rel_eps:
- raise self.failureException, \
- (msg or '%s != %s rel_error = %s rel_limit = %s' % (
- `ref`, `x`, abs(ref-x)/abs(ref), `rel_eps` ))
+ if abs(ref-x) / abs(ref) > rel_eps:
+ raise self.failureException(
+ msg or '%r != %r rel_error = %r rel_limit = %r' % (
+ ref, x, abs(ref-x) / abs(ref), rel_eps
+ )
+ )
else:
- raise self.failureException, \
- (msg or '%s != %s rel_error = %s rel_limit = %s' % (
- `ref`, `x`, abs(ref-x)/abs(ref), `rel_eps` ))
+ raise self.failureException(
+ msg or '%r != %r rel_error = %r rel_limit = %r' % (
+ ref, x, abs(ref-x) / abs(ref), rel_eps
+ )
+ )
def assertComplexTuplesAlmostEqual (self, a, b, places=7, msg=None):
self.assertEqual (len(a), len(b))
- for i in xrange (len(a)):
+ for i in range (len(a)):
self.assertComplexAlmostEqual (a[i], b[i], places, msg)
def assertComplexTuplesAlmostEqual2 (self, ref, x,
abs_eps=1e-12, rel_eps=1e-6, msg=None):
self.assertEqual (len(ref), len(x))
- for i in xrange (len(ref)):
+ for i in range (len(ref)):
try:
self.assertComplexAlmostEqual2 (ref[i], x[i], abs_eps, rel_eps, msg)
- except self.failureException, e:
+ except self.failureException as e:
#sys.stderr.write("index = %d " % (i,))
- #sys.stderr.write("%s\n" % (e,))
+ #sys.stderr.write("%r\n" % (e,))
raise
def assertFloatTuplesAlmostEqual (self, a, b, places=7, msg=None):
self.assertEqual (len(a), len(b))
- for i in xrange (len(a)):
+ for i in range (len(a)):
self.assertAlmostEqual (a[i], b[i], places, msg)
def assertFloatTuplesAlmostEqual2 (self, ref, x,
abs_eps=1e-12, rel_eps=1e-6, msg=None):
self.assertEqual (len(ref), len(x))
- for i in xrange (len(ref)):
+ for i in range (len(ref)):
try:
self.assertComplexAlmostEqual2 (ref[i], x[i], abs_eps, rel_eps, msg)
- except self.failureException, e:
+ except self.failureException as e:
#sys.stderr.write("index = %d " % (i,))
- #sys.stderr.write("%s\n" % (e,))
+ #sys.stderr.write("%r\n" % (e,))
raise
@@ -124,7 +135,7 @@ def run(PUT, filename=None):
path = basepath + "/python"
if not os.path.exists(basepath):
- os.makedirs(basepath, 0750)
+ os.makedirs(basepath, mode=0o750)
xmlrunner = None
# only proceed if .unittests is writable
@@ -132,13 +143,13 @@ def run(PUT, filename=None):
if(st & stat.S_IWUSR > 0):
# Test if path exists; if not, build it
if not os.path.exists(path):
- os.makedirs(path, 0750)
+ os.makedirs(path, mode=0o750)
# Just for safety: make sure we can write here, too
st = os.stat(path)[stat.ST_MODE]
if(st & stat.S_IWUSR > 0):
# Create an XML runner to filename
- fout = file(path+"/"+filename, "w")
+ fout = open(path+"/"+filename, "w")
xmlrunner = gr_xmlrunner.XMLTestRunner(fout)
txtrunner = TextTestRunner(verbosity=1)
@@ -148,7 +159,7 @@ def run(PUT, filename=None):
suite = TestLoader().loadTestsFromTestCase(PUT)
# use the xmlrunner if we can write the the directory
- if(xmlrunner is not None):
+ if xmlrunner is not None:
xmlrunner.run(suite)
main()
diff --git a/gnuradio-runtime/python/gnuradio/gr_xmlrunner.py b/gnuradio-runtime/python/gnuradio/gr_xmlrunner.py
index 31298197f..fccb1b76f 100644
--- a/gnuradio-runtime/python/gnuradio/gr_xmlrunner.py
+++ b/gnuradio-runtime/python/gnuradio/gr_xmlrunner.py
@@ -1,25 +1,56 @@
"""
XML Test Runner for PyUnit
"""
-
# Written by Sebastian Rittau <srittau@jroger.in-berlin.de> and placed in
# the Public Domain. With contributions by Paolo Borelli and others.
# Added to GNU Radio Oct. 3, 2010
-__version__ = "0.1"
+from __future__ import unicode_literals
import os.path
import re
import sys
import time
-import traceback
import unittest
+import linecache
from xml.sax.saxutils import escape
+from io import StringIO
+
+
+__version__ = "0.1"
-try:
- from StringIO import StringIO
-except ImportError:
- from io import StringIO
+
+# inline trackeback.print_tb so that py2 uses unicode literals (py2/3 compat)
+def print_tb(tb, limit=None, out=None):
+ """Print up to 'limit' stack trace entries from the traceback 'tb'.
+
+ If 'limit' is omitted or None, all entries are printed. If 'file'
+ is omitted or None, the output goes to sys.stderr; otherwise
+ 'file' should be an open file or file-like object with a write()
+ method.
+ """
+ def _print(out, s='', terminator='\n'):
+ out.write(s+terminator)
+
+ if out is None:
+ out = sys.stderr
+ if limit is None:
+ if hasattr(sys, 'tracebacklimit'):
+ limit = sys.tracebacklimit
+ n = 0
+ while tb is not None and (limit is None or n < limit):
+ f = tb.tb_frame
+ lineno = tb.tb_lineno
+ co = f.f_code
+ filename = co.co_filename
+ name = co.co_name
+ _print(out, ' Out "%s", line %d, in %s' % (filename, lineno, name))
+ linecache.checkcache(filename)
+ line = linecache.getline(filename, lineno, f.f_globals)
+ if line:
+ _print(out, ' ' + line.strip())
+ tb = tb.tb_next
+ n = n+1
class _TestInfo(object):
@@ -60,12 +91,12 @@ class _TestInfo(object):
supplied stream.
"""
- stream.write(' <testcase classname="%(class)s" name="%(method)s" time="%(time).4f">' % \
- {
- "class": self._class,
- "method": self._method,
- "time": self._time,
- })
+ stream.write(' <testcase classname="%(class)s" name="%(method)s" time="%(time).4f">' %
+ {
+ 'class': self._class,
+ 'method': self._method,
+ 'time': self._time,
+ })
if self._failure is not None:
self._print_error(stream, 'failure', self._failure)
if self._error is not None:
@@ -76,10 +107,10 @@ class _TestInfo(object):
"""Print information from a failure or error to the supplied stream."""
text = escape(str(error[1]))
stream.write('\n')
- stream.write(' <%s type="%s">%s\n' \
- % (tagname, _clsname(error[0]), text))
+ stream.write(' <%s type="%s">%s\n'
+ % (tagname, _clsname(error[0]), text))
tb_stream = StringIO()
- traceback.print_tb(error[2], None, tb_stream)
+ print_tb(error[2], None, tb_stream)
stream.write(escape(tb_stream.getvalue()))
stream.write(' </%s>\n' % tagname)
stream.write(' ')
@@ -137,14 +168,17 @@ class _XMLTestResult(unittest.TestResult):
output and standard error streams must be passed in.a
"""
- stream.write('<testsuite errors="%(e)d" failures="%(f)d" ' % \
- { "e": len(self.errors), "f": len(self.failures) })
- stream.write('name="%(n)s" tests="%(t)d" time="%(time).3f">\n' % \
- {
- "n": self._test_name,
- "t": self.testsRun,
- "time": time_taken,
- })
+ stream.write('<testsuite errors="%(e)d" failures="%(f)d" ' %
+ {
+ "e": len(self.errors),
+ "f": len(self.failures)
+ })
+ stream.write('name="%(n)s" tests="%(t)d" time="%(time).3f">\n' %
+ {
+ "n": self._test_name,
+ "t": self.testsRun,
+ "time": time_taken
+ })
for info in self._tests:
info.print_report(stream)
stream.write(' <system-out><![CDATA[%s]]></system-out>\n' % out)
@@ -173,9 +207,9 @@ class XMLTestRunner(object):
"""Run the given test case or test suite."""
class_ = test.__class__
classname = class_.__module__ + "." + class_.__name__
- if self._stream == None:
+ if self._stream is None:
filename = "TEST-%s.xml" % classname
- stream = file(os.path.join(self._path, filename), "w")
+ stream = open(os.path.join(self._path, filename), "w")
stream.write('<?xml version="1.0" encoding="utf-8"?>\n')
else:
stream = self._stream
diff --git a/gnuradio-runtime/python/gnuradio/gru/__init__.py b/gnuradio-runtime/python/gnuradio/gru/__init__.py
index 4e41d03a7..0948edb17 100644
--- a/gnuradio-runtime/python/gnuradio/gru/__init__.py
+++ b/gnuradio-runtime/python/gnuradio/gru/__init__.py
@@ -1,13 +1,15 @@
+from __future__ import absolute_import
+from __future__ import unicode_literals
# make this a package
# Import gru stuff
-from daemon import *
-from freqz import *
-from gnuplot_freqz import *
-from hexint import *
-from listmisc import *
-from mathmisc import *
-from msgq_runner import *
-from os_read_exactly import *
-from seq_with_cursor import *
-from socket_stuff import *
+from .daemon import *
+from .freqz import *
+from .gnuplot_freqz import *
+from .hexint import *
+from .listmisc import *
+from .mathmisc import *
+from .msgq_runner import *
+from .os_read_exactly import *
+from .seq_with_cursor import *
+from .socket_stuff import *
diff --git a/gnuradio-runtime/python/gnuradio/gru/daemon.py b/gnuradio-runtime/python/gnuradio/gru/daemon.py
index e04702152..14138f973 100644
--- a/gnuradio-runtime/python/gnuradio/gru/daemon.py
+++ b/gnuradio-runtime/python/gnuradio/gru/daemon.py
@@ -18,6 +18,10 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#
+
+from __future__ import print_function
+from __future__ import unicode_literals
+
import os, sys, signal
# Turn application into a background daemon process.
@@ -55,38 +59,38 @@ import os, sys, signal
def daemonize(pidfile=None, logfile=None):
# fork() into background
try:
- pid = os.fork()
- except OSError, e:
- raise Exception, "%s [%d]" % (e.strerror, e.errno)
+ pid = os.fork()
+ except OSError as e:
+ raise Exception("%s [%d]" % (e.strerror, e.errno))
if pid == 0: # First child of first fork()
- # Become session leader of new session
- os.setsid()
+ # Become session leader of new session
+ os.setsid()
- # fork() into background again
- try:
- pid = os.fork()
- except OSError, e:
- raise Exception, "%s [%d]" % (e.strerror, e.errno)
+ # fork() into background again
+ try:
+ pid = os.fork()
+ except OSError as e:
+ raise Exception("%s [%d]" % (e.strerror, e.errno))
- if pid != 0:
- os._exit(0) # Second child of second fork()
+ if pid != 0:
+ os._exit(0) # Second child of second fork()
- else: # Second child of first fork()
- os._exit(0)
+ else: # Second child of first fork()
+ os._exit(0)
- os.umask(0111)
+ os.umask(0o111)
# Write pid
pid = os.getpid()
if pidfile is not None:
- open(pidfile, 'w').write('%d\n'%pid)
+ open(pidfile, 'w').write('%d\n'%pid)
# Redirect streams
if logfile is not None:
- lf = open(logfile, 'a+')
- sys.stdout = lf
- sys.stderr = lf
+ lf = open(logfile, 'a+')
+ sys.stdout = lf
+ sys.stderr = lf
# Prevent pinning any filesystem mounts
os.chdir('/')
@@ -97,6 +101,6 @@ def daemonize(pidfile=None, logfile=None):
if __name__ == "__main__":
import time
daemonize()
- print "Hello, world, from daemon process."
+ print("Hello, world, from daemon process.")
time.sleep(20)
- print "Goodbye, world, from daemon process."
+ print("Goodbye, world, from daemon process.")
diff --git a/gnuradio-runtime/python/gnuradio/gru/freqz.py b/gnuradio-runtime/python/gnuradio/gru/freqz.py
index a24d13dde..edea6113b 100644
--- a/gnuradio-runtime/python/gnuradio/gru/freqz.py
+++ b/gnuradio-runtime/python/gnuradio/gru/freqz.py
@@ -52,6 +52,8 @@
# DAMAGE.
#
+from __future__ import division
+from __future__ import unicode_literals
__all__ = ['freqz']
import numpy
@@ -106,7 +108,7 @@ def polyval(p,x):
y = x * y + p[i]
return y
-class poly1d:
+class poly1d(object):
"""A one-dimensional polynomial class.
p = poly1d([1,2,3]) constructs the polynomial x**2 + 2 x + 3
@@ -125,14 +127,14 @@ class poly1d:
"""
def __init__(self, c_or_r, r=0):
if isinstance(c_or_r,poly1d):
- for key in c_or_r.__dict__.keys():
+ for key in list(c_or_r.__dict__.keys()):
self.__dict__[key] = c_or_r.__dict__[key]
return
if r:
c_or_r = poly(c_or_r)
c_or_r = atleast_1d(c_or_r)
if len(c_or_r.shape) > 1:
- raise ValueError, "Polynomial must be 1d only."
+ raise ValueError("Polynomial must be 1d only.")
c_or_r = trim_zeros(c_or_r, trim='f')
if len(c_or_r) == 0:
c_or_r = numpy.array([0])
@@ -227,7 +229,7 @@ class poly1d:
def __pow__(self, val):
if not isscalar(val) or int(val) != val or val < 0:
- raise ValueError, "Power to non-negative integers only."
+ raise ValueError("Power to non-negative integers only.")
res = [1]
for k in range(val):
res = polymul(self.coeffs, res)
@@ -243,20 +245,20 @@ class poly1d:
def __div__(self, other):
if isscalar(other):
- return poly1d(self.coeffs/other)
+ return poly1d(self.coeffs / other)
else:
other = poly1d(other)
- return map(poly1d,polydiv(self.coeffs, other.coeffs))
+ return list(map(poly1d,polydiv(self.coeffs, other.coeffs)))
def __rdiv__(self, other):
if isscalar(other):
- return poly1d(other/self.coeffs)
+ return poly1d(other / self.coeffs)
else:
other = poly1d(other)
- return map(poly1d,polydiv(other.coeffs, self.coeffs))
+ return list(map(poly1d,polydiv(other.coeffs, self.coeffs)))
def __setattr__(self, key, val):
- raise ValueError, "Attributes cannot be changed this way."
+ raise ValueError("Attributes cannot be changed this way.")
def __getattr__(self, key):
if key in ['r','roots']:
@@ -279,7 +281,7 @@ class poly1d:
def __setitem__(self, key, val):
ind = self.order - key
if key < 0:
- raise ValueError, "Does not support negative powers."
+ raise ValueError("Does not support negative powers.")
if key > self.order:
zr = numpy.zeros(key-self.order,self.coeffs.typecode())
self.__dict__['coeffs'] = numpy.concatenate((zr,self.coeffs))
@@ -323,22 +325,22 @@ def freqz(b, a, worN=None, whole=0, plot=None):
h -- The frequency response.
w -- The frequencies at which h was computed.
"""
- b, a = map(atleast_1d, (b,a))
+ b, a = list(map(atleast_1d, (b,a)))
if whole:
lastpoint = 2*pi
else:
lastpoint = pi
if worN is None:
N = 512
- w = Num.arange(0,lastpoint,lastpoint/N)
- elif isinstance(worN, types.IntType):
+ w = Num.arange(0,lastpoint,lastpoint / N)
+ elif isinstance(worN, int):
N = worN
- w = Num.arange(0,lastpoint,lastpoint/N)
+ w = Num.arange(0,lastpoint,lastpoint / N)
else:
w = worN
w = atleast_1d(w)
zm1 = exp(-1j*w)
- h = polyval(b[::-1], zm1) / polyval(a[::-1], zm1)
+ h = polyval(b[::-1] / zm1, polyval(a[::-1], zm1))
# if not plot is None:
# plot(w, h)
return h, w
diff --git a/gnuradio-runtime/python/gnuradio/gru/gnuplot_freqz.py b/gnuradio-runtime/python/gnuradio/gru/gnuplot_freqz.py
index dd483e427..71aee11f0 100755..100644
--- a/gnuradio-runtime/python/gnuradio/gru/gnuplot_freqz.py
+++ b/gnuradio-runtime/python/gnuradio/gru/gnuplot_freqz.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+from __future__ import unicode_literals
__all__ = ['gnuplot_freqz']
import tempfile
@@ -46,10 +48,10 @@ def gnuplot_freqz (hw, Fs=None, logfreq=False):
h, w = hw
ampl = 20 * numpy.log10 (numpy.absolute (h) + 1e-9)
- phase = map (lambda x: math.atan2 (x.imag, x.real), h)
+ phase = [math.atan2 (x.imag, x.real) for x in h]
if Fs:
- w *= (Fs/(2*math.pi))
+ w *= (Fs / (2*math.pi))
for freq, a, ph in zip (w, ampl, phase):
data_file.write ("%g\t%g\t%g\n" % (freq, a, ph))
@@ -99,4 +101,4 @@ def test_plot ():
if __name__ == '__main__':
handle = test_plot ()
- raw_input ('Press Enter to continue: ')
+ input ('Press Enter to continue: ')
diff --git a/gnuradio-runtime/python/gnuradio/gru/hexint.py b/gnuradio-runtime/python/gnuradio/gru/hexint.py
index 0fb5ecde0..096b87670 100644
--- a/gnuradio-runtime/python/gnuradio/gru/hexint.py
+++ b/gnuradio-runtime/python/gnuradio/gru/hexint.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
#
# Copyright 2005 Free Software Foundation, Inc.
#
diff --git a/gnuradio-runtime/python/gnuradio/gru/listmisc.py b/gnuradio-runtime/python/gnuradio/gru/listmisc.py
index 9e70eb863..a98114733 100644
--- a/gnuradio-runtime/python/gnuradio/gru/listmisc.py
+++ b/gnuradio-runtime/python/gnuradio/gru/listmisc.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
#
# Copyright 2005 Free Software Foundation, Inc.
#
diff --git a/gnuradio-runtime/python/gnuradio/gru/mathmisc.py b/gnuradio-runtime/python/gnuradio/gru/mathmisc.py
index 7e6f23a34..790d7c993 100644
--- a/gnuradio-runtime/python/gnuradio/gru/mathmisc.py
+++ b/gnuradio-runtime/python/gnuradio/gru/mathmisc.py
@@ -1,3 +1,5 @@
+from __future__ import division
+from __future__ import unicode_literals
#
# Copyright 2005 Free Software Foundation, Inc.
#
@@ -30,4 +32,4 @@ def lcm(a,b):
return a * b / gcd(a, b)
def log2(x):
- return math.log(x)/math.log(2)
+ return math.log(x) / math.log(2)
diff --git a/gnuradio-runtime/python/gnuradio/gru/msgq_runner.py b/gnuradio-runtime/python/gnuradio/gru/msgq_runner.py
index 767a74a71..2d58480f5 100644
--- a/gnuradio-runtime/python/gnuradio/gru/msgq_runner.py
+++ b/gnuradio-runtime/python/gnuradio/gru/msgq_runner.py
@@ -40,6 +40,7 @@ To manually stop the runner, call stop() on the object.
To determine if the runner has exited, call exited() on the object.
"""
+from __future__ import unicode_literals
from gnuradio import gr
import gnuradio.gr.gr_threading as _threading
@@ -66,7 +67,7 @@ class msgq_runner(_threading.Thread):
else:
try:
self._callback(msg)
- except Exception, e:
+ except Exception as e:
if self._exit_on_error:
self._exit_error = e
self.stop()
diff --git a/gnuradio-runtime/python/gnuradio/gru/os_read_exactly.py b/gnuradio-runtime/python/gnuradio/gru/os_read_exactly.py
index 40b053770..c079fc4e1 100644
--- a/gnuradio-runtime/python/gnuradio/gru/os_read_exactly.py
+++ b/gnuradio-runtime/python/gnuradio/gru/os_read_exactly.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
#
# Copyright 2005 Free Software Foundation, Inc.
#
diff --git a/gnuradio-runtime/python/gnuradio/gru/seq_with_cursor.py b/gnuradio-runtime/python/gnuradio/gru/seq_with_cursor.py
index def3299b6..0aefbf83b 100644
--- a/gnuradio-runtime/python/gnuradio/gru/seq_with_cursor.py
+++ b/gnuradio-runtime/python/gnuradio/gru/seq_with_cursor.py
@@ -21,8 +21,12 @@
# misc utilities
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
import types
-import exceptions
+
class seq_with_cursor (object):
__slots__ = [ 'items', 'index' ]
@@ -40,7 +44,7 @@ class seq_with_cursor (object):
elif initial_index >= 0 and initial_index < len (self.items):
self.index = initial_index
else:
- raise exceptions.ValueError
+ raise ValueError
def set_index_by_value(self, v):
"""
@@ -51,9 +55,9 @@ class seq_with_cursor (object):
cv = self.current()
more = True
while cv < v and more:
- cv, more = self.next() # side effect!
+ cv, more = next(self) # side effect!
- def next (self):
+ def __next__ (self):
new_index = self.index + 1
if new_index < len (self.items):
self.index = new_index
@@ -74,4 +78,3 @@ class seq_with_cursor (object):
def get_seq (self):
return self.items[:] # copy of items
-
diff --git a/gnuradio-runtime/python/gnuradio/gru/socket_stuff.py b/gnuradio-runtime/python/gnuradio/gru/socket_stuff.py
index b7c5ac2fe..ce08ce1e1 100644
--- a/gnuradio-runtime/python/gnuradio/gru/socket_stuff.py
+++ b/gnuradio-runtime/python/gnuradio/gru/socket_stuff.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
#
# Copyright 2005 Free Software Foundation, Inc.
#
@@ -37,7 +38,7 @@ def tcp_connect_or_die(sock_addr):
s = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect(sock_addr)
- except socket.error, err:
+ except socket.error as err:
sys.stderr.write('Failed to connect to %s: %s\n' %
(sock_addr, os.strerror (err.args[0]),))
sys.exit(1)
@@ -55,7 +56,7 @@ def udp_connect_or_die(sock_addr):
s = socket.socket (socket.AF_INET, socket.SOCK_DGRAM)
try:
s.connect(sock_addr)
- except socket.error, err:
+ except socket.error as err:
sys.stderr.write('Failed to connect to %s: %s\n' %
(sock_addr, os.strerror (err.args[0]),))
sys.exit(1)
diff --git a/gnuradio-runtime/python/pmt/CMakeLists.txt b/gnuradio-runtime/python/pmt/CMakeLists.txt
index 1ddfc2a46..7afac956c 100644
--- a/gnuradio-runtime/python/pmt/CMakeLists.txt
+++ b/gnuradio-runtime/python/pmt/CMakeLists.txt
@@ -41,6 +41,6 @@ foreach(py_qa_test_file ${py_qa_test_files})
${CMAKE_BINARY_DIR}/gnuradio-runtime/swig
)
set(GR_TEST_TARGET_DEPS gnuradio-runtime)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gnuradio-runtime/python/pmt/__init__.py b/gnuradio-runtime/python/pmt/__init__.py
index 399fae870..89eb55582 100644
--- a/gnuradio-runtime/python/pmt/__init__.py
+++ b/gnuradio-runtime/python/pmt/__init__.py
@@ -39,14 +39,17 @@ bool, symbol (string), integer, real, complex, null, pair, list,
vector, dict, uniform_vector, any (boost::any cast)
'''
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
import os
try:
- from pmt_swig import *
+ from .pmt_swig import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
- from pmt_swig import *
+ from .pmt_swig import *
# due to changes in the PMT_NIL singleton for static builds, we force
# this into Python here.
@@ -55,5 +58,5 @@ PMT_T = get_PMT_T()
PMT_F = get_PMT_F()
PMT_EOF = get_PMT_EOF()
-from pmt_to_python import pmt_to_python as to_python
-from pmt_to_python import python_to_pmt as to_pmt
+from .pmt_to_python import pmt_to_python as to_python
+from .pmt_to_python import python_to_pmt as to_pmt
diff --git a/gnuradio-runtime/python/pmt/pmt_to_python.py b/gnuradio-runtime/python/pmt/pmt_to_python.py
index 2909c93c2..270a1dd9e 100644
--- a/gnuradio-runtime/python/pmt/pmt_to_python.py
+++ b/gnuradio-runtime/python/pmt/pmt_to_python.py
@@ -17,8 +17,9 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-try: import pmt_swig as pmt
-except: import pmt
+from __future__ import unicode_literals
+
+from . import pmt_swig as pmt
import numpy
# SWIG isn't taking in the #define PMT_NIL;
@@ -34,7 +35,7 @@ def pmt_to_tuple(p):
return tuple(elems)
def pmt_from_tuple(p):
- args = map(python_to_pmt, p)
+ args = list(map(python_to_pmt, p))
return pmt.make_tuple(*args)
def pmt_to_vector(p):
@@ -62,7 +63,7 @@ def pmt_to_dict(p):
def pmt_from_dict(p):
d = pmt.make_dict()
- for k, v in p.iteritems():
+ for k, v in list(p.items()):
#dict is immutable -> therefore pmt_dict_add returns the new dict
d = pmt.dict_add(d, python_to_pmt(k), python_to_pmt(v))
return d
@@ -88,27 +89,27 @@ uvector_mappings = dict([ (numpy_mappings[key][3], (numpy_mappings[key][2], key)
def numpy_to_uvector(numpy_array):
try:
mapping = numpy_mappings[numpy_array.dtype]
- pc = map(mapping[1], numpy.ravel(numpy_array))
+ pc = list(map(mapping[1], numpy.ravel(numpy_array)))
return mapping[0](numpy_array.size, pc)
except KeyError:
raise ValueError("unsupported numpy array dtype for conversion to pmt %s"%(numpy_array.dtype))
def uvector_to_numpy(uvector):
- match = None
- for test_func in uvector_mappings.keys():
- if test_func(uvector):
- match = uvector_mappings[test_func]
- return numpy.array(match[0](uvector), dtype = match[1])
- else:
- raise ValueError("unsupported uvector data type for conversion to numpy array %s"%(uvector))
+ match = None
+ for test_func in list(uvector_mappings.keys()):
+ if test_func(uvector):
+ match = uvector_mappings[test_func]
+ return numpy.array(match[0](uvector), dtype = match[1])
+ else:
+ raise ValueError("unsupported uvector data type for conversion to numpy array %s"%(uvector))
type_mappings = ( #python type, check pmt type, to python, from python
(None, pmt.is_null, lambda x: None, lambda x: PMT_NIL),
(bool, pmt.is_bool, pmt.to_bool, pmt.from_bool),
(str, pmt.is_symbol, pmt.symbol_to_string, pmt.string_to_symbol),
- (unicode, lambda x: False, None, lambda x: pmt.string_to_symbol(x.encode('utf-8'))),
+ (str, lambda x: False, None, lambda x: pmt.string_to_symbol(x.encode('utf-8'))),
(int, pmt.is_integer, pmt.to_long, pmt.from_long),
- (long, pmt.is_uint64, lambda x: long(pmt.to_uint64(x)), pmt.from_uint64),
+ (int, pmt.is_uint64, lambda x: int(pmt.to_uint64(x)), pmt.from_uint64),
(float, pmt.is_real, pmt.to_double, pmt.from_double),
(complex, pmt.is_complex, pmt.to_complex, pmt.from_complex),
(tuple, pmt.is_tuple, pmt_to_tuple, pmt_from_tuple),
diff --git a/gnuradio-runtime/python/pmt/qa_pmt.py b/gnuradio-runtime/python/pmt/qa_pmt.py
index 32cff62f4..0d87676a3 100755..100644
--- a/gnuradio-runtime/python/pmt/qa_pmt.py
+++ b/gnuradio-runtime/python/pmt/qa_pmt.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+
import unittest
import pmt
@@ -30,7 +32,7 @@ class test_pmt(unittest.TestCase):
b = pmt.from_double(123765)
d1 = pmt.make_dict()
d2 = pmt.dict_add(d1, a, b)
- print d2
+ print(d2)
def test02(self):
const = 123765
diff --git a/gnuradio-runtime/python/pmt/qa_pmt_to_python.py b/gnuradio-runtime/python/pmt/qa_pmt_to_python.py
index e63ade184..18a8e2bcf 100755..100644
--- a/gnuradio-runtime/python/pmt/qa_pmt_to_python.py
+++ b/gnuradio-runtime/python/pmt/qa_pmt_to_python.py
@@ -20,16 +20,19 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import absolute_import
+
+
import unittest
import pmt
-import pmt_to_python as pmt2py
+from pmt import pmt_to_python as pmt2py
class test_pmt_to_python(unittest.TestCase):
def test_pmt_from_double(self):
b = pmt.from_double(123765)
self.assertEqual(pmt.to_python(b), 123765)
- t = pmt.to_pmt(range(5))
+ t = pmt.to_pmt(list(range(5)))
def test_numpy_to_uvector_and_reverse(self):
import numpy as np
diff --git a/gnuradio-runtime/swig/CMakeLists.txt b/gnuradio-runtime/swig/CMakeLists.txt
index aeb95dfb7..9135f311c 100644
--- a/gnuradio-runtime/swig/CMakeLists.txt
+++ b/gnuradio-runtime/swig/CMakeLists.txt
@@ -104,6 +104,7 @@ install(
msg_queue.i
pmt_swig.i
prefs.i
+ py3compat.i
realtime.i
sync_block.i
sync_decimator.i
diff --git a/gnuradio-runtime/swig/basic_block.i b/gnuradio-runtime/swig/basic_block.i
index cf75479bb..363e121bc 100644
--- a/gnuradio-runtime/swig/basic_block.i
+++ b/gnuradio-runtime/swig/basic_block.i
@@ -31,6 +31,10 @@ namespace std {
%template(x_vector_basic_block_sptr) vector<gr::basic_block_sptr>;
};
+%begin %{
+#define SWIG_PYTHON_2_UNICODE
+%}
+
namespace gr {
class gr::basic_block
@@ -60,6 +64,8 @@ namespace gr {
}
#ifdef SWIGPYTHON
+%import py3compat.i
+
%pythoncode %{
basic_block_sptr.__repr__ = lambda self: "<basic_block %s (%d)>" % (self.name(), self.unique_id ())
%}
diff --git a/gnuradio-runtime/swig/gnuradio.i b/gnuradio-runtime/swig/gnuradio.i
index 7056d28ff..6e8a3093f 100644
--- a/gnuradio-runtime/swig/gnuradio.i
+++ b/gnuradio-runtime/swig/gnuradio.i
@@ -77,3 +77,14 @@
%}
%include <gnuradio/high_res_timer.h>
+
+////////////////////////////////////////////////////////////////////////
+// Python 2/3 compatibilty
+
+%begin %{
+#define SWIG_PYTHON_2_UNICODE
+%}
+
+#ifdef SWIGPYTHON
+%import py3compat.i
+#endif
diff --git a/gnuradio-runtime/swig/pmt_swig.i b/gnuradio-runtime/swig/pmt_swig.i
index 2063a5c97..c627b7d3e 100644
--- a/gnuradio-runtime/swig/pmt_swig.i
+++ b/gnuradio-runtime/swig/pmt_swig.i
@@ -25,6 +25,10 @@
%include "std_string.i"
%include "stdint.i"
+%begin %{
+#define SWIG_PYTHON_2_UNICODE
+%}
+
%{
#include <boost/intrusive_ptr.hpp>
#include <boost/shared_ptr.hpp>
@@ -58,6 +62,8 @@
%template(pmt_vector_cfloat) std::vector< std::complex<float> >;
%template(pmt_vector_cdouble) std::vector< std::complex<double> >;
+%import py3compat.i
+
////////////////////////////////////////////////////////////////////////
// Language independent exception handler
////////////////////////////////////////////////////////////////////////
diff --git a/gnuradio-runtime/swig/py3compat.i b/gnuradio-runtime/swig/py3compat.i
new file mode 100644
index 000000000..6e726c294
--- /dev/null
+++ b/gnuradio-runtime/swig/py3compat.i
@@ -0,0 +1,7 @@
+%begin %{
+#define SWIG_PYTHON_2_UNICODE
+%}
+
+%pythonbegin %{
+from __future__ import absolute_import
+%}
diff --git a/gr-analog/examples/fmtest.py b/gr-analog/examples/fmtest.py
index 7ed08cafb..04218a447 100755..100644
--- a/gr-analog/examples/fmtest.py
+++ b/gr-analog/examples/fmtest.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
from gnuradio import filter
@@ -31,13 +34,13 @@ try:
import scipy
from scipy import fftpack
except ImportError:
- print "Error: Program requires scipy (see: www.scipy.org)."
+ print("Error: Program requires scipy (see: www.scipy.org).")
sys.exit(1)
try:
import pylab
except ImportError:
- print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ print("Error: Program requires matplotlib (see: matplotlib.sourceforge.net).")
sys.exit(1)
@@ -80,7 +83,7 @@ class fmtest(gr.top_block):
# Create a signal source and frequency modulate it
self.sum = blocks.add_cc()
- for n in xrange(self._N):
+ for n in range(self._N):
sig = analog.sig_source_f(self._audio_rate, analog.GR_SIN_WAVE, freq[n], 0.5)
fm = fmtx(f_lo[n], self._audio_rate, self._if_rate)
self.connect(sig, fm)
@@ -95,17 +98,17 @@ class fmtest(gr.top_block):
# Design the channlizer
self._M = 10
- bw = chspacing/2.0
- t_bw = chspacing/10.0
+ bw = chspacing / 2.0
+ t_bw = chspacing / 10.0
self._chan_rate = self._if_rate / self._M
self._taps = filter.firdes.low_pass_2(1, self._if_rate, bw, t_bw,
attenuation_dB=100,
window=filter.firdes.WIN_BLACKMAN_hARRIS)
- tpc = math.ceil(float(len(self._taps)) / float(self._M))
+ tpc = math.ceil(float(len(self._taps)) / float(self._M))
- print "Number of taps: ", len(self._taps)
- print "Number of channels: ", self._M
- print "Taps per channel: ", tpc
+ print("Number of taps: ", len(self._taps))
+ print("Number of channels: ", self._M)
+ print("Taps per channel: ", tpc)
self.pfb = filter.pfb.channelizer_ccf(self._M, self._taps)
@@ -115,7 +118,7 @@ class fmtest(gr.top_block):
self.fmdet = list()
self.squelch = list()
self.snks = list()
- for i in xrange(self._M):
+ for i in range(self._M):
self.fmdet.append(analog.nbfm_rx(self._audio_rate, self._chan_rate))
self.squelch.append(analog.standard_squelch(self._audio_rate*10))
self.snks.append(blocks.vector_sink_f())
@@ -152,11 +155,11 @@ def main():
d = fm.snk_tx.data()[Ns:Ns+Ne]
sp1_f = fig1.add_subplot(2, 1, 1)
- X,freq = sp1_f.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ X,freq = sp1_f.psd(d, NFFT=fftlen, noverlap=fftlen / 4, Fs=fs,
window = lambda d: d*winfunc(fftlen),
visible=False)
X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
- f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
+ f_in = scipy.arange(-fs / 2.0, fs / 2.0, fs / float(X_in.size))
p1_f = sp1_f.plot(f_in, X_in, "b")
sp1_f.set_xlim([min(f_in), max(f_in)+1])
sp1_f.set_ylim([-120.0, 20.0])
@@ -165,7 +168,7 @@ def main():
sp1_f.set_xlabel("Frequency (Hz)")
sp1_f.set_ylabel("Power (dBW)")
- Ts = 1.0/fs
+ Ts = 1.0 / fs
Tmax = len(d)*Ts
t_in = scipy.arange(0, Tmax, Ts)
@@ -184,20 +187,20 @@ def main():
# Plot each of the channels outputs. Frequencies on Figure 2 and
# time signals on Figure 3
fs_o = fm._audio_rate
- for i in xrange(len(fm.snks)):
+ for i in range(len(fm.snks)):
# remove issues with the transients at the beginning
# also remove some corruption at the end of the stream
# this is a bug, probably due to the corner cases
d = fm.snks[i].data()[Ns:Ne]
sp2_f = fig2.add_subplot(Nrows, Ncols, 1+i)
- X,freq = sp2_f.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o,
+ X,freq = sp2_f.psd(d, NFFT=fftlen, noverlap=fftlen / 4, Fs=fs_o,
window = lambda d: d*winfunc(fftlen),
visible=False)
#X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
X_o = 10.0*scipy.log10(abs(X))
#f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size))
- f_o = scipy.arange(0, fs_o/2.0, fs_o/2.0/float(X_o.size))
+ f_o = scipy.arange(0, fs_o / 2.0, fs_o/2.0/float(X_o.size))
p2_f = sp2_f.plot(f_o, X_o, "b")
sp2_f.set_xlim([min(f_o), max(f_o)+0.1])
sp2_f.set_ylim([-120.0, 20.0])
@@ -208,7 +211,7 @@ def main():
sp2_f.set_ylabel("Power (dBW)")
- Ts = 1.0/fs_o
+ Ts = 1.0 / fs_o
Tmax = len(d)*Ts
t_o = scipy.arange(0, Tmax, Ts)
diff --git a/gr-analog/examples/tags/uhd_burst_detector.py b/gr-analog/examples/tags/uhd_burst_detector.py
index 5aa80b254..d3d221a45 100755..100644
--- a/gr-analog/examples/tags/uhd_burst_detector.py
+++ b/gr-analog/examples/tags/uhd_burst_detector.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import filter, analog, blocks
diff --git a/gr-analog/grc/CMakeLists.txt b/gr-analog/grc/CMakeLists.txt
index 1251af5b8..35456cee3 100644
--- a/gr-analog/grc/CMakeLists.txt
+++ b/gr-analog/grc/CMakeLists.txt
@@ -17,5 +17,5 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-file(GLOB xml_files "*.xml")
-install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR})
+file(GLOB yml_files "*.yml")
+install(FILES ${yml_files} DESTINATION ${GRC_BLOCKS_DIR})
diff --git a/gr-analog/grc/analog.tree.yml b/gr-analog/grc/analog.tree.yml
new file mode 100644
index 000000000..44a88bd5c
--- /dev/null
+++ b/gr-analog/grc/analog.tree.yml
@@ -0,0 +1,39 @@
+'[Core]':
+- Level Controllers:
+ - analog_agc_xx
+ - analog_agc2_xx
+ - analog_agc3_xx
+ - analog_feedforward_agc_cc
+ - analog_ctcss_squelch_ff
+ - analog_pwr_squelch_xx
+ - analog_simple_squelch_cc
+ - analog_standard_squelch
+ - analog_rail_ff
+- Modulators:
+ - analog_frequency_modulator_fc
+ - analog_phase_modulator_fc
+ - analog_quadrature_demod_cf
+ - analog_nbfm_tx
+ - analog_nbfm_rx
+ - analog_wfm_tx
+ - analog_wfm_rcv
+ - analog_wfm_rcv_pll
+ - analog_am_demod_cf
+ - analog_fm_demod_cf
+ - analog_fm_deemph
+ - analog_fm_preemph
+- Waveform Generators:
+ - analog_sig_source_x
+ - analog_const_source_x
+ - analog_noise_source_x
+ - analog_fastnoise_source_x
+ - analog_random_source_x
+ - analog_random_uniform_source_x
+- Synchronizers:
+ - analog_pll_carriertracking_cc
+ - analog_pll_freqdet_cf
+ - analog_pll_refout_cc
+- Peak Detectors:
+ - analog_dpll_bb
+- Measurement Tools:
+ - analog_probe_avg_mag_sqrd_x
diff --git a/gr-analog/grc/analog_agc2_xx.block.yml b/gr-analog/grc/analog_agc2_xx.block.yml
new file mode 100644
index 000000000..93990b5c3
--- /dev/null
+++ b/gr-analog/grc/analog_agc2_xx.block.yml
@@ -0,0 +1,53 @@
+id: analog_agc2_xx
+label: AGC2
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float]
+ option_attributes:
+ fcn: [cc, ff]
+ hide: part
+- id: attack_rate
+ label: Attack Rate
+ dtype: real
+ default: 1e-1
+- id: decay_rate
+ label: Decay Rate
+ dtype: real
+ default: 1e-2
+- id: reference
+ label: Reference
+ dtype: real
+ default: '1.0'
+- id: gain
+ label: Gain
+ dtype: real
+ default: '1.0'
+- id: max_gain
+ label: Max Gain
+ dtype: real
+ default: '65536'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import analog
+ make: |-
+ analog.agc2_${type.fcn}(${attack_rate}, ${decay_rate}, ${reference}, ${gain})
+ self.${id}.set_max_gain(${max_gain})
+ callbacks:
+ - set_attack_rate(${attack_rate})
+ - set_decay_rate(${decay_rate})
+ - set_reference(${reference})
+ - set_gain(${gain})
+ - set_max_gain(${max_gain})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_agc2_xx.xml b/gr-analog/grc/analog_agc2_xx.xml
deleted file mode 100644
index cafd6a09b..000000000
--- a/gr-analog/grc/analog_agc2_xx.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##AGC2
-###################################################
- -->
-<block>
- <name>AGC2</name>
- <key>analog_agc2_xx</key>
- <import>from gnuradio import analog</import>
- <make>analog.agc2_$(type.fcn)($attack_rate, $decay_rate, $reference, $gain)
-self.$(id).set_max_gain($max_gain)</make>
- <callback>set_attack_rate($attack_rate)</callback>
- <callback>set_decay_rate($decay_rate)</callback>
- <callback>set_reference($reference)</callback>
- <callback>set_gain($gain)</callback>
- <callback>set_max_gain($max_gain)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- </param>
- <param>
- <name>Attack Rate</name>
- <key>attack_rate</key>
- <value>1e-1</value>
- <type>real</type>
- </param>
- <param>
- <name>Decay Rate</name>
- <key>decay_rate</key>
- <value>1e-2</value>
- <type>real</type>
- </param>
- <param>
- <name>Reference</name>
- <key>reference</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Max Gain</name>
- <key>max_gain</key>
- <value>65536</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_agc3_xx.block.yml b/gr-analog/grc/analog_agc3_xx.block.yml
new file mode 100644
index 000000000..17a03f677
--- /dev/null
+++ b/gr-analog/grc/analog_agc3_xx.block.yml
@@ -0,0 +1,57 @@
+id: analog_agc3_xx
+label: AGC3
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex]
+ option_attributes:
+ fcn: [cc]
+ hide: part
+- id: attack_rate
+ label: Attack Rate
+ dtype: real
+ default: 1e-3
+- id: decay_rate
+ label: Decay Rate
+ dtype: real
+ default: 1e-4
+- id: reference
+ label: Reference
+ dtype: real
+ default: '1.0'
+- id: gain
+ label: Gain
+ dtype: real
+ default: '1.0'
+- id: max_gain
+ label: Max Gain
+ dtype: real
+ default: '65536'
+- id: iir_update_decim
+ label: IIR Update Decimation
+ dtype: real
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import analog
+ make: |-
+ analog.agc3_${type.fcn}(${attack_rate}, ${decay_rate}, ${reference}, ${gain}, ${iir_update_decim})
+ self.${id}.set_max_gain(${max_gain})
+ callbacks:
+ - set_attack_rate(${attack_rate})
+ - set_decay_rate(${decay_rate})
+ - set_reference(${reference})
+ - set_gain(${gain})
+ - set_max_gain(${max_gain})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_agc3_xx.xml b/gr-analog/grc/analog_agc3_xx.xml
deleted file mode 100644
index 1e6b9fd38..000000000
--- a/gr-analog/grc/analog_agc3_xx.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##AGC3
-###################################################
- -->
-<block>
- <name>AGC3</name>
- <key>analog_agc3_xx</key>
- <import>from gnuradio import analog</import>
- <make>analog.agc3_$(type.fcn)($attack_rate, $decay_rate, $reference, $gain, $iir_update_decim)
-self.$(id).set_max_gain($max_gain)</make>
- <callback>set_attack_rate($attack_rate)</callback>
- <callback>set_decay_rate($decay_rate)</callback>
- <callback>set_reference($reference)</callback>
- <callback>set_gain($gain)</callback>
- <callback>set_max_gain($max_gain)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
-<!-- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option> -->
- </param>
- <param>
- <name>Attack Rate</name>
- <key>attack_rate</key>
- <value>1e-3</value>
- <type>real</type>
- </param>
- <param>
- <name>Decay Rate</name>
- <key>decay_rate</key>
- <value>1e-4</value>
- <type>real</type>
- </param>
- <param>
- <name>Reference</name>
- <key>reference</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Max Gain</name>
- <key>max_gain</key>
- <value>65536</value>
- <type>real</type>
- </param>
- <param>
- <name>IIR Update Decimation</name>
- <key>iir_update_decim</key>
- <value>1</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_agc_xx.block.yml b/gr-analog/grc/analog_agc_xx.block.yml
new file mode 100644
index 000000000..52ef26f79
--- /dev/null
+++ b/gr-analog/grc/analog_agc_xx.block.yml
@@ -0,0 +1,48 @@
+id: analog_agc_xx
+label: AGC
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float]
+ option_attributes:
+ fcn: [cc, ff]
+ hide: part
+- id: rate
+ label: Rate
+ dtype: real
+ default: 1e-4
+- id: reference
+ label: Reference
+ dtype: real
+ default: '1.0'
+- id: gain
+ label: Gain
+ dtype: real
+ default: '1.0'
+- id: max_gain
+ label: Max Gain
+ dtype: real
+ default: '65536'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import analog
+ make: |-
+ analog.agc_${type.fcn}(${rate}, ${reference}, ${gain})
+ self.${id}.set_max_gain(${max_gain})
+ callbacks:
+ - set_rate(${rate})
+ - set_reference(${reference})
+ - set_gain(${gain})
+ - set_max_gain(${max_gain})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_agc_xx.xml b/gr-analog/grc/analog_agc_xx.xml
deleted file mode 100644
index 085ded3d8..000000000
--- a/gr-analog/grc/analog_agc_xx.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##AGC
-###################################################
- -->
-<block>
- <name>AGC</name>
- <key>analog_agc_xx</key>
- <import>from gnuradio import analog</import>
- <make>analog.agc_$(type.fcn)($rate, $reference, $gain)
-self.$(id).set_max_gain($max_gain)</make>
- <callback>set_rate($rate)</callback>
- <callback>set_reference($reference)</callback>
- <callback>set_gain($gain)</callback>
- <callback>set_max_gain($max_gain)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- </param>
- <param>
- <name>Rate</name>
- <key>rate</key>
- <value>1e-4</value>
- <type>real</type>
- </param>
- <param>
- <name>Reference</name>
- <key>reference</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Max Gain</name>
- <key>max_gain</key>
- <value>65536</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_am_demod_cf.block.yml b/gr-analog/grc/analog_am_demod_cf.block.yml
new file mode 100644
index 000000000..8bc6cc1c3
--- /dev/null
+++ b/gr-analog/grc/analog_am_demod_cf.block.yml
@@ -0,0 +1,33 @@
+id: analog_am_demod_cf
+label: AM Demod
+
+parameters:
+- id: chan_rate
+ label: Channel Rate
+ dtype: real
+- id: audio_decim
+ label: Audio Decimation
+ dtype: int
+- id: audio_pass
+ label: Audio Pass
+ dtype: real
+ default: '5000'
+- id: audio_stop
+ label: Audio Stop
+ dtype: real
+ default: '5500'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: "analog.am_demod_cf(\n\tchannel_rate=${chan_rate},\n\taudio_decim=${audio_decim},\n\
+ \taudio_pass=${audio_pass},\n\taudio_stop=${audio_stop},\n)"
+
+file_format: 1
diff --git a/gr-analog/grc/analog_am_demod_cf.xml b/gr-analog/grc/analog_am_demod_cf.xml
deleted file mode 100644
index b066882bd..000000000
--- a/gr-analog/grc/analog_am_demod_cf.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##AM Demod
-###################################################
- -->
-<block>
- <name>AM Demod</name>
- <key>analog_am_demod_cf</key>
- <import>from gnuradio import analog</import>
- <make>analog.am_demod_cf(
- channel_rate=$chan_rate,
- audio_decim=$audio_decim,
- audio_pass=$audio_pass,
- audio_stop=$audio_stop,
-)</make>
- <param>
- <name>Channel Rate</name>
- <key>chan_rate</key>
- <type>real</type>
- </param>
- <param>
- <name>Audio Decimation</name>
- <key>audio_decim</key>
- <type>int</type>
- </param>
- <param>
- <name>Audio Pass</name>
- <key>audio_pass</key>
- <value>5000</value>
- <type>real</type>
- </param>
- <param>
- <name>Audio Stop</name>
- <key>audio_stop</key>
- <value>5500</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_block_tree.xml b/gr-analog/grc/analog_block_tree.xml
deleted file mode 100644
index 7337c34c3..000000000
--- a/gr-analog/grc/analog_block_tree.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2012 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##Block Tree for GR Analog blocks.
-###################################################
- -->
-<cat>
- <name>[Core]</name>
- <cat>
- <name>Level Controllers</name>
- <block>analog_agc_xx</block>
- <block>analog_agc2_xx</block>
- <block>analog_agc3_xx</block>
- <block>analog_feedforward_agc_cc</block>
- <block>analog_ctcss_squelch_ff</block>
- <block>analog_pwr_squelch_xx</block>
- <block>analog_simple_squelch_cc</block>
- <block>analog_standard_squelch</block>
- <block>analog_rail_ff</block>
- </cat>
- <cat>
- <name>Modulators</name>
- <block>analog_frequency_modulator_fc</block>
- <block>analog_phase_modulator_fc</block>
- <block>analog_quadrature_demod_cf</block>
- <block>analog_nbfm_tx</block>
- <block>analog_nbfm_rx</block>
- <block>analog_wfm_tx</block>
- <block>analog_wfm_rcv</block>
- <block>analog_wfm_rcv_pll</block>
- <block>analog_am_demod_cf</block>
- <block>analog_fm_demod_cf</block>
- <block>analog_fm_deemph</block>
- <block>analog_fm_preemph</block>
- </cat>
- <cat>
- <name>Waveform Generators</name>
- <block>analog_sig_source_x</block>
- <block>analog_const_source_x</block>
- <block>analog_noise_source_x</block>
- <block>analog_fastnoise_source_x</block>
- <block>analog_random_source_x</block>
- <block>analog_random_uniform_source_x</block>
- </cat>
- <cat>
- <name>Synchronizers</name>
- <block>analog_pll_carriertracking_cc</block>
- <block>analog_pll_freqdet_cf</block>
- <block>analog_pll_refout_cc</block>
- </cat>
- <cat>
- <name>Peak Detectors</name>
- <block>analog_dpll_bb</block>
- </cat>
- <cat>
- <name>Measurement Tools</name>
- <block>analog_probe_avg_mag_sqrd_x</block>
- </cat>
-</cat>
diff --git a/gr-analog/grc/analog_const_source_x.block.yml b/gr-analog/grc/analog_const_source_x.block.yml
new file mode 100644
index 000000000..ac676b7ac
--- /dev/null
+++ b/gr-analog/grc/analog_const_source_x.block.yml
@@ -0,0 +1,28 @@
+id: analog_const_source_x
+label: Constant Source
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [complex, float, int, short]
+ option_attributes:
+ const_type: [complex, real, int, int]
+ fcn: [c, f, i, s]
+ hide: part
+- id: const
+ label: Constant
+ dtype: ${ type.const_type }
+ default: '0'
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.sig_source_${type.fcn}(0, analog.GR_CONST_WAVE, 0, 0, ${const})
+ callbacks:
+ - set_offset(${const})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_const_source_x.xml b/gr-analog/grc/analog_const_source_x.xml
deleted file mode 100644
index de8c30626..000000000
--- a/gr-analog/grc/analog_const_source_x.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Constant Source: Custom wrapper
-###################################################
- -->
-<block>
- <name>Constant Source</name>
- <key>analog_const_source_x</key>
- <import>from gnuradio import analog</import>
- <make>analog.sig_source_$(type.fcn)(0, analog.GR_CONST_WAVE, 0, 0, $const)</make>
- <callback>set_offset($const)</callback>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- <opt>const_type:complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- <opt>const_type:real</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- <opt>const_type:int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- <opt>const_type:int</opt>
- </option>
- </param>
- <param>
- <name>Constant</name>
- <key>const</key>
- <value>0</value>
- <type>$type.const_type</type>
- </param>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_cpfsk_bc.block.yml b/gr-analog/grc/analog_cpfsk_bc.block.yml
new file mode 100644
index 000000000..c9ccbaac2
--- /dev/null
+++ b/gr-analog/grc/analog_cpfsk_bc.block.yml
@@ -0,0 +1,31 @@
+id: analog_cpfsk_bc
+label: CPFSK
+category: '[Core]/Deprecated'
+
+parameters:
+- id: k
+ label: K
+ dtype: real
+- id: amplitude
+ label: Amplitude
+ dtype: real
+- id: samples_per_symbol
+ label: Samples/Symbol
+ dtype: int
+ default: '2'
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.cpfsk_bc(${k}, ${amplitude}, ${samples_per_symbol})
+ callbacks:
+ - set_amplitude(${amplitude})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_cpfsk_bc.xml b/gr-analog/grc/analog_cpfsk_bc.xml
deleted file mode 100644
index 5108ff61f..000000000
--- a/gr-analog/grc/analog_cpfsk_bc.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##CPFSK
-###################################################
- -->
-<block>
- <name>CPFSK</name>
- <key>analog_cpfsk_bc</key>
- <category>[Core]/Deprecated</category>
- <import>from gnuradio import analog</import>
- <make>analog.cpfsk_bc($k, $amplitude, $samples_per_symbol)</make>
- <callback>set_amplitude($amplitude)</callback>
- <param>
- <name>K</name>
- <key>k</key>
- <type>real</type>
- </param>
- <param>
- <name>Amplitude</name>
- <key>amplitude</key>
- <type>real</type>
- </param>
- <param>
- <name>Samples/Symbol</name>
- <key>samples_per_symbol</key>
- <value>2</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_ctcss_squelch_ff.block.yml b/gr-analog/grc/analog_ctcss_squelch_ff.block.yml
new file mode 100644
index 000000000..a3dd89f1f
--- /dev/null
+++ b/gr-analog/grc/analog_ctcss_squelch_ff.block.yml
@@ -0,0 +1,45 @@
+id: analog_ctcss_squelch_ff
+label: CTCSS Squelch
+
+parameters:
+- id: rate
+ label: Sampling Rate (Hz)
+ dtype: real
+ default: samp_rate
+- id: freq
+ label: Tone Frequency
+ dtype: real
+ default: '100.0'
+- id: level
+ label: Level
+ dtype: real
+ default: '0.01'
+- id: len
+ label: Length
+ dtype: int
+ default: '0'
+- id: ramp
+ label: Ramp
+ dtype: int
+ default: '0'
+- id: gate
+ label: Gate
+ dtype: bool
+ default: 'False'
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.ctcss_squelch_ff(${rate}, ${freq}, ${level}, ${len}, ${ramp}, ${gate})
+ callbacks:
+ - set_level(${level})
+ - set_frequency(${freq})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_ctcss_squelch_ff.xml b/gr-analog/grc/analog_ctcss_squelch_ff.xml
deleted file mode 100644
index 7a2248aa7..000000000
--- a/gr-analog/grc/analog_ctcss_squelch_ff.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0"?>
-<!--
-#
-# Copyright 2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##CTCSS Squelch
-###################################################
- -->
-<block>
- <name>CTCSS Squelch</name>
- <key>analog_ctcss_squelch_ff</key>
- <import>from gnuradio import analog</import>
- <make>analog.ctcss_squelch_ff($rate, $freq, $level, $len, $ramp, $gate)</make>
- <callback>set_level($level)</callback>
- <callback>set_frequency($freq)</callback>
- <param>
- <name>Sampling Rate (Hz)</name>
- <key>rate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>Tone Frequency</name>
- <key>freq</key>
- <value>100.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Level</name>
- <key>level</key>
- <value>0.01</value>
- <type>real</type>
- </param>
- <param>
- <name>Length</name>
- <key>len</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Ramp</name>
- <key>ramp</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Gate</name>
- <key>gate</key>
- <value>False</value>
- <type>bool</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_dpll_bb.block.yml b/gr-analog/grc/analog_dpll_bb.block.yml
new file mode 100644
index 000000000..289f3a283
--- /dev/null
+++ b/gr-analog/grc/analog_dpll_bb.block.yml
@@ -0,0 +1,26 @@
+id: analog_dpll_bb
+label: Detect Peak
+
+parameters:
+- id: period
+ label: Period
+ dtype: real
+- id: gain
+ label: Gain
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.dpll_bb(${period}, ${gain})
+ callbacks:
+ - set_gain(${gain})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_dpll_bb.xml b/gr-analog/grc/analog_dpll_bb.xml
deleted file mode 100644
index 65a489414..000000000
--- a/gr-analog/grc/analog_dpll_bb.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Detect Peak
-###################################################
- -->
-<block>
- <name>Detect Peak</name>
- <key>analog_dpll_bb</key>
- <import>from gnuradio import analog</import>
- <make>analog.dpll_bb($period, $gain)</make>
- <callback>set_gain($gain)</callback>
- <param>
- <name>Period</name>
- <key>period</key>
- <type>real</type>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_fastnoise_source_x.block.yml b/gr-analog/grc/analog_fastnoise_source_x.block.yml
new file mode 100644
index 000000000..21c436607
--- /dev/null
+++ b/gr-analog/grc/analog_fastnoise_source_x.block.yml
@@ -0,0 +1,45 @@
+id: analog_fastnoise_source_x
+label: Fast Noise Source
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [complex, float, int, short]
+ option_attributes:
+ fcn: [c, f, i, s]
+ hide: part
+- id: noise_type
+ label: Noise Type
+ dtype: int
+ default: analog.GR_GAUSSIAN
+ options: [analog.GR_UNIFORM, analog.GR_GAUSSIAN, analog.GR_LAPLACIAN, analog.GR_IMPULSE]
+ option_labels: [Uniform, Gaussian, Laplacian, Impulse]
+- id: amp
+ label: Amplitude
+ dtype: real
+ default: '1'
+- id: seed
+ label: Seed
+ dtype: int
+ default: '0'
+- id: samples
+ label: Variate Pool Size
+ dtype: int
+ default: '8192'
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.fastnoise_source_${type.fcn}(${noise_type}, ${amp}, ${seed}, ${samples})
+ callbacks:
+ - set_type(${noise_type})
+ - set_amplitude(${amp})
+
+documentation: |-
+ The fast noise source works by pre-generating a pool of random variates taken from the specified distribution. At runtime, samples are then uniform randomly chosen from this pool which is a very fast operation.
+
+file_format: 1
diff --git a/gr-analog/grc/analog_fastnoise_source_x.xml b/gr-analog/grc/analog_fastnoise_source_x.xml
deleted file mode 100644
index f18c8c2f5..000000000
--- a/gr-analog/grc/analog_fastnoise_source_x.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Fast Noise Source
-###################################################
- -->
-<block>
- <name>Fast Noise Source</name>
- <key>analog_fastnoise_source_x</key>
- <import>from gnuradio import analog</import>
- <make>analog.fastnoise_source_$(type.fcn)($noise_type, $amp, $seed, $samples)</make>
- <callback>set_type($noise_type)</callback>
- <callback>set_amplitude($amp)</callback>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- </option>
- </param>
- <param>
- <name>Noise Type</name>
- <key>noise_type</key>
- <value>analog.GR_GAUSSIAN</value>
- <type>int</type>
- <option>
- <name>Uniform</name>
- <key>analog.GR_UNIFORM</key>
- </option>
- <option>
- <name>Gaussian</name>
- <key>analog.GR_GAUSSIAN</key>
- </option>
- <option>
- <name>Laplacian</name>
- <key>analog.GR_LAPLACIAN</key>
- </option>
- <option>
- <name>Impulse</name>
- <key>analog.GR_IMPULSE</key>
- </option>
- </param>
- <param>
- <name>Amplitude</name>
- <key>amp</key>
- <value>1</value>
- <type>real</type>
- </param>
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Variate Pool Size</name>
- <key>samples</key>
- <value>8192</value>
- <type>int</type>
- </param>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
- <doc>
-The fast noise source works by pre-generating a pool of random variates taken from the specified distribution. At runtime, samples are then uniform randomly chosen from this pool which is a very fast operation.
- </doc>
-</block>
diff --git a/gr-analog/grc/analog_feedforward_agc_cc.block.yml b/gr-analog/grc/analog_feedforward_agc_cc.block.yml
new file mode 100644
index 000000000..fd49a654a
--- /dev/null
+++ b/gr-analog/grc/analog_feedforward_agc_cc.block.yml
@@ -0,0 +1,26 @@
+id: analog_feedforward_agc_cc
+label: Feed Forward AGC
+
+parameters:
+- id: num_samples
+ label: Num Samples
+ dtype: int
+ default: '1024'
+- id: reference
+ label: Reference
+ dtype: real
+ default: '1.0'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.feedforward_agc_cc(${num_samples}, ${reference})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_feedforward_agc_cc.xml b/gr-analog/grc/analog_feedforward_agc_cc.xml
deleted file mode 100644
index 66d200a84..000000000
--- a/gr-analog/grc/analog_feedforward_agc_cc.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Feed Forward AGC
-###################################################
- -->
-<block>
- <name>Feed Forward AGC</name>
- <key>analog_feedforward_agc_cc</key>
- <import>from gnuradio import analog</import>
- <make>analog.feedforward_agc_cc($num_samples, $reference)</make>
- <param>
- <name>Num Samples</name>
- <key>num_samples</key>
- <value>1024</value>
- <type>int</type>
- </param>
- <param>
- <name>Reference</name>
- <key>reference</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_fm_deemph.block.yml b/gr-analog/grc/analog_fm_deemph.block.yml
new file mode 100644
index 000000000..b9c11a684
--- /dev/null
+++ b/gr-analog/grc/analog_fm_deemph.block.yml
@@ -0,0 +1,25 @@
+id: analog_fm_deemph
+label: FM Deemphasis
+
+parameters:
+- id: samp_rate
+ label: Sample Rate
+ dtype: real
+- id: tau
+ label: Tau
+ dtype: real
+ default: 75e-6
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.fm_deemph(fs=${samp_rate}, tau=${tau})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_fm_deemph.xml b/gr-analog/grc/analog_fm_deemph.xml
deleted file mode 100644
index 0fcb5a87d..000000000
--- a/gr-analog/grc/analog_fm_deemph.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##FM Deemphasis
-###################################################
- -->
-<block>
- <name>FM Deemphasis</name>
- <key>analog_fm_deemph</key>
- <import>from gnuradio import analog</import>
- <make>analog.fm_deemph(fs=$samp_rate, tau=$tau)</make>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <type>real</type>
- </param>
- <param>
- <name>Tau</name>
- <key>tau</key>
- <value>75e-6</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_fm_demod_cf.block.yml b/gr-analog/grc/analog_fm_demod_cf.block.yml
new file mode 100644
index 000000000..a558253a2
--- /dev/null
+++ b/gr-analog/grc/analog_fm_demod_cf.block.yml
@@ -0,0 +1,46 @@
+id: analog_fm_demod_cf
+label: FM Demod
+
+parameters:
+- id: chan_rate
+ label: Channel Rate
+ dtype: real
+- id: audio_decim
+ label: Audio Decimation
+ dtype: int
+- id: deviation
+ label: Deviation
+ dtype: real
+ default: '75000'
+- id: audio_pass
+ label: Audio Pass
+ dtype: real
+ default: '15000'
+- id: audio_stop
+ label: Audio Stop
+ dtype: real
+ default: '16000'
+- id: gain
+ label: Gain
+ dtype: real
+ default: '1.0'
+- id: tau
+ label: Tau
+ dtype: real
+ default: 75e-6
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: "analog.fm_demod_cf(\n\tchannel_rate=${chan_rate},\n\taudio_decim=${audio_decim},\n\
+ \tdeviation=${deviation},\n\taudio_pass=${audio_pass},\n\taudio_stop=${audio_stop},\n\
+ \tgain=${gain},\n\ttau=${tau},\n)"
+
+file_format: 1
diff --git a/gr-analog/grc/analog_fm_demod_cf.xml b/gr-analog/grc/analog_fm_demod_cf.xml
deleted file mode 100644
index c903ddfc7..000000000
--- a/gr-analog/grc/analog_fm_demod_cf.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##FM Demod
-###################################################
- -->
-<block>
- <name>FM Demod</name>
- <key>analog_fm_demod_cf</key>
- <import>from gnuradio import analog</import>
- <make>analog.fm_demod_cf(
- channel_rate=$chan_rate,
- audio_decim=$audio_decim,
- deviation=$deviation,
- audio_pass=$audio_pass,
- audio_stop=$audio_stop,
- gain=$gain,
- tau=$tau,
-)</make>
- <param>
- <name>Channel Rate</name>
- <key>chan_rate</key>
- <type>real</type>
- </param>
- <param>
- <name>Audio Decimation</name>
- <key>audio_decim</key>
- <type>int</type>
- </param>
- <param>
- <name>Deviation</name>
- <key>deviation</key>
- <value>75000</value>
- <type>real</type>
- </param>
- <param>
- <name>Audio Pass</name>
- <key>audio_pass</key>
- <value>15000</value>
- <type>real</type>
- </param>
- <param>
- <name>Audio Stop</name>
- <key>audio_stop</key>
- <value>16000</value>
- <type>real</type>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Tau</name>
- <key>tau</key>
- <value>75e-6</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_fm_preemph.block.yml b/gr-analog/grc/analog_fm_preemph.block.yml
new file mode 100644
index 000000000..d3f05d316
--- /dev/null
+++ b/gr-analog/grc/analog_fm_preemph.block.yml
@@ -0,0 +1,29 @@
+id: analog_fm_preemph
+label: FM Preemphasis
+
+parameters:
+- id: samp_rate
+ label: Sample Rate
+ dtype: real
+- id: tau
+ label: Tau
+ dtype: real
+ default: 75e-6
+- id: fh
+ label: High Corner Freq
+ dtype: real
+ default: '-1.0'
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.fm_preemph(fs=${samp_rate}, tau=${tau}, fh=${fh})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_fm_preemph.xml b/gr-analog/grc/analog_fm_preemph.xml
deleted file mode 100644
index a754ce9c6..000000000
--- a/gr-analog/grc/analog_fm_preemph.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##FM Preemphasis
-###################################################
- -->
-<block>
- <name>FM Preemphasis</name>
- <key>analog_fm_preemph</key>
- <import>from gnuradio import analog</import>
- <make>analog.fm_preemph(fs=$samp_rate, tau=$tau, fh=$fh)</make>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <type>real</type>
- </param>
- <param>
- <name>Tau</name>
- <key>tau</key>
- <value>75e-6</value>
- <type>real</type>
- </param>
- <param>
- <name>High Corner Freq</name>
- <key>fh</key>
- <value>-1.0</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_fmdet_cf.block.yml b/gr-analog/grc/analog_fmdet_cf.block.yml
new file mode 100644
index 000000000..ee8661b80
--- /dev/null
+++ b/gr-analog/grc/analog_fmdet_cf.block.yml
@@ -0,0 +1,31 @@
+id: analog_fmdet_cf
+label: FM Detector
+
+parameters:
+- id: samplerate
+ label: Sample rate
+ dtype: real
+- id: freq_low
+ label: Lowest frequency
+ dtype: real
+- id: freq_high
+ label: Highest frequency
+ dtype: real
+- id: scl
+ label: Scale factor
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: "analog.fmdet_cf(\n\tsamplerate=${samplerate},\n\tfreq_low=${freq_low},\n\
+ \tfreq_high=${freq_high},\n\tscl=${scl}\n)"
+
+file_format: 1
diff --git a/gr-analog/grc/analog_fmdet_cf.xml b/gr-analog/grc/analog_fmdet_cf.xml
deleted file mode 100644
index 26688b289..000000000
--- a/gr-analog/grc/analog_fmdet_cf.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##FM Detector
-###################################################
- -->
-<block>
- <name>FM Detector</name>
- <key>analog_fmdet_cf</key>
- <import>from gnuradio import analog</import>
- <make>analog.fmdet_cf(
- samplerate=$samplerate,
- freq_low=$freq_low,
- freq_high=$freq_high,
- scl=$scl
-)</make>
- <param>
- <name>Sample rate</name>
- <key>samplerate</key>
- <type>real</type>
- </param>
- <param>
- <name>Lowest frequency</name>
- <key>freq_low</key>
- <type>real</type>
- </param>
- <param>
- <name>Highest frequency</name>
- <key>freq_high</key>
- <type>real</type>
- </param>
- <param>
- <name>Scale factor</name>
- <key>scl</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_frequency_modulator_fc.block.yml b/gr-analog/grc/analog_frequency_modulator_fc.block.yml
new file mode 100644
index 000000000..09f3e807f
--- /dev/null
+++ b/gr-analog/grc/analog_frequency_modulator_fc.block.yml
@@ -0,0 +1,23 @@
+id: analog_frequency_modulator_fc
+label: Frequency Mod
+
+parameters:
+- id: sensitivity
+ label: Sensitivity
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.frequency_modulator_fc(${sensitivity})
+ callbacks:
+ - set_sensitivity(${sensitivity})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_frequency_modulator_fc.xml b/gr-analog/grc/analog_frequency_modulator_fc.xml
deleted file mode 100644
index 3b6cd159a..000000000
--- a/gr-analog/grc/analog_frequency_modulator_fc.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Frequency Modulator
-###################################################
- -->
-<block>
- <name>Frequency Mod</name>
- <key>analog_frequency_modulator_fc</key>
- <import>from gnuradio import analog</import>
- <make>analog.frequency_modulator_fc($sensitivity)</make>
- <callback>set_sensitivity($sensitivity)</callback>
- <param>
- <name>Sensitivity</name>
- <key>sensitivity</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_nbfm_rx.block.yml b/gr-analog/grc/analog_nbfm_rx.block.yml
new file mode 100644
index 000000000..8bb3da768
--- /dev/null
+++ b/gr-analog/grc/analog_nbfm_rx.block.yml
@@ -0,0 +1,38 @@
+id: analog_nbfm_rx
+label: NBFM Receive
+
+parameters:
+- id: audio_rate
+ label: Audio Rate
+ dtype: int
+- id: quad_rate
+ label: Quadrature Rate
+ dtype: int
+- id: tau
+ label: Tau
+ dtype: real
+ default: 75e-6
+- id: max_dev
+ label: Max Deviation
+ dtype: real
+ default: 5e3
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: float
+
+asserts:
+- ${ (quad_rate)%(audio_rate) == 0 }
+
+templates:
+ imports: from gnuradio import analog
+ make: "analog.nbfm_rx(\n\taudio_rate=${audio_rate},\n\tquad_rate=${quad_rate},\n\
+ \ttau=${tau},\n\tmax_dev=${max_dev},\n )"
+ callbacks:
+ - set_max_deviation(${max_dev})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_nbfm_rx.xml b/gr-analog/grc/analog_nbfm_rx.xml
deleted file mode 100644
index 9250b77b5..000000000
--- a/gr-analog/grc/analog_nbfm_rx.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##NBFM Receive
-###################################################
- -->
-<block>
- <name>NBFM Receive</name>
- <key>analog_nbfm_rx</key>
- <import>from gnuradio import analog</import>
- <make>analog.nbfm_rx(
- audio_rate=$audio_rate,
- quad_rate=$quad_rate,
- tau=$tau,
- max_dev=$max_dev,
- )</make>
- <callback>set_max_deviation($max_dev)</callback>
-
- <param>
- <name>Audio Rate</name>
- <key>audio_rate</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Quadrature Rate</name>
- <key>quad_rate</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Tau</name>
- <key>tau</key>
- <value>75e-6</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Max Deviation</name>
- <key>max_dev</key>
- <value>5e3</value>
- <type>real</type>
- </param>
-
- <check>($quad_rate)%($audio_rate) == 0</check>
-
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_nbfm_tx.block.yml b/gr-analog/grc/analog_nbfm_tx.block.yml
new file mode 100644
index 000000000..00f63f8d6
--- /dev/null
+++ b/gr-analog/grc/analog_nbfm_tx.block.yml
@@ -0,0 +1,42 @@
+id: analog_nbfm_tx
+label: NBFM Transmit
+
+parameters:
+- id: audio_rate
+ label: Audio Rate
+ dtype: int
+- id: quad_rate
+ label: Quadrature Rate
+ dtype: int
+- id: tau
+ label: Tau
+ dtype: real
+ default: 75e-6
+- id: max_dev
+ label: Max Deviation
+ dtype: real
+ default: 5e3
+- id: fh
+ label: Preemphasis High Corner Freq
+ dtype: real
+ default: '-1.0'
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: complex
+
+asserts:
+- ${ (quad_rate)%(audio_rate) == 0 }
+
+templates:
+ imports: from gnuradio import analog
+ make: "analog.nbfm_tx(\n\taudio_rate=${audio_rate},\n\tquad_rate=${quad_rate},\n\
+ \ttau=${tau},\n\tmax_dev=${max_dev},\n\tfh=${fh},\n )"
+ callbacks:
+ - set_max_deviation(${max_dev})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_nbfm_tx.xml b/gr-analog/grc/analog_nbfm_tx.xml
deleted file mode 100644
index bc80fffbc..000000000
--- a/gr-analog/grc/analog_nbfm_tx.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##NBFM Transmit
-###################################################
- -->
-<block>
- <name>NBFM Transmit</name>
- <key>analog_nbfm_tx</key>
- <import>from gnuradio import analog</import>
- <make>analog.nbfm_tx(
- audio_rate=$audio_rate,
- quad_rate=$quad_rate,
- tau=$tau,
- max_dev=$max_dev,
- fh=$fh,
- )</make>
- <callback>set_max_deviation($max_dev)</callback>
-
- <param>
- <name>Audio Rate</name>
- <key>audio_rate</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Quadrature Rate</name>
- <key>quad_rate</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Tau</name>
- <key>tau</key>
- <value>75e-6</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Max Deviation</name>
- <key>max_dev</key>
- <value>5e3</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Preemphasis High Corner Freq</name>
- <key>fh</key>
- <value>-1.0</value>
- <type>real</type>
- </param>
-
- <check>($quad_rate)%($audio_rate) == 0</check>
-
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_noise_source_x.block.yml b/gr-analog/grc/analog_noise_source_x.block.yml
new file mode 100644
index 000000000..bb3f67209
--- /dev/null
+++ b/gr-analog/grc/analog_noise_source_x.block.yml
@@ -0,0 +1,38 @@
+id: analog_noise_source_x
+label: Noise Source
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [complex, float, int, short]
+ option_attributes:
+ fcn: [c, f, i, s]
+ hide: part
+- id: noise_type
+ label: Noise Type
+ dtype: int
+ default: analog.GR_GAUSSIAN
+ options: [analog.GR_UNIFORM, analog.GR_GAUSSIAN, analog.GR_LAPLACIAN, analog.GR_IMPULSE]
+ option_labels: [Uniform, Gaussian, Laplacian, Impulse]
+- id: amp
+ label: Amplitude
+ dtype: real
+ default: '1'
+- id: seed
+ label: Seed
+ dtype: int
+ default: '0'
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.noise_source_${type.fcn}(${noise_type}, ${amp}, ${seed})
+ callbacks:
+ - set_type(${noise_type})
+ - set_amplitude(${amp})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_noise_source_x.xml b/gr-analog/grc/analog_noise_source_x.xml
deleted file mode 100644
index 5404e7896..000000000
--- a/gr-analog/grc/analog_noise_source_x.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Noise Source
-###################################################
- -->
-<block>
- <name>Noise Source</name>
- <key>analog_noise_source_x</key>
- <import>from gnuradio import analog</import>
- <make>analog.noise_source_$(type.fcn)($noise_type, $amp, $seed)</make>
- <callback>set_type($noise_type)</callback>
- <callback>set_amplitude($amp)</callback>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- </option>
- </param>
- <param>
- <name>Noise Type</name>
- <key>noise_type</key>
- <value>analog.GR_GAUSSIAN</value>
- <type>int</type>
- <option>
- <name>Uniform</name>
- <key>analog.GR_UNIFORM</key>
- </option>
- <option>
- <name>Gaussian</name>
- <key>analog.GR_GAUSSIAN</key>
- </option>
- <option>
- <name>Laplacian</name>
- <key>analog.GR_LAPLACIAN</key>
- </option>
- <option>
- <name>Impulse</name>
- <key>analog.GR_IMPULSE</key>
- </option>
- </param>
- <param>
- <name>Amplitude</name>
- <key>amp</key>
- <value>1</value>
- <type>real</type>
- </param>
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>0</value>
- <type>int</type>
- </param>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_phase_modulator_fc.block.yml b/gr-analog/grc/analog_phase_modulator_fc.block.yml
new file mode 100644
index 000000000..6d38ddd01
--- /dev/null
+++ b/gr-analog/grc/analog_phase_modulator_fc.block.yml
@@ -0,0 +1,23 @@
+id: analog_phase_modulator_fc
+label: Phase Mod
+
+parameters:
+- id: sensitivity
+ label: Sensitivity
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.phase_modulator_fc(${sensitivity})
+ callbacks:
+ - set_sensitivity(${sensitivity})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_phase_modulator_fc.xml b/gr-analog/grc/analog_phase_modulator_fc.xml
deleted file mode 100644
index c13af769c..000000000
--- a/gr-analog/grc/analog_phase_modulator_fc.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Phase Modulator
-###################################################
- -->
-<block>
- <name>Phase Mod</name>
- <key>analog_phase_modulator_fc</key>
- <import>from gnuradio import analog</import>
- <make>analog.phase_modulator_fc($sensitivity)</make>
- <callback>set_sensitivity($sensitivity)</callback>
- <param>
- <name>Sensitivity</name>
- <key>sensitivity</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_pll_carriertracking_cc.block.yml b/gr-analog/grc/analog_pll_carriertracking_cc.block.yml
new file mode 100644
index 000000000..1a66aca0a
--- /dev/null
+++ b/gr-analog/grc/analog_pll_carriertracking_cc.block.yml
@@ -0,0 +1,31 @@
+id: analog_pll_carriertracking_cc
+label: PLL Carrier Tracking
+
+parameters:
+- id: w
+ label: Loop Bandwidth
+ dtype: real
+- id: max_freq
+ label: Max Freq
+ dtype: real
+- id: min_freq
+ label: Min Freq
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.pll_carriertracking_cc(${w}, ${max_freq}, ${min_freq})
+ callbacks:
+ - set_loop_bandwidth(${w})
+ - set_max_freq(${max_freq})
+ - set_min_freq(${min_freq})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_pll_carriertracking_cc.xml b/gr-analog/grc/analog_pll_carriertracking_cc.xml
deleted file mode 100644
index 95ec4b415..000000000
--- a/gr-analog/grc/analog_pll_carriertracking_cc.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##PLL Carrier Tracking
-###################################################
- -->
-<block>
- <name>PLL Carrier Tracking</name>
- <key>analog_pll_carriertracking_cc</key>
- <import>from gnuradio import analog</import>
- <make>analog.pll_carriertracking_cc($w, $max_freq, $min_freq)</make>
- <callback>set_loop_bandwidth($w)</callback>
- <callback>set_max_freq($max_freq)</callback>
- <callback>set_min_freq($min_freq)</callback>
- <param>
- <name>Loop Bandwidth</name>
- <key>w</key>
- <type>real</type>
- </param>
- <param>
- <name>Max Freq</name>
- <key>max_freq</key>
- <type>real</type>
- </param>
- <param>
- <name>Min Freq</name>
- <key>min_freq</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_pll_freqdet_cf.block.yml b/gr-analog/grc/analog_pll_freqdet_cf.block.yml
new file mode 100644
index 000000000..b9fe199dd
--- /dev/null
+++ b/gr-analog/grc/analog_pll_freqdet_cf.block.yml
@@ -0,0 +1,31 @@
+id: analog_pll_freqdet_cf
+label: PLL Freq Det
+
+parameters:
+- id: w
+ label: Loop Bandwidth
+ dtype: real
+- id: max_freq
+ label: Max Freq
+ dtype: real
+- id: min_freq
+ label: Min Freq
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.pll_freqdet_cf(${w}, ${max_freq}, ${min_freq})
+ callbacks:
+ - set_loop_bandwidth(${w})
+ - set_max_freq(${max_freq})
+ - set_min_freq(${min_freq})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_pll_freqdet_cf.xml b/gr-analog/grc/analog_pll_freqdet_cf.xml
deleted file mode 100644
index 0d44c160b..000000000
--- a/gr-analog/grc/analog_pll_freqdet_cf.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##PLL Frequency Det
-###################################################
- -->
-<block>
- <name>PLL Freq Det</name>
- <key>analog_pll_freqdet_cf</key>
- <import>from gnuradio import analog</import>
- <make>analog.pll_freqdet_cf($w, $max_freq, $min_freq)</make>
- <callback>set_loop_bandwidth($w)</callback>
- <callback>set_max_freq($max_freq)</callback>
- <callback>set_min_freq($min_freq)</callback>
- <param>
- <name>Loop Bandwidth</name>
- <key>w</key>
- <type>real</type>
- </param>
- <param>
- <name>Max Freq</name>
- <key>max_freq</key>
- <type>real</type>
- </param>
- <param>
- <name>Min Freq</name>
- <key>min_freq</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_pll_refout_cc.block.yml b/gr-analog/grc/analog_pll_refout_cc.block.yml
new file mode 100644
index 000000000..5acd85c3b
--- /dev/null
+++ b/gr-analog/grc/analog_pll_refout_cc.block.yml
@@ -0,0 +1,31 @@
+id: analog_pll_refout_cc
+label: PLL Ref Out
+
+parameters:
+- id: w
+ label: Loop Bandwidth
+ dtype: real
+- id: max_freq
+ label: Max Freq
+ dtype: real
+- id: min_freq
+ label: Min Freq
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.pll_refout_cc(${w}, ${max_freq}, ${min_freq})
+ callbacks:
+ - set_loop_bandwidth(${w})
+ - set_max_freq(${max_freq})
+ - set_min_freq(${min_freq})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_pll_refout_cc.xml b/gr-analog/grc/analog_pll_refout_cc.xml
deleted file mode 100644
index eb2d752b2..000000000
--- a/gr-analog/grc/analog_pll_refout_cc.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##PLL Reference Out
-###################################################
- -->
-<block>
- <name>PLL Ref Out</name>
- <key>analog_pll_refout_cc</key>
- <import>from gnuradio import analog</import>
- <make>analog.pll_refout_cc($w, $max_freq, $min_freq)</make>
- <callback>set_loop_bandwidth($w)</callback>
- <callback>set_max_freq($max_freq)</callback>
- <callback>set_min_freq($min_freq)</callback>
- <param>
- <name>Loop Bandwidth</name>
- <key>w</key>
- <type>real</type>
- </param>
- <param>
- <name>Max Freq</name>
- <key>max_freq</key>
- <type>real</type>
- </param>
- <param>
- <name>Min Freq</name>
- <key>min_freq</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_probe_avg_mag_sqrd_x.block.yml b/gr-analog/grc/analog_probe_avg_mag_sqrd_x.block.yml
new file mode 100644
index 000000000..ad128c152
--- /dev/null
+++ b/gr-analog/grc/analog_probe_avg_mag_sqrd_x.block.yml
@@ -0,0 +1,47 @@
+id: analog_probe_avg_mag_sqrd_x
+label: Probe Avg Mag^2
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [c, f, cf]
+ option_labels: [Complex, Float, Complex->Float]
+ option_attributes:
+ hide: [all, all, '']
+ input: [complex, float, complex]
+ optional: ['1', '1', '0']
+ hide: part
+- id: threshold
+ label: Threshold (dB)
+ dtype: real
+ default: '0'
+- id: alpha
+ label: Alpha
+ dtype: real
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: float
+ optional: true
+ hide: ${ type.hide }
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.probe_avg_mag_sqrd_${type}(${threshold}, ${alpha})
+ callbacks:
+ - set_alpha(${alpha})
+ - set_threshold(${threshold})
+ - reset()
+
+documentation: |-
+ Available functions to probe: level()
+
+ Use with the function probe block.
+
+file_format: 1
diff --git a/gr-analog/grc/analog_probe_avg_mag_sqrd_x.xml b/gr-analog/grc/analog_probe_avg_mag_sqrd_x.xml
deleted file mode 100644
index 98e6702ff..000000000
--- a/gr-analog/grc/analog_probe_avg_mag_sqrd_x.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Probe Average Magnitude Squared
-###################################################
- -->
-<block>
- <name>Probe Avg Mag^2</name>
- <key>analog_probe_avg_mag_sqrd_x</key>
- <import>from gnuradio import analog</import>
- <make>analog.probe_avg_mag_sqrd_$(type)($threshold, $alpha)</make>
- <callback>set_alpha($alpha)</callback>
- <callback>set_threshold($threshold)</callback>
- <callback>reset()</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>c</key>
- <opt>input:complex</opt>
- <opt>optional:1</opt>
- <opt>hide:all</opt>
- </option>
- <option>
- <name>Float</name>
- <key>f</key>
- <opt>input:float</opt>
- <opt>optional:1</opt>
- <opt>hide:all</opt>
- </option>
- <option>
- <name>Complex->Float</name>
- <key>cf</key>
- <opt>input:complex</opt>
- <opt>optional:0</opt>
- <opt>hide:</opt>
- </option>
- </param>
- <param>
- <name>Threshold (dB)</name>
- <key>threshold</key>
- <value>0</value>
- <type>real</type>
- </param>
- <param>
- <name>Alpha</name>
- <key>alpha</key>
- <value>1</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- <optional>$type.optional</optional>
- <hide>$type.hide</hide>
- </source>
- <doc>
-Available functions to probe: level()
-
-Use with the function probe block.
- </doc>
-</block>
diff --git a/gr-analog/grc/analog_pwr_squelch_xx.block.yml b/gr-analog/grc/analog_pwr_squelch_xx.block.yml
new file mode 100644
index 000000000..20bcfa923
--- /dev/null
+++ b/gr-analog/grc/analog_pwr_squelch_xx.block.yml
@@ -0,0 +1,44 @@
+id: analog_pwr_squelch_xx
+label: Power Squelch
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float]
+ option_attributes:
+ fcn: [cc, ff]
+ hide: part
+- id: threshold
+ label: Threshold (dB)
+ dtype: real
+- id: alpha
+ label: Alpha
+ dtype: real
+ default: 1e-4
+- id: ramp
+ label: Ramp
+ dtype: int
+ default: '0'
+- id: gate
+ label: Gate
+ dtype: enum
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.pwr_squelch_${type.fcn}(${threshold}, ${alpha}, ${ramp}, ${gate})
+ callbacks:
+ - set_threshold(${threshold})
+ - set_alpha(${alpha})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_pwr_squelch_xx.xml b/gr-analog/grc/analog_pwr_squelch_xx.xml
deleted file mode 100644
index a75f85cf1..000000000
--- a/gr-analog/grc/analog_pwr_squelch_xx.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Power Squelch
-###################################################
- -->
-<block>
- <name>Power Squelch</name>
- <key>analog_pwr_squelch_xx</key>
- <import>from gnuradio import analog</import>
- <make>analog.pwr_squelch_$(type.fcn)($threshold, $alpha, $ramp, $gate)</make>
- <callback>set_threshold($threshold)</callback>
- <callback>set_alpha($alpha)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- </param>
- <param>
- <name>Threshold (dB)</name>
- <key>threshold</key>
- <type>real</type>
- </param>
- <param>
- <name>Alpha</name>
- <key>alpha</key>
- <value>1e-4</value>
- <type>real</type>
- </param>
- <param>
- <name>Ramp</name>
- <key>ramp</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Gate</name>
- <key>gate</key>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_quadrature_demod_cf.block.yml b/gr-analog/grc/analog_quadrature_demod_cf.block.yml
new file mode 100644
index 000000000..874b286c8
--- /dev/null
+++ b/gr-analog/grc/analog_quadrature_demod_cf.block.yml
@@ -0,0 +1,47 @@
+id: analog_quadrature_demod_cf
+label: Quadrature Demod
+
+parameters:
+- id: gain
+ label: Gain
+ dtype: real
+ default: samp_rate/(2*math.pi*fsk_deviation_hz/8.0)
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: |-
+ from gnuradio import analog
+ import math
+ make: analog.quadrature_demod_cf(${gain})
+ callbacks:
+ - set_gain(${gain})
+
+documentation: |-
+ This can be used to demod FM, FSK, GMSK, etc. The input is complex
+ baseband, output is the signal frequency in relation to the sample
+ rated, multiplied with the gain.
+
+ Mathematically, this block calculates the product of the one-sample
+ delayed input and the conjugate undelayed signal, and then calculates
+ the argument of the resulting complex number:
+
+ y[n] = \mathrm{arg}\left(x[n] \, \bar x [n-1]\right).
+
+ Let x be a complex sinusoid with amplitude A>0, (absolute)
+ frequency f\in\mathbb R and phase \phi_0\in[0;2\pi] sampled at
+ f_s>0 so, without loss of generality,
+
+ x[n]= A e^{j2\pi( \frac f{f_s} n + \phi_0)}\f
+
+ then
+
+ y[n] = \mathrm{arg}\left(A e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)} \overline{A e^{j2\pi( \frac f{f_s} (n-1) + \phi_0)}}\right)\ = \mathrm{arg}\left(A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)} e^{-j2\pi( \frac f{f_s} (n-1) + \phi_0)}\right)\ = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0 - \frac f{f_s} (n-1) - \phi_0\right)}\right)\ = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n - \frac f{f_s} (n-1)\right)}\right)\ = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} \left(n-(n-1)\right)\right)}\right)\ = \mathrm{arg}\left( A^2 e^{j2\pi \frac f{f_s}}\right) \intertext{$A$ is real, so is $A^2$ and hence only \textit{scales}, therefore $\mathrm{arg}(\cdot)$ is invariant:} = \mathrm{arg}\left(e^{j2\pi \frac f{f_s}}\right)\= \frac f{f_s}\\
+
+file_format: 1
diff --git a/gr-analog/grc/analog_quadrature_demod_cf.xml b/gr-analog/grc/analog_quadrature_demod_cf.xml
deleted file mode 100644
index 447acf2ed..000000000
--- a/gr-analog/grc/analog_quadrature_demod_cf.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Quadrature Demodulator
-###################################################
- -->
-<block>
- <name>Quadrature Demod</name>
- <key>analog_quadrature_demod_cf</key>
- <import>from gnuradio import analog</import>
- <import>import math</import>
- <make>analog.quadrature_demod_cf($gain)</make>
- <callback>set_gain($gain)</callback>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>samp_rate/(2*math.pi*fsk_deviation_hz/8.0)</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
- <doc>
-This can be used to demod FM, FSK, GMSK, etc. The input is complex
-baseband, output is the signal frequency in relation to the sample
-rated, multiplied with the gain.
-
-Mathematically, this block calculates the product of the one-sample
-delayed input and the conjugate undelayed signal, and then calculates
-the argument of the resulting complex number:
-
-y[n] = \mathrm{arg}\left(x[n] \, \bar x [n-1]\right).
-
-Let x be a complex sinusoid with amplitude A>0, (absolute)
-frequency f\in\mathbb R and phase \phi_0\in[0;2\pi] sampled at
-f_s>0 so, without loss of generality,
-
-x[n]= A e^{j2\pi( \frac f{f_s} n + \phi_0)}\f
-
-then
-
-y[n] = \mathrm{arg}\left(A e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)} \overline{A e^{j2\pi( \frac f{f_s} (n-1) + \phi_0)}}\right)\\
- = \mathrm{arg}\left(A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)} e^{-j2\pi( \frac f{f_s} (n-1) + \phi_0)}\right)\\
- = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0 - \frac f{f_s} (n-1) - \phi_0\right)}\right)\\
- = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n - \frac f{f_s} (n-1)\right)}\right)\\
- = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} \left(n-(n-1)\right)\right)}\right)\\
- = \mathrm{arg}\left( A^2 e^{j2\pi \frac f{f_s}}\right) \intertext{$A$ is real, so is $A^2$ and hence only \textit{scales}, therefore $\mathrm{arg}(\cdot)$ is invariant:} = \mathrm{arg}\left(e^{j2\pi \frac f{f_s}}\right)\\
-= \frac f{f_s}\\
- </doc>
-</block>
diff --git a/gr-analog/grc/analog_rail_ff.block.yml b/gr-analog/grc/analog_rail_ff.block.yml
new file mode 100644
index 000000000..8a2d2e8a5
--- /dev/null
+++ b/gr-analog/grc/analog_rail_ff.block.yml
@@ -0,0 +1,27 @@
+id: analog_rail_ff
+label: Rail
+
+parameters:
+- id: lo
+ label: Low clipping
+ dtype: real
+- id: hi
+ label: Hi clipping
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.rail_ff(${lo}, ${hi})
+ callbacks:
+ - set_lo(${lo})
+ - set_hi(${hi})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_rail_ff.xml b/gr-analog/grc/analog_rail_ff.xml
deleted file mode 100644
index 87dff0977..000000000
--- a/gr-analog/grc/analog_rail_ff.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0"?>
-<!--
-#
-# Copyright 2012 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##Rail
-###################################################
- -->
-<block>
- <name>Rail</name>
- <key>analog_rail_ff</key>
- <import>from gnuradio import analog</import>
- <make>analog.rail_ff($lo, $hi)</make>
- <callback>set_lo($lo)</callback>
- <callback>set_hi($hi)</callback>
- <param>
- <name>Low clipping</name>
- <key>lo</key>
- <type>real</type>
- </param>
- <param>
- <name>Hi clipping</name>
- <key>hi</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_random_source_x.block.yml b/gr-analog/grc/analog_random_source_x.block.yml
new file mode 100644
index 000000000..595aa81b6
--- /dev/null
+++ b/gr-analog/grc/analog_random_source_x.block.yml
@@ -0,0 +1,47 @@
+id: analog_random_source_x
+label: Random Source
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [int, short, byte]
+ option_attributes:
+ fcn: [i, s, b]
+ hide: part
+- id: min
+ label: Minimum
+ dtype: int
+ default: '0'
+- id: max
+ label: Maximum
+ dtype: int
+ default: '2'
+- id: num_samps
+ label: Num Samples
+ dtype: int
+ default: '1000'
+- id: repeat
+ label: Repeat
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: |-
+ from gnuradio import blocks
+ import numpy
+ make: blocks.vector_source_${type.fcn}(map(int, numpy.random.randint(${min}, ${max},
+ ${num_samps})), ${repeat})
+
+documentation: |-
+ Generate num samples of random numbers of [min, max). Repeat samples if specified.
+
+ Ex: With min=0 and max=2, the sequence 01110101... will be generated.
+
+file_format: 1
diff --git a/gr-analog/grc/analog_random_source_x.xml b/gr-analog/grc/analog_random_source_x.xml
deleted file mode 100644
index e466c02fb..000000000
--- a/gr-analog/grc/analog_random_source_x.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Random Source:
-## Custom block
-###################################################
- -->
-<block>
- <name>Random Source</name>
- <key>analog_random_source_x</key>
- <import>from gnuradio import blocks</import>
- <import>import numpy</import>
- <make>blocks.vector_source_$(type.fcn)(map(int, numpy.random.randint($min, $max, $num_samps)), $repeat)</make>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:b</opt>
- </option>
- </param>
- <param>
- <name>Minimum</name>
- <key>min</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Maximum</name>
- <key>max</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Num Samples</name>
- <key>num_samps</key>
- <value>1000</value>
- <type>int</type>
- </param>
- <param>
- <name>Repeat</name>
- <key>repeat</key>
- <value>True</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
- <doc>
-Generate num samples of random numbers of [min, max). Repeat samples if specified.
-
-Ex: With min=0 and max=2, the sequence 01110101... will be generated.
- </doc>
-</block>
diff --git a/gr-analog/grc/analog_random_uniform_source_x.block.yml b/gr-analog/grc/analog_random_uniform_source_x.block.yml
new file mode 100644
index 000000000..d76bc903a
--- /dev/null
+++ b/gr-analog/grc/analog_random_uniform_source_x.block.yml
@@ -0,0 +1,32 @@
+id: analog_random_uniform_source_x
+label: Random Uniform Source
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [int, short, byte]
+ option_attributes:
+ fcn: [i, s, b]
+ offset_type: [int, int, int]
+ hide: part
+- id: minimum
+ label: Minimum
+ dtype: int
+- id: maximum
+ label: Maximum
+ dtype: int
+- id: seed
+ label: Seed
+ dtype: int
+ default: '0'
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.random_uniform_source_${type.fcn}(${minimum}, ${maximum}, ${seed})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_random_uniform_source_x.xml b/gr-analog/grc/analog_random_uniform_source_x.xml
deleted file mode 100644
index c81b637f9..000000000
--- a/gr-analog/grc/analog_random_uniform_source_x.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>Random Uniform Source</name>
- <key>analog_random_uniform_source_x</key>
- <import>from gnuradio import analog</import>
- <make>analog.random_uniform_source_$(type.fcn)($minimum, $maximum, $seed)</make>
-
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- <opt>offset_type:int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- <opt>offset_type:int</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:b</opt>
- <opt>offset_type:int</opt>
- </option>
- </param>
-
- <param>
- <name>Minimum</name>
- <key>minimum</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Maximum</name>
- <key>maximum</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>0</value>
- <type>int</type>
- </param>
-
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_sig_source_x.block.yml b/gr-analog/grc/analog_sig_source_x.block.yml
new file mode 100644
index 000000000..2fbc853a9
--- /dev/null
+++ b/gr-analog/grc/analog_sig_source_x.block.yml
@@ -0,0 +1,57 @@
+id: analog_sig_source_x
+label: Signal Source
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [complex, float, int, short]
+ option_attributes:
+ fcn: [c, f, i, s]
+ offset_type: [complex, real, int, int]
+ hide: part
+- id: samp_rate
+ label: Sample Rate
+ dtype: real
+ default: samp_rate
+- id: waveform
+ label: Waveform
+ dtype: int
+ default: analog.GR_COS_WAVE
+ options: [analog.GR_CONST_WAVE, analog.GR_SIN_WAVE, analog.GR_COS_WAVE, analog.GR_SQR_WAVE,
+ analog.GR_TRI_WAVE, analog.GR_SAW_WAVE]
+ option_labels: [Constant, Sine, Cosine, Square, Triangle, Saw Tooth]
+- id: freq
+ label: Frequency
+ dtype: real
+ default: '1000'
+- id: amp
+ label: Amplitude
+ dtype: real
+ default: '1'
+- id: offset
+ label: Offset
+ dtype: ${ type.offset_type }
+ default: '0'
+
+inputs:
+- domain: message
+ id: freq
+ optional: true
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.sig_source_${type.fcn}(${samp_rate}, ${waveform}, ${freq}, ${amp},
+ ${offset})
+ callbacks:
+ - set_sampling_freq(${samp_rate})
+ - set_waveform(${waveform})
+ - set_frequency(${freq})
+ - set_amplitude(${amp})
+ - set_offset(${offset})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_sig_source_x.xml b/gr-analog/grc/analog_sig_source_x.xml
deleted file mode 100644
index e3c587b25..000000000
--- a/gr-analog/grc/analog_sig_source_x.xml
+++ /dev/null
@@ -1,109 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Signal Source
-###################################################
- -->
-<block>
- <name>Signal Source</name>
- <key>analog_sig_source_x</key>
- <import>from gnuradio import analog</import>
- <make>analog.sig_source_$(type.fcn)($samp_rate, $waveform, $freq, $amp, $offset)</make>
- <callback>set_sampling_freq($samp_rate)</callback>
- <callback>set_waveform($waveform)</callback>
- <callback>set_frequency($freq)</callback>
- <callback>set_amplitude($amp)</callback>
- <callback>set_offset($offset)</callback>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- <opt>offset_type:complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- <opt>offset_type:real</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- <opt>offset_type:int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- <opt>offset_type:int</opt>
- </option>
- </param>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>Waveform</name>
- <key>waveform</key>
- <value>analog.GR_COS_WAVE</value>
- <type>int</type>
- <option>
- <name>Constant</name>
- <key>analog.GR_CONST_WAVE</key>
- </option>
- <option>
- <name>Sine</name>
- <key>analog.GR_SIN_WAVE</key>
- </option>
- <option>
- <name>Cosine</name>
- <key>analog.GR_COS_WAVE</key>
- </option>
- <option>
- <name>Square</name>
- <key>analog.GR_SQR_WAVE</key>
- </option>
- <option>
- <name>Triangle</name>
- <key>analog.GR_TRI_WAVE</key>
- </option>
- <option>
- <name>Saw Tooth</name>
- <key>analog.GR_SAW_WAVE</key>
- </option>
- </param>
- <param>
- <name>Frequency</name>
- <key>freq</key>
- <value>1000</value>
- <type>real</type>
- </param>
- <param>
- <name>Amplitude</name>
- <key>amp</key>
- <value>1</value>
- <type>real</type>
- </param>
- <param>
- <name>Offset</name>
- <key>offset</key>
- <value>0</value>
- <type>$type.offset_type</type>
- </param>
- <sink>
- <name>freq</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_simple_squelch_cc.block.yml b/gr-analog/grc/analog_simple_squelch_cc.block.yml
new file mode 100644
index 000000000..17a98eb4b
--- /dev/null
+++ b/gr-analog/grc/analog_simple_squelch_cc.block.yml
@@ -0,0 +1,27 @@
+id: analog_simple_squelch_cc
+label: Simple Squelch
+
+parameters:
+- id: threshold
+ label: Threshold (dB)
+ dtype: real
+- id: alpha
+ label: Alpha
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import analog
+ make: analog.simple_squelch_cc(${threshold}, ${alpha})
+ callbacks:
+ - set_threshold(${threshold})
+ - set_alpha(${alpha})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_simple_squelch_cc.xml b/gr-analog/grc/analog_simple_squelch_cc.xml
deleted file mode 100644
index 648921a14..000000000
--- a/gr-analog/grc/analog_simple_squelch_cc.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Simple Squelch
-###################################################
- -->
-<block>
- <name>Simple Squelch</name>
- <key>analog_simple_squelch_cc</key>
- <import>from gnuradio import analog</import>
- <make>analog.simple_squelch_cc($threshold, $alpha)</make>
- <callback>set_threshold($threshold)</callback>
- <callback>set_alpha($alpha)</callback>
- <param>
- <name>Threshold (dB)</name>
- <key>threshold</key>
- <type>real</type>
- </param>
- <param>
- <name>Alpha</name>
- <key>alpha</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_standard_squelch.block.yml b/gr-analog/grc/analog_standard_squelch.block.yml
new file mode 100644
index 000000000..d753dfaf0
--- /dev/null
+++ b/gr-analog/grc/analog_standard_squelch.block.yml
@@ -0,0 +1,28 @@
+id: analog_standard_squelch
+label: Standard Squelch
+
+parameters:
+- id: audio_rate
+ label: Audio Rate
+ dtype: real
+- id: threshold
+ label: Threshold
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: |-
+ analog.standard_squelch(audio_rate=${audio_rate})
+ self.${id}.set_threshold(${threshold})
+ callbacks:
+ - set_threshold(${threshold})
+
+file_format: 1
diff --git a/gr-analog/grc/analog_standard_squelch.xml b/gr-analog/grc/analog_standard_squelch.xml
deleted file mode 100644
index 264c57ab5..000000000
--- a/gr-analog/grc/analog_standard_squelch.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Standard Squelch
-###################################################
- -->
-<block>
- <name>Standard Squelch</name>
- <key>analog_standard_squelch</key>
- <import>from gnuradio import analog</import>
- <make>analog.standard_squelch(audio_rate=$audio_rate)
-self.$(id).set_threshold($threshold)</make>
- <callback>set_threshold($threshold)</callback>
- <param>
- <name>Audio Rate</name>
- <key>audio_rate</key>
- <type>real</type>
- </param>
- <param>
- <name>Threshold</name>
- <key>threshold</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_wfm_rcv.block.yml b/gr-analog/grc/analog_wfm_rcv.block.yml
new file mode 100644
index 000000000..eb3a84893
--- /dev/null
+++ b/gr-analog/grc/analog_wfm_rcv.block.yml
@@ -0,0 +1,25 @@
+id: analog_wfm_rcv
+label: WBFM Receive
+
+parameters:
+- id: quad_rate
+ label: Quadrature Rate
+ dtype: real
+- id: audio_decimation
+ label: Audio Decimation
+ dtype: int
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: "analog.wfm_rcv(\n\tquad_rate=${quad_rate},\n\taudio_decimation=${audio_decimation},\n\
+ )"
+
+file_format: 1
diff --git a/gr-analog/grc/analog_wfm_rcv.xml b/gr-analog/grc/analog_wfm_rcv.xml
deleted file mode 100644
index ce2abb92d..000000000
--- a/gr-analog/grc/analog_wfm_rcv.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##WBFM Receive
-###################################################
- -->
-<block>
- <name>WBFM Receive</name>
- <key>analog_wfm_rcv</key>
- <import>from gnuradio import analog</import>
- <make>analog.wfm_rcv(
- quad_rate=$quad_rate,
- audio_decimation=$audio_decimation,
-)</make>
- <param>
- <name>Quadrature Rate</name>
- <key>quad_rate</key>
- <type>real</type>
- </param>
- <param>
- <name>Audio Decimation</name>
- <key>audio_decimation</key>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_wfm_rcv_pll.block.yml b/gr-analog/grc/analog_wfm_rcv_pll.block.yml
new file mode 100644
index 000000000..e5e3d76cc
--- /dev/null
+++ b/gr-analog/grc/analog_wfm_rcv_pll.block.yml
@@ -0,0 +1,29 @@
+id: analog_wfm_rcv_pll
+label: WBFM Receive PLL
+
+parameters:
+- id: quad_rate
+ label: Quadrature Rate
+ dtype: real
+- id: audio_decimation
+ label: Audio Decimation
+ dtype: int
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- label: Lout
+ domain: stream
+ dtype: float
+- label: Rout
+ domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import analog
+ make: "analog.wfm_rcv_pll(\n\tdemod_rate=${quad_rate},\n\taudio_decimation=${audio_decimation},\n\
+ )"
+
+file_format: 1
diff --git a/gr-analog/grc/analog_wfm_rcv_pll.xml b/gr-analog/grc/analog_wfm_rcv_pll.xml
deleted file mode 100644
index db31ed9be..000000000
--- a/gr-analog/grc/analog_wfm_rcv_pll.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##WBFM Receive PLL
-###################################################
- -->
-<block>
- <name>WBFM Receive PLL</name>
- <key>analog_wfm_rcv_pll</key>
- <import>from gnuradio import analog</import>
- <make>analog.wfm_rcv_pll(
- demod_rate=$quad_rate,
- audio_decimation=$audio_decimation,
-)</make>
- <param>
- <name>Quadrature Rate</name>
- <key>quad_rate</key>
- <type>real</type>
- </param>
- <param>
- <name>Audio Decimation</name>
- <key>audio_decimation</key>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>Lout</name>
- <type>float</type>
- </source>
- <source>
- <name>Rout</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-analog/grc/analog_wfm_tx.block.yml b/gr-analog/grc/analog_wfm_tx.block.yml
new file mode 100644
index 000000000..1e4346c41
--- /dev/null
+++ b/gr-analog/grc/analog_wfm_tx.block.yml
@@ -0,0 +1,40 @@
+id: analog_wfm_tx
+label: WBFM Transmit
+
+parameters:
+- id: audio_rate
+ label: Audio Rate
+ dtype: int
+- id: quad_rate
+ label: Quadrature Rate
+ dtype: int
+- id: tau
+ label: Tau
+ dtype: real
+ default: 75e-6
+- id: max_dev
+ label: Max Deviation
+ dtype: real
+ default: 75e3
+- id: fh
+ label: Preemphasis High Corner Freq
+ dtype: real
+ default: '-1.0'
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: complex
+
+asserts:
+- ${ (quad_rate)%(audio_rate) == 0 }
+
+templates:
+ imports: from gnuradio import analog
+ make: "analog.wfm_tx(\n\taudio_rate=${audio_rate},\n\tquad_rate=${quad_rate},\n\
+ \ttau=${tau},\n\tmax_dev=${max_dev},\n\tfh=${fh},\n)"
+
+file_format: 1
diff --git a/gr-analog/grc/analog_wfm_tx.xml b/gr-analog/grc/analog_wfm_tx.xml
deleted file mode 100644
index 507c2ea89..000000000
--- a/gr-analog/grc/analog_wfm_tx.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##WBFM Transmit
-###################################################
- -->
-<block>
- <name>WBFM Transmit</name>
- <key>analog_wfm_tx</key>
- <import>from gnuradio import analog</import>
- <make>analog.wfm_tx(
- audio_rate=$audio_rate,
- quad_rate=$quad_rate,
- tau=$tau,
- max_dev=$max_dev,
- fh=$fh,
-)</make>
- <param>
- <name>Audio Rate</name>
- <key>audio_rate</key>
- <type>int</type>
- </param>
- <param>
- <name>Quadrature Rate</name>
- <key>quad_rate</key>
- <type>int</type>
- </param>
- <param>
- <name>Tau</name>
- <key>tau</key>
- <value>75e-6</value>
- <type>real</type>
- </param>
- <param>
- <name>Max Deviation</name>
- <key>max_dev</key>
- <value>75e3</value>
- <type>real</type>
- </param>
- <param>
- <name>Preemphasis High Corner Freq</name>
- <key>fh</key>
- <value>-1.0</value>
- <type>real</type>
- </param>
- <check>($quad_rate)%($audio_rate) == 0</check>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-analog/python/analog/CMakeLists.txt b/gr-analog/python/analog/CMakeLists.txt
index 1fed9d189..ba3dfb5fc 100644
--- a/gr-analog/python/analog/CMakeLists.txt
+++ b/gr-analog/python/analog/CMakeLists.txt
@@ -53,7 +53,7 @@ if(ENABLE_TESTING)
file(GLOB py_qa_test_files "qa_*.py")
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gr-analog/python/analog/__init__.py b/gr-analog/python/analog/__init__.py
index 3c4a0ff62..79c19e1e3 100644
--- a/gr-analog/python/analog/__init__.py
+++ b/gr-analog/python/analog/__init__.py
@@ -21,24 +21,26 @@
'''
Blocks and utilities for analog modulation and demodulation.
'''
+from __future__ import absolute_import
+from __future__ import unicode_literals
# The presence of this file turns this directory into a Python package
import os
try:
- from analog_swig import *
+ from .analog_swig import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
- from analog_swig import *
+ from .analog_swig import *
-from am_demod import *
-from fm_demod import *
-from fm_emph import *
-from nbfm_rx import *
-from nbfm_tx import *
-from standard_squelch import *
-from wfm_rcv import *
-from wfm_rcv_fmdet import *
-from wfm_rcv_pll import *
-from wfm_tx import *
+from .am_demod import *
+from .fm_demod import *
+from .fm_emph import *
+from .nbfm_rx import *
+from .nbfm_tx import *
+from .standard_squelch import *
+from .wfm_rcv import *
+from .wfm_rcv_fmdet import *
+from .wfm_rcv_pll import *
+from .wfm_tx import *
diff --git a/gr-analog/python/analog/am_demod.py b/gr-analog/python/analog/am_demod.py
index 3459e825f..eeb8964f3 100644
--- a/gr-analog/python/analog/am_demod.py
+++ b/gr-analog/python/analog/am_demod.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
#
# Copyright 2006,2007,2012 Free Software Foundation, Inc.
#
@@ -39,22 +40,22 @@ class am_demod_cf(gr.hier_block2):
audio_stop: audio low pass filter stop frequency (float)
"""
def __init__(self, channel_rate, audio_decim, audio_pass, audio_stop):
- gr.hier_block2.__init__(self, "am_demod_cf",
- gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
- gr.io_signature(1, 1, gr.sizeof_float)) # Input signature
+ gr.hier_block2.__init__(self, "am_demod_cf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Input signature
- MAG = blocks.complex_to_mag()
- DCR = blocks.add_const_ff(-1.0)
+ MAG = blocks.complex_to_mag()
+ DCR = blocks.add_const_ff(-1.0)
- audio_taps = filter.optfir.low_pass(0.5, # Filter gain
+ audio_taps = filter.optfir.low_pass(0.5, # Filter gain
channel_rate, # Sample rate
audio_pass, # Audio passband
audio_stop, # Audio stopband
- 0.1, # Passband ripple
- 60) # Stopband attenuation
- LPF = filter.fir_filter_fff(audio_decim, audio_taps)
+ 0.1, # Passband ripple
+ 60) # Stopband attenuation
+ LPF = filter.fir_filter_fff(audio_decim, audio_taps)
- self.connect(self, MAG, DCR, LPF, self)
+ self.connect(self, MAG, DCR, LPF, self)
class demod_10k0a3e_cf(am_demod_cf):
"""
@@ -68,6 +69,6 @@ class demod_10k0a3e_cf(am_demod_cf):
audio_decim: input to output decimation rate (integer)
"""
def __init__(self, channel_rate, audio_decim):
- am_demod_cf.__init__(self, channel_rate, audio_decim,
- 5000, # Audio passband
- 5500) # Audio stopband
+ am_demod_cf.__init__(self, channel_rate, audio_decim,
+ 5000, # Audio passband
+ 5500) # Audio stopband
diff --git a/gr-analog/python/analog/fm_demod.py b/gr-analog/python/analog/fm_demod.py
index 4e3c01d19..1344db831 100644
--- a/gr-analog/python/analog/fm_demod.py
+++ b/gr-analog/python/analog/fm_demod.py
@@ -19,14 +19,15 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
from gnuradio import gr, filter
-from fm_emph import fm_deemph
+from .fm_emph import fm_deemph
from math import pi
-try:
- from gnuradio import analog
-except ImportError:
- import analog_swig as analog
+from . import analog_swig as analog
class fm_demod_cf(gr.hier_block2):
@@ -54,7 +55,7 @@ class fm_demod_cf(gr.hier_block2):
gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
- k = channel_rate/(2*pi*deviation)
+ k = channel_rate / (2*pi*deviation)
QUAD = analog.quadrature_demod_cf(k)
audio_taps = filter.optfir.low_pass(
diff --git a/gr-analog/python/analog/fm_emph.py b/gr-analog/python/analog/fm_emph.py
index 348fb172d..02bdd576e 100644
--- a/gr-analog/python/analog/fm_emph.py
+++ b/gr-analog/python/analog/fm_emph.py
@@ -19,6 +19,10 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
from gnuradio import gr, filter
import math
import cmath
@@ -132,8 +136,8 @@ class fm_deemph(gr.hier_block2):
# Since H(s = 0) = 1.0, then H(z = 1) = 1.0 and has 0 dB gain at DC
if 0:
- print "btaps =", btaps
- print "ataps =", ataps
+ print("btaps =", btaps)
+ print("ataps =", ataps)
global plot1
plot1 = gru.gnuplot_freqz(gru.freqz(btaps, ataps), fs, True)
@@ -149,11 +153,11 @@ class fm_deemph(gr.hier_block2):
# o------+ +-----+--------o
# | R1 | |
# +----/\/\/\/--+ \
-# /
+ # /
# \ R2
# /
# \
-# |
+ # |
# o--------------------------+--------o
#
# (This fine ASCII rendition is based on Figure 5-15
@@ -263,44 +267,43 @@ class fm_preemph(gr.hier_block2):
gr.io_signature(1, 1, gr.sizeof_float), # Input signature
gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
- # Set fh to something sensible, if needed.
- # N.B. fh == fs/2.0 or fh == 0.0 results in a pole on the unit circle
- # at z = -1.0 or z = 1.0 respectively. That makes the filter unstable
- # and useless.
- if fh <= 0.0 or fh >= fs/2.0:
- fh = 0.925 * fs/2.0
+ # Set fh to something sensible, if needed.
+ # N.B. fh == fs/2.0 or fh == 0.0 results in a pole on the unit circle
+ # at z = -1.0 or z = 1.0 respectively. That makes the filter unstable
+ # and useless.
+ if fh <= 0.0 or fh >= fs / 2.0:
+ fh = 0.925 * fs/2.0
- # Digital corner frequencies
- w_cl = 1.0 / tau
- w_ch = 2.0 * math.pi * fh
+ # Digital corner frequencies
+ w_cl = 1.0 / tau
+ w_ch = 2.0 * math.pi * fh
- # Prewarped analog corner frequencies
- w_cla = 2.0 * fs * math.tan(w_cl / (2.0 * fs))
- w_cha = 2.0 * fs * math.tan(w_ch / (2.0 * fs))
+ # Prewarped analog corner frequencies
+ w_cla = 2.0 * fs * math.tan(w_cl / (2.0 * fs))
+ w_cha = 2.0 * fs * math.tan(w_ch / (2.0 * fs))
- # Resulting digital pole, zero, and gain term from the bilinear
- # transformation of H(s) = (s + w_cla) / (s + w_cha) to
- # H(z) = b0 (1 - z1 z^-1)/(1 - p1 z^-1)
- kl = -w_cla / (2.0 * fs)
- kh = -w_cha / (2.0 * fs)
- z1 = (1.0 + kl) / (1.0 - kl)
- p1 = (1.0 + kh) / (1.0 - kh)
- b0 = (1.0 - kl) / (1.0 - kh)
+ # Resulting digital pole, zero, and gain term from the bilinear
+ # transformation of H(s) = (s + w_cla) / (s + w_cha) to
+ # H(z) = b0 (1 - z1 z^-1)/(1 - p1 z^-1)
+ kl = -w_cla / (2.0 * fs)
+ kh = -w_cha / (2.0 * fs)
+ z1 = (1.0 + kl) / (1.0 - kl)
+ p1 = (1.0 + kh) / (1.0 - kh)
+ b0 = (1.0 - kl) / (1.0 - kh)
- # Since H(s = infinity) = 1.0, then H(z = -1) = 1.0 and
- # this filter has 0 dB gain at fs/2.0.
- # That isn't what users are going to expect, so adjust with a
- # gain, g, so that H(z = 1) = 1.0 for 0 dB gain at DC.
- w_0dB = 2.0 * math.pi * 0.0
- g = abs(1.0 - p1 * cmath.rect(1.0, -w_0dB)) \
- / (b0 * abs(1.0 - z1 * cmath.rect(1.0, -w_0dB)))
+ # Since H(s = infinity) = 1.0, then H(z = -1) = 1.0 and
+ # this filter has 0 dB gain at fs/2.0.
+ # That isn't what users are going to expect, so adjust with a
+ # gain, g, so that H(z = 1) = 1.0 for 0 dB gain at DC.
+ w_0dB = 2.0 * math.pi * 0.0
+ g = abs(1.0 - p1 * cmath.rect(1.0 / -w_0dB), (b0 * abs(1.0 - z1 * cmath.rect(1.0, -w_0dB))))
- btaps = [ g * b0 * 1.0, g * b0 * -z1 ]
- ataps = [ 1.0, -p1 ]
+ btaps = [ g * b0 * 1.0, g * b0 * -z1 ]
+ ataps = [ 1.0, -p1 ]
if 0:
- print "btaps =", btaps
- print "ataps =", ataps
+ print("btaps =", btaps)
+ print("ataps =", ataps)
global plot2
plot2 = gru.gnuplot_freqz(gru.freqz(btaps, ataps), fs, True)
diff --git a/gr-analog/python/analog/nbfm_rx.py b/gr-analog/python/analog/nbfm_rx.py
index 38fbf803c..3e8dcd528 100644
--- a/gr-analog/python/analog/nbfm_rx.py
+++ b/gr-analog/python/analog/nbfm_rx.py
@@ -19,15 +19,19 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
import math
+
from gnuradio import gr
from gnuradio import filter
-from fm_emph import fm_deemph
-try:
- from gnuradio import analog
-except ImportError:
- import analog_swig as analog
+from . import analog_swig as analog
+from .fm_emph import fm_deemph
+
class nbfm_rx(gr.hier_block2):
def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=5e3):
@@ -52,22 +56,22 @@ class nbfm_rx(gr.hier_block2):
audio_filter
"""
- gr.hier_block2.__init__(self, "nbfm_rx",
- gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
- gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+ gr.hier_block2.__init__(self, "nbfm_rx",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
# FIXME audio_rate and quad_rate ought to be exact rationals
self._audio_rate = audio_rate = int(audio_rate)
self._quad_rate = quad_rate = int(quad_rate)
if quad_rate % audio_rate != 0:
- raise ValueError, "quad_rate is not an integer multiple of audio_rate"
+ raise ValueError("quad_rate is not an integer multiple of audio_rate")
- squelch_threshold = 20 # dB
+ squelch_threshold = 20 # dB
#self.squelch = analog.simple_squelch_cc(squelch_threshold, 0.001)
# FM Demodulator input: complex; output: float
- k = quad_rate/(2*math.pi*max_dev)
+ k = quad_rate / (2*math.pi*max_dev)
self.quad_demod = analog.quadrature_demod_cf(k)
# FM Deemphasis IIR filter
@@ -81,7 +85,7 @@ class nbfm_rx(gr.hier_block2):
0.5e3, # Transition band
filter.firdes.WIN_HAMMING) # filter type
- print "len(audio_taps) =", len(audio_taps)
+ print("len(audio_taps) =", len(audio_taps))
# Decimating audio filter
# input: float; output: float; taps: float
@@ -90,5 +94,5 @@ class nbfm_rx(gr.hier_block2):
self.connect(self, self.quad_demod, self.deemph, self.audio_filter, self)
def set_max_deviation(self, max_dev):
- k = self._quad_rate/(2*math.pi*max_dev)
+ k = self._quad_rate / (2*math.pi*max_dev)
self.quad_demod.set_gain(k)
diff --git a/gr-analog/python/analog/nbfm_tx.py b/gr-analog/python/analog/nbfm_tx.py
index aa6c1eccc..a7620451e 100644
--- a/gr-analog/python/analog/nbfm_tx.py
+++ b/gr-analog/python/analog/nbfm_tx.py
@@ -19,14 +19,18 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
import math
+
from gnuradio import gr, filter
-from fm_emph import fm_preemph
+from .fm_emph import fm_preemph
+
+from . import analog_swig as analog
-try:
- from gnuradio import analog
-except ImportError:
- import analog_swig as analog
class nbfm_tx(gr.hier_block2):
def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=5e3, fh=-1.0):
@@ -46,16 +50,16 @@ class nbfm_tx(gr.hier_block2):
quad_rate must be an integer multiple of audio_rate.
"""
- gr.hier_block2.__init__(self, "nbfm_tx",
- gr.io_signature(1, 1, gr.sizeof_float), # Input signature
- gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
+ gr.hier_block2.__init__(self, "nbfm_tx",
+ gr.io_signature(1, 1, gr.sizeof_float), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
# FIXME audio_rate and quad_rate ought to be exact rationals
self._audio_rate = audio_rate = int(audio_rate)
self._quad_rate = quad_rate = int(quad_rate)
if quad_rate % audio_rate != 0:
- raise ValueError, "quad_rate is not an integer multiple of audio_rate"
+ raise ValueError("quad_rate is not an integer multiple of audio_rate")
do_interp = audio_rate != quad_rate
@@ -66,10 +70,10 @@ class nbfm_tx(gr.hier_block2):
quad_rate, # Fs
4500, # passband cutoff
7000, # stopband cutoff
- 0.1, # passband ripple dB
+ 0.1, # passband ripple dB
40) # stopband atten dB
- #print "len(interp_taps) =", len(interp_taps)
+ #print("len(interp_taps) =", len(interp_taps))
self.interpolator = filter.interp_fir_filter_fff (interp_factor, interp_taps)
self.preemph = fm_preemph(quad_rate, tau=tau, fh=fh)
@@ -90,10 +94,10 @@ class nbfm_tx(gr.hier_block2):
class ctcss_gen_f(gr.hier_block2):
def __init__(self, sample_rate, tone_freq):
- gr.hier_block2.__init__(self, "ctcss_gen_f",
- gr.io_signature(0, 0, 0), # Input signature
- gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+ gr.hier_block2.__init__(self, "ctcss_gen_f",
+ gr.io_signature(0, 0, 0), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
self.plgen = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE,
tone_freq, 0.1, 0.0)
- self.connect(self.plgen, self)
+ self.connect(self.plgen, self)
diff --git a/gr-analog/python/analog/qa_agc.py b/gr-analog/python/analog/qa_agc.py
index 70c9ba578..bac661f8b 100755..100644
--- a/gr-analog/python/analog/qa_agc.py
+++ b/gr-analog/python/analog/qa_agc.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, analog, blocks
class test_agc(gr_unittest.TestCase):
@@ -33,10 +34,10 @@ class test_agc(gr_unittest.TestCase):
def test_001_sets(self):
agc = analog.agc_cc(1e-3, 1, 1)
- agc.set_rate(1)
- agc.set_reference(1.1)
- agc.set_gain(1.1)
- agc.set_max_gain(100)
+ agc.set_rate(1)
+ agc.set_reference(1.1)
+ agc.set_gain(1.1)
+ agc.set_max_gain(100)
self.assertAlmostEqual(agc.rate(), 1)
self.assertAlmostEqual(agc.reference(), 1.1)
@@ -118,10 +119,10 @@ class test_agc(gr_unittest.TestCase):
def test_002_sets(self):
agc = analog.agc_ff(1e-3, 1, 1)
- agc.set_rate(1)
- agc.set_reference(1.1)
- agc.set_gain(1.1)
- agc.set_max_gain(100)
+ agc.set_rate(1)
+ agc.set_reference(1.1)
+ agc.set_gain(1.1)
+ agc.set_max_gain(100)
self.assertAlmostEqual(agc.rate(), 1)
self.assertAlmostEqual(agc.reference(), 1.1)
@@ -203,11 +204,11 @@ class test_agc(gr_unittest.TestCase):
def test_003_sets(self):
agc = analog.agc2_cc(1e-3, 1e-1, 1, 1)
- agc.set_attack_rate(1)
- agc.set_decay_rate(2)
- agc.set_reference(1.1)
- agc.set_gain(1.1)
- agc.set_max_gain(100)
+ agc.set_attack_rate(1)
+ agc.set_decay_rate(2)
+ agc.set_reference(1.1)
+ agc.set_gain(1.1)
+ agc.set_max_gain(100)
self.assertAlmostEqual(agc.attack_rate(), 1)
self.assertAlmostEqual(agc.decay_rate(), 2)
@@ -290,11 +291,11 @@ class test_agc(gr_unittest.TestCase):
def test_004_sets(self):
agc = analog.agc2_ff(1e-3, 1e-1, 1, 1)
- agc.set_attack_rate(1)
- agc.set_decay_rate(2)
- agc.set_reference(1.1)
- agc.set_gain(1.1)
- agc.set_max_gain(100)
+ agc.set_attack_rate(1)
+ agc.set_decay_rate(2)
+ agc.set_reference(1.1)
+ agc.set_gain(1.1)
+ agc.set_max_gain(100)
self.assertAlmostEqual(agc.attack_rate(), 1)
self.assertAlmostEqual(agc.decay_rate(), 2)
@@ -450,10 +451,10 @@ class test_agc(gr_unittest.TestCase):
def test_006_sets(self):
agc = analog.agc3_cc(1e-3, 1e-1, 1)
- agc.set_attack_rate(1)
- agc.set_decay_rate(2)
- agc.set_reference(1.1)
- agc.set_gain(1.1)
+ agc.set_attack_rate(1)
+ agc.set_decay_rate(2)
+ agc.set_reference(1.1)
+ agc.set_gain(1.1)
self.assertAlmostEqual(agc.attack_rate(), 1)
self.assertAlmostEqual(agc.decay_rate(), 2)
@@ -481,7 +482,7 @@ class test_agc(gr_unittest.TestCase):
tb.run()
dst_data = dst1.data()
M = 100
- result = map(lambda x: abs(x), dst_data[N-M:])
+ result = [abs(x) for x in dst_data[N-M:]]
self.assertFloatTuplesAlmostEqual(result, M*[ref,], 4)
def test_100(self):
diff --git a/gr-analog/python/analog/qa_cpfsk.py b/gr-analog/python/analog/qa_cpfsk.py
index be2e0a9b7..ef8ea0cb3 100755..100644
--- a/gr-analog/python/analog/qa_cpfsk.py
+++ b/gr-analog/python/analog/qa_cpfsk.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import math
from gnuradio import gr, gr_unittest, analog, blocks
@@ -50,7 +51,7 @@ class test_cpfsk_bc(gr_unittest.TestCase):
def test_cpfsk_bc_002(self):
src_data = 10*[0, 1]
- expected_result = map(lambda x: complex(2*x-1,0), src_data)
+ expected_result = [complex(2*x-1,0) for x in src_data]
src = blocks.vector_source_b(src_data)
op = analog.cpfsk_bc(2, 1, 2)
diff --git a/gr-analog/python/analog/qa_ctcss_squelch.py b/gr-analog/python/analog/qa_ctcss_squelch.py
index 3be1e9de3..f3db194f5 100755..100644
--- a/gr-analog/python/analog/qa_ctcss_squelch.py
+++ b/gr-analog/python/analog/qa_ctcss_squelch.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, analog, blocks
class test_ctcss_squelch(gr_unittest.TestCase):
@@ -63,7 +65,7 @@ class test_ctcss_squelch(gr_unittest.TestCase):
ramp = 1
gate = True
- src_data = map(lambda x: float(x)/10.0, range(1, 40))
+ src_data = [float(x) / 10.0 for x in range(1, 40)]
expected_result = src_data
expected_result[0] = 0
@@ -88,7 +90,7 @@ class test_ctcss_squelch(gr_unittest.TestCase):
ramp = 1
gate = False
- src_data = map(lambda x: float(x)/10.0, range(1, 40))
+ src_data = [float(x) / 10.0 for x in range(1, 40)]
src = blocks.vector_source_f(src_data)
op = analog.ctcss_squelch_ff(rate, freq, level,
length, ramp, gate)
diff --git a/gr-analog/python/analog/qa_dpll.py b/gr-analog/python/analog/qa_dpll.py
index 3ae8a3684..2d215e3d9 100755..100644
--- a/gr-analog/python/analog/qa_dpll.py
+++ b/gr-analog/python/analog/qa_dpll.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, analog, blocks
class test_dpll_bb(gr_unittest.TestCase):
@@ -42,7 +44,7 @@ class test_dpll_bb(gr_unittest.TestCase):
self.assertAlmostEqual(g, 0.2)
f = op.freq()
- self.assertEqual(1/period, f)
+ self.assertEqual(1 / period, f)
d0 = 1.0 - 0.5*f;
d1 = op.decision_threshold()
diff --git a/gr-analog/python/analog/qa_fastnoise.py b/gr-analog/python/analog/qa_fastnoise.py
index 91e1cb87b..e90fcfd96 100644
--- a/gr-analog/python/analog/qa_fastnoise.py
+++ b/gr-analog/python/analog/qa_fastnoise.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, analog
class test_fastnoise_source(gr_unittest.TestCase):
diff --git a/gr-analog/python/analog/qa_fmdet.py b/gr-analog/python/analog/qa_fmdet.py
index a9c88c3b9..77ad21341 100755..100644
--- a/gr-analog/python/analog/qa_fmdet.py
+++ b/gr-analog/python/analog/qa_fmdet.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, analog, blocks
class test_fmdet_cf(gr_unittest.TestCase):
diff --git a/gr-analog/python/analog/qa_frequency_modulator.py b/gr-analog/python/analog/qa_frequency_modulator.py
index 0f5c45b11..29282b0ea 100755..100644
--- a/gr-analog/python/analog/qa_frequency_modulator.py
+++ b/gr-analog/python/analog/qa_frequency_modulator.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import math
from gnuradio import gr, gr_unittest, analog, blocks
@@ -38,9 +40,9 @@ class test_frequency_modulator(gr_unittest.TestCase):
def test_fm_001(self):
pi = math.pi
- sensitivity = pi/4
- src_data = (1.0/4, 1.0/2, 1.0/4, -1.0/4, -1.0/2, -1/4.0)
- running_sum = (pi/16, 3*pi/16, pi/4, 3*pi/16, pi/16, 0)
+ sensitivity = pi / 4
+ src_data = (1.0 / 4, 1.0 / 2, 1.0 / 4, -1.0 / 4, -1.0 / 2, -1 / 4.0)
+ running_sum = (pi / 16, 3*pi/16, pi / 4, 3*pi/16, pi / 16, 0)
expected_result = tuple([sincos(x) for x in running_sum])
src = blocks.vector_source_f(src_data)
op = analog.frequency_modulator_fc(sensitivity)
diff --git a/gr-analog/python/analog/qa_noise.py b/gr-analog/python/analog/qa_noise.py
index 5576773f2..cf2e9e607 100755..100644
--- a/gr-analog/python/analog/qa_noise.py
+++ b/gr-analog/python/analog/qa_noise.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, analog
class test_noise_source(gr_unittest.TestCase):
diff --git a/gr-analog/python/analog/qa_phase_modulator.py b/gr-analog/python/analog/qa_phase_modulator.py
index c6223e5cd..7f7d57fa7 100755..100644
--- a/gr-analog/python/analog/qa_phase_modulator.py
+++ b/gr-analog/python/analog/qa_phase_modulator.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import math
from gnuradio import gr, gr_unittest, analog, blocks
@@ -38,8 +40,8 @@ class test_phase_modulator(gr_unittest.TestCase):
def test_fm_001(self):
pi = math.pi
- sensitivity = pi/4
- src_data = (1.0/4, 1.0/2, 1.0/4, -1.0/4, -1.0/2, -1/4.0)
+ sensitivity = pi / 4
+ src_data = (1.0 / 4, 1.0 / 2, 1.0 / 4, -1.0 / 4, -1.0 / 2, -1 / 4.0)
expected_result = tuple([sincos(sensitivity*x) for x in src_data])
src = blocks.vector_source_f(src_data)
diff --git a/gr-analog/python/analog/qa_pll_carriertracking.py b/gr-analog/python/analog/qa_pll_carriertracking.py
index 10ad41464..56bb14d2c 100755..100644
--- a/gr-analog/python/analog/qa_pll_carriertracking.py
+++ b/gr-analog/python/analog/qa_pll_carriertracking.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import math
from gnuradio import gr, gr_unittest, analog, blocks
@@ -137,7 +139,7 @@ class test_pll_carriertracking(gr_unittest.TestCase):
sampling_freq = 10e3
freq = sampling_freq / 100
- loop_bw = math.pi/100.0
+ loop_bw = math.pi / 100.0
maxf = 1
minf = -1
diff --git a/gr-analog/python/analog/qa_pll_freqdet.py b/gr-analog/python/analog/qa_pll_freqdet.py
index c7a8aa836..2006dd736 100755..100644
--- a/gr-analog/python/analog/qa_pll_freqdet.py
+++ b/gr-analog/python/analog/qa_pll_freqdet.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import math
from gnuradio import gr, gr_unittest, analog, blocks
@@ -137,7 +139,7 @@ class test_pll_freqdet(gr_unittest.TestCase):
sampling_freq = 10e3
freq = sampling_freq / 100
- loop_bw = math.pi/100.0
+ loop_bw = math.pi / 100.0
maxf = 1
minf = -1
@@ -153,7 +155,7 @@ class test_pll_freqdet(gr_unittest.TestCase):
dst_data = dst.data()
# convert it from normalized frequency to absolute frequency (Hz)
- dst_data = [i*(sampling_freq/(2*math.pi)) for i in dst_data]
+ dst_data = [i*(sampling_freq / (2*math.pi)) for i in dst_data]
self.assertFloatTuplesAlmostEqual(expected_result, dst_data, 3)
diff --git a/gr-analog/python/analog/qa_pll_refout.py b/gr-analog/python/analog/qa_pll_refout.py
index 835b6a452..ac1139cc0 100755..100644
--- a/gr-analog/python/analog/qa_pll_refout.py
+++ b/gr-analog/python/analog/qa_pll_refout.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import math
from gnuradio import gr, gr_unittest, analog, blocks
@@ -137,7 +139,7 @@ class test_pll_refout(gr_unittest.TestCase):
sampling_freq = 10e3
freq = sampling_freq / 100
- loop_bw = math.pi/100.0
+ loop_bw = math.pi / 100.0
maxf = 1
minf = -1
diff --git a/gr-analog/python/analog/qa_probe_avg_mag_sqrd.py b/gr-analog/python/analog/qa_probe_avg_mag_sqrd.py
index a52c0806e..68652eb36 100755..100644
--- a/gr-analog/python/analog/qa_probe_avg_mag_sqrd.py
+++ b/gr-analog/python/analog/qa_probe_avg_mag_sqrd.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import math
from gnuradio import gr, gr_unittest, analog, blocks
diff --git a/gr-analog/python/analog/qa_pwr_squelch.py b/gr-analog/python/analog/qa_pwr_squelch.py
index 561ca79a7..9f84a6140 100755..100644
--- a/gr-analog/python/analog/qa_pwr_squelch.py
+++ b/gr-analog/python/analog/qa_pwr_squelch.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, analog, blocks
class test_pwr_squelch(gr_unittest.TestCase):
@@ -61,7 +63,7 @@ class test_pwr_squelch(gr_unittest.TestCase):
alpha = 0.0001
thr = -25
- src_data = map(lambda x: float(x)/10.0, range(1, 40))
+ src_data = [float(x) / 10.0 for x in range(1, 40)]
src = blocks.vector_source_c(src_data)
op = analog.pwr_squelch_cc(thr, alpha)
dst = blocks.vector_sink_c()
@@ -107,7 +109,7 @@ class test_pwr_squelch(gr_unittest.TestCase):
alpha = 0.0001
thr = -25
- src_data = map(lambda x: float(x)/10.0, range(1, 40))
+ src_data = [float(x) / 10.0 for x in range(1, 40)]
src = blocks.vector_source_f(src_data)
op = analog.pwr_squelch_ff(thr, alpha)
dst = blocks.vector_sink_f()
diff --git a/gr-analog/python/analog/qa_quadrature_demod.py b/gr-analog/python/analog/qa_quadrature_demod.py
index 08f3f4600..e3a513b9a 100755..100644
--- a/gr-analog/python/analog/qa_quadrature_demod.py
+++ b/gr-analog/python/analog/qa_quadrature_demod.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import cmath
from gnuradio import gr, gr_unittest, analog, blocks
@@ -37,13 +39,13 @@ class test_quadrature_demod(gr_unittest.TestCase):
fs = 8000.0
src_data = []
- for i in xrange(200):
- ti = i/fs
+ for i in range(200):
+ ti = i / fs
src_data.append(cmath.exp(2j*cmath.pi*f*ti))
# f/fs is a quarter turn per sample.
# Set the gain based on this to get 1 out.
- gain = 1.0/(cmath.pi/4)
+ gain = 1.0 / (cmath.pi / 4)
expected_result = [0,] + 199*[1.0]
diff --git a/gr-analog/python/analog/qa_rail_ff.py b/gr-analog/python/analog/qa_rail_ff.py
index e3990dfd3..93cde00a9 100755..100644
--- a/gr-analog/python/analog/qa_rail_ff.py
+++ b/gr-analog/python/analog/qa_rail_ff.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, analog, blocks
def clip(x, lo, hi):
@@ -60,7 +61,7 @@ class test_rail(gr_unittest.TestCase):
lo = -0.75
hi = 0.90
src_data = [-2, -1, -0.5, -0.25, 0, 0.25, 0.5, 1, 2]
- expected_result = map(lambda x: clip(x, lo, hi), src_data)
+ expected_result = [clip(x, lo, hi) for x in src_data]
src = blocks.vector_source_f(src_data)
op = analog.rail_ff(lo, hi)
diff --git a/gr-analog/python/analog/qa_random_uniform_source.py b/gr-analog/python/analog/qa_random_uniform_source.py
index 474c5716c..d02ea7ea8 100755..100644
--- a/gr-analog/python/analog/qa_random_uniform_source.py
+++ b/gr-analog/python/analog/qa_random_uniform_source.py
@@ -21,6 +21,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest
from gnuradio import blocks, analog
import numpy as np
diff --git a/gr-analog/python/analog/qa_sig_source.py b/gr-analog/python/analog/qa_sig_source.py
index 8d050fa72..a38db2928 100755..100644
--- a/gr-analog/python/analog/qa_sig_source.py
+++ b/gr-analog/python/analog/qa_sig_source.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import math
import pmt
from gnuradio import gr, gr_unittest, analog, blocks
diff --git a/gr-analog/python/analog/qa_simple_squelch.py b/gr-analog/python/analog/qa_simple_squelch.py
index b09a3b2a8..a0b09e719 100755..100644
--- a/gr-analog/python/analog/qa_simple_squelch.py
+++ b/gr-analog/python/analog/qa_simple_squelch.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, analog, blocks
class test_simple_squelch(gr_unittest.TestCase):
@@ -48,7 +50,7 @@ class test_simple_squelch(gr_unittest.TestCase):
alpha = 0.0001
thr = -25
- src_data = map(lambda x: float(x)/10.0, range(1, 40))
+ src_data = [float(x) / 10.0 for x in range(1, 40)]
src = blocks.vector_source_c(src_data)
op = analog.simple_squelch_cc(thr, alpha)
dst = blocks.vector_sink_c()
diff --git a/gr-analog/python/analog/standard_squelch.py b/gr-analog/python/analog/standard_squelch.py
index 3ed9ebcea..9609f2449 100644
--- a/gr-analog/python/analog/standard_squelch.py
+++ b/gr-analog/python/analog/standard_squelch.py
@@ -1,3 +1,5 @@
+from __future__ import division
+from __future__ import unicode_literals
#
# Copyright 2005,2007,2012 Free Software Foundation, Inc.
#
@@ -26,29 +28,29 @@ from gnuradio import filter
class standard_squelch(gr.hier_block2):
def __init__(self, audio_rate):
- gr.hier_block2.__init__(self, "standard_squelch",
- gr.io_signature(1, 1, gr.sizeof_float), # Input signature
- gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+ gr.hier_block2.__init__(self, "standard_squelch",
+ gr.io_signature(1, 1, gr.sizeof_float), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
self.input_node = blocks.add_const_ff(0) # FIXME kludge
self.low_iir = filter.iir_filter_ffd((0.0193,0,-0.0193),(1,1.9524,-0.9615))
self.low_square = blocks.multiply_ff()
- self.low_smooth = filter.single_pole_iir_filter_ff(1/(0.01*audio_rate)) # 100ms time constant
+ self.low_smooth = filter.single_pole_iir_filter_ff(1 / (0.01*audio_rate)) # 100ms time constant
self.hi_iir = filter.iir_filter_ffd((0.0193,0,-0.0193),(1,1.3597,-0.9615))
self.hi_square = blocks.multiply_ff()
- self.hi_smooth = filter.single_pole_iir_filter_ff(1/(0.01*audio_rate))
+ self.hi_smooth = filter.single_pole_iir_filter_ff(1 / (0.01*audio_rate))
self.sub = blocks.sub_ff();
self.add = blocks.add_ff();
self.gate = blocks.threshold_ff(0.3,0.43,0)
- self.squelch_lpf = filter.single_pole_iir_filter_ff(1/(0.01*audio_rate))
+ self.squelch_lpf = filter.single_pole_iir_filter_ff(1 / (0.01*audio_rate))
self.div = blocks.divide_ff()
self.squelch_mult = blocks.multiply_ff()
- self.connect(self, self.input_node)
+ self.connect(self, self.input_node)
self.connect(self.input_node, (self.squelch_mult, 0))
self.connect(self.input_node,self.low_iir)
@@ -66,7 +68,7 @@ class standard_squelch(gr.hier_block2):
self.connect(self.sub, (self.div, 0))
self.connect(self.add, (self.div, 1))
self.connect(self.div, self.gate, self.squelch_lpf, (self.squelch_mult,1))
- self.connect(self.squelch_mult, self)
+ self.connect(self.squelch_mult, self)
def set_threshold(self, threshold):
self.gate.set_hi(threshold)
@@ -75,4 +77,4 @@ class standard_squelch(gr.hier_block2):
return self.gate.hi()
def squelch_range(self):
- return (0.0, 1.0, 1.0/100)
+ return (0.0, 1.0, 1.0 / 100)
diff --git a/gr-analog/python/analog/wfm_rcv.py b/gr-analog/python/analog/wfm_rcv.py
index d35d21927..c1f6dea33 100644
--- a/gr-analog/python/analog/wfm_rcv.py
+++ b/gr-analog/python/analog/wfm_rcv.py
@@ -19,14 +19,17 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, filter
-from fm_emph import fm_deemph
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
import math
-try:
- from gnuradio import analog
-except ImportError:
- import analog_swig as analog
+from gnuradio import gr, filter
+
+from . import analog_swig as analog
+from .fm_emph import fm_deemph
+
class wfm_rcv(gr.hier_block2):
def __init__ (self, quad_rate, audio_decimation):
@@ -40,14 +43,14 @@ class wfm_rcv(gr.hier_block2):
quad_rate: input sample rate of complex baseband input. (float)
audio_decimation: how much to decimate quad_rate to get to audio. (integer)
"""
- gr.hier_block2.__init__(self, "wfm_rcv",
- gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
- gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+ gr.hier_block2.__init__(self, "wfm_rcv",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
volume = 20.
max_dev = 75e3
- fm_demod_gain = quad_rate/(2*math.pi*max_dev)
+ fm_demod_gain = quad_rate / (2*math.pi*max_dev)
audio_rate = quad_rate / audio_decimation
@@ -64,7 +67,7 @@ class wfm_rcv(gr.hier_block2):
width_of_transition_band = audio_rate / 32
audio_coeffs = filter.firdes.low_pass(1.0, # gain
quad_rate, # sampling rate
- audio_rate/2 - width_of_transition_band,
+ audio_rate / 2 - width_of_transition_band,
width_of_transition_band,
filter.firdes.WIN_HAMMING)
# input: float; output: float
diff --git a/gr-analog/python/analog/wfm_rcv_fmdet.py b/gr-analog/python/analog/wfm_rcv_fmdet.py
index b7cd1458f..fe91465a3 100644
--- a/gr-analog/python/analog/wfm_rcv_fmdet.py
+++ b/gr-analog/python/analog/wfm_rcv_fmdet.py
@@ -19,16 +19,19 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
+import math
+
from gnuradio import gr
from gnuradio import blocks
from gnuradio import filter
-from fm_emph import fm_deemph
-import math
-try:
- from gnuradio import analog
-except ImportError:
- import analog_swig as analog
+from . import analog_swig as analog
+from .fm_emph import fm_deemph
+
class wfm_rcv_fmdet(gr.hier_block2):
def __init__ (self, demod_rate, audio_decimation):
@@ -43,11 +46,11 @@ class wfm_rcv_fmdet(gr.hier_block2):
demod_rate: input sample rate of complex baseband input. (float)
audio_decimation: how much to decimate demod_rate to get to audio. (integer)
"""
- gr.hier_block2.__init__(self, "wfm_rcv_fmdet",
- gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
- gr.io_signature(2, 2, gr.sizeof_float)) # Output signature
- lowfreq = -125e3/demod_rate
- highfreq = 125e3/demod_rate
+ gr.hier_block2.__init__(self, "wfm_rcv_fmdet",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(2, 2, gr.sizeof_float)) # Output signature
+ lowfreq = -125e3 / demod_rate
+ highfreq = 125e3 / demod_rate
audio_rate = demod_rate / audio_decimation
# We assign to self so that outsiders can grab the demodulator
@@ -98,8 +101,8 @@ class wfm_rcv_fmdet(gr.hier_block2):
stereo_dsbsc_filter_coeffs = \
filter.firdes.complex_band_pass(20.0,
demod_rate,
- 38000-15000/2,
- 38000+15000/2,
+ 38000-15000 / 2,
+ 38000+15000 / 2,
width_of_transition_band,
filter.firdes.WIN_HAMMING)
#print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs)
@@ -127,12 +130,12 @@ class wfm_rcv_fmdet(gr.hier_block2):
#print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs
# construct overlap add filter system from coefficients for stereo carrier
- self.rds_signal_filter = \
+ self.rds_signal_filter = \
filter.fir_filter_fcc(audio_decimation,
stereo_rds_filter_coeffs)
- self.rds_carrier_generator = blocks.multiply_cc();
- self.rds_signal_generator = blocks.multiply_cc();
- self_rds_signal_processor = blocks.null_sink(gr.sizeof_gr_complex);
+ self.rds_carrier_generator = blocks.multiply_cc();
+ self.rds_signal_generator = blocks.multiply_cc();
+ self_rds_signal_processor = blocks.null_sink(gr.sizeof_gr_complex);
loop_bw = 2*math.pi/100.0
max_freq = -2.0*math.pi*18990/audio_rate;
@@ -191,21 +194,21 @@ class wfm_rcv_fmdet(gr.hier_block2):
#send it to negative side of a subtracter
self.connect(self.LmR_real,(self.Make_Right,1))
- # Make rds carrier by taking the squared pilot tone and
- # multiplying by pilot tone
- self.connect(self.stereo_basebander,(self.rds_carrier_generator,0))
+ # Make rds carrier by taking the squared pilot tone and
+ # multiplying by pilot tone
+ self.connect(self.stereo_basebander,(self.rds_carrier_generator,0))
self.connect(self.stereo_carrier_pll_recovery,(self.rds_carrier_generator,1))
- # take signal, filter off rds, send into mixer 0 channel
- self.connect(self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0))
+ # take signal, filter off rds, send into mixer 0 channel
+ self.connect(self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0))
# take rds_carrier_generator output and send into mixer 1
# channel
- self.connect(self.rds_carrier_generator,(self.rds_signal_generator,1))
+ self.connect(self.rds_carrier_generator,(self.rds_signal_generator,1))
- # send basebanded rds signal and send into "processor"
- # which for now is a null sink
- self.connect(self.rds_signal_generator,self_rds_signal_processor)
+ # send basebanded rds signal and send into "processor"
+ # which for now is a null sink
+ self.connect(self.rds_signal_generator,self_rds_signal_processor)
if 1:
diff --git a/gr-analog/python/analog/wfm_rcv_pll.py b/gr-analog/python/analog/wfm_rcv_pll.py
index 282e2b14b..b6ca7fe7c 100644
--- a/gr-analog/python/analog/wfm_rcv_pll.py
+++ b/gr-analog/python/analog/wfm_rcv_pll.py
@@ -19,16 +19,19 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
+import math
+
from gnuradio import gr
from gnuradio import blocks
from gnuradio import filter
-from fm_emph import fm_deemph
-import math
-try:
- from gnuradio import analog
-except ImportError:
- import analog_swig as analog
+from . import analog_swig as analog
+from .fm_emph import fm_deemph
+
class wfm_rcv_pll(gr.hier_block2):
def __init__(self, demod_rate, audio_decimation):
@@ -42,9 +45,9 @@ class wfm_rcv_pll(gr.hier_block2):
demod_rate: input sample rate of complex baseband input. (float)
audio_decimation: how much to decimate demod_rate to get to audio. (integer)
"""
- gr.hier_block2.__init__(self, "wfm_rcv_pll",
- gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
- gr.io_signature(2, 2, gr.sizeof_float)) # Output signature
+ gr.hier_block2.__init__(self, "wfm_rcv_pll",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(2, 2, gr.sizeof_float)) # Output signature
bandwidth = 250e3
audio_rate = demod_rate / audio_decimation
@@ -92,8 +95,8 @@ class wfm_rcv_pll(gr.hier_block2):
stereo_dsbsc_filter_coeffs = \
filter.firdes.complex_band_pass(20.0,
demod_rate,
- 38000-15000/2,
- 38000+15000/2,
+ 38000-15000 / 2,
+ 38000+15000 / 2,
width_of_transition_band,
filter.firdes.WIN_HAMMING)
#print "len stereo dsbsc filter = ",len(stereo_dsbsc_filter_coeffs)
@@ -120,12 +123,12 @@ class wfm_rcv_pll(gr.hier_block2):
#print "stereo dsbsc filter ", stereo_dsbsc_filter_coeffs
# construct overlap add filter system from coefficients for stereo carrier
- self.rds_signal_filter = \
+ self.rds_signal_filter = \
filter.fir_filter_fcc(audio_decimation, stereo_rds_filter_coeffs)
- self.rds_carrier_generator = blocks.multiply_cc();
- self.rds_signal_generator = blocks.multiply_cc();
- self_rds_signal_processor = blocks.null_sink(gr.sizeof_gr_complex);
+ self.rds_carrier_generator = blocks.multiply_cc();
+ self.rds_signal_generator = blocks.multiply_cc();
+ self_rds_signal_processor = blocks.null_sink(gr.sizeof_gr_complex);
loop_bw = 2*math.pi/100.0
max_freq = -2.0*math.pi*18990/audio_rate;
@@ -169,15 +172,15 @@ class wfm_rcv_pll(gr.hier_block2):
#take the same real part of the DSBSC baseband signal and send it to negative side of a subtracter
self.connect(self.LmR_real,(self.Make_Right,1))
- # Make rds carrier by taking the squared pilot tone and multiplying by pilot tone
- self.connect(self.stereo_basebander,(self.rds_carrier_generator,0))
+ # Make rds carrier by taking the squared pilot tone and multiplying by pilot tone
+ self.connect(self.stereo_basebander,(self.rds_carrier_generator,0))
self.connect(self.stereo_carrier_pll_recovery,(self.rds_carrier_generator,1))
- # take signal, filter off rds, send into mixer 0 channel
- self.connect(self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0))
+ # take signal, filter off rds, send into mixer 0 channel
+ self.connect(self.fm_demod,self.rds_signal_filter,(self.rds_signal_generator,0))
# take rds_carrier_generator output and send into mixer 1 channel
- self.connect(self.rds_carrier_generator,(self.rds_signal_generator,1))
- # send basebanded rds signal and send into "processor" which for now is a null sink
- self.connect(self.rds_signal_generator,self_rds_signal_processor)
+ self.connect(self.rds_carrier_generator,(self.rds_signal_generator,1))
+ # send basebanded rds signal and send into "processor" which for now is a null sink
+ self.connect(self.rds_signal_generator,self_rds_signal_processor)
if 1:
diff --git a/gr-analog/python/analog/wfm_tx.py b/gr-analog/python/analog/wfm_tx.py
index a1b589350..9f49ca3ca 100644
--- a/gr-analog/python/analog/wfm_tx.py
+++ b/gr-analog/python/analog/wfm_tx.py
@@ -19,15 +19,19 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
import math
+
from gnuradio import gr
from gnuradio import filter
-from fm_emph import fm_preemph
-try:
- from gnuradio import analog
-except ImportError:
- import analog_swig as analog
+from . import analog_swig as analog
+from .fm_emph import fm_preemph
+
class wfm_tx(gr.hier_block2):
def __init__(self, audio_rate, quad_rate, tau=75e-6, max_dev=75e3, fh=-1.0):
@@ -46,16 +50,16 @@ class wfm_tx(gr.hier_block2):
quad_rate must be an integer multiple of audio_rate.
"""
- gr.hier_block2.__init__(self, "wfm_tx",
- gr.io_signature(1, 1, gr.sizeof_float), # Input signature
- gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
+ gr.hier_block2.__init__(self, "wfm_tx",
+ gr.io_signature(1, 1, gr.sizeof_float), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
# FIXME audio_rate and quad_rate ought to be exact rationals
audio_rate = int(audio_rate)
quad_rate = int(quad_rate)
if quad_rate % audio_rate != 0:
- raise ValueError, "quad_rate is not an integer multiple of audio_rate"
+ raise ValueError("quad_rate is not an integer multiple of audio_rate")
do_interp = audio_rate != quad_rate
@@ -66,10 +70,10 @@ class wfm_tx(gr.hier_block2):
quad_rate, # Fs
16000, # passband cutoff
18000, # stopband cutoff
- 0.1, # passband ripple dB
+ 0.1, # passband ripple dB
40) # stopband atten dB
- print "len(interp_taps) =", len(interp_taps)
+ print("len(interp_taps) =", len(interp_taps))
self.interpolator = filter.interp_fir_filter_fff (interp_factor, interp_taps)
self.preemph = fm_preemph(quad_rate, tau=tau, fh=fh)
diff --git a/gr-audio/examples/python/audio_copy.py b/gr-audio/examples/python/audio_copy.py
index b68e94949..5909be650 100755..100644
--- a/gr-audio/examples/python/audio_copy.py
+++ b/gr-audio/examples/python/audio_copy.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio.eng_arg import eng_float
diff --git a/gr-audio/examples/python/audio_play.py b/gr-audio/examples/python/audio_play.py
index 367d7bd20..7d551cc18 100755..100644
--- a/gr-audio/examples/python/audio_play.py
+++ b/gr-audio/examples/python/audio_play.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio import blocks
diff --git a/gr-audio/examples/python/audio_to_file.py b/gr-audio/examples/python/audio_to_file.py
index b385abf92..e35bb7038 100755..100644
--- a/gr-audio/examples/python/audio_to_file.py
+++ b/gr-audio/examples/python/audio_to_file.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio import blocks
diff --git a/gr-audio/examples/python/dial_tone.py b/gr-audio/examples/python/dial_tone.py
index ebef8c01c..98a75e6bb 100755..100644
--- a/gr-audio/examples/python/dial_tone.py
+++ b/gr-audio/examples/python/dial_tone.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio.eng_arg import eng_float
diff --git a/gr-audio/examples/python/dial_tone_daemon.py b/gr-audio/examples/python/dial_tone_daemon.py
index 9919e367a..932ae07d4 100755..100644
--- a/gr-audio/examples/python/dial_tone_daemon.py
+++ b/gr-audio/examples/python/dial_tone_daemon.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import gr, gru
from gnuradio import audio
from gnuradio.eng_arg import eng_float
@@ -54,5 +56,5 @@ class my_top_block(gr.top_block):
if __name__ == '__main__':
pid = gru.daemonize()
- print "To stop this program, enter 'kill %d'" % pid
+ print("To stop this program, enter 'kill %d'" % pid)
my_top_block().run()
diff --git a/gr-audio/examples/python/dial_tone_wav.py b/gr-audio/examples/python/dial_tone_wav.py
index 351ca94e7..b9cf6bc51 100755..100644
--- a/gr-audio/examples/python/dial_tone_wav.py
+++ b/gr-audio/examples/python/dial_tone_wav.py
@@ -22,6 +22,7 @@
# GNU Radio example program to record a dial tone to a WAV file
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
from gnuradio.eng_arg import eng_float
diff --git a/gr-audio/examples/python/mono_tone.py b/gr-audio/examples/python/mono_tone.py
index 653fd575f..be86a4f6f 100755..100644
--- a/gr-audio/examples/python/mono_tone.py
+++ b/gr-audio/examples/python/mono_tone.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio.eng_arg import eng_float
diff --git a/gr-audio/examples/python/multi_tone.py b/gr-audio/examples/python/multi_tone.py
index 00c052794..a2e8702a7 100755..100644
--- a/gr-audio/examples/python/multi_tone.py
+++ b/gr-audio/examples/python/multi_tone.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio.eng_arg import eng_float, intx
@@ -59,11 +61,11 @@ class my_top_block(gr.top_block):
# See "Genesis of a Music". He was into some very wild tunings...
base = 392
ratios = { 1 : 1.0,
- 3 : 3.0/2,
- 5 : 5.0/4,
- 7 : 7.0/4,
- 9 : 9.0/8,
- 11 : 11.0/8 }
+ 3 : 3.0 / 2,
+ 5 : 5.0 / 4,
+ 7 : 7.0 / 4,
+ 9 : 9.0 / 8,
+ 11 : 11.0 / 8 }
# progression = (1, 5, 3, 7)
# progression = (1, 9, 3, 7)
diff --git a/gr-audio/examples/python/noise.py b/gr-audio/examples/python/noise.py
index 31fdb16fe..ee4e7f213 100755..100644
--- a/gr-audio/examples/python/noise.py
+++ b/gr-audio/examples/python/noise.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio import digital
diff --git a/gr-audio/examples/python/spectrum_inversion.py b/gr-audio/examples/python/spectrum_inversion.py
index 163668e45..f5d5a05b9 100755..100644
--- a/gr-audio/examples/python/spectrum_inversion.py
+++ b/gr-audio/examples/python/spectrum_inversion.py
@@ -26,6 +26,7 @@
# to a SSB signal on the wrong sideband.
#
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio import blocks
diff --git a/gr-audio/examples/python/test_resampler.py b/gr-audio/examples/python/test_resampler.py
index 4d8a9233e..daca7fc71 100755..100644
--- a/gr-audio/examples/python/test_resampler.py
+++ b/gr-audio/examples/python/test_resampler.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr, gru
from gnuradio import audio
from gnuradio import filter
@@ -54,11 +57,11 @@ class my_top_block(gr.top_block):
input_rate = int(args.input_rate)
output_rate = int(args.output_rate)
- interp = gru.lcm(input_rate, output_rate) / input_rate
- decim = gru.lcm(input_rate, output_rate) / output_rate
+ interp = gru.lcm(input_rate / output_rate, input_rate)
+ decim = gru.lcm(input_rate / output_rate, output_rate)
- print "interp =", interp
- print "decim =", decim
+ print("interp =", interp)
+ print("decim =", decim)
ampl = 0.1
src0 = analog.sig_source_f(input_rate, analog.GR_SIN_WAVE, 650, ampl)
diff --git a/gr-audio/grc/CMakeLists.txt b/gr-audio/grc/CMakeLists.txt
index 7da5fbc35..ead168ee4 100644
--- a/gr-audio/grc/CMakeLists.txt
+++ b/gr-audio/grc/CMakeLists.txt
@@ -18,5 +18,5 @@
# Boston, MA 02110-1301, USA.
########################################################################
-file(GLOB xml_files "*.xml")
-install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR})
+file(GLOB yml_files "*.yml")
+install(FILES ${yml_files} DESTINATION ${GRC_BLOCKS_DIR})
diff --git a/gr-audio/grc/audio_sink.block.yml b/gr-audio/grc/audio_sink.block.yml
new file mode 100644
index 000000000..05dd947f8
--- /dev/null
+++ b/gr-audio/grc/audio_sink.block.yml
@@ -0,0 +1,49 @@
+id: audio_sink
+label: Audio Sink
+category: '[Core]/Audio'
+flags: throttle
+
+parameters:
+- id: samp_rate
+ label: Sample Rate
+ dtype: int
+ default: samp_rate
+ options: ['16000', '22050', '24000', '32000', '44100', '48000']
+ option_labels: [16KHz, 22.05KHz, 24KHz, 32KHz, 44.1KHz, 48KHz]
+- id: device_name
+ label: Device Name
+ dtype: string
+ hide: ${ ('none' if device_name else 'part') }
+- id: ok_to_block
+ label: OK to Block
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: num_inputs
+ label: Num Inputs
+ dtype: int
+ default: '1'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: float
+ multiplicity: ${ num_inputs }
+
+asserts:
+- ${ 0 < num_inputs }
+
+templates:
+ imports: from gnuradio import audio
+ make: audio.sink(${samp_rate}, ${device_name}, ${ok_to_block})
+
+documentation: |-
+ Not all sampling rates will be supported by your hardware.
+
+ Leave the device name blank to choose deafult audio device. ALSA users with audio trouble may try setting the device name to plughw:0,0
+
+ The audio sink can have multiple inputs depending upon your hardware. For example, set the inputs to 2 for stereo audio.
+
+file_format: 1
diff --git a/gr-audio/grc/audio_sink.xml b/gr-audio/grc/audio_sink.xml
deleted file mode 100644
index 9181055cd..000000000
--- a/gr-audio/grc/audio_sink.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Audio Sink
-###################################################
- -->
-<block>
- <name>Audio Sink</name>
- <key>audio_sink</key>
- <category>[Core]/Audio</category>
- <flags>throttle</flags>
- <import>from gnuradio import audio</import>
- <make>audio.sink($samp_rate, $device_name, $ok_to_block)</make>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>int</type>
- <option>
- <name>16KHz</name>
- <key>16000</key>
- </option>
- <option>
- <name>22.05KHz</name>
- <key>22050</key>
- </option>
- <option>
- <name>24KHz</name>
- <key>24000</key>
- </option>
- <option>
- <name>32KHz</name>
- <key>32000</key>
- </option>
- <option>
- <name>44.1KHz</name>
- <key>44100</key>
- </option>
- <option>
- <name>48KHz</name>
- <key>48000</key>
- </option>
- </param>
- <param>
- <name>Device Name</name>
- <key>device_name</key>
- <value></value>
- <type>string</type>
- <hide>#if $device_name() then 'none' else 'part'#</hide>
- </param>
- <param>
- <name>OK to Block</name>
- <key>ok_to_block</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Num Inputs</name>
- <key>num_inputs</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>0 &lt; $num_inputs</check>
- <sink>
- <name>in</name>
- <type>float</type>
- <nports>$num_inputs</nports>
- </sink>
- <doc>
-Not all sampling rates will be supported by your hardware.
-
-Leave the device name blank to choose deafult audio device. \
-ALSA users with audio trouble may try setting the device name to plughw:0,0
-
-The audio sink can have multiple inputs depending upon your hardware. \
-For example, set the inputs to 2 for stereo audio.
- </doc>
-</block>
diff --git a/gr-audio/grc/audio_source.block.yml b/gr-audio/grc/audio_source.block.yml
new file mode 100644
index 000000000..cf22ab3cb
--- /dev/null
+++ b/gr-audio/grc/audio_source.block.yml
@@ -0,0 +1,49 @@
+id: audio_source
+label: Audio Source
+category: '[Core]/Audio'
+flags: throttle
+
+parameters:
+- id: samp_rate
+ label: Sample Rate
+ dtype: int
+ default: samp_rate
+ options: ['16000', '22050', '24000', '32000', '44100', '48000']
+ option_labels: [16KHz, 22.05KHz, 24KHz, 32KHz, 44.1KHz, 48KHz]
+- id: device_name
+ label: Device Name
+ dtype: string
+ hide: ${ ('none' if device_name else 'part') }
+- id: ok_to_block
+ label: OK to Block
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: num_outputs
+ label: Num Outputs
+ dtype: int
+ default: '1'
+ hide: part
+
+outputs:
+- domain: stream
+ dtype: float
+ multiplicity: ${ num_outputs }
+
+asserts:
+- ${ 0 < num_outputs }
+
+templates:
+ imports: from gnuradio import audio
+ make: audio.source(${samp_rate}, ${device_name}, ${ok_to_block})
+
+documentation: |-
+ Not all sampling rates will be supported by your hardware.
+
+ Leave the device name blank to choose deafult audio device. ALSA users with audio trouble may try setting the device name to plughw:0,0
+
+ The audio source can have multiple outputs depending upon your hardware. For example, set the outputs to 2 for stereo audio.
+
+file_format: 1
diff --git a/gr-audio/grc/audio_source.xml b/gr-audio/grc/audio_source.xml
deleted file mode 100644
index 044b14466..000000000
--- a/gr-audio/grc/audio_source.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Audio Source
-###################################################
- -->
-<block>
- <name>Audio Source</name>
- <key>audio_source</key>
- <category>[Core]/Audio</category>
- <flags>throttle</flags>
- <import>from gnuradio import audio</import>
- <make>audio.source($samp_rate, $device_name, $ok_to_block)</make>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>int</type>
- <option>
- <name>16KHz</name>
- <key>16000</key>
- </option>
- <option>
- <name>22.05KHz</name>
- <key>22050</key>
- </option>
- <option>
- <name>24KHz</name>
- <key>24000</key>
- </option>
- <option>
- <name>32KHz</name>
- <key>32000</key>
- </option>
- <option>
- <name>44.1KHz</name>
- <key>44100</key>
- </option>
- <option>
- <name>48KHz</name>
- <key>48000</key>
- </option>
- </param>
- <param>
- <name>Device Name</name>
- <key>device_name</key>
- <value></value>
- <type>string</type>
- <hide>#if $device_name() then 'none' else 'part'#</hide>
- </param>
- <param>
- <name>OK to Block</name>
- <key>ok_to_block</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Num Outputs</name>
- <key>num_outputs</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>0 &lt; $num_outputs</check>
- <source>
- <name>out</name>
- <type>float</type>
- <nports>$num_outputs</nports>
- </source>
- <doc>
-Not all sampling rates will be supported by your hardware.
-
-Leave the device name blank to choose deafult audio device. \
-ALSA users with audio trouble may try setting the device name to plughw:0,0
-
-The audio source can have multiple outputs depending upon your hardware. \
-For example, set the outputs to 2 for stereo audio.
- </doc>
-</block>
diff --git a/gr-audio/python/audio/CMakeLists.txt b/gr-audio/python/audio/CMakeLists.txt
index 2edbf21cf..2f1fee57f 100644
--- a/gr-audio/python/audio/CMakeLists.txt
+++ b/gr-audio/python/audio/CMakeLists.txt
@@ -41,6 +41,6 @@ if(ENABLE_TESTING)
file(GLOB py_qa_test_files "qa_*.py")
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gr-audio/python/audio/__init__.py b/gr-audio/python/audio/__init__.py
index 8674c2603..03f5d6a93 100644
--- a/gr-audio/python/audio/__init__.py
+++ b/gr-audio/python/audio/__init__.py
@@ -26,6 +26,7 @@ ports on a computer.
The underlying hardware driver is system and OS dependent and this
module should automatically discover the correct one to use.
'''
+from __future__ import unicode_literals
import os
try:
diff --git a/gr-blocks/examples/ctrlport/simple_copy_controller.py b/gr-blocks/examples/ctrlport/simple_copy_controller.py
index 7bd05006f..0f907eef6 100755..100644
--- a/gr-blocks/examples/ctrlport/simple_copy_controller.py
+++ b/gr-blocks/examples/ctrlport/simple_copy_controller.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
+from __future__ import unicode_literals
import sys
import pmt
from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient
diff --git a/gr-blocks/examples/ctrlport/usrp_sink_controller.py b/gr-blocks/examples/ctrlport/usrp_sink_controller.py
index ec687d80e..a5dc20070 100755..100644
--- a/gr-blocks/examples/ctrlport/usrp_sink_controller.py
+++ b/gr-blocks/examples/ctrlport/usrp_sink_controller.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
+from __future__ import unicode_literals
import sys
import pmt
from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient
diff --git a/gr-blocks/examples/ctrlport/usrp_source_controller.py b/gr-blocks/examples/ctrlport/usrp_source_controller.py
index 78c5ae66a..ec27c84a1 100755..100644
--- a/gr-blocks/examples/ctrlport/usrp_source_controller.py
+++ b/gr-blocks/examples/ctrlport/usrp_source_controller.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
+from __future__ import unicode_literals
import sys
import pmt
from gnuradio.ctrlport.GNURadioControlPortClient import GNURadioControlPortClient
diff --git a/gr-blocks/examples/tags/test_file_tags.py b/gr-blocks/examples/tags/test_file_tags.py
index cc11cf594..0837bcc2a 100755..100644
--- a/gr-blocks/examples/tags/test_file_tags.py
+++ b/gr-blocks/examples/tags/test_file_tags.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
+
from gnuradio import gr
from gnuradio import blocks
import sys
@@ -27,7 +30,7 @@ import sys
try:
import scipy
except ImportError:
- print "Error: Program requires scipy (see: www.scipy.org)."
+ print("Error: Program requires scipy (see: www.scipy.org).")
sys.exit(1)
def main():
@@ -52,5 +55,3 @@ def main():
if __name__ == "__main__":
main()
-
-
diff --git a/gr-blocks/grc/CMakeLists.txt b/gr-blocks/grc/CMakeLists.txt
index 2dd1481a4..3d0e5d81a 100644
--- a/gr-blocks/grc/CMakeLists.txt
+++ b/gr-blocks/grc/CMakeLists.txt
@@ -18,14 +18,14 @@
# Boston, MA 02110-1301, USA.
########################################################################
-file(GLOB xml_files "*.xml")
+file(GLOB yml_files "*.yml")
# Force out the controlport GRC blocks if we've disabled it.
if(NOT ENABLE_GR_CTRLPORT)
- list(REMOVE_ITEM xml_files
- ${CMAKE_CURRENT_SOURCE_DIR}/ctrlport_probe_c.xml
- ${CMAKE_CURRENT_SOURCE_DIR}/ctrlport_probe2_c.xml
+ list(REMOVE_ITEM yml_files
+ ${CMAKE_CURRENT_SOURCE_DIR}/ctrlport_probe_c.block.yml
+ ${CMAKE_CURRENT_SOURCE_DIR}/ctrlport_probe2_c.block.yml
)
endif(NOT ENABLE_GR_CTRLPORT)
-install(FILES ${xml_files} DESTINATION ${GRC_BLOCKS_DIR})
+install(FILES ${yml_files} DESTINATION ${GRC_BLOCKS_DIR})
diff --git a/gr-blocks/grc/blocks.tree.yml b/gr-blocks/grc/blocks.tree.yml
new file mode 100644
index 000000000..ebe509ddc
--- /dev/null
+++ b/gr-blocks/grc/blocks.tree.yml
@@ -0,0 +1,171 @@
+'[Core]':
+- Audio:
+ - blocks_wavfile_source
+ - blocks_wavfile_sink
+- Boolean Operators:
+ - blocks_and_xx
+ - blocks_and_const_xx
+ - blocks_not_xx
+ - blocks_or_xx
+ - blocks_xor_xx
+- Byte Operators:
+ - blocks_packed_to_unpacked_xx
+ - blocks_unpacked_to_packed_xx
+ - blocks_pack_k_bits_bb
+ - blocks_unpack_k_bits_bb
+ - blocks_repack_bits_bb
+- Control Port:
+ - blocks_ctrlport_monitor
+ - blocks_ctrlport_monitor_performance
+ - blocks_ctrlport_probe2_x
+ - blocks_ctrlport_probe2_c
+ - blocks_ctrlport_probe_c
+- Debug Tools:
+ - blocks_vector_sink_x
+ - blocks_tag_debug
+ - blocks_message_debug
+ - blocks_random_pdu
+ - blocks_message_strobe
+ - blocks_message_strobe_random
+ - blocks_tags_strobe
+ - blocks_test_tag_variable_rate_ff
+- File Operators:
+ - blocks_wavfile_source
+ - blocks_wavfile_sink
+ - blocks_file_source
+ - blocks_file_sink
+ - blocks_file_descriptor_source
+ - blocks_file_descriptor_sink
+ - blocks_file_meta_source
+ - blocks_file_meta_sink
+ - blocks_tagged_file_sink
+- Level Controllers:
+ - blocks_mute_xx
+ - blocks_sample_and_hold_xx
+ - blocks_moving_average_xx
+ - blocks_threshold_ff
+- Math Operators:
+ - blocks_abs_xx
+ - blocks_add_xx
+ - blocks_add_const_vxx
+ - blocks_divide_xx
+ - blocks_exponentiate_const_cci
+ - blocks_multiply_xx
+ - blocks_multiply_const_xx
+ - blocks_multiply_const_vxx
+ - blocks_multiply_conjugate_cc
+ - blocks_multiply_matrix_xx
+ - blocks_multiply_by_tag_value_cc
+ - blocks_sub_xx
+ - blocks_conjugate_cc
+ - blocks_integrate_xx
+ - blocks_nlog10_ff
+ - blocks_rms_xx
+ - blocks_rotator_cc
+ - blocks_transcendental
+ - blocks_argmax_xx
+ - blocks_max_xx
+ - blocks_min_xx
+- Measurement Tools:
+ - blocks_message_debug
+ - blocks_tag_debug
+ - blocks_probe_signal_x
+ - blocks_probe_signal_vx
+ - blocks_probe_rate
+ - blocks_ctrlport_probe2_c
+ - blocks_ctrlport_probe_c
+- Message Tools:
+ - blocks_message_strobe
+ - blocks_message_strobe_random
+ - blocks_message_debug
+ - blocks_pdu_filter
+ - blocks_pdu_remove
+ - blocks_pdu_set
+ - blocks_pdu_to_tagged_stream
+ - blocks_tagged_stream_multiply_length
+ - blocks_tagged_stream_to_pdu
+ - blocks_random_pdu
+- Misc:
+ - blocks_throttle
+ - blocks_vector_source_x
+ - blocks_head
+ - blocks_skiphead
+ - blocks_delay
+ - blocks_null_source
+ - blocks_null_sink
+ - blocks_copy
+ - blocks_nop
+ - xmlrpc_server
+ - xmlrpc_client
+- Modulators:
+ - blocks_vco_f
+ - blocks_vco_c
+- Networking Tools:
+ - blocks_tuntap_pdu
+ - blocks_socket_pdu
+ - blocks_tcp_server_sink
+ - blocks_udp_source
+ - blocks_udp_sink
+- Peak Detectors:
+ - blocks_burst_tagger
+ - blocks_peak_detector_xb
+ - blocks_peak_detector2_fb
+ - blocks_plateau_detector_fb
+- Stream Operators:
+ - blocks_deinterleave
+ - blocks_interleave
+ - blocks_keep_m_in_n
+ - blocks_keep_one_in_n
+ - blocks_stream_mux
+ - blocks_stream_to_streams
+ - blocks_stream_to_vector
+ - blocks_streams_to_stream
+ - blocks_streams_to_vector
+ - blocks_stream_to_vector_decimator
+ - blocks_vector_to_stream
+ - blocks_vector_to_streams
+ - blocks_patterned_interleaver
+ - blocks_endian_swap
+ - blocks_vector_insert_x
+ - blocks_tagged_stream_mux
+ - blocks_repeat
+ - blocks_regenerate_bb
+ - blocks_stretch_ff
+- Stream Tag Tools:
+ - blocks_tag_debug
+ - blocks_tag_gate
+ - blocks_tag_share
+ - blocks_tagged_file_sink
+ - blocks_tagged_stream_mux
+ - blocks_tagged_stream_align
+ - blocks_stream_to_tagged_stream
+ - blocks_test_tag_variable_rate_ff
+- Type Converters:
+ - blocks_char_to_float
+ - blocks_char_to_short
+ - blocks_complex_to_interleaved_char
+ - blocks_complex_to_interleaved_short
+ - blocks_complex_to_float
+ - blocks_complex_to_magphase
+ - blocks_complex_to_imag
+ - blocks_complex_to_real
+ - blocks_complex_to_mag
+ - blocks_complex_to_mag_squared
+ - blocks_complex_to_arg
+ - blocks_float_to_char
+ - blocks_float_to_complex
+ - blocks_magphase_to_complex
+ - blocks_float_to_int
+ - blocks_float_to_short
+ - blocks_float_to_uchar
+ - blocks_int_to_float
+ - blocks_interleaved_short_to_complex
+ - blocks_interleaved_char_to_complex
+ - blocks_short_to_char
+ - blocks_short_to_float
+ - blocks_uchar_to_float
+- Waveform Generators:
+ - blocks_vco_f
+ - blocks_vco_c
+- Variables:
+ - variable_tag_object
diff --git a/gr-blocks/grc/blocks_abs_xx.block.yml b/gr-blocks/grc/blocks_abs_xx.block.yml
new file mode 100644
index 000000000..12d9a8fc3
--- /dev/null
+++ b/gr-blocks/grc/blocks_abs_xx.block.yml
@@ -0,0 +1,32 @@
+id: blocks_abs_xx
+label: Abs
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [int, short, float]
+ option_attributes:
+ fcn: [ii, ss, ff]
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.abs_${type.fcn}(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_abs_xx.xml b/gr-blocks/grc/blocks_abs_xx.xml
deleted file mode 100644
index 77298716c..000000000
--- a/gr-blocks/grc/blocks_abs_xx.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Abs Block
-###################################################
- -->
-<block>
- <name>Abs</name>
- <key>blocks_abs_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.abs_$(type.fcn)($vlen)</make>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_add_const_vxx.block.yml b/gr-blocks/grc/blocks_add_const_vxx.block.yml
new file mode 100644
index 000000000..b95065cdb
--- /dev/null
+++ b/gr-blocks/grc/blocks_add_const_vxx.block.yml
@@ -0,0 +1,43 @@
+id: blocks_add_const_vxx
+label: Add Const
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short]
+ option_attributes:
+ const_type: [complex_vector, real_vector, int_vector, int_vector]
+ fcn: [cc, ff, ii, ss]
+ hide: part
+- id: const
+ label: Constant
+ dtype: ${ type.const_type }
+ default: '0'
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ len(const) == vlen }
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.add_const_v${type.fcn}(${const})
+ callbacks:
+ - set_k(${const})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_add_const_vxx.xml b/gr-blocks/grc/blocks_add_const_vxx.xml
deleted file mode 100644
index 96303acef..000000000
--- a/gr-blocks/grc/blocks_add_const_vxx.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Add Const Block:
-## all types, 1 output, 1 input & const
-###################################################
- -->
-<block>
- <name>Add Const</name>
- <key>blocks_add_const_vxx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.add_const_v$(type.fcn)($const)</make>
- <callback>set_k($const)</callback>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>const_type:complex_vector</opt>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>const_type:real_vector</opt>
- <opt>fcn:ff</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>const_type:int_vector</opt>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>const_type:int_vector</opt>
- <opt>fcn:ss</opt>
- </option>
- </param>
- <param>
- <name>Constant</name>
- <key>const</key>
- <value>0</value>
- <type>$type.const_type</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>len($const) == $vlen</check>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_add_xx.block.yml b/gr-blocks/grc/blocks_add_xx.block.yml
new file mode 100644
index 000000000..38df37a65
--- /dev/null
+++ b/gr-blocks/grc/blocks_add_xx.block.yml
@@ -0,0 +1,42 @@
+id: blocks_add_xx
+label: Add
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short]
+ option_attributes:
+ fcn: [cc, ff, ii, ss]
+ hide: part
+- id: num_inputs
+ label: Num Inputs
+ dtype: int
+ default: '2'
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_inputs }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ num_inputs > 1 }
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.add_v${type.fcn}(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_add_xx.xml b/gr-blocks/grc/blocks_add_xx.xml
deleted file mode 100644
index 951dff5e5..000000000
--- a/gr-blocks/grc/blocks_add_xx.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Add Block:
-## all types, 1 output, 2 to inf inputs
-###################################################
- -->
-<block>
- <name>Add</name>
- <key>blocks_add_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.add_v$(type.fcn)($vlen)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- </option>
- </param>
- <param>
- <name>Num Inputs</name>
- <key>num_inputs</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_inputs &gt; 1</check>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_inputs</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_and_const_xx.block.yml b/gr-blocks/grc/blocks_and_const_xx.block.yml
new file mode 100644
index 000000000..459527260
--- /dev/null
+++ b/gr-blocks/grc/blocks_and_const_xx.block.yml
@@ -0,0 +1,31 @@
+id: blocks_and_const_xx
+label: And Const
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [int, short, byte]
+ option_attributes:
+ fcn: [ii, ss, bb]
+ hide: part
+- id: const
+ label: Constant
+ dtype: int
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.and_const_${type.fcn}(${const})
+ callbacks:
+ - set_k(${const})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_and_const_xx.xml b/gr-blocks/grc/blocks_and_const_xx.xml
deleted file mode 100644
index d0abbfe51..000000000
--- a/gr-blocks/grc/blocks_and_const_xx.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## And Const Block:
-## all types, 1 output, 1 input & const
-###################################################
- -->
-<block>
- <name>And Const</name>
- <key>blocks_and_const_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.and_const_$(type.fcn)($const)</make>
- <callback>set_k($const)</callback>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:bb</opt>
- </option>
- </param>
- <param>
- <name>Constant</name>
- <key>const</key>
- <value>0</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_and_xx.block.yml b/gr-blocks/grc/blocks_and_xx.block.yml
new file mode 100644
index 000000000..a8bba020a
--- /dev/null
+++ b/gr-blocks/grc/blocks_and_xx.block.yml
@@ -0,0 +1,34 @@
+id: blocks_and_xx
+label: And
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [int, short, byte]
+ option_attributes:
+ fcn: [ii, ss, bb]
+ hide: part
+- id: num_inputs
+ label: Num Inputs
+ dtype: int
+ default: '2'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ multiplicity: ${ num_inputs }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+asserts:
+- ${ num_inputs >= 2 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.and_${type.fcn}()
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_and_xx.xml b/gr-blocks/grc/blocks_and_xx.xml
deleted file mode 100644
index 317a0f645..000000000
--- a/gr-blocks/grc/blocks_and_xx.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Logical And Block
-###################################################
- -->
-<block>
- <name>And</name>
- <key>blocks_and_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.and_$(type.fcn)()</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:bb</opt>
- </option>
- </param>
- <param>
- <name>Num Inputs</name>
- <key>num_inputs</key>
- <value>2</value>
- <type>int</type>
- </param>
- <check>$num_inputs &gt;= 2</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <nports>$num_inputs</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_argmax_xx.block.yml b/gr-blocks/grc/blocks_argmax_xx.block.yml
new file mode 100644
index 000000000..723f3fed6
--- /dev/null
+++ b/gr-blocks/grc/blocks_argmax_xx.block.yml
@@ -0,0 +1,45 @@
+id: blocks_argmax_xx
+label: Argmax
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [float, int, short]
+ option_attributes:
+ fcn: [fs, is, dd]
+ hide: part
+- id: num_inputs
+ label: Num Inputs
+ dtype: int
+ default: '2'
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_inputs }
+
+outputs:
+- label: max_vec
+ domain: stream
+ dtype: short
+- label: max_inp
+ domain: stream
+ dtype: short
+
+asserts:
+- ${ num_inputs >= 1 }
+- ${ vlen >= 1 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.argmax_${type.fcn}(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_argmax_xx.xml b/gr-blocks/grc/blocks_argmax_xx.xml
deleted file mode 100644
index 7adfa7597..000000000
--- a/gr-blocks/grc/blocks_argmax_xx.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##ArgMax:
-## 1 output, 2 to inf inputs
-###################################################
- -->
-<block>
- <name>Argmax</name>
- <key>blocks_argmax_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.argmax_$(type.fcn)($vlen)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:fs</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:is</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:dd</opt>
- </option>
- </param>
- <param>
- <name>Num Inputs</name>
- <key>num_inputs</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_inputs &gt;= 1</check>
- <check>$vlen &gt;= 1</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_inputs</nports>
- </sink>
- <source>
- <name>max_vec</name>
- <type>short</type>
- </source>
- <source>
- <name>max_inp</name>
- <type>short</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_block_tree.xml b/gr-blocks/grc/blocks_block_tree.xml
deleted file mode 100644
index ef2703f69..000000000
--- a/gr-blocks/grc/blocks_block_tree.xml
+++ /dev/null
@@ -1,239 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2012,2013 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##Block Tree for gr-blocks.
-###################################################
- -->
-<cat>
- <name>[Core]</name>
- <cat>
- <name>Audio</name>
- <block>blocks_wavfile_source</block>
- <block>blocks_wavfile_sink</block>
- </cat>
- <cat>
- <name>Boolean Operators</name>
- <block>blocks_and_xx</block>
- <block>blocks_and_const_xx</block>
- <block>blocks_not_xx</block>
- <block>blocks_or_xx</block>
- <block>blocks_xor_xx</block>
- </cat>
- <cat>
- <name>Byte Operators</name>
- <block>blocks_packed_to_unpacked_xx</block>
- <block>blocks_unpacked_to_packed_xx</block>
- <block>blocks_pack_k_bits_bb</block>
- <block>blocks_unpack_k_bits_bb</block>
- <block>blocks_repack_bits_bb</block>
- </cat>
- <cat>
- <name>Control Port</name>
- <block>blocks_ctrlport_monitor</block>
- <block>blocks_ctrlport_monitor_performance</block>
- <block>blocks_ctrlport_probe2_x</block>
- <block>blocks_ctrlport_probe2_c</block>
- <block>blocks_ctrlport_probe_c</block>
- </cat>
- <cat>
- <name>Debug Tools</name>
- <block>blocks_vector_sink_x</block>
- <block>blocks_tag_debug</block>
- <block>blocks_message_debug</block>
- <block>blocks_random_pdu</block>
- <block>blocks_message_strobe</block>
- <block>blocks_message_strobe_random</block>
- <block>blocks_tags_strobe</block>
- <block>blocks_test_tag_variable_rate_ff</block>
- </cat>
- <cat>
- <name>File Operators</name>
- <block>blocks_wavfile_source</block>
- <block>blocks_wavfile_sink</block>
- <block>blocks_file_source</block>
- <block>blocks_file_sink</block>
- <block>blocks_file_descriptor_source</block>
- <block>blocks_file_descriptor_sink</block>
- <block>blocks_file_meta_source</block>
- <block>blocks_file_meta_sink</block>
- <block>blocks_tagged_file_sink</block>
- </cat>
- <cat>
- <name>Level Controllers</name>
- <block>blocks_mute_xx</block>
- <block>blocks_sample_and_hold_xx</block>
- <block>blocks_moving_average_xx</block>
- <block>blocks_threshold_ff</block>
- </cat>
- <cat>
- <name>Math Operators</name>
- <block>blocks_abs_xx</block>
- <block>blocks_add_xx</block>
- <block>blocks_add_const_vxx</block>
- <block>blocks_divide_xx</block>
- <block>blocks_exponentiate_const_cci</block>
- <block>blocks_multiply_xx</block>
- <block>blocks_multiply_const_xx</block>
- <block>blocks_multiply_const_vxx</block>
- <block>blocks_multiply_conjugate_cc</block>
- <block>blocks_multiply_matrix_xx</block>
- <block>blocks_multiply_by_tag_value_cc</block>
- <block>blocks_sub_xx</block>
- <block>blocks_conjugate_cc</block>
- <block>blocks_integrate_xx</block>
- <block>blocks_nlog10_ff</block>
- <block>blocks_rms_xx</block>
- <block>blocks_rotator_cc</block>
- <block>blocks_transcendental</block>
- <block>blocks_argmax_xx</block>
- <block>blocks_max_xx</block>
- <block>blocks_min_xx</block>
- </cat>
- <cat>
- <name>Measurement Tools</name>
- <block>blocks_message_debug</block>
- <block>blocks_tag_debug</block>
- <block>blocks_probe_signal_x</block>
- <block>blocks_probe_signal_vx</block>
- <block>blocks_probe_rate</block>
- <block>blocks_ctrlport_probe2_c</block>
- <block>blocks_ctrlport_probe_c</block>
- </cat>
- <cat>
- <name>Message Tools</name>
- <block>blocks_message_strobe</block>
- <block>blocks_message_strobe_random</block>
- <block>blocks_message_debug</block>
- <block>blocks_pdu_filter</block>
- <block>blocks_pdu_remove</block>
- <block>blocks_pdu_set</block>
- <block>blocks_pdu_to_tagged_stream</block>
- <block>blocks_tagged_stream_multiply_length</block>
- <block>blocks_tagged_stream_to_pdu</block>
- <block>blocks_random_pdu</block>
- </cat>
- <cat>
- <name>Misc</name>
- <block>blocks_throttle</block>
- <block>blocks_vector_source_x</block>
- <block>blocks_head</block>
- <block>blocks_skiphead</block>
- <block>blocks_delay</block>
- <block>blocks_null_source</block>
- <block>blocks_null_sink</block>
- <block>blocks_copy</block>
- <block>blocks_nop</block>
- <block>xmlrpc_server</block>
- <block>xmlrpc_client</block>
- </cat>
- <cat>
- <name>Modulators</name>
- <block>blocks_vco_f</block>
- <block>blocks_vco_c</block>
- </cat>
- <cat>
- <name>Networking Tools</name>
- <block>blocks_tuntap_pdu</block>
- <block>blocks_socket_pdu</block>
- <block>blocks_tcp_server_sink</block>
- <block>blocks_udp_source</block>
- <block>blocks_udp_sink</block>
- </cat>
- <cat>
- <name>Peak Detectors</name>
- <block>blocks_burst_tagger</block>
- <block>blocks_peak_detector_xb</block>
- <block>blocks_peak_detector2_fb</block>
- <block>blocks_plateau_detector_fb</block>
- </cat>
- <cat>
- <name>Stream Operators</name>
- <block>blocks_deinterleave</block>
- <block>blocks_interleave</block>
- <block>blocks_keep_m_in_n</block>
- <block>blocks_keep_one_in_n</block>
- <block>blocks_stream_mux</block>
- <block>blocks_stream_to_streams</block>
- <block>blocks_stream_to_vector</block>
- <block>blocks_streams_to_stream</block>
- <block>blocks_streams_to_vector</block>
- <block>blocks_stream_to_vector_decimator</block>
- <block>blocks_vector_to_stream</block>
- <block>blocks_vector_to_streams</block>
- <block>blocks_patterned_interleaver</block>
- <block>blocks_endian_swap</block>
- <block>blocks_vector_insert_x</block>
- <block>blocks_tagged_stream_mux</block>
- <block>blocks_repeat</block>
- <block>blocks_regenerate_bb</block>
- <block>blocks_stretch_ff</block>
- </cat>
- <cat>
- <name>Stream Tag Tools</name>
- <block>blocks_tag_debug</block>
- <block>blocks_tag_gate</block>
- <block>blocks_tag_share</block>
- <block>blocks_tagged_file_sink</block>
- <block>blocks_tagged_stream_mux</block>
- <block>blocks_tagged_stream_align</block>
- <block>blocks_stream_to_tagged_stream</block>
- <block>blocks_test_tag_variable_rate_ff</block>
- </cat>
- <cat>
- <name>Type Converters</name>
- <block>blocks_char_to_float</block>
- <block>blocks_char_to_short</block>
- <block>blocks_complex_to_interleaved_char</block>
- <block>blocks_complex_to_interleaved_short</block>
- <block>blocks_complex_to_float</block>
- <block>blocks_complex_to_magphase</block>
- <block>blocks_complex_to_imag</block>
- <block>blocks_complex_to_real</block>
- <block>blocks_complex_to_mag</block>
- <block>blocks_complex_to_mag_squared</block>
- <block>blocks_complex_to_arg</block>
- <block>blocks_float_to_char</block>
- <block>blocks_float_to_complex</block>
- <block>blocks_magphase_to_complex</block>
- <block>blocks_float_to_int</block>
- <block>blocks_float_to_short</block>
- <block>blocks_float_to_uchar</block>
- <block>blocks_int_to_float</block>
- <block>blocks_interleaved_short_to_complex</block>
- <block>blocks_interleaved_char_to_complex</block>
- <block>blocks_short_to_char</block>
- <block>blocks_short_to_float</block>
- <block>blocks_uchar_to_float</block>
- </cat>
- <cat>
- <name>Waveform Generators</name>
- <block>blocks_vco_f</block>
- <block>blocks_vco_c</block>
- </cat>
- <cat>
- <name>Variables</name>
- <block>variable_tag_object</block>
- </cat>
-</cat>
diff --git a/gr-blocks/grc/blocks_burst_tagger.block.yml b/gr-blocks/grc/blocks_burst_tagger.block.yml
new file mode 100644
index 000000000..d2c4882e3
--- /dev/null
+++ b/gr-blocks/grc/blocks_burst_tagger.block.yml
@@ -0,0 +1,52 @@
+id: blocks_burst_tagger
+label: Burst Tagger
+
+parameters:
+- id: type
+ label: Stream Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: true_key
+ label: True KeyID
+ dtype: string
+ default: burst
+- id: true_value
+ label: True Value
+ dtype: bool
+ default: 'True'
+- id: false_key
+ label: False KeyID
+ dtype: string
+ default: burst
+- id: false_value
+ label: False Value
+ dtype: bool
+ default: 'False'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: 1
+- label: trigger
+ domain: stream
+ dtype: short
+ vlen: 1
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: 1
+
+templates:
+ imports: from gnuradio import blocks
+ make: "blocks.burst_tagger(${type.size})\nself.${id}.set_true_tag(${true_key},${true_value})\n\
+ self.${id}.set_false_tag(${false_key},${false_value})\n\t"
+ callbacks:
+ - set_true_tag(${true_key},${true_value})
+ - set_false_tag(${false_key},${false_value})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_burst_tagger.xml b/gr-blocks/grc/blocks_burst_tagger.xml
deleted file mode 100644
index f603b5348..000000000
--- a/gr-blocks/grc/blocks_burst_tagger.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Burst tagger:
-## all types, 1 output, 2 input: stream & trigger (short)
-###################################################
- -->
-<block>
- <name>Burst Tagger</name>
- <key>blocks_burst_tagger</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.burst_tagger($type.size)
-self.$(id).set_true_tag($true_key,$true_value)
-self.$(id).set_false_tag($false_key,$false_value)
- </make>
- <callback>set_true_tag($true_key,$true_value)</callback>
- <callback>set_false_tag($false_key,$false_value)</callback>
- <param>
- <name>Stream Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>True KeyID</name>
- <key>true_key</key>
- <value>burst</value>
- <type>string</type>
- </param>
- <param>
- <name>True Value</name>
- <key>true_value</key>
- <value>True</value>
- <type>bool</type>
- </param>
- <param>
- <name>False KeyID</name>
- <key>false_key</key>
- <value>burst</value>
- <type>string</type>
- </param>
- <param>
- <name>False Value</name>
- <key>false_value</key>
- <value>False</value>
- <type>bool</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>1</vlen>
- </sink>
- <sink>
- <name>trigger</name>
- <type>short</type>
- <vlen>1</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>1</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_char_to_float.block.yml b/gr-blocks/grc/blocks_char_to_float.block.yml
new file mode 100644
index 000000000..c0858b5c1
--- /dev/null
+++ b/gr-blocks/grc/blocks_char_to_float.block.yml
@@ -0,0 +1,31 @@
+id: blocks_char_to_float
+label: Char To Float
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: scale
+ label: Scale
+ dtype: real
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: float
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.char_to_float(${vlen}, ${scale})
+ callbacks:
+ - set_scale(${scale})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_char_to_float.xml b/gr-blocks/grc/blocks_char_to_float.xml
deleted file mode 100644
index 5d367d719..000000000
--- a/gr-blocks/grc/blocks_char_to_float.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Char to Float:
-###################################################
- -->
-<block>
- <name>Char To Float</name>
- <key>blocks_char_to_float</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.char_to_float($vlen, $scale)</make>
- <callback>set_scale($scale)</callback>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Scale</name>
- <key>scale</key>
- <value>1</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_char_to_short.block.yml b/gr-blocks/grc/blocks_char_to_short.block.yml
new file mode 100644
index 000000000..f378e87e7
--- /dev/null
+++ b/gr-blocks/grc/blocks_char_to_short.block.yml
@@ -0,0 +1,25 @@
+id: blocks_char_to_short
+label: Char To Short
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: short
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.char_to_short(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_char_to_short.xml b/gr-blocks/grc/blocks_char_to_short.xml
deleted file mode 100644
index b19fdb46a..000000000
--- a/gr-blocks/grc/blocks_char_to_short.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Char to Short:
-###################################################
- -->
-<block>
- <name>Char To Short</name>
- <key>blocks_char_to_short</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.char_to_short($vlen)</make>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>short</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_complex_to_arg.block.yml b/gr-blocks/grc/blocks_complex_to_arg.block.yml
new file mode 100644
index 000000000..4f44e4ae2
--- /dev/null
+++ b/gr-blocks/grc/blocks_complex_to_arg.block.yml
@@ -0,0 +1,28 @@
+id: blocks_complex_to_arg
+label: Complex to Arg
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: float
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.complex_to_arg(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_complex_to_arg.xml b/gr-blocks/grc/blocks_complex_to_arg.xml
deleted file mode 100644
index 83140501d..000000000
--- a/gr-blocks/grc/blocks_complex_to_arg.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Complex to Arg
-###################################################
- -->
-<block>
- <name>Complex to Arg</name>
- <key>blocks_complex_to_arg</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.complex_to_arg($vlen)</make>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>complex</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_complex_to_float.block.yml b/gr-blocks/grc/blocks_complex_to_float.block.yml
new file mode 100644
index 000000000..f7b35936c
--- /dev/null
+++ b/gr-blocks/grc/blocks_complex_to_float.block.yml
@@ -0,0 +1,34 @@
+id: blocks_complex_to_float
+label: Complex To Float
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ vlen }
+
+outputs:
+- label: re
+ domain: stream
+ dtype: float
+ vlen: ${ vlen }
+- label: im
+ domain: stream
+ dtype: float
+ vlen: ${ vlen }
+ optional: true
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.complex_to_float(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_complex_to_float.xml b/gr-blocks/grc/blocks_complex_to_float.xml
deleted file mode 100644
index 7acf3fccb..000000000
--- a/gr-blocks/grc/blocks_complex_to_float.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Complex to Float:
-## one or two output streams
-###################################################
- -->
-<block>
- <name>Complex To Float</name>
- <key>blocks_complex_to_float</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.complex_to_float($vlen)</make>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>complex</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>re</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </source>
- <source>
- <name>im</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_complex_to_imag.block.yml b/gr-blocks/grc/blocks_complex_to_imag.block.yml
new file mode 100644
index 000000000..29e14046a
--- /dev/null
+++ b/gr-blocks/grc/blocks_complex_to_imag.block.yml
@@ -0,0 +1,28 @@
+id: blocks_complex_to_imag
+label: Complex to Imag
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: float
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.complex_to_imag(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_complex_to_imag.xml b/gr-blocks/grc/blocks_complex_to_imag.xml
deleted file mode 100644
index cb2c2019f..000000000
--- a/gr-blocks/grc/blocks_complex_to_imag.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Complex to Imaginary
-###################################################
- -->
-<block>
- <name>Complex to Imag</name>
- <key>blocks_complex_to_imag</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.complex_to_imag($vlen)</make>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>complex</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_complex_to_interleaved_char.block.yml b/gr-blocks/grc/blocks_complex_to_interleaved_char.block.yml
new file mode 100644
index 000000000..06a75fc8d
--- /dev/null
+++ b/gr-blocks/grc/blocks_complex_to_interleaved_char.block.yml
@@ -0,0 +1,28 @@
+id: blocks_complex_to_interleaved_char
+label: Complex To IChar
+
+parameters:
+- id: vector_output
+ label: Vector Output
+ dtype: enum
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['No', 'Yes']
+ option_attributes:
+ vlen: ['1', '2']
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ vector_output.vlen }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.complex_to_interleaved_char(${vector_output})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_complex_to_interleaved_char.xml b/gr-blocks/grc/blocks_complex_to_interleaved_char.xml
deleted file mode 100644
index 5631f242c..000000000
--- a/gr-blocks/grc/blocks_complex_to_interleaved_char.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Complex to Interleaved Char:
-###################################################
- -->
-<block>
- <name>Complex To IChar</name>
- <key>blocks_complex_to_interleaved_char</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.complex_to_interleaved_char($vector_output)</make>
- <param>
- <name>Vector Output</name>
- <key>vector_output</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>No</name>
- <key>False</key>
- <opt>vlen:1</opt>
- </option>
- <option>
- <name>Yes</name>
- <key>True</key>
- <opt>vlen:2</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>$vector_output.vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_complex_to_interleaved_short.block.yml b/gr-blocks/grc/blocks_complex_to_interleaved_short.block.yml
new file mode 100644
index 000000000..0b8aa5362
--- /dev/null
+++ b/gr-blocks/grc/blocks_complex_to_interleaved_short.block.yml
@@ -0,0 +1,28 @@
+id: blocks_complex_to_interleaved_short
+label: Complex To IShort
+
+parameters:
+- id: vector_output
+ label: Vector Output
+ dtype: enum
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['No', 'Yes']
+ option_attributes:
+ vlen: ['1', '2']
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: short
+ vlen: ${ vector_output.vlen }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.complex_to_interleaved_short(${vector_output})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_complex_to_interleaved_short.xml b/gr-blocks/grc/blocks_complex_to_interleaved_short.xml
deleted file mode 100644
index 7f69d6b03..000000000
--- a/gr-blocks/grc/blocks_complex_to_interleaved_short.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Complex to Interleaved Short:
-###################################################
- -->
-<block>
- <name>Complex To IShort</name>
- <key>blocks_complex_to_interleaved_short</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.complex_to_interleaved_short($vector_output)</make>
- <param>
- <name>Vector Output</name>
- <key>vector_output</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>No</name>
- <key>False</key>
- <opt>vlen:1</opt>
- </option>
- <option>
- <name>Yes</name>
- <key>True</key>
- <opt>vlen:2</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>short</type>
- <vlen>$vector_output.vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_complex_to_mag.block.yml b/gr-blocks/grc/blocks_complex_to_mag.block.yml
new file mode 100644
index 000000000..d9582d172
--- /dev/null
+++ b/gr-blocks/grc/blocks_complex_to_mag.block.yml
@@ -0,0 +1,28 @@
+id: blocks_complex_to_mag
+label: Complex to Mag
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: float
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.complex_to_mag(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_complex_to_mag.xml b/gr-blocks/grc/blocks_complex_to_mag.xml
deleted file mode 100644
index 2aa4faee7..000000000
--- a/gr-blocks/grc/blocks_complex_to_mag.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Complex to Magnitude
-###################################################
- -->
-<block>
- <name>Complex to Mag</name>
- <key>blocks_complex_to_mag</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.complex_to_mag($vlen)</make>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>complex</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_complex_to_mag_squared.block.yml b/gr-blocks/grc/blocks_complex_to_mag_squared.block.yml
new file mode 100644
index 000000000..815636d65
--- /dev/null
+++ b/gr-blocks/grc/blocks_complex_to_mag_squared.block.yml
@@ -0,0 +1,28 @@
+id: blocks_complex_to_mag_squared
+label: Complex to Mag^2
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: float
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.complex_to_mag_squared(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_complex_to_mag_squared.xml b/gr-blocks/grc/blocks_complex_to_mag_squared.xml
deleted file mode 100644
index ee2270fec..000000000
--- a/gr-blocks/grc/blocks_complex_to_mag_squared.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Complex to Magnitude Squared
-###################################################
- -->
-<block>
- <name>Complex to Mag^2</name>
- <key>blocks_complex_to_mag_squared</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.complex_to_mag_squared($vlen)</make>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>complex</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_complex_to_magphase.block.yml b/gr-blocks/grc/blocks_complex_to_magphase.block.yml
new file mode 100644
index 000000000..80420ac2a
--- /dev/null
+++ b/gr-blocks/grc/blocks_complex_to_magphase.block.yml
@@ -0,0 +1,34 @@
+id: blocks_complex_to_magphase
+label: Complex To Mag Phase
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ vlen }
+
+outputs:
+- label: mag
+ domain: stream
+ dtype: float
+ vlen: ${ vlen }
+- label: phase
+ domain: stream
+ dtype: float
+ vlen: ${ vlen }
+ optional: true
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.complex_to_magphase(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_complex_to_magphase.xml b/gr-blocks/grc/blocks_complex_to_magphase.xml
deleted file mode 100644
index cad310b2f..000000000
--- a/gr-blocks/grc/blocks_complex_to_magphase.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Complex to Magnitude and Phase (floats):
-## two output streams
-###################################################
- -->
-<block>
- <name>Complex To Mag Phase</name>
- <key>blocks_complex_to_magphase</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.complex_to_magphase($vlen)</make>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>complex</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>mag</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </source>
- <source>
- <name>phase</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_complex_to_real.block.yml b/gr-blocks/grc/blocks_complex_to_real.block.yml
new file mode 100644
index 000000000..41fbbb33c
--- /dev/null
+++ b/gr-blocks/grc/blocks_complex_to_real.block.yml
@@ -0,0 +1,29 @@
+id: blocks_complex_to_real
+label: Complex To Real
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ vlen }
+
+outputs:
+- label: re
+ domain: stream
+ dtype: float
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.complex_to_real(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_complex_to_real.xml b/gr-blocks/grc/blocks_complex_to_real.xml
deleted file mode 100644
index 6737f1da3..000000000
--- a/gr-blocks/grc/blocks_complex_to_real.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Complex to Real:
-## one or two output streams
-###################################################
- -->
-<block>
- <name>Complex To Real</name>
- <key>blocks_complex_to_real</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.complex_to_real($vlen)</make>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>complex</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>re</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_conjugate_cc.block.yml b/gr-blocks/grc/blocks_conjugate_cc.block.yml
new file mode 100644
index 000000000..a0d8b1a64
--- /dev/null
+++ b/gr-blocks/grc/blocks_conjugate_cc.block.yml
@@ -0,0 +1,16 @@
+id: blocks_conjugate_cc
+label: Complex Conjugate
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.conjugate_cc()
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_conjugate_cc.xml b/gr-blocks/grc/blocks_conjugate_cc.xml
deleted file mode 100644
index 152f797b2..000000000
--- a/gr-blocks/grc/blocks_conjugate_cc.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Complex Conjugate
-###################################################
- -->
-<block>
- <name>Complex Conjugate</name>
- <key>blocks_conjugate_cc</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.conjugate_cc()</make>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_copy.block.yml b/gr-blocks/grc/blocks_copy.block.yml
new file mode 100644
index 000000000..0de4bcadf
--- /dev/null
+++ b/gr-blocks/grc/blocks_copy.block.yml
@@ -0,0 +1,57 @@
+id: blocks_copy
+label: Copy
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: enabled
+ label: Enabled
+ dtype: bool
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: [Enabled, Disabled]
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: showports
+ label: Show Msg Ports
+ dtype: enum
+ default: 'True'
+ options: ['False', 'True']
+ option_labels: ['Yes', 'No']
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+- domain: message
+ id: en
+ optional: true
+ hide: ${ showports }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: |-
+ blocks.copy(${type.size}*${vlen})
+ self.${id}.set_enabled(${enabled})
+ callbacks:
+ - set_enabled(${enabled})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_copy.xml b/gr-blocks/grc/blocks_copy.xml
deleted file mode 100644
index 6192937cd..000000000
--- a/gr-blocks/grc/blocks_copy.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Copy
-###################################################
- -->
-<block>
- <name>Copy</name>
- <key>blocks_copy</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.copy($type.size*$vlen)
-self.$(id).set_enabled($enabled)</make>
- <callback>set_enabled($enabled)</callback>
-
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
-
- <param>
- <name>Enabled</name>
- <key>enabled</key>
- <value>True</value>
- <type>bool</type>
- <option>
- <name>Enabled</name>
- <key>True</key>
- </option>
- <option>
- <name>Disabled</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Show Msg Ports</name>
- <key>showports</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>False</key>
- </option>
- <option>
- <name>No</name>
- <key>True</key>
- </option>
- </param>
-
- <check>$vlen &gt; 0</check>
-
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
-
- <sink>
- <name>en</name>
- <type>message</type>
- <optional>1</optional>
- <hide>$showports</hide>
- </sink>
-
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_ctrlport_performance.block.yml b/gr-blocks/grc/blocks_ctrlport_performance.block.yml
new file mode 100644
index 000000000..80f541a41
--- /dev/null
+++ b/gr-blocks/grc/blocks_ctrlport_performance.block.yml
@@ -0,0 +1,17 @@
+id: blocks_ctrlport_monitor_performance
+label: CtrlPort Performance Monitor
+
+parameters:
+- id: en
+ label: Enabled
+ dtype: enum
+ options: ['True', 'False']
+
+templates:
+ imports: from gnuradio.ctrlport.monitor import *
+ make: not ${en} or monitor("gr-perf-monitorx")
+
+documentation: |-
+ Place this in a graph to launch a QtPy GR CtrlPort Performance Monitor app.
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_ctrlport_performance.xml b/gr-blocks/grc/blocks_ctrlport_performance.xml
deleted file mode 100644
index ab17c9e26..000000000
--- a/gr-blocks/grc/blocks_ctrlport_performance.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2012 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<block>
- <name>CtrlPort Performance Monitor</name>
- <key>blocks_ctrlport_monitor_performance</key>
- <import>from gnuradio.ctrlport.monitor import *</import>
- <make>not $en or monitor("gr-perf-monitorx")</make>
- <param>
- <name>Enabled</name>
- <key>en</key>
- <value></value>
- <type>enum</type>
- <option>
- <name>True</name>
- <key>True</key>
- </option>
- <option>
- <name>False</name>
- <key>False</key>
- </option>
- </param>
-
- <doc>
- Place this in a graph to launch a QtPy GR CtrlPort Performance Monitor app.
- </doc>
-
-</block>
diff --git a/gr-blocks/grc/blocks_ctrlport_probe2_c.block.yml b/gr-blocks/grc/blocks_ctrlport_probe2_c.block.yml
new file mode 100644
index 000000000..2b757718a
--- /dev/null
+++ b/gr-blocks/grc/blocks_ctrlport_probe2_c.block.yml
@@ -0,0 +1,41 @@
+id: blocks_ctrlport_probe2_c
+label: Ctrlport Probe
+
+parameters:
+- id: name
+ label: Name
+ dtype: string
+ default: samples
+- id: desc
+ label: Description
+ dtype: string
+ default: Sample Points
+- id: len
+ label: Length
+ dtype: int
+ default: '1024'
+- id: disp_mask
+ label: Display Mask
+ dtype: int
+ default: gr.DISPTIME
+ options: [gr.DISPXY | gr.DISPOPTSCATTER, gr.DISPTIME, gr.DISPPSD, gr.DISPSPEC,
+ gr.DISPRAST]
+ option_labels: [Constellation, Time, PSD, Spectrogram, Raster]
+
+inputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.ctrlport_probe2_c(${name}, ${desc}, ${len}, ${disp_mask})
+ callbacks:
+ - set_length(${len})
+
+documentation: |-
+ Place this in a graph to export vectors of samples to a GRCP port probe.
+
+ * Specify the number of samples to transmit at once and the type
+ of default display to use.
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_ctrlport_probe2_c.xml b/gr-blocks/grc/blocks_ctrlport_probe2_c.xml
deleted file mode 100644
index 708a8fdf9..000000000
--- a/gr-blocks/grc/blocks_ctrlport_probe2_c.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2012-2013 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<block>
- <name>Ctrlport Probe</name>
- <key>blocks_ctrlport_probe2_c</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.ctrlport_probe2_c($name, $desc, $len, $disp_mask)</make>
- <callback>set_length($len)</callback>
-
- <param>
- <name>Name</name>
- <key>name</key>
- <value>samples</value>
- <type>string</type>
- </param>
-
- <param>
- <name>Description</name>
- <key>desc</key>
- <value>Sample Points</value>
- <type>string</type>
- </param>
-
- <param>
- <name>Length</name>
- <key>len</key>
- <value>1024</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Display Mask</name>
- <key>disp_mask</key>
- <value>gr.DISPTIME</value>
- <type>int</type>
- <option>
- <name>Constellation</name>
- <key>gr.DISPXY | gr.DISPOPTSCATTER</key>
- </option>
- <option>
- <name>Time</name>
- <key>gr.DISPTIME</key>
- </option>
- <option>
- <name>PSD</name>
- <key>gr.DISPPSD</key>
- </option>
- <option>
- <name>Spectrogram</name>
- <key>gr.DISPSPEC</key>
- </option>
- <option>
- <name>Raster</name>
- <key>gr.DISPRAST</key>
- </option>
- </param>
-
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
-
- <doc>
- Place this in a graph to export vectors of samples to a GRCP port probe.
-
- * Specify the number of samples to transmit at once and the type
- of default display to use.
- </doc>
-
-</block>
-
diff --git a/gr-blocks/grc/blocks_ctrlport_probe2_x.block.yml b/gr-blocks/grc/blocks_ctrlport_probe2_x.block.yml
new file mode 100644
index 000000000..f2b8e0a78
--- /dev/null
+++ b/gr-blocks/grc/blocks_ctrlport_probe2_x.block.yml
@@ -0,0 +1,48 @@
+id: blocks_ctrlport_probe2_x
+label: Ctrlport Probe
+
+parameters:
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ fcn: [c, f, i, s, b]
+ hide: part
+- id: name
+ label: Name
+ dtype: string
+ default: samples
+- id: desc
+ label: Description
+ dtype: string
+ default: Sample Points
+- id: len
+ label: Length
+ dtype: int
+ default: '1024'
+- id: disp_mask
+ label: Display Mask
+ dtype: int
+ default: gr.DISPTIME
+ options: [gr.DISPXY | gr.DISPOPTSCATTER, gr.DISPTIME, gr.DISPPSD, gr.DISPSPEC,
+ gr.DISPRAST]
+ option_labels: [Constellation, Time, PSD, Spectrogram, Raster]
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.ctrlport_probe2_${type.fcn}(${name}, ${desc}, ${len}, ${disp_mask})
+ callbacks:
+ - set_length(${len})
+
+documentation: |-
+ Place this in a graph to export vectors of samples to a GRCP port probe.
+
+ * Specify the number of samples to transmit at once and the type
+ of default display to use.
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_ctrlport_probe2_x.xml b/gr-blocks/grc/blocks_ctrlport_probe2_x.xml
deleted file mode 100644
index 47d1b81d3..000000000
--- a/gr-blocks/grc/blocks_ctrlport_probe2_x.xml
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2013 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<block>
- <name>Ctrlport Probe</name>
- <key>blocks_ctrlport_probe2_x</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.ctrlport_probe2_$(type.fcn)($name, $desc, $len, $disp_mask)</make>
- <callback>set_length($len)</callback>
-
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:b</opt>
- </option>
- </param>
-
- <param>
- <name>Name</name>
- <key>name</key>
- <value>samples</value>
- <type>string</type>
- </param>
-
- <param>
- <name>Description</name>
- <key>desc</key>
- <value>Sample Points</value>
- <type>string</type>
- </param>
-
- <param>
- <name>Length</name>
- <key>len</key>
- <value>1024</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Display Mask</name>
- <key>disp_mask</key>
- <value>gr.DISPTIME</value>
- <type>int</type>
- <option>
- <name>Constellation</name>
- <key>gr.DISPXY | gr.DISPOPTSCATTER</key>
- </option>
- <option>
- <name>Time</name>
- <key>gr.DISPTIME</key>
- </option>
- <option>
- <name>PSD</name>
- <key>gr.DISPPSD</key>
- </option>
- <option>
- <name>Spectrogram</name>
- <key>gr.DISPSPEC</key>
- </option>
- <option>
- <name>Raster</name>
- <key>gr.DISPRAST</key>
- </option>
- </param>
-
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
-
- <doc>
- Place this in a graph to export vectors of samples to a GRCP port probe.
-
- * Specify the number of samples to transmit at once and the type
- of default display to use.
- </doc>
-
-</block>
-
diff --git a/gr-blocks/grc/blocks_ctrlport_probe_c.block.yml b/gr-blocks/grc/blocks_ctrlport_probe_c.block.yml
new file mode 100644
index 000000000..6f59f3e69
--- /dev/null
+++ b/gr-blocks/grc/blocks_ctrlport_probe_c.block.yml
@@ -0,0 +1,25 @@
+id: blocks_ctrlport_probe_c
+label: Ctrlport Complex Probe
+
+parameters:
+- id: name
+ label: Name
+ dtype: string
+ default: constellation
+- id: desc
+ label: Description
+ dtype: string
+ default: Constellation Points
+
+inputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.ctrlport_probe_c(${name}, ${desc})
+
+documentation: |-
+ Place this in a graph to export complex values to a GRCP port probe.
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_ctrlport_probe_c.xml b/gr-blocks/grc/blocks_ctrlport_probe_c.xml
deleted file mode 100644
index 64174204f..000000000
--- a/gr-blocks/grc/blocks_ctrlport_probe_c.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2012 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<block>
- <name>Ctrlport Complex Probe</name>
- <key>blocks_ctrlport_probe_c</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.ctrlport_probe_c($name, $desc)</make>
-
- <param>
- <name>Name</name>
- <key>name</key>
- <value>constellation</value>
- <type>string</type>
- </param>
-
- <param>
- <name>Description</name>
- <key>desc</key>
- <value>Constellation Points</value>
- <type>string</type>
- </param>
-
-
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
-
- <doc>
- Place this in a graph to export complex values to a GRCP port probe.
- </doc>
-
-</block>
-
diff --git a/gr-blocks/grc/blocks_ctrlport_viewer.block.yml b/gr-blocks/grc/blocks_ctrlport_viewer.block.yml
new file mode 100644
index 000000000..dc718aa97
--- /dev/null
+++ b/gr-blocks/grc/blocks_ctrlport_viewer.block.yml
@@ -0,0 +1,17 @@
+id: blocks_ctrlport_monitor
+label: CtrlPort Monitor
+
+parameters:
+- id: en
+ label: Enabled
+ dtype: enum
+ options: ['True', 'False']
+
+templates:
+ imports: from gnuradio.ctrlport.monitor import *
+ make: not ${en} or monitor()
+
+documentation: |-
+ Place this in a graph to launch a QtPy GR CtrlPort Monitor app.
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_ctrlport_viewer.xml b/gr-blocks/grc/blocks_ctrlport_viewer.xml
deleted file mode 100644
index 1d5a2e593..000000000
--- a/gr-blocks/grc/blocks_ctrlport_viewer.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2012 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<block>
- <name>CtrlPort Monitor</name>
- <key>blocks_ctrlport_monitor</key>
- <import>from gnuradio.ctrlport.monitor import *</import>
- <make>not $en or monitor()</make>
- <param>
- <name>Enabled</name>
- <key>en</key>
- <value></value>
- <type>enum</type>
- <option>
- <name>True</name>
- <key>True</key>
- </option>
- <option>
- <name>False</name>
- <key>False</key>
- </option>
- </param>
-
- <doc>
- Place this in a graph to launch a QtPy GR CtrlPort Monitor app.
- </doc>
-
-</block>
diff --git a/gr-blocks/grc/blocks_deinterleave.block.yml b/gr-blocks/grc/blocks_deinterleave.block.yml
new file mode 100644
index 000000000..98761c4cc
--- /dev/null
+++ b/gr-blocks/grc/blocks_deinterleave.block.yml
@@ -0,0 +1,48 @@
+id: blocks_deinterleave
+label: Deinterleave
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: num_streams
+ label: Num Streams
+ dtype: int
+ default: '2'
+ hide: part
+- id: blocksize
+ label: Block Size
+ dtype: int
+ default: '1'
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_streams }
+
+asserts:
+- ${ num_streams > 0 }
+- ${ vlen >= 1 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.deinterleave(${type.size}*${vlen}, ${blocksize})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_deinterleave.xml b/gr-blocks/grc/blocks_deinterleave.xml
deleted file mode 100644
index 4ada49dc3..000000000
--- a/gr-blocks/grc/blocks_deinterleave.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Deinterleave
-###################################################
- -->
-<block>
- <name>Deinterleave</name>
- <key>blocks_deinterleave</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.deinterleave($type.size*$vlen, $blocksize)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Num Streams</name>
- <key>num_streams</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Block Size</name>
- <key>blocksize</key>
- <value>1</value>
- <type>int</type>
- <hide>part</hide>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_streams &gt; 0</check>
- <check>$vlen &gt;= 1</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_streams</nports>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_delay.block.yml b/gr-blocks/grc/blocks_delay.block.yml
new file mode 100644
index 000000000..b9d63df58
--- /dev/null
+++ b/gr-blocks/grc/blocks_delay.block.yml
@@ -0,0 +1,50 @@
+id: blocks_delay
+label: Delay
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: delay
+ label: Delay
+ dtype: int
+ default: '0'
+- id: num_ports
+ label: Num Ports
+ dtype: int
+ default: '1'
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_ports }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_ports }
+
+asserts:
+- ${ num_ports > 0 }
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.delay(${type.size}*${vlen}, ${delay})
+ callbacks:
+ - set_dly(${delay})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_delay.xml b/gr-blocks/grc/blocks_delay.xml
deleted file mode 100644
index a7c48c4dc..000000000
--- a/gr-blocks/grc/blocks_delay.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Delay
-###################################################
- -->
-<block>
- <name>Delay</name>
- <key>blocks_delay</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.delay($type.size*$vlen, $delay)</make>
- <callback>set_dly($delay)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Delay</name>
- <key>delay</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Num Ports</name>
- <key>num_ports</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_ports &gt; 0</check>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_ports</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_ports</nports>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_divide_XX.block.yml b/gr-blocks/grc/blocks_divide_XX.block.yml
new file mode 100644
index 000000000..a98dfde5c
--- /dev/null
+++ b/gr-blocks/grc/blocks_divide_XX.block.yml
@@ -0,0 +1,42 @@
+id: blocks_divide_xx
+label: Divide
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short]
+ option_attributes:
+ fcn: [cc, ff, ii, ss]
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: num_inputs
+ label: Num Inputs
+ dtype: int
+ default: '2'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_inputs }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+- ${ num_inputs >= 2 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.divide_${type.fcn}(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_divide_XX.xml b/gr-blocks/grc/blocks_divide_XX.xml
deleted file mode 100644
index d784d305d..000000000
--- a/gr-blocks/grc/blocks_divide_XX.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Divide Block:
-## all types, 1 output, 2 to inf inputs
-###################################################
- -->
-<block>
- <name>Divide</name>
- <key>blocks_divide_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.divide_$(type.fcn)($vlen)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- </option>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Num Inputs</name>
- <key>num_inputs</key>
- <value>2</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <check>$num_inputs &gt;= 2</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_inputs</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_endian_swap.block.yml b/gr-blocks/grc/blocks_endian_swap.block.yml
new file mode 100644
index 000000000..da2ef0c37
--- /dev/null
+++ b/gr-blocks/grc/blocks_endian_swap.block.yml
@@ -0,0 +1,26 @@
+id: blocks_endian_swap
+label: Endian Swap
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, s32, s16]
+ option_labels: [Complex, Int, Short]
+ option_attributes:
+ size: ['8', '4', '2']
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.endian_swap(${type.size})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_endian_swap.xml b/gr-blocks/grc/blocks_endian_swap.xml
deleted file mode 100644
index 5fea42066..000000000
--- a/gr-blocks/grc/blocks_endian_swap.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Add Block:
-## all types, 1 output, 2 to inf inputs
-###################################################
- -->
-<block>
- <name>Endian Swap</name>
- <key>blocks_endian_swap</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.endian_swap($type.size)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:8</opt>
- </option>
- <option>
- <name>Int</name>
- <key>s32</key>
- <opt>size:4</opt>
- </option>
- <option>
- <name>Short</name>
- <key>s16</key>
- <opt>size:2</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_exponentiate_const_cci.block.yml b/gr-blocks/grc/blocks_exponentiate_const_cci.block.yml
new file mode 100644
index 000000000..10bef0d3c
--- /dev/null
+++ b/gr-blocks/grc/blocks_exponentiate_const_cci.block.yml
@@ -0,0 +1,43 @@
+id: blocks_exponentiate_const_cci
+label: Exponentiate Const Int
+
+parameters:
+- id: num_ports
+ label: Num Ports
+ dtype: int
+ default: '1'
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: exponent
+ label: Exponent
+ dtype: int
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ vlen }
+ multiplicity: ${ num_ports }
+
+outputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ vlen }
+ multiplicity: ${ num_ports }
+
+asserts:
+- ${ num_ports > 0 }
+- ${ vlen > 0 }
+- ${ exponent > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.exponentiate_const_cci(${exponent}, ${vlen})
+ callbacks:
+ - set_exponent(${exponent})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_exponentiate_const_cci.xml b/gr-blocks/grc/blocks_exponentiate_const_cci.xml
deleted file mode 100644
index 3c9e9b962..000000000
--- a/gr-blocks/grc/blocks_exponentiate_const_cci.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>Exponentiate Const Int</name>
- <key>blocks_exponentiate_const_cci</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.exponentiate_const_cci($exponent, $vlen)</make>
- <callback>set_exponent($exponent)</callback>
-
- <param>
- <name>Num Ports</name>
- <key>num_ports</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Exponent</name>
- <key>exponent</key>
- <value>1</value>
- <type>int</type>
- </param>
-
- <check>$num_ports &gt; 0</check>
- <check>$vlen &gt; 0</check>
- <check>$exponent &gt; 0</check>
-
- <sink>
- <name>in</name>
- <type>complex</type>
- <vlen>$vlen</vlen>
- <nports>$num_ports</nports>
- </sink>
-
- <source>
- <name>out</name>
- <type>complex</type>
- <vlen>$vlen</vlen>
- <nports>$num_ports</nports>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_file_descriptor_sink.block.yml b/gr-blocks/grc/blocks_file_descriptor_sink.block.yml
new file mode 100644
index 000000000..24d88f67f
--- /dev/null
+++ b/gr-blocks/grc/blocks_file_descriptor_sink.block.yml
@@ -0,0 +1,34 @@
+id: blocks_file_descriptor_sink
+label: File Descriptor Sink
+
+parameters:
+- id: fd
+ label: File Descriptor
+ dtype: int
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.file_descriptor_sink(${type.size}*${vlen}, ${fd})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_file_descriptor_sink.xml b/gr-blocks/grc/blocks_file_descriptor_sink.xml
deleted file mode 100644
index 211d86dfd..000000000
--- a/gr-blocks/grc/blocks_file_descriptor_sink.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##File Sink
-###################################################
- -->
-<block>
- <name>File Descriptor Sink</name>
- <key>blocks_file_descriptor_sink</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.file_descriptor_sink($type.size*$vlen, $fd)</make>
- <param>
- <name>File Descriptor</name>
- <key>fd</key>
- <type>int</type>
- </param>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
-</block>
diff --git a/gr-blocks/grc/blocks_file_descriptor_source.block.yml b/gr-blocks/grc/blocks_file_descriptor_source.block.yml
new file mode 100644
index 000000000..84926661e
--- /dev/null
+++ b/gr-blocks/grc/blocks_file_descriptor_source.block.yml
@@ -0,0 +1,37 @@
+id: blocks_file_descriptor_source
+label: File Descriptor Source
+
+parameters:
+- id: fd
+ label: File Descriptor
+ dtype: int
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: repeat
+ label: Repeat
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.file_descriptor_source(${type.size}*${vlen}, ${fd}, ${repeat})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_file_descriptor_source.xml b/gr-blocks/grc/blocks_file_descriptor_source.xml
deleted file mode 100644
index b29335c3a..000000000
--- a/gr-blocks/grc/blocks_file_descriptor_source.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##File Source
-###################################################
- -->
-<block>
- <name>File Descriptor Source</name>
- <key>blocks_file_descriptor_source</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.file_descriptor_source($type.size*$vlen, $fd, $repeat)</make>
- <param>
- <name>File Descriptor</name>
- <key>fd</key>
- <type>int</type>
- </param>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Repeat</name>
- <key>repeat</key>
- <value>True</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_file_meta_sink.block.yml b/gr-blocks/grc/blocks_file_meta_sink.block.yml
new file mode 100644
index 000000000..7512f23aa
--- /dev/null
+++ b/gr-blocks/grc/blocks_file_meta_sink.block.yml
@@ -0,0 +1,70 @@
+id: blocks_file_meta_sink
+label: File Meta Sink
+
+parameters:
+- id: file
+ label: File
+ dtype: file_save
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ cplx: ['True', 'False', 'False', 'False', 'False']
+ dtype: [blocks.GR_FILE_FLOAT, blocks.GR_FILE_FLOAT, blocks.GR_FILE_INT, blocks.GR_FILE_SHORT,
+ blocks.GR_FILE_BYTE]
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: samp_rate
+ label: Sample Rate
+ dtype: real
+ default: samp_rate
+- id: rel_rate
+ label: Relative Rate Change
+ dtype: real
+ default: '1'
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: max_seg_size
+ label: Max Seg. Size
+ dtype: int
+ default: '1000000'
+- id: extra_dict
+ label: Extra Dict.
+ dtype: string
+ default: '""'
+- id: detached
+ label: Detached
+ dtype: bool
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['Off', 'On']
+- id: unbuffered
+ label: Unbuffered
+ dtype: bool
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['Off', 'On']
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import gr, blocks
+ make: |-
+ blocks.file_meta_sink(${type.size}*${vlen}, ${file}, ${samp_rate}, ${rel_rate}, ${type.dtype}, ${type.cplx}, ${max_seg_size}, ${extra_dict}, ${detached})
+ self.${id}.set_unbuffered(${unbuffered})
+ callbacks:
+ - set_unbuffered(${unbuffered})
+ - open(${file})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_file_meta_sink.xml b/gr-blocks/grc/blocks_file_meta_sink.xml
deleted file mode 100644
index f6490d507..000000000
--- a/gr-blocks/grc/blocks_file_meta_sink.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##File Meta Sink
-###################################################
- -->
-<block>
- <name>File Meta Sink</name>
- <key>blocks_file_meta_sink</key>
- <import>from gnuradio import gr, blocks</import>
- <make>blocks.file_meta_sink($type.size*$vlen, $file, $samp_rate, $rel_rate, $type.dtype, $type.cplx, $max_seg_size, $extra_dict, $detached)
-self.$(id).set_unbuffered($unbuffered)</make>
- <callback>set_unbuffered($unbuffered)</callback>
- <callback>open($file)</callback>
- <param>
- <name>File</name>
- <key>file</key>
- <value></value>
- <type>file_save</type>
- </param>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- <opt>dtype:blocks.GR_FILE_FLOAT</opt>
- <opt>cplx:True</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- <opt>dtype:blocks.GR_FILE_FLOAT</opt>
- <opt>cplx:False</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- <opt>dtype:blocks.GR_FILE_INT</opt>
- <opt>cplx:False</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- <opt>dtype:blocks.GR_FILE_SHORT</opt>
- <opt>cplx:False</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- <opt>dtype:blocks.GR_FILE_BYTE</opt>
- <opt>cplx:False</opt>
- </option>
- </param>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>Relative Rate Change</name>
- <key>rel_rate</key>
- <value>1</value>
- <type>real</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Max Seg. Size</name>
- <key>max_seg_size</key>
- <value>1000000</value>
- <type>int</type>
- </param>
- <param>
- <name>Extra Dict.</name>
- <key>extra_dict</key>
- <value>""</value>
- <type>string</type>
- </param>
- <param>
- <name>Detached</name>
- <key>detached</key>
- <value>False</value>
- <type>bool</type>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- </param> <param>
- <name>Unbuffered</name>
- <key>unbuffered</key>
- <value>False</value>
- <type>bool</type>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
-</block>
diff --git a/gr-blocks/grc/blocks_file_meta_source.block.yml b/gr-blocks/grc/blocks_file_meta_source.block.yml
new file mode 100644
index 000000000..016c2f62a
--- /dev/null
+++ b/gr-blocks/grc/blocks_file_meta_source.block.yml
@@ -0,0 +1,48 @@
+id: blocks_file_meta_source
+label: File Meta Source
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: file
+ label: File
+ dtype: file_open
+- id: repeat
+ label: Repeat
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: detached
+ label: Detached Header
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: hdr_file
+ label: Header File
+ dtype: file_open
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import gr, blocks
+ make: blocks.file_meta_source(${file}, ${repeat}, ${detached}, ${hdr_file})
+ callbacks:
+ - open(${file}, ${repeat})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_file_meta_source.xml b/gr-blocks/grc/blocks_file_meta_source.xml
deleted file mode 100644
index aa7e34955..000000000
--- a/gr-blocks/grc/blocks_file_meta_source.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##File Source
-###################################################
- -->
-<block>
- <name>File Meta Source</name>
- <key>blocks_file_meta_source</key>
- <import>from gnuradio import gr, blocks</import>
- <make>blocks.file_meta_source($file, $repeat, $detached, $hdr_file)</make>
- <callback>open($file, $repeat)</callback>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>File</name>
- <key>file</key>
- <value></value>
- <type>file_open</type>
- </param>
- <param>
- <name>Repeat</name>
- <key>repeat</key>
- <value>True</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Detached Header</name>
- <key>detached</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Header File</name>
- <key>hdr_file</key>
- <value></value>
- <type>file_open</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_file_sink.block.yml b/gr-blocks/grc/blocks_file_sink.block.yml
new file mode 100644
index 000000000..cf9782340
--- /dev/null
+++ b/gr-blocks/grc/blocks_file_sink.block.yml
@@ -0,0 +1,51 @@
+id: blocks_file_sink
+label: File Sink
+
+parameters:
+- id: file
+ label: File
+ dtype: file_save
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: unbuffered
+ label: Unbuffered
+ dtype: bool
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['Off', 'On']
+- id: append
+ label: Append file
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: [Append, Overwrite]
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: |-
+ blocks.file_sink(${type.size}*${vlen}, ${file}, ${append})
+ self.${id}.set_unbuffered(${unbuffered})
+ callbacks:
+ - set_unbuffered(${unbuffered})
+ - open(${file})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_file_sink.xml b/gr-blocks/grc/blocks_file_sink.xml
deleted file mode 100644
index ece21fd2a..000000000
--- a/gr-blocks/grc/blocks_file_sink.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##File Sink
-###################################################
- -->
-<block>
- <name>File Sink</name>
- <key>blocks_file_sink</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.file_sink($type.size*$vlen, $file, $append)
-self.$(id).set_unbuffered($unbuffered)</make>
- <callback>set_unbuffered($unbuffered)</callback>
- <callback>open($file)</callback>
- <param>
- <name>File</name>
- <key>file</key>
- <value></value>
- <type>file_save</type>
- </param>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Unbuffered</name>
- <key>unbuffered</key>
- <value>False</value>
- <type>bool</type>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- </param>
- <param>
- <name>Append file</name>
- <key>append</key>
- <value>False</value>
- <type>bool</type>
- <option>
- <name>Append</name>
- <key>True</key>
- </option>
- <option>
- <name>Overwrite</name>
- <key>False</key>
- </option>
- </param>
-
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
-</block>
diff --git a/gr-blocks/grc/blocks_file_source.block.yml b/gr-blocks/grc/blocks_file_source.block.yml
new file mode 100644
index 000000000..4aed206fb
--- /dev/null
+++ b/gr-blocks/grc/blocks_file_source.block.yml
@@ -0,0 +1,59 @@
+id: blocks_file_source
+label: File Source
+
+parameters:
+- id: file
+ label: File
+ dtype: file_open
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: repeat
+ label: Repeat
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: begin_tag
+ label: Add begin tag
+ dtype: raw
+ default: pmt.PMT_NIL
+- id: offset
+ label: Offset
+ dtype: int
+ default: '0'
+- id: length
+ label: Length
+ dtype: int
+ default: '0'
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: |-
+ from gnuradio import blocks
+ import pmt
+ make: |-
+ blocks.file_source(${type.size}*${vlen}, ${file}, ${repeat}, ${offset}, ${length})
+ self.${id}.set_begin_tag(${begin_tag})
+ callbacks:
+ - open(${file}, ${repeat})
+ - self.${id}.set_begin_tag(${begin_tag})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_file_source.xml b/gr-blocks/grc/blocks_file_source.xml
deleted file mode 100644
index e8ebd9870..000000000
--- a/gr-blocks/grc/blocks_file_source.xml
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##File Source
-###################################################
- -->
-<block>
- <name>File Source</name>
- <key>blocks_file_source</key>
- <import>from gnuradio import blocks</import>
- <import>import pmt</import>
- <make>blocks.file_source($type.size*$vlen, $file, $repeat, $offset, $length)
-self.$(id).set_begin_tag($begin_tag)</make>
- <callback>open($file, $repeat)</callback>
- <callback>self.$(id).set_begin_tag($begin_tag)</callback>
- <param>
- <name>File</name>
- <key>file</key>
- <value></value>
- <type>file_open</type>
- </param>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Repeat</name>
- <key>repeat</key>
- <value>True</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Add begin tag</name>
- <key>begin_tag</key>
- <value>pmt.PMT_NIL</value>
- <type>raw</type>
- </param>
- <param>
- <name>Offset</name>
- <key>offset</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Length</name>
- <key>length</key>
- <value>0</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_float_to_char.block.yml b/gr-blocks/grc/blocks_float_to_char.block.yml
new file mode 100644
index 000000000..4f6eeb728
--- /dev/null
+++ b/gr-blocks/grc/blocks_float_to_char.block.yml
@@ -0,0 +1,31 @@
+id: blocks_float_to_char
+label: Float To Char
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: scale
+ label: Scale
+ dtype: real
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: float
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.float_to_char(${vlen}, ${scale})
+ callbacks:
+ - set_scale(${scale})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_float_to_char.xml b/gr-blocks/grc/blocks_float_to_char.xml
deleted file mode 100644
index e3854fc4e..000000000
--- a/gr-blocks/grc/blocks_float_to_char.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Float to Char:
-###################################################
- -->
-<block>
- <name>Float To Char</name>
- <key>blocks_float_to_char</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.float_to_char($vlen, $scale)</make>
- <callback>set_scale($scale)</callback>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Scale</name>
- <key>scale</key>
- <value>1</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_float_to_complex.block.yml b/gr-blocks/grc/blocks_float_to_complex.block.yml
new file mode 100644
index 000000000..d592c4e46
--- /dev/null
+++ b/gr-blocks/grc/blocks_float_to_complex.block.yml
@@ -0,0 +1,34 @@
+id: blocks_float_to_complex
+label: Float To Complex
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- label: re
+ domain: stream
+ dtype: float
+ vlen: ${ vlen }
+- label: im
+ domain: stream
+ dtype: float
+ vlen: ${ vlen }
+ optional: true
+
+outputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.float_to_complex(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_float_to_complex.xml b/gr-blocks/grc/blocks_float_to_complex.xml
deleted file mode 100644
index 6120d5887..000000000
--- a/gr-blocks/grc/blocks_float_to_complex.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Float to Complex:
-## one or two input streams
-###################################################
- -->
-<block>
- <name>Float To Complex</name>
- <key>blocks_float_to_complex</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.float_to_complex($vlen)</make>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>re</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </sink>
- <sink>
- <name>im</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- <optional>1</optional>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_float_to_int.block.yml b/gr-blocks/grc/blocks_float_to_int.block.yml
new file mode 100644
index 000000000..4ed0e0871
--- /dev/null
+++ b/gr-blocks/grc/blocks_float_to_int.block.yml
@@ -0,0 +1,31 @@
+id: blocks_float_to_int
+label: Float To Int
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: scale
+ label: Scale
+ dtype: real
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: float
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: int
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.float_to_int(${vlen}, ${scale})
+ callbacks:
+ - set_scale(${scale})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_float_to_int.xml b/gr-blocks/grc/blocks_float_to_int.xml
deleted file mode 100644
index 0ff5d9cdf..000000000
--- a/gr-blocks/grc/blocks_float_to_int.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Float to Int:
-###################################################
- -->
-<block>
- <name>Float To Int</name>
- <key>blocks_float_to_int</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.float_to_int($vlen, $scale)</make>
- <callback>set_scale($scale)</callback>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Scale</name>
- <key>scale</key>
- <value>1</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>int</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_float_to_short.block.yml b/gr-blocks/grc/blocks_float_to_short.block.yml
new file mode 100644
index 000000000..8b1c4e58b
--- /dev/null
+++ b/gr-blocks/grc/blocks_float_to_short.block.yml
@@ -0,0 +1,31 @@
+id: blocks_float_to_short
+label: Float To Short
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: scale
+ label: Scale
+ dtype: real
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: float
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: short
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.float_to_short(${vlen}, ${scale})
+ callbacks:
+ - set_scale(${scale})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_float_to_short.xml b/gr-blocks/grc/blocks_float_to_short.xml
deleted file mode 100644
index 986e68ec4..000000000
--- a/gr-blocks/grc/blocks_float_to_short.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Float to Short:
-###################################################
- -->
-<block>
- <name>Float To Short</name>
- <key>blocks_float_to_short</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.float_to_short($vlen, $scale)</make>
- <callback>set_scale($scale)</callback>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Scale</name>
- <key>scale</key>
- <value>1</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>short</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_float_uchar.block.yml b/gr-blocks/grc/blocks_float_uchar.block.yml
new file mode 100644
index 000000000..33687978c
--- /dev/null
+++ b/gr-blocks/grc/blocks_float_uchar.block.yml
@@ -0,0 +1,16 @@
+id: blocks_float_to_uchar
+label: Float To UChar
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.float_to_uchar()
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_float_uchar.xml b/gr-blocks/grc/blocks_float_uchar.xml
deleted file mode 100644
index d190eafcf..000000000
--- a/gr-blocks/grc/blocks_float_uchar.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Float to Unsigned Char:
-###################################################
- -->
-<block>
- <name>Float To UChar</name>
- <key>blocks_float_to_uchar</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.float_to_uchar()</make>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_head.block.yml b/gr-blocks/grc/blocks_head.block.yml
new file mode 100644
index 000000000..c342e4006
--- /dev/null
+++ b/gr-blocks/grc/blocks_head.block.yml
@@ -0,0 +1,42 @@
+id: blocks_head
+label: Head
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: num_items
+ label: Num Items
+ dtype: int
+ default: '1024'
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.head(${type.size}*${vlen}, ${num_items})
+ callbacks:
+ - set_length(${num_items})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_head.xml b/gr-blocks/grc/blocks_head.xml
deleted file mode 100644
index dc8e826d5..000000000
--- a/gr-blocks/grc/blocks_head.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Head
-###################################################
- -->
-<block>
- <name>Head</name>
- <key>blocks_head</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.head($type.size*$vlen, $num_items)</make>
- <callback>set_length($num_items)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Num Items</name>
- <key>num_items</key>
- <value>1024</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_int_to_float.block.yml b/gr-blocks/grc/blocks_int_to_float.block.yml
new file mode 100644
index 000000000..a6f3b3b92
--- /dev/null
+++ b/gr-blocks/grc/blocks_int_to_float.block.yml
@@ -0,0 +1,31 @@
+id: blocks_int_to_float
+label: Int To Float
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: scale
+ label: Scale
+ dtype: real
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: int
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: float
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.int_to_float(${vlen}, ${scale})
+ callbacks:
+ - set_scale(${scale})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_int_to_float.xml b/gr-blocks/grc/blocks_int_to_float.xml
deleted file mode 100644
index 2bb25d8be..000000000
--- a/gr-blocks/grc/blocks_int_to_float.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Int to Float:
-###################################################
- -->
-<block>
- <name>Int To Float</name>
- <key>blocks_int_to_float</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.int_to_float($vlen, $scale)</make>
- <callback>set_scale($scale)</callback>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Scale</name>
- <key>scale</key>
- <value>1</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>int</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_integrate_xx.block.yml b/gr-blocks/grc/blocks_integrate_xx.block.yml
new file mode 100644
index 000000000..e8d3dd08c
--- /dev/null
+++ b/gr-blocks/grc/blocks_integrate_xx.block.yml
@@ -0,0 +1,35 @@
+id: blocks_integrate_xx
+label: Integrate
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short]
+ option_attributes:
+ fcn: [cc, ff, ii, ss]
+ hide: part
+- id: decim
+ label: Decimation
+ dtype: int
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.integrate_${type.fcn}(${decim}, ${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_integrate_xx.xml b/gr-blocks/grc/blocks_integrate_xx.xml
deleted file mode 100644
index 8f47b9499..000000000
--- a/gr-blocks/grc/blocks_integrate_xx.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Integrate
-###################################################
- -->
-<block>
- <name>Integrate</name>
- <key>blocks_integrate_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.integrate_$(type.fcn)($decim, $vlen)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- </option>
- </param>
- <param>
- <name>Decimation</name>
- <key>decim</key>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_interleave.block.yml b/gr-blocks/grc/blocks_interleave.block.yml
new file mode 100644
index 000000000..e814e675b
--- /dev/null
+++ b/gr-blocks/grc/blocks_interleave.block.yml
@@ -0,0 +1,48 @@
+id: blocks_interleave
+label: Interleave
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: num_streams
+ label: Num Streams
+ dtype: int
+ default: '2'
+ hide: part
+- id: blocksize
+ label: Block Size
+ dtype: int
+ default: '1'
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_streams }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ num_streams > 0 }
+- ${ vlen >= 1 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.interleave(${type.size}*${vlen}, ${blocksize})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_interleave.xml b/gr-blocks/grc/blocks_interleave.xml
deleted file mode 100644
index 69fb15e2c..000000000
--- a/gr-blocks/grc/blocks_interleave.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Interleave
-###################################################
- -->
-<block>
- <name>Interleave</name>
- <key>blocks_interleave</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.interleave($type.size*$vlen, $blocksize)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Num Streams</name>
- <key>num_streams</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Block Size</name>
- <key>blocksize</key>
- <value>1</value>
- <type>int</type>
- <hide>part</hide>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_streams &gt; 0</check>
- <check>$vlen &gt;= 1</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_streams</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_interleaved_char_to_complex.block.yml b/gr-blocks/grc/blocks_interleaved_char_to_complex.block.yml
new file mode 100644
index 000000000..049f67b24
--- /dev/null
+++ b/gr-blocks/grc/blocks_interleaved_char_to_complex.block.yml
@@ -0,0 +1,28 @@
+id: blocks_interleaved_char_to_complex
+label: IChar To Complex
+
+parameters:
+- id: vector_input
+ label: Vector Input
+ dtype: enum
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['No', 'Yes']
+ option_attributes:
+ vlen: ['1', '2']
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ vector_input.vlen }
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.interleaved_char_to_complex(${vector_input})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_interleaved_char_to_complex.xml b/gr-blocks/grc/blocks_interleaved_char_to_complex.xml
deleted file mode 100644
index 9c0cdef6f..000000000
--- a/gr-blocks/grc/blocks_interleaved_char_to_complex.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Interleaved Char to Complex:
-###################################################
- -->
-<block>
- <name>IChar To Complex</name>
- <key>blocks_interleaved_char_to_complex</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.interleaved_char_to_complex($vector_input)</make>
- <param>
- <name>Vector Input</name>
- <key>vector_input</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>No</name>
- <key>False</key>
- <opt>vlen:1</opt>
- </option>
- <option>
- <name>Yes</name>
- <key>True</key>
- <opt>vlen:2</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>$vector_input.vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_interleaved_short_to_complex.block.yml b/gr-blocks/grc/blocks_interleaved_short_to_complex.block.yml
new file mode 100644
index 000000000..5c3ab76d4
--- /dev/null
+++ b/gr-blocks/grc/blocks_interleaved_short_to_complex.block.yml
@@ -0,0 +1,37 @@
+id: blocks_interleaved_short_to_complex
+label: IShort To Complex
+
+parameters:
+- id: vector_input
+ label: Vector Input
+ dtype: enum
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['No', 'Yes']
+ option_attributes:
+ vlen: ['1', '2']
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: swap
+ label: Swap
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: short
+ vlen: ${ vector_input.vlen }
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.interleaved_short_to_complex(${vector_input}, ${swap})
+ callbacks:
+ - set_swap(${swap})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_interleaved_short_to_complex.xml b/gr-blocks/grc/blocks_interleaved_short_to_complex.xml
deleted file mode 100644
index 2c4e15385..000000000
--- a/gr-blocks/grc/blocks_interleaved_short_to_complex.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Interleaved Short to Complex:
-###################################################
- -->
-<block>
- <name>IShort To Complex</name>
- <key>blocks_interleaved_short_to_complex</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.interleaved_short_to_complex($vector_input, $swap)</make>
- <callback>set_swap($swap)</callback>
- <param>
- <name>Vector Input</name>
- <key>vector_input</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>No</name>
- <key>False</key>
- <opt>vlen:1</opt>
- </option>
- <option>
- <name>Yes</name>
- <key>True</key>
- <opt>vlen:2</opt>
- </option>
- </param>
- <param>
- <name>Swap</name>
- <key>swap</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>short</type>
- <vlen>$vector_input.vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_keep_m_in_n.block.yml b/gr-blocks/grc/blocks_keep_m_in_n.block.yml
new file mode 100644
index 000000000..451899eae
--- /dev/null
+++ b/gr-blocks/grc/blocks_keep_m_in_n.block.yml
@@ -0,0 +1,49 @@
+id: blocks_keep_m_in_n
+label: Keep M in N
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: m
+ label: M
+ dtype: int
+ default: '1'
+- id: n
+ label: N
+ dtype: int
+ default: '2'
+- id: offset
+ label: initial offset
+ dtype: int
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: 1
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: 1
+
+asserts:
+- ${ n > 0 }
+- ${ m > 0 }
+- ${ m <= n }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.keep_m_in_n(${type.size}, ${m}, ${n}, ${offset})
+ callbacks:
+ - set_offset(${offset})
+ - set_m(${m})
+ - set_n(${n})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_keep_m_in_n.xml b/gr-blocks/grc/blocks_keep_m_in_n.xml
deleted file mode 100644
index 824955c41..000000000
--- a/gr-blocks/grc/blocks_keep_m_in_n.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Keep M in N
-###################################################
- -->
-<block>
- <name>Keep M in N</name>
- <key>blocks_keep_m_in_n</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.keep_m_in_n($type.size, $m, $n, $offset)</make>
- <callback>set_offset($offset)</callback>
- <callback>set_m($m)</callback>
- <callback>set_n($n)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>M</name>
- <key>m</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>N</name>
- <key>n</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>initial offset</name>
- <key>offset</key>
- <value>0</value>
- <type>int</type>
- </param>
- <check>$n &gt; 0</check>
- <check>$m &gt; 0</check>
- <check>$m &lt;= $n</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>1</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>1</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_keep_one_in_n.block.yml b/gr-blocks/grc/blocks_keep_one_in_n.block.yml
new file mode 100644
index 000000000..d79055783
--- /dev/null
+++ b/gr-blocks/grc/blocks_keep_one_in_n.block.yml
@@ -0,0 +1,44 @@
+id: blocks_keep_one_in_n
+label: Keep 1 in N
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: n
+ label: N
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ n > 0 }
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.keep_one_in_n(${type.size}*${vlen}, ${n})
+ callbacks:
+ - set_n(${n})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_keep_one_in_n.xml b/gr-blocks/grc/blocks_keep_one_in_n.xml
deleted file mode 100644
index 4289a984f..000000000
--- a/gr-blocks/grc/blocks_keep_one_in_n.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Keep 1 in N
-###################################################
- -->
-<block>
- <name>Keep 1 in N</name>
- <key>blocks_keep_one_in_n</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.keep_one_in_n($type.size*$vlen, $n)</make>
- <callback>set_n($n)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>N</name>
- <key>n</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$n &gt; 0</check>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_magphase_to_complex.block.yml b/gr-blocks/grc/blocks_magphase_to_complex.block.yml
new file mode 100644
index 000000000..56f939d81
--- /dev/null
+++ b/gr-blocks/grc/blocks_magphase_to_complex.block.yml
@@ -0,0 +1,34 @@
+id: blocks_magphase_to_complex
+label: Magnitude and Phase To Complex
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- label: mag
+ domain: stream
+ dtype: float
+ vlen: ${ vlen }
+- label: phase
+ domain: stream
+ dtype: float
+ vlen: ${ vlen }
+ optional: true
+
+outputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.magphase_to_complex(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_magphase_to_complex.xml b/gr-blocks/grc/blocks_magphase_to_complex.xml
deleted file mode 100644
index 1292c7d8c..000000000
--- a/gr-blocks/grc/blocks_magphase_to_complex.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Magnitue and Phase to Complex:
-## Two input streams
-###################################################
- -->
-<block>
- <name>Magnitude and Phase To Complex</name>
- <key>blocks_magphase_to_complex</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.magphase_to_complex($vlen)</make>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>mag</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </sink>
- <sink>
- <name>phase</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- <optional>1</optional>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_max_xx.block.yml b/gr-blocks/grc/blocks_max_xx.block.yml
new file mode 100644
index 000000000..8b7516de8
--- /dev/null
+++ b/gr-blocks/grc/blocks_max_xx.block.yml
@@ -0,0 +1,47 @@
+id: blocks_max_xx
+label: Max
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [float, int, short]
+ option_attributes:
+ fcn: [ff, ii, ss]
+ hide: part
+- id: num_inputs
+ label: Num Inputs
+ dtype: int
+ default: '1'
+ hide: part
+- id: vlen
+ label: Input Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: vlen_out
+ label: Output Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_inputs }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen_out }
+
+asserts:
+- ${ num_inputs >= 1 }
+- ${ vlen >= 1 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.max_${type.fcn}(${vlen},${vlen_out})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_max_xx.xml b/gr-blocks/grc/blocks_max_xx.xml
deleted file mode 100644
index 65c536a3d..000000000
--- a/gr-blocks/grc/blocks_max_xx.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Max:
-## 1 output, 2 to inf inputs
-###################################################
- -->
-<block>
- <name>Max</name>
- <key>blocks_max_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.max_$(type.fcn)($vlen,$vlen_out)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- </option>
- </param>
- <param>
- <name>Num Inputs</name>
- <key>num_inputs</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Input Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Output Vec Length</name>
- <key>vlen_out</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_inputs &gt;= 1</check>
- <check>$vlen &gt;= 1</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_inputs</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen_out</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_message_debug.block.yml b/gr-blocks/grc/blocks_message_debug.block.yml
new file mode 100644
index 000000000..301320e88
--- /dev/null
+++ b/gr-blocks/grc/blocks_message_debug.block.yml
@@ -0,0 +1,19 @@
+id: blocks_message_debug
+label: Message Debug
+
+inputs:
+- domain: message
+ id: print
+ optional: true
+- domain: message
+ id: store
+ optional: true
+- domain: message
+ id: print_pdu
+ optional: true
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.message_debug()
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_message_debug.xml b/gr-blocks/grc/blocks_message_debug.xml
deleted file mode 100644
index c547c7542..000000000
--- a/gr-blocks/grc/blocks_message_debug.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Message Debug
-###################################################
- -->
-<block>
- <name>Message Debug</name>
- <key>blocks_message_debug</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.message_debug()</make>
- <sink>
- <name>print</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
- <sink>
- <name>store</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
- <sink>
- <name>print_pdu</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
-</block>
diff --git a/gr-blocks/grc/blocks_message_strobe.block.yml b/gr-blocks/grc/blocks_message_strobe.block.yml
new file mode 100644
index 000000000..6adb2948e
--- /dev/null
+++ b/gr-blocks/grc/blocks_message_strobe.block.yml
@@ -0,0 +1,33 @@
+id: blocks_message_strobe
+label: Message Strobe
+
+parameters:
+- id: msg
+ label: Message PMT
+ dtype: raw
+ default: pmt.intern("TEST")
+- id: period
+ label: Period (ms)
+ dtype: real
+ default: '1000'
+
+inputs:
+- domain: message
+ id: set_msg
+ optional: true
+
+outputs:
+- domain: message
+ id: strobe
+ optional: true
+
+templates:
+ imports: |-
+ from gnuradio import blocks
+ import pmt
+ make: blocks.message_strobe(${msg}, ${period})
+ callbacks:
+ - set_msg(${msg})
+ - set_period(${period})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_message_strobe.xml b/gr-blocks/grc/blocks_message_strobe.xml
deleted file mode 100644
index 4a6091d8e..000000000
--- a/gr-blocks/grc/blocks_message_strobe.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Message Strobe
-###################################################
- -->
-<block>
- <name>Message Strobe</name>
- <key>blocks_message_strobe</key>
- <import>from gnuradio import blocks</import>
- <import>import pmt</import>
- <make>blocks.message_strobe($msg, $period)</make>
- <callback>set_msg($msg)</callback>
- <callback>set_period($period)</callback>
- <param>
- <name>Message PMT</name>
- <key>msg</key>
- <value>pmt.intern("TEST")</value>
- <type>raw</type>
- </param>
- <param>
- <name>Period (ms)</name>
- <key>period</key>
- <value>1000</value>
- <type>real</type>
- </param>
- <sink>
- <name>set_msg</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
- <source>
- <name>strobe</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_message_strobe_random.block.yml b/gr-blocks/grc/blocks_message_strobe_random.block.yml
new file mode 100644
index 000000000..c0d607589
--- /dev/null
+++ b/gr-blocks/grc/blocks_message_strobe_random.block.yml
@@ -0,0 +1,50 @@
+id: blocks_message_strobe_random
+label: Message Strobe Random-Delay
+
+parameters:
+- id: msg
+ label: Message PMT
+ dtype: raw
+ default: pmt.intern("TEST")
+- id: dist
+ label: Distribution
+ dtype: enum
+ options: [blocks.STROBE_POISSON, blocks.STROBE_UNIFORM, blocks.STROBE_GAUSSIAN]
+ option_labels: [Poisson, Uniform, Gaussian]
+- id: mean
+ label: Mean (ms)
+ dtype: real
+ default: '1000'
+- id: std
+ label: Std (ms)
+ dtype: real
+ default: '100'
+
+inputs:
+- domain: message
+ id: set_msg
+ optional: true
+
+outputs:
+- domain: message
+ id: strobe
+ optional: true
+
+templates:
+ imports: |-
+ from gnuradio import blocks
+ import pmt
+ make: blocks.message_strobe_random(${msg}, ${dist}, ${mean}, ${std})
+ callbacks:
+ - set_msg(${msg})
+ - set_dist(${dist})
+ - set_mean(${mean})
+ - set_std(${std})
+
+documentation: |-
+ Please note some peculiarities below:
+ - poisson does not care about your std
+ - gaussian operates as expected
+ - uniform is actually of the range (mean-std, mean+std) - thus we are lieing and it is not actually an std here
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_message_strobe_random.xml b/gr-blocks/grc/blocks_message_strobe_random.xml
deleted file mode 100644
index 573db58ae..000000000
--- a/gr-blocks/grc/blocks_message_strobe_random.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Message Strobe
-###################################################
- -->
-<block>
- <name>Message Strobe Random-Delay</name>
- <key>blocks_message_strobe_random</key>
- <import>from gnuradio import blocks</import>
- <import>import pmt</import>
- <make>blocks.message_strobe_random($msg, $dist, $mean, $std)</make>
- <callback>set_msg($msg)</callback>
- <callback>set_dist($dist)</callback>
- <callback>set_mean($mean)</callback>
- <callback>set_std($std)</callback>
- <param>
- <name>Message PMT</name>
- <key>msg</key>
- <value>pmt.intern("TEST")</value>
- <type>raw</type>
- </param>
- <param>
- <name>Distribution</name>
- <key>dist</key>
- <type>enum</type>
- <option>
- <name>Poisson</name>
- <key>blocks.STROBE_POISSON</key>
- </option>
- <option>
- <name>Uniform</name>
- <key>blocks.STROBE_UNIFORM</key>
- </option>
- <option>
- <name>Gaussian</name>
- <key>blocks.STROBE_GAUSSIAN</key>
- </option>
- </param>
- <param>
- <name>Mean (ms)</name>
- <key>mean</key>
- <value>1000</value>
- <type>real</type>
- </param>
- <param>
- <name>Std (ms)</name>
- <key>std</key>
- <value>100</value>
- <type>real</type>
- </param>
- <sink>
- <name>set_msg</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
- <source>
- <name>strobe</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-
- <doc>
- Please note some peculiarities below:
- - poisson does not care about your std
- - gaussian operates as expected
- - uniform is actually of the range (mean-std, mean+std) - thus we are lieing and it is not actually an std here
- </doc>
-</block>
diff --git a/gr-blocks/grc/blocks_min_xx.block.yml b/gr-blocks/grc/blocks_min_xx.block.yml
new file mode 100644
index 000000000..511d67c14
--- /dev/null
+++ b/gr-blocks/grc/blocks_min_xx.block.yml
@@ -0,0 +1,47 @@
+id: blocks_min_xx
+label: Min
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [float, int, short]
+ option_attributes:
+ fcn: [ff, ii, ss]
+ hide: part
+- id: num_inputs
+ label: Num Inputs
+ dtype: int
+ default: '1'
+ hide: part
+- id: vlen
+ label: Input Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: vlen_out
+ label: Output Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_inputs }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen_out }
+
+asserts:
+- ${ num_inputs >= 1 }
+- ${ vlen >= 1 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.min_${type.fcn}(${vlen},${vlen_out})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_min_xx.xml b/gr-blocks/grc/blocks_min_xx.xml
deleted file mode 100644
index 406f7a11e..000000000
--- a/gr-blocks/grc/blocks_min_xx.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Min:
-## 1 output, 2 to inf inputs
-###################################################
- -->
-<block>
- <name>Min</name>
- <key>blocks_min_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.min_$(type.fcn)($vlen,$vlen_out)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- </option>
- </param>
- <param>
- <name>Num Inputs</name>
- <key>num_inputs</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Input Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Output Vec Length</name>
- <key>vlen_out</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_inputs &gt;= 1</check>
- <check>$vlen &gt;= 1</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_inputs</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen_out</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_moving_average_xx.block.yml b/gr-blocks/grc/blocks_moving_average_xx.block.yml
new file mode 100644
index 000000000..6b1235589
--- /dev/null
+++ b/gr-blocks/grc/blocks_moving_average_xx.block.yml
@@ -0,0 +1,49 @@
+id: blocks_moving_average_xx
+label: Moving Average
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float, int, short]
+ option_attributes:
+ fcn: [cc, ff, ii, ss]
+ scale: [complex, real, int, int]
+ hide: part
+- id: length
+ label: Length
+ dtype: int
+ default: '1000'
+- id: scale
+ label: Scale
+ dtype: ${ type.scale }
+ default: '1'
+- id: max_iter
+ label: Max Iter
+ dtype: int
+ default: '4000'
+- id: vlen
+ label: Length of Vectors
+ dtype: int
+ default: 1
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.moving_average_${type.fcn}(${length}, ${scale}, ${max_iter}, ${vlen})
+ callbacks:
+ - set_length_and_scale(${length}, ${scale})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_moving_average_xx.xml b/gr-blocks/grc/blocks_moving_average_xx.xml
deleted file mode 100644
index 00c5e1d48..000000000
--- a/gr-blocks/grc/blocks_moving_average_xx.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Moving Average
-###################################################
- -->
-<block>
- <name>Moving Average</name>
- <key>blocks_moving_average_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.moving_average_$(type.fcn)($length, $scale, $max_iter, $vlen)</make>
- <callback>set_length_and_scale($length, $scale)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- <opt>scale:complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- <opt>scale:real</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- <opt>scale:int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- <opt>scale:int</opt>
- </option>
- </param>
- <param>
- <name>Length</name>
- <key>length</key>
- <value>1000</value>
- <type>int</type>
- </param>
- <param>
- <name>Scale</name>
- <key>scale</key>
- <value>1</value>
- <type>$type.scale</type>
- </param>
- <param>
- <name>Max Iter</name>
- <key>max_iter</key>
- <value>4000</value>
- <type>int</type>
- </param>
- <param>
- <name>Length of Vectors</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_multiply_by_tag_value_cc.block.yml b/gr-blocks/grc/blocks_multiply_by_tag_value_cc.block.yml
new file mode 100644
index 000000000..f6b72edf3
--- /dev/null
+++ b/gr-blocks/grc/blocks_multiply_by_tag_value_cc.block.yml
@@ -0,0 +1,25 @@
+id: blocks_multiply_by_tag_value_cc
+label: Multiply by Tag Value
+
+parameters:
+- id: tagname
+ label: Tag Name
+ dtype: string
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.multiply_by_tag_value_cc(${tagname}, ${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_multiply_by_tag_value_cc.xml b/gr-blocks/grc/blocks_multiply_by_tag_value_cc.xml
deleted file mode 100644
index cedca12bd..000000000
--- a/gr-blocks/grc/blocks_multiply_by_tag_value_cc.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-
-<block>
- <name>Multiply by Tag Value</name>
- <key>blocks_multiply_by_tag_value_cc</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.multiply_by_tag_value_cc($tagname, $vlen)</make>
-
- <param>
- <name>Tag Name</name>
- <key>tagname</key>
- <type>string</type>
- </param>
-
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-
-</block>
diff --git a/gr-blocks/grc/blocks_multiply_conjugate_cc.block.yml b/gr-blocks/grc/blocks_multiply_conjugate_cc.block.yml
new file mode 100644
index 000000000..aceabc643
--- /dev/null
+++ b/gr-blocks/grc/blocks_multiply_conjugate_cc.block.yml
@@ -0,0 +1,33 @@
+id: blocks_multiply_conjugate_cc
+label: Multiply Conjugate
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- label: in0
+ domain: stream
+ dtype: complex
+ vlen: ${ vlen }
+- label: in1
+ domain: stream
+ dtype: complex
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.multiply_conjugate_cc(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_multiply_conjugate_cc.xml b/gr-blocks/grc/blocks_multiply_conjugate_cc.xml
deleted file mode 100644
index cf0acf4d8..000000000
--- a/gr-blocks/grc/blocks_multiply_conjugate_cc.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Multiply Conjugate Block:
-## 2 complex inputs, 1 complex output
-###################################################
- -->
-<block>
- <name>Multiply Conjugate</name>
- <key>blocks_multiply_conjugate_cc</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.multiply_conjugate_cc($vlen)</make>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in0</name>
- <type>complex</type>
- <vlen>$vlen</vlen>
- </sink>
- <sink>
- <name>in1</name>
- <type>complex</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_multiply_const_vxx.block.yml b/gr-blocks/grc/blocks_multiply_const_vxx.block.yml
new file mode 100644
index 000000000..fe7efa464
--- /dev/null
+++ b/gr-blocks/grc/blocks_multiply_const_vxx.block.yml
@@ -0,0 +1,43 @@
+id: blocks_multiply_const_vxx
+label: Multiply Const
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short]
+ option_attributes:
+ const_type: [complex_vector, real_vector, int_vector, int_vector]
+ fcn: [cc, ff, ii, ss]
+ hide: part
+- id: const
+ label: Constant
+ dtype: ${ type.const_type }
+ default: '0'
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ len(const) == vlen }
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.multiply_const_v${type.fcn}(${const})
+ callbacks:
+ - set_k(${const})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_multiply_const_vxx.xml b/gr-blocks/grc/blocks_multiply_const_vxx.xml
deleted file mode 100644
index 6162621d3..000000000
--- a/gr-blocks/grc/blocks_multiply_const_vxx.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Multiply Const Block:
-## all types, 1 output, 1 input & const
-###################################################
- -->
-<block>
- <name>Multiply Const</name>
- <key>blocks_multiply_const_vxx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.multiply_const_v$(type.fcn)($const)</make>
- <callback>set_k($const)</callback>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>const_type:complex_vector</opt>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>const_type:real_vector</opt>
- <opt>fcn:ff</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>const_type:int_vector</opt>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>const_type:int_vector</opt>
- <opt>fcn:ss</opt>
- </option>
- </param>
- <param>
- <name>Constant</name>
- <key>const</key>
- <value>0</value>
- <type>$type.const_type</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>len($const) == $vlen</check>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_multiply_const_xx.block.yml b/gr-blocks/grc/blocks_multiply_const_xx.block.yml
new file mode 100644
index 000000000..168de8480
--- /dev/null
+++ b/gr-blocks/grc/blocks_multiply_const_xx.block.yml
@@ -0,0 +1,41 @@
+id: blocks_multiply_const_xx
+label: Fast Multiply Const
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short]
+ option_attributes:
+ fcn: [cc, ff, ii, ss]
+ hide: part
+- id: const
+ label: Constant
+ dtype: ${ type }
+ default: '0'
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.multiply_const_${type.fcn}(${const})
+ callbacks:
+ - set_k(${const})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_multiply_const_xx.xml b/gr-blocks/grc/blocks_multiply_const_xx.xml
deleted file mode 100644
index db8b5211e..000000000
--- a/gr-blocks/grc/blocks_multiply_const_xx.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Fast Multiply Const Block:
-## all types, 1 output, 1 input & const
-###################################################
- -->
-<block>
- <name>Fast Multiply Const</name>
- <key>blocks_multiply_const_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.multiply_const_$(type.fcn)($const)</make>
- <callback>set_k($const)</callback>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- </option>
- </param>
- <param>
- <name>Constant</name>
- <key>const</key>
- <value>0</value>
- <type>$type</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_multiply_matrix_xx.block.yml b/gr-blocks/grc/blocks_multiply_matrix_xx.block.yml
new file mode 100644
index 000000000..21a66b4f8
--- /dev/null
+++ b/gr-blocks/grc/blocks_multiply_matrix_xx.block.yml
@@ -0,0 +1,47 @@
+id: blocks_multiply_matrix_xx
+label: Multiply by Matrix
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [float, complex]
+ option_attributes:
+ fcn: [ff, cc]
+ hide: part
+- id: A
+ label: Matrix A
+ dtype: raw
+ default: ((1, 0), (0, 1))
+ hide: part
+- id: tag_propagation_policy
+ label: TPP
+ dtype: enum
+ options: [gr.TPP_ALL_TO_ALL, gr.TPP_ONE_TO_ONE, gr.TPP_DONT, gr.TPP_CUSTOM]
+ option_labels: [All to All, One to One, No Propagation, Matrix-Defined]
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ multiplicity: ${ len(A[0]) }
+- domain: message
+ id: set_A
+ optional: true
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ multiplicity: ${ len(A) }
+
+asserts:
+- ${ len(A) > 0 }
+- ${ len(A[0]) > 0 }
+- ${ tag_propagation_policy != gr.TPP_ONE_TO_ONE or (len(A) == len(A[0])) }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.multiply_matrix_${type.fcn}(${A}, ${tag_propagation_policy})
+ callbacks:
+ - set_A(${A})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_multiply_matrix_xx.xml b/gr-blocks/grc/blocks_multiply_matrix_xx.xml
deleted file mode 100644
index bb1d77c0b..000000000
--- a/gr-blocks/grc/blocks_multiply_matrix_xx.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>Multiply by Matrix</name>
- <key>blocks_multiply_matrix_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.multiply_matrix_$(type.fcn)($A, $tag_propagation_policy)</make>
- <callback>set_A($A)</callback>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
- </param>
- <param>
- <name>Matrix A</name>
- <key>A</key>
- <value>((1, 0), (0, 1))</value>
- <type>raw</type>
- </param>
- <param>
- <name>TPP</name>
- <key>tag_propagation_policy</key>
- <type>enum</type>
- <option>
- <name>All to All</name>
- <key>gr.TPP_ALL_TO_ALL</key>
- </option>
- <option>
- <name>One to One</name>
- <key>gr.TPP_ONE_TO_ONE</key>
- </option>
- <option>
- <name>No Propagation</name>
- <key>gr.TPP_DONT</key>
- </option>
- <option>
- <name>Matrix-Defined</name>
- <key>gr.TPP_CUSTOM</key>
- </option>
- </param>
- <check>len($A) > 0</check>
- <check>len(${A}[0]) > 0</check>
- <check>$tag_propagation_policy != gr.TPP_ONE_TO_ONE or (len($A) == len(${A}[0]))</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <nports>len(${A}[0])</nports>
- </sink>
- <sink>
- <name>set_A</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <nports>len($A)</nports>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_multiply_xx.block.yml b/gr-blocks/grc/blocks_multiply_xx.block.yml
new file mode 100644
index 000000000..41c28458a
--- /dev/null
+++ b/gr-blocks/grc/blocks_multiply_xx.block.yml
@@ -0,0 +1,42 @@
+id: blocks_multiply_xx
+label: Multiply
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short]
+ option_attributes:
+ fcn: [cc, ff, ii, ss]
+ hide: part
+- id: num_inputs
+ label: Num Inputs
+ dtype: int
+ default: '2'
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_inputs }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ num_inputs > 1 }
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.multiply_v${type.fcn}(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_multiply_xx.xml b/gr-blocks/grc/blocks_multiply_xx.xml
deleted file mode 100644
index 15f024142..000000000
--- a/gr-blocks/grc/blocks_multiply_xx.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Multiply Block:
-## all types, 1 output, 2 to inf inputs
-###################################################
- -->
-<block>
- <name>Multiply</name>
- <key>blocks_multiply_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.multiply_v$(type.fcn)($vlen)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- </option>
- </param>
- <param>
- <name>Num Inputs</name>
- <key>num_inputs</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_inputs &gt; 1</check>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_inputs</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_mute_xx.block.yml b/gr-blocks/grc/blocks_mute_xx.block.yml
new file mode 100644
index 000000000..8e36c568d
--- /dev/null
+++ b/gr-blocks/grc/blocks_mute_xx.block.yml
@@ -0,0 +1,35 @@
+id: blocks_mute_xx
+label: Mute
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short]
+ option_attributes:
+ fcn: [cc, ff, ii, ss]
+ hide: part
+- id: mute
+ label: Mute
+ dtype: raw
+ default: 'False'
+ options: ['True', 'False']
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+- domain: message
+ id: set_mute
+ optional: true
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.mute_${type.fcn}(bool(${mute}))
+ callbacks:
+ - set_mute(bool(${mute}))
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_mute_xx.xml b/gr-blocks/grc/blocks_mute_xx.xml
deleted file mode 100644
index 74c22ec83..000000000
--- a/gr-blocks/grc/blocks_mute_xx.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Mute Block:
-## Cast input to bool.
-###################################################
- -->
-<block>
- <name>Mute</name>
- <key>blocks_mute_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.mute_$(type.fcn)(bool($mute))</make>
- <callback>set_mute(bool($mute))</callback>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- </option>
- </param>
- <param>
- <name>Mute</name>
- <key>mute</key>
- <value>False</value>
- <type>raw</type>
- <option>
- <name>True</name>
- <key>True</key>
- </option>
- <option>
- <name>False</name>
- <key>False</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <sink>
- <name>set_mute</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_nlog10_ff.block.yml b/gr-blocks/grc/blocks_nlog10_ff.block.yml
new file mode 100644
index 000000000..004e72b4e
--- /dev/null
+++ b/gr-blocks/grc/blocks_nlog10_ff.block.yml
@@ -0,0 +1,37 @@
+id: blocks_nlog10_ff
+label: Log10
+
+parameters:
+- id: n
+ label: n
+ dtype: real
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: k
+ label: k
+ dtype: real
+ default: '0'
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: float
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: float
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen >= 1 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.nlog10_ff(${n}, ${vlen}, ${k})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_nlog10_ff.xml b/gr-blocks/grc/blocks_nlog10_ff.xml
deleted file mode 100644
index 884f4a444..000000000
--- a/gr-blocks/grc/blocks_nlog10_ff.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Log10 Block:
-## float in/ float out
-###################################################
- -->
-<block>
- <name>Log10</name>
- <key>blocks_nlog10_ff</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.nlog10_ff($n, $vlen, $k)</make>
- <param>
- <name>n</name>
- <key>n</key>
- <value>1</value>
- <type>real</type>
- </param>
- <param>
- <name>k</name>
- <key>k</key>
- <value>0</value>
- <type>real</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen >= 1</check>
- <sink>
- <name>in</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_nop.block.yml b/gr-blocks/grc/blocks_nop.block.yml
new file mode 100644
index 000000000..5e47e813a
--- /dev/null
+++ b/gr-blocks/grc/blocks_nop.block.yml
@@ -0,0 +1,44 @@
+id: blocks_nop
+label: Nop
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: num_ports
+ label: Num Ports
+ dtype: int
+ default: '1'
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_ports }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_ports }
+
+asserts:
+- ${ num_ports > 0 }
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.nop(${type.size}*${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_nop.xml b/gr-blocks/grc/blocks_nop.xml
deleted file mode 100644
index d38c23839..000000000
--- a/gr-blocks/grc/blocks_nop.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Nop
-###################################################
- -->
-<block>
- <name>Nop</name>
- <key>blocks_nop</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.nop($type.size*$vlen)</make>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Num Ports</name>
- <key>num_ports</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_ports &gt; 0</check>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_ports</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_ports</nports>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_not_xx.block.yml b/gr-blocks/grc/blocks_not_xx.block.yml
new file mode 100644
index 000000000..63ec98a42
--- /dev/null
+++ b/gr-blocks/grc/blocks_not_xx.block.yml
@@ -0,0 +1,25 @@
+id: blocks_not_xx
+label: Not
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [int, short, byte]
+ option_attributes:
+ fcn: [ii, ss, bb]
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.not_${type.fcn}()
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_not_xx.xml b/gr-blocks/grc/blocks_not_xx.xml
deleted file mode 100644
index fe8916d8b..000000000
--- a/gr-blocks/grc/blocks_not_xx.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Logical Not Block
-###################################################
- -->
-<block>
- <name>Not</name>
- <key>blocks_not_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.not_$(type.fcn)()</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:bb</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_null_sink.block.yml b/gr-blocks/grc/blocks_null_sink.block.yml
new file mode 100644
index 000000000..c9530f99d
--- /dev/null
+++ b/gr-blocks/grc/blocks_null_sink.block.yml
@@ -0,0 +1,43 @@
+id: blocks_null_sink
+label: Null Sink
+
+parameters:
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: num_inputs
+ label: Num Inputs
+ dtype: int
+ default: '1'
+ hide: part
+- id: bus_conns
+ label: Bus Connections
+ dtype: raw
+ default: '[[0,],]'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_inputs }
+
+asserts:
+- ${ num_inputs >= 1 }
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.null_sink(${type.size}*${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_null_sink.xml b/gr-blocks/grc/blocks_null_sink.xml
deleted file mode 100644
index f2907d20b..000000000
--- a/gr-blocks/grc/blocks_null_sink.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Null Sink
-###################################################
- -->
-<block>
- <name>Null Sink</name>
- <key>blocks_null_sink</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.null_sink($type.size*$vlen)</make>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Num Inputs</name>
- <key>num_inputs</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Bus Connections</name>
- <key>bus_conns</key>
- <value>[[0,],]</value>
- <type>raw</type>
- <hide>part</hide>
- </param>
- <check>$num_inputs &gt;= 1</check>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_inputs</nports>
- </sink>
- <bus_structure_sink>$bus_conns</bus_structure_sink>
-</block>
-
diff --git a/gr-blocks/grc/blocks_null_source.block.yml b/gr-blocks/grc/blocks_null_source.block.yml
new file mode 100644
index 000000000..0678687a8
--- /dev/null
+++ b/gr-blocks/grc/blocks_null_source.block.yml
@@ -0,0 +1,39 @@
+id: blocks_null_source
+label: Null Source
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: num_outputs
+ label: Num Outputs
+ dtype: int
+ default: '1'
+ hide: part
+- id: bus_conns
+ label: Bus Connections
+ dtype: raw
+ default: '[[0,],]'
+ hide: part
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_outputs }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.null_source(${type.size}*${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_null_source.xml b/gr-blocks/grc/blocks_null_source.xml
deleted file mode 100644
index 9c109e651..000000000
--- a/gr-blocks/grc/blocks_null_source.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Null Source
-###################################################
- -->
-<block>
- <name>Null Source</name>
- <key>blocks_null_source</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.null_source($type.size*$vlen)</make>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Num Outputs</name>
- <key>num_outputs</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Bus Connections</name>
- <key>bus_conns</key>
- <value>[[0,],]</value>
- <type>raw</type>
- <hide>part</hide>
- </param>
- <check>$num_outputs &gt;= 1</check>
- <check>$vlen &gt; 0</check>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_outputs</nports>
- </source>
- <bus_structure_source>$bus_conns</bus_structure_source>
-</block>
diff --git a/gr-blocks/grc/blocks_or_xx.block.yml b/gr-blocks/grc/blocks_or_xx.block.yml
new file mode 100644
index 000000000..a28a95171
--- /dev/null
+++ b/gr-blocks/grc/blocks_or_xx.block.yml
@@ -0,0 +1,34 @@
+id: blocks_or_xx
+label: Or
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [int, short, byte]
+ option_attributes:
+ fcn: [ii, ss, bb]
+ hide: part
+- id: num_inputs
+ label: Num Inputs
+ dtype: int
+ default: '2'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ multiplicity: ${ num_inputs }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+asserts:
+- ${ num_inputs >= 2 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.or_${type.fcn}()
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_or_xx.xml b/gr-blocks/grc/blocks_or_xx.xml
deleted file mode 100644
index 400c09389..000000000
--- a/gr-blocks/grc/blocks_or_xx.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Logical Or Block
-###################################################
- -->
-<block>
- <name>Or</name>
- <key>blocks_or_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.or_$(type.fcn)()</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:bb</opt>
- </option>
- </param>
- <param>
- <name>Num Inputs</name>
- <key>num_inputs</key>
- <value>2</value>
- <type>int</type>
- </param>
- <check>$num_inputs &gt;= 2</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <nports>$num_inputs</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_pack_k_bits_bb.block.yml b/gr-blocks/grc/blocks_pack_k_bits_bb.block.yml
new file mode 100644
index 000000000..904f382f0
--- /dev/null
+++ b/gr-blocks/grc/blocks_pack_k_bits_bb.block.yml
@@ -0,0 +1,24 @@
+id: blocks_pack_k_bits_bb
+label: Pack K Bits
+
+parameters:
+- id: k
+ label: K
+ dtype: int
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.pack_k_bits_bb(${k})
+
+documentation: |-
+ Pack K unpacked bits (one bit per byte) into a single packed byte containing k bits and 8 - k zeros.
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_pack_k_bits_bb.xml b/gr-blocks/grc/blocks_pack_k_bits_bb.xml
deleted file mode 100644
index 5400eb4af..000000000
--- a/gr-blocks/grc/blocks_pack_k_bits_bb.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Pack K Bits
-###################################################
- -->
-<block>
- <name>Pack K Bits</name>
- <key>blocks_pack_k_bits_bb</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.pack_k_bits_bb($k)</make>
- <param>
- <name>K</name>
- <key>k</key>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-
- <doc>
- Pack K unpacked bits (one bit per byte) into a single packed byte containing k bits and 8 - k zeros.
- </doc>
-
-</block>
diff --git a/gr-blocks/grc/blocks_packed_to_unpacked_xx.block.yml b/gr-blocks/grc/blocks_packed_to_unpacked_xx.block.yml
new file mode 100644
index 000000000..5d49d1851
--- /dev/null
+++ b/gr-blocks/grc/blocks_packed_to_unpacked_xx.block.yml
@@ -0,0 +1,44 @@
+id: blocks_packed_to_unpacked_xx
+label: Packed to Unpacked
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [int, short, byte]
+ option_attributes:
+ fcn: [ii, ss, bb]
+ hide: part
+- id: bits_per_chunk
+ label: Bits per Chunk
+ dtype: int
+ default: '2'
+- id: endianness
+ label: Endianness
+ dtype: int
+ options: [gr.GR_MSB_FIRST, gr.GR_LSB_FIRST]
+ option_labels: [MSB, LSB]
+- id: num_ports
+ label: Num Ports
+ dtype: int
+ default: '1'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ multiplicity: ${ num_ports }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ multiplicity: ${ num_ports }
+
+asserts:
+- ${ num_ports > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.packed_to_unpacked_${type.fcn}(${bits_per_chunk}, ${endianness})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_packed_to_unpacked_xx.xml b/gr-blocks/grc/blocks_packed_to_unpacked_xx.xml
deleted file mode 100644
index b236a38db..000000000
--- a/gr-blocks/grc/blocks_packed_to_unpacked_xx.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Packed to Unpacked
-###################################################
- -->
-<block>
- <name>Packed to Unpacked</name>
- <key>blocks_packed_to_unpacked_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.packed_to_unpacked_$(type.fcn)($bits_per_chunk, $endianness)</make>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:bb</opt>
- </option>
- </param>
- <param>
- <name>Bits per Chunk</name>
- <key>bits_per_chunk</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Endianness</name>
- <key>endianness</key>
- <type>int</type>
- <option>
- <name>MSB</name>
- <key>gr.GR_MSB_FIRST</key>
- </option>
- <option>
- <name>LSB</name>
- <key>gr.GR_LSB_FIRST</key>
- </option>
- </param>
- <param>
- <name>Num Ports</name>
- <key>num_ports</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_ports &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <nports>$num_ports</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <nports>$num_ports</nports>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_patterned_interleaver.block.yml b/gr-blocks/grc/blocks_patterned_interleaver.block.yml
new file mode 100644
index 000000000..97f170f97
--- /dev/null
+++ b/gr-blocks/grc/blocks_patterned_interleaver.block.yml
@@ -0,0 +1,42 @@
+id: blocks_patterned_interleaver
+label: Patterned Interleaver
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: pattern
+ label: Pattern
+ dtype: int_vector
+ default: '[0,0,1,2]'
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ 1+max(pattern) }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen >= 1 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.patterned_interleaver(${type.size}*${vlen}, ${pattern})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_patterned_interleaver.xml b/gr-blocks/grc/blocks_patterned_interleaver.xml
deleted file mode 100644
index 8dd0fac41..000000000
--- a/gr-blocks/grc/blocks_patterned_interleaver.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Vector to Stream
-###################################################
- -->
-<block>
- <name>Patterned Interleaver</name>
- <key>blocks_patterned_interleaver</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.patterned_interleaver($type.size*$vlen, $pattern)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Pattern</name>
- <key>pattern</key>
- <value>[0,0,1,2]</value>
- <type>int_vector</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt;= 1</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>1+max($pattern)</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_pdu_filter.block.yml b/gr-blocks/grc/blocks_pdu_filter.block.yml
new file mode 100644
index 000000000..43d72b748
--- /dev/null
+++ b/gr-blocks/grc/blocks_pdu_filter.block.yml
@@ -0,0 +1,40 @@
+id: blocks_pdu_filter
+label: PDU Filter
+
+parameters:
+- id: k
+ label: Key
+ dtype: raw
+ default: pmt.intern("key")
+- id: v
+ label: Value
+ dtype: raw
+ default: pmt.intern("value")
+- id: invert
+ label: Invert Filter
+ dtype: bool
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['No', 'Yes']
+
+inputs:
+- domain: message
+ id: pdus
+ optional: true
+
+outputs:
+- domain: message
+ id: pdus
+ optional: true
+
+templates:
+ imports: |-
+ from gnuradio import blocks
+ import pmt
+ make: blocks.pdu_filter(${k}, ${v}, ${invert})
+ callbacks:
+ - set_key(${k})
+ - set_val(${v})
+ - set_inversion(${invert})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_pdu_filter.xml b/gr-blocks/grc/blocks_pdu_filter.xml
deleted file mode 100644
index 0e848963d..000000000
--- a/gr-blocks/grc/blocks_pdu_filter.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## PDU Filter
-###################################################
- -->
-<block>
- <name>PDU Filter</name>
- <key>blocks_pdu_filter</key>
- <import>from gnuradio import blocks</import>
- <import>import pmt</import>
- <make>blocks.pdu_filter($k, $v, $invert)</make>
- <callback>set_key($k)</callback>
- <callback>set_val($v)</callback>
- <callback>set_inversion($invert)</callback>
- <param>
- <name>Key</name>
- <key>k</key>
- <value>pmt.intern("key")</value>
- <type>raw</type>
- </param>
- <param>
- <name>Value</name>
- <key>v</key>
- <value>pmt.intern("value")</value>
- <type>raw</type>
- </param>
- <param>
- <name>Invert Filter</name>
- <key>invert</key>
- <value>False</value>
- <type>bool</type>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- </param>
- <sink>
- <name>pdus</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
- <source>
- <name>pdus</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_pdu_remove.block.yml b/gr-blocks/grc/blocks_pdu_remove.block.yml
new file mode 100644
index 000000000..4750ff22c
--- /dev/null
+++ b/gr-blocks/grc/blocks_pdu_remove.block.yml
@@ -0,0 +1,28 @@
+id: blocks_pdu_remove
+label: PDU Remove
+
+parameters:
+- id: k
+ label: Key
+ dtype: raw
+ default: pmt.intern("key")
+
+inputs:
+- domain: message
+ id: pdus
+ optional: true
+
+outputs:
+- domain: message
+ id: pdus
+ optional: true
+
+templates:
+ imports: |-
+ from gnuradio import blocks
+ import pmt
+ make: blocks.pdu_remove(${k})
+ callbacks:
+ - set_key(${k})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_pdu_remove.xml b/gr-blocks/grc/blocks_pdu_remove.xml
deleted file mode 100644
index c71da32fc..000000000
--- a/gr-blocks/grc/blocks_pdu_remove.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## PDU Remove
-###################################################
- -->
-<block>
- <name>PDU Remove</name>
- <key>blocks_pdu_remove</key>
- <import>from gnuradio import blocks</import>
- <import>import pmt</import>
- <make>blocks.pdu_remove($k)</make>
- <callback>set_key($k)</callback>
- <param>
- <name>Key</name>
- <key>k</key>
- <value>pmt.intern("key")</value>
- <type>raw</type>
- </param>
- <sink>
- <name>pdus</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
- <source>
- <name>pdus</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_pdu_set.block.yml b/gr-blocks/grc/blocks_pdu_set.block.yml
new file mode 100644
index 000000000..44a06a2e0
--- /dev/null
+++ b/gr-blocks/grc/blocks_pdu_set.block.yml
@@ -0,0 +1,33 @@
+id: blocks_pdu_set
+label: PDU Set
+
+parameters:
+- id: k
+ label: Key
+ dtype: raw
+ default: pmt.intern("key")
+- id: v
+ label: Value
+ dtype: raw
+ default: pmt.intern("value")
+
+inputs:
+- domain: message
+ id: pdus
+ optional: true
+
+outputs:
+- domain: message
+ id: pdus
+ optional: true
+
+templates:
+ imports: |-
+ from gnuradio import blocks
+ import pmt
+ make: blocks.pdu_set(${k}, ${v})
+ callbacks:
+ - set_key(${k})
+ - set_val(${v})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_pdu_set.xml b/gr-blocks/grc/blocks_pdu_set.xml
deleted file mode 100644
index b7a903062..000000000
--- a/gr-blocks/grc/blocks_pdu_set.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## PDU Set
-###################################################
- -->
-<block>
- <name>PDU Set</name>
- <key>blocks_pdu_set</key>
- <import>from gnuradio import blocks</import>
- <import>import pmt</import>
- <make>blocks.pdu_set($k, $v)</make>
- <callback>set_key($k)</callback>
- <callback>set_val($v)</callback>
- <param>
- <name>Key</name>
- <key>k</key>
- <value>pmt.intern("key")</value>
- <type>raw</type>
- </param>
- <param>
- <name>Value</name>
- <key>v</key>
- <value>pmt.intern("value")</value>
- <type>raw</type>
- </param>
- <sink>
- <name>pdus</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
- <source>
- <name>pdus</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_pdu_to_tagged_stream.block.yml b/gr-blocks/grc/blocks_pdu_to_tagged_stream.block.yml
new file mode 100644
index 000000000..3b44badd4
--- /dev/null
+++ b/gr-blocks/grc/blocks_pdu_to_tagged_stream.block.yml
@@ -0,0 +1,29 @@
+id: blocks_pdu_to_tagged_stream
+label: PDU to Tagged Stream
+
+parameters:
+- id: type
+ label: Item Type
+ dtype: enum
+ options: [byte, complex, float]
+ option_attributes:
+ tv: [blocks.byte_t, blocks.complex_t, blocks.float_t]
+ hide: part
+- id: tag
+ label: Length tag name
+ dtype: string
+ default: packet_len
+
+inputs:
+- domain: message
+ id: pdus
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.pdu_to_tagged_stream(${type.tv}, ${tag})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_pdu_to_tagged_stream.xml b/gr-blocks/grc/blocks_pdu_to_tagged_stream.xml
deleted file mode 100644
index 0835a2ade..000000000
--- a/gr-blocks/grc/blocks_pdu_to_tagged_stream.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## PDU Message to Tagged Stream
-###################################################
- -->
-<block>
- <name>PDU to Tagged Stream</name>
- <key>blocks_pdu_to_tagged_stream</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.pdu_to_tagged_stream($type.tv, $tag)</make>
- <param>
- <name>Item Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>tv:blocks.byte_t</opt>
- </option>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>tv:blocks.complex_t</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>tv:blocks.float_t</opt>
- </option>
- </param>
- <param>
- <name>Length tag name</name>
- <key>tag</key>
- <value>packet_len</value>
- <type>string</type>
- </param>
- <sink>
- <name>pdus</name>
- <type>message</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_peak_detector2_fb.block.yml b/gr-blocks/grc/blocks_peak_detector2_fb.block.yml
new file mode 100644
index 000000000..0950640ae
--- /dev/null
+++ b/gr-blocks/grc/blocks_peak_detector2_fb.block.yml
@@ -0,0 +1,38 @@
+id: blocks_peak_detector2_fb
+label: Peak Detector2
+
+parameters:
+- id: threshold_factor_rise
+ label: TH Factor Rise
+ dtype: real
+ default: '7'
+- id: look_ahead
+ label: Look Ahead
+ dtype: int
+ default: '1000'
+- id: alpha
+ label: Alpha
+ dtype: real
+ default: '0.001'
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: byte
+- label: debug
+ domain: stream
+ dtype: float
+ optional: true
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.peak_detector2_fb(${threshold_factor_rise}, ${look_ahead}, ${alpha})
+ callbacks:
+ - set_threshold_factor_rise(${threshold_factor_rise})
+ - set_look_ahead(${look_ahead})
+ - set_alpha(${alpha})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_peak_detector2_fb.xml b/gr-blocks/grc/blocks_peak_detector2_fb.xml
deleted file mode 100644
index 0b25e0168..000000000
--- a/gr-blocks/grc/blocks_peak_detector2_fb.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Peak Detector2
-###################################################
- -->
-<block>
- <name>Peak Detector2</name>
- <key>blocks_peak_detector2_fb</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.peak_detector2_fb($threshold_factor_rise, $look_ahead, $alpha)</make>
- <callback>set_threshold_factor_rise($threshold_factor_rise)</callback>
- <callback>set_look_ahead($look_ahead)</callback>
- <callback>set_alpha($alpha)</callback>
- <param>
- <name>TH Factor Rise</name>
- <key>threshold_factor_rise</key>
- <value>7</value>
- <type>real</type>
- </param>
- <param>
- <name>Look Ahead</name>
- <key>look_ahead</key>
- <value>1000</value>
- <type>int</type>
- </param>
- <param>
- <name>Alpha</name>
- <key>alpha</key>
- <value>0.001</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
- <source>
- <name>debug</name>
- <type>float</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_peak_detector_xb.block.yml b/gr-blocks/grc/blocks_peak_detector_xb.block.yml
new file mode 100644
index 000000000..be0f23839
--- /dev/null
+++ b/gr-blocks/grc/blocks_peak_detector_xb.block.yml
@@ -0,0 +1,47 @@
+id: blocks_peak_detector_xb
+label: Peak Detector
+
+parameters:
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [float, int, short]
+ option_attributes:
+ fcn: [f, i, s]
+ hide: part
+- id: threshold_factor_rise
+ label: TH Factor Rise
+ dtype: real
+ default: '0.25'
+- id: threshold_factor_fall
+ label: TH Factor Fall
+ dtype: real
+ default: '0.40'
+- id: look_ahead
+ label: Look Ahead
+ dtype: int
+ default: '10'
+- id: alpha
+ label: Alpha
+ dtype: real
+ default: '0.001'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.peak_detector_${type.fcn}b(${threshold_factor_rise}, ${threshold_factor_fall},
+ ${look_ahead}, ${alpha})
+ callbacks:
+ - set_threshold_factor_rise(${threshold_factor_rise})
+ - set_threshold_factor_fall(${threshold_factor_fall})
+ - set_look_ahead(${look_ahead})
+ - set_alpha(${alpha})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_peak_detector_xb.xml b/gr-blocks/grc/blocks_peak_detector_xb.xml
deleted file mode 100644
index 1aabf8947..000000000
--- a/gr-blocks/grc/blocks_peak_detector_xb.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Peak Detector
-###################################################
- -->
-<block>
- <name>Peak Detector</name>
- <key>blocks_peak_detector_xb</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.peak_detector_$(type.fcn)b($threshold_factor_rise, $threshold_factor_fall, $look_ahead, $alpha)</make>
- <callback>set_threshold_factor_rise($threshold_factor_rise)</callback>
- <callback>set_threshold_factor_fall($threshold_factor_fall)</callback>
- <callback>set_look_ahead($look_ahead)</callback>
- <callback>set_alpha($alpha)</callback>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- </option>
- </param>
- <param>
- <name>TH Factor Rise</name>
- <key>threshold_factor_rise</key>
- <value>0.25</value>
- <type>real</type>
- </param>
- <param>
- <name>TH Factor Fall</name>
- <key>threshold_factor_fall</key>
- <value>0.40</value>
- <type>real</type>
- </param>
- <param>
- <name>Look Ahead</name>
- <key>look_ahead</key>
- <value>10</value>
- <type>int</type>
- </param>
- <param>
- <name>Alpha</name>
- <key>alpha</key>
- <value>0.001</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_plateau_detector_fb.block.yml b/gr-blocks/grc/blocks_plateau_detector_fb.block.yml
new file mode 100644
index 000000000..9af55a67f
--- /dev/null
+++ b/gr-blocks/grc/blocks_plateau_detector_fb.block.yml
@@ -0,0 +1,25 @@
+id: blocks_plateau_detector_fb
+label: Plateau Detector
+
+parameters:
+- id: max_len
+ label: Max. plateau length
+ dtype: int
+- id: threshold
+ label: Threshold
+ dtype: real
+ default: '0.9'
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.plateau_detector_fb(${max_len}, ${threshold})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_plateau_detector_fb.xml b/gr-blocks/grc/blocks_plateau_detector_fb.xml
deleted file mode 100644
index 90f67a4cf..000000000
--- a/gr-blocks/grc/blocks_plateau_detector_fb.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>Plateau Detector</name>
- <key>blocks_plateau_detector_fb</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.plateau_detector_fb($max_len, $threshold)</make>
- <param>
- <name>Max. plateau length</name>
- <key>max_len</key>
- <type>int</type>
- </param>
- <param>
- <name>Threshold</name>
- <key>threshold</key>
- <value>0.9</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_probe_rate.block.yml b/gr-blocks/grc/blocks_probe_rate.block.yml
new file mode 100644
index 000000000..1f9ed65b2
--- /dev/null
+++ b/gr-blocks/grc/blocks_probe_rate.block.yml
@@ -0,0 +1,44 @@
+id: blocks_probe_rate
+label: Probe Rate
+
+parameters:
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: mintime
+ label: Min Update Time (ms)
+ dtype: real
+ default: '500.0'
+- id: alpha
+ label: Update Alpha
+ dtype: real
+ default: '0.15'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: message
+ id: rate
+ optional: true
+
+asserts:
+- ${ vlen >= 1 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.probe_rate(${type.size}*${vlen}, ${mintime}, ${alpha})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_probe_rate.xml b/gr-blocks/grc/blocks_probe_rate.xml
deleted file mode 100644
index f79444c13..000000000
--- a/gr-blocks/grc/blocks_probe_rate.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Probe Rate
-###################################################
- -->
-<block>
- <name>Probe Rate</name>
- <key>blocks_probe_rate</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.probe_rate($type.size*$vlen, $mintime, $alpha)</make>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Min Update Time (ms)</name>
- <key>mintime</key>
- <value>500.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Update Alpha</name>
- <key>alpha</key>
- <value>0.15</value>
- <type>real</type>
- </param>
- <check>$vlen &gt;= 1</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>rate</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_probe_signal_vx.block.yml b/gr-blocks/grc/blocks_probe_signal_vx.block.yml
new file mode 100644
index 000000000..2b486a55b
--- /dev/null
+++ b/gr-blocks/grc/blocks_probe_signal_vx.block.yml
@@ -0,0 +1,35 @@
+id: blocks_probe_signal_vx
+label: Probe Signal Vector
+
+parameters:
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ fcn: [c, f, i, s, b]
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.probe_signal_v${type.fcn}(${vlen})
+
+documentation: |-
+ Available functions to probe: level()
+
+ Use with the function probe block.
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_probe_signal_vx.xml b/gr-blocks/grc/blocks_probe_signal_vx.xml
deleted file mode 100644
index 930a49643..000000000
--- a/gr-blocks/grc/blocks_probe_signal_vx.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Probe Signal
-###################################################
- -->
-<block>
- <name>Probe Signal Vector</name>
- <key>blocks_probe_signal_vx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.probe_signal_v$(type.fcn)($vlen)</make>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:b</opt>
- </option>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <doc>
-Available functions to probe: level()
-
-Use with the function probe block.
- </doc>
-</block>
diff --git a/gr-blocks/grc/blocks_probe_signal_x.block.yml b/gr-blocks/grc/blocks_probe_signal_x.block.yml
new file mode 100644
index 000000000..0991bde99
--- /dev/null
+++ b/gr-blocks/grc/blocks_probe_signal_x.block.yml
@@ -0,0 +1,26 @@
+id: blocks_probe_signal_x
+label: Probe Signal
+
+parameters:
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ fcn: [c, f, i, s, b]
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.probe_signal_${type.fcn}()
+
+documentation: |-
+ Available functions to probe: level()
+
+ Use with the function probe block.
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_probe_signal_x.xml b/gr-blocks/grc/blocks_probe_signal_x.xml
deleted file mode 100644
index 726f0fa74..000000000
--- a/gr-blocks/grc/blocks_probe_signal_x.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Probe Signal
-###################################################
- -->
-<block>
- <name>Probe Signal</name>
- <key>blocks_probe_signal_x</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.probe_signal_$(type.fcn)()</make>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:b</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <doc>
-Available functions to probe: level()
-
-Use with the function probe block.
- </doc>
-</block>
diff --git a/gr-blocks/grc/blocks_random_pdu.block.yml b/gr-blocks/grc/blocks_random_pdu.block.yml
new file mode 100644
index 000000000..831b7eb4c
--- /dev/null
+++ b/gr-blocks/grc/blocks_random_pdu.block.yml
@@ -0,0 +1,38 @@
+id: blocks_random_pdu
+label: Random PDU Generator
+
+parameters:
+- id: minsize
+ label: Min Bytes
+ dtype: int
+ default: '50'
+- id: maxsize
+ label: Max Bytes
+ dtype: int
+ default: '2000'
+- id: mask
+ label: Byte Mask
+ dtype: int
+ default: '0xFF'
+- id: length_modulo
+ label: Length Modulo
+ dtype: int
+ default: '2'
+
+inputs:
+- domain: message
+ id: generate
+ optional: true
+
+outputs:
+- domain: message
+ id: pdus
+ optional: true
+
+templates:
+ imports: |-
+ from gnuradio import blocks
+ import pmt
+ make: blocks.random_pdu(${minsize}, ${maxsize}, chr(${mask}), ${length_modulo})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_random_pdu.xml b/gr-blocks/grc/blocks_random_pdu.xml
deleted file mode 100644
index a70fa7fbf..000000000
--- a/gr-blocks/grc/blocks_random_pdu.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Random PDU
-###################################################
- -->
-<block>
- <name>Random PDU Generator</name>
- <key>blocks_random_pdu</key>
- <import>from gnuradio import blocks</import>
- <import>import pmt</import>
- <make>blocks.random_pdu($minsize, $maxsize, chr($mask), $length_modulo)</make>
- <param>
- <name>Min Bytes</name>
- <key>minsize</key>
- <value>50</value>
- <type>int</type>
- </param>
- <param>
- <name>Max Bytes</name>
- <key>maxsize</key>
- <value>2000</value>
- <type>int</type>
- </param>
- <param>
- <name>Byte Mask</name>
- <key>mask</key>
- <value>0xFF</value>
- <type>int</type>
- </param>
- <param>
- <name>Length Modulo</name>
- <key>length_modulo</key>
- <value>2</value>
- <type>int</type>
- </param>
- <sink>
- <name>generate</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
- <source>
- <name>pdus</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_regenerate_bb.block.yml b/gr-blocks/grc/blocks_regenerate_bb.block.yml
new file mode 100644
index 000000000..843e680a4
--- /dev/null
+++ b/gr-blocks/grc/blocks_regenerate_bb.block.yml
@@ -0,0 +1,25 @@
+id: blocks_regenerate_bb
+label: Regenerate
+
+parameters:
+- id: period
+ label: Period
+ dtype: int
+- id: max_regen
+ label: Max Regen Count
+ dtype: int
+ default: '500'
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.regenerate_bb(${period}, ${max_regen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_regenerate_bb.xml b/gr-blocks/grc/blocks_regenerate_bb.xml
deleted file mode 100644
index bbee53387..000000000
--- a/gr-blocks/grc/blocks_regenerate_bb.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Regenerate Block:
-## char in/ char out
-###################################################
- -->
-<block>
- <name>Regenerate</name>
- <key>blocks_regenerate_bb</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.regenerate_bb($period, $max_regen)</make>
- <param>
- <name>Period</name>
- <key>period</key>
- <type>int</type>
- </param>
- <param>
- <name>Max Regen Count</name>
- <key>max_regen</key>
- <value>500</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_repack_bits_bb.block.yml b/gr-blocks/grc/blocks_repack_bits_bb.block.yml
new file mode 100644
index 000000000..9d5a3ba9c
--- /dev/null
+++ b/gr-blocks/grc/blocks_repack_bits_bb.block.yml
@@ -0,0 +1,47 @@
+id: blocks_repack_bits_bb
+label: Repack Bits
+
+parameters:
+- id: k
+ label: Bits per input byte
+ dtype: int
+ default: '1'
+- id: l
+ label: Bits per output byte
+ dtype: int
+ default: '8'
+- id: len_tag_key
+ label: Length Tag Key
+ dtype: string
+ default: '""'
+ hide: part
+- id: align_output
+ label: Packet Alignment
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: [Output, Input]
+ hide: part
+- id: endianness
+ label: Endianness
+ dtype: int
+ default: gr.GR_LSB_FIRST
+ options: [gr.GR_MSB_FIRST, gr.GR_LSB_FIRST]
+ option_labels: [MSB, LSB]
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.repack_bits_bb(${k}, ${l}, ${len_tag_key}, ${align_output}, ${endianness})
+ callbacks:
+ - set_k_and_l(${k},${l})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_repack_bits_bb.xml b/gr-blocks/grc/blocks_repack_bits_bb.xml
deleted file mode 100644
index 0c107d843..000000000
--- a/gr-blocks/grc/blocks_repack_bits_bb.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<block>
- <name>Repack Bits</name>
- <key>blocks_repack_bits_bb</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.repack_bits_bb($k, $l, $len_tag_key, $align_output, $endianness)</make>
- <callback>set_k_and_l($k,$l)</callback>
- <param>
- <name>Bits per input byte</name>
- <key>k</key>
- <value>1</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Bits per output byte</name>
- <key>l</key>
- <value>8</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Length Tag Key</name>
- <key>len_tag_key</key>
- <value>""</value>
- <type>string</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Packet Alignment</name>
- <key>align_output</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Output</name>
- <key>True</key>
- </option>
- <option>
- <name>Input</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Endianness</name>
- <key>endianness</key>
- <value>gr.GR_LSB_FIRST</value>
- <type>int</type>
- <hide>part</hide>
- <option>
- <name>MSB</name>
- <key>gr.GR_MSB_FIRST</key>
- </option>
- <option>
- <name>LSB</name>
- <key>gr.GR_LSB_FIRST</key>
- </option>
- </param>
-
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_repeat.block.yml b/gr-blocks/grc/blocks_repeat.block.yml
new file mode 100644
index 000000000..809231d29
--- /dev/null
+++ b/gr-blocks/grc/blocks_repeat.block.yml
@@ -0,0 +1,41 @@
+id: blocks_repeat
+label: Repeat
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: interp
+ label: Interpolation
+ dtype: int
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.repeat(${type.size}*${vlen}, ${interp})
+ callbacks:
+ - set_interpolation(${interp})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_repeat.xml b/gr-blocks/grc/blocks_repeat.xml
deleted file mode 100644
index 793d0148b..000000000
--- a/gr-blocks/grc/blocks_repeat.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Repeat
-###################################################
- -->
-<block>
- <name>Repeat</name>
- <key>blocks_repeat</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.repeat($type.size*$vlen, $interp)</make>
- <callback>set_interpolation($interp)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Interpolation</name>
- <key>interp</key>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_rms_xx.block.yml b/gr-blocks/grc/blocks_rms_xx.block.yml
new file mode 100644
index 000000000..ca5e8df12
--- /dev/null
+++ b/gr-blocks/grc/blocks_rms_xx.block.yml
@@ -0,0 +1,31 @@
+id: blocks_rms_xx
+label: RMS
+
+parameters:
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [complex, float]
+ option_attributes:
+ fcn: [c, f]
+ hide: part
+- id: alpha
+ label: Alpha
+ dtype: real
+ default: '0.0001'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.rms_${type.fcn}f(${alpha})
+ callbacks:
+ - set_alpha(${alpha})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_rms_xx.xml b/gr-blocks/grc/blocks_rms_xx.xml
deleted file mode 100644
index 0ae09139a..000000000
--- a/gr-blocks/grc/blocks_rms_xx.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##RMS
-###################################################
- -->
-<block>
- <name>RMS</name>
- <key>blocks_rms_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.rms_$(type.fcn)f($alpha)</make>
- <callback>set_alpha($alpha)</callback>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- </option>
- </param>
- <param>
- <name>Alpha</name>
- <key>alpha</key>
- <value>0.0001</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_rotator_cc.block.yml b/gr-blocks/grc/blocks_rotator_cc.block.yml
new file mode 100644
index 000000000..d65fbd599
--- /dev/null
+++ b/gr-blocks/grc/blocks_rotator_cc.block.yml
@@ -0,0 +1,24 @@
+id: blocks_rotator_cc
+label: Rotator
+
+parameters:
+- id: phase_inc
+ label: Phase Increment
+ dtype: real
+ default: '0.0'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.rotator_cc(${phase_inc})
+ callbacks:
+ - set_phase_inc(${phase_inc})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_rotator_cc.xml b/gr-blocks/grc/blocks_rotator_cc.xml
deleted file mode 100644
index aa011b80e..000000000
--- a/gr-blocks/grc/blocks_rotator_cc.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Complex rotator
-###################################################
- -->
-<block>
- <name>Rotator</name>
- <key>blocks_rotator_cc</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.rotator_cc($phase_inc)</make>
- <callback>set_phase_inc($phase_inc)</callback>
- <param>
- <name>Phase Increment</name>
- <key>phase_inc</key>
- <value>0.0</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_sample_and_hold_xx.block.yml b/gr-blocks/grc/blocks_sample_and_hold_xx.block.yml
new file mode 100644
index 000000000..893e7862b
--- /dev/null
+++ b/gr-blocks/grc/blocks_sample_and_hold_xx.block.yml
@@ -0,0 +1,28 @@
+id: blocks_sample_and_hold_xx
+label: Sample and Hold
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [float, int, short, byte]
+ option_attributes:
+ fcn: [ff, ii, ss, bb]
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+- label: ctrl
+ domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.sample_and_hold_${type.fcn}()
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_sample_and_hold_xx.xml b/gr-blocks/grc/blocks_sample_and_hold_xx.xml
deleted file mode 100644
index 1583204c0..000000000
--- a/gr-blocks/grc/blocks_sample_and_hold_xx.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Sample and Hold
-###################################################
- -->
-<block>
- <name>Sample and Hold</name>
- <key>blocks_sample_and_hold_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.sample_and_hold_$(type.fcn)()</make>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:bb</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <sink>
- <name>ctrl</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_short_to_char.block.yml b/gr-blocks/grc/blocks_short_to_char.block.yml
new file mode 100644
index 000000000..d24df725d
--- /dev/null
+++ b/gr-blocks/grc/blocks_short_to_char.block.yml
@@ -0,0 +1,25 @@
+id: blocks_short_to_char
+label: Short To Char
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: short
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.short_to_char(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_short_to_char.xml b/gr-blocks/grc/blocks_short_to_char.xml
deleted file mode 100644
index 1951333d1..000000000
--- a/gr-blocks/grc/blocks_short_to_char.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Short to char:
-###################################################
- -->
-<block>
- <name>Short To Char</name>
- <key>blocks_short_to_char</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.short_to_char($vlen)</make>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>short</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_short_to_float.block.yml b/gr-blocks/grc/blocks_short_to_float.block.yml
new file mode 100644
index 000000000..8ad5f7ed1
--- /dev/null
+++ b/gr-blocks/grc/blocks_short_to_float.block.yml
@@ -0,0 +1,31 @@
+id: blocks_short_to_float
+label: Short To Float
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: scale
+ label: Scale
+ dtype: real
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: short
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: float
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.short_to_float(${vlen}, ${scale})
+ callbacks:
+ - set_scale(${scale})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_short_to_float.xml b/gr-blocks/grc/blocks_short_to_float.xml
deleted file mode 100644
index 23ea019bc..000000000
--- a/gr-blocks/grc/blocks_short_to_float.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Short to Float:
-###################################################
- -->
-<block>
- <name>Short To Float</name>
- <key>blocks_short_to_float</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.short_to_float($vlen, $scale)</make>
- <callback>set_scale($scale)</callback>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Scale</name>
- <key>scale</key>
- <value>1</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>short</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_skiphead.block.yml b/gr-blocks/grc/blocks_skiphead.block.yml
new file mode 100644
index 000000000..c0f10eb2d
--- /dev/null
+++ b/gr-blocks/grc/blocks_skiphead.block.yml
@@ -0,0 +1,40 @@
+id: blocks_skiphead
+label: Skip Head
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: num_items
+ label: Num Items
+ dtype: int
+ default: '1024'
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.skiphead(${type.size}*${vlen}, ${num_items})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_skiphead.xml b/gr-blocks/grc/blocks_skiphead.xml
deleted file mode 100644
index 7d9086283..000000000
--- a/gr-blocks/grc/blocks_skiphead.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Skip Head
-###################################################
- -->
-<block>
- <name>Skip Head</name>
- <key>blocks_skiphead</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.skiphead($type.size*$vlen, $num_items)</make>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Num Items</name>
- <key>num_items</key>
- <value>1024</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_socket_pdu.block.yml b/gr-blocks/grc/blocks_socket_pdu.block.yml
new file mode 100644
index 000000000..986921904
--- /dev/null
+++ b/gr-blocks/grc/blocks_socket_pdu.block.yml
@@ -0,0 +1,63 @@
+id: blocks_socket_pdu
+label: Socket PDU
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ default: TCP_SERVER
+ options: ['"TCP_SERVER"', '"TCP_CLIENT"', '"UDP_SERVER"', '"UDP_CLIENT"']
+ option_labels: [TCP Server, TCP Client, UDP Server, UDP Client]
+- id: host
+ label: Host
+ dtype: string
+- id: port
+ label: Port
+ dtype: string
+ default: '52001'
+- id: mtu
+ label: MTU
+ dtype: int
+ default: '10000'
+- id: tcp_no_delay
+ label: TCP No Delay
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: [Enabled, Disabled]
+ hide: '${ #if ((type == ''"TCP_CLIENT"'') or (type == ''"TCP_SERVER"''))
+
+ #if (str(tcp_no_delay) == ''False'')
+
+ part
+
+ #else
+
+ none
+
+ #end if
+
+ #else
+
+ all
+
+ #end if }'
+
+inputs:
+- domain: message
+ id: pdus
+ optional: true
+
+outputs:
+- domain: message
+ id: pdus
+ optional: true
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.socket_pdu(${type}, ${host}, ${port}, ${mtu}, ${tcp_no_delay})
+
+documentation: |-
+ For server modes, leave Host blank to bind to all interfaces (equivalent to 0.0.0.0).
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_socket_pdu.xml b/gr-blocks/grc/blocks_socket_pdu.xml
deleted file mode 100644
index 72dc38134..000000000
--- a/gr-blocks/grc/blocks_socket_pdu.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Socket PDU Message source/sink
-###################################################
- -->
-<block>
- <name>Socket PDU</name>
- <key>blocks_socket_pdu</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.socket_pdu($type, $host, $port, $mtu, $tcp_no_delay)</make>
- <param>
- <name>Type</name>
- <key>type</key>
- <value>TCP_SERVER</value>
- <type>enum</type>
- <option>
- <name>TCP Server</name>
- <key>"TCP_SERVER"</key>
- </option>
- <option>
- <name>TCP Client</name>
- <key>"TCP_CLIENT"</key>
- </option>
- <option>
- <name>UDP Server</name>
- <key>"UDP_SERVER"</key>
- </option>
- <option>
- <name>UDP Client</name>
- <key>"UDP_CLIENT"</key>
- </option>
- </param>
- <param>
- <name>Host</name>
- <key>host</key>
- <value></value>
- <type>string</type>
- </param>
- <param>
- <name>Port</name>
- <key>port</key>
- <value>52001</value>
- <type>string</type>
- </param>
- <param>
- <name>MTU</name>
- <key>mtu</key>
- <value>10000</value>
- <type>int</type>
- </param>
- <param>
- <name>TCP No Delay</name>
- <key>tcp_no_delay</key>
- <value>False</value>
- <type>enum</type>
- <hide>
-#if (($type() == '"TCP_CLIENT"') or ($type() == '"TCP_SERVER"'))
-#if (str($tcp_no_delay()) == 'False')
-part
-#else
-none
-#end if
-#else
-all
-#end if
-</hide>
- <option>
- <name>Enabled</name>
- <key>True</key>
- </option>
- <option>
- <name>Disabled</name>
- <key>False</key>
- </option>
- </param>
- <sink>
- <name>pdus</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
- <source>
- <name>pdus</name>
- <type>message</type>
- <optional>1</optional>
- </source>
- <doc>For server modes, leave Host blank to bind to all interfaces (equivalent to 0.0.0.0).</doc>
-</block>
diff --git a/gr-blocks/grc/blocks_stream_mux.block.yml b/gr-blocks/grc/blocks_stream_mux.block.yml
new file mode 100644
index 000000000..27d3baf89
--- /dev/null
+++ b/gr-blocks/grc/blocks_stream_mux.block.yml
@@ -0,0 +1,48 @@
+id: blocks_stream_mux
+label: Stream Mux
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: lengths
+ label: Lengths
+ dtype: int_vector
+ default: 1, 1
+- id: num_inputs
+ label: Num Inputs
+ dtype: int
+ default: '2'
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_inputs }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ num_inputs > 0 }
+- ${ num_inputs == len(lengths) }
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.stream_mux(${type.size}*${vlen}, ${lengths})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_stream_mux.xml b/gr-blocks/grc/blocks_stream_mux.xml
deleted file mode 100644
index 5e56a65d9..000000000
--- a/gr-blocks/grc/blocks_stream_mux.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Stream Mux:
-## all types, many inputs, only one output
-###################################################
- -->
-<block>
- <name>Stream Mux</name>
- <key>blocks_stream_mux</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.stream_mux($type.size*$vlen, $lengths)</make>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Lengths</name>
- <key>lengths</key>
- <value>1, 1</value>
- <type>int_vector</type>
- </param>
- <param>
- <name>Num Inputs</name>
- <key>num_inputs</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_inputs &gt; 0</check>
- <check>$num_inputs == len($lengths)</check>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_inputs</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_stream_to_streams.block.yml b/gr-blocks/grc/blocks_stream_to_streams.block.yml
new file mode 100644
index 000000000..16adb159a
--- /dev/null
+++ b/gr-blocks/grc/blocks_stream_to_streams.block.yml
@@ -0,0 +1,43 @@
+id: blocks_stream_to_streams
+label: Stream to Streams
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: num_streams
+ label: Num Streams
+ dtype: int
+ default: '2'
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_streams }
+
+asserts:
+- ${ num_streams > 0 }
+- ${ vlen >= 1 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.stream_to_streams(${type.size}*${vlen}, ${num_streams})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_stream_to_streams.xml b/gr-blocks/grc/blocks_stream_to_streams.xml
deleted file mode 100644
index c164e477b..000000000
--- a/gr-blocks/grc/blocks_stream_to_streams.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Stream to Streams
-###################################################
- -->
-<block>
- <name>Stream to Streams</name>
- <key>blocks_stream_to_streams</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.stream_to_streams($type.size*$vlen, $num_streams)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Num Streams</name>
- <key>num_streams</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_streams &gt; 0</check>
- <check>$vlen &gt;= 1</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_streams</nports>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_stream_to_tagged_stream.block.yml b/gr-blocks/grc/blocks_stream_to_tagged_stream.block.yml
new file mode 100644
index 000000000..db75c20dd
--- /dev/null
+++ b/gr-blocks/grc/blocks_stream_to_tagged_stream.block.yml
@@ -0,0 +1,43 @@
+id: blocks_stream_to_tagged_stream
+label: Stream to Tagged Stream
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: vlen
+ label: Vector Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: packet_len
+ label: Packet Length
+ dtype: int
+- id: len_tag_key
+ label: Length Tag Key
+ dtype: string
+ default: '"packet_len"'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.stream_to_tagged_stream(${type.size}, ${vlen}, ${packet_len}, ${len_tag_key})
+ callbacks:
+ - set_packet_len(${packet_len})
+ - set_packet_len_pmt(${packet_len})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_stream_to_tagged_stream.xml b/gr-blocks/grc/blocks_stream_to_tagged_stream.xml
deleted file mode 100644
index c2af70c2a..000000000
--- a/gr-blocks/grc/blocks_stream_to_tagged_stream.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>Stream to Tagged Stream</name>
- <key>blocks_stream_to_tagged_stream</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.stream_to_tagged_stream($type.size, $vlen, $packet_len, $len_tag_key)</make>
- <callback>set_packet_len($packet_len)</callback>
- <callback>set_packet_len_pmt($packet_len)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Vector Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Packet Length</name>
- <key>packet_len</key>
- <type>int</type>
- </param>
- <param>
- <name>Length Tag Key</name>
- <key>len_tag_key</key>
- <value>"packet_len"</value>
- <type>string</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_stream_to_vector.block.yml b/gr-blocks/grc/blocks_stream_to_vector.block.yml
new file mode 100644
index 000000000..73e177d0c
--- /dev/null
+++ b/gr-blocks/grc/blocks_stream_to_vector.block.yml
@@ -0,0 +1,42 @@
+id: blocks_stream_to_vector
+label: Stream to Vector
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: num_items
+ label: Num Items
+ dtype: int
+ default: '2'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen*num_items }
+
+asserts:
+- ${ num_items > 0 }
+- ${ vlen >= 1 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.stream_to_vector(${type.size}*${vlen}, ${num_items})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_stream_to_vector.xml b/gr-blocks/grc/blocks_stream_to_vector.xml
deleted file mode 100644
index 8965dfbfe..000000000
--- a/gr-blocks/grc/blocks_stream_to_vector.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Stream to Vector
-###################################################
- -->
-<block>
- <name>Stream to Vector</name>
- <key>blocks_stream_to_vector</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.stream_to_vector($type.size*$vlen, $num_items)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Num Items</name>
- <key>num_items</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_items &gt; 0</check>
- <check>$vlen &gt;= 1</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen*$num_items</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_stream_to_vector_decimator.block.yml b/gr-blocks/grc/blocks_stream_to_vector_decimator.block.yml
new file mode 100644
index 000000000..7c48016de
--- /dev/null
+++ b/gr-blocks/grc/blocks_stream_to_vector_decimator.block.yml
@@ -0,0 +1,47 @@
+id: blocks_stream_to_vector_decimator
+label: Stream to Vec Decim
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: sample_rate
+ label: Sample Rate
+ dtype: real
+ default: samp_rate
+- id: vec_rate
+ label: Vec Rate
+ dtype: real
+ default: '30'
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1024'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen >= 1 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: "blocks.stream_to_vector_decimator(\n\titem_size=${type.size},\n\tsample_rate=${sample_rate},\n\
+ \tvec_rate=${vec_rate},\n\tvec_len=${vlen},\n)"
+ callbacks:
+ - set_sample_rate(${sample_rate})
+ - set_vec_rate(${vec_rate})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_stream_to_vector_decimator.xml b/gr-blocks/grc/blocks_stream_to_vector_decimator.xml
deleted file mode 100644
index ca71cf17f..000000000
--- a/gr-blocks/grc/blocks_stream_to_vector_decimator.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Stream to Vector Decimator
-###################################################
- -->
-<block>
- <name>Stream to Vec Decim</name>
- <key>blocks_stream_to_vector_decimator</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.stream_to_vector_decimator(
- item_size=$type.size,
- sample_rate=$sample_rate,
- vec_rate=$vec_rate,
- vec_len=$vlen,
-)</make>
- <callback>set_sample_rate($sample_rate)</callback>
- <callback>set_vec_rate($vec_rate)</callback>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Sample Rate</name>
- <key>sample_rate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>Vec Rate</name>
- <key>vec_rate</key>
- <value>30</value>
- <type>real</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1024</value>
- <type>int</type>
- </param>
- <check>$vlen &gt;= 1</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_streams_to_stream.block.yml b/gr-blocks/grc/blocks_streams_to_stream.block.yml
new file mode 100644
index 000000000..404fcb012
--- /dev/null
+++ b/gr-blocks/grc/blocks_streams_to_stream.block.yml
@@ -0,0 +1,43 @@
+id: blocks_streams_to_stream
+label: Streams to Stream
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: num_streams
+ label: Num Streams
+ dtype: int
+ default: '2'
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_streams }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ num_streams > 0 }
+- ${ vlen >= 1 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.streams_to_stream(${type.size}*${vlen}, ${num_streams})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_streams_to_stream.xml b/gr-blocks/grc/blocks_streams_to_stream.xml
deleted file mode 100644
index 2aa17dbe2..000000000
--- a/gr-blocks/grc/blocks_streams_to_stream.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Streams to Stream
-###################################################
- -->
-<block>
- <name>Streams to Stream</name>
- <key>blocks_streams_to_stream</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.streams_to_stream($type.size*$vlen, $num_streams)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Num Streams</name>
- <key>num_streams</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_streams &gt; 0</check>
- <check>$vlen &gt;= 1</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_streams</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_streams_to_vector.block.yml b/gr-blocks/grc/blocks_streams_to_vector.block.yml
new file mode 100644
index 000000000..d16d1e938
--- /dev/null
+++ b/gr-blocks/grc/blocks_streams_to_vector.block.yml
@@ -0,0 +1,43 @@
+id: blocks_streams_to_vector
+label: Streams to Vector
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: num_streams
+ label: Num Streams
+ dtype: int
+ default: '2'
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_streams }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen*num_streams }
+
+asserts:
+- ${ num_streams > 0 }
+- ${ vlen >= 1 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.streams_to_vector(${type.size}*${vlen}, ${num_streams})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_streams_to_vector.xml b/gr-blocks/grc/blocks_streams_to_vector.xml
deleted file mode 100644
index dc371f021..000000000
--- a/gr-blocks/grc/blocks_streams_to_vector.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Streams to Vector
-###################################################
- -->
-<block>
- <name>Streams to Vector</name>
- <key>blocks_streams_to_vector</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.streams_to_vector($type.size*$vlen, $num_streams)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Num Streams</name>
- <key>num_streams</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_streams &gt; 0</check>
- <check>$vlen &gt;= 1</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_streams</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen*$num_streams</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_stretch_ff.block.yml b/gr-blocks/grc/blocks_stretch_ff.block.yml
new file mode 100644
index 000000000..95921538c
--- /dev/null
+++ b/gr-blocks/grc/blocks_stretch_ff.block.yml
@@ -0,0 +1,28 @@
+id: blocks_stretch_ff
+label: Stretch
+
+parameters:
+- id: lo
+ label: Low
+ dtype: real
+- id: vlen
+ label: Vec. Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: float
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: float
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.stretch_ff(${lo}, ${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_stretch_ff.xml b/gr-blocks/grc/blocks_stretch_ff.xml
deleted file mode 100644
index 00a67602b..000000000
--- a/gr-blocks/grc/blocks_stretch_ff.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Stretch Block:
-## float in / float out
-###################################################
- -->
-<block>
- <name>Stretch</name>
- <key>blocks_stretch_ff</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.stretch_ff($lo, $vlen)</make>
- <param>
- <name>Low</name>
- <key>lo</key>
- <type>real</type>
- </param>
- <param>
- <name>Vec. Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_sub_xx.block.yml b/gr-blocks/grc/blocks_sub_xx.block.yml
new file mode 100644
index 000000000..0cfab0940
--- /dev/null
+++ b/gr-blocks/grc/blocks_sub_xx.block.yml
@@ -0,0 +1,42 @@
+id: blocks_sub_xx
+label: Subtract
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short]
+ option_attributes:
+ fcn: [cc, ff, ii, ss]
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: num_inputs
+ label: Num Inputs
+ dtype: int
+ default: '2'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_inputs }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+- ${ num_inputs >= 1 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.sub_${type.fcn}(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_sub_xx.xml b/gr-blocks/grc/blocks_sub_xx.xml
deleted file mode 100644
index 88b5ccbb5..000000000
--- a/gr-blocks/grc/blocks_sub_xx.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Subtract Block:
-## all types, 1 output, 2 to inf inputs
-###################################################
- -->
-<block>
- <name>Subtract</name>
- <key>blocks_sub_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.sub_$(type.fcn)($vlen)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- </option>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Num Inputs</name>
- <key>num_inputs</key>
- <value>2</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <check>$num_inputs &gt;= 1</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_inputs</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_tag_debug.block.yml b/gr-blocks/grc/blocks_tag_debug.block.yml
new file mode 100644
index 000000000..f6fe4eff6
--- /dev/null
+++ b/gr-blocks/grc/blocks_tag_debug.block.yml
@@ -0,0 +1,53 @@
+id: blocks_tag_debug
+label: Tag Debug
+
+parameters:
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: name
+ label: Name
+ dtype: string
+- id: filter
+ label: Key Filter
+ dtype: string
+ default: '""'
+- id: num_inputs
+ label: Num Inputs
+ dtype: int
+ default: '1'
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: display
+ label: Display
+ dtype: bool
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_inputs }
+
+asserts:
+- ${ num_inputs >= 1 }
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.tag_debug(${type.size}*${vlen}, ${name}, ${filter}); self.${id}.set_display(${display})
+ callbacks:
+ - set_display(${display})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_tag_debug.xml b/gr-blocks/grc/blocks_tag_debug.xml
deleted file mode 100644
index 03dd147cb..000000000
--- a/gr-blocks/grc/blocks_tag_debug.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Tag Debug
-###################################################
- -->
-<block>
- <name>Tag Debug</name>
- <key>blocks_tag_debug</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.tag_debug($type.size*$vlen, $name, $filter); self.$(id).set_display($display)</make>
- <callback>set_display($display)</callback>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Name</name>
- <key>name</key>
- <type>string</type>
- </param>
- <param>
- <name>Key Filter</name>
- <key>filter</key>
- <value>""</value>
- <type>string</type>
- </param>
- <param>
- <name>Num Inputs</name>
- <key>num_inputs</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Display</name>
- <key>display</key>
- <value>True</value>
- <type>bool</type>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <check>$num_inputs &gt;= 1</check>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_inputs</nports>
- </sink>
-</block>
diff --git a/gr-blocks/grc/blocks_tag_gate.block.yml b/gr-blocks/grc/blocks_tag_gate.block.yml
new file mode 100644
index 000000000..a05ee3c27
--- /dev/null
+++ b/gr-blocks/grc/blocks_tag_gate.block.yml
@@ -0,0 +1,50 @@
+id: blocks_tag_gate
+label: Tag Gate
+
+parameters:
+- id: type
+ label: Item Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: propagate_tags
+ label: Propagate Tags
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: single_key
+ label: Single Key
+ dtype: string
+ default: '""'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: |-
+ blocks.tag_gate(${type.size} * ${vlen}, ${propagate_tags})
+ self.${id}.set_single_key(${single_key})
+ callbacks:
+ - self.${id}.set_single_key(${single_key})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_tag_gate.xml b/gr-blocks/grc/blocks_tag_gate.xml
deleted file mode 100644
index 0cf6dc42e..000000000
--- a/gr-blocks/grc/blocks_tag_gate.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>Tag Gate</name>
- <key>blocks_tag_gate</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.tag_gate($type.size * $vlen, $propagate_tags)
-self.$(id).set_single_key($single_key)</make>
- <callback>self.$(id).set_single_key($single_key)</callback>
-
- <param>
- <name>Item Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Propagate Tags</name>
- <key>propagate_tags</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Single Key</name>
- <key>single_key</key>
- <value>""</value>
- <type>string</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_tag_object.block.yml b/gr-blocks/grc/blocks_tag_object.block.yml
new file mode 100644
index 000000000..cf0f99647
--- /dev/null
+++ b/gr-blocks/grc/blocks_tag_object.block.yml
@@ -0,0 +1,44 @@
+id: variable_tag_object
+label: Tag Object
+
+parameters:
+- id: offset
+ label: Offset
+ dtype: int
+ default: '0'
+- id: key
+ label: Key
+ dtype: raw
+ default: pmt.intern("key")
+- id: value
+ label: Value
+ dtype: raw
+ default: pmt.intern("value")
+- id: src
+ label: Source ID
+ dtype: raw
+ default: pmt.intern("src")
+value: ${ value }
+
+templates:
+ imports: import pmt
+ var_make: self.${id} = ${id} = gr.tag_utils.python_to_tag((${offset}, ${key},
+ ${value}, ${src}))
+ callbacks:
+ - self.set_${id}(gr.tag_utils.python_to_tag((${offset}, ${key}, ${value}, ${src})))
+
+documentation: |-
+ This block creates a tag object. While tags are based on an
+ absolute offset, this is based on a relative offset that must be
+ appropriately translated by the block using it. For example, this
+ is used by the vector_source blocks, which will treat a 0 offset
+ in the tag as the first item in the stream when the vector starts
+ or repeats.
+
+ The tag objects are created using the python_to_tag Python
+ function to make it easy to generate a tag_t in Python. The call
+ looks like:
+
+ gr.tag_utils.python_to_tag(($offset, $key, $value, $src))
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_tag_object.xml b/gr-blocks/grc/blocks_tag_object.xml
deleted file mode 100644
index 7352d801a..000000000
--- a/gr-blocks/grc/blocks_tag_object.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Tag Object: creates a tag
-###################################################
- -->
-<block>
- <name>Tag Object</name>
- <key>variable_tag_object</key>
- <import>import pmt</import>
- <var_make>self.$(id) = $(id) = gr.tag_utils.python_to_tag(($offset, $key, $value, $src))</var_make>
- <make></make>
- <callback>self.set_$(id)(gr.tag_utils.python_to_tag(($offset, $key, $value, $src)))</callback>
- <param>
- <name>Offset</name>
- <key>offset</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Key</name>
- <key>key</key>
- <value>pmt.intern("key")</value>
- <type>raw</type>
- </param>
- <param>
- <name>Value</name>
- <key>value</key>
- <value>pmt.intern("value")</value>
- <type>raw</type>
- </param>
- <param>
- <name>Source ID</name>
- <key>src</key>
- <value>pmt.intern("src")</value>
- <type>raw</type>
- </param>
- <doc>
- This block creates a tag object. While tags are based on an
- absolute offset, this is based on a relative offset that must be
- appropriately translated by the block using it. For example, this
- is used by the vector_source blocks, which will treat a 0 offset
- in the tag as the first item in the stream when the vector starts
- or repeats.
-
- The tag objects are created using the python_to_tag Python
- function to make it easy to generate a tag_t in Python. The call
- looks like:
-
- gr.tag_utils.python_to_tag(($offset, $key, $value, $src))
- </doc>
-</block>
diff --git a/gr-blocks/grc/blocks_tag_share.block.yml b/gr-blocks/grc/blocks_tag_share.block.yml
new file mode 100644
index 000000000..96096ef58
--- /dev/null
+++ b/gr-blocks/grc/blocks_tag_share.block.yml
@@ -0,0 +1,48 @@
+id: blocks_tag_share
+label: Tag Share
+
+parameters:
+- id: io_type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: share_type
+ label: Share Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ io_type }
+ vlen: ${ vlen }
+- label: share
+ domain: stream
+ dtype: ${ share_type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ io_type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.tag_share(${io_type.size}, ${share_type.size}, ${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_tag_share.xml b/gr-blocks/grc/blocks_tag_share.xml
deleted file mode 100644
index 21827d059..000000000
--- a/gr-blocks/grc/blocks_tag_share.xml
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>Tag Share</name>
- <key>blocks_tag_share</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.tag_share($io_type.size, $share_type.size, $vlen)</make>
-
- <param>
- <name>IO Type</name>
- <key>io_type</key>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Share Type</name>
- <key>share_type</key>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- <hide>part</hide>
- </param>
-
- <check>$vlen &gt; 0</check>
-
- <sink>
- <name>in</name>
- <type>$io_type</type>
- <vlen>$vlen</vlen>
- </sink>
- <sink>
- <name>share</name>
- <type>$share_type</type>
- <vlen>$vlen</vlen>
- </sink>
-
- <source>
- <name>out</name>
- <type>$io_type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_tagged_file_sink.block.yml b/gr-blocks/grc/blocks_tagged_file_sink.block.yml
new file mode 100644
index 000000000..f70c78154
--- /dev/null
+++ b/gr-blocks/grc/blocks_tagged_file_sink.block.yml
@@ -0,0 +1,35 @@
+id: blocks_tagged_file_sink
+label: Tagged File Sink
+
+parameters:
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: samp_rate
+ label: Sample Rate
+ dtype: int
+ default: samp_rate
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.tagged_file_sink(${type.size}*${vlen}, ${samp_rate})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_tagged_file_sink.xml b/gr-blocks/grc/blocks_tagged_file_sink.xml
deleted file mode 100644
index a849c48c9..000000000
--- a/gr-blocks/grc/blocks_tagged_file_sink.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Tagged File Sink
-###################################################
- -->
-<block>
- <name>Tagged File Sink</name>
- <key>blocks_tagged_file_sink</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.tagged_file_sink($type.size*$vlen, $samp_rate)</make>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
-</block>
diff --git a/gr-blocks/grc/blocks_tagged_stream_align.block.yml b/gr-blocks/grc/blocks_tagged_stream_align.block.yml
new file mode 100644
index 000000000..cfc5a7717
--- /dev/null
+++ b/gr-blocks/grc/blocks_tagged_stream_align.block.yml
@@ -0,0 +1,37 @@
+id: blocks_tagged_stream_align
+label: Tagged Stream Align
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: lengthtagname
+ label: Length tag names
+ dtype: string
+ default: packet_len
+- id: vlen
+ label: Vector Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.tagged_stream_align(${type.size}*${vlen}, ${lengthtagname})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_tagged_stream_align.xml b/gr-blocks/grc/blocks_tagged_stream_align.xml
deleted file mode 100644
index be0238d52..000000000
--- a/gr-blocks/grc/blocks_tagged_stream_align.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<block>
- <name>Tagged Stream Align</name>
- <key>blocks_tagged_stream_align</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.tagged_stream_align($type.size*$vlen, $lengthtagname)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Length tag names</name>
- <key>lengthtagname</key>
- <value>packet_len</value>
- <type>string</type>
- </param>
- <param>
- <name>Vector Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
-
diff --git a/gr-blocks/grc/blocks_tagged_stream_multiply_length.block.yml b/gr-blocks/grc/blocks_tagged_stream_multiply_length.block.yml
new file mode 100644
index 000000000..90fbcf0c2
--- /dev/null
+++ b/gr-blocks/grc/blocks_tagged_stream_multiply_length.block.yml
@@ -0,0 +1,46 @@
+id: blocks_tagged_stream_multiply_length
+label: Tagged Stream Multiply Length Tag
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: lengthtagname
+ label: Length tag names
+ dtype: string
+- id: vlen
+ label: Vector Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: c
+ label: Length Scalar
+ dtype: real
+ default: '1.0'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+- domain: message
+ id: set_scalar
+ optional: true
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.tagged_stream_multiply_length(${type.size}*${vlen}, ${lengthtagname},
+ ${c})
+ callbacks:
+ - set_scalar(${c})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_tagged_stream_multiply_length.xml b/gr-blocks/grc/blocks_tagged_stream_multiply_length.xml
deleted file mode 100644
index f4abb9290..000000000
--- a/gr-blocks/grc/blocks_tagged_stream_multiply_length.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<block>
- <name>Tagged Stream Multiply Length Tag</name>
- <key>blocks_tagged_stream_multiply_length</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.tagged_stream_multiply_length($type.size*$vlen, $lengthtagname, $c)</make>
- <callback>set_scalar($c)</callback>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Length tag names</name>
- <key>lengthtagname</key>
- <type>string</type>
- </param>
- <param>
- <name>Vector Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Length Scalar</name>
- <key>c</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <sink>
- <name>set_scalar</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
-
diff --git a/gr-blocks/grc/blocks_tagged_stream_mux.block.yml b/gr-blocks/grc/blocks_tagged_stream_mux.block.yml
new file mode 100644
index 000000000..4807e95d2
--- /dev/null
+++ b/gr-blocks/grc/blocks_tagged_stream_mux.block.yml
@@ -0,0 +1,46 @@
+id: blocks_tagged_stream_mux
+label: Tagged Stream Mux
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: ninputs
+ label: Number of inputs
+ dtype: int
+ hide: part
+- id: lengthtagname
+ label: Length tag names
+ dtype: string
+- id: vlen
+ label: Vector Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: tag_preserve_head_pos
+ label: 'Tags: Preserve head position on input'
+ dtype: int
+ default: '0'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ ninputs }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.tagged_stream_mux(${type.size}*${vlen}, ${lengthtagname}, ${tag_preserve_head_pos})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_tagged_stream_mux.xml b/gr-blocks/grc/blocks_tagged_stream_mux.xml
deleted file mode 100644
index 221a2ed7f..000000000
--- a/gr-blocks/grc/blocks_tagged_stream_mux.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<block>
- <name>Tagged Stream Mux</name>
- <key>blocks_tagged_stream_mux</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.tagged_stream_mux($type.size*$vlen, $lengthtagname, $tag_preserve_head_pos)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Number of inputs</name>
- <key>ninputs</key>
- <type>int</type>
- </param>
- <param>
- <name>Length tag names</name>
- <key>lengthtagname</key>
- <type>string</type>
- </param>
- <param>
- <name>Vector Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Tags: Preserve head position on input</name>
- <key>tag_preserve_head_pos</key>
- <value>0</value>
- <type>int</type>
- <hide>part</hide>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$ninputs</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
-
diff --git a/gr-blocks/grc/blocks_tagged_stream_to_pdu.block.yml b/gr-blocks/grc/blocks_tagged_stream_to_pdu.block.yml
new file mode 100644
index 000000000..e2292adb2
--- /dev/null
+++ b/gr-blocks/grc/blocks_tagged_stream_to_pdu.block.yml
@@ -0,0 +1,30 @@
+id: blocks_tagged_stream_to_pdu
+label: Tagged Stream to PDU
+
+parameters:
+- id: type
+ label: Item Type
+ dtype: enum
+ options: [byte, complex, float]
+ option_attributes:
+ tv: [blocks.byte_t, blocks.complex_t, blocks.float_t]
+ hide: part
+- id: tag
+ label: Length tag name
+ dtype: string
+ default: packet_len
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: message
+ id: pdus
+ optional: true
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.tagged_stream_to_pdu(${type.tv}, ${tag})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_tagged_stream_to_pdu.xml b/gr-blocks/grc/blocks_tagged_stream_to_pdu.xml
deleted file mode 100644
index ae8ad3b6c..000000000
--- a/gr-blocks/grc/blocks_tagged_stream_to_pdu.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Tagged Stream to PDU Message
-###################################################
- -->
-<block>
- <name>Tagged Stream to PDU</name>
- <key>blocks_tagged_stream_to_pdu</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.tagged_stream_to_pdu($type.tv, $tag)</make>
- <param>
- <name>Item Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>tv:blocks.byte_t</opt>
- </option>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>tv:blocks.complex_t</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>tv:blocks.float_t</opt>
- </option>
- </param>
- <param>
- <name>Length tag name</name>
- <key>tag</key>
- <value>packet_len</value>
- <type>string</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>pdus</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_tags_strobe.block.yml b/gr-blocks/grc/blocks_tags_strobe.block.yml
new file mode 100644
index 000000000..344fb9bde
--- /dev/null
+++ b/gr-blocks/grc/blocks_tags_strobe.block.yml
@@ -0,0 +1,49 @@
+id: blocks_tags_strobe
+label: Tags Strobe
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: value
+ label: Value (PMT)
+ dtype: raw
+ default: pmt.intern("TEST")
+- id: key
+ label: Key (PMT)
+ dtype: raw
+ default: pmt.intern("strobe")
+- id: nsamps
+ label: Num. Samples
+ dtype: int
+ default: '1000'
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: |-
+ from gnuradio import blocks
+ import pmt
+ make: blocks.tags_strobe(${type.size}*${vlen}, ${value}, ${nsamps}, ${key})
+ callbacks:
+ - set_value(${value})
+ - set_key(${key})
+ - set_nsamps(${nsamps})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_tags_strobe.xml b/gr-blocks/grc/blocks_tags_strobe.xml
deleted file mode 100644
index ed1492932..000000000
--- a/gr-blocks/grc/blocks_tags_strobe.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Tags Strobe
-###################################################
- -->
-<block>
- <name>Tags Strobe</name>
- <key>blocks_tags_strobe</key>
- <import>from gnuradio import blocks</import>
- <import>import pmt</import>
- <make>blocks.tags_strobe($type.size*$vlen, $value, $nsamps, $key)</make>
- <callback>set_value($value)</callback>
- <callback>set_key($key)</callback>
- <callback>set_nsamps($nsamps)</callback>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Value (PMT)</name>
- <key>value</key>
- <value>pmt.intern("TEST")</value>
- <type>raw</type>
- </param>
- <param>
- <name>Key (PMT)</name>
- <key>key</key>
- <value>pmt.intern("strobe")</value>
- <type>raw</type>
- </param>
- <param>
- <name>Num. Samples</name>
- <key>nsamps</key>
- <value>1000</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_tcp_server_sink.block.yml b/gr-blocks/grc/blocks_tcp_server_sink.block.yml
new file mode 100644
index 000000000..fc8eae056
--- /dev/null
+++ b/gr-blocks/grc/blocks_tcp_server_sink.block.yml
@@ -0,0 +1,42 @@
+id: blocks_tcp_server_sink
+label: TCP Server Sink
+
+parameters:
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: ipaddr
+ label: Destination IP Address
+ dtype: string
+- id: port
+ label: Destination Port
+ dtype: int
+- id: noblock
+ label: Nonblocking Mode
+ dtype: enum
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.tcp_server_sink(${type.size}*${vlen}, ${ipaddr}, ${port}, ${noblock})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_tcp_server_sink.xml b/gr-blocks/grc/blocks_tcp_server_sink.xml
deleted file mode 100644
index 644027da6..000000000
--- a/gr-blocks/grc/blocks_tcp_server_sink.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##TCP Server Sink
-###################################################
- -->
-<block>
- <name>TCP Server Sink</name>
- <key>blocks_tcp_server_sink</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.tcp_server_sink($type.size*$vlen, $ipaddr, $port, $noblock)</make>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Destination IP Address</name>
- <key>ipaddr</key>
- <type>string</type>
- </param>
- <param>
- <name>Destination Port</name>
- <key>port</key>
- <type>int</type>
- </param>
- <param>
- <name>Nonblocking Mode</name>
- <key>noblock</key>
- <type>enum</type>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
-</block>
diff --git a/gr-blocks/grc/blocks_test_tag_variable_rate_ff.block.yml b/gr-blocks/grc/blocks_test_tag_variable_rate_ff.block.yml
new file mode 100644
index 000000000..1a873cc19
--- /dev/null
+++ b/gr-blocks/grc/blocks_test_tag_variable_rate_ff.block.yml
@@ -0,0 +1,29 @@
+id: blocks_test_tag_variable_rate_ff
+label: Test Tag Variable Rate
+
+parameters:
+- id: once
+ label: Update Once
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+- id: step
+ label: Update Step
+ dtype: float
+ default: '0.001'
+
+inputs:
+- domain: stream
+ dtype: float
+ multiplicity: '1'
+
+outputs:
+- domain: stream
+ dtype: float
+ multiplicity: '1'
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.test_tag_variable_rate_ff(${once}, ${step})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_test_tag_variable_rate_ff.xml b/gr-blocks/grc/blocks_test_tag_variable_rate_ff.xml
deleted file mode 100644
index 2a6c4b52e..000000000
--- a/gr-blocks/grc/blocks_test_tag_variable_rate_ff.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Test tag variable rate
-###################################################
--->
-
-<block>
- <name>Test Tag Variable Rate</name>
- <key>blocks_test_tag_variable_rate_ff</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.test_tag_variable_rate_ff($once, $step)</make>
-
- <param>
- <name>Update Once</name>
- <key>once</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>True</name>
- <key>True</key>
- </option>
- <option>
- <name>False</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Update Step</name>
- <key>step</key>
- <value>0.001</value>
- <type>float</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>float</type>
- <nports>1</nports>
- </sink>
-
- <source>
- <name>out</name>
- <type>float</type>
- <nports>1</nports>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_threshold_ff.block.yml b/gr-blocks/grc/blocks_threshold_ff.block.yml
new file mode 100644
index 000000000..52a6f1005
--- /dev/null
+++ b/gr-blocks/grc/blocks_threshold_ff.block.yml
@@ -0,0 +1,33 @@
+id: blocks_threshold_ff
+label: Threshold
+
+parameters:
+- id: low
+ label: Low
+ dtype: real
+ default: '-100'
+- id: high
+ label: High
+ dtype: real
+ default: '100'
+- id: init
+ label: Initial State
+ dtype: real
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.threshold_ff(${low}, ${high}, ${init})
+ callbacks:
+ - set_hi(${high})
+ - set_lo(${low})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_threshold_ff.xml b/gr-blocks/grc/blocks_threshold_ff.xml
deleted file mode 100644
index 0da4157fc..000000000
--- a/gr-blocks/grc/blocks_threshold_ff.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Threshold
-###################################################
- -->
-<block>
- <name>Threshold</name>
- <key>blocks_threshold_ff</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.threshold_ff($low, $high, $init)</make>
- <callback>set_hi($high)</callback>
- <callback>set_lo($low)</callback>
- <param>
- <name>Low</name>
- <key>low</key>
- <value>-100</value>
- <type>real</type>
- </param>
- <param>
- <name>High</name>
- <key>high</key>
- <value>100</value>
- <type>real</type>
- </param>
- <param>
- <name>Initial State</name>
- <key>init</key>
- <value>0</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_throttle.block.yml b/gr-blocks/grc/blocks_throttle.block.yml
new file mode 100644
index 000000000..8b497b60c
--- /dev/null
+++ b/gr-blocks/grc/blocks_throttle.block.yml
@@ -0,0 +1,48 @@
+id: blocks_throttle
+label: Throttle
+flags: throttle
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: samples_per_second
+ label: Sample Rate
+ dtype: real
+ default: samp_rate
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: ignoretag
+ label: Ignore rx_rate tag
+ dtype: bool
+ default: 'True'
+ hide: ${ ('part' if str(ignoretag) == 'True' else 'none') }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.throttle(${type.size}*${vlen}, ${samples_per_second},${ignoretag})
+ callbacks:
+ - set_sample_rate(${samples_per_second})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_throttle.xml b/gr-blocks/grc/blocks_throttle.xml
deleted file mode 100644
index 26f4aa768..000000000
--- a/gr-blocks/grc/blocks_throttle.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Throttle
-###################################################
- -->
-<block>
- <name>Throttle</name>
- <key>blocks_throttle</key>
- <flags>throttle</flags>
- <import>from gnuradio import blocks</import>
- <make>blocks.throttle($type.size*$vlen, $samples_per_second,$ignoretag)</make>
- <callback>set_sample_rate($samples_per_second)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Sample Rate</name>
- <key>samples_per_second</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Ignore rx_rate tag</name>
- <key>ignoretag</key>
- <value>True</value>
- <type>bool</type>
- <hide>#if str($ignoretag()) == 'True' then 'part' else 'none'#</hide>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_transcendental.block.yml b/gr-blocks/grc/blocks_transcendental.block.yml
new file mode 100644
index 000000000..768bc7301
--- /dev/null
+++ b/gr-blocks/grc/blocks_transcendental.block.yml
@@ -0,0 +1,30 @@
+id: blocks_transcendental
+label: Transcendental
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex_double, float]
+ option_labels: [Complex, Float]
+ option_attributes:
+ type: [complex, float]
+ hide: part
+- id: name
+ label: Function Name
+ dtype: string
+ default: cos
+
+inputs:
+- domain: stream
+ dtype: ${ type.type }
+
+outputs:
+- domain: stream
+ dtype: ${ type.type }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.transcendental(${name}, "$type")
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_transcendental.xml b/gr-blocks/grc/blocks_transcendental.xml
deleted file mode 100644
index a883a2eef..000000000
--- a/gr-blocks/grc/blocks_transcendental.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##transcendental functions
-###################################################
- -->
-<block>
- <name>Transcendental</name>
- <key>blocks_transcendental</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.transcendental($name, "$type")</make>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex_double</key>
- <opt>type:complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>type:float</opt>
- </option>
- </param>
- <param>
- <name>Function Name</name>
- <key>name</key>
- <value>cos</value>
- <type>string</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type.type</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.type</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_tuntap_pdu.block.yml b/gr-blocks/grc/blocks_tuntap_pdu.block.yml
new file mode 100644
index 000000000..0fd183cbf
--- /dev/null
+++ b/gr-blocks/grc/blocks_tuntap_pdu.block.yml
@@ -0,0 +1,34 @@
+id: blocks_tuntap_pdu
+label: TUNTAP PDU
+
+parameters:
+- id: ifn
+ label: Interface Name
+ dtype: string
+ default: tap0
+- id: mtu
+ label: MTU
+ dtype: int
+ default: '10000'
+- id: istunflag
+ label: Flag
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: [TUN(IP Packet), TAP(Ethernet Frame)]
+
+inputs:
+- domain: message
+ id: pdus
+ optional: true
+
+outputs:
+- domain: message
+ id: pdus
+ optional: true
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.tuntap_pdu(${ifn}, ${mtu}, ${istunflag})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_tuntap_pdu.xml b/gr-blocks/grc/blocks_tuntap_pdu.xml
deleted file mode 100644
index 16e5871b9..000000000
--- a/gr-blocks/grc/blocks_tuntap_pdu.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## TUNTAP PDU async message source/sink
-###################################################
- -->
-<block>
- <name>TUNTAP PDU</name>
- <key>blocks_tuntap_pdu</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.tuntap_pdu($ifn, $mtu, $istunflag)</make>
- <param>
- <name>Interface Name</name>
- <key>ifn</key>
- <value>tap0</value>
- <type>string</type>
- </param>
- <param>
- <name>MTU</name>
- <key>mtu</key>
- <value>10000</value>
- <type>int</type>
- </param>
- <param>
- <name>Flag</name>
- <key>istunflag</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>TUN(IP Packet)</name>
- <key>True</key>
- </option>
- <option>
- <name>TAP(Ethernet Frame)</name>
- <key>False</key>
- </option>
- </param>
- <sink>
- <name>pdus</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
- <source>
- <name>pdus</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_uchar_to_float.block.yml b/gr-blocks/grc/blocks_uchar_to_float.block.yml
new file mode 100644
index 000000000..984cbd392
--- /dev/null
+++ b/gr-blocks/grc/blocks_uchar_to_float.block.yml
@@ -0,0 +1,16 @@
+id: blocks_uchar_to_float
+label: UChar To Float
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.uchar_to_float()
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_uchar_to_float.xml b/gr-blocks/grc/blocks_uchar_to_float.xml
deleted file mode 100644
index eb2b5505e..000000000
--- a/gr-blocks/grc/blocks_uchar_to_float.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Unsigned Char to Float:
-###################################################
- -->
-<block>
- <name>UChar To Float</name>
- <key>blocks_uchar_to_float</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.uchar_to_float()</make>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_udp_sink.block.yml b/gr-blocks/grc/blocks_udp_sink.block.yml
new file mode 100644
index 000000000..1ffa83c03
--- /dev/null
+++ b/gr-blocks/grc/blocks_udp_sink.block.yml
@@ -0,0 +1,45 @@
+id: blocks_udp_sink
+label: UDP Sink
+
+parameters:
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: ipaddr
+ label: Destination IP Address
+ dtype: string
+- id: port
+ label: Destination Port
+ dtype: int
+- id: psize
+ label: Payload Size
+ dtype: int
+ default: '1472'
+- id: eof
+ label: Send Null Pkt as EOF
+ dtype: bool
+ default: 'True'
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.udp_sink(${type.size}*${vlen}, ${ipaddr}, ${port}, ${psize}, ${eof})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_udp_sink.xml b/gr-blocks/grc/blocks_udp_sink.xml
deleted file mode 100644
index 0b67532c7..000000000
--- a/gr-blocks/grc/blocks_udp_sink.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##UDP Sink
-###################################################
- -->
-<block>
- <name>UDP Sink</name>
- <key>blocks_udp_sink</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.udp_sink($type.size*$vlen, $ipaddr, $port, $psize, $eof)</make>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Destination IP Address</name>
- <key>ipaddr</key>
- <type>string</type>
- </param>
- <param>
- <name>Destination Port</name>
- <key>port</key>
- <type>int</type>
- </param>
- <param>
- <name>Payload Size</name>
- <key>psize</key>
- <value>1472</value>
- <type>int</type>
- </param>
- <param>
- <name>Send Null Pkt as EOF</name>
- <key>eof</key>
- <value>True</value>
- <type>bool</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
-</block>
diff --git a/gr-blocks/grc/blocks_udp_source.block.yml b/gr-blocks/grc/blocks_udp_source.block.yml
new file mode 100644
index 000000000..1e1567815
--- /dev/null
+++ b/gr-blocks/grc/blocks_udp_source.block.yml
@@ -0,0 +1,48 @@
+id: blocks_udp_source
+label: UDP Source
+flags: throttle
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: ipaddr
+ label: IP Address
+ dtype: string
+ default: 127.0.0.1
+- id: port
+ label: Port
+ dtype: int
+ default: '1234'
+- id: psize
+ label: Payload Size
+ dtype: int
+ default: '1472'
+- id: eof
+ label: Null Pkt is EOF
+ dtype: bool
+ default: 'True'
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.udp_source(${type.size}*${vlen}, ${ipaddr}, ${port}, ${psize}, ${eof})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_udp_source.xml b/gr-blocks/grc/blocks_udp_source.xml
deleted file mode 100644
index c84816f78..000000000
--- a/gr-blocks/grc/blocks_udp_source.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##UDP Source
-###################################################
- -->
-<block>
- <name>UDP Source</name>
- <key>blocks_udp_source</key>
- <flags>throttle</flags>
- <import>from gnuradio import blocks</import>
- <make>blocks.udp_source($type.size*$vlen, $ipaddr, $port, $psize, $eof)</make>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>IP Address</name>
- <key>ipaddr</key>
- <value>127.0.0.1</value>
- <type>string</type>
- </param>
- <param>
- <name>Port</name>
- <key>port</key>
- <value>1234</value>
- <type>int</type>
- </param>
- <param>
- <name>Payload Size</name>
- <key>psize</key>
- <value>1472</value>
- <type>int</type>
- </param>
- <param>
- <name>Null Pkt is EOF</name>
- <key>eof</key>
- <value>True</value>
- <type>bool</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_unpack_k_bits_bb.block.yml b/gr-blocks/grc/blocks_unpack_k_bits_bb.block.yml
new file mode 100644
index 000000000..065fc45eb
--- /dev/null
+++ b/gr-blocks/grc/blocks_unpack_k_bits_bb.block.yml
@@ -0,0 +1,21 @@
+id: blocks_unpack_k_bits_bb
+label: Unpack K Bits
+
+parameters:
+- id: k
+ label: K
+ dtype: int
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.unpack_k_bits_bb(${k})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_unpack_k_bits_bb.xml b/gr-blocks/grc/blocks_unpack_k_bits_bb.xml
deleted file mode 100644
index 90d7493af..000000000
--- a/gr-blocks/grc/blocks_unpack_k_bits_bb.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Unpack K Bits
-###################################################
- -->
-<block>
- <name>Unpack K Bits</name>
- <key>blocks_unpack_k_bits_bb</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.unpack_k_bits_bb($k)</make>
- <param>
- <name>K</name>
- <key>k</key>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_unpacked_to_packed_xx.block.yml b/gr-blocks/grc/blocks_unpacked_to_packed_xx.block.yml
new file mode 100644
index 000000000..97c7af9e2
--- /dev/null
+++ b/gr-blocks/grc/blocks_unpacked_to_packed_xx.block.yml
@@ -0,0 +1,44 @@
+id: blocks_unpacked_to_packed_xx
+label: Unpacked to Packed
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [int, short, byte]
+ option_attributes:
+ fcn: [ii, ss, bb]
+ hide: part
+- id: bits_per_chunk
+ label: Bits per Chunk
+ dtype: int
+ default: '2'
+- id: endianness
+ label: Endianness
+ dtype: int
+ options: [gr.GR_MSB_FIRST, gr.GR_LSB_FIRST]
+ option_labels: [MSB, LSB]
+- id: num_ports
+ label: Num Ports
+ dtype: int
+ default: '1'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ multiplicity: ${ num_ports }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ multiplicity: ${ num_ports }
+
+asserts:
+- ${ num_ports > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.unpacked_to_packed_${type.fcn}(${bits_per_chunk}, ${endianness})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_unpacked_to_packed_xx.xml b/gr-blocks/grc/blocks_unpacked_to_packed_xx.xml
deleted file mode 100644
index d27dc9bfc..000000000
--- a/gr-blocks/grc/blocks_unpacked_to_packed_xx.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Unpacked to Packed
-###################################################
- -->
-<block>
- <name>Unpacked to Packed</name>
- <key>blocks_unpacked_to_packed_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.unpacked_to_packed_$(type.fcn)($bits_per_chunk, $endianness)</make>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:bb</opt>
- </option>
- </param>
- <param>
- <name>Bits per Chunk</name>
- <key>bits_per_chunk</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Endianness</name>
- <key>endianness</key>
- <type>int</type>
- <option>
- <name>MSB</name>
- <key>gr.GR_MSB_FIRST</key>
- </option>
- <option>
- <name>LSB</name>
- <key>gr.GR_LSB_FIRST</key>
- </option>
- </param>
- <param>
- <name>Num Ports</name>
- <key>num_ports</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_ports &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <nports>$num_ports</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <nports>$num_ports</nports>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_vco_c.block.yml b/gr-blocks/grc/blocks_vco_c.block.yml
new file mode 100644
index 000000000..b14b96bc5
--- /dev/null
+++ b/gr-blocks/grc/blocks_vco_c.block.yml
@@ -0,0 +1,27 @@
+id: blocks_vco_c
+label: VCO (complex)
+
+parameters:
+- id: samp_rate
+ label: Sample Rate
+ dtype: real
+- id: sensitivity
+ label: Sensitivity
+ dtype: real
+- id: amplitude
+ label: Amplitude
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.vco_c(${samp_rate}, ${sensitivity}, ${amplitude})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_vco_c.xml b/gr-blocks/grc/blocks_vco_c.xml
deleted file mode 100644
index f6246441b..000000000
--- a/gr-blocks/grc/blocks_vco_c.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##VCO
-###################################################
- -->
-<block>
- <name>VCO (complex)</name>
- <key>blocks_vco_c</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.vco_c($samp_rate, $sensitivity, $amplitude)</make>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <type>real</type>
- </param>
- <param>
- <name>Sensitivity</name>
- <key>sensitivity</key>
- <type>real</type>
- </param>
- <param>
- <name>Amplitude</name>
- <key>amplitude</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_vco_f.block.yml b/gr-blocks/grc/blocks_vco_f.block.yml
new file mode 100644
index 000000000..79ade4d0a
--- /dev/null
+++ b/gr-blocks/grc/blocks_vco_f.block.yml
@@ -0,0 +1,27 @@
+id: blocks_vco_f
+label: VCO
+
+parameters:
+- id: samp_rate
+ label: Sample Rate
+ dtype: real
+- id: sensitivity
+ label: Sensitivity
+ dtype: real
+- id: amplitude
+ label: Amplitude
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.vco_f(${samp_rate}, ${sensitivity}, ${amplitude})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_vco_f.xml b/gr-blocks/grc/blocks_vco_f.xml
deleted file mode 100644
index 77a3ba0bd..000000000
--- a/gr-blocks/grc/blocks_vco_f.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##VCO
-###################################################
- -->
-<block>
- <name>VCO</name>
- <key>blocks_vco_f</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.vco_f($samp_rate, $sensitivity, $amplitude)</make>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <type>real</type>
- </param>
- <param>
- <name>Sensitivity</name>
- <key>sensitivity</key>
- <type>real</type>
- </param>
- <param>
- <name>Amplitude</name>
- <key>amplitude</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_vector_insert_x.block.yml b/gr-blocks/grc/blocks_vector_insert_x.block.yml
new file mode 100644
index 000000000..d3b833865
--- /dev/null
+++ b/gr-blocks/grc/blocks_vector_insert_x.block.yml
@@ -0,0 +1,44 @@
+id: blocks_vector_insert_x
+label: Vector Insert
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [byte, complex, float, int, short]
+ option_attributes:
+ fcn: [b, c, f, i, s]
+ vec_type: [int_vector, complex_vector, real_vector, int_vector, int_vector]
+ hide: part
+- id: vector
+ label: Vector
+ dtype: ${ type.vec_type }
+ default: 0, 0, 0
+- id: period
+ label: Periodicity
+ dtype: int
+ default: '100'
+- id: offset
+ label: Offset
+ dtype: int
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.vector_insert_${type.fcn}(${vector}, ${period}, ${offset})
+
+documentation: |-
+ Periodicity, the length of the periodicity at which the vector should be inserted at the output.
+ (i.e. one vector for every N output items)
+
+ Offset sepcifies where in the cycle period we should begin at.
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_vector_insert_x.xml b/gr-blocks/grc/blocks_vector_insert_x.xml
deleted file mode 100644
index 2bc7ada2e..000000000
--- a/gr-blocks/grc/blocks_vector_insert_x.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Vector Source
-###################################################
- -->
-<block>
- <name>Vector Insert</name>
- <key>blocks_vector_insert_x</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.vector_insert_$(type.fcn)($vector, $period, $offset)</make>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:b</opt>
- <opt>vec_type:int_vector</opt>
- </option>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- <opt>vec_type:complex_vector</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- <opt>vec_type:real_vector</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- <opt>vec_type:int_vector</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- <opt>vec_type:int_vector</opt>
- </option>
- </param>
- <param>
- <name>Vector</name>
- <key>vector</key>
- <value>0, 0, 0</value>
- <type>$type.vec_type</type>
- </param>
- <param>
- <name>Periodicity</name>
- <key>period</key>
- <value>100</value>
- <type>int</type>
- </param>
- <param>
- <name>Offset</name>
- <key>offset</key>
- <value>0</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-
- <doc>
- Periodicity, the length of the periodicity at which the vector should be inserted at the output.
- (i.e. one vector for every N output items)
-
- Offset sepcifies where in the cycle period we should begin at.
- </doc>
-</block>
diff --git a/gr-blocks/grc/blocks_vector_sink_x.block.yml b/gr-blocks/grc/blocks_vector_sink_x.block.yml
new file mode 100644
index 000000000..9be64eae2
--- /dev/null
+++ b/gr-blocks/grc/blocks_vector_sink_x.block.yml
@@ -0,0 +1,30 @@
+id: blocks_vector_sink_x
+label: Vector Sink
+
+parameters:
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ fcn: [c, f, i, s, b]
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.vector_sink_${type.fcn}(${vlen})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_vector_sink_x.xml b/gr-blocks/grc/blocks_vector_sink_x.xml
deleted file mode 100644
index 7f5173197..000000000
--- a/gr-blocks/grc/blocks_vector_sink_x.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Vector sink
-###################################################
- -->
-<block>
- <name>Vector Sink</name>
- <key>blocks_vector_sink_x</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.vector_sink_$(type.fcn)($vlen)</make>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:b</opt>
- </option>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
-</block>
diff --git a/gr-blocks/grc/blocks_vector_source_x.block.yml b/gr-blocks/grc/blocks_vector_source_x.block.yml
new file mode 100644
index 000000000..5cdb6d6d5
--- /dev/null
+++ b/gr-blocks/grc/blocks_vector_source_x.block.yml
@@ -0,0 +1,47 @@
+id: blocks_vector_source_x
+label: Vector Source
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ fcn: [c, f, i, s, b]
+ vec_type: [complex_vector, real_vector, int_vector, int_vector, int_vector]
+ hide: part
+- id: vector
+ label: Vector
+ dtype: raw
+ default: (0, 0, 0)
+- id: tags
+ label: Tags
+ dtype: raw
+ default: '[]'
+- id: repeat
+ label: Repeat
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.vector_source_${type.fcn}(${vector}, ${repeat}, ${vlen}, ${tags})
+ callbacks:
+ - set_data(${vector}, ${tags})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_vector_source_x.xml b/gr-blocks/grc/blocks_vector_source_x.xml
deleted file mode 100644
index 0417baa34..000000000
--- a/gr-blocks/grc/blocks_vector_source_x.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Vector Source
-###################################################
- -->
-<block>
- <name>Vector Source</name>
- <key>blocks_vector_source_x</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.vector_source_$(type.fcn)($vector, $repeat, $vlen, $tags)</make>
- <callback>set_data($vector, $tags)</callback>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- <opt>vec_type:complex_vector</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- <opt>vec_type:real_vector</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- <opt>vec_type:int_vector</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- <opt>vec_type:int_vector</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:b</opt>
- <opt>vec_type:int_vector</opt>
- </option>
- </param>
- <param>
- <name>Vector</name>
- <key>vector</key>
- <value>(0, 0, 0)</value>
- <type>raw</type>
- </param>
- <param>
- <name>Tags</name>
- <key>tags</key>
- <value>[]</value>
- <type>raw</type>
- </param>
- <param>
- <name>Repeat</name>
- <key>repeat</key>
- <value>True</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_vector_to_stream.block.yml b/gr-blocks/grc/blocks_vector_to_stream.block.yml
new file mode 100644
index 000000000..77b42ab68
--- /dev/null
+++ b/gr-blocks/grc/blocks_vector_to_stream.block.yml
@@ -0,0 +1,42 @@
+id: blocks_vector_to_stream
+label: Vector to Stream
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: num_items
+ label: Num Items
+ dtype: int
+ default: '2'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen*num_items }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ num_items > 0 }
+- ${ vlen >= 1 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.vector_to_stream(${type.size}*${vlen}, ${num_items})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_vector_to_stream.xml b/gr-blocks/grc/blocks_vector_to_stream.xml
deleted file mode 100644
index a4a77bef8..000000000
--- a/gr-blocks/grc/blocks_vector_to_stream.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Vector to Stream
-###################################################
- -->
-<block>
- <name>Vector to Stream</name>
- <key>blocks_vector_to_stream</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.vector_to_stream($type.size*$vlen, $num_items)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Num Items</name>
- <key>num_items</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_items &gt; 0</check>
- <check>$vlen &gt;= 1</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen*$num_items</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_vector_to_streams.block.yml b/gr-blocks/grc/blocks_vector_to_streams.block.yml
new file mode 100644
index 000000000..e64df3853
--- /dev/null
+++ b/gr-blocks/grc/blocks_vector_to_streams.block.yml
@@ -0,0 +1,43 @@
+id: blocks_vector_to_streams
+label: Vector to Streams
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: num_streams
+ label: Num Streams
+ dtype: int
+ default: '2'
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen*num_streams }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_streams }
+
+asserts:
+- ${ num_streams > 0 }
+- ${ vlen >= 1 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.vector_to_streams(${type.size}*${vlen}, ${num_streams})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_vector_to_streams.xml b/gr-blocks/grc/blocks_vector_to_streams.xml
deleted file mode 100644
index 6a246b98d..000000000
--- a/gr-blocks/grc/blocks_vector_to_streams.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Vector to Streams
-###################################################
- -->
-<block>
- <name>Vector to Streams</name>
- <key>blocks_vector_to_streams</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.vector_to_streams($type.size*$vlen, $num_streams)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Num Streams</name>
- <key>num_streams</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_streams &gt; 0</check>
- <check>$vlen &gt;= 1</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen*$num_streams</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_streams</nports>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_wavfile_sink.block.yml b/gr-blocks/grc/blocks_wavfile_sink.block.yml
new file mode 100644
index 000000000..6bce90d0e
--- /dev/null
+++ b/gr-blocks/grc/blocks_wavfile_sink.block.yml
@@ -0,0 +1,36 @@
+id: blocks_wavfile_sink
+label: Wav File Sink
+
+parameters:
+- id: file
+ label: File
+ dtype: file_save
+- id: nchan
+ label: N Channels
+ dtype: int
+ default: '1'
+ hide: part
+- id: samp_rate
+ label: Sample Rate
+ dtype: int
+ default: samp_rate
+- id: bits_per_sample
+ label: Bits per Sample
+ dtype: int
+ default: '8'
+
+inputs:
+- domain: stream
+ dtype: float
+ multiplicity: ${ nchan }
+
+asserts:
+- ${ 1 <= nchan }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.wavfile_sink(${file}, ${nchan}, ${samp_rate}, ${bits_per_sample})
+ callbacks:
+ - open(${file})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_wavfile_sink.xml b/gr-blocks/grc/blocks_wavfile_sink.xml
deleted file mode 100644
index 8e81d8d20..000000000
--- a/gr-blocks/grc/blocks_wavfile_sink.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Wav File Sink
-###################################################
- -->
-<block>
- <name>Wav File Sink</name>
- <key>blocks_wavfile_sink</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.wavfile_sink($file, $nchan, $samp_rate, $bits_per_sample)</make>
- <callback>open($file)</callback>
- <param>
- <name>File</name>
- <key>file</key>
- <value></value>
- <type>file_save</type>
- </param>
- <param>
- <name>N Channels</name>
- <key>nchan</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>int</type>
- </param>
- <param>
- <name>Bits per Sample</name>
- <key>bits_per_sample</key>
- <value>8</value>
- <type>int</type>
- </param>
- <check>1 &lt;= $nchan</check>
- <sink>
- <name>in</name>
- <type>float</type>
- <nports>$nchan</nports>
- </sink>
-</block>
diff --git a/gr-blocks/grc/blocks_wavfile_source.block.yml b/gr-blocks/grc/blocks_wavfile_source.block.yml
new file mode 100644
index 000000000..6a84ebbb8
--- /dev/null
+++ b/gr-blocks/grc/blocks_wavfile_source.block.yml
@@ -0,0 +1,32 @@
+id: blocks_wavfile_source
+label: Wav File Source
+
+parameters:
+- id: file
+ label: File
+ dtype: file_open
+- id: repeat
+ label: Repeat
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: nchan
+ label: N Channels
+ dtype: int
+ default: '1'
+ hide: part
+
+outputs:
+- domain: stream
+ dtype: float
+ multiplicity: ${ nchan }
+
+asserts:
+- ${ 1 <= nchan }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.wavfile_source(${file}, ${repeat})
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_wavfile_source.xml b/gr-blocks/grc/blocks_wavfile_source.xml
deleted file mode 100644
index deb48472a..000000000
--- a/gr-blocks/grc/blocks_wavfile_source.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Wav File Source
-###################################################
- -->
-<block>
- <name>Wav File Source</name>
- <key>blocks_wavfile_source</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.wavfile_source($file, $repeat)</make>
- <param>
- <name>File</name>
- <key>file</key>
- <value></value>
- <type>file_open</type>
- </param>
- <param>
- <name>Repeat</name>
- <key>repeat</key>
- <value>True</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>N Channels</name>
- <key>nchan</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>1 &lt;= $nchan</check>
- <source>
- <name>out</name>
- <type>float</type>
- <nports>$nchan</nports>
- </source>
-</block>
diff --git a/gr-blocks/grc/blocks_xor_xx.block.yml b/gr-blocks/grc/blocks_xor_xx.block.yml
new file mode 100644
index 000000000..493afef0c
--- /dev/null
+++ b/gr-blocks/grc/blocks_xor_xx.block.yml
@@ -0,0 +1,34 @@
+id: blocks_xor_xx
+label: Xor
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [int, short, byte]
+ option_attributes:
+ fcn: [ii, ss, bb]
+ hide: part
+- id: num_inputs
+ label: Num Inputs
+ dtype: int
+ default: '2'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ multiplicity: ${ num_inputs }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+asserts:
+- ${ num_inputs >= 2 }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.xor_${type.fcn}()
+
+file_format: 1
diff --git a/gr-blocks/grc/blocks_xor_xx.xml b/gr-blocks/grc/blocks_xor_xx.xml
deleted file mode 100644
index 87cb8864c..000000000
--- a/gr-blocks/grc/blocks_xor_xx.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Logical Xor Block
-###################################################
- -->
-<block>
- <name>Xor</name>
- <key>blocks_xor_xx</key>
- <import>from gnuradio import blocks</import>
- <make>blocks.xor_$(type.fcn)()</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:ii</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:ss</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:bb</opt>
- </option>
- </param>
- <param>
- <name>Num Inputs</name>
- <key>num_inputs</key>
- <value>2</value>
- <type>int</type>
- </param>
- <check>$num_inputs &gt;= 2</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <nports>$num_inputs</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-blocks/grc/xmlrpc_client.block.yml b/gr-blocks/grc/xmlrpc_client.block.yml
new file mode 100644
index 000000000..fd9057b1b
--- /dev/null
+++ b/gr-blocks/grc/xmlrpc_client.block.yml
@@ -0,0 +1,30 @@
+id: xmlrpc_client
+label: XMLRPC Client
+
+parameters:
+- id: addr
+ label: Address
+ dtype: string
+ default: localhost
+- id: port
+ label: Port
+ dtype: int
+ default: '8080'
+- id: callback
+ label: Callback
+ dtype: string
+ default: set_
+- id: variable
+ label: Variable
+ dtype: raw
+
+templates:
+ imports: import xmlrpclib
+ make: xmlrpclib.Server('http://$(addr):$(port)')
+ callbacks:
+ - ${callback}(${variable})
+
+documentation: |-
+ This block will create an XMLRPC client. The client will execute the callback on the server when the variable is changed. The callback should be a the name of a function registered on the server. The variable should be an expression containing a the name of a variable in flow graph.
+
+file_format: 1
diff --git a/gr-blocks/grc/xmlrpc_client.xml b/gr-blocks/grc/xmlrpc_client.xml
deleted file mode 100644
index dc4d154d1..000000000
--- a/gr-blocks/grc/xmlrpc_client.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Simple XMLRPC Client
-###################################################
- -->
-<block>
- <name>XMLRPC Client</name>
- <key>xmlrpc_client</key>
- <import>import xmlrpclib</import>
- <make>xmlrpclib.Server('http://$(addr()):$(port)')</make>
- <callback>$(callback())($variable)</callback>
- <param>
- <name>Address</name>
- <key>addr</key>
- <value>localhost</value>
- <type>string</type>
- </param>
- <param>
- <name>Port</name>
- <key>port</key>
- <value>8080</value>
- <type>int</type>
- </param>
- <param>
- <name>Callback</name>
- <key>callback</key>
- <value>set_</value>
- <type>string</type>
- </param>
- <param>
- <name>Variable</name>
- <key>variable</key>
- <type>raw</type>
- </param>
- <doc>
-This block will create an XMLRPC client. \
-The client will execute the callback on the server when the variable is changed. \
-The callback should be a the name of a function registered on the server. \
-The variable should be an expression containing a the name of a variable in flow graph.
- </doc>
-</block>
diff --git a/gr-blocks/grc/xmlrpc_server.block.yml b/gr-blocks/grc/xmlrpc_server.block.yml
new file mode 100644
index 000000000..fb33fa79a
--- /dev/null
+++ b/gr-blocks/grc/xmlrpc_server.block.yml
@@ -0,0 +1,34 @@
+id: xmlrpc_server
+label: XMLRPC Server
+
+parameters:
+- id: addr
+ label: Address
+ dtype: string
+ default: localhost
+- id: port
+ label: Port
+ dtype: int
+ default: '8080'
+
+templates:
+ imports: |-
+ import SimpleXMLRPCServer
+ import threading
+ make: |-
+ SimpleXMLRPCServer.SimpleXMLRPCServer((${addr}, ${port}), allow_none=True)
+ self.${id}.register_instance(self)
+ self.${id}_thread = threading.Thread(target=self.${id}.serve_forever)
+ self.${id}_thread.daemon = True
+ self.${id}_thread.start()
+
+documentation: |-
+ This block will start an XMLRPC server. The server provides access to the run, start, stop, wait functions of the flow graph. The server also provides access to the variable callbacks in the flow graph. Ex: If the variable is called freq, the function provided by the server will be called set_freq(new_freq).
+
+ Example client in python:
+
+ import xmlrpclib
+ s = xmlrpclib.Server('http://localhost:8080')
+ s.set_freq(5000)
+
+file_format: 1
diff --git a/gr-blocks/grc/xmlrpc_server.xml b/gr-blocks/grc/xmlrpc_server.xml
deleted file mode 100644
index 602d44416..000000000
--- a/gr-blocks/grc/xmlrpc_server.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Simple XMLRPC Server
-###################################################
- -->
-<block>
- <name>XMLRPC Server</name>
- <key>xmlrpc_server</key>
- <import>import SimpleXMLRPCServer</import>
- <import>import threading</import>
- <make>SimpleXMLRPCServer.SimpleXMLRPCServer(($addr, $port), allow_none=True)
-self.$(id).register_instance(self)
-self.$(id)_thread = threading.Thread(target=self.$(id).serve_forever)
-self.$(id)_thread.daemon = True
-self.$(id)_thread.start()</make>
- <param>
- <name>Address</name>
- <key>addr</key>
- <value>localhost</value>
- <type>string</type>
- </param>
- <param>
- <name>Port</name>
- <key>port</key>
- <value>8080</value>
- <type>int</type>
- </param>
- <doc>
-This block will start an XMLRPC server. \
-The server provides access to the run, start, stop, wait functions of the flow graph. \
-The server also provides access to the variable callbacks in the flow graph. \
-Ex: If the variable is called freq, the function provided by the server will be called set_freq(new_freq).
-
-Example client in python:
-
-import xmlrpclib
-s = xmlrpclib.Server('http://localhost:8080')
-s.set_freq(5000)
- </doc>
-</block>
diff --git a/gr-blocks/python/blocks/CMakeLists.txt b/gr-blocks/python/blocks/CMakeLists.txt
index afb860a07..aa6de297b 100644
--- a/gr-blocks/python/blocks/CMakeLists.txt
+++ b/gr-blocks/python/blocks/CMakeLists.txt
@@ -53,7 +53,7 @@ if(ENABLE_TESTING)
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gr-blocks/python/blocks/__init__.py b/gr-blocks/python/blocks/__init__.py
index fc4cc7ab6..148479a21 100644
--- a/gr-blocks/python/blocks/__init__.py
+++ b/gr-blocks/python/blocks/__init__.py
@@ -22,16 +22,20 @@
'''
Processing blocks common to many flowgraphs.
'''
+
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
import os
try:
- from blocks_swig import *
+ from .blocks_swig import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
- from blocks_swig import *
+ from .blocks_swig import *
-from stream_to_vector_decimator import *
+from .stream_to_vector_decimator import *
#alias old add_vXX and multiply_vXX
add_vcc = add_cc
diff --git a/gr-blocks/python/blocks/parse_file_metadata.py b/gr-blocks/python/blocks/parse_file_metadata.py
index 7d8d41d16..39092d8ab 100644
--- a/gr-blocks/python/blocks/parse_file_metadata.py
+++ b/gr-blocks/python/blocks/parse_file_metadata.py
@@ -20,6 +20,10 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
import sys
from gnuradio import gr, blocks
import pmt
@@ -65,7 +69,7 @@ def parse_header(p, VERBOSE=False):
r = pmt.dict_ref(p, pmt.string_to_symbol("version"), dump)
version = pmt.to_long(r)
if(VERBOSE):
- print "Version Number: {0}".format(version)
+ print("Version Number: {0}".format(version))
else:
sys.stderr.write("Could not find key 'version': invalid or corrupt data file.\n")
sys.exit(1)
@@ -76,7 +80,7 @@ def parse_header(p, VERBOSE=False):
samp_rate = pmt.to_double(r)
info["rx_rate"] = samp_rate
if(VERBOSE):
- print "Sample Rate: {0:.2f} sps".format(samp_rate)
+ print("Sample Rate: {0:.2f} sps".format(samp_rate))
else:
sys.stderr.write("Could not find key 'sr': invalid or corrupt data file.\n")
sys.exit(1)
@@ -91,7 +95,7 @@ def parse_header(p, VERBOSE=False):
t = secs + fracs
info["rx_time"] = t
if(VERBOSE):
- print "Seconds: {0:.6f}".format(t)
+ print("Seconds: {0:.6f}".format(t))
else:
sys.stderr.write("Could not find key 'time': invalid or corrupt data file.\n")
sys.exit(1)
@@ -102,7 +106,7 @@ def parse_header(p, VERBOSE=False):
dsize = pmt.to_long(r)
info["size"] = dsize
if(VERBOSE):
- print "Item size: {0}".format(dsize)
+ print("Item size: {0}".format(dsize))
else:
sys.stderr.write("Could not find key 'size': invalid or corrupt data file.\n")
sys.exit(1)
@@ -114,7 +118,7 @@ def parse_header(p, VERBOSE=False):
stype = ftype_to_string[dtype]
info["type"] = stype
if(VERBOSE):
- print "Data Type: {0} ({1})".format(stype, dtype)
+ print("Data Type: {0} ({1})".format(stype, dtype))
else:
sys.stderr.write("Could not find key 'type': invalid or corrupt data file.\n")
sys.exit(1)
@@ -125,7 +129,7 @@ def parse_header(p, VERBOSE=False):
cplx = pmt.to_bool(r)
info["cplx"] = cplx
if(VERBOSE):
- print "Complex? {0}".format(cplx)
+ print("Complex? {0}".format(cplx))
else:
sys.stderr.write("Could not find key 'cplx': invalid or corrupt data file.\n")
sys.exit(1)
@@ -138,9 +142,9 @@ def parse_header(p, VERBOSE=False):
info["extra_len"] = seg_start - HEADER_LENGTH
info["has_extra"] = info["extra_len"] > 0
if(VERBOSE):
- print "Header Length: {0} bytes".format(info["hdr_len"])
- print "Extra Length: {0}".format((info["extra_len"]))
- print "Extra Header? {0}".format(info["has_extra"])
+ print("Header Length: {0} bytes".format(info["hdr_len"]))
+ print("Extra Length: {0}".format((info["extra_len"])))
+ print("Extra Header? {0}".format(info["has_extra"]))
else:
sys.stderr.write("Could not find key 'strt': invalid or corrupt data file.\n")
sys.exit(1)
@@ -150,13 +154,13 @@ def parse_header(p, VERBOSE=False):
r = pmt.dict_ref(p, pmt.string_to_symbol("bytes"), dump)
nbytes = pmt.to_uint64(r)
- nitems = nbytes/dsize
+ nitems = nbytes / dsize
info["nitems"] = nitems
info["nbytes"] = nbytes
if(VERBOSE):
- print "Size of Data: {0} bytes".format(nbytes)
- print " {0} items".format(nitems)
+ print("Size of Data: {0} bytes".format(nbytes))
+ print(" {0} items".format(nitems))
else:
sys.stderr.write("Could not find key 'size': invalid or corrupt data file.\n")
sys.exit(1)
@@ -171,12 +175,12 @@ def parse_extra_dict(p, info, VERBOSE=False):
items = pmt.dict_items(p)
nitems = pmt.length(items)
- for i in xrange(nitems):
+ for i in range(nitems):
item = pmt.nth(i, items)
key = pmt.symbol_to_string(pmt.car(item))
val = pmt.cdr(item)
info[key] = val
if(VERBOSE):
- print "{0}: {1}".format(key, val)
+ print("{0}: {1}".format(key, val))
return info
diff --git a/gr-blocks/python/blocks/qa_add_mult_div_sub.py b/gr-blocks/python/blocks/qa_add_mult_div_sub.py
index 8699b3a08..f90609f9e 100755..100644
--- a/gr-blocks/python/blocks/qa_add_mult_div_sub.py
+++ b/gr-blocks/python/blocks/qa_add_mult_div_sub.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_add_mult_div_sub(gr_unittest.TestCase):
@@ -31,7 +32,7 @@ class test_add_mult_div_sub(gr_unittest.TestCase):
self.tb = None
def help_ii(self, src_data, exp_data, op):
- for s in zip(range(len(src_data)), src_data):
+ for s in zip(list(range(len(src_data))), src_data):
src = blocks.vector_source_i(s[1])
self.tb.connect(src, (op, s[0]))
dst = blocks.vector_sink_i()
@@ -41,7 +42,7 @@ class test_add_mult_div_sub(gr_unittest.TestCase):
self.assertEqual(exp_data, result_data)
def help_ss(self, src_data, exp_data, op):
- for s in zip(range(len(src_data)), src_data):
+ for s in zip(list(range(len(src_data))), src_data):
src = blocks.vector_source_s(s[1])
self.tb.connect(src, (op, s[0]))
dst = blocks.vector_sink_s()
@@ -51,7 +52,7 @@ class test_add_mult_div_sub(gr_unittest.TestCase):
self.assertEqual(exp_data, result_data)
def help_ff(self, src_data, exp_data, op):
- for s in zip(range(len(src_data)), src_data):
+ for s in zip(list(range(len(src_data))), src_data):
src = blocks.vector_source_f(s[1])
self.tb.connect(src, (op, s[0]))
dst = blocks.vector_sink_f()
@@ -61,7 +62,7 @@ class test_add_mult_div_sub(gr_unittest.TestCase):
self.assertEqual(exp_data, result_data)
def help_cc(self, src_data, exp_data, op):
- for s in zip(range(len(src_data)), src_data):
+ for s in zip(list(range(len(src_data))), src_data):
src = blocks.vector_source_c(s[1])
self.tb.connect(src, (op, s[0]))
dst = blocks.vector_sink_c()
diff --git a/gr-blocks/python/blocks/qa_add_mult_v.py b/gr-blocks/python/blocks/qa_add_mult_v.py
index 721ee4eca..eaa33755b 100755..100644
--- a/gr-blocks/python/blocks/qa_add_mult_v.py
+++ b/gr-blocks/python/blocks/qa_add_mult_v.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_add_mult_v(gr_unittest.TestCase):
@@ -31,12 +32,13 @@ class test_add_mult_v(gr_unittest.TestCase):
self.tb = None
def help_ss(self, size, src_data, exp_data, op):
- for s in zip(range (len (src_data)), src_data):
+ for s in zip(list(range(len (src_data))), src_data):
src = blocks.vector_source_s(s[1])
- srcv = blocks.stream_to_vector(gr.sizeof_short, size)
- self.tb.connect(src, srcv)
+ srcv = blocks.stream_to_vector(gr.sizeof_short, size)
+ self.tb.connect(src, srcv)
self.tb.connect(srcv, (op, s[0]))
- rhs = blocks.vector_to_stream(gr.sizeof_short, size)
+
+ rhs = blocks.vector_to_stream(gr.sizeof_short, size)
dst = blocks.vector_sink_s()
self.tb.connect(op, rhs, dst)
self.tb.run()
@@ -44,12 +46,13 @@ class test_add_mult_v(gr_unittest.TestCase):
self.assertEqual(exp_data, result_data)
def help_ii(self, size, src_data, exp_data, op):
- for s in zip(range (len (src_data)), src_data):
+ for s in zip(list(range(len (src_data))), src_data):
src = blocks.vector_source_i(s[1])
- srcv = blocks.stream_to_vector(gr.sizeof_int, size)
- self.tb.connect(src, srcv)
+ srcv = blocks.stream_to_vector(gr.sizeof_int, size)
+ self.tb.connect(src, srcv)
self.tb.connect(srcv, (op, s[0]))
- rhs = blocks.vector_to_stream(gr.sizeof_int, size)
+
+ rhs = blocks.vector_to_stream(gr.sizeof_int, size)
dst = blocks.vector_sink_i()
self.tb.connect(op, rhs, dst)
self.tb.run()
@@ -57,12 +60,13 @@ class test_add_mult_v(gr_unittest.TestCase):
self.assertEqual(exp_data, result_data)
def help_ff(self, size, src_data, exp_data, op):
- for s in zip(range (len (src_data)), src_data):
+ for s in zip(list(range(len (src_data))), src_data):
src = blocks.vector_source_f(s[1])
- srcv = blocks.stream_to_vector(gr.sizeof_float, size)
- self.tb.connect(src, srcv)
+ srcv = blocks.stream_to_vector(gr.sizeof_float, size)
+ self.tb.connect(src, srcv)
self.tb.connect(srcv, (op, s[0]))
- rhs = blocks.vector_to_stream(gr.sizeof_float, size)
+
+ rhs = blocks.vector_to_stream(gr.sizeof_float, size)
dst = blocks.vector_sink_f()
self.tb.connect(op, rhs, dst)
self.tb.run()
@@ -70,12 +74,13 @@ class test_add_mult_v(gr_unittest.TestCase):
self.assertEqual(exp_data, result_data)
def help_cc(self, size, src_data, exp_data, op):
- for s in zip(range (len (src_data)), src_data):
+ for s in zip(list(range(len (src_data))), src_data):
src = blocks.vector_source_c(s[1])
- srcv = blocks.stream_to_vector(gr.sizeof_gr_complex, size)
- self.tb.connect(src, srcv)
+ srcv = blocks.stream_to_vector(gr.sizeof_gr_complex, size)
+ self.tb.connect(src, srcv)
self.tb.connect(srcv, (op, s[0]))
- rhs = blocks.vector_to_stream(gr.sizeof_gr_complex, size)
+
+ rhs = blocks.vector_to_stream(gr.sizeof_gr_complex, size)
dst = blocks.vector_sink_c()
self.tb.connect(op, rhs, dst)
self.tb.run()
@@ -83,9 +88,9 @@ class test_add_mult_v(gr_unittest.TestCase):
self.assertEqual(exp_data, result_data)
def help_const_ss(self, src_data, exp_data, op):
- src = blocks.vector_source_s(src_data)
- srcv = blocks.stream_to_vector(gr.sizeof_short, len(src_data))
- rhs = blocks.vector_to_stream(gr.sizeof_short, len(src_data))
+ src = blocks.vector_source_s(src_data)
+ srcv = blocks.stream_to_vector(gr.sizeof_short, len(src_data))
+ rhs = blocks.vector_to_stream(gr.sizeof_short, len(src_data))
dst = blocks.vector_sink_s()
self.tb.connect(src, srcv, op, rhs, dst)
self.tb.run()
@@ -93,9 +98,9 @@ class test_add_mult_v(gr_unittest.TestCase):
self.assertEqual(exp_data, result_data)
def help_const_ii(self, src_data, exp_data, op):
- src = blocks.vector_source_i(src_data)
- srcv = blocks.stream_to_vector(gr.sizeof_int, len(src_data))
- rhs = blocks.vector_to_stream(gr.sizeof_int, len(src_data))
+ src = blocks.vector_source_i(src_data)
+ srcv = blocks.stream_to_vector(gr.sizeof_int, len(src_data))
+ rhs = blocks.vector_to_stream(gr.sizeof_int, len(src_data))
dst = blocks.vector_sink_i()
self.tb.connect(src, srcv, op, rhs, dst)
self.tb.run()
@@ -103,9 +108,9 @@ class test_add_mult_v(gr_unittest.TestCase):
self.assertEqual(exp_data, result_data)
def help_const_ff(self, src_data, exp_data, op):
- src = blocks.vector_source_f(src_data)
- srcv = blocks.stream_to_vector(gr.sizeof_float, len(src_data))
- rhs = blocks.vector_to_stream(gr.sizeof_float, len(src_data))
+ src = blocks.vector_source_f(src_data)
+ srcv = blocks.stream_to_vector(gr.sizeof_float, len(src_data))
+ rhs = blocks.vector_to_stream(gr.sizeof_float, len(src_data))
dst = blocks.vector_sink_f()
self.tb.connect(src, srcv, op, rhs, dst)
self.tb.run()
@@ -113,9 +118,9 @@ class test_add_mult_v(gr_unittest.TestCase):
self.assertEqual(exp_data, result_data)
def help_const_cc(self, src_data, exp_data, op):
- src = blocks.vector_source_c(src_data)
- srcv = blocks.stream_to_vector(gr.sizeof_gr_complex, len(src_data))
- rhs = blocks.vector_to_stream(gr.sizeof_gr_complex, len(src_data))
+ src = blocks.vector_source_c(src_data)
+ srcv = blocks.stream_to_vector(gr.sizeof_gr_complex, len(src_data))
+ rhs = blocks.vector_to_stream(gr.sizeof_gr_complex, len(src_data))
dst = blocks.vector_sink_c()
self.tb.connect(src, srcv, op, rhs, dst)
self.tb.run()
@@ -125,234 +130,234 @@ class test_add_mult_v(gr_unittest.TestCase):
# add_vXX
def test_add_vss_one(self):
- src1_data = (1,)
- src2_data = (2,)
- src3_data = (3,)
- expected_result = (6,)
- op = blocks.add_ss(1)
- self.help_ss(1, (src1_data, src2_data, src3_data), expected_result, op)
+ src1_data = (1,)
+ src2_data = (2,)
+ src3_data = (3,)
+ expected_result = (6,)
+ op = blocks.add_ss(1)
+ self.help_ss(1, (src1_data, src2_data, src3_data), expected_result, op)
def test_add_vss_five(self):
- src1_data = (1, 2, 3, 4, 5)
- src2_data = (6, 7, 8, 9, 10)
- src3_data = (11, 12, 13, 14, 15)
- expected_result = (18, 21, 24, 27, 30)
- op = blocks.add_ss(5)
- self.help_ss(5, (src1_data, src2_data, src3_data), expected_result, op)
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (6, 7, 8, 9, 10)
+ src3_data = (11, 12, 13, 14, 15)
+ expected_result = (18, 21, 24, 27, 30)
+ op = blocks.add_ss(5)
+ self.help_ss(5, (src1_data, src2_data, src3_data), expected_result, op)
def test_add_vii_one(self):
- src1_data = (1,)
- src2_data = (2,)
- src3_data = (3,)
- expected_result = (6,)
- op = blocks.add_ii(1)
- self.help_ii(1, (src1_data, src2_data, src3_data), expected_result, op)
+ src1_data = (1,)
+ src2_data = (2,)
+ src3_data = (3,)
+ expected_result = (6,)
+ op = blocks.add_ii(1)
+ self.help_ii(1, (src1_data, src2_data, src3_data), expected_result, op)
def test_add_vii_five(self):
- src1_data = (1, 2, 3, 4, 5)
- src2_data = (6, 7, 8, 9, 10)
- src3_data = (11, 12, 13, 14, 15)
- expected_result = (18, 21, 24, 27, 30)
- op = blocks.add_ii(5)
- self.help_ii(5, (src1_data, src2_data, src3_data), expected_result, op)
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (6, 7, 8, 9, 10)
+ src3_data = (11, 12, 13, 14, 15)
+ expected_result = (18, 21, 24, 27, 30)
+ op = blocks.add_ii(5)
+ self.help_ii(5, (src1_data, src2_data, src3_data), expected_result, op)
def test_add_vff_one(self):
- src1_data = (1.0,)
- src2_data = (2.0,)
- src3_data = (3.0,)
- expected_result = (6.0,)
- op = blocks.add_ff(1)
- self.help_ff(1, (src1_data, src2_data, src3_data), expected_result, op)
+ src1_data = (1.0,)
+ src2_data = (2.0,)
+ src3_data = (3.0,)
+ expected_result = (6.0,)
+ op = blocks.add_ff(1)
+ self.help_ff(1, (src1_data, src2_data, src3_data), expected_result, op)
def test_add_vff_five(self):
- src1_data = (1.0, 2.0, 3.0, 4.0, 5.0)
- src2_data = (6.0, 7.0, 8.0, 9.0, 10.0)
- src3_data = (11.0, 12.0, 13.0, 14.0, 15.0)
- expected_result = (18.0, 21.0, 24.0, 27.0, 30.0)
- op = blocks.add_ff(5)
- self.help_ff(5, (src1_data, src2_data, src3_data), expected_result, op)
+ src1_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ src2_data = (6.0, 7.0, 8.0, 9.0, 10.0)
+ src3_data = (11.0, 12.0, 13.0, 14.0, 15.0)
+ expected_result = (18.0, 21.0, 24.0, 27.0, 30.0)
+ op = blocks.add_ff(5)
+ self.help_ff(5, (src1_data, src2_data, src3_data), expected_result, op)
def test_add_vcc_one(self):
- src1_data = (1.0+2.0j,)
- src2_data = (3.0+4.0j,)
- src3_data = (5.0+6.0j,)
- expected_result = (9.0+12j,)
- op = blocks.add_cc(1)
- self.help_cc(1, (src1_data, src2_data, src3_data), expected_result, op)
+ src1_data = (1.0+2.0j,)
+ src2_data = (3.0+4.0j,)
+ src3_data = (5.0+6.0j,)
+ expected_result = (9.0+12j,)
+ op = blocks.add_cc(1)
+ self.help_cc(1, (src1_data, src2_data, src3_data), expected_result, op)
def test_add_vcc_five(self):
- src1_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j)
- src2_data = (11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j)
- src3_data = (21.0+22.0j, 23.0+24.0j, 25.0+26.0j, 27.0+28.0j, 29.0+30.0j)
- expected_result = (33.0+36.0j, 39.0+42.0j, 45.0+48.0j, 51.0+54.0j, 57.0+60.0j)
- op = blocks.add_cc(5)
- self.help_cc(5, (src1_data, src2_data, src3_data), expected_result, op)
+ src1_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j)
+ src2_data = (11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j)
+ src3_data = (21.0+22.0j, 23.0+24.0j, 25.0+26.0j, 27.0+28.0j, 29.0+30.0j)
+ expected_result = (33.0+36.0j, 39.0+42.0j, 45.0+48.0j, 51.0+54.0j, 57.0+60.0j)
+ op = blocks.add_cc(5)
+ self.help_cc(5, (src1_data, src2_data, src3_data), expected_result, op)
# add_const_vXX
def test_add_const_vss_one(self):
- src_data = (1,)
- op = blocks.add_const_vss((2,))
- exp_data = (3,)
- self.help_const_ss(src_data, exp_data, op)
+ src_data = (1,)
+ op = blocks.add_const_vss((2,))
+ exp_data = (3,)
+ self.help_const_ss(src_data, exp_data, op)
def test_add_const_vss_five(self):
- src_data = (1, 2, 3, 4, 5)
- op = blocks.add_const_vss((6, 7, 8, 9, 10))
- exp_data = (7, 9, 11, 13, 15)
- self.help_const_ss(src_data, exp_data, op)
+ src_data = (1, 2, 3, 4, 5)
+ op = blocks.add_const_vss((6, 7, 8, 9, 10))
+ exp_data = (7, 9, 11, 13, 15)
+ self.help_const_ss(src_data, exp_data, op)
def test_add_const_vii_one(self):
- src_data = (1,)
- op = blocks.add_const_vii((2,))
- exp_data = (3,)
- self.help_const_ii(src_data, exp_data, op)
+ src_data = (1,)
+ op = blocks.add_const_vii((2,))
+ exp_data = (3,)
+ self.help_const_ii(src_data, exp_data, op)
def test_add_const_vii_five(self):
- src_data = (1, 2, 3, 4, 5)
- op = blocks.add_const_vii((6, 7, 8, 9, 10))
- exp_data = (7, 9, 11, 13, 15)
- self.help_const_ii(src_data, exp_data, op)
+ src_data = (1, 2, 3, 4, 5)
+ op = blocks.add_const_vii((6, 7, 8, 9, 10))
+ exp_data = (7, 9, 11, 13, 15)
+ self.help_const_ii(src_data, exp_data, op)
def test_add_const_vff_one(self):
- src_data = (1.0,)
- op = blocks.add_const_vff((2.0,))
- exp_data = (3.0,)
- self.help_const_ff(src_data, exp_data, op)
+ src_data = (1.0,)
+ op = blocks.add_const_vff((2.0,))
+ exp_data = (3.0,)
+ self.help_const_ff(src_data, exp_data, op)
def test_add_const_vff_five(self):
- src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
- op = blocks.add_const_vff((6.0, 7.0, 8.0, 9.0, 10.0))
- exp_data = (7.0, 9.0, 11.0, 13.0, 15.0)
- self.help_const_ff(src_data, exp_data, op)
+ src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ op = blocks.add_const_vff((6.0, 7.0, 8.0, 9.0, 10.0))
+ exp_data = (7.0, 9.0, 11.0, 13.0, 15.0)
+ self.help_const_ff(src_data, exp_data, op)
def test_add_const_vcc_one(self):
- src_data = (1.0+2.0j,)
- op = blocks.add_const_vcc((2.0+3.0j,))
- exp_data = (3.0+5.0j,)
- self.help_const_cc(src_data, exp_data, op)
+ src_data = (1.0+2.0j,)
+ op = blocks.add_const_vcc((2.0+3.0j,))
+ exp_data = (3.0+5.0j,)
+ self.help_const_cc(src_data, exp_data, op)
def test_add_const_vcc_five(self):
- src_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j)
- op = blocks.add_const_vcc((11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j))
- exp_data = (12.0+14.0j, 16.0+18.0j, 20.0+22.0j, 24.0+26.0j, 28.0+30.0j)
- self.help_const_cc(src_data, exp_data, op)
+ src_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j)
+ op = blocks.add_const_vcc((11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j))
+ exp_data = (12.0+14.0j, 16.0+18.0j, 20.0+22.0j, 24.0+26.0j, 28.0+30.0j)
+ self.help_const_cc(src_data, exp_data, op)
# multiply_vXX
def test_multiply_vss_one(self):
- src1_data = (1,)
- src2_data = (2,)
- src3_data = (3,)
- expected_result = (6,)
- op = blocks.multiply_ss(1)
- self.help_ss(1, (src1_data, src2_data, src3_data), expected_result, op)
+ src1_data = (1,)
+ src2_data = (2,)
+ src3_data = (3,)
+ expected_result = (6,)
+ op = blocks.multiply_ss(1)
+ self.help_ss(1, (src1_data, src2_data, src3_data), expected_result, op)
def test_multiply_vss_five(self):
- src1_data = (1, 2, 3, 4, 5)
- src2_data = (6, 7, 8, 9, 10)
- src3_data = (11, 12, 13, 14, 15)
- expected_result = (66, 168, 312, 504, 750)
- op = blocks.multiply_ss(5)
- self.help_ss(5, (src1_data, src2_data, src3_data), expected_result, op)
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (6, 7, 8, 9, 10)
+ src3_data = (11, 12, 13, 14, 15)
+ expected_result = (66, 168, 312, 504, 750)
+ op = blocks.multiply_ss(5)
+ self.help_ss(5, (src1_data, src2_data, src3_data), expected_result, op)
def test_multiply_vii_one(self):
- src1_data = (1,)
- src2_data = (2,)
- src3_data = (3,)
- expected_result = (6,)
- op = blocks.multiply_ii(1)
- self.help_ii(1, (src1_data, src2_data, src3_data), expected_result, op)
+ src1_data = (1,)
+ src2_data = (2,)
+ src3_data = (3,)
+ expected_result = (6,)
+ op = blocks.multiply_ii(1)
+ self.help_ii(1, (src1_data, src2_data, src3_data), expected_result, op)
def test_multiply_vii_five(self):
- src1_data = (1, 2, 3, 4, 5)
- src2_data = (6, 7, 8, 9, 10)
- src3_data = (11, 12, 13, 14, 15)
- expected_result = (66, 168, 312, 504, 750)
- op = blocks.multiply_ii(5)
- self.help_ii(5, (src1_data, src2_data, src3_data), expected_result, op)
+ src1_data = (1, 2, 3, 4, 5)
+ src2_data = (6, 7, 8, 9, 10)
+ src3_data = (11, 12, 13, 14, 15)
+ expected_result = (66, 168, 312, 504, 750)
+ op = blocks.multiply_ii(5)
+ self.help_ii(5, (src1_data, src2_data, src3_data), expected_result, op)
def test_multiply_vff_one(self):
- src1_data = (1.0,)
- src2_data = (2.0,)
- src3_data = (3.0,)
- expected_result = (6.0,)
- op = blocks.multiply_ff(1)
- self.help_ff(1, (src1_data, src2_data, src3_data), expected_result, op)
+ src1_data = (1.0,)
+ src2_data = (2.0,)
+ src3_data = (3.0,)
+ expected_result = (6.0,)
+ op = blocks.multiply_ff(1)
+ self.help_ff(1, (src1_data, src2_data, src3_data), expected_result, op)
def test_multiply_vff_five(self):
- src1_data = (1.0, 2.0, 3.0, 4.0, 5.0)
- src2_data = (6.0, 7.0, 8.0, 9.0, 10.0)
- src3_data = (11.0, 12.0, 13.0, 14.0, 15.0)
- expected_result = (66.0, 168.0, 312.0, 504.0, 750.0)
- op = blocks.multiply_ff(5)
- self.help_ff(5, (src1_data, src2_data, src3_data), expected_result, op)
+ src1_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ src2_data = (6.0, 7.0, 8.0, 9.0, 10.0)
+ src3_data = (11.0, 12.0, 13.0, 14.0, 15.0)
+ expected_result = (66.0, 168.0, 312.0, 504.0, 750.0)
+ op = blocks.multiply_ff(5)
+ self.help_ff(5, (src1_data, src2_data, src3_data), expected_result, op)
def test_multiply_vcc_one(self):
- src1_data = (1.0+2.0j,)
- src2_data = (3.0+4.0j,)
- src3_data = (5.0+6.0j,)
- expected_result = (-85+20j,)
- op = blocks.multiply_cc(1)
- self.help_cc(1, (src1_data, src2_data, src3_data), expected_result, op)
+ src1_data = (1.0+2.0j,)
+ src2_data = (3.0+4.0j,)
+ src3_data = (5.0+6.0j,)
+ expected_result = (-85+20j,)
+ op = blocks.multiply_cc(1)
+ self.help_cc(1, (src1_data, src2_data, src3_data), expected_result, op)
def test_multiply_vcc_five(self):
- src1_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j)
- src2_data = (11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j)
- src3_data = (21.0+22.0j, 23.0+24.0j, 25.0+26.0j, 27.0+28.0j, 29.0+30.0j)
- expected_result = (-1021.0+428.0j, -2647.0+1754.0j, -4945.0+3704.0j, -8011.0+6374.0j, -11941.0+9860.0j)
- op = blocks.multiply_cc(5)
- self.help_cc(5, (src1_data, src2_data, src3_data), expected_result, op)
+ src1_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j)
+ src2_data = (11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j)
+ src3_data = (21.0+22.0j, 23.0+24.0j, 25.0+26.0j, 27.0+28.0j, 29.0+30.0j)
+ expected_result = (-1021.0+428.0j, -2647.0+1754.0j, -4945.0+3704.0j, -8011.0+6374.0j, -11941.0+9860.0j)
+ op = blocks.multiply_cc(5)
+ self.help_cc(5, (src1_data, src2_data, src3_data), expected_result, op)
# multiply_const_vXX
def test_multiply_const_vss_one(self):
- src_data = (2,)
- op = blocks.multiply_const_vss((3,))
- exp_data = (6,)
- self.help_const_ss(src_data, exp_data, op)
+ src_data = (2,)
+ op = blocks.multiply_const_vss((3,))
+ exp_data = (6,)
+ self.help_const_ss(src_data, exp_data, op)
def test_multiply_const_vss_five(self):
- src_data = (1, 2, 3, 4, 5)
- op = blocks.multiply_const_vss((6, 7, 8, 9, 10))
- exp_data = (6, 14, 24, 36, 50)
- self.help_const_ss(src_data, exp_data, op)
+ src_data = (1, 2, 3, 4, 5)
+ op = blocks.multiply_const_vss((6, 7, 8, 9, 10))
+ exp_data = (6, 14, 24, 36, 50)
+ self.help_const_ss(src_data, exp_data, op)
def test_multiply_const_vii_one(self):
- src_data = (2,)
- op = blocks.multiply_const_vii((3,))
- exp_data = (6,)
- self.help_const_ii(src_data, exp_data, op)
+ src_data = (2,)
+ op = blocks.multiply_const_vii((3,))
+ exp_data = (6,)
+ self.help_const_ii(src_data, exp_data, op)
def test_multiply_const_vii_five(self):
- src_data = (1, 2, 3, 4, 5)
- op = blocks.multiply_const_vii((6, 7, 8, 9, 10))
- exp_data = (6, 14, 24, 36, 50)
- self.help_const_ii(src_data, exp_data, op)
+ src_data = (1, 2, 3, 4, 5)
+ op = blocks.multiply_const_vii((6, 7, 8, 9, 10))
+ exp_data = (6, 14, 24, 36, 50)
+ self.help_const_ii(src_data, exp_data, op)
def test_multiply_const_vff_one(self):
- src_data = (2.0,)
- op = blocks.multiply_const_vff((3.0,))
- exp_data = (6.0,)
- self.help_const_ff(src_data, exp_data, op)
+ src_data = (2.0,)
+ op = blocks.multiply_const_vff((3.0,))
+ exp_data = (6.0,)
+ self.help_const_ff(src_data, exp_data, op)
def test_multiply_const_vff_five(self):
- src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
- op = blocks.multiply_const_vff((6.0, 7.0, 8.0, 9.0, 10.0))
- exp_data = (6.0, 14.0, 24.0, 36.0, 50.0)
- self.help_const_ff(src_data, exp_data, op)
+ src_data = (1.0, 2.0, 3.0, 4.0, 5.0)
+ op = blocks.multiply_const_vff((6.0, 7.0, 8.0, 9.0, 10.0))
+ exp_data = (6.0, 14.0, 24.0, 36.0, 50.0)
+ self.help_const_ff(src_data, exp_data, op)
def test_multiply_const_vcc_one(self):
- src_data = (1.0+2.0j,)
- op = blocks.multiply_const_vcc((2.0+3.0j,))
- exp_data = (-4.0+7.0j,)
- self.help_const_cc(src_data, exp_data, op)
+ src_data = (1.0+2.0j,)
+ op = blocks.multiply_const_vcc((2.0+3.0j,))
+ exp_data = (-4.0+7.0j,)
+ self.help_const_cc(src_data, exp_data, op)
def test_multiply_const_vcc_five(self):
- src_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j)
- op = blocks.multiply_const_vcc((11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j))
- exp_data = (-13.0+34.0j, -17.0+94.0j, -21.0+170.0j, -25.0+262.0j, -29.0+370.0j)
- self.help_const_cc(src_data, exp_data, op)
+ src_data = (1.0+2.0j, 3.0+4.0j, 5.0+6.0j, 7.0+8.0j, 9.0+10.0j)
+ op = blocks.multiply_const_vcc((11.0+12.0j, 13.0+14.0j, 15.0+16.0j, 17.0+18.0j, 19.0+20.0j))
+ exp_data = (-13.0+34.0j, -17.0+94.0j, -21.0+170.0j, -25.0+262.0j, -29.0+370.0j)
+ self.help_const_cc(src_data, exp_data, op)
if __name__ == '__main__':
diff --git a/gr-blocks/python/blocks/qa_affinity.py b/gr-blocks/python/blocks/qa_affinity.py
index 98b5c4486..d80e50bc4 100644
--- a/gr-blocks/python/blocks/qa_affinity.py
+++ b/gr-blocks/python/blocks/qa_affinity.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_affinity(gr_unittest.TestCase):
diff --git a/gr-blocks/python/blocks/qa_argmax.py b/gr-blocks/python/blocks/qa_argmax.py
index fead481c0..9dea186fe 100644
--- a/gr-blocks/python/blocks/qa_argmax.py
+++ b/gr-blocks/python/blocks/qa_argmax.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import math
diff --git a/gr-blocks/python/blocks/qa_bin_statistics.py b/gr-blocks/python/blocks/qa_bin_statistics.py
index 52b858572..e6bdfaca5 100755..100644
--- a/gr-blocks/python/blocks/qa_bin_statistics.py
+++ b/gr-blocks/python/blocks/qa_bin_statistics.py
@@ -20,17 +20,21 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gr_unittest, blocks
-
-import random
-import struct
-
"""
Note: There has been an issue with this block in the past, see Issue
#199. This test is being enabled only on the 'next' branch for version
v3.7 for now. TWR
"""
+from __future__ import print_function
+
+import struct
+
+import six
+
+from gnuradio import gr, gr_unittest, blocks
+
+
class counter(gr.feval_dd):
def __init__(self, step_size=1):
gr.feval_dd.__init__(self)
@@ -57,8 +61,8 @@ class counter3(gr.feval_dd):
t = self.count
self.count = self.count + self.step_size
self.f(self.count)
- except Exception, e:
- print "Exception: ", e
+ except Exception as e:
+ print("Exception: ", e)
return t
def foobar3(new_t):
@@ -79,8 +83,8 @@ class counter4(gr.feval_dd):
t = self.count
self.count = self.count + self.step_size
self.obj_instance.foobar4(self.count)
- except Exception, e:
- print "Exception: ", e
+ except Exception as e:
+ print("Exception: ", e)
return t
@@ -89,7 +93,8 @@ class parse_msg(object):
self.center_freq = msg.arg1()
self.vlen = int(msg.arg2())
assert(msg.length() == self.vlen * gr.sizeof_float)
- self.data = struct.unpack('%df' % (self.vlen,), msg.to_string())
+ self.data = struct.unpack(b'%df' % self.vlen, six.b(msg.to_string()))
+
class test_bin_statistics(gr_unittest.TestCase):
diff --git a/gr-blocks/python/blocks/qa_block_behavior.py b/gr-blocks/python/blocks/qa_block_behavior.py
index a21e423b2..482e88a31 100644
--- a/gr-blocks/python/blocks/qa_block_behavior.py
+++ b/gr-blocks/python/blocks/qa_block_behavior.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_block_behavior(gr_unittest.TestCase):
diff --git a/gr-blocks/python/blocks/qa_block_gateway.py b/gr-blocks/python/blocks/qa_block_gateway.py
index 6fdb0090a..23036eec5 100644
--- a/gr-blocks/python/blocks/qa_block_gateway.py
+++ b/gr-blocks/python/blocks/qa_block_gateway.py
@@ -1,3 +1,5 @@
+from __future__ import division
+
#
# Copyright 2011-2013 Free Software Foundation, Inc.
#
@@ -126,7 +128,7 @@ class tag_source(gr.sync_block):
#put code here to fill the output items...
#make a new tag on the middle element every time work is called
- count = self.nitems_written(0) + num_output_items/2
+ count = self.nitems_written(0) + num_output_items // 2
key = pmt.string_to_symbol("example_key")
value = pmt.string_to_symbol("example_value")
self.add_item_tag(0, count, key, value)
@@ -200,8 +202,8 @@ class vector_to_stream(gr.interp_block):
def work(self, input_items, output_items):
n = 0
- for i in xrange(len(input_items[0])):
- for j in xrange(self.block_size):
+ for i in range(len(input_items[0])):
+ for j in range(self.block_size):
output_items[0][n] = input_items[0][i][j]
n += 1
diff --git a/gr-blocks/python/blocks/qa_boolean_operators.py b/gr-blocks/python/blocks/qa_boolean_operators.py
index cbcd5688a..e364aaaa0 100755..100644
--- a/gr-blocks/python/blocks/qa_boolean_operators.py
+++ b/gr-blocks/python/blocks/qa_boolean_operators.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_boolean_operators (gr_unittest.TestCase):
@@ -31,7 +32,7 @@ class test_boolean_operators (gr_unittest.TestCase):
self.tb = None
def help_ss (self, src_data, exp_data, op):
- for s in zip (range (len (src_data)), src_data):
+ for s in zip (list(range(len (src_data))), src_data):
src = blocks.vector_source_s (s[1])
self.tb.connect (src, (op, s[0]))
dst = blocks.vector_sink_s ()
@@ -41,7 +42,7 @@ class test_boolean_operators (gr_unittest.TestCase):
self.assertEqual (exp_data, result_data)
def help_bb (self, src_data, exp_data, op):
- for s in zip (range (len (src_data)), src_data):
+ for s in zip (list(range(len (src_data))), src_data):
src = blocks.vector_source_b (s[1])
self.tb.connect (src, (op, s[0]))
dst = blocks.vector_sink_b ()
@@ -51,7 +52,7 @@ class test_boolean_operators (gr_unittest.TestCase):
self.assertEqual (exp_data, result_data)
def help_ii (self, src_data, exp_data, op):
- for s in zip (range (len (src_data)), src_data):
+ for s in zip (list(range(len (src_data))), src_data):
src = blocks.vector_source_i (s[1])
self.tb.connect (src, (op, s[0]))
dst = blocks.vector_sink_i ()
diff --git a/gr-blocks/python/blocks/qa_burst_tagger.py b/gr-blocks/python/blocks/qa_burst_tagger.py
index b1a4f942f..a2b7b402e 100644
--- a/gr-blocks/python/blocks/qa_burst_tagger.py
+++ b/gr-blocks/python/blocks/qa_burst_tagger.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import pmt
diff --git a/gr-blocks/python/blocks/qa_conjugate.py b/gr-blocks/python/blocks/qa_conjugate.py
index 36172e30a..d672c453c 100644
--- a/gr-blocks/python/blocks/qa_conjugate.py
+++ b/gr-blocks/python/blocks/qa_conjugate.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_conjugate (gr_unittest.TestCase):
diff --git a/gr-blocks/python/blocks/qa_copy.py b/gr-blocks/python/blocks/qa_copy.py
index 20914b51e..c832c0ef0 100755..100644
--- a/gr-blocks/python/blocks/qa_copy.py
+++ b/gr-blocks/python/blocks/qa_copy.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_copy(gr_unittest.TestCase):
@@ -46,7 +47,7 @@ class test_copy(gr_unittest.TestCase):
expected_result = ()
src = blocks.vector_source_b(src_data)
op = blocks.copy(gr.sizeof_char)
- op.set_enabled(False)
+ op.set_enabled(False)
dst = blocks.vector_sink_b()
self.tb.connect(src, op, dst)
self.tb.run()
diff --git a/gr-blocks/python/blocks/qa_cpp_py_binding.py b/gr-blocks/python/blocks/qa_cpp_py_binding.py
index 23a5c9b82..f15bfddb2 100644
--- a/gr-blocks/python/blocks/qa_cpp_py_binding.py
+++ b/gr-blocks/python/blocks/qa_cpp_py_binding.py
@@ -24,6 +24,7 @@
# This program tests mixed python and c++ ctrlport exports in a single app
#
+
import sys, time, random, numpy, re
from gnuradio import gr, gr_unittest, blocks
@@ -37,7 +38,7 @@ def get1():
def get2():
return "failure"
-class inc_class:
+class inc_class(object):
def __init__(self):
self.val = 1
def pp(self):
@@ -131,7 +132,7 @@ class test_cpp_py_binding(gr_unittest.TestCase):
self.assertComplexTuplesAlmostEqual(val, rval, 5)
def test_002(self):
- data = range(1,9)
+ data = list(range(1,9))
self.src = blocks.vector_source_c(data)
self.p1 = blocks.ctrlport_probe_c("aaa","C++ exported variable")
@@ -163,7 +164,7 @@ class test_cpp_py_binding(gr_unittest.TestCase):
# Get all exported knobs
ret = radio.getKnobs([probe_name + "::bbb"])
- for name in ret.keys():
+ for name in list(ret.keys()):
result = ret[name].value
self.assertEqual(result, expected_result)
diff --git a/gr-blocks/python/blocks/qa_cpp_py_binding_set.py b/gr-blocks/python/blocks/qa_cpp_py_binding_set.py
index 5b81de08f..641f588fa 100644
--- a/gr-blocks/python/blocks/qa_cpp_py_binding_set.py
+++ b/gr-blocks/python/blocks/qa_cpp_py_binding_set.py
@@ -24,6 +24,7 @@
# This program tests mixed python and c++ GRCP sets in a single app
#
+
import sys, time, random, numpy, re
from gnuradio import gr, gr_unittest, blocks
@@ -31,7 +32,7 @@ from gnuradio.ctrlport import GNURadio
from gnuradio import ctrlport
import os
-class inc_class:
+class inc_class(object):
def __init__(self,val):
self.val = val;
@@ -108,7 +109,7 @@ class test_cpp_py_binding_set(gr_unittest.TestCase):
def test_002(self):
- data = range(1, 10)
+ data = list(range(1, 10))
self.src = blocks.vector_source_c(data, True)
self.p = blocks.nop(gr.sizeof_gr_complex)
diff --git a/gr-blocks/python/blocks/qa_ctrlport_probes.py b/gr-blocks/python/blocks/qa_ctrlport_probes.py
index c678846df..d373bb9ff 100644
--- a/gr-blocks/python/blocks/qa_ctrlport_probes.py
+++ b/gr-blocks/python/blocks/qa_ctrlport_probes.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import sys, time, random, numpy
from gnuradio import gr, gr_unittest, blocks
import os, struct, re
@@ -36,7 +37,7 @@ class test_ctrlport_probes(gr_unittest.TestCase):
self.tb = None
def test_001(self):
- data = range(1,9)
+ data = list(range(1,9))
self.src = blocks.vector_source_c(data, True)
self.probe = blocks.ctrlport_probe2_c("samples","Complex",
@@ -68,7 +69,7 @@ class test_ctrlport_probes(gr_unittest.TestCase):
# Get all exported knobs
ret = radio.getKnobs([probe_name + "::samples"])
- for name in ret.keys():
+ for name in list(ret.keys()):
# Get data in probe, which might be offset; find the
# beginning and unwrap.
result = ret[name].value
@@ -81,7 +82,7 @@ class test_ctrlport_probes(gr_unittest.TestCase):
def test_002(self):
- data = range(1,9)
+ data = list(range(1,9))
self.src = blocks.vector_source_f(data, True)
self.probe = blocks.ctrlport_probe2_f("samples","Floats",
@@ -109,7 +110,7 @@ class test_ctrlport_probes(gr_unittest.TestCase):
# Get all exported knobs
ret = radio.getKnobs([probe_name + "::samples"])
- for name in ret.keys():
+ for name in list(ret.keys()):
# Get data in probe, which might be offset; find the
# beginning and unwrap.
result = ret[name].value
@@ -121,7 +122,7 @@ class test_ctrlport_probes(gr_unittest.TestCase):
self.tb.wait()
def test_003(self):
- data = range(1,9)
+ data = list(range(1,9))
self.src = blocks.vector_source_i(data, True)
self.probe = blocks.ctrlport_probe2_i("samples","Integers",
@@ -149,7 +150,7 @@ class test_ctrlport_probes(gr_unittest.TestCase):
# Get all exported knobs
ret = radio.getKnobs([probe_name + "::samples"])
- for name in ret.keys():
+ for name in list(ret.keys()):
# Get data in probe, which might be offset; find the
# beginning and unwrap.
result = ret[name].value
@@ -162,7 +163,7 @@ class test_ctrlport_probes(gr_unittest.TestCase):
def test_004(self):
- data = range(1,9)
+ data = list(range(1,9))
self.src = blocks.vector_source_s(data, True)
self.probe = blocks.ctrlport_probe2_s("samples","Shorts",
@@ -190,7 +191,7 @@ class test_ctrlport_probes(gr_unittest.TestCase):
# Get all exported knobs
ret = radio.getKnobs([probe_name + "::samples"])
- for name in ret.keys():
+ for name in list(ret.keys()):
# Get data in probe, which might be offset; find the
# beginning and unwrap.
result = ret[name].value
@@ -202,7 +203,7 @@ class test_ctrlport_probes(gr_unittest.TestCase):
self.tb.wait()
def test_005(self):
- data = range(1,9)
+ data = list(range(1,9))
self.src = blocks.vector_source_b(data, True)
self.probe = blocks.ctrlport_probe2_b("samples","Bytes",
@@ -230,7 +231,7 @@ class test_ctrlport_probes(gr_unittest.TestCase):
# Get all exported knobs
ret = radio.getKnobs([probe_name + "::samples"])
- for name in ret.keys():
+ for name in list(ret.keys()):
# Get data in probe, which might be offset; find the
# beginning and unwrap.
result = ret[name].value
diff --git a/gr-blocks/python/blocks/qa_delay.py b/gr-blocks/python/blocks/qa_delay.py
index 09200862b..2fd369142 100755..100644
--- a/gr-blocks/python/blocks/qa_delay.py
+++ b/gr-blocks/python/blocks/qa_delay.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import pmt
diff --git a/gr-blocks/python/blocks/qa_endian_swap.py b/gr-blocks/python/blocks/qa_endian_swap.py
index dd6ee349b..3e1e05960 100644
--- a/gr-blocks/python/blocks/qa_endian_swap.py
+++ b/gr-blocks/python/blocks/qa_endian_swap.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import ctypes
diff --git a/gr-blocks/python/blocks/qa_file_metadata.py b/gr-blocks/python/blocks/qa_file_metadata.py
index 886207f10..16c1a8916 100644
--- a/gr-blocks/python/blocks/qa_file_metadata.py
+++ b/gr-blocks/python/blocks/qa_file_metadata.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import absolute_import
+from __future__ import division
+
import os, math
from gnuradio import gr, gr_unittest, blocks
@@ -28,9 +31,9 @@ import pmt
import parse_file_metadata
def sig_source_c(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: amp*math.cos(2.*math.pi*freq*x) + \
- 1j*amp*math.sin(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [amp*math.cos(2.*math.pi*freq*x) + \
+ 1j*amp*math.sin(2.*math.pi*freq*x) for x in t]
return y
class test_file_metadata(gr_unittest.TestCase):
@@ -44,7 +47,7 @@ class test_file_metadata(gr_unittest.TestCase):
def test_001(self):
N = 1000
- outfile = "test_out.dat"
+ outfile = "test_out.dat"
detached = False
samp_rate = 200000
@@ -62,8 +65,8 @@ class test_file_metadata(gr_unittest.TestCase):
1000000, extras_str, detached)
fsnk.set_unbuffered(True)
- self.tb.connect(src, fsnk)
- self.tb.run()
+ self.tb.connect(src, fsnk)
+ self.tb.run()
fsnk.close()
handle = open(outfile, "rb")
@@ -119,12 +122,12 @@ class test_file_metadata(gr_unittest.TestCase):
# Test that the data portion was extracted and received correctly.
self.assertComplexTuplesAlmostEqual(vsnk.data(), ssnk.data(), 5)
- os.remove(outfile)
+ os.remove(outfile)
def test_002(self):
N = 1000
- outfile = "test_out.dat"
- outfile_hdr = "test_out.dat.hdr"
+ outfile = "test_out.dat"
+ outfile_hdr = "test_out.dat.hdr"
detached = True
samp_rate = 200000
@@ -142,8 +145,8 @@ class test_file_metadata(gr_unittest.TestCase):
1000000, extras_str, detached)
fsnk.set_unbuffered(True)
- self.tb.connect(src, fsnk)
- self.tb.run()
+ self.tb.connect(src, fsnk)
+ self.tb.run()
fsnk.close()
# Open detached header for reading
@@ -201,8 +204,8 @@ class test_file_metadata(gr_unittest.TestCase):
# Test that the data portion was extracted and received correctly.
self.assertComplexTuplesAlmostEqual(vsnk.data(), ssnk.data(), 5)
- os.remove(outfile)
- os.remove(outfile_hdr)
+ os.remove(outfile)
+ os.remove(outfile_hdr)
if __name__ == '__main__':
gr_unittest.run(test_file_metadata, "test_file_metadata.xml")
diff --git a/gr-blocks/python/blocks/qa_head.py b/gr-blocks/python/blocks/qa_head.py
index 9b5bca221..b6167f937 100755..100644
--- a/gr-blocks/python/blocks/qa_head.py
+++ b/gr-blocks/python/blocks/qa_head.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_head(gr_unittest.TestCase):
diff --git a/gr-blocks/python/blocks/qa_hier_block2.py b/gr-blocks/python/blocks/qa_hier_block2.py
index 065580038..fefe0c3b4 100755..100644
--- a/gr-blocks/python/blocks/qa_hier_block2.py
+++ b/gr-blocks/python/blocks/qa_hier_block2.py
@@ -1,10 +1,13 @@
#!/usr/bin/env python
-from gnuradio import gr, gr_unittest, blocks
-import numpy
import threading
import time
+import numpy
+
+from gnuradio import gr, gr_unittest, blocks
+
+
class add_ff(gr.sync_block):
def __init__(self):
gr.sync_block.__init__(
@@ -29,88 +32,88 @@ class multiply_const_ff(gr.sync_block):
self.k = k
def work(self, input_items, output_items):
- output_items[0][:] = map(lambda x: self.k*x, input_items[0])
+ output_items[0][:] = [self.k*x for x in input_items[0]]
return len(output_items[0])
class test_hier_block2(gr_unittest.TestCase):
def setUp(self):
- pass
+ pass
def tearDown(self):
- pass
+ pass
def test_001_make(self):
- hblock = gr.hier_block2("test_block",
- gr.io_signature(1,1,gr.sizeof_int),
- gr.io_signature(1,1,gr.sizeof_int))
- self.assertEqual("test_block", hblock.name())
- self.assertEqual(1, hblock.input_signature().max_streams())
- self.assertEqual(1, hblock.output_signature().min_streams())
- self.assertEqual(1, hblock.output_signature().max_streams())
- self.assertEqual(gr.sizeof_int, hblock.output_signature().sizeof_stream_item(0))
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ self.assertEqual("test_block", hblock.name())
+ self.assertEqual(1, hblock.input_signature().max_streams())
+ self.assertEqual(1, hblock.output_signature().min_streams())
+ self.assertEqual(1, hblock.output_signature().max_streams())
+ self.assertEqual(gr.sizeof_int, hblock.output_signature().sizeof_stream_item(0))
def test_002_connect_input(self):
- hblock = gr.hier_block2("test_block",
- gr.io_signature(1,1,gr.sizeof_int),
- gr.io_signature(1,1,gr.sizeof_int))
- nop1 = blocks.nop(gr.sizeof_int)
- hblock.connect(hblock, nop1)
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ hblock.connect(hblock, nop1)
def test_004_connect_output(self):
- hblock = gr.hier_block2("test_block",
- gr.io_signature(1,1,gr.sizeof_int),
- gr.io_signature(1,1,gr.sizeof_int))
- nop1 = blocks.nop(gr.sizeof_int)
- hblock.connect(nop1, hblock)
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ hblock.connect(nop1, hblock)
def test_005_connect_output_in_use(self):
- hblock = gr.hier_block2("test_block",
- gr.io_signature(1,1,gr.sizeof_int),
- gr.io_signature(1,1,gr.sizeof_int))
- nop1 = blocks.nop(gr.sizeof_int)
- nop2 = blocks.nop(gr.sizeof_int)
- hblock.connect(nop1, hblock)
- self.assertRaises(RuntimeError,
- lambda: hblock.connect(nop2, hblock))
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ nop2 = blocks.nop(gr.sizeof_int)
+ hblock.connect(nop1, hblock)
+ self.assertRaises(RuntimeError,
+ lambda: hblock.connect(nop2, hblock))
def test_006_connect_invalid_src_port_neg(self):
- hblock = gr.hier_block2("test_block",
- gr.io_signature(1,1,gr.sizeof_int),
- gr.io_signature(1,1,gr.sizeof_int))
- nop1 = blocks.nop(gr.sizeof_int)
- self.assertRaises(RuntimeError,
- lambda: hblock.connect((hblock, -1), nop1))
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ self.assertRaises(RuntimeError,
+ lambda: hblock.connect((hblock, -1), nop1))
def test_005_connect_invalid_src_port_exceeds(self):
- hblock = gr.hier_block2("test_block",
- gr.io_signature(1,1,gr.sizeof_int),
- gr.io_signature(1,1,gr.sizeof_int))
- nop1 = blocks.nop(gr.sizeof_int)
- self.assertRaises(RuntimeError,
- lambda: hblock.connect((hblock, 1), nop1))
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ self.assertRaises(RuntimeError,
+ lambda: hblock.connect((hblock, 1), nop1))
def test_007_connect_invalid_dst_port_neg(self):
- hblock = gr.hier_block2("test_block",
- gr.io_signature(1,1,gr.sizeof_int),
- gr.io_signature(1,1,gr.sizeof_int))
- nop1 = blocks.nop(gr.sizeof_int)
- nop2 = blocks.nop(gr.sizeof_int)
- self.assertRaises(RuntimeError,
- lambda: hblock.connect(nop1, (nop2, -1)))
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ nop2 = blocks.nop(gr.sizeof_int)
+ self.assertRaises(RuntimeError,
+ lambda: hblock.connect(nop1, (nop2, -1)))
def test_008_connect_invalid_dst_port_exceeds(self):
- hblock = gr.hier_block2("test_block",
- gr.io_signature(1,1,gr.sizeof_int),
- gr.io_signature(1,1,gr.sizeof_int))
- nop1 = blocks.null_sink(gr.sizeof_int)
- nop2 = blocks.null_sink(gr.sizeof_int)
- self.assertRaises(RuntimeError,
- lambda: hblock.connect(nop1, (nop2, 1)))
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.null_sink(gr.sizeof_int)
+ nop2 = blocks.null_sink(gr.sizeof_int)
+ self.assertRaises(RuntimeError,
+ lambda: hblock.connect(nop1, (nop2, 1)))
def test_009_check_topology(self):
- hblock = gr.top_block("test_block")
- hblock.check_topology(0, 0)
+ hblock = gr.top_block("test_block")
+ hblock.check_topology(0, 0)
def test_010_run(self):
expected = (1.0, 2.0, 3.0, 4.0)
@@ -123,89 +126,89 @@ class test_hier_block2(gr_unittest.TestCase):
hblock.run()
actual1 = sink1.data()
actual2 = sink2.data()
- self.assertEquals(expected, actual1)
- self.assertEquals(expected, actual2)
+ self.assertEqual(expected, actual1)
+ self.assertEqual(expected, actual2)
def test_012_disconnect_input(self):
- hblock = gr.hier_block2("test_block",
- gr.io_signature(1,1,gr.sizeof_int),
- gr.io_signature(1,1,gr.sizeof_int))
- nop1 = blocks.nop(gr.sizeof_int)
- hblock.connect(hblock, nop1)
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ hblock.connect(hblock, nop1)
hblock.disconnect(hblock, nop1)
def test_013_disconnect_input_not_connected(self):
- hblock = gr.hier_block2("test_block",
- gr.io_signature(1,1,gr.sizeof_int),
- gr.io_signature(1,1,gr.sizeof_int))
- nop1 = blocks.nop(gr.sizeof_int)
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
nop2 = blocks.nop(gr.sizeof_int)
- hblock.connect(hblock, nop1)
+ hblock.connect(hblock, nop1)
self.assertRaises(RuntimeError,
lambda: hblock.disconnect(hblock, nop2))
def test_014_disconnect_input_neg(self):
- hblock = gr.hier_block2("test_block",
- gr.io_signature(1,1,gr.sizeof_int),
- gr.io_signature(1,1,gr.sizeof_int))
- nop1 = blocks.nop(gr.sizeof_int)
- hblock.connect(hblock, nop1)
- self.assertRaises(RuntimeError,
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ hblock.connect(hblock, nop1)
+ self.assertRaises(ValueError,
lambda: hblock.disconnect((hblock, -1), nop1))
def test_015_disconnect_input_exceeds(self):
- hblock = gr.hier_block2("test_block",
- gr.io_signature(1,1,gr.sizeof_int),
- gr.io_signature(1,1,gr.sizeof_int))
- nop1 = blocks.nop(gr.sizeof_int)
- hblock.connect(hblock, nop1)
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ hblock.connect(hblock, nop1)
self.assertRaises(RuntimeError,
lambda: hblock.disconnect((hblock, 1), nop1))
def test_016_disconnect_output(self):
- hblock = gr.hier_block2("test_block",
- gr.io_signature(1,1,gr.sizeof_int),
- gr.io_signature(1,1,gr.sizeof_int))
- nop1 = blocks.nop(gr.sizeof_int)
- hblock.connect(nop1, hblock)
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ hblock.connect(nop1, hblock)
hblock.disconnect(nop1, hblock)
def test_017_disconnect_output_not_connected(self):
- hblock = gr.hier_block2("test_block",
- gr.io_signature(1,1,gr.sizeof_int),
- gr.io_signature(1,1,gr.sizeof_int))
- nop1 = blocks.nop(gr.sizeof_int)
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
nop2 = blocks.nop(gr.sizeof_int)
- hblock.connect(nop1, hblock)
+ hblock.connect(nop1, hblock)
self.assertRaises(RuntimeError,
lambda: hblock.disconnect(nop2, hblock))
def test_018_disconnect_output_neg(self):
- hblock = gr.hier_block2("test_block",
- gr.io_signature(1,1,gr.sizeof_int),
- gr.io_signature(1,1,gr.sizeof_int))
- nop1 = blocks.nop(gr.sizeof_int)
- hblock.connect(hblock, nop1)
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ hblock.connect(hblock, nop1)
self.assertRaises(RuntimeError,
lambda: hblock.disconnect(nop1, (hblock, -1)))
def test_019_disconnect_output_exceeds(self):
- hblock = gr.hier_block2("test_block",
- gr.io_signature(1,1,gr.sizeof_int),
- gr.io_signature(1,1,gr.sizeof_int))
- nop1 = blocks.nop(gr.sizeof_int)
- hblock.connect(nop1, hblock)
+ hblock = gr.hier_block2("test_block",
+ gr.io_signature(1,1,gr.sizeof_int),
+ gr.io_signature(1,1,gr.sizeof_int))
+ nop1 = blocks.nop(gr.sizeof_int)
+ hblock.connect(nop1, hblock)
self.assertRaises(RuntimeError,
lambda: hblock.disconnect(nop1, (hblock, 1)))
def test_020_run(self):
- hblock = gr.top_block("test_block")
- data = (1.0, 2.0, 3.0, 4.0)
- src = blocks.vector_source_f(data, False)
- dst = blocks.vector_sink_f()
- hblock.connect(src, dst)
- hblock.run()
- self.assertEquals(data, dst.data())
+ hblock = gr.top_block("test_block")
+ data = (1.0, 2.0, 3.0, 4.0)
+ src = blocks.vector_source_f(data, False)
+ dst = blocks.vector_sink_f()
+ hblock.connect(src, dst)
+ hblock.run()
+ self.assertEqual(data, dst.data())
def test_021_connect_single(self):
hblock = gr.top_block("test_block")
@@ -258,7 +261,7 @@ class test_hier_block2(gr_unittest.TestCase):
hb.connect(src, dst)
tb.connect(hb)
tb.run()
- self.assertEquals(expected_data, dst.data())
+ self.assertEqual(expected_data, dst.data())
def test_027a_internally_unconnected_input(self):
tb = gr.top_block()
@@ -333,7 +336,7 @@ class test_hier_block2(gr_unittest.TestCase):
tb.disconnect(src) # Singleton disconnect
tb.connect(src, dst)
tb.run()
- self.assertEquals(dst.data(), (1,))
+ self.assertEqual(dst.data(), (1,))
def test_030_nested_input(self):
tb = gr.top_block()
@@ -349,7 +352,7 @@ class test_hier_block2(gr_unittest.TestCase):
hb1.connect(hb1, hb2)
hb2.connect(hb2, blocks.copy(gr.sizeof_char), dst)
tb.run()
- self.assertEquals(dst.data(), (1,))
+ self.assertEqual(dst.data(), (1,))
def test_031_multiple_internal_inputs(self):
tb = gr.top_block()
@@ -368,7 +371,7 @@ class test_hier_block2(gr_unittest.TestCase):
dst = blocks.vector_sink_f()
tb.connect(src, hb, dst)
tb.run()
- self.assertEquals(dst.data(), (3.0,))
+ self.assertEqual(dst.data(), (3.0,))
def test_032_nested_multiple_internal_inputs(self):
tb = gr.top_block()
@@ -392,7 +395,7 @@ class test_hier_block2(gr_unittest.TestCase):
dst = blocks.vector_sink_f()
tb.connect(src, hb, dst)
tb.run()
- self.assertEquals(dst.data(), (3.0,))
+ self.assertEqual(dst.data(), (3.0,))
def test_033a_set_affinity(self):
@@ -404,7 +407,7 @@ class test_hier_block2(gr_unittest.TestCase):
hblock.set_processor_affinity([0,])
hblock.run()
actual = snk.data()
- self.assertEquals(expected, actual)
+ self.assertEqual(expected, actual)
def test_033b_unset_affinity(self):
expected = (1.0, 2.0, 3.0, 4.0)
@@ -416,7 +419,7 @@ class test_hier_block2(gr_unittest.TestCase):
hblock.unset_processor_affinity()
hblock.run()
actual = snk.data()
- self.assertEquals(expected, actual)
+ self.assertEqual(expected, actual)
def test_033c_get_affinity(self):
expected = (1.0, 2.0, 3.0, 4.0)
@@ -426,7 +429,7 @@ class test_hier_block2(gr_unittest.TestCase):
hblock.connect(src, snk)
hblock.set_processor_affinity([0,])
procs = hblock.processor_affinity()
- self.assertEquals((0,), procs)
+ self.assertEqual((0,), procs)
def test_34a_lock_unlock(self):
hblock = gr.top_block("test_block")
diff --git a/gr-blocks/python/blocks/qa_hier_block2_message_connections.py b/gr-blocks/python/blocks/qa_hier_block2_message_connections.py
index 4283f537e..e66a0dbdc 100644
--- a/gr-blocks/python/blocks/qa_hier_block2_message_connections.py
+++ b/gr-blocks/python/blocks/qa_hier_block2_message_connections.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import weakref
from gnuradio import blocks, gr, gr_unittest
diff --git a/gr-blocks/python/blocks/qa_integrate.py b/gr-blocks/python/blocks/qa_integrate.py
index be4285ce9..4ecfbb517 100755..100644
--- a/gr-blocks/python/blocks/qa_integrate.py
+++ b/gr-blocks/python/blocks/qa_integrate.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_integrate (gr_unittest.TestCase):
@@ -31,66 +32,66 @@ class test_integrate (gr_unittest.TestCase):
self.tb = None
def test_000_ss(self):
- src_data = (1, 2, 3, 4, 5, 6)
- dst_data = (6, 15)
- src = blocks.vector_source_s(src_data)
- itg = blocks.integrate_ss(3)
- dst = blocks.vector_sink_s()
- self.tb.connect(src, itg, dst)
- self.tb.run()
- self.assertEqual(dst_data, dst.data())
+ src_data = (1, 2, 3, 4, 5, 6)
+ dst_data = (6, 15)
+ src = blocks.vector_source_s(src_data)
+ itg = blocks.integrate_ss(3)
+ dst = blocks.vector_sink_s()
+ self.tb.connect(src, itg, dst)
+ self.tb.run()
+ self.assertEqual(dst_data, dst.data())
def test_001_ii(self):
- src_data = (1, 2, 3, 4, 5, 6)
- dst_data = (6, 15)
- src = blocks.vector_source_i(src_data)
- itg = blocks.integrate_ii(3)
- dst = blocks.vector_sink_i()
- self.tb.connect(src, itg, dst)
- self.tb.run()
- self.assertEqual(dst_data, dst.data())
+ src_data = (1, 2, 3, 4, 5, 6)
+ dst_data = (6, 15)
+ src = blocks.vector_source_i(src_data)
+ itg = blocks.integrate_ii(3)
+ dst = blocks.vector_sink_i()
+ self.tb.connect(src, itg, dst)
+ self.tb.run()
+ self.assertEqual(dst_data, dst.data())
def test_002_ff(self):
- src_data = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
- dst_data = [6.0, 15.0]
- src = blocks.vector_source_f(src_data)
- itg = blocks.integrate_ff(3)
- dst = blocks.vector_sink_f()
- self.tb.connect(src, itg, dst)
- self.tb.run()
- self.assertFloatTuplesAlmostEqual(dst_data, dst.data(), 6)
+ src_data = [1.0, 2.0, 3.0, 4.0, 5.0, 6.0]
+ dst_data = [6.0, 15.0]
+ src = blocks.vector_source_f(src_data)
+ itg = blocks.integrate_ff(3)
+ dst = blocks.vector_sink_f()
+ self.tb.connect(src, itg, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(dst_data, dst.data(), 6)
def test_003_cc(self):
- src_data = [1.0+1.0j, 2.0+2.0j, 3.0+3.0j, 4.0+4.0j, 5.0+5.0j, 6.0+6.0j]
- dst_data = [6.0+6.0j, 15.0+15.0j]
- src = blocks.vector_source_c(src_data)
- itg = blocks.integrate_cc(3)
- dst = blocks.vector_sink_c()
- self.tb.connect(src, itg, dst)
- self.tb.run()
- self.assertComplexTuplesAlmostEqual(dst_data, dst.data(), 6)
+ src_data = [1.0+1.0j, 2.0+2.0j, 3.0+3.0j, 4.0+4.0j, 5.0+5.0j, 6.0+6.0j]
+ dst_data = [6.0+6.0j, 15.0+15.0j]
+ src = blocks.vector_source_c(src_data)
+ itg = blocks.integrate_cc(3)
+ dst = blocks.vector_sink_c()
+ self.tb.connect(src, itg, dst)
+ self.tb.run()
+ self.assertComplexTuplesAlmostEqual(dst_data, dst.data(), 6)
def test_004_ss_vec(self):
- src_data = (1, 2, 3, 4, 5, 6)
- dst_data = (9, 12)
- vlen = 2
- src = blocks.vector_source_s(src_data, False, vlen)
- itg = blocks.integrate_ss(3, vlen)
- dst = blocks.vector_sink_s(vlen)
- self.tb.connect(src, itg, dst)
- self.tb.run()
- self.assertEqual(dst_data, dst.data())
+ src_data = (1, 2, 3, 4, 5, 6)
+ dst_data = (9, 12)
+ vlen = 2
+ src = blocks.vector_source_s(src_data, False, vlen)
+ itg = blocks.integrate_ss(3, vlen)
+ dst = blocks.vector_sink_s(vlen)
+ self.tb.connect(src, itg, dst)
+ self.tb.run()
+ self.assertEqual(dst_data, dst.data())
def test_003_cc_vec(self):
- src_data = [1.0+1.0j, 2.0+2.0j, 3.0+3.0j, 4.0+4.0j, 5.0+5.0j, 6.0+6.0j]
- dst_data = [9.0+9.0j, 12.0+12.0j]
- vlen = 2
- src = blocks.vector_source_c(src_data, False, vlen)
- itg = blocks.integrate_cc(3, vlen)
- dst = blocks.vector_sink_c(vlen)
- self.tb.connect(src, itg, dst)
- self.tb.run()
- self.assertComplexTuplesAlmostEqual(dst_data, dst.data(), 6)
+ src_data = [1.0+1.0j, 2.0+2.0j, 3.0+3.0j, 4.0+4.0j, 5.0+5.0j, 6.0+6.0j]
+ dst_data = [9.0+9.0j, 12.0+12.0j]
+ vlen = 2
+ src = blocks.vector_source_c(src_data, False, vlen)
+ itg = blocks.integrate_cc(3, vlen)
+ dst = blocks.vector_sink_c(vlen)
+ self.tb.connect(src, itg, dst)
+ self.tb.run()
+ self.assertComplexTuplesAlmostEqual(dst_data, dst.data(), 6)
if __name__ == '__main__':
gr_unittest.run(test_integrate, "test_integrate.xml")
diff --git a/gr-blocks/python/blocks/qa_interleave.py b/gr-blocks/python/blocks/qa_interleave.py
index 526e4a4e6..9d334a465 100755..100644
--- a/gr-blocks/python/blocks/qa_interleave.py
+++ b/gr-blocks/python/blocks/qa_interleave.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, blocks
class test_interleave (gr_unittest.TestCase):
@@ -32,10 +34,10 @@ class test_interleave (gr_unittest.TestCase):
def test_int_001 (self):
lenx = 64
- src0 = blocks.vector_source_f (range (0, lenx, 4))
- src1 = blocks.vector_source_f (range (1, lenx, 4))
- src2 = blocks.vector_source_f (range (2, lenx, 4))
- src3 = blocks.vector_source_f (range (3, lenx, 4))
+ src0 = blocks.vector_source_f (list(range(0, lenx, 4)))
+ src1 = blocks.vector_source_f (list(range(1, lenx, 4)))
+ src2 = blocks.vector_source_f (list(range(2, lenx, 4)))
+ src3 = blocks.vector_source_f (list(range(3, lenx, 4)))
op = blocks.interleave (gr.sizeof_float)
dst = blocks.vector_sink_f ()
@@ -54,13 +56,13 @@ class test_interleave (gr_unittest.TestCase):
lenx = 64
plusup_big = lambda a: a + (blksize * 4)
plusup_little = lambda a: a + blksize
- a_vec = range(0,blksize)
- for i in range(0,(lenx/(4 * blksize)) - 1):
- a_vec += map(plusup_big, a_vec[len(a_vec) - blksize:])
+ a_vec = list(range(0,blksize))
+ for i in range(0,(lenx // (4 * blksize)) - 1):
+ a_vec += list(map(plusup_big, a_vec[len(a_vec) - blksize:]))
- b_vec = map(plusup_little, a_vec)
- c_vec = map(plusup_little, b_vec)
- d_vec = map(plusup_little, c_vec)
+ b_vec = list(map(plusup_little, a_vec))
+ c_vec = list(map(plusup_little, b_vec))
+ d_vec = list(map(plusup_little, c_vec))
src0 = blocks.vector_source_f (a_vec)
src1 = blocks.vector_source_f (b_vec)
@@ -82,7 +84,7 @@ class test_interleave (gr_unittest.TestCase):
def test_deint_001 (self):
lenx = 64
- src = blocks.vector_source_f (range (lenx))
+ src = blocks.vector_source_f (list(range(lenx)))
op = blocks.deinterleave (gr.sizeof_float)
dst0 = blocks.vector_sink_f ()
dst1 = blocks.vector_sink_f ()
@@ -109,7 +111,7 @@ class test_interleave (gr_unittest.TestCase):
def test_deint_002 (self):
blksize = 4
lenx = 64
- src = blocks.vector_source_f (range (lenx))
+ src = blocks.vector_source_f (list(range(lenx)))
op = blocks.deinterleave (gr.sizeof_float, blksize)
dst0 = blocks.vector_sink_f ()
dst1 = blocks.vector_sink_f ()
@@ -125,13 +127,13 @@ class test_interleave (gr_unittest.TestCase):
plusup_big = lambda a: a + (blksize * 4)
plusup_little = lambda a: a + blksize
- a_vec = range(0,blksize)
- for i in range(0,(lenx/(4 * blksize)) - 1):
- a_vec += map(plusup_big, a_vec[len(a_vec) - blksize:])
+ a_vec = list(range(0,blksize))
+ for i in range(0,(lenx // (4 * blksize)) - 1):
+ a_vec += list(map(plusup_big, a_vec[len(a_vec) - blksize:]))
- b_vec = map(plusup_little, a_vec)
- c_vec = map(plusup_little, b_vec)
- d_vec = map(plusup_little, c_vec)
+ b_vec = list(map(plusup_little, a_vec))
+ c_vec = list(map(plusup_little, b_vec))
+ d_vec = list(map(plusup_little, c_vec))
expected_result0 = tuple (a_vec)
expected_result1 = tuple (b_vec)
diff --git a/gr-blocks/python/blocks/qa_keep_m_in_n.py b/gr-blocks/python/blocks/qa_keep_m_in_n.py
index 4db48335b..30a15d9de 100755..100644
--- a/gr-blocks/python/blocks/qa_keep_m_in_n.py
+++ b/gr-blocks/python/blocks/qa_keep_m_in_n.py
@@ -19,6 +19,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import sys
@@ -27,15 +28,15 @@ import random
class test_keep_m_in_n(gr_unittest.TestCase):
def setUp(self):
- pass
+ pass
def tearDown(self):
- pass
+ pass
def test_001(self):
self.maxDiff = None;
tb = gr.top_block()
- src = blocks.vector_source_b( range(0,100) )
+ src = blocks.vector_source_b( list(range(0,100)) )
# itemsize, M, N, offset
km2 = blocks.keep_m_in_n( 1, 1, 2, 0 );
@@ -49,11 +50,10 @@ class test_keep_m_in_n(gr_unittest.TestCase):
tb.connect(src,km7,snk7);
tb.run();
- self.assertEqual(range(0,100,2), list(snk2.data()));
- self.assertEqual(range(1,100,3), list(snk3.data()));
- self.assertEqual(range(2,100,7), list(snk7.data()));
+ self.assertEqual(list(range(0,100,2)), list(snk2.data()));
+ self.assertEqual(list(range(1,100,3)), list(snk3.data()));
+ self.assertEqual(list(range(2,100,7)), list(snk7.data()));
if __name__ == '__main__':
gr_unittest.run(test_keep_m_in_n, "test_keep_m_in_n.xml")
-
diff --git a/gr-blocks/python/blocks/qa_keep_one_in_n.py b/gr-blocks/python/blocks/qa_keep_one_in_n.py
index d8251fe61..fd7c122c6 100755..100644
--- a/gr-blocks/python/blocks/qa_keep_one_in_n.py
+++ b/gr-blocks/python/blocks/qa_keep_one_in_n.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_keep_one_in_n(gr_unittest.TestCase):
diff --git a/gr-blocks/python/blocks/qa_logger.py b/gr-blocks/python/blocks/qa_logger.py
index d2b6b3ee5..bdcd24cf0 100644
--- a/gr-blocks/python/blocks/qa_logger.py
+++ b/gr-blocks/python/blocks/qa_logger.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_logger (gr_unittest.TestCase):
diff --git a/gr-blocks/python/blocks/qa_max.py b/gr-blocks/python/blocks/qa_max.py
index 709dbee72..45c2261de 100755..100644
--- a/gr-blocks/python/blocks/qa_max.py
+++ b/gr-blocks/python/blocks/qa_max.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, blocks
import math
@@ -47,18 +49,18 @@ class test_max(gr_unittest.TestCase):
self.assertEqual(expected_result, result_data)
def stest_002(self):
- src_data=(-100,-99,-98,-97,-96,-1)
- expected_result = (float(max(src_data)),)
+ src_data=(-100,-99,-98,-97,-96,-1)
+ expected_result = (float(max(src_data)),)
- src = blocks.vector_source_f(src_data)
- s2v = blocks.stream_to_vector(gr.sizeof_float, len(src_data))
- op = blocks.max_ff(len(src_data))
- dst = blocks.vector_sink_f()
+ src = blocks.vector_source_f(src_data)
+ s2v = blocks.stream_to_vector(gr.sizeof_float, len(src_data))
+ op = blocks.max_ff(len(src_data))
+ dst = blocks.vector_sink_f()
- self.tb.connect(src, s2v, op, dst)
- self.tb.run()
- result_data = dst.data()
- self.assertEqual(expected_result, result_data)
+ self.tb.connect(src, s2v, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
def stest_003(self):
src_data0 = (0, 2, -3, 0, 12, 0)
@@ -85,7 +87,7 @@ class test_max(gr_unittest.TestCase):
expected_data = []
tmp = [float(max(x,y)) for x,y in zip(src_data0, src_data1)]
- for i in xrange(len(tmp)/dim):
+ for i in range(len(tmp) / dim):
expected_data.append(float(max(tmp[i*dim:(i+1)*dim])))
src0 = blocks.vector_source_f(src_data0)
@@ -118,18 +120,18 @@ class test_max(gr_unittest.TestCase):
self.assertEqual(expected_result, result_data)
def stest_s002(self):
- src_data=(-100,-99,-98,-97,-96,-1)
- expected_result = (max(src_data),)
+ src_data=(-100,-99,-98,-97,-96,-1)
+ expected_result = (max(src_data),)
- src = blocks.vector_source_s(src_data)
- s2v = blocks.stream_to_vector(gr.sizeof_short, len(src_data))
- op = blocks.max_ss(len(src_data))
- dst = blocks.vector_sink_s()
+ src = blocks.vector_source_s(src_data)
+ s2v = blocks.stream_to_vector(gr.sizeof_short, len(src_data))
+ op = blocks.max_ss(len(src_data))
+ dst = blocks.vector_sink_s()
- self.tb.connect(src, s2v, op, dst)
- self.tb.run()
- result_data = dst.data()
- self.assertEqual(expected_result, result_data)
+ self.tb.connect(src, s2v, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
def stest_s003(self):
@@ -157,7 +159,7 @@ class test_max(gr_unittest.TestCase):
expected_data = []
tmp = [max(x,y) for x,y in zip(src_data0, src_data1)]
- for i in xrange(len(tmp)/dim):
+ for i in range(len(tmp) / dim):
expected_data.append(max(tmp[i*dim:(i+1)*dim]))
src0 = blocks.vector_source_s(src_data0)
diff --git a/gr-blocks/python/blocks/qa_message.py b/gr-blocks/python/blocks/qa_message.py
index 1d0380d44..639001f09 100755..100644
--- a/gr-blocks/python/blocks/qa_message.py
+++ b/gr-blocks/python/blocks/qa_message.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import time
from gnuradio import gr, gr_unittest, blocks
@@ -95,7 +96,7 @@ class test_message(gr_unittest.TestCase):
input_data = (0,1,2,3,4,5,6,7,8,9)
src = blocks.vector_source_b(input_data)
dst = blocks.vector_sink_b()
- tb = gr.top_block()
+ tb = gr.top_block()
tb.connect(src, dst)
tb.run()
self.assertEquals(input_data, dst.data())
@@ -105,7 +106,7 @@ class test_message(gr_unittest.TestCase):
src = blocks.message_strobe(msg, 500)
snk = blocks.message_debug()
- tb = gr.top_block()
+ tb = gr.top_block()
tb.msg_connect(src, "strobe", snk, "store")
tb.start()
time.sleep(1)
diff --git a/gr-blocks/python/blocks/qa_min.py b/gr-blocks/python/blocks/qa_min.py
index 642782a1a..374c15e31 100644
--- a/gr-blocks/python/blocks/qa_min.py
+++ b/gr-blocks/python/blocks/qa_min.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, blocks
import math
@@ -47,18 +49,18 @@ class test_min(gr_unittest.TestCase):
self.assertEqual(expected_result, result_data)
def stest_002(self):
- src_data=(-100,-99,-98,-97,-96,-1)
- expected_result = (float(min(src_data)),)
+ src_data=(-100,-99,-98,-97,-96,-1)
+ expected_result = (float(min(src_data)),)
- src = blocks.vector_source_f(src_data)
- s2v = blocks.stream_to_vector(gr.sizeof_float, len(src_data))
- op = blocks.min_ff(len(src_data))
- dst = blocks.vector_sink_f()
+ src = blocks.vector_source_f(src_data)
+ s2v = blocks.stream_to_vector(gr.sizeof_float, len(src_data))
+ op = blocks.min_ff(len(src_data))
+ dst = blocks.vector_sink_f()
- self.tb.connect(src, s2v, op, dst)
- self.tb.run()
- result_data = dst.data()
- self.assertEqual(expected_result, result_data)
+ self.tb.connect(src, s2v, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
def stest_003(self):
src_data0 = (0, 2, -3, 0, 12, 0)
@@ -85,7 +87,7 @@ class test_min(gr_unittest.TestCase):
expected_data = []
tmp = [float(min(x,y)) for x,y in zip(src_data0, src_data1)]
- for i in xrange(len(tmp)/dim):
+ for i in range(len(tmp) / dim):
expected_data.append(float(min(tmp[i*dim:(i+1)*dim])))
src0 = blocks.vector_source_f(src_data0)
@@ -118,18 +120,18 @@ class test_min(gr_unittest.TestCase):
self.assertEqual(expected_result, result_data)
def stest_s002(self):
- src_data=(-100,-99,-98,-97,-96,-1)
- expected_result = (min(src_data),)
+ src_data=(-100,-99,-98,-97,-96,-1)
+ expected_result = (min(src_data),)
- src = blocks.vector_source_s(src_data)
- s2v = blocks.stream_to_vector(gr.sizeof_short, len(src_data))
- op = blocks.min_ss(len(src_data))
- dst = blocks.vector_sink_s()
+ src = blocks.vector_source_s(src_data)
+ s2v = blocks.stream_to_vector(gr.sizeof_short, len(src_data))
+ op = blocks.min_ss(len(src_data))
+ dst = blocks.vector_sink_s()
- self.tb.connect(src, s2v, op, dst)
- self.tb.run()
- result_data = dst.data()
- self.assertEqual(expected_result, result_data)
+ self.tb.connect(src, s2v, op, dst)
+ self.tb.run()
+ result_data = dst.data()
+ self.assertEqual(expected_result, result_data)
def stest_s003(self):
@@ -157,7 +159,7 @@ class test_min(gr_unittest.TestCase):
expected_data = []
tmp = [min(x,y) for x,y in zip(src_data0, src_data1)]
- for i in xrange(len(tmp)/dim):
+ for i in range(len(tmp) / dim):
expected_data.append(min(tmp[i*dim:(i+1)*dim]))
src0 = blocks.vector_source_s(src_data0)
diff --git a/gr-blocks/python/blocks/qa_moving_average.py b/gr-blocks/python/blocks/qa_moving_average.py
index b76f81392..87f8d3015 100644
--- a/gr-blocks/python/blocks/qa_moving_average.py
+++ b/gr-blocks/python/blocks/qa_moving_average.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import math, random
diff --git a/gr-blocks/python/blocks/qa_multiply_conjugate.py b/gr-blocks/python/blocks/qa_multiply_conjugate.py
index c2391f141..dadea69ba 100644
--- a/gr-blocks/python/blocks/qa_multiply_conjugate.py
+++ b/gr-blocks/python/blocks/qa_multiply_conjugate.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_multiply_conjugate (gr_unittest.TestCase):
diff --git a/gr-blocks/python/blocks/qa_multiply_matrix_xx.py b/gr-blocks/python/blocks/qa_multiply_matrix_xx.py
index feee53d51..eb1053556 100755..100644
--- a/gr-blocks/python/blocks/qa_multiply_matrix_xx.py
+++ b/gr-blocks/python/blocks/qa_multiply_matrix_xx.py
@@ -21,6 +21,7 @@
# Boston, MA 02110-1301, USA.
#
+
import time
import numpy
import os
@@ -73,7 +74,7 @@ class test_multiply_matrix_xx (gr_unittest.TestCase):
self.multiplier.set_A(A2)
A = A2
A_matrix = numpy.matrix(A)
- for i in xrange(N):
+ for i in range(N):
if tags is None:
these_tags = ()
else:
@@ -83,17 +84,17 @@ class test_multiply_matrix_xx (gr_unittest.TestCase):
(self.multiplier, i)
)
sinks = []
- for i in xrange(M):
+ for i in range(M):
sinks.append(BLOCK_LOOKUP[datatype]['sink']())
self.tb.connect((self.multiplier, i), sinks[i])
# Run and check
self.tb.run()
- for i in xrange(X_in.shape[1]):
+ for i in range(X_in.shape[1]):
Y_out_exp[:,i] = A_matrix * X_in[:,i]
Y_out = [list(x.data()) for x in sinks]
if tags is not None:
self.the_tags = []
- for i in xrange(M):
+ for i in range(M):
self.the_tags.append(sinks[i].tags())
self.assertEqual(list(Y_out), Y_out_exp.tolist())
diff --git a/gr-blocks/python/blocks/qa_mute.py b/gr-blocks/python/blocks/qa_mute.py
index 97ee5bd82..d061954ef 100755..100644
--- a/gr-blocks/python/blocks/qa_mute.py
+++ b/gr-blocks/python/blocks/qa_mute.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_mute(gr_unittest.TestCase):
@@ -31,7 +32,7 @@ class test_mute(gr_unittest.TestCase):
self.tb = None
def help_ii(self, src_data, exp_data, op):
- for s in zip(range(len(src_data)), src_data):
+ for s in zip(list(range(len(src_data))), src_data):
src = blocks.vector_source_i(s[1])
self.tb.connect(src, (op, s[0]))
dst = blocks.vector_sink_i()
@@ -41,7 +42,7 @@ class test_mute(gr_unittest.TestCase):
self.assertEqual(exp_data, result_data)
def help_ff(self, src_data, exp_data, op):
- for s in zip(range(len(src_data)), src_data):
+ for s in zip(list(range(len(src_data))), src_data):
src = blocks.vector_source_f(s[1])
self.tb.connect(src, (op, s[0]))
dst = blocks.vector_sink_f()
@@ -51,7 +52,7 @@ class test_mute(gr_unittest.TestCase):
self.assertEqual(exp_data, result_data)
def help_cc(self, src_data, exp_data, op):
- for s in zip(range(len(src_data)), src_data):
+ for s in zip(list(range(len(src_data))), src_data):
src = blocks.vector_source_c(s[1])
self.tb.connect(src, (op, s[0]))
dst = blocks.vector_sink_c()
diff --git a/gr-blocks/python/blocks/qa_nlog10.py b/gr-blocks/python/blocks/qa_nlog10.py
index c925479f5..94269c34f 100755..100644
--- a/gr-blocks/python/blocks/qa_nlog10.py
+++ b/gr-blocks/python/blocks/qa_nlog10.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_nlog10(gr_unittest.TestCase):
diff --git a/gr-blocks/python/blocks/qa_null_sink_source.py b/gr-blocks/python/blocks/qa_null_sink_source.py
index 03d6ab14c..8ddd8db6f 100644
--- a/gr-blocks/python/blocks/qa_null_sink_source.py
+++ b/gr-blocks/python/blocks/qa_null_sink_source.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import math
diff --git a/gr-blocks/python/blocks/qa_pack_k_bits.py b/gr-blocks/python/blocks/qa_pack_k_bits.py
index ab0b638a0..28285845b 100755..100644
--- a/gr-blocks/python/blocks/qa_pack_k_bits.py
+++ b/gr-blocks/python/blocks/qa_pack_k_bits.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import random
from gnuradio import gr, gr_unittest, blocks
@@ -54,7 +55,7 @@ class test_pack(gr_unittest.TestCase):
self.assertEqual(expected_results, dst.data())
def test_003(self):
- src_data = expected_results = map(lambda x: random.randint(0,3), range(10));
+ src_data = expected_results = [random.randint(0,3) for x in range(10)];
src = blocks.vector_source_b( src_data );
pack = blocks.pack_k_bits_bb(2);
unpack = blocks.unpack_k_bits_bb(2);
diff --git a/gr-blocks/python/blocks/qa_packed_to_unpacked.py b/gr-blocks/python/blocks/qa_packed_to_unpacked.py
index 02dc87249..13e93a713 100755..100644
--- a/gr-blocks/python/blocks/qa_packed_to_unpacked.py
+++ b/gr-blocks/python/blocks/qa_packed_to_unpacked.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import random
@@ -139,7 +140,7 @@ class test_packing(gr_unittest.TestCase):
def test_009(self):
random.seed(0)
src_data = []
- for i in xrange(202):
+ for i in range(202):
src_data.append((random.randint(0,255)))
src_data = tuple(src_data)
expected_results = src_data
@@ -158,7 +159,7 @@ class test_packing(gr_unittest.TestCase):
def test_010(self):
random.seed(0)
src_data = []
- for i in xrange(56):
+ for i in range(56):
src_data.append((random.randint(0,255)))
src_data = tuple(src_data)
expected_results = src_data
@@ -176,7 +177,7 @@ class test_packing(gr_unittest.TestCase):
def test_011(self):
random.seed(0)
src_data = []
- for i in xrange(56):
+ for i in range(56):
src_data.append((random.randint(0,255)))
src_data = tuple(src_data)
expected_results = src_data
@@ -196,7 +197,7 @@ class test_packing(gr_unittest.TestCase):
def test_100a(self):
random.seed(0)
src_data = []
- for i in xrange(100):
+ for i in range(100):
src_data.append((random.randint(-2**15,2**15-1)))
src_data = tuple(src_data)
expected_results = src_data
@@ -214,7 +215,7 @@ class test_packing(gr_unittest.TestCase):
def test_100b(self):
random.seed(0)
src_data = []
- for i in xrange(100):
+ for i in range(100):
src_data.append((random.randint(-2**15,2**15-1)))
src_data = tuple(src_data)
expected_results = src_data
@@ -232,7 +233,7 @@ class test_packing(gr_unittest.TestCase):
def test_101a(self):
random.seed(0)
src_data = []
- for i in xrange(100):
+ for i in range(100):
src_data.append((random.randint(-2**15,2**15-1)))
src_data = tuple(src_data)
expected_results = src_data
@@ -250,7 +251,7 @@ class test_packing(gr_unittest.TestCase):
def test_101b(self):
random.seed(0)
src_data = []
- for i in xrange(100):
+ for i in range(100):
src_data.append((random.randint(-2**15,2**15-1)))
src_data = tuple(src_data)
expected_results = src_data
@@ -270,7 +271,7 @@ class test_packing(gr_unittest.TestCase):
def test_200a(self):
random.seed(0)
src_data = []
- for i in xrange(100):
+ for i in range(100):
src_data.append((random.randint(-2**31,2**31-1)))
src_data = tuple(src_data)
expected_results = src_data
@@ -288,7 +289,7 @@ class test_packing(gr_unittest.TestCase):
def test_200b(self):
random.seed(0)
src_data = []
- for i in xrange(100):
+ for i in range(100):
src_data.append((random.randint(-2**31,2**31-1)))
src_data = tuple(src_data)
expected_results = src_data
@@ -306,7 +307,7 @@ class test_packing(gr_unittest.TestCase):
def test_201a(self):
random.seed(0)
src_data = []
- for i in xrange(100):
+ for i in range(100):
src_data.append((random.randint(-2**31,2**31-1)))
src_data = tuple(src_data)
expected_results = src_data
@@ -324,7 +325,7 @@ class test_packing(gr_unittest.TestCase):
def test_201b(self):
random.seed(0)
src_data = []
- for i in xrange(100):
+ for i in range(100):
src_data.append((random.randint(-2**31,2**31-1)))
src_data = tuple(src_data)
expected_results = src_data
diff --git a/gr-blocks/python/blocks/qa_patterned_interleaver.py b/gr-blocks/python/blocks/qa_patterned_interleaver.py
index 2d3168db4..300565210 100755..100644
--- a/gr-blocks/python/blocks/qa_patterned_interleaver.py
+++ b/gr-blocks/python/blocks/qa_patterned_interleaver.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import math
diff --git a/gr-blocks/python/blocks/qa_pdu.py b/gr-blocks/python/blocks/qa_pdu.py
index 79d39df48..3ee5e576e 100755..100644
--- a/gr-blocks/python/blocks/qa_pdu.py
+++ b/gr-blocks/python/blocks/qa_pdu.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import time
from gnuradio import gr, gr_unittest, blocks
@@ -79,7 +80,7 @@ class test_pdu(gr_unittest.TestCase):
# Convert the PMT vector into a Python list
msg_data = []
- for i in xrange(16):
+ for i in range(16):
msg_data.append(pmt.u8vector_ref(msg_vec, i))
actual_data = 16*[0xFF,]
@@ -108,7 +109,7 @@ class test_pdu(gr_unittest.TestCase):
def test_002_tags_plus_data(self):
packet_len = 16
- src_data = range(packet_len)
+ src_data = list(range(packet_len))
tag1 = gr.tag_t()
tag1.offset = 0
tag1.key = pmt.string_to_symbol('spam')
diff --git a/gr-blocks/python/blocks/qa_peak_detector.py b/gr-blocks/python/blocks/qa_peak_detector.py
index c855e9253..cb253a5db 100644
--- a/gr-blocks/python/blocks/qa_peak_detector.py
+++ b/gr-blocks/python/blocks/qa_peak_detector.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_peak_detector(gr_unittest.TestCase):
diff --git a/gr-blocks/python/blocks/qa_peak_detector2.py b/gr-blocks/python/blocks/qa_peak_detector2.py
index d6fd4fe95..a7de40200 100644
--- a/gr-blocks/python/blocks/qa_peak_detector2.py
+++ b/gr-blocks/python/blocks/qa_peak_detector2.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_peak_detector2(gr_unittest.TestCase):
diff --git a/gr-blocks/python/blocks/qa_pipe_fittings.py b/gr-blocks/python/blocks/qa_pipe_fittings.py
index bc29cc750..b56915758 100755..100644
--- a/gr-blocks/python/blocks/qa_pipe_fittings.py
+++ b/gr-blocks/python/blocks/qa_pipe_fittings.py
@@ -20,13 +20,14 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
def calc_expected_result(src_data, n):
assert (len(src_data) % n) == 0
result = [list() for x in range(n)]
#print "len(result) =", len(result)
- for i in xrange(len(src_data)):
+ for i in range(len(src_data)):
(result[i % n]).append(src_data[i])
return [tuple(x) for x in result]
@@ -45,7 +46,7 @@ class test_pipe_fittings(gr_unittest.TestCase):
"""
n = 8
src_len = n * 8
- src_data = range(src_len)
+ src_data = list(range(src_len))
expected_results = calc_expected_result(src_data, n)
#print "expected results: ", expected_results
diff --git a/gr-blocks/python/blocks/qa_plateau_detector_fb.py b/gr-blocks/python/blocks/qa_plateau_detector_fb.py
index 003c4ea74..6a41a249e 100755..100644
--- a/gr-blocks/python/blocks/qa_plateau_detector_fb.py
+++ b/gr-blocks/python/blocks/qa_plateau_detector_fb.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class qa_plateau_detector_fb (gr_unittest.TestCase):
diff --git a/gr-blocks/python/blocks/qa_probe_signal.py b/gr-blocks/python/blocks/qa_probe_signal.py
index 8194cafdb..b7fd6b061 100644
--- a/gr-blocks/python/blocks/qa_probe_signal.py
+++ b/gr-blocks/python/blocks/qa_probe_signal.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_probe_signal(gr_unittest.TestCase):
diff --git a/gr-blocks/python/blocks/qa_python_message_passing.py b/gr-blocks/python/blocks/qa_python_message_passing.py
index 7bb5fbe10..49e2e5e48 100644
--- a/gr-blocks/python/blocks/qa_python_message_passing.py
+++ b/gr-blocks/python/blocks/qa_python_message_passing.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import pmt
import numpy
diff --git a/gr-blocks/python/blocks/qa_regenerate.py b/gr-blocks/python/blocks/qa_regenerate.py
index 52b6bdb51..65d76cfe1 100755..100644
--- a/gr-blocks/python/blocks/qa_regenerate.py
+++ b/gr-blocks/python/blocks/qa_regenerate.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_regenerate(gr_unittest.TestCase):
diff --git a/gr-blocks/python/blocks/qa_repack_bits_bb.py b/gr-blocks/python/blocks/qa_repack_bits_bb.py
index 50e150619..fa86c0cca 100755..100644
--- a/gr-blocks/python/blocks/qa_repack_bits_bb.py
+++ b/gr-blocks/python/blocks/qa_repack_bits_bb.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import random
from gnuradio import gr, gr_unittest, blocks
import pmt
diff --git a/gr-blocks/python/blocks/qa_repeat.py b/gr-blocks/python/blocks/qa_repeat.py
index eaf20d4e2..0054f8ce5 100755..100644
--- a/gr-blocks/python/blocks/qa_repeat.py
+++ b/gr-blocks/python/blocks/qa_repeat.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_repeat (gr_unittest.TestCase):
@@ -31,17 +32,17 @@ class test_repeat (gr_unittest.TestCase):
self.tb = None
def test_001_float(self):
- src_data = [n*1.0 for n in range(100)];
- dst_data = []
- for n in range(100):
- dst_data += [1.0*n, 1.0*n, 1.0*n]
-
- src = blocks.vector_source_f(src_data)
- rpt = blocks.repeat(gr.sizeof_float, 3)
- dst = blocks.vector_sink_f()
- self.tb.connect(src, rpt, dst)
- self.tb.run()
- self.assertFloatTuplesAlmostEqual(dst_data, dst.data(), 6)
+ src_data = [n*1.0 for n in range(100)];
+ dst_data = []
+ for n in range(100):
+ dst_data += [1.0*n, 1.0*n, 1.0*n]
+
+ src = blocks.vector_source_f(src_data)
+ rpt = blocks.repeat(gr.sizeof_float, 3)
+ dst = blocks.vector_sink_f()
+ self.tb.connect(src, rpt, dst)
+ self.tb.run()
+ self.assertFloatTuplesAlmostEqual(dst_data, dst.data(), 6)
if __name__ == '__main__':
gr_unittest.run(test_repeat, "test_repeat.xml")
diff --git a/gr-blocks/python/blocks/qa_rms.py b/gr-blocks/python/blocks/qa_rms.py
index 0b07c37bd..53c13b54d 100644
--- a/gr-blocks/python/blocks/qa_rms.py
+++ b/gr-blocks/python/blocks/qa_rms.py
@@ -20,19 +20,21 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, blocks
import math
def sig_source_f(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: amp*math.cos(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [amp*math.cos(2.*math.pi*freq*x) for x in t]
return y
def sig_source_c(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: amp*math.cos(2.*math.pi*freq*x) + \
- 1j*amp*math.sin(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [amp*math.cos(2.*math.pi*freq*x) + \
+ 1j*amp*math.sin(2.*math.pi*freq*x) for x in t]
return y
class test_rms(gr_unittest.TestCase):
@@ -48,7 +50,7 @@ class test_rms(gr_unittest.TestCase):
src_data = sig_source_f(1, 0.01, amp, 200)
N = 750000
- expected_data = amp/math.sqrt(2.0)
+ expected_data = amp / math.sqrt(2.0)
src = blocks.vector_source_f(src_data, True)
head = blocks.head(gr.sizeof_float, N)
diff --git a/gr-blocks/python/blocks/qa_sample_and_hold.py b/gr-blocks/python/blocks/qa_sample_and_hold.py
index f64514869..306151600 100644
--- a/gr-blocks/python/blocks/qa_sample_and_hold.py
+++ b/gr-blocks/python/blocks/qa_sample_and_hold.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import time
from gnuradio import gr, gr_unittest, blocks
diff --git a/gr-blocks/python/blocks/qa_skiphead.py b/gr-blocks/python/blocks/qa_skiphead.py
index a9b6df40c..6eed7b465 100755..100644
--- a/gr-blocks/python/blocks/qa_skiphead.py
+++ b/gr-blocks/python/blocks/qa_skiphead.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_skiphead(gr_unittest.TestCase):
diff --git a/gr-blocks/python/blocks/qa_socket_pdu.py b/gr-blocks/python/blocks/qa_socket_pdu.py
index 528558534..961dc914e 100755..100644
--- a/gr-blocks/python/blocks/qa_socket_pdu.py
+++ b/gr-blocks/python/blocks/qa_socket_pdu.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import random
import pmt
@@ -67,7 +68,7 @@ class qa_socket_pdu (gr_unittest.TestCase):
received = self.dbg.get_message(0)
received_data = pmt.cdr(received)
msg_data = []
- for i in xrange(4):
+ for i in range(4):
msg_data.append(pmt.u8vector_ref(received_data, i))
self.assertEqual(srcdata, tuple(msg_data))
@@ -104,7 +105,7 @@ class qa_socket_pdu (gr_unittest.TestCase):
# Test that the TCP server can stream PDUs <= the MTU size.
port = str(random.Random().randint(0, 30000) + 10000)
mtu = 10000
- srcdata = tuple([x % 256 for x in xrange(mtu)])
+ srcdata = tuple(x % 256 for x in range(mtu))
data = pmt.init_u8vector(srcdata.__len__(), srcdata)
pdu_msg = pmt.cons(pmt.PMT_NIL, data)
@@ -124,7 +125,7 @@ class qa_socket_pdu (gr_unittest.TestCase):
received = self.pdu_sink.get_message(0)
received_data = pmt.cdr(received)
msg_data = []
- for i in xrange(mtu):
+ for i in range(mtu):
msg_data.append(pmt.u8vector_ref(received_data, i))
self.assertEqual(srcdata, tuple(msg_data))
diff --git a/gr-blocks/python/blocks/qa_stream_mux.py b/gr-blocks/python/blocks/qa_stream_mux.py
index 3b470afa4..b09e6db76 100755..100644
--- a/gr-blocks/python/blocks/qa_stream_mux.py
+++ b/gr-blocks/python/blocks/qa_stream_mux.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import pmt
import os
@@ -49,8 +50,8 @@ class test_stream_mux (gr_unittest.TestCase):
return dst.data ()
def help_stream_ramp_2ff(self, N, stream_sizes):
- r1 = range(N)
- r2 = range(N)
+ r1 = list(range(N))
+ r2 = list(range(N))
r2.reverse()
v0 = blocks.vector_source_f(r1, False)
diff --git a/gr-blocks/python/blocks/qa_stream_to_tagged_stream.py b/gr-blocks/python/blocks/qa_stream_to_tagged_stream.py
index 0d3f503ab..27904ede0 100755..100644
--- a/gr-blocks/python/blocks/qa_stream_to_tagged_stream.py
+++ b/gr-blocks/python/blocks/qa_stream_to_tagged_stream.py
@@ -21,6 +21,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest
from gnuradio import blocks
@@ -34,7 +35,7 @@ class qa_stream_to_tagged_stream (gr_unittest.TestCase):
def test_001_t (self):
src_data = (1, ) * 50
- packet_len = 10L
+ packet_len = 10
len_tag_key = 'packet_len'
src = blocks.vector_source_f(src_data, False, 1)
tagger = blocks.stream_to_tagged_stream(gr.sizeof_float, 1, packet_len, len_tag_key)
@@ -44,7 +45,7 @@ class qa_stream_to_tagged_stream (gr_unittest.TestCase):
self.assertEqual(sink.data(), src_data)
tags = [gr.tag_to_python(x) for x in sink.tags()]
tags = sorted([(x.offset, x.key, x.value) for x in tags])
- expected_tags = [(long(pos), 'packet_len', packet_len) for pos in range(0, 50, 10) ]
+ expected_tags = [(int(pos), 'packet_len', packet_len) for pos in range(0, 50, 10) ]
self.assertEqual(tags, expected_tags)
diff --git a/gr-blocks/python/blocks/qa_stretch.py b/gr-blocks/python/blocks/qa_stretch.py
index e91a375ab..540d89c0c 100755..100644
--- a/gr-blocks/python/blocks/qa_stretch.py
+++ b/gr-blocks/python/blocks/qa_stretch.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, blocks
class test_stretch(gr_unittest.TestCase):
@@ -34,8 +36,8 @@ class test_stretch(gr_unittest.TestCase):
tb = self.tb
data = 10*[1,]
- data0 = map(lambda x: x/20.0, data)
- data1 = map(lambda x: x/10.0, data)
+ data0 = [x / 20.0 for x in data]
+ data1 = [x / 10.0 for x in data]
expected_result0 = 10*[0.05,]
expected_result1 = 10*[0.1,]
diff --git a/gr-blocks/python/blocks/qa_tag_debug.py b/gr-blocks/python/blocks/qa_tag_debug.py
index 5ccb285a5..68d131ac0 100755..100644
--- a/gr-blocks/python/blocks/qa_tag_debug.py
+++ b/gr-blocks/python/blocks/qa_tag_debug.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_tag_debug(gr_unittest.TestCase):
diff --git a/gr-blocks/python/blocks/qa_tag_file_sink.py b/gr-blocks/python/blocks/qa_tag_file_sink.py
index 250ad1add..bd4ee5438 100644
--- a/gr-blocks/python/blocks/qa_tag_file_sink.py
+++ b/gr-blocks/python/blocks/qa_tag_file_sink.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import os, struct
@@ -51,14 +52,14 @@ class test_tag_file_sink(gr_unittest.TestCase):
# Open the files and read in the data, then remove the files
# to clean up the directory.
- outfile0 = file(file0, 'rb')
- outfile1 = file(file1, 'rb')
- data0 = outfile0.read(8)
- data1 = outfile1.read(8)
+ outfile0 = open(file0, 'rb')
+ outfile1 = open(file1, 'rb')
+ data0 = outfile0.read(8)
+ data1 = outfile1.read(8)
outfile0.close()
outfile1.close()
- os.remove(file0)
- os.remove(file1)
+ os.remove(file0)
+ os.remove(file1)
# Convert the 8 bytes from the files into a tuple of 2 ints.
idata0 = struct.unpack('ii', data0)
diff --git a/gr-blocks/python/blocks/qa_tag_gate.py b/gr-blocks/python/blocks/qa_tag_gate.py
index 7ae676562..085abf337 100755..100644
--- a/gr-blocks/python/blocks/qa_tag_gate.py
+++ b/gr-blocks/python/blocks/qa_tag_gate.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import pmt
@@ -37,7 +38,7 @@ class qa_tag_gate (gr_unittest.TestCase):
tag.key = pmt.string_to_symbol('key')
tag.value = pmt.from_long(42)
tag.offset = 0
- src = blocks.vector_source_f(range(20), False, 1, (tag,))
+ src = blocks.vector_source_f(list(range(20)), False, 1, (tag,))
gate = blocks.tag_gate(gr.sizeof_float, False)
sink = blocks.vector_sink_f()
self.tb.connect(src, gate, sink)
diff --git a/gr-blocks/python/blocks/qa_tagged_stream_mux.py b/gr-blocks/python/blocks/qa_tagged_stream_mux.py
index 6f1c1c538..aeedd16c4 100755..100644
--- a/gr-blocks/python/blocks/qa_tagged_stream_mux.py
+++ b/gr-blocks/python/blocks/qa_tagged_stream_mux.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import numpy
import pmt
from gnuradio import gr, gr_unittest, blocks
@@ -84,9 +85,9 @@ class qa_tagged_stream_mux (gr_unittest.TestCase):
This will add a 'special' tag to item 0 on stream 1.
It should be on item 0 of the output stream. """
packet_len_0 = 5
- data0 = range(packet_len_0)
+ data0 = list(range(packet_len_0))
packet_len_1 = 3
- data1 = range(packet_len_1)
+ data1 = list(range(packet_len_1))
mux = blocks.tagged_stream_mux(
gr.sizeof_float,
self.tsb_key,
@@ -99,7 +100,7 @@ class qa_tagged_stream_mux (gr_unittest.TestCase):
(mux, 0)
)
self.tb.connect(
- blocks.vector_source_f(range(packet_len_1), tags=(make_tag('spam', 'eggs', 0),)),
+ blocks.vector_source_f(list(range(packet_len_1)), tags=(make_tag('spam', 'eggs', 0),)),
blocks.stream_to_tagged_stream(gr.sizeof_float, 1, packet_len_1, self.tsb_key),
(mux, 1)
)
diff --git a/gr-blocks/python/blocks/qa_tags_strobe.py b/gr-blocks/python/blocks/qa_tags_strobe.py
index c4e1b5d8b..e347e30c8 100644
--- a/gr-blocks/python/blocks/qa_tags_strobe.py
+++ b/gr-blocks/python/blocks/qa_tags_strobe.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, blocks
import pmt
import math
@@ -55,7 +57,7 @@ class test_tags_strobe(gr_unittest.TestCase):
def test_002(self):
N = 10000
nsamps = 123
- ntags = N / nsamps
+ ntags = N // nsamps
src = blocks.tags_strobe(gr.sizeof_float,
pmt.intern("TEST"), nsamps)
diff --git a/gr-blocks/python/blocks/qa_tcp_server_sink.py b/gr-blocks/python/blocks/qa_tcp_server_sink.py
index f7d3a0af9..96c6fcbe3 100644
--- a/gr-blocks/python/blocks/qa_tcp_server_sink.py
+++ b/gr-blocks/python/blocks/qa_tcp_server_sink.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import os
import socket
diff --git a/gr-blocks/python/blocks/qa_threshold.py b/gr-blocks/python/blocks/qa_threshold.py
index 49798426f..5b92ca1a7 100644
--- a/gr-blocks/python/blocks/qa_threshold.py
+++ b/gr-blocks/python/blocks/qa_threshold.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_threshold(gr_unittest.TestCase):
diff --git a/gr-blocks/python/blocks/qa_throttle.py b/gr-blocks/python/blocks/qa_throttle.py
index 7d18e87ad..dae489fec 100755..100644
--- a/gr-blocks/python/blocks/qa_throttle.py
+++ b/gr-blocks/python/blocks/qa_throttle.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
class test_throttle(gr_unittest.TestCase):
diff --git a/gr-blocks/python/blocks/qa_transcendental.py b/gr-blocks/python/blocks/qa_transcendental.py
index 1da56381f..ba30a62e3 100644
--- a/gr-blocks/python/blocks/qa_transcendental.py
+++ b/gr-blocks/python/blocks/qa_transcendental.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import math
diff --git a/gr-blocks/python/blocks/qa_tsb_vector_sink_X.py b/gr-blocks/python/blocks/qa_tsb_vector_sink_X.py
index ac3cd38d4..dca47b321 100755..100644
--- a/gr-blocks/python/blocks/qa_tsb_vector_sink_X.py
+++ b/gr-blocks/python/blocks/qa_tsb_vector_sink_X.py
@@ -21,6 +21,7 @@
# Boston, MA 02110-1301, USA.
#
+
import pmt
from gnuradio import gr, gr_unittest
from gnuradio import blocks
@@ -36,7 +37,7 @@ class qa_tsb_vector_sink (gr_unittest.TestCase):
def test_001_t (self):
packet_len = 4
- data = range(2 * packet_len)
+ data = list(range(2 * packet_len))
tag = gr.tag_t()
tag.key = pmt.intern("foo")
tag.offset = 5
diff --git a/gr-blocks/python/blocks/qa_type_conversions.py b/gr-blocks/python/blocks/qa_type_conversions.py
index cd600de2b..6206542ed 100755..100644
--- a/gr-blocks/python/blocks/qa_type_conversions.py
+++ b/gr-blocks/python/blocks/qa_type_conversions.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
from math import sqrt, atan2
diff --git a/gr-blocks/python/blocks/qa_udp_source_sink.py b/gr-blocks/python/blocks/qa_udp_source_sink.py
index 905b9e08a..f0418357f 100644
--- a/gr-blocks/python/blocks/qa_udp_source_sink.py
+++ b/gr-blocks/python/blocks/qa_udp_source_sink.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import os
diff --git a/gr-blocks/python/blocks/qa_unpack_k_bits.py b/gr-blocks/python/blocks/qa_unpack_k_bits.py
index 765c459df..f351e75d3 100755..100644
--- a/gr-blocks/python/blocks/qa_unpack_k_bits.py
+++ b/gr-blocks/python/blocks/qa_unpack_k_bits.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import random
diff --git a/gr-blocks/python/blocks/qa_vco.py b/gr-blocks/python/blocks/qa_vco.py
index fdd1eb100..a67fe36d6 100644
--- a/gr-blocks/python/blocks/qa_vco.py
+++ b/gr-blocks/python/blocks/qa_vco.py
@@ -20,18 +20,20 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, blocks
import math
def sig_source_f(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: amp*math.cos(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [amp*math.cos(2.*math.pi*freq*x) for x in t]
return y
def sig_source_c(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: math.cos(2.*math.pi*freq*x) + \
- 1j*math.sin(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [math.cos(2.*math.pi*freq*x) + \
+ 1j*math.sin(2.*math.pi*freq*x) for x in t]
return y
class test_vco(gr_unittest.TestCase):
@@ -49,7 +51,7 @@ class test_vco(gr_unittest.TestCase):
sig_source_f(1, 0.25, 1, 200)
src = blocks.vector_source_f(src_data)
- op = blocks.vco_f(1, math.pi/2.0, 1)
+ op = blocks.vco_f(1, math.pi / 2.0, 1)
dst = blocks.vector_sink_f()
self.tb.connect(src, op, dst)
@@ -66,7 +68,7 @@ class test_vco(gr_unittest.TestCase):
sig_source_c(1, 0.25, 1, 200)
src = blocks.vector_source_f(src_data)
- op = blocks.vco_c(1, math.pi/2.0, 1)
+ op = blocks.vco_c(1, math.pi / 2.0, 1)
dst = blocks.vector_sink_c()
self.tb.connect(src, op, dst)
diff --git a/gr-blocks/python/blocks/qa_vector_insert.py b/gr-blocks/python/blocks/qa_vector_insert.py
index b916e3d52..5913fee68 100755..100644
--- a/gr-blocks/python/blocks/qa_vector_insert.py
+++ b/gr-blocks/python/blocks/qa_vector_insert.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import math
diff --git a/gr-blocks/python/blocks/qa_vector_map.py b/gr-blocks/python/blocks/qa_vector_map.py
index 1c07de826..1e7545c2f 100644
--- a/gr-blocks/python/blocks/qa_vector_map.py
+++ b/gr-blocks/python/blocks/qa_vector_map.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import math
@@ -34,7 +35,7 @@ class test_vector_map(gr_unittest.TestCase):
def test_reversing(self):
# Chunk data in blocks of N and reverse the block contents.
N = 5
- src_data = range(0, 20)
+ src_data = list(range(0, 20))
expected_result = []
for i in range(N-1, len(src_data), N):
for j in range(0, N):
@@ -52,10 +53,10 @@ class test_vector_map(gr_unittest.TestCase):
# Split an input vector into N streams.
N = 5
M = 20
- src_data = range(0, M)
+ src_data = list(range(0, M))
expected_results = []
for n in range(0, N):
- expected_results.append(range(n, M, N))
+ expected_results.append(list(range(n, M, N)))
mapping = [[(0, n)] for n in range(0, N)]
src = blocks.vector_source_f(src_data, False, N)
vmap = blocks.vector_map(gr.sizeof_float, (N, ), mapping)
diff --git a/gr-blocks/python/blocks/qa_vector_sink_source.py b/gr-blocks/python/blocks/qa_vector_sink_source.py
index 026713f5f..c9bdfb4b5 100755..100644
--- a/gr-blocks/python/blocks/qa_vector_sink_source.py
+++ b/gr-blocks/python/blocks/qa_vector_sink_source.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import pmt
import math
diff --git a/gr-blocks/python/blocks/qa_wavfile.py b/gr-blocks/python/blocks/qa_wavfile.py
index 97978c936..761b0be9c 100755..100644
--- a/gr-blocks/python/blocks/qa_wavfile.py
+++ b/gr-blocks/python/blocks/qa_wavfile.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks
import os
@@ -38,35 +39,35 @@ class test_wavefile(gr_unittest.TestCase):
self.tb = None
def test_001_checkwavread(self):
- wf = blocks.wavfile_source(g_in_file)
- self.assertEqual(wf.sample_rate(), 8000)
+ wf = blocks.wavfile_source(g_in_file)
+ self.assertEqual(wf.sample_rate(), 8000)
def test_002_checkwavcopy(self):
- infile = g_in_file
- outfile = "test_out.wav"
+ infile = g_in_file
+ outfile = "test_out.wav"
- wf_in = blocks.wavfile_source(infile)
- wf_out = blocks.wavfile_sink(outfile,
+ wf_in = blocks.wavfile_source(infile)
+ wf_out = blocks.wavfile_sink(outfile,
wf_in.channels(),
wf_in.sample_rate(),
wf_in.bits_per_sample())
- self.tb.connect(wf_in, wf_out)
- self.tb.run()
- wf_out.close()
+ self.tb.connect(wf_in, wf_out)
+ self.tb.run()
+ wf_out.close()
- # we're losing all extra header chunks
- self.assertEqual(getsize(infile) - g_extra_header_len, getsize(outfile))
+ # we're losing all extra header chunks
+ self.assertEqual(getsize(infile) - g_extra_header_len, getsize(outfile))
- in_f = file(infile, 'rb')
- out_f = file(outfile, 'rb')
+ in_f = open(infile, 'rb')
+ out_f = open(outfile, 'rb')
- in_data = in_f.read()
- out_data = out_f.read()
+ in_data = in_f.read()
+ out_data = out_f.read()
out_f.close()
- os.remove(outfile)
- # cut extra header chunks input file
- self.assertEqual(in_data[:g_extra_header_offset] + \
- in_data[g_extra_header_offset + g_extra_header_len:], out_data)
+ os.remove(outfile)
+ # cut extra header chunks input file
+ self.assertEqual(in_data[:g_extra_header_offset] + \
+ in_data[g_extra_header_offset + g_extra_header_len:], out_data)
if __name__ == '__main__':
gr_unittest.run(test_wavefile, "test_wavefile.xml")
diff --git a/gr-blocks/python/blocks/stream_to_vector_decimator.py b/gr-blocks/python/blocks/stream_to_vector_decimator.py
index bcbfd96b8..9896ab8d3 100644
--- a/gr-blocks/python/blocks/stream_to_vector_decimator.py
+++ b/gr-blocks/python/blocks/stream_to_vector_decimator.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
#
# Copyright 2008 Free Software Foundation, Inc.
#
@@ -19,9 +20,11 @@
# Boston, MA 02110-1301, USA.
#
-import blocks_swig as blocks
from gnuradio import gr
+from . import blocks_swig as blocks
+
+
class stream_to_vector_decimator(gr.hier_block2):
"""
Convert the stream to a vector, decimate the vector stream to achieve the vector rate.
diff --git a/gr-blocks/swig/blocks_swig.py.in b/gr-blocks/swig/blocks_swig.py.in
index 7682f17d8..71ab4dac1 100644
--- a/gr-blocks/swig/blocks_swig.py.in
+++ b/gr-blocks/swig/blocks_swig.py.in
@@ -19,14 +19,16 @@
# Boston, MA 02110-1301, USA.
#
-from blocks_swig0 import *
-from blocks_swig1 import *
-from blocks_swig2 import *
-from blocks_swig3 import *
-from blocks_swig4 import *
-from blocks_swig5 import *
-from blocks_swig6 import *
-from blocks_swig7 import *
-from blocks_swig8 import *
-from blocks_swig9 import *
-from blocks_swig10 import *
+from __future__ import absolute_import
+
+from .blocks_swig0 import *
+from .blocks_swig1 import *
+from .blocks_swig2 import *
+from .blocks_swig3 import *
+from .blocks_swig4 import *
+from .blocks_swig5 import *
+from .blocks_swig6 import *
+from .blocks_swig7 import *
+from .blocks_swig8 import *
+from .blocks_swig9 import *
+from .blocks_swig10 import *
diff --git a/gr-channels/grc/CMakeLists.txt b/gr-channels/grc/CMakeLists.txt
index c85170b4e..a268d6938 100644
--- a/gr-channels/grc/CMakeLists.txt
+++ b/gr-channels/grc/CMakeLists.txt
@@ -17,7 +17,7 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-file(GLOB xml_files "*.xml")
-install(FILES ${xml_files}
+file(GLOB yml_files "*.yml")
+install(FILES ${yml_files}
DESTINATION ${GRC_BLOCKS_DIR}
)
diff --git a/gr-channels/grc/channels.tree.yml b/gr-channels/grc/channels.tree.yml
new file mode 100644
index 000000000..588246def
--- /dev/null
+++ b/gr-channels/grc/channels.tree.yml
@@ -0,0 +1,20 @@
+'[Core]':
+- Channel Models:
+ - channels_channel_model
+ - channels_channel_model2
+ - channels_conj_fs_iqcorr
+ - channels_fading_model
+ - channels_dynamic_channel_model
+ - channels_selective_fading_model
+ - channels_selective_fading_model2
+- Impairment Models:
+ - channels_impairments
+ - channels_quantizer
+ - channels_phase_noise_gen
+ - channels_iqbal_gen
+ - channels_distortion_2_gen
+ - channels_distortion_3_gen
+ - channels_amp_bal
+ - channels_phase_bal
+ - channels_cfo_model
+ - channels_sro_model
diff --git a/gr-channels/grc/channels_amp_bal.block.yml b/gr-channels/grc/channels_amp_bal.block.yml
new file mode 100644
index 000000000..6cefa2b58
--- /dev/null
+++ b/gr-channels/grc/channels_amp_bal.block.yml
@@ -0,0 +1,24 @@
+id: channels_amp_bal
+label: Amplitude Balance
+
+parameters:
+- id: alpha
+ label: Alpha
+ dtype: float
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import channels
+ make: channels.amp_bal(${alpha})
+ callbacks:
+ - set_alpha(${alpha})
+
+file_format: 1
diff --git a/gr-channels/grc/channels_amp_bal.xml b/gr-channels/grc/channels_amp_bal.xml
deleted file mode 100644
index 7e0738ec9..000000000
--- a/gr-channels/grc/channels_amp_bal.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Amplitude balance
-###################################################
- -->
-<block>
- <name>Amplitude Balance</name>
- <key>channels_amp_bal</key>
- <import>from gnuradio import channels</import>
- <make>channels.amp_bal($alpha)</make>
- <callback>set_alpha($alpha)</callback>
- <param>
- <name>Alpha</name>
- <key>alpha</key>
- <value>0</value>
- <type>float</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-channels/grc/channels_block_tree.xml b/gr-channels/grc/channels_block_tree.xml
deleted file mode 100644
index 80aabaf47..000000000
--- a/gr-channels/grc/channels_block_tree.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2012 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##Block Tree for GR Channel Model blocks.
-###################################################
- -->
-<cat>
- <name>[Core]</name>
- <cat>
- <name>Channel Models</name>
- <block>channels_channel_model</block>
- <block>channels_channel_model2</block>
- <block>channels_conj_fs_iqcorr</block>
- <block>channels_fading_model</block>
- <block>channels_dynamic_channel_model</block>
- <block>channels_selective_fading_model</block>
- <block>channels_selective_fading_model2</block>
- </cat>
- <cat>
- <name>Impairment Models</name>
- <block>channels_impairments</block>
- <block>channels_quantizer</block>
- <block>channels_phase_noise_gen</block>
- <block>channels_iqbal_gen</block>
- <block>channels_distortion_2_gen</block>
- <block>channels_distortion_3_gen</block>
- <block>channels_amp_bal</block>
- <block>channels_phase_bal</block>
- <block>channels_cfo_model</block>
- <block>channels_sro_model</block>
- </cat>
-</cat>
-
diff --git a/gr-channels/grc/channels_cfo_model.block.yml b/gr-channels/grc/channels_cfo_model.block.yml
new file mode 100644
index 000000000..daa4eb703
--- /dev/null
+++ b/gr-channels/grc/channels_cfo_model.block.yml
@@ -0,0 +1,44 @@
+id: channels_cfo_model
+label: CFO Model
+
+parameters:
+- id: srate
+ label: Sample Rate Hz
+ dtype: real
+ default: samp_rate
+- id: stdev
+ label: CFO Standard Deviation Hz per sample
+ dtype: real
+ default: '0.01'
+- id: maxdev
+ label: Max CFO Bound Hz
+ dtype: real
+ default: 1e3
+- id: seed
+ label: Seed
+ dtype: int
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import channels
+ make: |-
+ channels.cfo_model(
+ ${srate},
+ ${stdev},
+ ${maxdev},
+ ${seed}
+ )
+ callbacks:
+ - set_std_dev(${stdev})
+ - set_max_dev(${maxdev})
+ - set_samp_rate(${srate})
+
+file_format: 1
diff --git a/gr-channels/grc/channels_cfo_model.xml b/gr-channels/grc/channels_cfo_model.xml
deleted file mode 100644
index 7d44f7fe8..000000000
--- a/gr-channels/grc/channels_cfo_model.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##CFO Model
-###################################################
- -->
-<block>
- <name>CFO Model</name>
- <key>channels_cfo_model</key>
- <import>from gnuradio import channels</import>
- <make>channels.cfo_model(
- $srate,
- $stdev,
- $maxdev,
- $seed
-)</make>
- <callback>set_std_dev($stdev)</callback>
- <callback>set_max_dev($maxdev)</callback>
- <callback>set_samp_rate($srate)</callback>
- <param>
- <name>Sample Rate Hz</name>
- <key>srate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>CFO Standard Deviation Hz per sample</name>
- <key>stdev</key>
- <value>0.01</value>
- <type>real</type>
- </param>
- <param>
- <name>Max CFO Bound Hz</name>
- <key>maxdev</key>
- <value>1e3</value>
- <type>real</type>
- </param>
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>0</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-channels/grc/channels_channel_model.block.yml b/gr-channels/grc/channels_channel_model.block.yml
new file mode 100644
index 000000000..d2e166924
--- /dev/null
+++ b/gr-channels/grc/channels_channel_model.block.yml
@@ -0,0 +1,56 @@
+id: channels_channel_model
+label: Channel Model
+
+parameters:
+- id: noise_voltage
+ label: Noise Voltage
+ dtype: real
+ default: '0.0'
+- id: freq_offset
+ label: Frequency Offset
+ dtype: real
+ default: '0.0'
+- id: epsilon
+ label: Epsilon
+ dtype: real
+ default: '1.0'
+- id: taps
+ label: Taps
+ dtype: complex_vector
+ default: 1.0 + 1.0j
+- id: seed
+ label: Seed
+ dtype: int
+ default: '0'
+- id: block_tags
+ label: Block Tag Propagation
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ option_attributes:
+ hide_block: ['', part]
+ hide: ${ block_tags.hide_block }
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: |-
+ from gnuradio import channels
+ from gnuradio.filter import firdes
+ make: "channels.channel_model(\n\tnoise_voltage=${noise_voltage},\n\tfrequency_offset=${freq_offset},\n\
+ \tepsilon=${epsilon},\n\ttaps=${taps},\n\tnoise_seed=${seed},\n\tblock_tags=${block_tags}\n\
+ )"
+ callbacks:
+ - set_noise_voltage(${noise_voltage})
+ - set_frequency_offset(${freq_offset})
+ - set_taps(${taps})
+ - set_timing_offset(${epsilon})
+
+file_format: 1
diff --git a/gr-channels/grc/channels_channel_model.xml b/gr-channels/grc/channels_channel_model.xml
deleted file mode 100644
index 909301de9..000000000
--- a/gr-channels/grc/channels_channel_model.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Channel Model
-###################################################
- -->
-<block>
- <name>Channel Model</name>
- <key>channels_channel_model</key>
- <import>from gnuradio import channels</import>
- <import>from gnuradio.filter import firdes</import>
- <make>channels.channel_model(
- noise_voltage=$noise_voltage,
- frequency_offset=$freq_offset,
- epsilon=$epsilon,
- taps=$taps,
- noise_seed=$seed,
- block_tags=$block_tags
-)</make>
- <callback>set_noise_voltage($noise_voltage)</callback>
- <callback>set_frequency_offset($freq_offset)</callback>
- <callback>set_taps($taps)</callback>
- <callback>set_timing_offset($epsilon)</callback>
- <param>
- <name>Noise Voltage</name>
- <key>noise_voltage</key>
- <value>0.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Frequency Offset</name>
- <key>freq_offset</key>
- <value>0.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Epsilon</name>
- <key>epsilon</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Taps</name>
- <key>taps</key>
- <value>1.0 + 1.0j</value>
- <type>complex_vector</type>
- </param>
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Block Tag Propagation</name>
- <key>block_tags</key>
- <value>False</value>
- <type>enum</type>
- <hide>$block_tags.hide_block</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- <opt>hide_block:</opt>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- <opt>hide_block:part</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-channels/grc/channels_channel_model2.block.yml b/gr-channels/grc/channels_channel_model2.block.yml
new file mode 100644
index 000000000..f42a77c8d
--- /dev/null
+++ b/gr-channels/grc/channels_channel_model2.block.yml
@@ -0,0 +1,56 @@
+id: channels_channel_model2
+label: Channel Model 2
+
+parameters:
+- id: noise_voltage
+ label: Noise Voltage
+ dtype: real
+ default: '0.0'
+- id: epsilon
+ label: Time Offset
+ dtype: real
+ default: '1.0'
+- id: taps
+ label: Taps
+ dtype: complex_vector
+ default: 1.0 + 1.0j
+- id: seed
+ label: Seed
+ dtype: int
+ default: '0'
+- id: block_tags
+ label: Block Tag Propagation
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ option_attributes:
+ hide_block: ['', part]
+ hide: ${ block_tags.hide_block }
+
+inputs:
+- domain: stream
+ dtype: complex
+- label: freq
+ domain: stream
+ dtype: float
+- label: time
+ domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: |-
+ from gnuradio import channels
+ from gnuradio.filter import firdes
+ make: "channels.channel_model2(\n\tnoise_voltage=${noise_voltage},\n\tepsilon=${epsilon},\n\
+ \ttaps=${taps},\n\tnoise_seed=${seed},\n\tblock_tags=${block_tags}\n)"
+ callbacks:
+ - set_noise_voltage(${noise_voltage})
+ - set_taps(${taps})
+ - set_timing_offset(${epsilon})
+
+file_format: 1
diff --git a/gr-channels/grc/channels_channel_model2.xml b/gr-channels/grc/channels_channel_model2.xml
deleted file mode 100644
index 85355a102..000000000
--- a/gr-channels/grc/channels_channel_model2.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Channel Model
-###################################################
- -->
-<block>
- <name>Channel Model 2</name>
- <key>channels_channel_model2</key>
- <import>from gnuradio import channels</import>
- <import>from gnuradio.filter import firdes</import>
- <make>channels.channel_model2(
- noise_voltage=$noise_voltage,
- epsilon=$epsilon,
- taps=$taps,
- noise_seed=$seed,
- block_tags=$block_tags
-)</make>
- <callback>set_noise_voltage($noise_voltage)</callback>
- <callback>set_taps($taps)</callback>
- <callback>set_timing_offset($epsilon)</callback>
- <param>
- <name>Noise Voltage</name>
- <key>noise_voltage</key>
- <value>0.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Time Offset</name>
- <key>epsilon</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Taps</name>
- <key>taps</key>
- <value>1.0 + 1.0j</value>
- <type>complex_vector</type>
- </param>
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Block Tag Propagation</name>
- <key>block_tags</key>
- <value>False</value>
- <type>enum</type>
- <hide>$block_tags.hide_block</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- <opt>hide_block:</opt>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- <opt>hide_block:part</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <sink>
- <name>freq</name>
- <type>float</type>
- </sink>
- <sink>
- <name>time</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-channels/grc/channels_conj_fs_iqcorr.block.yml b/gr-channels/grc/channels_conj_fs_iqcorr.block.yml
new file mode 100644
index 000000000..66f9e1d3a
--- /dev/null
+++ b/gr-channels/grc/channels_conj_fs_iqcorr.block.yml
@@ -0,0 +1,29 @@
+id: channels_conj_fs_iqcorr
+label: Freq. Selective IQ Correction
+
+parameters:
+- id: delay
+ label: Delay
+ dtype: int
+ default: '0'
+- id: taps
+ label: Taps
+ dtype: complex_vector
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import channels
+ make: channels.conj_fs_iqcorr(${delay}, ${taps})
+ callbacks:
+ - set_delay(${delay})
+ - set_taps(${taps})
+
+file_format: 1
diff --git a/gr-channels/grc/channels_conj_fs_iqcorr.xml b/gr-channels/grc/channels_conj_fs_iqcorr.xml
deleted file mode 100644
index 354f1a203..000000000
--- a/gr-channels/grc/channels_conj_fs_iqcorr.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Freq. Selective IQ Correction
-###################################################
- -->
-<block>
- <name>Freq. Selective IQ Correction</name>
- <key>channels_conj_fs_iqcorr</key>
- <import>from gnuradio import channels</import>
- <make>channels.conj_fs_iqcorr($delay, $taps)</make>
- <callback>set_delay($delay)</callback>
- <callback>set_taps($taps)</callback>
- <param>
- <name>Delay</name>
- <key>delay</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Taps</name>
- <key>taps</key>
- <value>0</value>
- <type>complex_vector</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-channels/grc/channels_distortion_2_gen.block.yml b/gr-channels/grc/channels_distortion_2_gen.block.yml
new file mode 100644
index 000000000..f45bd06e7
--- /dev/null
+++ b/gr-channels/grc/channels_distortion_2_gen.block.yml
@@ -0,0 +1,24 @@
+id: channels_distortion_2_gen
+label: Second Order Distortion
+
+parameters:
+- id: beta
+ label: Distortion
+ dtype: float
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import channels
+ make: channels.distortion_2_gen(${beta})
+ callbacks:
+ - set_beta(${beta})
+
+file_format: 1
diff --git a/gr-channels/grc/channels_distortion_2_gen.xml b/gr-channels/grc/channels_distortion_2_gen.xml
deleted file mode 100644
index 5b117a9d0..000000000
--- a/gr-channels/grc/channels_distortion_2_gen.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Second Order Distortion Generator
-###################################################
- -->
-<block>
- <name>Second Order Distortion</name>
- <key>channels_distortion_2_gen</key>
- <import>from gnuradio import channels</import>
- <make>channels.distortion_2_gen($beta)</make>
- <callback>set_beta($beta)</callback>
- <param>
- <name>Distortion</name>
- <key>beta</key>
- <value>0</value>
- <type>float</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-channels/grc/channels_distortion_3_gen.block.yml b/gr-channels/grc/channels_distortion_3_gen.block.yml
new file mode 100644
index 000000000..f92677757
--- /dev/null
+++ b/gr-channels/grc/channels_distortion_3_gen.block.yml
@@ -0,0 +1,24 @@
+id: channels_distortion_3_gen
+label: Third Order Distortion
+
+parameters:
+- id: beta
+ label: Distortion
+ dtype: float
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import channels
+ make: channels.distortion_3_gen(${beta})
+ callbacks:
+ - set_beta(${beta})
+
+file_format: 1
diff --git a/gr-channels/grc/channels_distortion_3_gen.xml b/gr-channels/grc/channels_distortion_3_gen.xml
deleted file mode 100644
index 7bf145c27..000000000
--- a/gr-channels/grc/channels_distortion_3_gen.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Third Order Distortion Generator
-###################################################
- -->
-<block>
- <name>Third Order Distortion</name>
- <key>channels_distortion_3_gen</key>
- <import>from gnuradio import channels</import>
- <make>channels.distortion_3_gen($beta)</make>
- <callback>set_beta($beta)</callback>
- <param>
- <name>Distortion</name>
- <key>beta</key>
- <value>0</value>
- <type>float</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-channels/grc/channels_dynamic_channel_model.block.yml b/gr-channels/grc/channels_dynamic_channel_model.block.yml
new file mode 100644
index 000000000..a18adf878
--- /dev/null
+++ b/gr-channels/grc/channels_dynamic_channel_model.block.yml
@@ -0,0 +1,98 @@
+id: channels_dynamic_channel_model
+label: Dynamic Channel Model
+
+parameters:
+- id: samp_rate
+ label: Sample Rate Hz
+ dtype: real
+ default: samp_rate
+- id: cfo_stdev
+ label: CFO Standard Deviation Hz per sample
+ dtype: real
+ default: '0.01'
+- id: cfo_maxdev
+ label: Max CFO Bound Hz
+ dtype: real
+ default: 1e3
+- id: sro_stdev
+ label: SRO Standard Deviation Hz per sample
+ dtype: real
+ default: '0.01'
+- id: sro_maxdev
+ label: Max SRO Bound Hz
+ dtype: real
+ default: 1e3
+- id: noise_amp
+ label: White Noise Amplitude
+ dtype: real
+ default: '1.0'
+- id: N
+ label: Num Sinusoids (SoS model)
+ dtype: int
+ default: '8'
+- id: fD
+ label: Max Doppler Freq (Hz)
+ dtype: real
+ default: '2.0'
+- id: LOS
+ label: LOS Model
+ dtype: enum
+ options: ['False', 'True']
+ option_labels: [Rayleigh/NLOS, Rician/LOS]
+ option_attributes:
+ hide_K: [all, '']
+- id: K
+ label: Rician factor (K)
+ dtype: real
+ default: '4.0'
+ hide: ${ LOS.hide_K }
+- id: seed
+ label: Seed
+ dtype: int
+ default: '0'
+- id: delays
+ label: PDP Delays (samp)
+ dtype: real_vector
+ default: 0.0,0.1,1.3
+- id: mags
+ label: PDP Magnitudes
+ dtype: real_vector
+ default: 1,0.99,0.97
+- id: ntaps
+ label: Num Taps
+ dtype: int
+ default: '8'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import channels
+ make: channels.dynamic_channel_model( ${samp_rate}, ${sro_stdev}, ${sro_maxdev},
+ ${cfo_stdev}, ${cfo_maxdev}, ${N}, ${fD}, ${LOS}, ${K}, ${delays}, ${mags},
+ ${ntaps}, ${noise_amp}, ${seed} )
+ callbacks:
+ - set_samp_rate(${samp_rate})
+ - set_sro_dev_std(${sro_stdev})
+ - set_sro_dev_max(${sro_maxdev})
+ - set_cfo_dev_std(${cfo_stdev})
+ - set_cfo_dev_max(${cfo_maxdev})
+ - set_noise_amp(${noise_amp})
+ - set_doppler_freq(${fD})
+ - set_K(${K})
+
+documentation: |-
+ The dynamic channel model is a hier block consisting of the following effects:
+ - Dynamic Frequency Selective Fading Channel
+ - Dynamic Center Frequency Offset Model
+ - Dynamic Sample Rate Offset Model
+ - Additive White Gaussian Noise
+
+ The desired power delay profile and max doppler frequency may be provided to achieve the desired Ricean or Rayleigh fading scenario. For center frequency and sample rate offset models, a gaussian random walk process is conducted for each. The single sample step variance and maximum deviation for these two processes is specified and may be modified to simulate various desired stability effects. Lastly AWGN is added to simulate a typical receiver/thermal noise floor after propagation, and the variance may be modified here as desired.
+
+file_format: 1
diff --git a/gr-channels/grc/channels_dynamic_channel_model.xml b/gr-channels/grc/channels_dynamic_channel_model.xml
deleted file mode 100644
index d9022c579..000000000
--- a/gr-channels/grc/channels_dynamic_channel_model.xml
+++ /dev/null
@@ -1,136 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-# Dynamic Channel Model
-###################################################
- -->
-<block>
- <name>Dynamic Channel Model</name>
- <key>channels_dynamic_channel_model</key>
- <import>from gnuradio import channels</import>
- <make>channels.dynamic_channel_model( $samp_rate, $sro_stdev, $sro_maxdev, $cfo_stdev, $cfo_maxdev, $N, $fD, $LOS, $K, $delays, $mags, $ntaps, $noise_amp, $seed )</make>
-
- <callback>set_samp_rate($samp_rate)</callback>
- <callback>set_sro_dev_std($sro_stdev)</callback>
- <callback>set_sro_dev_max($sro_maxdev)</callback>
- <callback>set_cfo_dev_std($cfo_stdev)</callback>
- <callback>set_cfo_dev_max($cfo_maxdev)</callback>
- <callback>set_noise_amp($noise_amp)</callback>
- <callback>set_doppler_freq($fD)</callback>
- <callback>set_K($K)</callback>
-
- <param>
- <name>Sample Rate Hz</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>CFO Standard Deviation Hz per sample</name>
- <key>cfo_stdev</key>
- <value>0.01</value>
- <type>real</type>
- </param>
- <param>
- <name>Max CFO Bound Hz</name>
- <key>cfo_maxdev</key>
- <value>1e3</value>
- <type>real</type>
- </param>
-
- <param>
- <name>SRO Standard Deviation Hz per sample</name>
- <key>sro_stdev</key>
- <value>0.01</value>
- <type>real</type>
- </param>
- <param>
- <name>Max SRO Bound Hz</name>
- <key>sro_maxdev</key>
- <value>1e3</value>
- <type>real</type>
- </param>
-
- <param>
- <name>White Noise Amplitude</name>
- <key>noise_amp</key>
- <value>1.0</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Num Sinusoids (SoS model)</name>
- <key>N</key>
- <value>8</value>
- <type>int</type>
- </param>
- <param>
- <name>Max Doppler Freq (Hz)</name>
- <key>fD</key>
- <value>2.0</value>
- <type>real</type>
- </param>
- <param>
- <name>LOS Model</name>
- <key>LOS</key>
- <type>enum</type>
- <option>
- <name>Rayleigh/NLOS</name>
- <key>False</key>
- <opt>hide_K:all</opt>
- </option>
- <option>
- <name>Rician/LOS</name>
- <key>True</key>
- <opt>hide_K:</opt>
- </option>
- </param>
- <param>
- <name>Rician factor (K)</name>
- <key>K</key>
- <value>4.0</value>
- <type>real</type>
- <hide>$LOS.hide_K</hide>
- </param>
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>PDP Delays (samp)</name>
- <key>delays</key>
- <value>0.0,0.1,1.3</value>
- <type>real_vector</type>
- </param>
- <param>
- <name>PDP Magnitudes</name>
- <key>mags</key>
- <value>1,0.99,0.97</value>
- <type>real_vector</type>
- </param>
- <param>
- <name>Num Taps</name>
- <key>ntaps</key>
- <value>8</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
- <doc>
- The dynamic channel model is a hier block consisting of the following effects:
- - Dynamic Frequency Selective Fading Channel
- - Dynamic Center Frequency Offset Model
- - Dynamic Sample Rate Offset Model
- - Additive White Gaussian Noise
-
- The desired power delay profile and max doppler frequency may be provided to achieve the desired Ricean or Rayleigh fading scenario. For center frequency and sample rate offset models, a gaussian random walk process is conducted for each. The single sample step variance and maximum deviation for these two processes is specified and may be modified to simulate various desired stability effects. Lastly AWGN is added to simulate a typical receiver/thermal noise floor after propagation, and the variance may be modified here as desired.
- </doc>
-</block>
diff --git a/gr-channels/grc/channels_fading_model.block.yml b/gr-channels/grc/channels_fading_model.block.yml
new file mode 100644
index 000000000..7e1587feb
--- /dev/null
+++ b/gr-channels/grc/channels_fading_model.block.yml
@@ -0,0 +1,57 @@
+id: channels_fading_model
+label: Fading Model
+
+parameters:
+- id: N
+ label: Num Sinusoids (SoS model)
+ dtype: int
+ default: '8'
+- id: fDTs
+ label: Normalized Max Doppler (fD*Ts)
+ dtype: real
+ default: 10.0/samp_rate
+- id: LOS
+ label: LOS Model
+ dtype: enum
+ options: ['False', 'True']
+ option_labels: [Rayleigh/NLOS, Rician/LOS]
+ option_attributes:
+ hide_K: [all, '']
+- id: K
+ label: Rician factor (K)
+ dtype: real
+ default: '4.0'
+ hide: ${ LOS.hide_K }
+- id: seed
+ label: Seed
+ dtype: int
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import channels
+ make: channels.fading_model( ${N}, ${fDTs}, ${LOS}, ${K}, ${seed} )
+ callbacks:
+ - set_fDTs(${fDTs})
+ - set_K(${K})
+
+documentation: |-
+ This algorithm implements the method described in
+ Compact Rayleigh and Rician fading simulator based on random walk processes
+ A. Alimohammad S.F. Fard B.F. Cockburn C. Schlegel
+ 26th November 2008
+
+ int d_N=8; // number of sinusoids
+ float d_fDTs=0.01 // normalized maximum doppler frequency (f_doppler / f_samprate)
+ float d_K=4; // Rician factor (ratio of the specular power to the scattered power)
+ bool d_LOS=true; // LOS path exists? chooses Rician (LOS) vs Rayleigh (NLOS) model.
+ int seed=0; // noise seed
+
+file_format: 1
diff --git a/gr-channels/grc/channels_fading_model.xml b/gr-channels/grc/channels_fading_model.xml
deleted file mode 100644
index d47f0624f..000000000
--- a/gr-channels/grc/channels_fading_model.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Fading Model
-###################################################
- -->
-<block>
- <name>Fading Model</name>
- <key>channels_fading_model</key>
- <import>from gnuradio import channels</import>
- <make>channels.fading_model( $N, $fDTs, $LOS, $K, $seed )</make>
- <callback>set_fDTs($fDTs)</callback>
- <callback>set_K($K)</callback>
- <param>
- <name>Num Sinusoids (SoS model)</name>
- <key>N</key>
- <value>8</value>
- <type>int</type>
- </param>
- <param>
- <name>Normalized Max Doppler (fD*Ts)</name>
- <key>fDTs</key>
- <value>10.0/samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>LOS Model</name>
- <key>LOS</key>
- <type>enum</type>
- <option>
- <name>Rayleigh/NLOS</name>
- <key>False</key>
- <opt>hide_K:all</opt>
- </option>
- <option>
- <name>Rician/LOS</name>
- <key>True</key>
- <opt>hide_K:</opt>
- </option>
- </param>
- <param>
- <name>Rician factor (K)</name>
- <key>K</key>
- <value>4.0</value>
- <type>real</type>
- <hide>$LOS.hide_K</hide>
- </param>
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>0</value>
- <type>int</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
- <doc>
- This algorithm implements the method described in
- Compact Rayleigh and Rician fading simulator based on random walk processes
- A. Alimohammad S.F. Fard B.F. Cockburn C. Schlegel
- 26th November 2008
-
- int d_N=8; // number of sinusoids
- float d_fDTs=0.01 // normalized maximum doppler frequency (f_doppler / f_samprate)
- float d_K=4; // Rician factor (ratio of the specular power to the scattered power)
- bool d_LOS=true; // LOS path exists? chooses Rician (LOS) vs Rayleigh (NLOS) model.
- int seed=0; // noise seed
- </doc>
-</block>
diff --git a/gr-channels/grc/channels_impairments.block.yml b/gr-channels/grc/channels_impairments.block.yml
new file mode 100644
index 000000000..ccbdff9f4
--- /dev/null
+++ b/gr-channels/grc/channels_impairments.block.yml
@@ -0,0 +1,60 @@
+id: channels_impairments
+label: HW Impairments
+
+parameters:
+- id: phase_noise_mag
+ label: Phase Noise Mag.
+ dtype: float
+ default: '0'
+- id: magbal
+ label: IQ Mag. Imbalance
+ dtype: float
+ default: '0'
+- id: phasebal
+ label: IQ Phase. Imbalance
+ dtype: float
+ default: '0'
+- id: q_ofs
+ label: Quadrature Offset
+ dtype: float
+ default: '0'
+- id: i_ofs
+ label: Inphase Offset
+ dtype: float
+ default: '0'
+- id: freq_offset
+ label: Frequency Offset
+ dtype: float
+ default: '0'
+- id: gamma
+ label: Second Order Distortion
+ dtype: float
+ default: '0'
+- id: beta
+ label: Third Order Distortion
+ dtype: float
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import channels
+ make: channels.impairments(${phase_noise_mag}, ${magbal}, ${phasebal}, ${q_ofs},
+ ${i_ofs}, ${freq_offset}, ${gamma}, ${beta})
+ callbacks:
+ - set_phase_noise_mag(${phase_noise_mag})
+ - set_magbal(${magbal})
+ - set_phasebal(${phasebal})
+ - set_q_ofs(${q_ofs})
+ - set_i_ofs(${i_ofs})
+ - set_freq_offset(${freq_offset})
+ - set_gamma(${gamma})
+ - set_beta(${beta})
+
+file_format: 1
diff --git a/gr-channels/grc/channels_impairments.xml b/gr-channels/grc/channels_impairments.xml
deleted file mode 100644
index 12ee65c74..000000000
--- a/gr-channels/grc/channels_impairments.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Impairments Model
-###################################################
- -->
-<block>
- <name>HW Impairments</name>
- <key>channels_impairments</key>
- <import>from gnuradio import channels</import>
- <make>channels.impairments($phase_noise_mag, $magbal, $phasebal, $q_ofs, $i_ofs, $freq_offset, $gamma, $beta)</make>
- <callback>set_phase_noise_mag($phase_noise_mag)</callback>
- <callback>set_magbal($magbal)</callback>
- <callback>set_phasebal($phasebal)</callback>
- <callback>set_q_ofs($q_ofs)</callback>
- <callback>set_i_ofs($i_ofs)</callback>
- <callback>set_freq_offset($freq_offset)</callback>
- <callback>set_gamma($gamma)</callback>
- <callback>set_beta($beta)</callback>
- <param>
- <name>Phase Noise Mag.</name>
- <key>phase_noise_mag</key>
- <value>0</value>
- <type>float</type>
- </param>
- <param>
- <name>IQ Mag. Imbalance</name>
- <key>magbal</key>
- <value>0</value>
- <type>float</type>
- </param>
- <param>
- <name>IQ Phase. Imbalance</name>
- <key>phasebal</key>
- <value>0</value>
- <type>float</type>
- </param>
- <param>
- <name>Quadrature Offset</name>
- <key>q_ofs</key>
- <value>0</value>
- <type>float</type>
- </param>
- <param>
- <name>Inphase Offset</name>
- <key>i_ofs</key>
- <value>0</value>
- <type>float</type>
- </param>
- <param>
- <name>Frequency Offset</name>
- <key>freq_offset</key>
- <value>0</value>
- <type>float</type>
- </param>
- <param>
- <name>Second Order Distortion</name>
- <key>gamma</key>
- <value>0</value>
- <type>float</type>
- </param>
- <param>
- <name>Third Order Distortion</name>
- <key>beta</key>
- <value>0</value>
- <type>float</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-channels/grc/channels_iqbal_gen.block.yml b/gr-channels/grc/channels_iqbal_gen.block.yml
new file mode 100644
index 000000000..5b424761c
--- /dev/null
+++ b/gr-channels/grc/channels_iqbal_gen.block.yml
@@ -0,0 +1,29 @@
+id: channels_iqbal_gen
+label: IQ Imbalance Generator
+
+parameters:
+- id: mag
+ label: Magnitude
+ dtype: float
+ default: '0'
+- id: phase
+ label: Phase
+ dtype: float
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import channels
+ make: channels.iqbal_gen(${mag}, ${phase})
+ callbacks:
+ - set_magnitude(${mag})
+ - set_phase(${phase})
+
+file_format: 1
diff --git a/gr-channels/grc/channels_iqbal_gen.xml b/gr-channels/grc/channels_iqbal_gen.xml
deleted file mode 100644
index 9cb267ade..000000000
--- a/gr-channels/grc/channels_iqbal_gen.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##IQ Imbalance Generator
-###################################################
- -->
-<block>
- <name>IQ Imbalance Generator</name>
- <key>channels_iqbal_gen</key>
- <import>from gnuradio import channels</import>
- <make>channels.iqbal_gen($mag, $phase)</make>
- <callback>set_magnitude($mag)</callback>
- <callback>set_phase($phase)</callback>
- <param>
- <name>Magnitude</name>
- <key>mag</key>
- <value>0</value>
- <type>float</type>
- </param>
- <param>
- <name>Phase</name>
- <key>phase</key>
- <value>0</value>
- <type>float</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-channels/grc/channels_phase_bal.block.yml b/gr-channels/grc/channels_phase_bal.block.yml
new file mode 100644
index 000000000..70244cffe
--- /dev/null
+++ b/gr-channels/grc/channels_phase_bal.block.yml
@@ -0,0 +1,24 @@
+id: channels_phase_bal
+label: Phase Balance
+
+parameters:
+- id: alpha
+ label: Alpha
+ dtype: float
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import channels
+ make: channels.phase_bal(${alpha})
+ callbacks:
+ - set_alpha(${alpha})
+
+file_format: 1
diff --git a/gr-channels/grc/channels_phase_bal.xml b/gr-channels/grc/channels_phase_bal.xml
deleted file mode 100644
index ce17ab79a..000000000
--- a/gr-channels/grc/channels_phase_bal.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Phase balance
-###################################################
- -->
-<block>
- <name>Phase Balance</name>
- <key>channels_phase_bal</key>
- <import>from gnuradio import channels</import>
- <make>channels.phase_bal($alpha)</make>
- <callback>set_alpha($alpha)</callback>
- <param>
- <name>Alpha</name>
- <key>alpha</key>
- <value>0</value>
- <type>float</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-channels/grc/channels_phase_noise_gen.block.yml b/gr-channels/grc/channels_phase_noise_gen.block.yml
new file mode 100644
index 000000000..1310caad8
--- /dev/null
+++ b/gr-channels/grc/channels_phase_noise_gen.block.yml
@@ -0,0 +1,29 @@
+id: channels_phase_noise_gen
+label: Phase Noise Generator
+
+parameters:
+- id: noise_mag
+ label: Noise Magnitude
+ dtype: float
+ default: '0'
+- id: alpha
+ label: Alpha
+ dtype: float
+ default: '0.1'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import channels
+ make: channels.phase_noise_gen(${noise_mag}, ${alpha})
+ callbacks:
+ - set_noise_mag(${noise_mag})
+ - set_alpha(${alpha})
+
+file_format: 1
diff --git a/gr-channels/grc/channels_phase_noise_gen.xml b/gr-channels/grc/channels_phase_noise_gen.xml
deleted file mode 100644
index 852b4c996..000000000
--- a/gr-channels/grc/channels_phase_noise_gen.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Phase Noise Generator
-###################################################
- -->
-<block>
- <name>Phase Noise Generator</name>
- <key>channels_phase_noise_gen</key>
- <import>from gnuradio import channels</import>
- <make>channels.phase_noise_gen($noise_mag, $alpha)</make>
- <callback>set_noise_mag($noise_mag)</callback>
- <callback>set_alpha($alpha)</callback>
- <param>
- <name>Noise Magnitude</name>
- <key>noise_mag</key>
- <value>0</value>
- <type>float</type>
- </param>
- <param>
- <name>Alpha</name>
- <key>alpha</key>
- <value>0.1</value>
- <type>float</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-channels/grc/channels_quantizer.block.yml b/gr-channels/grc/channels_quantizer.block.yml
new file mode 100644
index 000000000..68fcf5029
--- /dev/null
+++ b/gr-channels/grc/channels_quantizer.block.yml
@@ -0,0 +1,24 @@
+id: channels_quantizer
+label: Quantizer
+
+parameters:
+- id: bits
+ label: Bits
+ dtype: int
+ default: '16'
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import channels
+ make: channels.quantizer(${bits})
+ callbacks:
+ - set_bits(${bits})
+
+file_format: 1
diff --git a/gr-channels/grc/channels_quantizer.xml b/gr-channels/grc/channels_quantizer.xml
deleted file mode 100644
index 57bed74ee..000000000
--- a/gr-channels/grc/channels_quantizer.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Quantization
-###################################################
- -->
-<block>
- <name>Quantizer</name>
- <key>channels_quantizer</key>
- <import>from gnuradio import channels</import>
- <make>channels.quantizer($bits)</make>
- <callback>set_bits($bits)</callback>
- <param>
- <name>Bits</name>
- <key>bits</key>
- <value>16</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-channels/grc/channels_selective_fading_model.block.yml b/gr-channels/grc/channels_selective_fading_model.block.yml
new file mode 100644
index 000000000..9898ee75a
--- /dev/null
+++ b/gr-channels/grc/channels_selective_fading_model.block.yml
@@ -0,0 +1,87 @@
+id: channels_selective_fading_model
+label: Frequency Selective Fading Model
+
+parameters:
+- id: N
+ label: Num Sinusoids (SoS model)
+ dtype: int
+ default: '8'
+- id: fDTs
+ label: Normalized Max Doppler (fD*Ts)
+ dtype: real
+ default: 10.0/samp_rate
+- id: LOS
+ label: LOS Model
+ dtype: enum
+ options: ['False', 'True']
+ option_labels: [Rayleigh/NLOS, Rician/LOS]
+ option_attributes:
+ hide_K: [all, '']
+- id: K
+ label: Rician factor (K)
+ dtype: real
+ default: '4.0'
+ hide: ${ LOS.hide_K }
+- id: seed
+ label: Seed
+ dtype: int
+ default: '0'
+- id: delays
+ label: PDP Delays (samp)
+ dtype: real_vector
+ default: 0.0,0.1,1.3
+- id: mags
+ label: PDP Magnitudes
+ dtype: real_vector
+ default: 1,0.99,0.97
+- id: ntaps
+ label: Num Taps
+ dtype: int
+ default: '8'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import channels
+ make: channels.selective_fading_model( ${N}, ${fDTs}, ${LOS}, ${K}, ${seed}, ${delays},
+ ${mags}, ${ntaps} )
+ callbacks:
+ - set_fDTs(${fDTs})
+ - set_K(${K})
+
+documentation: |-
+ int d_N=8; // number of sinusoids used to simulate gain on each ray
+ float d_fDTs=0.01 // normalized maximum doppler frequency (f_doppler / f_samprate)
+ float d_K=4; // Rician factor (ratio of the specular power to the scattered power)
+ bool d_LOS=true; // LOS path exists? chooses Rician (LOS) vs Rayleigh (NLOS) model.
+ int seed=0; // noise seed
+ int ntaps; // Number of FIR taps to use in selective fading model
+
+ These two vectors comprise the Power Delay Profile of the signal
+ float_vector delays // Time delay in the fir filter (in samples) for each arriving WSSUS Ray
+ float_vector mags // Magnitude corresponding to each WSSUS Ray
+
+ If using a LOS model, the first delay and mag should correspond with the LOS component
+
+ References:
+
+ The flat-fading portion of the algorithm implements the following
+ Compact Rayleigh and Rician fading simulator based on random walk processes
+ A. Alimohammad S.F. Fard B.F. Cockburn C. Schlegel
+ 26th November 2008
+
+ The frequency selective extension of the block roughly implements
+ A Low-Complexity Hardware Implementation of Discrete-Time
+ Frequency-Selective Rayleigh Fading Channels
+ F. Ren and Y. Zheng
+ 24-27 May 2009
+
+ Implementation by Tim O'Shea
+
+file_format: 1
diff --git a/gr-channels/grc/channels_selective_fading_model.xml b/gr-channels/grc/channels_selective_fading_model.xml
deleted file mode 100644
index c9b89a0da..000000000
--- a/gr-channels/grc/channels_selective_fading_model.xml
+++ /dev/null
@@ -1,109 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Frequency Selective Fading Model
-###################################################
- -->
-<block>
- <name>Frequency Selective Fading Model</name>
- <key>channels_selective_fading_model</key>
- <import>from gnuradio import channels</import>
- <make>channels.selective_fading_model( $N, $fDTs, $LOS, $K, $seed, $delays, $mags, $ntaps )</make>
- <callback>set_fDTs($fDTs)</callback>
- <callback>set_K($K)</callback>
- <param>
- <name>Num Sinusoids (SoS model)</name>
- <key>N</key>
- <value>8</value>
- <type>int</type>
- </param>
- <param>
- <name>Normalized Max Doppler (fD*Ts)</name>
- <key>fDTs</key>
- <value>10.0/samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>LOS Model</name>
- <key>LOS</key>
- <type>enum</type>
- <option>
- <name>Rayleigh/NLOS</name>
- <key>False</key>
- <opt>hide_K:all</opt>
- </option>
- <option>
- <name>Rician/LOS</name>
- <key>True</key>
- <opt>hide_K:</opt>
- </option>
- </param>
- <param>
- <name>Rician factor (K)</name>
- <key>K</key>
- <value>4.0</value>
- <type>real</type>
- <hide>$LOS.hide_K</hide>
- </param>
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>PDP Delays (samp)</name>
- <key>delays</key>
- <value>0.0,0.1,1.3</value>
- <type>real_vector</type>
- </param>
- <param>
- <name>PDP Magnitudes</name>
- <key>mags</key>
- <value>1,0.99,0.97</value>
- <type>real_vector</type>
- </param>
- <param>
- <name>Num Taps</name>
- <key>ntaps</key>
- <value>8</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
- <doc>
- int d_N=8; // number of sinusoids used to simulate gain on each ray
- float d_fDTs=0.01 // normalized maximum doppler frequency (f_doppler / f_samprate)
- float d_K=4; // Rician factor (ratio of the specular power to the scattered power)
- bool d_LOS=true; // LOS path exists? chooses Rician (LOS) vs Rayleigh (NLOS) model.
- int seed=0; // noise seed
- int ntaps; // Number of FIR taps to use in selective fading model
-
- These two vectors comprise the Power Delay Profile of the signal
- float_vector delays // Time delay in the fir filter (in samples) for each arriving WSSUS Ray
- float_vector mags // Magnitude corresponding to each WSSUS Ray
-
- If using a LOS model, the first delay and mag should correspond with the LOS component
-
- References:
-
- The flat-fading portion of the algorithm implements the following
- Compact Rayleigh and Rician fading simulator based on random walk processes
- A. Alimohammad S.F. Fard B.F. Cockburn C. Schlegel
- 26th November 2008
-
- The frequency selective extension of the block roughly implements
- A Low-Complexity Hardware Implementation of Discrete-Time
- Frequency-Selective Rayleigh Fading Channels
- F. Ren and Y. Zheng
- 24-27 May 2009
-
- Implementation by Tim O'Shea
- </doc>
-</block>
diff --git a/gr-channels/grc/channels_selective_fading_model2.block.yml b/gr-channels/grc/channels_selective_fading_model2.block.yml
new file mode 100644
index 000000000..1506c03fb
--- /dev/null
+++ b/gr-channels/grc/channels_selective_fading_model2.block.yml
@@ -0,0 +1,100 @@
+id: channels_selective_fading_model2
+label: Frequency Selective Fading Model2
+
+parameters:
+- id: N
+ label: Num Sinusoids (Stochastic SoS model + delay drift)
+ dtype: int
+ default: '8'
+- id: fDTs
+ label: Normalized Max Doppler (fD*Ts)
+ dtype: real
+ default: 0.2/samp_rate
+- id: LOS
+ label: LOS Model
+ dtype: enum
+ options: ['False', 'True']
+ option_labels: [Rayleigh/NLOS, Rician/LOS]
+ option_attributes:
+ hide_K: [all, '']
+- id: K
+ label: Rician factor (K)
+ dtype: real
+ default: '4.0'
+ hide: ${ LOS.hide_K }
+- id: seed
+ label: Seed
+ dtype: int
+ default: '0'
+- id: delays
+ label: PDP Delays (in samps)
+ dtype: real_vector
+ default: 1.0,1.9,2.7
+- id: delay_std
+ label: PDP Delay StdDev (per samp)
+ dtype: real_vector
+ default: 1e-4,1e-4,1e-4
+- id: delay_maxdev
+ label: PDP Delay Max-Dev (per samp)
+ dtype: real_vector
+ default: 0.5,0.7,0.9
+- id: mags
+ label: PDP Magnitudes
+ dtype: real_vector
+ default: 1,0.95,0.8
+- id: ntaps
+ label: Num Taps
+ dtype: int
+ default: '8'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+- domain: message
+ id: taps
+ optional: true
+
+templates:
+ imports: from gnuradio import channels
+ make: channels.selective_fading_model2( ${N}, ${fDTs}, ${LOS}, ${K}, ${seed},
+ ${delays}, ${delay_std}, ${delay_maxdev}, ${mags}, ${ntaps} )
+ callbacks:
+ - set_fDTs(${fDTs})
+ - set_K(${K})
+
+documentation: |-
+ int d_N=8; // number of sinusoids used to simulate gain on each ray
+ float d_fDTs=0.01 // normalized maximum doppler frequency (f_doppler / f_samprate)
+ float d_K=4; // Rician factor (ratio of the specular power to the scattered power)
+ bool d_LOS=true; // LOS path exists? chooses Rician (LOS) vs Rayleigh (NLOS) model.
+ int seed=0; // noise seed
+ int ntaps; // Number of FIR taps to use in selective fading model
+
+ These two vectors comprise the Power Delay Profile of the signal
+ float_vector delays // Time delay in the fir filter (in samples) for each arriving WSSUS Ray
+ float_vector mags // Magnitude corresponding to each WSSUS Ray
+
+ If using a LOS model, the first delay and mag should correspond with the LOS component
+
+ References:
+
+ The flat-fading portion of the algorithm implements the following
+ Compact Rayleigh and Rician fading simulator based on random walk processes
+ A. Alimohammad S.F. Fard B.F. Cockburn C. Schlegel
+ 26th November 2008
+ (Alogrithm III)
+ ( with a novel addition of time delay tap random walk )
+
+ The frequency selective extension of the block roughly implements
+ A Low-Complexity Hardware Implementation of Discrete-Time
+ Frequency-Selective Rayleigh Fading Channels
+ F. Ren and Y. Zheng
+ 24-27 May 2009
+
+ Implementation by Tim O'Shea
+
+file_format: 1
diff --git a/gr-channels/grc/channels_selective_fading_model2.xml b/gr-channels/grc/channels_selective_fading_model2.xml
deleted file mode 100644
index 1e1ea3a70..000000000
--- a/gr-channels/grc/channels_selective_fading_model2.xml
+++ /dev/null
@@ -1,128 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Frequency Selective Fading Model
-###################################################
- -->
-<block>
- <name>Frequency Selective Fading Model2</name>
- <key>channels_selective_fading_model2</key>
- <import>from gnuradio import channels</import>
- <make>channels.selective_fading_model2( $N, $fDTs, $LOS, $K, $seed, $delays, $delay_std, $delay_maxdev, $mags, $ntaps )</make>
- <callback>set_fDTs($fDTs)</callback>
- <callback>set_K($K)</callback>
- <param>
- <name>Num Sinusoids (Stochastic SoS model + delay drift)</name>
- <key>N</key>
- <value>8</value>
- <type>int</type>
- </param>
- <param>
- <name>Normalized Max Doppler (fD*Ts)</name>
- <key>fDTs</key>
- <value>0.2/samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>LOS Model</name>
- <key>LOS</key>
- <type>enum</type>
- <option>
- <name>Rayleigh/NLOS</name>
- <key>False</key>
- <opt>hide_K:all</opt>
- </option>
- <option>
- <name>Rician/LOS</name>
- <key>True</key>
- <opt>hide_K:</opt>
- </option>
- </param>
- <param>
- <name>Rician factor (K)</name>
- <key>K</key>
- <value>4.0</value>
- <type>real</type>
- <hide>$LOS.hide_K</hide>
- </param>
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>PDP Delays (in samps)</name>
- <key>delays</key>
- <value>1.0,1.9,2.7</value>
- <type>real_vector</type>
- </param>
- <param>
- <name>PDP Delay StdDev (per samp)</name>
- <key>delay_std</key>
- <value>1e-4,1e-4,1e-4</value>
- <type>real_vector</type>
- </param>
- <param>
- <name>PDP Delay Max-Dev (per samp)</name>
- <key>delay_maxdev</key>
- <value>0.5,0.7,0.9</value>
- <type>real_vector</type>
- </param>
- <param>
- <name>PDP Magnitudes</name>
- <key>mags</key>
- <value>1,0.95,0.8</value>
- <type>real_vector</type>
- </param>
- <param>
- <name>Num Taps</name>
- <key>ntaps</key>
- <value>8</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
- <source>
- <name>taps</name>
- <type>message</type>
- <optional>1</optional>
- </source>
- <doc>
- int d_N=8; // number of sinusoids used to simulate gain on each ray
- float d_fDTs=0.01 // normalized maximum doppler frequency (f_doppler / f_samprate)
- float d_K=4; // Rician factor (ratio of the specular power to the scattered power)
- bool d_LOS=true; // LOS path exists? chooses Rician (LOS) vs Rayleigh (NLOS) model.
- int seed=0; // noise seed
- int ntaps; // Number of FIR taps to use in selective fading model
-
- These two vectors comprise the Power Delay Profile of the signal
- float_vector delays // Time delay in the fir filter (in samples) for each arriving WSSUS Ray
- float_vector mags // Magnitude corresponding to each WSSUS Ray
-
- If using a LOS model, the first delay and mag should correspond with the LOS component
-
- References:
-
- The flat-fading portion of the algorithm implements the following
- Compact Rayleigh and Rician fading simulator based on random walk processes
- A. Alimohammad S.F. Fard B.F. Cockburn C. Schlegel
- 26th November 2008
- (Alogrithm III)
- ( with a novel addition of time delay tap random walk )
-
- The frequency selective extension of the block roughly implements
- A Low-Complexity Hardware Implementation of Discrete-Time
- Frequency-Selective Rayleigh Fading Channels
- F. Ren and Y. Zheng
- 24-27 May 2009
-
- Implementation by Tim O'Shea
- </doc>
-</block>
diff --git a/gr-channels/grc/channels_sro_model.block.yml b/gr-channels/grc/channels_sro_model.block.yml
new file mode 100644
index 000000000..8da9a5b25
--- /dev/null
+++ b/gr-channels/grc/channels_sro_model.block.yml
@@ -0,0 +1,44 @@
+id: channels_sro_model
+label: SRO Model
+
+parameters:
+- id: srate
+ label: Sample Rate Hz
+ dtype: real
+ default: samp_rate
+- id: stdev
+ label: SRO Standard Deviation Hz per sample
+ dtype: real
+ default: '0.01'
+- id: maxdev
+ label: Max SRO Bound Hz
+ dtype: real
+ default: 1e3
+- id: seed
+ label: Seed
+ dtype: int
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import channels
+ make: |-
+ channels.sro_model(
+ ${srate},
+ ${stdev},
+ ${maxdev},
+ ${seed}
+ )
+ callbacks:
+ - set_std_dev(${stdev})
+ - set_max_dev(${maxdev})
+ - set_samp_rate(${srate})
+
+file_format: 1
diff --git a/gr-channels/grc/channels_sro_model.xml b/gr-channels/grc/channels_sro_model.xml
deleted file mode 100644
index 63752aaef..000000000
--- a/gr-channels/grc/channels_sro_model.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##SRO Model
-###################################################
- -->
-<block>
- <name>SRO Model</name>
- <key>channels_sro_model</key>
- <import>from gnuradio import channels</import>
- <make>channels.sro_model(
- $srate,
- $stdev,
- $maxdev,
- $seed
-)</make>
- <callback>set_std_dev($stdev)</callback>
- <callback>set_max_dev($maxdev)</callback>
- <callback>set_samp_rate($srate)</callback>
- <param>
- <name>Sample Rate Hz</name>
- <key>srate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>SRO Standard Deviation Hz per sample</name>
- <key>stdev</key>
- <value>0.01</value>
- <type>real</type>
- </param>
- <param>
- <name>Max SRO Bound Hz</name>
- <key>maxdev</key>
- <value>1e3</value>
- <type>real</type>
- </param>
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>0</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-channels/python/channels/CMakeLists.txt b/gr-channels/python/channels/CMakeLists.txt
index a91033df7..391b86893 100644
--- a/gr-channels/python/channels/CMakeLists.txt
+++ b/gr-channels/python/channels/CMakeLists.txt
@@ -50,6 +50,6 @@ if(ENABLE_TESTING)
file (GLOB py_qa_test_files "qa_*.py")
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gr-channels/python/channels/__init__.py b/gr-channels/python/channels/__init__.py
index ae4c4ab71..1bae9b44e 100644
--- a/gr-channels/python/channels/__init__.py
+++ b/gr-channels/python/channels/__init__.py
@@ -22,23 +22,25 @@
'''
Blocks for channel models and related functions.
'''
+from __future__ import absolute_import
+from __future__ import unicode_literals
import os
try:
- from channels_swig import *
+ from .channels_swig import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
- from channels_swig import *
+ from .channels_swig import *
# Blocks for Hardware Impairments
-from amp_bal import *
-from conj_fs_iqcorr import *
-from distortion_2_gen import *
-from distortion_3_gen import *
-from iqbal_gen import *
-from impairments import *
-from phase_bal import *
-from phase_noise_gen import *
-from quantizer import *
+from .amp_bal import *
+from .conj_fs_iqcorr import *
+from .distortion_2_gen import *
+from .distortion_3_gen import *
+from .iqbal_gen import *
+from .impairments import *
+from .phase_bal import *
+from .phase_noise_gen import *
+from .quantizer import *
diff --git a/gr-channels/python/channels/amp_bal.py b/gr-channels/python/channels/amp_bal.py
index 30e0f0d8e..0ec3db8ab 100644
--- a/gr-channels/python/channels/amp_bal.py
+++ b/gr-channels/python/channels/amp_bal.py
@@ -7,6 +7,7 @@
# Generated: Thu Aug 1 11:47:46 2013
##################################################
+from __future__ import unicode_literals
from gnuradio import blocks
from gnuradio import gr
from gnuradio.filter import firdes
diff --git a/gr-channels/python/channels/conj_fs_iqcorr.py b/gr-channels/python/channels/conj_fs_iqcorr.py
index 700eb645c..f9873f160 100644
--- a/gr-channels/python/channels/conj_fs_iqcorr.py
+++ b/gr-channels/python/channels/conj_fs_iqcorr.py
@@ -7,6 +7,7 @@
# Generated: Thu Aug 1 13:00:27 2013
##################################################
+from __future__ import unicode_literals
from gnuradio import blocks
from gnuradio import filter
from gnuradio import gr
diff --git a/gr-channels/python/channels/distortion_2_gen.py b/gr-channels/python/channels/distortion_2_gen.py
index f8933cf7a..cf44fd8d2 100644
--- a/gr-channels/python/channels/distortion_2_gen.py
+++ b/gr-channels/python/channels/distortion_2_gen.py
@@ -6,6 +6,7 @@
# Generated: Thu Aug 1 12:30:23 2013
##################################################
+from __future__ import unicode_literals
from gnuradio import blocks
from gnuradio import gr
from gnuradio.filter import firdes
diff --git a/gr-channels/python/channels/distortion_3_gen.py b/gr-channels/python/channels/distortion_3_gen.py
index 1607e01bf..9cb388806 100644
--- a/gr-channels/python/channels/distortion_3_gen.py
+++ b/gr-channels/python/channels/distortion_3_gen.py
@@ -6,6 +6,7 @@
# Generated: Thu Aug 1 12:37:59 2013
##################################################
+from __future__ import unicode_literals
from gnuradio import blocks
from gnuradio import gr
from gnuradio.filter import firdes
diff --git a/gr-channels/python/channels/impairments.py b/gr-channels/python/channels/impairments.py
index 3da838a90..5e2319a5d 100644
--- a/gr-channels/python/channels/impairments.py
+++ b/gr-channels/python/channels/impairments.py
@@ -6,6 +6,9 @@
# Generated: Thu Aug 1 12:46:10 2013
##################################################
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import analog
from gnuradio import blocks
from gnuradio import gr
@@ -13,10 +16,10 @@ from gnuradio.filter import firdes
import math
#Import locally
-from phase_noise_gen import *
-from iqbal_gen import *
-from distortion_2_gen import *
-from distortion_3_gen import *
+from .phase_noise_gen import *
+from .iqbal_gen import *
+from .distortion_2_gen import *
+from .distortion_3_gen import *
class impairments(gr.hier_block2):
@@ -42,7 +45,7 @@ class impairments(gr.hier_block2):
##################################################
# Blocks
##################################################
- self.channels_phase_noise_gen_0_0 = phase_noise_gen(math.pow(10.0,phase_noise_mag/20.0), .01)
+ self.channels_phase_noise_gen_0_0 = phase_noise_gen(math.pow(10.0,phase_noise_mag / 20.0), .01)
self.channels_iqbal_gen_0 = iqbal_gen(magbal, phasebal)
self.channels_distortion_3_gen_0 = distortion_3_gen(beta)
self.channels_distortion_2_gen_0 = distortion_2_gen(gamma)
@@ -75,7 +78,7 @@ class impairments(gr.hier_block2):
def set_phase_noise_mag(self, phase_noise_mag):
self.phase_noise_mag = phase_noise_mag
- self.channels_phase_noise_gen_0_0.set_noise_mag(math.pow(10.0,self.phase_noise_mag/20.0))
+ self.channels_phase_noise_gen_0_0.set_noise_mag(math.pow(10.0,self.phase_noise_mag / 20.0))
def get_magbal(self):
return self.magbal
diff --git a/gr-channels/python/channels/iqbal_gen.py b/gr-channels/python/channels/iqbal_gen.py
index d42ca2277..bfe439350 100644
--- a/gr-channels/python/channels/iqbal_gen.py
+++ b/gr-channels/python/channels/iqbal_gen.py
@@ -6,6 +6,8 @@
# Generated: Thu Aug 1 12:08:07 2013
##################################################
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import blocks
from gnuradio import gr
from gnuradio.filter import firdes
@@ -29,7 +31,7 @@ class iqbal_gen(gr.hier_block2):
##################################################
# Blocks
##################################################
- self.mag = blocks.multiply_const_vff((math.pow(10,magnitude/20.0), ))
+ self.mag = blocks.multiply_const_vff((math.pow(10,magnitude / 20.0), ))
self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((math.sin(phase*math.pi/180.0), ))
self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
self.blocks_complex_to_float_0 = blocks.complex_to_float(1)
@@ -55,7 +57,7 @@ class iqbal_gen(gr.hier_block2):
def set_magnitude(self, magnitude):
self.magnitude = magnitude
- self.mag.set_k((math.pow(10,self.magnitude/20.0), ))
+ self.mag.set_k((math.pow(10,self.magnitude / 20.0), ))
def get_phase(self):
return self.phase
diff --git a/gr-channels/python/channels/phase_bal.py b/gr-channels/python/channels/phase_bal.py
index b760e6f43..2ebdebcc2 100644
--- a/gr-channels/python/channels/phase_bal.py
+++ b/gr-channels/python/channels/phase_bal.py
@@ -6,6 +6,7 @@
# Generated: Thu Aug 1 11:49:41 2013
##################################################
+from __future__ import unicode_literals
from gnuradio import blocks
from gnuradio import filter
from gnuradio import gr
diff --git a/gr-channels/python/channels/phase_noise_gen.py b/gr-channels/python/channels/phase_noise_gen.py
index 95c5676e4..5e05c0a10 100644
--- a/gr-channels/python/channels/phase_noise_gen.py
+++ b/gr-channels/python/channels/phase_noise_gen.py
@@ -6,6 +6,7 @@
# Generated: Thu Aug 1 11:59:39 2013
##################################################
+from __future__ import unicode_literals
from gnuradio import analog
from gnuradio import blocks
from gnuradio import filter
diff --git a/gr-channels/python/channels/qa_channel_model.py b/gr-channels/python/channels/qa_channel_model.py
index fed542f44..53cc80f91 100755..100644
--- a/gr-channels/python/channels/qa_channel_model.py
+++ b/gr-channels/python/channels/qa_channel_model.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, analog, blocks, channels
import math
diff --git a/gr-channels/python/channels/qa_fading_model.py b/gr-channels/python/channels/qa_fading_model.py
index 1e99312e8..84ca531d6 100644
--- a/gr-channels/python/channels/qa_fading_model.py
+++ b/gr-channels/python/channels/qa_fading_model.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, analog, blocks, channels
import math
diff --git a/gr-channels/python/channels/quantizer.py b/gr-channels/python/channels/quantizer.py
index a3d918c7c..897a1eb43 100644
--- a/gr-channels/python/channels/quantizer.py
+++ b/gr-channels/python/channels/quantizer.py
@@ -5,6 +5,8 @@
# Generated: Thu Aug 1 11:09:51 2013
##################################################
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import blocks
from gnuradio import gr
from gnuradio.filter import firdes
@@ -27,7 +29,7 @@ class quantizer(gr.hier_block2):
# Blocks
##################################################
self.blocks_short_to_float_0 = blocks.short_to_float(1, 1)
- self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((1.0/pow(2.0,bits-1.0), ))
+ self.blocks_multiply_const_vxx_0_0 = blocks.multiply_const_vff((1.0 / pow(2.0,bits-1.0), ))
self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vff((pow(2,bits-1.0), ))
self.blocks_float_to_short_0 = blocks.float_to_short(1, 1)
@@ -48,7 +50,7 @@ class quantizer(gr.hier_block2):
def set_bits(self, bits):
self.bits = bits
- self.blocks_multiply_const_vxx_0_0.set_k((1.0/pow(2.0,self.bits-1.0), ))
+ self.blocks_multiply_const_vxx_0_0.set_k((1.0 / pow(2.0,self.bits-1.0), ))
self.blocks_multiply_const_vxx_0.set_k((pow(2,self.bits-1.0), ))
diff --git a/gr-comedi/python/comedi/CMakeLists.txt b/gr-comedi/python/comedi/CMakeLists.txt
index e3f7031a2..b3e983e9b 100644
--- a/gr-comedi/python/comedi/CMakeLists.txt
+++ b/gr-comedi/python/comedi/CMakeLists.txt
@@ -43,6 +43,6 @@ if(ENABLE_TESTING)
file(GLOB py_qa_test_files "qa_*.py")
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gr-comedi/python/comedi/__init__.py b/gr-comedi/python/comedi/__init__.py
index 701b82af7..f9f1124e5 100644
--- a/gr-comedi/python/comedi/__init__.py
+++ b/gr-comedi/python/comedi/__init__.py
@@ -21,13 +21,14 @@
'''
Blocks and utilities for COMEDI devices
'''
+from __future__ import unicode_literals
# The presence of this file turns this directory into a Python package
import os
try:
- from comedi_swig import *
+ from .comedi_swig import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
- from comedi_swig import *
+ from .comedi_swig import *
diff --git a/gr-comedi/python/comedi/qa_comedi.py b/gr-comedi/python/comedi/qa_comedi.py
index 08ec92dd1..f4dc7b777 100755..100644
--- a/gr-comedi/python/comedi/qa_comedi.py
+++ b/gr-comedi/python/comedi/qa_comedi.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, comedi
class test_comedi(gr_unittest.TestCase):
diff --git a/gr-digital/examples/berawgn.py b/gr-digital/examples/berawgn.py
index c47d99174..886c93bdf 100755..100644
--- a/gr-digital/examples/berawgn.py
+++ b/gr-digital/examples/berawgn.py
@@ -32,6 +32,10 @@ Of course, expect the maximum value for BER to be one order of
magnitude below what you chose for N_BITS.
"""
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
import math
import numpy
@@ -43,13 +47,13 @@ import sys
try:
from scipy.special import erfc
except ImportError:
- print "Error: could not import scipy (http://www.scipy.org/)"
+ print("Error: could not import scipy (http://www.scipy.org/)")
sys.exit(1)
try:
import pylab
except ImportError:
- print "Error: could not import pylab (http://matplotlib.sourceforge.net/)"
+ print("Error: could not import pylab (http://matplotlib.sourceforge.net/)")
sys.exit(1)
# Best to choose powers of 10
@@ -58,7 +62,7 @@ RAND_SEED = 42
def berawgn(EbN0):
""" Calculates theoretical bit error rate in AWGN (for BPSK and given Eb/N0) """
- return 0.5 * erfc(math.sqrt(10**(float(EbN0)/10)))
+ return 0.5 * erfc(math.sqrt(10**(float(EbN0) / 10)))
class BitErrors(gr.hier_block2):
""" Two inputs: true and received bits. We compare them and
@@ -81,7 +85,7 @@ class BitErrors(gr.hier_block2):
blocks.unpack_k_bits_bb(bits_per_byte),
blocks.uchar_to_float(),
blocks.integrate_ff(intdump_decim),
- blocks.multiply_const_ff(1.0/N_BITS),
+ blocks.multiply_const_ff(1.0 / N_BITS),
self)
self.connect((self, 1), (comp, 1))
@@ -91,7 +95,7 @@ class BERAWGNSimu(gr.top_block):
gr.top_block.__init__(self)
self.const = digital.qpsk_constellation()
# Source is N_BITS bits, non-repeated
- data = map(int, numpy.random.randint(0, self.const.arity(), N_BITS/self.const.bits_per_symbol()))
+ data = list(map(int, numpy.random.randint(0, self.const.arity(), N_BITS / self.const.bits_per_symbol())))
src = blocks.vector_source_b(data, False)
mod = digital.chunks_to_symbols_bc((self.const.points()), 1)
add = blocks.add_vcc()
@@ -107,12 +111,12 @@ class BERAWGNSimu(gr.top_block):
def EbN0_to_noise_voltage(self, EbN0):
""" Converts Eb/N0 to a complex noise voltage (assuming unit symbol power) """
- return 1.0 / math.sqrt(self.const.bits_per_symbol() * 10**(float(EbN0)/10))
+ return 1.0 / math.sqrt(self.const.bits_per_symbol( * 10**(float(EbN0) / 10)))
def simulate_ber(EbN0):
""" All the work's done here: create flow graph, run, read out BER """
- print "Eb/N0 = %d dB" % EbN0
+ print("Eb/N0 = %d dB" % EbN0)
fg = BERAWGNSimu(EbN0)
fg.run()
return numpy.sum(fg.sink.data())
@@ -120,9 +124,9 @@ def simulate_ber(EbN0):
if __name__ == "__main__":
EbN0_min = 0
EbN0_max = 15
- EbN0_range = range(EbN0_min, EbN0_max+1)
+ EbN0_range = list(range(EbN0_min, EbN0_max+1))
ber_theory = [berawgn(x) for x in EbN0_range]
- print "Simulating..."
+ print("Simulating...")
ber_simu = [simulate_ber(x) for x in EbN0_range]
f = pylab.figure()
@@ -135,4 +139,3 @@ if __name__ == "__main__":
s.legend()
s.grid()
pylab.show()
-
diff --git a/gr-digital/examples/demod/pam_timing.grc b/gr-digital/examples/demod/pam_timing.grc
index cb1f1ad98..3c0fcfeda 100644
--- a/gr-digital/examples/demod/pam_timing.grc
+++ b/gr-digital/examples/demod/pam_timing.grc
@@ -1,22 +1,23 @@
-<?xml version='1.0' encoding='ASCII'?>
+<?xml version='1.0' encoding='utf-8'?>
+<?grc format='1' created='3.7.10'?>
<flow_graph>
<timestamp>Sat Jul 12 13:50:56 2014</timestamp>
<block>
<key>options</key>
<param>
- <key>id</key>
- <value>pam_timing</value>
+ <key>author</key>
+ <value></value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>window_size</key>
+ <value>1280, 1024</value>
</param>
<param>
- <key>title</key>
- <value></value>
+ <key>category</key>
+ <value>Custom</value>
</param>
<param>
- <key>author</key>
+ <key>comment</key>
<value></value>
</param>
<param>
@@ -24,16 +25,44 @@
<value></value>
</param>
<param>
- <key>window_size</key>
- <value>1280, 1024</value>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(-1, 0)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
</param>
<param>
<key>generate_options</key>
<value>qt_gui</value>
</param>
<param>
- <key>category</key>
- <value>Custom</value>
+ <key>hier_block_src_path</key>
+ <value>.:</value>
+ </param>
+ <param>
+ <key>id</key>
+ <value>pam_timing</value>
+ </param>
+ <param>
+ <key>max_nouts</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>qt_qss_theme</key>
+ <value></value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>run_command</key>
+ <value>{python} -u {filename}</value>
</param>
<param>
<key>run_options</key>
@@ -44,233 +73,445 @@
<value>True</value>
</param>
<param>
- <key>max_nouts</key>
- <value>0</value>
+ <key>thread_safe_setters</key>
+ <value></value>
</param>
<param>
- <key>realtime_scheduling</key>
+ <key>title</key>
<value></value>
</param>
+ </block>
+ <block>
+ <key>variable</key>
<param>
- <key>alias</key>
+ <key>comment</key>
<value></value>
</param>
<param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
<key>_coordinate</key>
- <value>(-1, 0)</value>
+ <value>(206, 116)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
- </block>
- <block>
- <key>variable</key>
<param>
<key>id</key>
<value>const</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
<key>value</key>
<value>digital.qpsk_constellation()</value>
</param>
+ </block>
+ <block>
+ <key>variable_qtgui_range</key>
<param>
- <key>alias</key>
+ <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>(206, 116)</value>
+ <value>(268, 527)</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value>4,2,1,1</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
- </block>
- <block>
- <key>variable</key>
<param>
<key>id</key>
- <value>sig_amp</value>
+ <value>freq_offset</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>label</key>
+ <value>Frequency Offset</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>-.5</value>
+ </param>
+ <param>
+ <key>step</key>
+ <value>.01</value>
+ </param>
+ <param>
+ <key>stop</key>
+ <value>.5</value>
+ </param>
+ <param>
+ <key>rangeType</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>widget</key>
+ <value>counter_slider</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_qtgui_range</key>
+ <param>
+ <key>comment</key>
+ <value></value>
</param>
<param>
<key>value</key>
<value>1</value>
</param>
<param>
- <key>alias</key>
- <value></value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
<key>_coordinate</key>
- <value>(791, 46)</value>
+ <value>(6, 526)</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value>2,2,1,1</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
- </block>
- <block>
- <key>variable</key>
<param>
<key>id</key>
- <value>samp_rate</value>
+ <value>interpratio</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>label</key>
+ <value>Timing Offset</value>
</param>
<param>
- <key>value</key>
- <value>32000</value>
+ <key>min_len</key>
+ <value>200</value>
</param>
<param>
- <key>alias</key>
- <value></value>
+ <key>orient</key>
+ <value>Qt.Horizontal</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(267, 357)</value>
+ <key>start</key>
+ <value>.99</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>step</key>
+ <value>0.0001</value>
+ </param>
+ <param>
+ <key>stop</key>
+ <value>1.01</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>id</key>
- <value>spb</value>
+ <key>comment</key>
+ <value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
+ <key>_coordinate</key>
+ <value>(562, 334)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>id</key>
+ <value>nfilts</value>
+ </param>
+ <param>
<key>value</key>
- <value>4.2563</value>
+ <value>32</value>
</param>
+ </block>
+ <block>
+ <key>variable_qtgui_range</key>
<param>
- <key>alias</key>
+ <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>(300, 0)</value>
+ <value>(130, 528)</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value>3,2,1,1</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
+ <param>
+ <key>id</key>
+ <value>noise_amp</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Channel Noise</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>.001</value>
+ </param>
+ <param>
+ <key>stop</key>
+ <value>1</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>id</key>
- <value>rolloff</value>
+ <key>comment</key>
+ <value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
+ <key>_coordinate</key>
+ <value>(482, 335)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>id</key>
+ <value>rolloff</value>
+ </param>
+ <param>
<key>value</key>
<value>.35</value>
</param>
+ </block>
+ <block>
+ <key>variable</key>
<param>
- <key>alias</key>
+ <key>comment</key>
<value></value>
</param>
<param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
<key>_coordinate</key>
- <value>(482, 335)</value>
+ <value>(267, 357)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>32000</value>
+ </param>
</block>
<block>
<key>variable</key>
<param>
- <key>id</key>
- <value>nfilts</value>
+ <key>comment</key>
+ <value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
+ <key>_coordinate</key>
+ <value>(791, 46)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>id</key>
+ <value>sig_amp</value>
+ </param>
+ <param>
<key>value</key>
- <value>32</value>
+ <value>1</value>
</param>
+ </block>
+ <block>
+ <key>variable</key>
<param>
- <key>alias</key>
+ <key>comment</key>
<value></value>
</param>
<param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
<key>_coordinate</key>
- <value>(562, 334)</value>
+ <value>(300, 0)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
+ <param>
+ <key>id</key>
+ <value>spb</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>4.2563</value>
+ </param>
</block>
<block>
- <key>analog_random_source_x</key>
+ <key>variable_qtgui_range</key>
<param>
- <key>id</key>
- <value>analog_random_source_x</value>
+ <key>comment</key>
+ <value></value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>type</key>
- <value>byte</value>
+ <key>_coordinate</key>
+ <value>(451, 0)</value>
</param>
<param>
- <key>min</key>
+ <key>gui_hint</key>
+ <value>1,2,1,1</value>
+ </param>
+ <param>
+ <key>_rotation</key>
<value>0</value>
</param>
<param>
- <key>max</key>
- <value>const.arity()</value>
+ <key>id</key>
+ <value>time_bw</value>
</param>
<param>
- <key>num_samps</key>
- <value>10000000</value>
+ <key>label</key>
+ <value>Timing Loop BW</value>
</param>
<param>
- <key>repeat</key>
- <value>True</value>
+ <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>.001</value>
+ </param>
+ <param>
+ <key>stop</key>
+ <value>.1</value>
+ </param>
+ <param>
+ <key>rangeType</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>widget</key>
+ <value>counter_slider</value>
+ </param>
+ </block>
+ <block>
+ <key>analog_random_source_x</key>
+ <param>
<key>alias</key>
<value></value>
</param>
<param>
- <key>affinity</key>
+ <key>comment</key>
<value></value>
</param>
<param>
- <key>minoutbuf</key>
- <value>0</value>
+ <key>affinity</key>
+ <value></value>
</param>
<param>
- <key>maxoutbuf</key>
- <value>0</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
<key>_coordinate</key>
@@ -280,103 +521,107 @@
<key>_rotation</key>
<value>0</value>
</param>
- </block>
- <block>
- <key>digital_chunks_to_symbols_xx</key>
<param>
<key>id</key>
- <value>digital_chunks_to_symbols_xx</value>
+ <value>analog_random_source_x</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>maxoutbuf</key>
+ <value>0</value>
</param>
<param>
- <key>in_type</key>
- <value>byte</value>
+ <key>max</key>
+ <value>const.arity()</value>
</param>
<param>
- <key>out_type</key>
- <value>complex</value>
+ <key>minoutbuf</key>
+ <value>0</value>
</param>
<param>
- <key>symbol_table</key>
- <value>const.points()</value>
+ <key>min</key>
+ <value>0</value>
</param>
<param>
- <key>dimension</key>
- <value>1</value>
+ <key>num_samps</key>
+ <value>10000000</value>
</param>
<param>
- <key>num_ports</key>
- <value>1</value>
+ <key>type</key>
+ <value>byte</value>
</param>
<param>
+ <key>repeat</key>
+ <value>True</value>
+ </param>
+ </block>
+ <block>
+ <key>blocks_multiply_const_vxx</key>
+ <param>
<key>alias</key>
<value></value>
</param>
<param>
- <key>affinity</key>
+ <key>comment</key>
<value></value>
</param>
<param>
- <key>minoutbuf</key>
- <value>0</value>
+ <key>const</key>
+ <value>sig_amp</value>
</param>
<param>
- <key>maxoutbuf</key>
- <value>0</value>
+ <key>affinity</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
<key>_coordinate</key>
- <value>(203, 178)</value>
+ <value>(760, 159)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
- </block>
- <block>
- <key>blocks_throttle</key>
<param>
<key>id</key>
- <value>blocks_throttle_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
+ <value>blocks_multiply_const_vxx_0</value>
</param>
<param>
<key>type</key>
<value>complex</value>
</param>
<param>
- <key>samples_per_second</key>
- <value>samp_rate</value>
+ <key>maxoutbuf</key>
+ <value>0</value>
</param>
<param>
- <key>vlen</key>
- <value>1</value>
+ <key>minoutbuf</key>
+ <value>0</value>
</param>
<param>
- <key>ignoretag</key>
- <value>True</value>
+ <key>vlen</key>
+ <value>1</value>
</param>
+ </block>
+ <block>
+ <key>blocks_throttle</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
- <key>affinity</key>
+ <key>comment</key>
<value></value>
</param>
<param>
- <key>minoutbuf</key>
- <value>0</value>
+ <key>affinity</key>
+ <value></value>
</param>
<param>
- <key>maxoutbuf</key>
- <value>0</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
<key>_coordinate</key>
@@ -386,43 +631,47 @@
<key>_rotation</key>
<value>0</value>
</param>
- </block>
- <block>
- <key>channels_channel_model</key>
<param>
<key>id</key>
- <value>channels_channel_model_0</value>
+ <value>blocks_throttle_0</value>
</param>
<param>
- <key>_enabled</key>
+ <key>ignoretag</key>
<value>True</value>
</param>
<param>
- <key>noise_voltage</key>
- <value>noise_amp</value>
+ <key>maxoutbuf</key>
+ <value>0</value>
</param>
<param>
- <key>freq_offset</key>
- <value>freq_offset</value>
+ <key>minoutbuf</key>
+ <value>0</value>
</param>
<param>
- <key>epsilon</key>
- <value>interpratio</value>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>taps</key>
- <value>1.0</value>
+ <key>type</key>
+ <value>complex</value>
</param>
<param>
- <key>seed</key>
- <value>42</value>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ </block>
+ <block>
+ <key>channels_channel_model</key>
+ <param>
+ <key>alias</key>
+ <value></value>
</param>
<param>
<key>block_tags</key>
<value>False</value>
</param>
<param>
- <key>alias</key>
+ <key>comment</key>
<value></value>
</param>
<param>
@@ -430,12 +679,16 @@
<value></value>
</param>
<param>
- <key>minoutbuf</key>
- <value>0</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>maxoutbuf</key>
- <value>0</value>
+ <key>epsilon</key>
+ <value>interpratio</value>
+ </param>
+ <param>
+ <key>freq_offset</key>
+ <value>freq_offset</value>
</param>
<param>
<key>_coordinate</key>
@@ -445,43 +698,39 @@
<key>_rotation</key>
<value>0</value>
</param>
- </block>
- <block>
- <key>pfb_arb_resampler_xxx</key>
<param>
<key>id</key>
- <value>pfb_arb_resampler_xxx_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
+ <value>channels_channel_model_0</value>
</param>
<param>
- <key>type</key>
- <value>ccf</value>
+ <key>maxoutbuf</key>
+ <value>0</value>
</param>
<param>
- <key>rrate</key>
- <value>spb</value>
+ <key>minoutbuf</key>
+ <value>0</value>
</param>
<param>
- <key>taps</key>
- <value>firdes.root_raised_cosine(nfilts, nfilts, 1.0, rolloff, 44*nfilts)</value>
+ <key>noise_voltage</key>
+ <value>noise_amp</value>
</param>
<param>
- <key>nfilts</key>
- <value>32</value>
+ <key>seed</key>
+ <value>42</value>
</param>
<param>
- <key>atten</key>
- <value>100</value>
+ <key>taps</key>
+ <value>1.0</value>
</param>
+ </block>
+ <block>
+ <key>digital_chunks_to_symbols_xx</key>
<param>
- <key>samp_delay</key>
- <value>0</value>
+ <key>alias</key>
+ <value></value>
</param>
<param>
- <key>alias</key>
+ <key>comment</key>
<value></value>
</param>
<param>
@@ -489,73 +738,58 @@
<value></value>
</param>
<param>
- <key>minoutbuf</key>
- <value>0</value>
+ <key>dimension</key>
+ <value>1</value>
</param>
<param>
- <key>maxoutbuf</key>
- <value>0</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
<key>_coordinate</key>
- <value>(458, 179)</value>
+ <value>(203, 178)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
- </block>
- <block>
- <key>import</key>
<param>
<key>id</key>
- <value>import_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>import</key>
- <value>from gnuradio import digital</value>
- </param>
- <param>
- <key>alias</key>
- <value></value>
+ <value>digital_chunks_to_symbols_xx</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(-1, 61)</value>
+ <key>in_type</key>
+ <value>byte</value>
</param>
<param>
- <key>_rotation</key>
+ <key>maxoutbuf</key>
<value>0</value>
</param>
- </block>
- <block>
- <key>blocks_multiply_const_vxx</key>
<param>
- <key>id</key>
- <value>blocks_multiply_const_vxx_0</value>
+ <key>minoutbuf</key>
+ <value>0</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>num_ports</key>
+ <value>1</value>
</param>
<param>
- <key>type</key>
+ <key>out_type</key>
<value>complex</value>
</param>
<param>
- <key>const</key>
- <value>sig_amp</value>
+ <key>symbol_table</key>
+ <value>const.points()</value>
</param>
+ </block>
+ <block>
+ <key>digital_pfb_clock_sync_xxx</key>
<param>
- <key>vlen</key>
- <value>1</value>
+ <key>alias</key>
+ <value></value>
</param>
<param>
- <key>alias</key>
+ <key>comment</key>
<value></value>
</param>
<param>
@@ -563,614 +797,616 @@
<value></value>
</param>
<param>
- <key>minoutbuf</key>
- <value>0</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>maxoutbuf</key>
- <value>0</value>
+ <key>filter_size</key>
+ <value>nfilts</value>
</param>
<param>
<key>_coordinate</key>
- <value>(760, 159)</value>
+ <value>(467, 403)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
- </block>
- <block>
- <key>qtgui_time_sink_x</key>
<param>
<key>id</key>
- <value>qtgui_time_sink_x_0</value>
+ <value>digital_pfb_clock_sync_xxx_0</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>init_phase</key>
+ <value>0</value>
</param>
<param>
- <key>type</key>
- <value>complex</value>
+ <key>loop_bw</key>
+ <value>time_bw</value>
</param>
<param>
- <key>name</key>
- <value>Error</value>
+ <key>maxoutbuf</key>
+ <value>0</value>
</param>
<param>
- <key>ylabel</key>
- <value>Amplitude</value>
+ <key>max_dev</key>
+ <value>1.5</value>
</param>
<param>
- <key>yunit</key>
- <value>""</value>
+ <key>minoutbuf</key>
+ <value>0</value>
</param>
<param>
- <key>size</key>
- <value>1024</value>
+ <key>osps</key>
+ <value>1</value>
</param>
<param>
- <key>srate</key>
- <value>samp_rate</value>
+ <key>sps</key>
+ <value>spb</value>
</param>
<param>
- <key>grid</key>
- <value>False</value>
+ <key>taps</key>
+ <value>firdes.root_raised_cosine(nfilts, nfilts*spb, 1.0, rolloff, 44*nfilts)</value>
</param>
<param>
- <key>autoscale</key>
- <value>False</value>
+ <key>type</key>
+ <value>ccf</value>
</param>
+ </block>
+ <block>
+ <key>import</key>
<param>
- <key>ymin</key>
- <value>-1</value>
+ <key>alias</key>
+ <value></value>
</param>
<param>
- <key>ymax</key>
- <value>1</value>
+ <key>comment</key>
+ <value></value>
</param>
<param>
- <key>nconnections</key>
- <value>1</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>update_time</key>
- <value>0.10</value>
+ <key>_coordinate</key>
+ <value>(-1, 61)</value>
</param>
<param>
- <key>entags</key>
- <value>True</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
<param>
- <key>gui_hint</key>
- <value>notebook@3</value>
+ <key>id</key>
+ <value>import_0</value>
</param>
<param>
- <key>tr_mode</key>
- <value>qtgui.TRIG_MODE_FREE</value>
+ <key>import</key>
+ <value>from gnuradio import digital</value>
</param>
+ </block>
+ <block>
+ <key>qtgui_tab_widget</key>
<param>
- <key>tr_slope</key>
- <value>qtgui.TRIG_SLOPE_POS</value>
+ <key>alias</key>
+ <value></value>
</param>
<param>
- <key>tr_level</key>
- <value>0.0</value>
+ <key>comment</key>
+ <value></value>
</param>
<param>
- <key>tr_delay</key>
- <value>0</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>tr_chan</key>
+ <key>_coordinate</key>
+ <value>(485, 554)</value>
+ </param>
+ <param>
+ <key>gui_hint</key>
+ <value>1,1,5,1</value>
+ </param>
+ <param>
+ <key>_rotation</key>
<value>0</value>
</param>
<param>
- <key>tr_tag</key>
- <value>""</value>
+ <key>id</key>
+ <value>notebook</value>
+ </param>
+ <param>
+ <key>label0</key>
+ <value>Error</value>
</param>
<param>
<key>label1</key>
- <value></value>
+ <value>Phase</value>
</param>
<param>
- <key>width1</key>
- <value>1</value>
+ <key>label10</key>
+ <value>Tab 10</value>
</param>
<param>
- <key>color1</key>
- <value>"blue"</value>
+ <key>label11</key>
+ <value>Tab 11</value>
</param>
<param>
- <key>style1</key>
- <value>1</value>
+ <key>label12</key>
+ <value>Tab 12</value>
</param>
<param>
- <key>marker1</key>
- <value>-1</value>
+ <key>label13</key>
+ <value>Tab 13</value>
</param>
<param>
- <key>alpha1</key>
- <value>1.0</value>
+ <key>label14</key>
+ <value>Tab 14</value>
</param>
<param>
- <key>label2</key>
- <value></value>
+ <key>label15</key>
+ <value>Tab 15</value>
</param>
<param>
- <key>width2</key>
- <value>1</value>
+ <key>label16</key>
+ <value>Tab 16</value>
</param>
<param>
- <key>color2</key>
- <value>"red"</value>
+ <key>label17</key>
+ <value>Tab 17</value>
</param>
<param>
- <key>style2</key>
- <value>1</value>
+ <key>label18</key>
+ <value>Tab 18</value>
</param>
<param>
- <key>marker2</key>
- <value>-1</value>
+ <key>label19</key>
+ <value>Tab 19</value>
</param>
<param>
- <key>alpha2</key>
- <value>1.0</value>
+ <key>label2</key>
+ <value>Freq</value>
</param>
<param>
<key>label3</key>
- <value></value>
+ <value>Resampled Signal</value>
</param>
<param>
- <key>width3</key>
- <value>1</value>
+ <key>label4</key>
+ <value>Tab 4</value>
</param>
<param>
- <key>color3</key>
- <value>"green"</value>
+ <key>label5</key>
+ <value>Tab 5</value>
</param>
<param>
- <key>style3</key>
- <value>1</value>
+ <key>label6</key>
+ <value>Tab 6</value>
</param>
<param>
- <key>marker3</key>
- <value>-1</value>
+ <key>label7</key>
+ <value>Tab 7</value>
</param>
<param>
- <key>alpha3</key>
- <value>1.0</value>
+ <key>label8</key>
+ <value>Tab 8</value>
</param>
<param>
- <key>label4</key>
+ <key>label9</key>
+ <value>Tab 9</value>
+ </param>
+ <param>
+ <key>num_tabs</key>
+ <value>4</value>
+ </param>
+ </block>
+ <block>
+ <key>pfb_arb_resampler_xxx</key>
+ <param>
+ <key>alias</key>
<value></value>
</param>
<param>
- <key>width4</key>
- <value>1</value>
+ <key>comment</key>
+ <value></value>
</param>
<param>
- <key>color4</key>
- <value>"black"</value>
+ <key>affinity</key>
+ <value></value>
</param>
<param>
- <key>style4</key>
- <value>1</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>marker4</key>
- <value>-1</value>
+ <key>_coordinate</key>
+ <value>(458, 179)</value>
</param>
<param>
- <key>alpha4</key>
- <value>1.0</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
<param>
- <key>label5</key>
- <value></value>
+ <key>id</key>
+ <value>pfb_arb_resampler_xxx_0</value>
</param>
<param>
- <key>width5</key>
- <value>1</value>
+ <key>maxoutbuf</key>
+ <value>0</value>
</param>
<param>
- <key>color5</key>
- <value>"cyan"</value>
+ <key>minoutbuf</key>
+ <value>0</value>
</param>
<param>
- <key>style5</key>
- <value>1</value>
+ <key>nfilts</key>
+ <value>32</value>
</param>
<param>
- <key>marker5</key>
- <value>-1</value>
+ <key>rrate</key>
+ <value>spb</value>
</param>
<param>
- <key>alpha5</key>
- <value>1.0</value>
+ <key>samp_delay</key>
+ <value>0</value>
</param>
<param>
- <key>label6</key>
- <value></value>
+ <key>atten</key>
+ <value>100</value>
</param>
<param>
- <key>width6</key>
- <value>1</value>
+ <key>taps</key>
+ <value>firdes.root_raised_cosine(nfilts, nfilts, 1.0, rolloff, 44*nfilts)</value>
</param>
<param>
- <key>color6</key>
- <value>"magenta"</value>
+ <key>type</key>
+ <value>ccf</value>
</param>
+ </block>
+ <block>
+ <key>qtgui_time_sink_x</key>
<param>
- <key>style6</key>
- <value>1</value>
+ <key>autoscale</key>
+ <value>False</value>
</param>
<param>
- <key>marker6</key>
- <value>-1</value>
+ <key>axislabels</key>
+ <value>True</value>
</param>
<param>
- <key>alpha6</key>
- <value>1.0</value>
+ <key>alias</key>
+ <value></value>
</param>
<param>
- <key>label7</key>
+ <key>comment</key>
<value></value>
</param>
<param>
- <key>width7</key>
- <value>1</value>
+ <key>ctrlpanel</key>
+ <value>False</value>
</param>
<param>
- <key>color7</key>
- <value>"yellow"</value>
+ <key>affinity</key>
+ <value></value>
</param>
<param>
- <key>style7</key>
- <value>1</value>
+ <key>entags</key>
+ <value>True</value>
</param>
<param>
- <key>marker7</key>
- <value>-1</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>alpha7</key>
- <value>1.0</value>
+ <key>_coordinate</key>
+ <value>(1020, 128)</value>
</param>
<param>
- <key>label8</key>
- <value></value>
+ <key>gui_hint</key>
+ <value>notebook@3</value>
</param>
<param>
- <key>width8</key>
- <value>1</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
<param>
- <key>color8</key>
- <value>"dark red"</value>
+ <key>grid</key>
+ <value>False</value>
</param>
<param>
- <key>style8</key>
- <value>1</value>
+ <key>id</key>
+ <value>qtgui_time_sink_x_0</value>
</param>
<param>
- <key>marker8</key>
- <value>-1</value>
+ <key>legend</key>
+ <value>True</value>
</param>
<param>
- <key>alpha8</key>
+ <key>alpha1</key>
<value>1.0</value>
</param>
<param>
- <key>label9</key>
- <value></value>
+ <key>color1</key>
+ <value>"blue"</value>
</param>
<param>
- <key>width9</key>
- <value>1</value>
+ <key>label1</key>
+ <value></value>
</param>
<param>
- <key>color9</key>
- <value>"dark green"</value>
+ <key>marker1</key>
+ <value>-1</value>
</param>
<param>
- <key>style9</key>
+ <key>style1</key>
<value>1</value>
</param>
<param>
- <key>marker9</key>
- <value>-1</value>
+ <key>width1</key>
+ <value>1</value>
</param>
<param>
- <key>alpha9</key>
+ <key>alpha10</key>
<value>1.0</value>
</param>
<param>
- <key>label10</key>
- <value></value>
+ <key>color10</key>
+ <value>"blue"</value>
</param>
<param>
- <key>width10</key>
- <value>1</value>
+ <key>label10</key>
+ <value></value>
</param>
<param>
- <key>color10</key>
- <value>"blue"</value>
+ <key>marker10</key>
+ <value>-1</value>
</param>
<param>
<key>style10</key>
<value>1</value>
</param>
<param>
- <key>marker10</key>
- <value>-1</value>
+ <key>width10</key>
+ <value>1</value>
</param>
<param>
- <key>alpha10</key>
+ <key>alpha2</key>
<value>1.0</value>
</param>
<param>
- <key>alias</key>
- <value></value>
+ <key>color2</key>
+ <value>"red"</value>
</param>
<param>
- <key>affinity</key>
+ <key>label2</key>
<value></value>
</param>
<param>
- <key>_coordinate</key>
- <value>(1020, 128)</value>
+ <key>marker2</key>
+ <value>-1</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>style2</key>
+ <value>1</value>
</param>
- </block>
- <block>
- <key>qtgui_tab_widget</key>
<param>
- <key>id</key>
- <value>notebook</value>
+ <key>width2</key>
+ <value>1</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>alpha3</key>
+ <value>1.0</value>
</param>
<param>
- <key>num_tabs</key>
- <value>4</value>
+ <key>color3</key>
+ <value>"green"</value>
</param>
<param>
- <key>label0</key>
- <value>Error</value>
+ <key>label3</key>
+ <value></value>
</param>
<param>
- <key>label1</key>
- <value>Phase</value>
+ <key>marker3</key>
+ <value>-1</value>
</param>
<param>
- <key>label2</key>
- <value>Freq</value>
+ <key>style3</key>
+ <value>1</value>
</param>
<param>
- <key>label3</key>
- <value>Resampled Signal</value>
+ <key>width3</key>
+ <value>1</value>
</param>
<param>
- <key>label4</key>
- <value>Tab 4</value>
+ <key>alpha4</key>
+ <value>1.0</value>
</param>
<param>
- <key>gui_hint</key>
- <value>1,1,5,1</value>
+ <key>color4</key>
+ <value>"black"</value>
</param>
<param>
- <key>alias</key>
+ <key>label4</key>
<value></value>
</param>
<param>
- <key>_coordinate</key>
- <value>(485, 554)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>variable_qtgui_range</key>
- <param>
- <key>id</key>
- <value>interpratio</value>
+ <key>marker4</key>
+ <value>-1</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>style4</key>
+ <value>1</value>
</param>
<param>
- <key>label</key>
- <value>Timing Offset</value>
+ <key>width4</key>
+ <value>1</value>
</param>
<param>
- <key>value</key>
- <value>1</value>
+ <key>alpha5</key>
+ <value>1.0</value>
</param>
<param>
- <key>start</key>
- <value>.99</value>
+ <key>color5</key>
+ <value>"cyan"</value>
</param>
<param>
- <key>stop</key>
- <value>1.01</value>
+ <key>label5</key>
+ <value></value>
</param>
<param>
- <key>step</key>
- <value>0.0001</value>
+ <key>marker5</key>
+ <value>-1</value>
</param>
<param>
- <key>widget</key>
- <value>counter_slider</value>
+ <key>style5</key>
+ <value>1</value>
</param>
<param>
- <key>orient</key>
- <value>Qt.Horizontal</value>
+ <key>width5</key>
+ <value>1</value>
</param>
<param>
- <key>min_len</key>
- <value>200</value>
+ <key>alpha6</key>
+ <value>1.0</value>
</param>
<param>
- <key>gui_hint</key>
- <value>2,2,1,1</value>
+ <key>color6</key>
+ <value>"magenta"</value>
</param>
<param>
- <key>alias</key>
+ <key>label6</key>
<value></value>
</param>
<param>
- <key>_coordinate</key>
- <value>(6, 526)</value>
+ <key>marker6</key>
+ <value>-1</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>style6</key>
+ <value>1</value>
</param>
- </block>
- <block>
- <key>variable_qtgui_range</key>
<param>
- <key>id</key>
- <value>noise_amp</value>
+ <key>width6</key>
+ <value>1</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>alpha7</key>
+ <value>1.0</value>
</param>
<param>
- <key>label</key>
- <value>Channel Noise</value>
+ <key>color7</key>
+ <value>"yellow"</value>
</param>
<param>
- <key>value</key>
- <value>0</value>
+ <key>label7</key>
+ <value></value>
</param>
<param>
- <key>start</key>
- <value>0</value>
+ <key>marker7</key>
+ <value>-1</value>
</param>
<param>
- <key>stop</key>
+ <key>style7</key>
<value>1</value>
</param>
<param>
- <key>step</key>
- <value>.001</value>
- </param>
- <param>
- <key>widget</key>
- <value>counter_slider</value>
+ <key>width7</key>
+ <value>1</value>
</param>
<param>
- <key>orient</key>
- <value>Qt.Horizontal</value>
+ <key>alpha8</key>
+ <value>1.0</value>
</param>
<param>
- <key>min_len</key>
- <value>200</value>
+ <key>color8</key>
+ <value>"dark red"</value>
</param>
<param>
- <key>gui_hint</key>
- <value>3,2,1,1</value>
+ <key>label8</key>
+ <value></value>
</param>
<param>
- <key>alias</key>
- <value></value>
+ <key>marker8</key>
+ <value>-1</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(130, 528)</value>
+ <key>style8</key>
+ <value>1</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>width8</key>
+ <value>1</value>
</param>
- </block>
- <block>
- <key>variable_qtgui_range</key>
<param>
- <key>id</key>
- <value>freq_offset</value>
+ <key>alpha9</key>
+ <value>1.0</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>color9</key>
+ <value>"dark green"</value>
</param>
<param>
- <key>label</key>
- <value>Frequency Offset</value>
+ <key>label9</key>
+ <value></value>
</param>
<param>
- <key>value</key>
- <value>0</value>
+ <key>marker9</key>
+ <value>-1</value>
</param>
<param>
- <key>start</key>
- <value>-.5</value>
+ <key>style9</key>
+ <value>1</value>
</param>
<param>
- <key>stop</key>
- <value>.5</value>
+ <key>width9</key>
+ <value>1</value>
</param>
<param>
- <key>step</key>
- <value>.01</value>
+ <key>name</key>
+ <value>Error</value>
</param>
<param>
- <key>widget</key>
- <value>counter_slider</value>
+ <key>nconnections</key>
+ <value>1</value>
</param>
<param>
- <key>orient</key>
- <value>Qt.Horizontal</value>
+ <key>size</key>
+ <value>1024</value>
</param>
<param>
- <key>min_len</key>
- <value>200</value>
+ <key>srate</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>gui_hint</key>
- <value>4,2,1,1</value>
+ <key>tr_chan</key>
+ <value>0</value>
</param>
<param>
- <key>alias</key>
- <value></value>
+ <key>tr_delay</key>
+ <value>0</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(268, 527)</value>
+ <key>tr_level</key>
+ <value>0.0</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>tr_mode</key>
+ <value>qtgui.TRIG_MODE_FREE</value>
</param>
- </block>
- <block>
- <key>qtgui_time_sink_x</key>
<param>
- <key>id</key>
- <value>qtgui_time_sink_x_1_1</value>
+ <key>tr_slope</key>
+ <value>qtgui.TRIG_SLOPE_POS</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>tr_tag</key>
+ <value>""</value>
</param>
<param>
<key>type</key>
- <value>float</value>
+ <value>complex</value>
</param>
<param>
- <key>name</key>
- <value>Phase</value>
+ <key>update_time</key>
+ <value>0.10</value>
</param>
<param>
<key>ylabel</key>
@@ -1181,343 +1417,359 @@
<value>""</value>
</param>
<param>
- <key>size</key>
- <value>1024</value>
+ <key>ymax</key>
+ <value>1</value>
</param>
<param>
- <key>srate</key>
- <value>samp_rate</value>
+ <key>ymin</key>
+ <value>-1</value>
</param>
+ </block>
+ <block>
+ <key>qtgui_time_sink_x</key>
<param>
- <key>grid</key>
+ <key>autoscale</key>
<value>False</value>
</param>
<param>
- <key>autoscale</key>
+ <key>axislabels</key>
<value>True</value>
</param>
<param>
- <key>ymin</key>
- <value>-1</value>
+ <key>alias</key>
+ <value></value>
</param>
<param>
- <key>ymax</key>
- <value>1</value>
+ <key>comment</key>
+ <value></value>
</param>
<param>
- <key>nconnections</key>
- <value>1</value>
+ <key>ctrlpanel</key>
+ <value>False</value>
</param>
<param>
- <key>update_time</key>
- <value>0.10</value>
+ <key>affinity</key>
+ <value></value>
</param>
<param>
<key>entags</key>
<value>True</value>
</param>
<param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(1029, 281)</value>
+ </param>
+ <param>
<key>gui_hint</key>
- <value>notebook@1</value>
+ <value></value>
</param>
<param>
- <key>tr_mode</key>
- <value>qtgui.TRIG_MODE_FREE</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
<param>
- <key>tr_slope</key>
- <value>qtgui.TRIG_SLOPE_POS</value>
+ <key>grid</key>
+ <value>False</value>
</param>
<param>
- <key>tr_level</key>
- <value>0.0</value>
+ <key>id</key>
+ <value>qtgui_time_sink_x_0_0</value>
</param>
<param>
- <key>tr_delay</key>
- <value>0</value>
+ <key>legend</key>
+ <value>True</value>
</param>
<param>
- <key>tr_chan</key>
- <value>0</value>
+ <key>alpha1</key>
+ <value>1.0</value>
</param>
<param>
- <key>tr_tag</key>
- <value>""</value>
+ <key>color1</key>
+ <value>"blue"</value>
</param>
<param>
<key>label1</key>
<value></value>
</param>
<param>
+ <key>marker1</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>style1</key>
+ <value>1</value>
+ </param>
+ <param>
<key>width1</key>
<value>1</value>
</param>
<param>
- <key>color1</key>
+ <key>alpha10</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>color10</key>
<value>"blue"</value>
</param>
<param>
- <key>style1</key>
- <value>1</value>
+ <key>label10</key>
+ <value></value>
</param>
<param>
- <key>marker1</key>
+ <key>marker10</key>
<value>-1</value>
</param>
<param>
- <key>alpha1</key>
- <value>1.0</value>
+ <key>style10</key>
+ <value>1</value>
</param>
<param>
- <key>label2</key>
- <value></value>
+ <key>width10</key>
+ <value>1</value>
</param>
<param>
- <key>width2</key>
- <value>1</value>
+ <key>alpha2</key>
+ <value>1.0</value>
</param>
<param>
<key>color2</key>
<value>"red"</value>
</param>
<param>
- <key>style2</key>
- <value>1</value>
+ <key>label2</key>
+ <value></value>
</param>
<param>
<key>marker2</key>
<value>-1</value>
</param>
<param>
- <key>alpha2</key>
- <value>1.0</value>
+ <key>style2</key>
+ <value>1</value>
</param>
<param>
- <key>label3</key>
- <value></value>
+ <key>width2</key>
+ <value>1</value>
</param>
<param>
- <key>width3</key>
- <value>1</value>
+ <key>alpha3</key>
+ <value>1.0</value>
</param>
<param>
<key>color3</key>
<value>"green"</value>
</param>
<param>
- <key>style3</key>
- <value>1</value>
+ <key>label3</key>
+ <value></value>
</param>
<param>
<key>marker3</key>
<value>-1</value>
</param>
<param>
- <key>alpha3</key>
- <value>1.0</value>
+ <key>style3</key>
+ <value>1</value>
</param>
<param>
- <key>label4</key>
- <value></value>
+ <key>width3</key>
+ <value>1</value>
</param>
<param>
- <key>width4</key>
- <value>1</value>
+ <key>alpha4</key>
+ <value>1.0</value>
</param>
<param>
<key>color4</key>
<value>"black"</value>
</param>
<param>
- <key>style4</key>
- <value>1</value>
+ <key>label4</key>
+ <value></value>
</param>
<param>
<key>marker4</key>
<value>-1</value>
</param>
<param>
- <key>alpha4</key>
- <value>1.0</value>
+ <key>style4</key>
+ <value>1</value>
</param>
<param>
- <key>label5</key>
- <value></value>
+ <key>width4</key>
+ <value>1</value>
</param>
<param>
- <key>width5</key>
- <value>1</value>
+ <key>alpha5</key>
+ <value>1.0</value>
</param>
<param>
<key>color5</key>
<value>"cyan"</value>
</param>
<param>
- <key>style5</key>
- <value>1</value>
+ <key>label5</key>
+ <value></value>
</param>
<param>
<key>marker5</key>
<value>-1</value>
</param>
<param>
- <key>alpha5</key>
- <value>1.0</value>
+ <key>style5</key>
+ <value>1</value>
</param>
<param>
- <key>label6</key>
- <value></value>
+ <key>width5</key>
+ <value>1</value>
</param>
<param>
- <key>width6</key>
- <value>1</value>
+ <key>alpha6</key>
+ <value>1.0</value>
</param>
<param>
<key>color6</key>
<value>"magenta"</value>
</param>
<param>
- <key>style6</key>
- <value>1</value>
+ <key>label6</key>
+ <value></value>
</param>
<param>
<key>marker6</key>
<value>-1</value>
</param>
<param>
- <key>alpha6</key>
- <value>1.0</value>
+ <key>style6</key>
+ <value>1</value>
</param>
<param>
- <key>label7</key>
- <value></value>
+ <key>width6</key>
+ <value>1</value>
</param>
<param>
- <key>width7</key>
- <value>1</value>
+ <key>alpha7</key>
+ <value>1.0</value>
</param>
<param>
<key>color7</key>
<value>"yellow"</value>
</param>
<param>
- <key>style7</key>
- <value>1</value>
+ <key>label7</key>
+ <value></value>
</param>
<param>
<key>marker7</key>
<value>-1</value>
</param>
<param>
- <key>alpha7</key>
- <value>1.0</value>
+ <key>style7</key>
+ <value>1</value>
</param>
<param>
- <key>label8</key>
- <value></value>
+ <key>width7</key>
+ <value>1</value>
</param>
<param>
- <key>width8</key>
- <value>1</value>
+ <key>alpha8</key>
+ <value>1.0</value>
</param>
<param>
<key>color8</key>
<value>"dark red"</value>
</param>
<param>
- <key>style8</key>
- <value>1</value>
+ <key>label8</key>
+ <value></value>
</param>
<param>
<key>marker8</key>
<value>-1</value>
</param>
<param>
- <key>alpha8</key>
- <value>1.0</value>
+ <key>style8</key>
+ <value>1</value>
</param>
<param>
- <key>label9</key>
- <value></value>
+ <key>width8</key>
+ <value>1</value>
</param>
<param>
- <key>width9</key>
- <value>1</value>
+ <key>alpha9</key>
+ <value>1.0</value>
</param>
<param>
<key>color9</key>
<value>"dark green"</value>
</param>
<param>
- <key>style9</key>
- <value>1</value>
+ <key>label9</key>
+ <value></value>
</param>
<param>
<key>marker9</key>
<value>-1</value>
</param>
<param>
- <key>alpha9</key>
- <value>1.0</value>
- </param>
- <param>
- <key>label10</key>
- <value></value>
+ <key>style9</key>
+ <value>1</value>
</param>
<param>
- <key>width10</key>
+ <key>width9</key>
<value>1</value>
</param>
<param>
- <key>color10</key>
- <value>"blue"</value>
+ <key>name</key>
+ <value>Scope Plot</value>
</param>
<param>
- <key>style10</key>
+ <key>nconnections</key>
<value>1</value>
</param>
<param>
- <key>marker10</key>
- <value>-1</value>
+ <key>size</key>
+ <value>1024</value>
</param>
<param>
- <key>alpha10</key>
- <value>1.0</value>
+ <key>srate</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>alias</key>
- <value></value>
+ <key>tr_chan</key>
+ <value>0</value>
</param>
<param>
- <key>affinity</key>
- <value></value>
+ <key>tr_delay</key>
+ <value>0</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(1014, 622)</value>
+ <key>tr_level</key>
+ <value>0.0</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>tr_mode</key>
+ <value>qtgui.TRIG_MODE_FREE</value>
</param>
- </block>
- <block>
- <key>qtgui_time_sink_x</key>
<param>
- <key>id</key>
- <value>qtgui_time_sink_x_1_0</value>
+ <key>tr_slope</key>
+ <value>qtgui.TRIG_SLOPE_POS</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>tr_tag</key>
+ <value>""</value>
</param>
<param>
<key>type</key>
- <value>float</value>
+ <value>complex</value>
</param>
<param>
- <key>name</key>
- <value>Rate</value>
+ <key>update_time</key>
+ <value>0.10</value>
</param>
<param>
<key>ylabel</key>
@@ -1528,343 +1780,359 @@
<value>""</value>
</param>
<param>
- <key>size</key>
- <value>1024</value>
+ <key>ymax</key>
+ <value>1</value>
</param>
<param>
- <key>srate</key>
- <value>samp_rate</value>
+ <key>ymin</key>
+ <value>-1</value>
</param>
+ </block>
+ <block>
+ <key>qtgui_time_sink_x</key>
<param>
- <key>grid</key>
- <value>False</value>
+ <key>autoscale</key>
+ <value>True</value>
</param>
<param>
- <key>autoscale</key>
+ <key>axislabels</key>
<value>True</value>
</param>
<param>
- <key>ymin</key>
- <value>-1</value>
+ <key>alias</key>
+ <value></value>
</param>
<param>
- <key>ymax</key>
- <value>1</value>
+ <key>comment</key>
+ <value></value>
</param>
<param>
- <key>nconnections</key>
- <value>1</value>
+ <key>ctrlpanel</key>
+ <value>False</value>
</param>
<param>
- <key>update_time</key>
- <value>0.10</value>
+ <key>affinity</key>
+ <value></value>
</param>
<param>
<key>entags</key>
<value>True</value>
</param>
<param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(1024, 400)</value>
+ </param>
+ <param>
<key>gui_hint</key>
- <value>notebook@2</value>
+ <value>notebook@0</value>
</param>
<param>
- <key>tr_mode</key>
- <value>qtgui.TRIG_MODE_FREE</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
<param>
- <key>tr_slope</key>
- <value>qtgui.TRIG_SLOPE_POS</value>
+ <key>grid</key>
+ <value>False</value>
</param>
<param>
- <key>tr_level</key>
- <value>0.0</value>
+ <key>id</key>
+ <value>qtgui_time_sink_x_1</value>
</param>
<param>
- <key>tr_delay</key>
- <value>0</value>
+ <key>legend</key>
+ <value>True</value>
</param>
<param>
- <key>tr_chan</key>
- <value>0</value>
+ <key>alpha1</key>
+ <value>1.0</value>
</param>
<param>
- <key>tr_tag</key>
- <value>""</value>
+ <key>color1</key>
+ <value>"blue"</value>
</param>
<param>
<key>label1</key>
<value></value>
</param>
<param>
+ <key>marker1</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>style1</key>
+ <value>1</value>
+ </param>
+ <param>
<key>width1</key>
<value>1</value>
</param>
<param>
- <key>color1</key>
+ <key>alpha10</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>color10</key>
<value>"blue"</value>
</param>
<param>
- <key>style1</key>
- <value>1</value>
+ <key>label10</key>
+ <value></value>
</param>
<param>
- <key>marker1</key>
+ <key>marker10</key>
<value>-1</value>
</param>
<param>
- <key>alpha1</key>
- <value>1.0</value>
+ <key>style10</key>
+ <value>1</value>
</param>
<param>
- <key>label2</key>
- <value></value>
+ <key>width10</key>
+ <value>1</value>
</param>
<param>
- <key>width2</key>
- <value>1</value>
+ <key>alpha2</key>
+ <value>1.0</value>
</param>
<param>
<key>color2</key>
<value>"red"</value>
</param>
<param>
- <key>style2</key>
- <value>1</value>
+ <key>label2</key>
+ <value></value>
</param>
<param>
<key>marker2</key>
<value>-1</value>
</param>
<param>
- <key>alpha2</key>
- <value>1.0</value>
+ <key>style2</key>
+ <value>1</value>
</param>
<param>
- <key>label3</key>
- <value></value>
+ <key>width2</key>
+ <value>1</value>
</param>
<param>
- <key>width3</key>
- <value>1</value>
+ <key>alpha3</key>
+ <value>1.0</value>
</param>
<param>
<key>color3</key>
<value>"green"</value>
</param>
<param>
- <key>style3</key>
- <value>1</value>
+ <key>label3</key>
+ <value></value>
</param>
<param>
<key>marker3</key>
<value>-1</value>
</param>
<param>
- <key>alpha3</key>
- <value>1.0</value>
+ <key>style3</key>
+ <value>1</value>
</param>
<param>
- <key>label4</key>
- <value></value>
+ <key>width3</key>
+ <value>1</value>
</param>
<param>
- <key>width4</key>
- <value>1</value>
+ <key>alpha4</key>
+ <value>1.0</value>
</param>
<param>
<key>color4</key>
<value>"black"</value>
</param>
<param>
- <key>style4</key>
- <value>1</value>
+ <key>label4</key>
+ <value></value>
</param>
<param>
<key>marker4</key>
<value>-1</value>
</param>
<param>
- <key>alpha4</key>
- <value>1.0</value>
+ <key>style4</key>
+ <value>1</value>
</param>
<param>
- <key>label5</key>
- <value></value>
+ <key>width4</key>
+ <value>1</value>
</param>
<param>
- <key>width5</key>
- <value>1</value>
+ <key>alpha5</key>
+ <value>1.0</value>
</param>
<param>
<key>color5</key>
<value>"cyan"</value>
</param>
<param>
- <key>style5</key>
- <value>1</value>
+ <key>label5</key>
+ <value></value>
</param>
<param>
<key>marker5</key>
<value>-1</value>
</param>
<param>
- <key>alpha5</key>
- <value>1.0</value>
+ <key>style5</key>
+ <value>1</value>
</param>
<param>
- <key>label6</key>
- <value></value>
+ <key>width5</key>
+ <value>1</value>
</param>
<param>
- <key>width6</key>
- <value>1</value>
+ <key>alpha6</key>
+ <value>1.0</value>
</param>
<param>
<key>color6</key>
<value>"magenta"</value>
</param>
<param>
- <key>style6</key>
- <value>1</value>
+ <key>label6</key>
+ <value></value>
</param>
<param>
<key>marker6</key>
<value>-1</value>
</param>
<param>
- <key>alpha6</key>
- <value>1.0</value>
+ <key>style6</key>
+ <value>1</value>
</param>
<param>
- <key>label7</key>
- <value></value>
+ <key>width6</key>
+ <value>1</value>
</param>
<param>
- <key>width7</key>
- <value>1</value>
+ <key>alpha7</key>
+ <value>1.0</value>
</param>
<param>
<key>color7</key>
<value>"yellow"</value>
</param>
<param>
- <key>style7</key>
- <value>1</value>
+ <key>label7</key>
+ <value></value>
</param>
<param>
<key>marker7</key>
<value>-1</value>
</param>
<param>
- <key>alpha7</key>
- <value>1.0</value>
+ <key>style7</key>
+ <value>1</value>
</param>
<param>
- <key>label8</key>
- <value></value>
+ <key>width7</key>
+ <value>1</value>
</param>
<param>
- <key>width8</key>
- <value>1</value>
+ <key>alpha8</key>
+ <value>1.0</value>
</param>
<param>
<key>color8</key>
<value>"dark red"</value>
</param>
<param>
- <key>style8</key>
- <value>1</value>
+ <key>label8</key>
+ <value></value>
</param>
<param>
<key>marker8</key>
<value>-1</value>
</param>
<param>
- <key>alpha8</key>
- <value>1.0</value>
+ <key>style8</key>
+ <value>1</value>
</param>
<param>
- <key>label9</key>
- <value></value>
+ <key>width8</key>
+ <value>1</value>
</param>
<param>
- <key>width9</key>
- <value>1</value>
+ <key>alpha9</key>
+ <value>1.0</value>
</param>
<param>
<key>color9</key>
<value>"dark green"</value>
</param>
<param>
- <key>style9</key>
- <value>1</value>
+ <key>label9</key>
+ <value></value>
</param>
<param>
<key>marker9</key>
<value>-1</value>
</param>
<param>
- <key>alpha9</key>
- <value>1.0</value>
- </param>
- <param>
- <key>label10</key>
- <value></value>
+ <key>style9</key>
+ <value>1</value>
</param>
<param>
- <key>width10</key>
+ <key>width9</key>
<value>1</value>
</param>
<param>
- <key>color10</key>
- <value>"blue"</value>
+ <key>name</key>
+ <value>Error</value>
</param>
<param>
- <key>style10</key>
+ <key>nconnections</key>
<value>1</value>
</param>
<param>
- <key>marker10</key>
- <value>-1</value>
+ <key>size</key>
+ <value>1024</value>
</param>
<param>
- <key>alpha10</key>
- <value>1.0</value>
+ <key>srate</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>alias</key>
- <value></value>
+ <key>tr_chan</key>
+ <value>0</value>
</param>
<param>
- <key>affinity</key>
- <value></value>
+ <key>tr_delay</key>
+ <value>0</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(1018, 503)</value>
+ <key>tr_level</key>
+ <value>0.0</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>tr_mode</key>
+ <value>qtgui.TRIG_MODE_FREE</value>
</param>
- </block>
- <block>
- <key>qtgui_time_sink_x</key>
<param>
- <key>id</key>
- <value>qtgui_time_sink_x_1</value>
+ <key>tr_slope</key>
+ <value>qtgui.TRIG_SLOPE_POS</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>tr_tag</key>
+ <value>""</value>
</param>
<param>
<key>type</key>
<value>float</value>
</param>
<param>
- <key>name</key>
- <value>Error</value>
+ <key>update_time</key>
+ <value>0.10</value>
</param>
<param>
<key>ylabel</key>
@@ -1875,343 +2143,359 @@
<value>""</value>
</param>
<param>
- <key>size</key>
- <value>1024</value>
+ <key>ymax</key>
+ <value>1</value>
</param>
<param>
- <key>srate</key>
- <value>samp_rate</value>
+ <key>ymin</key>
+ <value>-1</value>
</param>
+ </block>
+ <block>
+ <key>qtgui_time_sink_x</key>
<param>
- <key>grid</key>
- <value>False</value>
+ <key>autoscale</key>
+ <value>True</value>
</param>
<param>
- <key>autoscale</key>
+ <key>axislabels</key>
<value>True</value>
</param>
<param>
- <key>ymin</key>
- <value>-1</value>
+ <key>alias</key>
+ <value></value>
</param>
<param>
- <key>ymax</key>
- <value>1</value>
+ <key>comment</key>
+ <value></value>
</param>
<param>
- <key>nconnections</key>
- <value>1</value>
+ <key>ctrlpanel</key>
+ <value>False</value>
</param>
<param>
- <key>update_time</key>
- <value>0.10</value>
+ <key>affinity</key>
+ <value></value>
</param>
<param>
<key>entags</key>
<value>True</value>
</param>
<param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(1018, 503)</value>
+ </param>
+ <param>
<key>gui_hint</key>
- <value>notebook@0</value>
+ <value>notebook@2</value>
</param>
<param>
- <key>tr_mode</key>
- <value>qtgui.TRIG_MODE_FREE</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
<param>
- <key>tr_slope</key>
- <value>qtgui.TRIG_SLOPE_POS</value>
+ <key>grid</key>
+ <value>False</value>
</param>
<param>
- <key>tr_level</key>
- <value>0.0</value>
+ <key>id</key>
+ <value>qtgui_time_sink_x_1_0</value>
</param>
<param>
- <key>tr_delay</key>
- <value>0</value>
+ <key>legend</key>
+ <value>True</value>
</param>
<param>
- <key>tr_chan</key>
- <value>0</value>
+ <key>alpha1</key>
+ <value>1.0</value>
</param>
<param>
- <key>tr_tag</key>
- <value>""</value>
+ <key>color1</key>
+ <value>"blue"</value>
</param>
<param>
<key>label1</key>
<value></value>
</param>
<param>
+ <key>marker1</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>style1</key>
+ <value>1</value>
+ </param>
+ <param>
<key>width1</key>
<value>1</value>
</param>
<param>
- <key>color1</key>
+ <key>alpha10</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>color10</key>
<value>"blue"</value>
</param>
<param>
- <key>style1</key>
- <value>1</value>
+ <key>label10</key>
+ <value></value>
</param>
<param>
- <key>marker1</key>
+ <key>marker10</key>
<value>-1</value>
</param>
<param>
- <key>alpha1</key>
- <value>1.0</value>
+ <key>style10</key>
+ <value>1</value>
</param>
<param>
- <key>label2</key>
- <value></value>
+ <key>width10</key>
+ <value>1</value>
</param>
<param>
- <key>width2</key>
- <value>1</value>
+ <key>alpha2</key>
+ <value>1.0</value>
</param>
<param>
<key>color2</key>
<value>"red"</value>
</param>
<param>
- <key>style2</key>
- <value>1</value>
+ <key>label2</key>
+ <value></value>
</param>
<param>
<key>marker2</key>
<value>-1</value>
</param>
<param>
- <key>alpha2</key>
- <value>1.0</value>
+ <key>style2</key>
+ <value>1</value>
</param>
<param>
- <key>label3</key>
- <value></value>
+ <key>width2</key>
+ <value>1</value>
</param>
<param>
- <key>width3</key>
- <value>1</value>
+ <key>alpha3</key>
+ <value>1.0</value>
</param>
<param>
<key>color3</key>
<value>"green"</value>
</param>
<param>
- <key>style3</key>
- <value>1</value>
+ <key>label3</key>
+ <value></value>
</param>
<param>
<key>marker3</key>
<value>-1</value>
</param>
<param>
- <key>alpha3</key>
- <value>1.0</value>
+ <key>style3</key>
+ <value>1</value>
</param>
<param>
- <key>label4</key>
- <value></value>
+ <key>width3</key>
+ <value>1</value>
</param>
<param>
- <key>width4</key>
- <value>1</value>
+ <key>alpha4</key>
+ <value>1.0</value>
</param>
<param>
<key>color4</key>
<value>"black"</value>
</param>
<param>
- <key>style4</key>
- <value>1</value>
+ <key>label4</key>
+ <value></value>
</param>
<param>
<key>marker4</key>
<value>-1</value>
</param>
<param>
- <key>alpha4</key>
- <value>1.0</value>
+ <key>style4</key>
+ <value>1</value>
</param>
<param>
- <key>label5</key>
- <value></value>
+ <key>width4</key>
+ <value>1</value>
</param>
<param>
- <key>width5</key>
- <value>1</value>
+ <key>alpha5</key>
+ <value>1.0</value>
</param>
<param>
<key>color5</key>
<value>"cyan"</value>
</param>
<param>
- <key>style5</key>
- <value>1</value>
+ <key>label5</key>
+ <value></value>
</param>
<param>
<key>marker5</key>
<value>-1</value>
</param>
<param>
- <key>alpha5</key>
- <value>1.0</value>
+ <key>style5</key>
+ <value>1</value>
</param>
<param>
- <key>label6</key>
- <value></value>
+ <key>width5</key>
+ <value>1</value>
</param>
<param>
- <key>width6</key>
- <value>1</value>
+ <key>alpha6</key>
+ <value>1.0</value>
</param>
<param>
<key>color6</key>
<value>"magenta"</value>
</param>
<param>
- <key>style6</key>
- <value>1</value>
+ <key>label6</key>
+ <value></value>
</param>
<param>
<key>marker6</key>
<value>-1</value>
</param>
<param>
- <key>alpha6</key>
- <value>1.0</value>
+ <key>style6</key>
+ <value>1</value>
</param>
<param>
- <key>label7</key>
- <value></value>
+ <key>width6</key>
+ <value>1</value>
</param>
<param>
- <key>width7</key>
- <value>1</value>
+ <key>alpha7</key>
+ <value>1.0</value>
</param>
<param>
<key>color7</key>
<value>"yellow"</value>
</param>
<param>
- <key>style7</key>
- <value>1</value>
+ <key>label7</key>
+ <value></value>
</param>
<param>
<key>marker7</key>
<value>-1</value>
</param>
<param>
- <key>alpha7</key>
- <value>1.0</value>
+ <key>style7</key>
+ <value>1</value>
</param>
<param>
- <key>label8</key>
- <value></value>
+ <key>width7</key>
+ <value>1</value>
</param>
<param>
- <key>width8</key>
- <value>1</value>
+ <key>alpha8</key>
+ <value>1.0</value>
</param>
<param>
<key>color8</key>
<value>"dark red"</value>
</param>
<param>
- <key>style8</key>
- <value>1</value>
+ <key>label8</key>
+ <value></value>
</param>
<param>
<key>marker8</key>
<value>-1</value>
</param>
<param>
- <key>alpha8</key>
- <value>1.0</value>
+ <key>style8</key>
+ <value>1</value>
</param>
<param>
- <key>label9</key>
- <value></value>
+ <key>width8</key>
+ <value>1</value>
</param>
<param>
- <key>width9</key>
- <value>1</value>
+ <key>alpha9</key>
+ <value>1.0</value>
</param>
<param>
<key>color9</key>
<value>"dark green"</value>
</param>
<param>
- <key>style9</key>
- <value>1</value>
+ <key>label9</key>
+ <value></value>
</param>
<param>
<key>marker9</key>
<value>-1</value>
</param>
<param>
- <key>alpha9</key>
- <value>1.0</value>
- </param>
- <param>
- <key>label10</key>
- <value></value>
+ <key>style9</key>
+ <value>1</value>
</param>
<param>
- <key>width10</key>
+ <key>width9</key>
<value>1</value>
</param>
<param>
- <key>color10</key>
- <value>"blue"</value>
+ <key>name</key>
+ <value>Rate</value>
</param>
<param>
- <key>style10</key>
+ <key>nconnections</key>
<value>1</value>
</param>
<param>
- <key>marker10</key>
- <value>-1</value>
+ <key>size</key>
+ <value>1024</value>
</param>
<param>
- <key>alpha10</key>
- <value>1.0</value>
+ <key>srate</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>alias</key>
- <value></value>
+ <key>tr_chan</key>
+ <value>0</value>
</param>
<param>
- <key>affinity</key>
- <value></value>
+ <key>tr_delay</key>
+ <value>0</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(1017, 378)</value>
+ <key>tr_level</key>
+ <value>0.0</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>tr_mode</key>
+ <value>qtgui.TRIG_MODE_FREE</value>
</param>
- </block>
- <block>
- <key>qtgui_time_sink_x</key>
<param>
- <key>id</key>
- <value>qtgui_time_sink_x_0_0</value>
+ <key>tr_slope</key>
+ <value>qtgui.TRIG_SLOPE_POS</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>tr_tag</key>
+ <value>""</value>
</param>
<param>
<key>type</key>
- <value>complex</value>
+ <value>float</value>
</param>
<param>
- <key>name</key>
- <value>Scope Plot</value>
+ <key>update_time</key>
+ <value>0.10</value>
</param>
<param>
<key>ylabel</key>
@@ -2222,473 +2506,398 @@
<value>""</value>
</param>
<param>
- <key>size</key>
- <value>1024</value>
+ <key>ymax</key>
+ <value>1</value>
</param>
<param>
- <key>srate</key>
- <value>samp_rate</value>
+ <key>ymin</key>
+ <value>-1</value>
</param>
+ </block>
+ <block>
+ <key>qtgui_time_sink_x</key>
<param>
- <key>grid</key>
- <value>False</value>
+ <key>autoscale</key>
+ <value>True</value>
</param>
<param>
- <key>autoscale</key>
- <value>False</value>
+ <key>axislabels</key>
+ <value>True</value>
</param>
<param>
- <key>ymin</key>
- <value>-1</value>
+ <key>alias</key>
+ <value></value>
</param>
<param>
- <key>ymax</key>
- <value>1</value>
+ <key>comment</key>
+ <value></value>
</param>
<param>
- <key>nconnections</key>
- <value>1</value>
+ <key>ctrlpanel</key>
+ <value>False</value>
</param>
<param>
- <key>update_time</key>
- <value>0.10</value>
+ <key>affinity</key>
+ <value></value>
</param>
<param>
<key>entags</key>
<value>True</value>
</param>
<param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(1014, 622)</value>
+ </param>
+ <param>
<key>gui_hint</key>
- <value></value>
+ <value>notebook@1</value>
</param>
<param>
- <key>tr_mode</key>
- <value>qtgui.TRIG_MODE_FREE</value>
+ <key>_rotation</key>
+ <value>0</value>
</param>
<param>
- <key>tr_slope</key>
- <value>qtgui.TRIG_SLOPE_POS</value>
+ <key>grid</key>
+ <value>False</value>
</param>
<param>
- <key>tr_level</key>
- <value>0.0</value>
+ <key>id</key>
+ <value>qtgui_time_sink_x_1_1</value>
</param>
<param>
- <key>tr_delay</key>
- <value>0</value>
+ <key>legend</key>
+ <value>True</value>
</param>
<param>
- <key>tr_chan</key>
- <value>0</value>
+ <key>alpha1</key>
+ <value>1.0</value>
</param>
<param>
- <key>tr_tag</key>
- <value>""</value>
+ <key>color1</key>
+ <value>"blue"</value>
</param>
<param>
<key>label1</key>
<value></value>
</param>
<param>
+ <key>marker1</key>
+ <value>-1</value>
+ </param>
+ <param>
+ <key>style1</key>
+ <value>1</value>
+ </param>
+ <param>
<key>width1</key>
<value>1</value>
</param>
<param>
- <key>color1</key>
+ <key>alpha10</key>
+ <value>1.0</value>
+ </param>
+ <param>
+ <key>color10</key>
<value>"blue"</value>
</param>
<param>
- <key>style1</key>
- <value>1</value>
+ <key>label10</key>
+ <value></value>
</param>
<param>
- <key>marker1</key>
+ <key>marker10</key>
<value>-1</value>
</param>
<param>
- <key>alpha1</key>
- <value>1.0</value>
+ <key>style10</key>
+ <value>1</value>
</param>
<param>
- <key>label2</key>
- <value></value>
+ <key>width10</key>
+ <value>1</value>
</param>
<param>
- <key>width2</key>
- <value>1</value>
+ <key>alpha2</key>
+ <value>1.0</value>
</param>
<param>
<key>color2</key>
<value>"red"</value>
</param>
<param>
- <key>style2</key>
- <value>1</value>
+ <key>label2</key>
+ <value></value>
</param>
<param>
<key>marker2</key>
<value>-1</value>
</param>
<param>
- <key>alpha2</key>
- <value>1.0</value>
+ <key>style2</key>
+ <value>1</value>
</param>
<param>
- <key>label3</key>
- <value></value>
+ <key>width2</key>
+ <value>1</value>
</param>
<param>
- <key>width3</key>
- <value>1</value>
+ <key>alpha3</key>
+ <value>1.0</value>
</param>
<param>
<key>color3</key>
<value>"green"</value>
</param>
<param>
- <key>style3</key>
- <value>1</value>
+ <key>label3</key>
+ <value></value>
</param>
<param>
<key>marker3</key>
<value>-1</value>
</param>
<param>
- <key>alpha3</key>
- <value>1.0</value>
+ <key>style3</key>
+ <value>1</value>
</param>
<param>
- <key>label4</key>
- <value></value>
+ <key>width3</key>
+ <value>1</value>
</param>
<param>
- <key>width4</key>
- <value>1</value>
+ <key>alpha4</key>
+ <value>1.0</value>
</param>
<param>
<key>color4</key>
<value>"black"</value>
</param>
<param>
- <key>style4</key>
- <value>1</value>
+ <key>label4</key>
+ <value></value>
</param>
<param>
<key>marker4</key>
<value>-1</value>
</param>
<param>
- <key>alpha4</key>
- <value>1.0</value>
+ <key>style4</key>
+ <value>1</value>
</param>
<param>
- <key>label5</key>
- <value></value>
+ <key>width4</key>
+ <value>1</value>
</param>
<param>
- <key>width5</key>
- <value>1</value>
+ <key>alpha5</key>
+ <value>1.0</value>
</param>
<param>
<key>color5</key>
<value>"cyan"</value>
</param>
<param>
- <key>style5</key>
- <value>1</value>
+ <key>label5</key>
+ <value></value>
</param>
<param>
<key>marker5</key>
<value>-1</value>
</param>
<param>
- <key>alpha5</key>
- <value>1.0</value>
+ <key>style5</key>
+ <value>1</value>
</param>
<param>
- <key>label6</key>
- <value></value>
+ <key>width5</key>
+ <value>1</value>
</param>
<param>
- <key>width6</key>
- <value>1</value>
+ <key>alpha6</key>
+ <value>1.0</value>
</param>
<param>
<key>color6</key>
<value>"magenta"</value>
</param>
<param>
- <key>style6</key>
- <value>1</value>
+ <key>label6</key>
+ <value></value>
</param>
<param>
<key>marker6</key>
<value>-1</value>
</param>
<param>
- <key>alpha6</key>
- <value>1.0</value>
+ <key>style6</key>
+ <value>1</value>
</param>
<param>
- <key>label7</key>
- <value></value>
+ <key>width6</key>
+ <value>1</value>
</param>
<param>
- <key>width7</key>
- <value>1</value>
+ <key>alpha7</key>
+ <value>1.0</value>
</param>
<param>
<key>color7</key>
<value>"yellow"</value>
</param>
<param>
- <key>style7</key>
- <value>1</value>
+ <key>label7</key>
+ <value></value>
</param>
<param>
<key>marker7</key>
<value>-1</value>
</param>
<param>
- <key>alpha7</key>
- <value>1.0</value>
+ <key>style7</key>
+ <value>1</value>
</param>
<param>
- <key>label8</key>
- <value></value>
+ <key>width7</key>
+ <value>1</value>
</param>
<param>
- <key>width8</key>
- <value>1</value>
+ <key>alpha8</key>
+ <value>1.0</value>
</param>
<param>
<key>color8</key>
<value>"dark red"</value>
</param>
<param>
- <key>style8</key>
- <value>1</value>
+ <key>label8</key>
+ <value></value>
</param>
<param>
<key>marker8</key>
<value>-1</value>
</param>
<param>
- <key>alpha8</key>
- <value>1.0</value>
+ <key>style8</key>
+ <value>1</value>
</param>
<param>
- <key>label9</key>
- <value></value>
+ <key>width8</key>
+ <value>1</value>
</param>
<param>
- <key>width9</key>
- <value>1</value>
+ <key>alpha9</key>
+ <value>1.0</value>
</param>
<param>
<key>color9</key>
<value>"dark green"</value>
</param>
<param>
- <key>style9</key>
- <value>1</value>
+ <key>label9</key>
+ <value></value>
</param>
<param>
<key>marker9</key>
<value>-1</value>
</param>
<param>
- <key>alpha9</key>
- <value>1.0</value>
- </param>
- <param>
- <key>label10</key>
- <value></value>
- </param>
- <param>
- <key>width10</key>
+ <key>style9</key>
<value>1</value>
</param>
<param>
- <key>color10</key>
- <value>"blue"</value>
- </param>
- <param>
- <key>style10</key>
+ <key>width9</key>
<value>1</value>
</param>
<param>
- <key>marker10</key>
- <value>-1</value>
- </param>
- <param>
- <key>alpha10</key>
- <value>1.0</value>
- </param>
- <param>
- <key>alias</key>
- <value></value>
- </param>
- <param>
- <key>affinity</key>
- <value></value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(1029, 281)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
+ <key>name</key>
+ <value>Phase</value>
</param>
- </block>
- <block>
- <key>variable_qtgui_range</key>
<param>
- <key>id</key>
- <value>time_bw</value>
+ <key>nconnections</key>
+ <value>1</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>size</key>
+ <value>1024</value>
</param>
<param>
- <key>label</key>
- <value>Timing Loop BW</value>
+ <key>srate</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>value</key>
+ <key>tr_chan</key>
<value>0</value>
</param>
<param>
- <key>start</key>
+ <key>tr_delay</key>
<value>0</value>
</param>
<param>
- <key>stop</key>
- <value>.1</value>
- </param>
- <param>
- <key>step</key>
- <value>.001</value>
- </param>
- <param>
- <key>widget</key>
- <value>counter_slider</value>
- </param>
- <param>
- <key>orient</key>
- <value>Qt.Horizontal</value>
- </param>
- <param>
- <key>min_len</key>
- <value>200</value>
- </param>
- <param>
- <key>gui_hint</key>
- <value>1,2,1,1</value>
- </param>
- <param>
- <key>alias</key>
- <value></value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(451, 0)</value>
+ <key>tr_level</key>
+ <value>0.0</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>tr_mode</key>
+ <value>qtgui.TRIG_MODE_FREE</value>
</param>
- </block>
- <block>
- <key>digital_pfb_clock_sync_xxx</key>
<param>
- <key>id</key>
- <value>digital_pfb_clock_sync_xxx_0</value>
+ <key>tr_slope</key>
+ <value>qtgui.TRIG_SLOPE_POS</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>tr_tag</key>
+ <value>""</value>
</param>
<param>
<key>type</key>
- <value>ccf</value>
- </param>
- <param>
- <key>sps</key>
- <value>spb</value>
- </param>
- <param>
- <key>loop_bw</key>
- <value>time_bw</value>
- </param>
- <param>
- <key>taps</key>
- <value>firdes.root_raised_cosine(nfilts, nfilts*spb, 1.0, rolloff, 44*nfilts)</value>
+ <value>float</value>
</param>
<param>
- <key>filter_size</key>
- <value>nfilts</value>
+ <key>update_time</key>
+ <value>0.10</value>
</param>
<param>
- <key>init_phase</key>
- <value>16</value>
+ <key>ylabel</key>
+ <value>Amplitude</value>
</param>
<param>
- <key>max_dev</key>
- <value>1.5</value>
+ <key>yunit</key>
+ <value>""</value>
</param>
<param>
- <key>osps</key>
+ <key>ymax</key>
<value>1</value>
</param>
<param>
- <key>alias</key>
- <value></value>
- </param>
- <param>
- <key>affinity</key>
- <value></value>
- </param>
- <param>
- <key>minoutbuf</key>
- <value>0</value>
- </param>
- <param>
- <key>maxoutbuf</key>
- <value>0</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(467, 403)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
+ <key>ymin</key>
+ <value>-1</value>
</param>
</block>
<connection>
- <source_block_id>blocks_throttle_0</source_block_id>
- <sink_block_id>digital_pfb_clock_sync_xxx_0</sink_block_id>
+ <source_block_id>analog_random_source_x</source_block_id>
+ <sink_block_id>digital_chunks_to_symbols_xx</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>pfb_arb_resampler_xxx_0</source_block_id>
- <sink_block_id>blocks_multiply_const_vxx_0</sink_block_id>
+ <source_block_id>blocks_multiply_const_vxx_0</source_block_id>
+ <sink_block_id>channels_channel_model_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>digital_chunks_to_symbols_xx</source_block_id>
- <sink_block_id>pfb_arb_resampler_xxx_0</sink_block_id>
+ <source_block_id>blocks_multiply_const_vxx_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>analog_random_source_x</source_block_id>
- <sink_block_id>digital_chunks_to_symbols_xx</sink_block_id>
+ <source_block_id>blocks_throttle_0</source_block_id>
+ <sink_block_id>digital_pfb_clock_sync_xxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
@@ -2699,15 +2908,15 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>blocks_multiply_const_vxx_0</source_block_id>
- <sink_block_id>channels_channel_model_0</sink_block_id>
+ <source_block_id>digital_chunks_to_symbols_xx</source_block_id>
+ <sink_block_id>pfb_arb_resampler_xxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>blocks_multiply_const_vxx_0</source_block_id>
- <sink_block_id>qtgui_time_sink_x_0</sink_block_id>
- <source_key>0</source_key>
+ <source_block_id>digital_pfb_clock_sync_xxx_0</source_block_id>
+ <sink_block_id>qtgui_time_sink_x_1</sink_block_id>
+ <source_key>1</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
@@ -2718,12 +2927,6 @@
</connection>
<connection>
<source_block_id>digital_pfb_clock_sync_xxx_0</source_block_id>
- <sink_block_id>qtgui_time_sink_x_1</sink_block_id>
- <source_key>1</source_key>
- <sink_key>0</sink_key>
- </connection>
- <connection>
- <source_block_id>digital_pfb_clock_sync_xxx_0</source_block_id>
<sink_block_id>qtgui_time_sink_x_1_1</sink_block_id>
<source_key>3</source_key>
<sink_key>0</sink_key>
@@ -2734,4 +2937,10 @@
<source_key>2</source_key>
<sink_key>0</sink_key>
</connection>
+ <connection>
+ <source_block_id>pfb_arb_resampler_xxx_0</source_block_id>
+ <sink_block_id>blocks_multiply_const_vxx_0</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
</flow_graph>
diff --git a/gr-digital/examples/example_costas.py b/gr-digital/examples/example_costas.py
index 77495d944..56fc41901 100755..100644
--- a/gr-digital/examples/example_costas.py
+++ b/gr-digital/examples/example_costas.py
@@ -20,6 +20,10 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
from gnuradio import gr, digital, filter
from gnuradio import blocks
from gnuradio import channels
@@ -31,13 +35,13 @@ import sys
try:
import scipy
except ImportError:
- print "Error: could not import scipy (http://www.scipy.org/)"
+ print("Error: could not import scipy (http://www.scipy.org/)")
sys.exit(1)
try:
import pylab
except ImportError:
- print "Error: could not import pylab (http://matplotlib.sourceforge.net/)"
+ print("Error: could not import pylab (http://matplotlib.sourceforge.net/)")
sys.exit(1)
class example_costas(gr.top_block):
diff --git a/gr-digital/examples/example_fll.py b/gr-digital/examples/example_fll.py
index cda92eaa7..2603f0634 100755..100644
--- a/gr-digital/examples/example_fll.py
+++ b/gr-digital/examples/example_fll.py
@@ -20,6 +20,10 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
from gnuradio import gr, digital, filter
from gnuradio import blocks
from gnuradio import channels
@@ -31,13 +35,13 @@ import sys
try:
import scipy
except ImportError:
- print "Error: could not import scipy (http://www.scipy.org/)"
+ print("Error: could not import scipy (http://www.scipy.org/)")
sys.exit(1)
try:
import pylab
except ImportError:
- print "Error: could not import pylab (http://matplotlib.sourceforge.net/)"
+ print("Error: could not import pylab (http://matplotlib.sourceforge.net/)")
sys.exit(1)
class example_fll(gr.top_block):
diff --git a/gr-digital/examples/example_timing.py b/gr-digital/examples/example_timing.py
index 5c10c0401..348d62b6f 100755..100644
--- a/gr-digital/examples/example_timing.py
+++ b/gr-digital/examples/example_timing.py
@@ -20,6 +20,10 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
from gnuradio import gr, digital, filter
from gnuradio import blocks
from gnuradio import channels
@@ -31,13 +35,13 @@ import sys
try:
import scipy
except ImportError:
- print "Error: could not import scipy (http://www.scipy.org/)"
+ print("Error: could not import scipy (http://www.scipy.org/)")
sys.exit(1)
try:
import pylab
except ImportError:
- print "Error: could not import pylab (http://matplotlib.sourceforge.net/)"
+ print("Error: could not import pylab (http://matplotlib.sourceforge.net/)")
sys.exit(1)
from scipy import fftpack
@@ -69,8 +73,8 @@ class example_timing(gr.top_block):
self.taps = self.clk.taps()
self.dtaps = self.clk.diff_taps()
- self.delay = int(scipy.ceil(((len(rrc_taps)-1)/2 +
- (len(self.taps[0])-1)/2)/float(sps))) + 1
+ self.delay = int(scipy.ceil((old_div((len(rrc_taps)-1) / 2 +
+ (len(self.taps[0])-1) / 2),float(sps)))) + 1
self.vsnk_err = blocks.vector_sink_f()
diff --git a/gr-digital/examples/gen_whitener.py b/gr-digital/examples/gen_whitener.py
index 62345cee5..4b4ecdb52 100755..100644
--- a/gr-digital/examples/gen_whitener.py
+++ b/gr-digital/examples/gen_whitener.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from gnuradio import gr, gru
from gnuradio import blocks
from gnuradio.eng_arg import eng_float, intx
diff --git a/gr-digital/examples/narrowband/benchmark_add_channel.py b/gr-digital/examples/narrowband/benchmark_add_channel.py
index cd85f4e48..846caddd2 100755..100644
--- a/gr-digital/examples/narrowband/benchmark_add_channel.py
+++ b/gr-digital/examples/narrowband/benchmark_add_channel.py
@@ -1,24 +1,28 @@
#!/usr/bin/env python
#
# Copyright 2010,2011 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import channels, gr
from gnuradio import blocks
@@ -32,14 +36,14 @@ class my_top_block(gr.top_block):
def __init__(self, ifile, ofile, options):
gr.top_block.__init__(self)
- SNR = 10.0**(options.snr/10.0)
+ SNR = 10.0**(options.snr / 10.0)
frequency_offset = options.frequency_offset
time_offset = options.time_offset
- phase_offset = options.phase_offset*(math.pi/180.0)
+ phase_offset = options.phase_offset*(math.pi / 180.0)
# calculate noise voltage from SNR
power_in_signal = abs(options.tx_amplitude)**2
- noise_power = power_in_signal/SNR
+ noise_power = power_in_signal / SNR
noise_voltage = math.sqrt(noise_power)
self.src = blocks.file_source(gr.sizeof_gr_complex, ifile)
@@ -52,7 +56,7 @@ class my_top_block(gr.top_block):
self.snk = blocks.file_sink(gr.sizeof_gr_complex, ofile)
self.connect(self.src, self.channel, self.phase, self.snk)
-
+
# /////////////////////////////////////////////////////////////////////////////
# main
@@ -86,13 +90,13 @@ def main():
ifile = args[0]
ofile = args[1]
-
+
# build the graph
tb = my_top_block(ifile, ofile, options)
r = gr.enable_realtime_scheduling()
if r != gr.RT_OK:
- print "Warning: Failed to enable realtime scheduling."
+ print("Warning: Failed to enable realtime scheduling.")
tb.start() # start flow graph
tb.wait() # wait for it to finish
diff --git a/gr-digital/examples/narrowband/benchmark_rx.py b/gr-digital/examples/narrowband/benchmark_rx.py
index 09d923fc6..8467d376e 100755..100644
--- a/gr-digital/examples/narrowband/benchmark_rx.py
+++ b/gr-digital/examples/narrowband/benchmark_rx.py
@@ -1,24 +1,28 @@
#!/usr/bin/env python
#
# Copyright 2010,2011,2013 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr, gru
from gnuradio import blocks
@@ -37,7 +41,7 @@ import struct
import sys
#import os
-#print os.getpid()
+#print(os.getpid())
#raw_input('Attach and press enter: ')
class my_top_block(gr.top_block):
@@ -47,10 +51,10 @@ class my_top_block(gr.top_block):
if(options.rx_freq is not None):
# Work-around to get the modulation's bits_per_symbol
args = demodulator.extract_kwargs_from_options(options)
- symbol_rate = options.bitrate / demodulator(**args).bits_per_symbol()
+ symbol_rate = options.bitrate / demodulator(**args.bits_per_symbol())
self.source = uhd_receiver(options.args, symbol_rate,
- options.samples_per_symbol, options.rx_freq,
+ options.samples_per_symbol, options.rx_freq,
options.lo_offset, options.rx_gain,
options.spec, options.antenna,
options.clock_source, options.verbose)
@@ -66,7 +70,7 @@ class my_top_block(gr.top_block):
# Set up receive path
# do this after for any adjustments to the options that may
# occur in the sinks (specifically the UHD sink)
- self.rxpath = receive_path(demodulator, rx_callback, options)
+ self.rxpath = receive_path(demodulator, rx_callback, options)
self.connect(self.source, self.rxpath)
@@ -82,7 +86,7 @@ def main():
n_rcvd = 0
n_right = 0
-
+
def rx_callback(ok, payload):
global n_rcvd, n_right
(pktno,) = struct.unpack('!H', payload[0:2])
@@ -90,8 +94,8 @@ def main():
if ok:
n_right += 1
- print "ok = %5s pktno = %4d n_rcvd = %4d n_right = %4d" % (
- ok, pktno, n_rcvd, n_right)
+ print("ok = %5s pktno = %4d n_rcvd = %4d n_right = %4d" % (
+ ok, pktno, n_rcvd, n_right))
demods = digital.modulation_utils.type_1_demods()
@@ -99,17 +103,17 @@ def main():
parser = OptionParser (option_class=eng_option, conflict_handler="resolve")
expert_grp = parser.add_option_group("Expert")
- parser.add_option("-m", "--modulation", type="choice", choices=demods.keys(),
+ parser.add_option("-m", "--modulation", type="choice", choices=list(demods.keys()),
default='psk',
help="Select modulation from: %s [default=%%default]"
- % (', '.join(demods.keys()),))
+ % (', '.join(list(demods.keys())),))
parser.add_option("","--from-file", default=None,
help="input file of samples to demod")
receive_path.add_options(parser, expert_grp)
uhd_receiver.add_options(parser)
- for mod in demods.values():
+ for mod in list(demods.values()):
mod.add_options(expert_grp)
(options, args) = parser.parse_args ()
@@ -130,7 +134,7 @@ def main():
r = gr.enable_realtime_scheduling()
if r != gr.RT_OK:
- print "Warning: Failed to enable realtime scheduling."
+ print("Warning: Failed to enable realtime scheduling.")
tb.start() # start flow graph
tb.wait() # wait for it to finish
diff --git a/gr-digital/examples/narrowband/benchmark_tx.py b/gr-digital/examples/narrowband/benchmark_tx.py
index e0744e79a..119932aeb 100755..100644
--- a/gr-digital/examples/narrowband/benchmark_tx.py
+++ b/gr-digital/examples/narrowband/benchmark_tx.py
@@ -1,24 +1,28 @@
#!/usr/bin/env python
#
# Copyright 2010,2011,2013 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
@@ -35,8 +39,8 @@ from uhd_interface import uhd_transmitter
import time, struct, sys
-#import os
-#print os.getpid()
+#import os
+#print(os.getpid())
#raw_input('Attach and press enter')
class my_top_block(gr.top_block):
@@ -46,7 +50,7 @@ class my_top_block(gr.top_block):
if(options.tx_freq is not None):
# Work-around to get the modulation's bits_per_symbol
args = modulator.extract_kwargs_from_options(options)
- symbol_rate = options.bitrate / modulator(**args).bits_per_symbol()
+ symbol_rate = options.bitrate / modulator(**args.bits_per_symbol())
self.sink = uhd_transmitter(options.args, symbol_rate,
options.samples_per_symbol, options.tx_freq,
@@ -54,7 +58,7 @@ class my_top_block(gr.top_block):
options.spec, options.antenna,
options.clock_source, options.verbose)
options.samples_per_symbol = self.sink._sps
-
+
elif(options.to_file is not None):
sys.stderr.write(("Saving samples to '%s'.\n\n" % (options.to_file)))
self.sink = blocks.file_sink(gr.sizeof_gr_complex, options.to_file)
@@ -82,10 +86,10 @@ def main():
parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
expert_grp = parser.add_option_group("Expert")
- parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(),
+ parser.add_option("-m", "--modulation", type="choice", choices=list(mods.keys()),
default='psk',
help="Select modulation from: %s [default=%%default]"
- % (', '.join(mods.keys()),))
+ % (', '.join(list(mods.keys())),))
parser.add_option("-s", "--size", type="eng_float", default=1500,
help="set packet size [default=%default]")
@@ -101,7 +105,7 @@ def main():
transmit_path.add_options(parser, expert_grp)
uhd_transmitter.add_options(parser)
- for mod in mods.values():
+ for mod in list(mods.values()):
mod.add_options(expert_grp)
(options, args) = parser.parse_args ()
@@ -109,7 +113,7 @@ def main():
if len(args) != 0:
parser.print_help()
sys.exit(1)
-
+
if options.from_file is not None:
source_file = open(options.from_file, 'r')
@@ -118,10 +122,10 @@ def main():
r = gr.enable_realtime_scheduling()
if r != gr.RT_OK:
- print "Warning: failed to enable realtime scheduling"
+ print("Warning: failed to enable realtime scheduling")
tb.start() # start flow graph
-
+
# generate and send packets
nbytes = int(1e6 * options.megabytes)
n = 0
@@ -130,7 +134,7 @@ def main():
while n < nbytes:
if options.from_file is None:
- data = (pkt_size - 2) * chr(pktno & 0xff)
+ data = (pkt_size - 2) * chr(pktno & 0xff)
else:
data = source_file.read(pkt_size - 2)
if data == '':
@@ -143,7 +147,7 @@ def main():
if options.discontinuous and pktno % 5 == 4:
time.sleep(1)
pktno += 1
-
+
send_pkt(eof=True)
tb.wait() # wait for it to finish
diff --git a/gr-digital/examples/narrowband/digital_bert_rx.py b/gr-digital/examples/narrowband/digital_bert_rx.py
index c04c76762..aaa8b3e9e 100755..100644
--- a/gr-digital/examples/narrowband/digital_bert_rx.py
+++ b/gr-digital/examples/narrowband/digital_bert_rx.py
@@ -20,6 +20,10 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
from gnuradio import gr, eng_notation
from optparse import OptionParser
from gnuradio.eng_option import eng_option
@@ -44,8 +48,8 @@ class status_thread(_threading.Thread):
def run(self):
while not self.done:
- print "Freq. Offset: {0:5.0f} Hz Timing Offset: {1:10.1f} ppm Estimated SNR: {2:4.1f} dB BER: {3:g}".format(
- tb.frequency_offset(), tb.timing_offset()*1e6, tb.snr(), tb.ber())
+ print("Freq. Offset: {0:5.0f} Hz Timing Offset: {1:10.1f} ppm Estimated SNR: {2:4.1f} dB BER: {3:g}".format(
+ tb.frequency_offset(), tb.timing_offset()*1e6, tb.snr(), tb.ber()))
try:
time.sleep(1.0)
except KeyboardInterrupt:
@@ -63,10 +67,10 @@ class bert_receiver(gr.hier_block2):
gr.hier_block2.__init__(self, "bert_receive",
gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
gr.io_signature(0, 0, 0)) # Output signature
-
+
self._bitrate = bitrate
- self._demod = digital.generic_demod(constellation, differential,
+ self._demod = digital.generic_demod(constellation, differential,
samples_per_symbol,
gray_coded, excess_bw,
freq_bw, timing_bw, phase_bw,
@@ -77,15 +81,15 @@ class bert_receiver(gr.hier_block2):
# Add an SNR probe on the demodulated constellation
self._snr_probe = digital.probe_mpsk_snr_est_c(digital.SNR_EST_M2M4, 1000,
- alpha=10.0/self._symbol_rate)
+ alpha=10.0 / self._symbol_rate)
self.connect(self._demod.time_recov, self._snr_probe)
-
+
# Descramble BERT sequence. A channel error will create 3 incorrect bits
self._descrambler = digital.descrambler_bb(0x8A, 0x7F, 7) # CCSDS 7-bit descrambler
# Measure BER by the density of 0s in the stream
- self._ber = digital.probe_density_b(1.0/self._symbol_rate)
-
+ self._ber = digital.probe_density_b(1.0 / self._symbol_rate)
+
self.connect(self, self._demod, self._descrambler, self._ber)
def frequency_offset(self):
@@ -98,22 +102,22 @@ class bert_receiver(gr.hier_block2):
return self._snr_probe.snr()
def ber(self):
- return (1.0-self._ber.density())/3.0
+ return (1.0-self._ber.density()) / 3.0
class rx_psk_block(gr.top_block):
def __init__(self, demod, options):
- gr.top_block.__init__(self, "rx_mpsk")
+ gr.top_block.__init__(self, "rx_mpsk")
self._demodulator_class = demod
# Get demod_kwargs
demod_kwargs = self._demodulator_class.extract_kwargs_from_options(options)
-
+
# demodulator
- self._demodulator = self._demodulator_class(**demod_kwargs)
+ self._demodulator = self._demodulator_class(**demod_kwargs)
if(options.rx_freq is not None):
symbol_rate = options.bitrate / self._demodulator.bits_per_symbol()
@@ -131,17 +135,17 @@ class rx_psk_block(gr.top_block):
# Create the BERT receiver
self._receiver = bert_receiver(options.bitrate,
- self._demodulator._constellation,
+ self._demodulator._constellation,
options.samples_per_symbol,
- options.differential,
- options.excess_bw,
+ options.differential,
+ options.excess_bw,
gray_coded=True,
freq_bw=options.freq_bw,
timing_bw=options.timing_bw,
phase_bw=options.phase_bw,
verbose=options.verbose,
log=options.log)
-
+
self.connect(self._source, self._receiver)
def snr(self):
@@ -149,7 +153,7 @@ class rx_psk_block(gr.top_block):
def mag(self):
return self._receiver.signal_mean()
-
+
def var(self):
return self._receiver.noise_variance()
@@ -158,19 +162,19 @@ class rx_psk_block(gr.top_block):
def frequency_offset(self):
return self._receiver.frequency_offset()
-
+
def timing_offset(self):
return self._receiver.timing_offset()
-
+
def get_options(demods):
parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
parser.add_option("","--from-file", default=None,
help="input file of samples to demod")
- parser.add_option("-m", "--modulation", type="choice", choices=demods.keys(),
+ parser.add_option("-m", "--modulation", type="choice", choices=list(demods.keys()),
default='psk',
help="Select modulation from: %s [default=%%default]"
- % (', '.join(demods.keys()),))
+ % (', '.join(list(demods.keys())),))
parser.add_option("-r", "--bitrate", type="eng_float", default=250e3,
help="Select modulation bit rate (default=%default)")
parser.add_option("-S", "--samples-per-symbol", type="float", default=2,
@@ -184,14 +188,14 @@ def get_options(demods):
uhd_receiver.add_options(parser)
demods = digital.modulation_utils.type_1_demods()
- for mod in demods.values():
+ for mod in list(demods.values()):
mod.add_options(parser)
-
+
(options, args) = parser.parse_args()
if len(args) != 0:
parser.print_help()
sys.exit(1)
-
+
return (options, args)
@@ -203,8 +207,8 @@ if __name__ == "__main__":
demod = demods[options.modulation]
tb = rx_psk_block(demod, options)
- print "\n*** SNR estimator is inaccurate below about 7dB"
- print "*** BER estimator is inaccurate above about 10%\n"
+ print("\n*** SNR estimator is inaccurate below about 7dB")
+ print("*** BER estimator is inaccurate above about 10%\n")
updater = status_thread(tb)
try:
diff --git a/gr-digital/examples/narrowband/digital_bert_tx.py b/gr-digital/examples/narrowband/digital_bert_tx.py
index 6859d2e7a..acc81b449 100755..100644
--- a/gr-digital/examples/narrowband/digital_bert_tx.py
+++ b/gr-digital/examples/narrowband/digital_bert_tx.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr, eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
@@ -97,10 +99,10 @@ class tx_psk_block(gr.top_block):
def get_options(mods):
parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
- parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(),
+ parser.add_option("-m", "--modulation", type="choice", choices=list(mods.keys()),
default='psk',
help="Select modulation from: %s [default=%%default]"
- % (', '.join(mods.keys()),))
+ % (', '.join(list(mods.keys())),))
parser.add_option("", "--amplitude", type="eng_float", default=0.2,
help="set Tx amplitude (0-1) (default=%default)")
parser.add_option("-r", "--bitrate", type="eng_float", default=250e3,
@@ -116,7 +118,7 @@ def get_options(mods):
uhd_transmitter.add_options(parser)
- for mod in mods.values():
+ for mod in list(mods.values()):
mod.add_options(parser)
(options, args) = parser.parse_args()
diff --git a/gr-digital/examples/narrowband/receive_path.py b/gr-digital/examples/narrowband/receive_path.py
index 9b44ae3f7..57a3f0914 100644
--- a/gr-digital/examples/narrowband/receive_path.py
+++ b/gr-digital/examples/narrowband/receive_path.py
@@ -1,24 +1,28 @@
#!/usr/bin/env python
#
# Copyright 2005-2007,2011 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr, gru, filter
from gnuradio import eng_notation
@@ -34,10 +38,10 @@ import sys
class receive_path(gr.hier_block2):
def __init__(self, demod_class, rx_callback, options):
- gr.hier_block2.__init__(self, "receive_path",
- gr.io_signature(1, 1, gr.sizeof_gr_complex),
- gr.io_signature(0, 0, 0))
-
+ gr.hier_block2.__init__(self, "receive_path",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex),
+ gr.io_signature(0, 0, 0))
+
options = copy.copy(options) # make a copy so we can destructively modify
self._verbose = options.verbose
@@ -56,10 +60,10 @@ class receive_path(gr.hier_block2):
# Make sure the channel BW factor is between 1 and sps/2
# or the filter won't work.
- if(self._chbw_factor < 1.0 or self._chbw_factor > self.samples_per_symbol()/2):
- sys.stderr.write("Channel bandwidth factor ({0}) must be within the range [1.0, {1}].\n".format(self._chbw_factor, self.samples_per_symbol()/2))
+ if(self._chbw_factor < 1.0 or self._chbw_factor > self.samples_per_symbol() / 2):
+ sys.stderr.write("Channel bandwidth factor ({0}) must be within the range [1.0, {1}].\n".format(self._chbw_factor, self.samples_per_symbol() / 2))
sys.exit(1)
-
+
# Design filter to get actual channel we want
sw_decim = 1
chan_coeffs = filter.firdes.low_pass(1.0, # gain
@@ -68,7 +72,7 @@ class receive_path(gr.hier_block2):
0.5, # width of trans. band
filter.firdes.WIN_HANN) # filter type
self.channel_filter = filter.fft_filter_ccc(sw_decim, chan_coeffs)
-
+
# receiver
self.packet_receiver = \
digital.demod_pkts(self.demodulator,
@@ -85,8 +89,8 @@ class receive_path(gr.hier_block2):
if self._verbose:
self._print_verbage()
- # connect block input to channel filter
- self.connect(self, self.channel_filter)
+ # connect block input to channel filter
+ self.connect(self, self.channel_filter)
# connect the channel input filter to the carrier power detector
self.connect(self.channel_filter, self.probe)
@@ -145,8 +149,8 @@ class receive_path(gr.hier_block2):
"""
Prints information about the receive path
"""
- print "\nReceive Path:"
- print "modulation: %s" % (self._demod_class.__name__)
- print "bitrate: %sb/s" % (eng_notation.num_to_str(self._bitrate))
- print "samples/symbol: %.4f" % (self.samples_per_symbol())
- print "Differential: %s" % (self.differential())
+ print("\nReceive Path:")
+ print("modulation: %s" % (self._demod_class.__name__))
+ print("bitrate: %sb/s" % (eng_notation.num_to_str(self._bitrate)))
+ print("samples/symbol: %.4f" % (self.samples_per_symbol()))
+ print("Differential: %s" % (self.differential()))
diff --git a/gr-digital/examples/narrowband/rx_voice.py b/gr-digital/examples/narrowband/rx_voice.py
index 8a0e9844b..16e4eb20a 100755..100644
--- a/gr-digital/examples/narrowband/rx_voice.py
+++ b/gr-digital/examples/narrowband/rx_voice.py
@@ -1,24 +1,28 @@
#!/usr/bin/env python
#
# Copyright 2005,2006,2009,2011,2013 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr, audio, uhd
from gnuradio import blocks
@@ -40,24 +44,24 @@ from receive_path import receive_path
from uhd_interface import uhd_receiver
#import os
-#print os.getpid()
+#print(os.getpid())
#raw_input('Attach and press enter')
class audio_tx(gr.hier_block2):
def __init__(self, audio_output_dev):
- gr.hier_block2.__init__(self, "audio_tx",
- gr.io_signature(0, 0, 0), # Input signature
- gr.io_signature(0, 0, 0)) # Output signature
-
+ gr.hier_block2.__init__(self, "audio_tx",
+ gr.io_signature(0, 0, 0), # Input signature
+ gr.io_signature(0, 0, 0)) # Output signature
+
self.sample_rate = sample_rate = 8000
self.packet_src = blocks.message_source(33)
voice_decoder = vocoder.gsm_fr_decode_ps()
s2f = blocks.short_to_float()
- sink_scale = blocks.multiply_const_ff(1.0/32767.)
+ sink_scale = blocks.multiply_const_ff(1.0 / 32767.)
audio_sink = audio.sink(sample_rate, audio_output_dev)
self.connect(self.packet_src, voice_decoder, s2f, sink_scale, audio_sink)
-
+
def msgq(self):
return self.packet_src.msgq()
@@ -79,7 +83,7 @@ class my_top_block(gr.top_block):
usrp_rate = self.source.get_sample_rate()
rrate = audio_rate / usrp_rate
self.resampler = filter.pfb.arb_resampler_ccf(rrate)
-
+
self.connect(self.source, self.resampler, self.rxpath)
elif(options.from_file is not None):
@@ -92,7 +96,7 @@ class my_top_block(gr.top_block):
self.source = blocks.null_source(gr.sizeof_gr_complex)
self.connect(self.source, self.thr, self.rxpath)
- self.connect(self.audio_tx)
+ self.connect(self.audio_tx)
# /////////////////////////////////////////////////////////////////////////////
# main
@@ -105,7 +109,7 @@ def main():
n_rcvd = 0
n_right = 0
-
+
def rx_callback(ok, payload):
global n_rcvd, n_right
n_rcvd += 1
@@ -113,9 +117,8 @@ def main():
n_right += 1
tb.audio_tx.msgq().insert_tail(gr.message_from_string(payload))
-
- print "ok = %r n_rcvd = %4d n_right = %4d" % (
- ok, n_rcvd, n_right)
+
+ print("ok = %r n_rcvd = %4d n_right = %4d" % (ok, n_rcvd, n_right))
demods = digital.modulation_utils.type_1_demods()
@@ -123,10 +126,10 @@ def main():
parser = OptionParser (option_class=eng_option, conflict_handler="resolve")
expert_grp = parser.add_option_group("Expert")
- parser.add_option("-m", "--modulation", type="choice", choices=demods.keys(),
+ parser.add_option("-m", "--modulation", type="choice", choices=list(demods.keys()),
default='gmsk',
help="Select modulation from: %s [default=%%default]"
- % (', '.join(demods.keys()),))
+ % (', '.join(list(demods.keys())),))
parser.add_option("-O", "--audio-output", type="string", default="",
help="pcm output device name. E.g., hw:0,0 or /dev/dsp")
parser.add_option("","--from-file", default=None,
@@ -134,7 +137,7 @@ def main():
receive_path.add_options(parser, expert_grp)
uhd_receiver.add_options(parser)
- for mod in demods.values():
+ for mod in list(demods.values()):
mod.add_options(expert_grp)
parser.set_defaults(bitrate=50e3) # override default bitrate default
@@ -156,7 +159,7 @@ def main():
r = gr.enable_realtime_scheduling()
if r != gr.RT_OK:
- print "Warning: Failed to enable realtime scheduling."
+ print("Warning: Failed to enable realtime scheduling.")
tb.run()
diff --git a/gr-digital/examples/narrowband/transmit_path.py b/gr-digital/examples/narrowband/transmit_path.py
index 70b4044e5..c451f6436 100644
--- a/gr-digital/examples/narrowband/transmit_path.py
+++ b/gr-digital/examples/narrowband/transmit_path.py
@@ -1,23 +1,26 @@
#
# Copyright 2005-2007,2011 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import eng_notation
@@ -36,10 +39,10 @@ class transmit_path(gr.hier_block2):
'''
See below for what options should hold
'''
- gr.hier_block2.__init__(self, "transmit_path",
- gr.io_signature(0,0,0),
- gr.io_signature(1,1,gr.sizeof_gr_complex))
-
+ gr.hier_block2.__init__(self, "transmit_path",
+ gr.io_signature(0,0,0),
+ gr.io_signature(1,1,gr.sizeof_gr_complex))
+
options = copy.copy(options) # make a copy so we can destructively modify
self._verbose = options.verbose
@@ -49,10 +52,10 @@ class transmit_path(gr.hier_block2):
# Get mod_kwargs
mod_kwargs = self._modulator_class.extract_kwargs_from_options(options)
-
+
# transmitter
- self.modulator = self._modulator_class(**mod_kwargs)
-
+ self.modulator = self._modulator_class(**mod_kwargs)
+
self.packet_transmitter = \
digital.mod_pkts(self.modulator,
access_code=None,
@@ -72,19 +75,19 @@ class transmit_path(gr.hier_block2):
def set_tx_amplitude(self, ampl):
"""
Sets the transmit amplitude sent to the USRP in volts
-
+
Args:
: ampl 0 <= ampl < 1.
"""
self._tx_amplitude = max(0.0, min(ampl, 1))
self.amp.set_k(self._tx_amplitude)
-
+
def send_pkt(self, payload='', eof=False):
"""
Calls the transmitter method to send a packet
"""
return self.packet_transmitter.send_pkt(payload, eof)
-
+
def bitrate(self):
return self._bitrate
@@ -120,8 +123,8 @@ class transmit_path(gr.hier_block2):
"""
Prints information about the transmit path
"""
- print "Tx amplitude %s" % (self._tx_amplitude)
- print "modulation: %s" % (self._modulator_class.__name__)
- print "bitrate: %sb/s" % (eng_notation.num_to_str(self._bitrate))
- print "samples/symbol: %.4f" % (self.samples_per_symbol())
- print "Differential: %s" % (self.differential())
+ print("Tx amplitude %s" % (self._tx_amplitude))
+ print("modulation: %s" % (self._modulator_class.__name__))
+ print("bitrate: %sb/s" % (eng_notation.num_to_str(self._bitrate)))
+ print("samples/symbol: %.4f" % (self.samples_per_symbol()))
+ print("Differential: %s" % (self.differential()))
diff --git a/gr-digital/examples/narrowband/tunnel.py b/gr-digital/examples/narrowband/tunnel.py
index 7b9b69cc8..da00baa90 100755..100644
--- a/gr-digital/examples/narrowband/tunnel.py
+++ b/gr-digital/examples/narrowband/tunnel.py
@@ -1,24 +1,28 @@
#!/usr/bin/env python
#
# Copyright 2005,2006,2009,2011 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
# ////////////////////////////////////////////////////////////////////
@@ -49,7 +53,7 @@ from uhd_interface import uhd_receiver
import os, sys
import random, time, struct
-#print os.getpid()
+#print(os.getpid())
#raw_input('Attach and press enter')
# ////////////////////////////////////////////////////////////////////
@@ -71,7 +75,7 @@ IFF_ONE_QUEUE = 0x2000 # beats me ;)
def open_tun_interface(tun_device_filename):
from fcntl import ioctl
-
+
mode = IFF_TAP | IFF_NO_PI
TUNSETIFF = 0x400454ca
@@ -79,7 +83,7 @@ def open_tun_interface(tun_device_filename):
ifs = ioctl(tun, TUNSETIFF, struct.pack("16sH", "gr%d", mode))
ifname = ifs[:16].strip("\x00")
return (tun, ifname)
-
+
# ////////////////////////////////////////////////////////////////////
# the flow graph
@@ -94,20 +98,20 @@ class my_top_block(gr.top_block):
# Get the modulation's bits_per_symbol
args = mod_class.extract_kwargs_from_options(options)
- symbol_rate = options.bitrate / mod_class(**args).bits_per_symbol()
+ symbol_rate = options.bitrate / mod_class(**args.bits_per_symbol())
self.source = uhd_receiver(options.args, symbol_rate,
options.samples_per_symbol,
options.rx_freq, options.rx_gain,
options.spec, options.antenna,
options.verbose)
-
+
self.sink = uhd_transmitter(options.args, symbol_rate,
options.samples_per_symbol,
options.tx_freq, options.tx_gain,
options.spec, options.antenna,
options.verbose)
-
+
options.samples_per_symbol = self.source._sps
self.txpath = transmit_path(mod_class, options)
@@ -131,7 +135,7 @@ class my_top_block(gr.top_block):
self.sink.set_freq(target_freq)
self.source.set_freq(target_freq)
-
+
# ////////////////////////////////////////////////////////////////////
# Carrier Sense MAC
@@ -166,7 +170,7 @@ class cs_mac(object):
payload: contents of the packet (string)
"""
if self.verbose:
- print "Rx: ok = %r len(payload) = %4d" % (ok, len(payload))
+ print("Rx: ok = %r len(payload) = %4d" % (ok, len(payload)))
if ok:
os.write(self.tun_fd, payload)
@@ -186,7 +190,7 @@ class cs_mac(object):
break
if self.verbose:
- print "Tx: len(payload) = %4d" % (len(payload),)
+ print("Tx: len(payload) = %4d" % (len(payload),))
delay = min_delay
while self.tb.carrier_sensed():
@@ -209,10 +213,10 @@ def main():
parser = OptionParser (option_class=eng_option, conflict_handler="resolve")
expert_grp = parser.add_option_group("Expert")
- parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(),
+ parser.add_option("-m", "--modulation", type="choice", choices=list(mods.keys()),
default='gmsk',
help="Select modulation from: %s [default=%%default]"
- % (', '.join(mods.keys()),))
+ % (', '.join(list(mods.keys())),))
parser.add_option("-s", "--size", type="eng_float", default=1500,
help="set packet size [default=%default]")
@@ -227,10 +231,10 @@ def main():
uhd_receiver.add_options(parser)
uhd_transmitter.add_options(parser)
- for mod in mods.values():
+ for mod in list(mods.values()):
mod.add_options(expert_grp)
- for demod in demods.values():
+ for demod in list(demods.values()):
demod.add_options(expert_grp)
(options, args) = parser.parse_args ()
@@ -247,7 +251,7 @@ def main():
realtime = True
else:
realtime = False
- print "Note: failed to enable realtime scheduling"
+ print("Note: failed to enable realtime scheduling")
# instantiate the MAC
mac = cs_mac(tun_fd, verbose=True)
@@ -261,26 +265,26 @@ def main():
mac.set_top_block(tb) # give the MAC a handle for the PHY
if tb.txpath.bitrate() != tb.rxpath.bitrate():
- print "WARNING: Transmit bitrate = %sb/sec, Receive bitrate = %sb/sec" % (
+ print("WARNING: Transmit bitrate = %sb/sec, Receive bitrate = %sb/sec" % (
eng_notation.num_to_str(tb.txpath.bitrate()),
- eng_notation.num_to_str(tb.rxpath.bitrate()))
-
- print "modulation: %s" % (options.modulation,)
- print "freq: %s" % (eng_notation.num_to_str(options.tx_freq))
- print "bitrate: %sb/sec" % (eng_notation.num_to_str(tb.txpath.bitrate()),)
- print "samples/symbol: %3d" % (tb.txpath.samples_per_symbol(),)
+ eng_notation.num_to_str(tb.rxpath.bitrate())))
+
+ print("modulation: %s" % (options.modulation,))
+ print("freq: %s" % (eng_notation.num_to_str(options.tx_freq)))
+ print("bitrate: %sb/sec" % (eng_notation.num_to_str(tb.txpath.bitrate()),))
+ print("samples/symbol: %3d" % (tb.txpath.samples_per_symbol(),))
tb.rxpath.set_carrier_threshold(options.carrier_threshold)
- print "Carrier sense threshold:", options.carrier_threshold, "dB"
-
- print
- print "Allocated virtual ethernet interface: %s" % (tun_ifname,)
- print "You must now use ifconfig to set its IP address. E.g.,"
- print
- print " $ sudo ifconfig %s 192.168.200.1" % (tun_ifname,)
- print
- print "Be sure to use a different address in the same subnet for each machine."
- print
+ print("Carrier sense threshold:", options.carrier_threshold, "dB")
+
+ print()
+ print("Allocated virtual ethernet interface: %s" % (tun_ifname,))
+ print("You must now use ifconfig to set its IP address. E.g.,")
+ print()
+ print(" $ sudo ifconfig %s 192.168.200.1" % (tun_ifname,))
+ print()
+ print("Be sure to use a different address in the same subnet for each machine.")
+ print()
tb.start() # Start executing the flow graph (runs in separate threads)
@@ -289,7 +293,7 @@ def main():
tb.stop() # but if it does, tell flow graph to stop.
tb.wait() # wait for it to finish
-
+
if __name__ == '__main__':
try:
diff --git a/gr-digital/examples/narrowband/tx_voice.py b/gr-digital/examples/narrowband/tx_voice.py
index afdb4406e..e65df64d2 100755..100644
--- a/gr-digital/examples/narrowband/tx_voice.py
+++ b/gr-digital/examples/narrowband/tx_voice.py
@@ -1,24 +1,28 @@
#!/usr/bin/env python
#
# Copyright 2005-2007,2009,2011,2013 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr, audio, uhd
from gnuradio import eng_notation
@@ -40,15 +44,15 @@ from transmit_path import transmit_path
from uhd_interface import uhd_transmitter
#import os
-#print os.getpid()
+#print(os.getpid())
#raw_input('Attach and press enter')
class audio_rx(gr.hier_block2):
def __init__(self, audio_input_dev):
- gr.hier_block2.__init__(self, "audio_rx",
- gr.io_signature(0, 0, 0), # Input signature
- gr.io_signature(0, 0, 0)) # Output signature
+ gr.hier_block2.__init__(self, "audio_rx",
+ gr.io_signature(0, 0, 0), # Input signature
+ gr.io_signature(0, 0, 0)) # Output signature
self.sample_rate = sample_rate = 8000
src = audio.source(sample_rate, audio_input_dev)
src_scale = blocks.multiply_const_ff(32767)
@@ -60,7 +64,7 @@ class audio_rx(gr.hier_block2):
def get_encoded_voice_packet(self):
return self.packets_from_encoder.delete_head()
-
+
class my_top_block(gr.top_block):
@@ -78,7 +82,7 @@ class my_top_block(gr.top_block):
audio_rate = self.audio_rx.sample_rate
usrp_rate = self.sink.get_sample_rate()
rrate = usrp_rate / audio_rate
-
+
elif(options.to_file is not None):
self.sink = blocks.file_sink(gr.sizeof_gr_complex, options.to_file)
rrate = 1
@@ -87,10 +91,10 @@ class my_top_block(gr.top_block):
rrate = 1
self.resampler = filter.pfb.arb_resampler_ccf(rrate)
-
- self.connect(self.audio_rx)
- self.connect(self.txpath, self.resampler, self.sink)
-
+
+ self.connect(self.audio_rx)
+ self.connect(self.txpath, self.resampler, self.sink)
+
# /////////////////////////////////////////////////////////////////////////////
# main
@@ -102,17 +106,17 @@ def main():
return tb.txpath.send_pkt(payload, eof)
def rx_callback(ok, payload):
- print "ok = %r, payload = '%s'" % (ok, payload)
+ print("ok = %r, payload = '%s'" % (ok, payload))
mods = digital.modulation_utils.type_1_mods()
parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
expert_grp = parser.add_option_group("Expert")
- parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(),
+ parser.add_option("-m", "--modulation", type="choice", choices=list(mods.keys()),
default='gmsk',
help="Select modulation from: %s [default=%%default]"
- % (', '.join(mods.keys()),))
+ % (', '.join(list(mods.keys())),))
parser.add_option("-M", "--megabytes", type="eng_float", default=0,
help="set megabytes to transmit [default=inf]")
parser.add_option("-I", "--audio-input", type="string", default="",
@@ -123,7 +127,7 @@ def main():
transmit_path.add_options(parser, expert_grp)
uhd_transmitter.add_options(parser)
- for mod in mods.values():
+ for mod in list(mods.values()):
mod.add_options(expert_grp)
parser.set_defaults(bitrate=50e3) # override default bitrate default
@@ -144,7 +148,7 @@ def main():
r = gr.enable_realtime_scheduling()
if r != gr.RT_OK:
- print "Warning: failed to enable realtime scheduling"
+ print("Warning: failed to enable realtime scheduling")
tb.start() # start flow graph
@@ -161,7 +165,7 @@ def main():
n += len(s)
sys.stderr.write('.')
pktno += 1
-
+
send_pkt(eof=True)
tb.wait() # wait for it to finish
@@ -170,4 +174,4 @@ if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
- pass
+ pass
diff --git a/gr-digital/examples/narrowband/uhd_interface.py b/gr-digital/examples/narrowband/uhd_interface.py
index e7c7fe3af..1da2bbb1b 100644
--- a/gr-digital/examples/narrowband/uhd_interface.py
+++ b/gr-digital/examples/narrowband/uhd_interface.py
@@ -1,24 +1,28 @@
#!/usr/bin/env python
#
# Copyright 2010,2011 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr, uhd
from gnuradio import eng_notation
@@ -41,10 +45,10 @@ def add_freq_option(parser):
help="set Tx and/or Rx frequency to FREQ [default=%default]",
metavar="FREQ")
-class uhd_interface:
+class uhd_interface(object):
def __init__(self, istx, args, sym_rate, sps, freq=None, lo_offset=None,
gain=None, spec=None, antenna=None, clock_source=None):
-
+
if(istx):
self.u = uhd.usrp_sink(device_addr=args, stream_args=uhd.stream_args('fc32'))
else:
@@ -61,15 +65,15 @@ class uhd_interface:
# Set the antenna
if(antenna):
self.u.set_antenna(antenna, 0)
-
+
self._args = args
self._ant = antenna
self._spec = spec
self._gain = self.set_gain(gain)
- self._lo_offset = lo_offset
- self._freq = self.set_freq(freq, lo_offset)
+ self._lo_offset = lo_offset
+ self._freq = self.set_freq(freq, lo_offset)
self._rate, self._sps = self.set_sample_rate(sym_rate, sps)
- self._clock_source = clock_source
+ self._clock_source = clock_source
def set_sample_rate(self, sym_rate, req_sps):
start_sps = req_sps
@@ -78,37 +82,37 @@ class uhd_interface:
self.u.set_samp_rate(asked_samp_rate)
actual_samp_rate = self.u.get_samp_rate()
- sps = actual_samp_rate/sym_rate
+ sps = actual_samp_rate / sym_rate
if(sps < 2):
req_sps +=1
else:
actual_sps = sps
break
-
+
if(sps != req_sps):
- print "\nSymbol Rate: %f" % (sym_rate)
- print "Requested sps: %f" % (start_sps)
- print "Given sample rate: %f" % (actual_samp_rate)
- print "Actual sps for rate: %f" % (actual_sps)
+ print("\nSymbol Rate: %f" % (sym_rate))
+ print("Requested sps: %f" % (start_sps))
+ print("Given sample rate: %f" % (actual_samp_rate))
+ print("Actual sps for rate: %f" % (actual_sps))
if(actual_samp_rate != asked_samp_rate):
- print "\nRequested sample rate: %f" % (asked_samp_rate)
- print "Actual sample rate: %f" % (actual_samp_rate)
+ print("\nRequested sample rate: %f" % (asked_samp_rate))
+ print("Actual sample rate: %f" % (actual_samp_rate))
return (actual_samp_rate, actual_sps)
def get_sample_rate(self):
return self.u.get_samp_rate()
-
+
def set_gain(self, gain=None):
if gain is None:
# if no gain was specified, use the mid-point in dB
g = self.u.get_gain_range()
- gain = float(g.start()+g.stop())/2
- print "\nNo gain specified."
- print "Setting gain to %f (from [%f, %f])" % \
- (gain, g.start(), g.stop())
-
+ gain = float(g.start()+g.stop()) / 2
+ print("\nNo gain specified.")
+ print("Setting gain to %f (from [%f, %f])" %
+ (gain, g.start(), g.stop()))
+
self.u.set_gain(gain, 0)
return gain
@@ -116,7 +120,7 @@ class uhd_interface:
if(freq is None):
sys.stderr.write("You must specify -f FREQ or --freq FREQ\n")
sys.exit(1)
-
+
r = self.u.set_center_freq(uhd.tune_request(freq, lo_offset))
if r:
return freq
@@ -163,22 +167,22 @@ class uhd_transmitter(uhd_interface, gr.hier_block2):
parser.add_option("", "--tx-gain", type="eng_float", default=None,
help="set transmit gain in dB (default is midpoint)")
parser.add_option("-C", "--clock-source", type="string", default=None,
- help="select clock source (e.g. 'external') [default=%default]")
+ help="select clock source (e.g. 'external') [default=%default]")
parser.add_option("-v", "--verbose", action="store_true", default=False)
def _print_verbage(self):
"""
Prints information about the UHD transmitter
"""
- print "\nUHD Transmitter:"
- print "Args: %s" % (self._args)
- print "Freq: %sHz" % (eng_notation.num_to_str(self._freq))
- print "LO Offset: %sHz" % (eng_notation.num_to_str(self._lo_offset))
- print "Gain: %f dB" % (self._gain)
- print "Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate))
- print "Antenna: %s" % (self._ant)
- print "Subdev Spec: %s" % (self._spec)
- print "Clock Source: %s" % (self._clock_source)
+ print("\nUHD Transmitter:")
+ print("Args: %s" % (self._args))
+ print("Freq: %sHz" % (eng_notation.num_to_str(self._freq)))
+ print("LO Offset: %sHz" % (eng_notation.num_to_str(self._lo_offset)) )
+ print("Gain: %f dB" % (self._gain))
+ print("Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate)))
+ print("Antenna: %s" % (self._ant))
+ print("Subdev Spec: %s" % (self._spec))
+ print("Clock Source: %s" % (self._clock_source))
#-------------------------------------------------------------------#
# RECEIVER
@@ -191,7 +195,7 @@ class uhd_receiver(uhd_interface, gr.hier_block2):
gr.hier_block2.__init__(self, "uhd_receiver",
gr.io_signature(0,0,0),
gr.io_signature(1,1,gr.sizeof_gr_complex))
-
+
# Set up the UHD interface as a receiver
uhd_interface.__init__(self, False, args, sym_rate, sps,
freq, lo_offset, gain, spec, antenna, clock_source)
@@ -214,11 +218,11 @@ class uhd_receiver(uhd_interface, gr.hier_block2):
help="set receive frequency to FREQ [default=%default]",
metavar="FREQ")
parser.add_option("", "--lo-offset", type="eng_float", default=0,
- help="set local oscillator offset in Hz (default is 0)")
+ help="set local oscillator offset in Hz (default is 0)")
parser.add_option("", "--rx-gain", type="eng_float", default=None,
help="set receive gain in dB (default is midpoint)")
parser.add_option("-C", "--clock-source", type="string", default=None,
- help="select clock source (e.g. 'external') [default=%default]")
+ help="select clock source (e.g. 'external') [default=%default]")
if not parser.has_option("--verbose"):
parser.add_option("-v", "--verbose", action="store_true", default=False)
@@ -226,13 +230,13 @@ class uhd_receiver(uhd_interface, gr.hier_block2):
"""
Prints information about the UHD transmitter
"""
- print "\nUHD Receiver:"
- print "UHD Args: %s" % (self._args)
- print "Freq: %sHz" % (eng_notation.num_to_str(self._freq))
- print "LO Offset: %sHz" % (eng_notation.num_to_str(self._lo_offset))
- print "Gain: %f dB" % (self._gain)
- print "Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate))
- print "Antenna: %s" % (self._ant)
- print "Spec: %s" % (self._spec)
- print "Clock Source: %s" % (self._clock_source)
+ print("\nUHD Receiver:")
+ print("UHD Args: %s" % (self._args))
+ print("Freq: %sHz" % (eng_notation.num_to_str(self._freq)))
+ print("LO Offset: %sHz" % (eng_notation.num_to_str(self._lo_offset)) )
+ print("Gain: %f dB" % (self._gain))
+ print("Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate)))
+ print("Antenna: %s" % (self._ant))
+ print("Spec: %s" % (self._spec))
+ print("Clock Source: %s" % (self._clock_source))
diff --git a/gr-digital/examples/ofdm/benchmark_add_channel.py b/gr-digital/examples/ofdm/benchmark_add_channel.py
index 0ac46985a..6fc7056df 100755..100644
--- a/gr-digital/examples/ofdm/benchmark_add_channel.py
+++ b/gr-digital/examples/ofdm/benchmark_add_channel.py
@@ -1,24 +1,28 @@
#!/usr/bin/env python
#
# Copyright 2010,2011 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr, channels
from gnuradio import blocks
@@ -32,15 +36,15 @@ class my_top_block(gr.top_block):
def __init__(self, ifile, ofile, options):
gr.top_block.__init__(self)
- SNR = 10.0**(options.snr/10.0)
+ SNR = 10.0**(options.snr / 10.0)
time_offset = options.time_offset
- phase_offset = options.phase_offset*(math.pi/180.0)
+ phase_offset = options.phase_offset*(math.pi / 180.0)
# calculate noise voltage from SNR
power_in_signal = abs(options.tx_amplitude)**2
- noise_power = power_in_signal/SNR
+ noise_power = power_in_signal / SNR
noise_voltage = math.sqrt(noise_power)
- print "Noise voltage: ", noise_voltage
+ print("Noise voltage: ", noise_voltage)
frequency_offset = options.frequency_offset / options.fft_length
@@ -54,7 +58,7 @@ class my_top_block(gr.top_block):
self.snk = blocks.file_sink(gr.sizeof_gr_complex, ofile)
self.connect(self.src, self.channel, self.phase, self.snk)
-
+
# /////////////////////////////////////////////////////////////////////////////
# main
@@ -94,13 +98,13 @@ def main():
ifile = args[0]
ofile = args[1]
-
+
# build the graph
tb = my_top_block(ifile, ofile, options)
r = gr.enable_realtime_scheduling()
if r != gr.RT_OK:
- print "Warning: Failed to enable realtime scheduling."
+ print("Warning: Failed to enable realtime scheduling.")
tb.start() # start flow graph
tb.wait() # wait for it to finish
diff --git a/gr-digital/examples/ofdm/receive_path.py b/gr-digital/examples/ofdm/receive_path.py
index 0cb4479a2..b9abe8ceb 100644
--- a/gr-digital/examples/ofdm/receive_path.py
+++ b/gr-digital/examples/ofdm/receive_path.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
#
# Copyright 2005,2006,2011 Free Software Foundation, Inc.
#
diff --git a/gr-digital/examples/ofdm/transmit_path.py b/gr-digital/examples/ofdm/transmit_path.py
index 98a81f3c1..17adffab4 100644
--- a/gr-digital/examples/ofdm/transmit_path.py
+++ b/gr-digital/examples/ofdm/transmit_path.py
@@ -1,23 +1,26 @@
#
# Copyright 2005,2006,2011 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import eng_notation
@@ -31,15 +34,15 @@ import sys
# transmit path
# /////////////////////////////////////////////////////////////////////////////
-class transmit_path(gr.hier_block2):
+class transmit_path(gr.hier_block2):
def __init__(self, options):
'''
See below for what options should hold
'''
- gr.hier_block2.__init__(self, "transmit_path",
- gr.io_signature(0, 0, 0),
- gr.io_signature(1, 1, gr.sizeof_gr_complex))
+ gr.hier_block2.__init__(self, "transmit_path",
+ gr.io_signature(0, 0, 0),
+ gr.io_signature(1, 1, gr.sizeof_gr_complex))
options = copy.copy(options) # make a copy so we can destructively modify
@@ -63,13 +66,13 @@ class transmit_path(gr.hier_block2):
def set_tx_amplitude(self, ampl):
"""
Sets the transmit amplitude sent to the USRP
-
+
Args:
: ampl 0 <= ampl < 1.0. Try 0.10
"""
self._tx_amplitude = max(0.0, min(ampl, 1))
self.amp.set_k(self._tx_amplitude)
-
+
def send_pkt(self, payload='', eof=False):
"""
Calls the transmitter method to send a packet
@@ -97,5 +100,5 @@ class transmit_path(gr.hier_block2):
"""
Prints information about the transmit path
"""
- print "Tx amplitude %s" % (self._tx_amplitude)
-
+ print("Tx amplitude %s" % (self._tx_amplitude))
+
diff --git a/gr-digital/examples/ofdm/uhd_interface.py b/gr-digital/examples/ofdm/uhd_interface.py
index ac34d956a..df5be60f3 100644
--- a/gr-digital/examples/ofdm/uhd_interface.py
+++ b/gr-digital/examples/ofdm/uhd_interface.py
@@ -1,24 +1,28 @@
#!/usr/bin/env python
#
# Copyright 2010,2011 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr, uhd
from gnuradio import eng_notation
@@ -41,17 +45,17 @@ def add_freq_option(parser):
help="set Tx and/or Rx frequency to FREQ [default=%default]",
metavar="FREQ")
-class uhd_interface:
+class uhd_interface(object):
def __init__(self, istx, args, bandwidth, freq=None, lo_offset=None,
gain=None, spec=None, antenna=None, clock_source=None):
-
+
if(istx):
self.u = uhd.usrp_sink(device_addr=args, stream_args=uhd.stream_args('fc32'))
else:
self.u = uhd.usrp_source(device_addr=args, stream_args=uhd.stream_args('fc32'))
# Set clock source to external.
- if(clock_source):
+ if(clock_source):
self.u.set_clock_source(clock_source, 0)
# Set the subdevice spec
@@ -61,7 +65,7 @@ class uhd_interface:
# Set the antenna
if(antenna):
self.u.set_antenna(antenna, 0)
-
+
self._args = args
self._ant = antenna
self._spec = spec
@@ -74,21 +78,21 @@ class uhd_interface:
def set_sample_rate(self, bandwidth):
self.u.set_samp_rate(bandwidth)
actual_bw = self.u.get_samp_rate()
-
+
return actual_bw
def get_sample_rate(self):
return self.u.get_samp_rate()
-
+
def set_gain(self, gain=None):
if gain is None:
# if no gain was specified, use the mid-point in dB
g = self.u.get_gain_range()
- gain = float(g.start()+g.stop())/2
- print "\nNo gain specified."
- print "Setting gain to %f (from [%f, %f])" % \
- (gain, g.start(), g.stop())
-
+ gain = float(g.start()+g.stop()) / 2
+ print("\nNo gain specified.")
+ print("Setting gain to %f (from [%f, %f])" %
+ (gain, g.start(), g.stop()))
+
self.u.set_gain(gain, 0)
return gain
@@ -96,7 +100,7 @@ class uhd_interface:
if(freq is None):
sys.stderr.write("You must specify -f FREQ or --freq FREQ\n")
sys.exit(1)
-
+
r = self.u.set_center_freq(uhd.tune_request(freq, lo_offset))
if r:
@@ -151,15 +155,15 @@ class uhd_transmitter(uhd_interface, gr.hier_block2):
"""
Prints information about the UHD transmitter
"""
- print "\nUHD Transmitter:"
- print "UHD Args: %s" % (self._args)
- print "Freq: %sHz" % (eng_notation.num_to_str(self._freq))
- print "LO Offset: %sHz" % (eng_notation.num_to_str(self._lo_offset))
- print "Gain: %f dB" % (self._gain)
- print "Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate))
- print "Antenna: %s" % (self._ant)
- print "Subdev Sec: %s" % (self._spec)
- print "Clock Source: %s" % (self._clock_source)
+ print("\nUHD Transmitter:")
+ print("UHD Args: %s" % (self._args))
+ print("Freq: %sHz" % (eng_notation.num_to_str(self._freq)))
+ print("LO Offset: %sHz" % (eng_notation.num_to_str(self._lo_offset)))
+ print("Gain: %f dB" % (self._gain))
+ print("Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate)))
+ print("Antenna: %s" % (self._ant))
+ print("Subdev Sec: %s" % (self._spec))
+ print("Clock Source: %s" % (self._clock_source))
@@ -174,7 +178,7 @@ class uhd_receiver(uhd_interface, gr.hier_block2):
gr.hier_block2.__init__(self, "uhd_receiver",
gr.io_signature(0,0,0),
gr.io_signature(1,1,gr.sizeof_gr_complex))
-
+
# Set up the UHD interface as a receiver
uhd_interface.__init__(self, False, args, bandwidth,
freq, lo_offset, gain, spec, antenna, clock_source)
@@ -209,13 +213,13 @@ class uhd_receiver(uhd_interface, gr.hier_block2):
"""
Prints information about the UHD transmitter
"""
- print "\nUHD Receiver:"
- print "UHD Args: %s" % (self._args)
- print "Freq: %sHz" % (eng_notation.num_to_str(self._freq))
- print "LO Offset: %sHz" % (eng_notation.num_to_str(self._lo_offset))
- print "Gain: %f dB" % (self._gain)
- print "Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate))
- print "Antenna: %s" % (self._ant)
- print "Subdev Sec: %s" % (self._spec)
- print "Clock Source: %s" % (self._clock_source)
+ print("\nUHD Receiver:")
+ print("UHD Args: %s" % (self._args))
+ print("Freq: %sHz" % (eng_notation.num_to_str(self._freq)))
+ print("LO Offset: %sHz" % (eng_notation.num_to_str(self._lo_offset)))
+ print("Gain: %f dB" % (self._gain))
+ print("Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate)))
+ print("Antenna: %s" % (self._ant))
+ print("Subdev Sec: %s" % (self._spec))
+ print("Clock Source: %s" % (self._clock_source))
diff --git a/gr-digital/examples/run_length.py b/gr-digital/examples/run_length.py
index 5020655db..a122a2b8e 100755..100644
--- a/gr-digital/examples/run_length.py
+++ b/gr-digital/examples/run_length.py
@@ -1,24 +1,27 @@
#!/usr/bin/env python
#
# Copyright 2007 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import unicode_literals
from optparse import OptionParser
import sys
@@ -30,9 +33,9 @@ def main():
(options, args) = parser.parse_args()
if options.file == None:
- print "Must specify file to read from using '-f'."
+ print("Must specify file to read from using '-f'.")
sys.exit(1)
- print "Using", options.file, "for data."
+ print("Using", options.file, "for data.")
f = open(options.file, 'r')
runs = []
@@ -40,7 +43,7 @@ def main():
current = 0
bytes = 0
bits = 0
-
+
for ch in f.read():
x = ord(ch)
bytes = bytes + 1
@@ -66,18 +69,16 @@ def main():
runs[count-1] = runs[count-1] + 1
chk = 0
- print "Bytes read: ", bytes
- print "Bits read: ", bits
- print
+ print("Bytes read: ", bytes)
+ print("Bits read: ", bits)
+ print()
for i in range(len(runs)):
chk = chk + runs[i]*(i+1)
- print "Runs of length", i+1, ":", runs[i]
- print
- print "Sum of runs:", chk, "bits"
- print
- print "Maximum run length is", len(runs), "bits"
+ print("Runs of length", i+1, ":", runs[i])
+ print()
+ print("Sum of runs:", chk, "bits")
+ print()
+ print("Maximum run length is", len(runs), "bits")
if __name__ == "__main__":
main()
-
-
diff --git a/gr-digital/examples/snr_estimators.py b/gr-digital/examples/snr_estimators.py
index 31efe6b83..b1decd84d 100755..100644
--- a/gr-digital/examples/snr_estimators.py
+++ b/gr-digital/examples/snr_estimators.py
@@ -20,19 +20,23 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
import sys
try:
import scipy
from scipy import stats
except ImportError:
- print "Error: Program requires scipy (www.scipy.org)."
+ print("Error: Program requires scipy (www.scipy.org).")
sys.exit(1)
try:
import pylab
except ImportError:
- print "Error: Program requires Matplotlib (matplotlib.sourceforge.net)."
+ print("Error: Program requires Matplotlib (matplotlib.sourceforge.net).")
sys.exit(1)
from gnuradio import gr, digital, filter
@@ -55,7 +59,7 @@ def online_skewness(data):
M2 = 0
M3 = 0
- for n in xrange(len(data)):
+ for n in range(len(data)):
delta = data[n] - mean
delta_n = delta / (n+1)
term1 = delta * delta_n * n
@@ -63,12 +67,12 @@ def online_skewness(data):
M3 = M3 + term1 * delta_n * (n - 1) - 3 * delta_n * M2
M2 = M2 + term1
- return scipy.sqrt(len(data))*M3 / scipy.power(M2, 3.0/2.0);
+ return scipy.sqrt(len(data))*M3 / scipy.power(M2, 3.0 / 2.0);
def snr_est_simple(signal):
s = scipy.mean(abs(signal)**2)
n = 2*scipy.var(abs(signal))
- snr_rat = s/n
+ snr_rat = s / n
return 10.0*scipy.log10(snr_rat), snr_rat
def snr_est_skew(signal):
@@ -94,11 +98,11 @@ def snr_est_svr(signal):
N = len(signal)
ssum = 0
msum = 0
- for i in xrange(1, N):
+ for i in range(1, N):
ssum += (abs(signal[i])**2)*(abs(signal[i-1])**2)
msum += (abs(signal[i])**4)
- savg = (1.0/(float(N)-1.0))*ssum
- mavg = (1.0/(float(N)-1.0))*msum
+ savg = (1.0 / (float(N-1.0)))*ssum
+ mavg = (1.0 / (float(N-1.0)))*msum
beta = savg / (mavg - savg)
snr_rat = ((beta - 1) + scipy.sqrt(beta*(beta-1)))
@@ -126,9 +130,9 @@ def main():
parser.add_option("", "--snr-step", type="float", default=0.5,
help="SNR step amount [default=%default]")
parser.add_option("-t", "--type", type="choice",
- choices=gr_estimators.keys(), default="simple",
+ choices=list(gr_estimators.keys()), default="simple",
help="Estimator type {0} [default=%default]".format(
- gr_estimators.keys()))
+ list(gr_estimators.keys())))
(options, args) = parser.parse_args ()
N = options.nsamples
@@ -155,14 +159,14 @@ def main():
SNR_step = options.snr_step
SNR_dB = scipy.arange(SNR_min, SNR_max+SNR_step, SNR_step)
for snr in SNR_dB:
- SNR = 10.0**(snr/10.0)
+ SNR = 10.0**(snr / 10.0)
scale = scipy.sqrt(2*SNR)
- yy = bits + n_cpx/scale
- print "SNR: ", snr
+ yy = bits + n_cpx / scale
+ print("SNR: ", snr)
Sknown = scipy.mean(yy**2)
- Nknown = scipy.var(n_cpx/scale)
- snr0 = Sknown/Nknown
+ Nknown = scipy.var(n_cpx / scale)
+ snr0 = Sknown / Nknown
snr0dB = 10.0*scipy.log10(snr0)
snr_known.append(float(snr0dB))
@@ -171,7 +175,7 @@ def main():
gr_src = blocks.vector_source_c(bits.tolist(), False)
gr_snr = digital.mpsk_snr_est_cc(gr_est, ntag, 0.001)
- gr_chn = channels.channel_model(1.0/scale)
+ gr_chn = channels.channel_model(1.0 / scale)
gr_snk = blocks.null_sink(gr.sizeof_gr_complex)
tb = gr.top_block()
tb.connect(gr_src, gr_chn, gr_snr, gr_snk)
diff --git a/gr-digital/grc/CMakeLists.txt b/gr-digital/grc/CMakeLists.txt
index a3d022329..78c826152 100644
--- a/gr-digital/grc/CMakeLists.txt
+++ b/gr-digital/grc/CMakeLists.txt
@@ -17,7 +17,7 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-file(GLOB xml_files "*.xml")
-install(FILES ${xml_files}
+file(GLOB yml_files "*.yml")
+install(FILES ${yml_files}
DESTINATION ${GRC_BLOCKS_DIR}
)
diff --git a/gr-digital/grc/digital.tree.yml b/gr-digital/grc/digital.tree.yml
new file mode 100644
index 000000000..0e4c2463e
--- /dev/null
+++ b/gr-digital/grc/digital.tree.yml
@@ -0,0 +1,85 @@
+'[Core]':
+- Coding:
+ - digital_additive_scrambler_bb
+ - digital_descrambler_bb
+ - digital_scrambler_bb
+- Equalizers:
+ - digital_cma_equalizer_cc
+ - digital_lms_dd_equalizer_cc
+ - digital_kurtotic_equalizer_cc
+- Measurement Tools:
+ - digital_mpsk_snr_est_cc
+ - digital_probe_density_b
+ - digital_probe_mpsk_snr_est_c
+- Modulators:
+ - digital_cpmmod_bc
+ - digital_gfsk_mod
+ - digital_gfsk_demod
+ - digital_gmskmod_bc
+ - digital_gmsk_mod
+ - digital_gmsk_demod
+ - digital_constellation_modulator
+ - digital_constellation_receiver_cb
+ - variable_constellation
+ - variable_constellation_rect
+ - variable_modulate_vector
+- Packet Operators:
+ - digital_correlate_access_code_tag_bb
+ - digital_correlate_access_code_xx_ts
+ - digital_crc32_bb
+ - digital_crc32_async_bb
+ - digital_framer_sink_1
+ - variable_header_format_default
+ - digital_protocol_formatter_async
+ - digital_protocol_formatter_bb
+ - digital_protocol_parser_b
+ - digital_header_payload_demux
+ - digital_packet_headergenerator_bb
+ - digital_packet_headergenerator_bb_default
+ - digital_packet_headerparser_b
+ - digital_packet_headerparser_b_default
+ - digital_packet_sink
+ - digital_hdlc_framer_pb
+ - digital_hdlc_deframer_bp
+ - digital_simple_framer
+ - digital_simple_correlator
+- OFDM:
+ - digital_ofdm_mod
+ - digital_ofdm_demod
+ - digital_ofdm_carrier_allocator_cvc
+ - digital_ofdm_chanest_vcvc
+ - digital_ofdm_cyclic_prefixer
+ - digital_ofdm_frame_acquisition
+ - digital_ofdm_frame_equalizer_vcvc
+ - digital_ofdm_frame_sink
+ - digital_ofdm_insert_preamble
+ - digital_ofdm_rx
+ - digital_ofdm_sampler
+ - digital_ofdm_serializer_vcc
+ - digital_ofdm_sync_pn
+ - digital_ofdm_sync_sc_cfb
+ - digital_ofdm_tx
+- Symbol Coding:
+ - digital_binary_slicer_fb
+ - digital_chunks_to_symbols_xx
+ - digital_constellation_decoder_cb
+ - digital_constellation_receiver_cb
+ - digital_constellation_soft_decoder_cf
+ - digital_diff_decoder_bb
+ - digital_diff_encoder_bb
+ - digital_diff_phasor_cc
+ - digital_map_bb
+- Synchronizers:
+ - digital_clock_recovery_mm_xx
+ - digital_costas_loop_cc
+ - digital_fll_band_edge_cc
+ - digital_pfb_clock_sync_xxx
+ - digital_pn_correlator_cc
+ - digital_symbol_sync_xx
+ - digital_corr_est_cc
+- Waveform Generators:
+ - digital_glfsr_source_x
+- Deprecated:
+ - digital_correlate_access_code_bb
+ - digital_simple_framer
+ - digital_simple_correlator
diff --git a/gr-digital/grc/digital_additive_scrambler_bb.block.yml b/gr-digital/grc/digital_additive_scrambler_bb.block.yml
new file mode 100644
index 000000000..d447a2822
--- /dev/null
+++ b/gr-digital/grc/digital_additive_scrambler_bb.block.yml
@@ -0,0 +1,43 @@
+id: digital_additive_scrambler_bb
+label: Additive Scrambler
+
+parameters:
+- id: mask
+ label: Mask
+ dtype: hex
+ default: '0x8A'
+- id: seed
+ label: Seed
+ dtype: hex
+ default: '0x7F'
+- id: len
+ label: Length
+ dtype: int
+ default: '7'
+- id: count
+ label: Count
+ dtype: int
+ default: '0'
+- id: bits_per_byte
+ label: Bits per byte
+ dtype: int
+ default: '1'
+- id: reset_tag_key
+ label: Reset tag key
+ dtype: string
+ default: '""'
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.additive_scrambler_bb(${mask}, ${seed}, ${len}, count=${count},
+ bits_per_byte=${bits_per_byte}, reset_tag_key=${reset_tag_key})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_additive_scrambler_bb.xml b/gr-digital/grc/digital_additive_scrambler_bb.xml
deleted file mode 100644
index 2bb06e48a..000000000
--- a/gr-digital/grc/digital_additive_scrambler_bb.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Additive Scrambler
-###################################################
- -->
-<block>
- <name>Additive Scrambler</name>
- <key>digital_additive_scrambler_bb</key>
- <import>from gnuradio import digital</import>
- <make>digital.additive_scrambler_bb($mask, $seed, $len, count=$count, bits_per_byte=$bits_per_byte, reset_tag_key=$reset_tag_key)</make>
- <param>
- <name>Mask</name>
- <key>mask</key>
- <value>0x8A</value>
- <type>hex</type>
- </param>
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>0x7F</value>
- <type>hex</type>
- </param>
- <param>
- <name>Length</name>
- <key>len</key>
- <value>7</value>
- <type>int</type>
- </param>
- <param>
- <name>Count</name>
- <key>count</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Bits per byte</name>
- <key>bits_per_byte</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Reset tag key</name>
- <key>reset_tag_key</key>
- <value>""</value>
- <type>string</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_binary_slicer_fb.block.yml b/gr-digital/grc/digital_binary_slicer_fb.block.yml
new file mode 100644
index 000000000..143c97c0e
--- /dev/null
+++ b/gr-digital/grc/digital_binary_slicer_fb.block.yml
@@ -0,0 +1,16 @@
+id: digital_binary_slicer_fb
+label: Binary Slicer
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.binary_slicer_fb()
+
+file_format: 1
diff --git a/gr-digital/grc/digital_binary_slicer_fb.xml b/gr-digital/grc/digital_binary_slicer_fb.xml
deleted file mode 100644
index 3187d13f9..000000000
--- a/gr-digital/grc/digital_binary_slicer_fb.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Binary Slicer
-###################################################
- -->
-<block>
- <name>Binary Slicer</name>
- <key>digital_binary_slicer_fb</key>
- <import>from gnuradio import digital</import>
- <make>digital.binary_slicer_fb()</make>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_block_tree.xml b/gr-digital/grc/digital_block_tree.xml
deleted file mode 100644
index 10346cbcd..000000000
--- a/gr-digital/grc/digital_block_tree.xml
+++ /dev/null
@@ -1,134 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Copyright (C) 2011-2017 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##Block Tree for GR Digital blocks.
-###################################################
- -->
-<cat>
- <name>[Core]</name>
- <cat>
- <name>Coding</name>
- <block>digital_additive_scrambler_bb</block>
- <block>digital_descrambler_bb</block>
- <block>digital_scrambler_bb</block>
- </cat>
- <cat>
- <name>Equalizers</name>
- <block>digital_cma_equalizer_cc</block>
- <block>digital_lms_dd_equalizer_cc</block>
- <block>digital_kurtotic_equalizer_cc</block>
- </cat>
- <cat>
- <name>Measurement Tools</name>
- <block>digital_mpsk_snr_est_cc</block>
- <block>digital_probe_density_b</block>
- <block>digital_probe_mpsk_snr_est_c</block>
- </cat>
- <cat>
- <name>Modulators</name>
- <block>digital_cpmmod_bc</block>
- <block>digital_gfsk_mod</block>
- <block>digital_gfsk_demod</block>
- <block>digital_gmskmod_bc</block>
- <block>digital_gmsk_mod</block>
- <block>digital_gmsk_demod</block>
- <block>digital_constellation_modulator</block>
- <block>digital_constellation_receiver_cb</block>
- <block>variable_constellation</block>
- <block>variable_constellation_rect</block>
- <block>variable_modulate_vector</block>
- </cat>
- <cat>
- <name>Packet Operators</name>
- <block>digital_correlate_access_code_tag_bb</block>
- <block>digital_correlate_access_code_xx_ts</block>
- <block>digital_crc32_bb</block>
- <block>digital_crc32_async_bb</block>
- <block>digital_framer_sink_1</block>
- <block>variable_header_format_default</block>
- <block>digital_protocol_formatter_async</block>
- <block>digital_protocol_formatter_bb</block>
- <block>digital_protocol_parser_b</block>
- <block>digital_header_payload_demux</block>
- <block>digital_packet_headergenerator_bb</block>
- <block>digital_packet_headergenerator_bb_default</block>
- <block>digital_packet_headerparser_b</block>
- <block>digital_packet_headerparser_b_default</block>
- <block>digital_packet_sink</block>
- <block>digital_hdlc_framer_pb</block>
- <block>digital_hdlc_deframer_bp</block>
- <block>digital_simple_framer</block>
- <block>digital_simple_correlator</block>
- </cat>
- <cat>
- <name>OFDM</name>
- <block>digital_ofdm_mod</block>
- <block>digital_ofdm_demod</block>
- <block>digital_ofdm_carrier_allocator_cvc</block>
- <block>digital_ofdm_chanest_vcvc</block>
- <block>digital_ofdm_cyclic_prefixer</block>
- <block>digital_ofdm_frame_acquisition</block>
- <block>digital_ofdm_frame_equalizer_vcvc</block>
- <block>digital_ofdm_frame_sink</block>
- <block>digital_ofdm_insert_preamble</block>
- <block>digital_ofdm_rx</block>
- <block>digital_ofdm_sampler</block>
- <block>digital_ofdm_serializer_vcc</block>
- <block>digital_ofdm_sync_pn</block>
- <block>digital_ofdm_sync_sc_cfb</block>
- <block>digital_ofdm_tx</block>
- </cat>
- <cat>
- <name>Symbol Coding</name>
- <block>digital_binary_slicer_fb</block>
- <block>digital_chunks_to_symbols_xx</block>
- <block>digital_constellation_decoder_cb</block>
- <block>digital_constellation_receiver_cb</block>
- <block>digital_constellation_soft_decoder_cf</block>
- <block>digital_diff_decoder_bb</block>
- <block>digital_diff_encoder_bb</block>
- <block>digital_diff_phasor_cc</block>
- <block>digital_map_bb</block>
- </cat>
- <cat>
- <name>Synchronizers</name>
- <block>digital_clock_recovery_mm_xx</block>
- <block>digital_costas_loop_cc</block>
- <block>digital_fll_band_edge_cc</block>
- <block>digital_pfb_clock_sync_xxx</block>
- <block>digital_pn_correlator_cc</block>
- <block>digital_symbol_sync_xx</block>
- <block>digital_corr_est_cc</block>
- </cat>
- <cat>
- <name>Waveform Generators</name>
- <block>digital_glfsr_source_x</block>
- </cat>
- <cat>
- <name>Deprecated</name>
- <block>digital_correlate_access_code_bb</block>
- <block>digital_simple_framer</block>
- <block>digital_simple_correlator</block>
- </cat>
-</cat>
diff --git a/gr-digital/grc/digital_burst_shaper.block.yml b/gr-digital/grc/digital_burst_shaper.block.yml
new file mode 100644
index 000000000..a6d7defb4
--- /dev/null
+++ b/gr-digital/grc/digital_burst_shaper.block.yml
@@ -0,0 +1,50 @@
+id: digital_burst_shaper_xx
+label: Burst Shaper
+category: '[Core]/Packet Operators'
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [float, complex]
+ option_attributes:
+ fcn: [ff, cc]
+ taps: [float_vector, complex_vector]
+ hide: part
+- id: window
+ label: Window Taps
+ dtype: ${ type.taps }
+ default: ([])
+- id: pre_padding
+ label: Pre-padding Length
+ dtype: int
+ default: '0'
+- id: post_padding
+ label: Post-padding Length
+ dtype: int
+ default: '0'
+- id: insert_phasing
+ label: Insert phasing symbols
+ dtype: enum
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['No', 'Yes']
+- id: length_tag_name
+ label: Length Tag Name
+ dtype: string
+ default: '"packet_len"'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.burst_shaper_${type.fcn}(${window}, ${pre_padding}, ${post_padding},
+ ${insert_phasing}, ${length_tag_name})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_burst_shaper.xml b/gr-digital/grc/digital_burst_shaper.xml
deleted file mode 100644
index 95e1bcbc7..000000000
--- a/gr-digital/grc/digital_burst_shaper.xml
+++ /dev/null
@@ -1,71 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>Burst Shaper</name>
- <key>digital_burst_shaper_xx</key>
- <category>[Core]/Packet Operators</category>
- <import>from gnuradio import digital</import>
- <make>digital.burst_shaper_$(type.fcn)($window, $pre_padding, $post_padding, $insert_phasing, $length_tag_name)</make>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- <opt>taps:float_vector</opt>
- </option>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- <opt>taps:complex_vector</opt>
- </option>
- </param>
- <param>
- <name>Window Taps</name>
- <key>window</key>
- <value>([])</value>
- <type>$(type.taps)</type>
- </param>
- <param>
- <name>Pre-padding Length</name>
- <key>pre_padding</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Post-padding Length</name>
- <key>post_padding</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Insert phasing symbols</name>
- <key>insert_phasing</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- </param>
- <param>
- <name>Length Tag Name</name>
- <key>length_tag_name</key>
- <value>"packet_len"</value>
- <type>string</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_chunks_to_symbols.block.yml b/gr-digital/grc/digital_chunks_to_symbols.block.yml
new file mode 100644
index 000000000..35b5ee94c
--- /dev/null
+++ b/gr-digital/grc/digital_chunks_to_symbols.block.yml
@@ -0,0 +1,53 @@
+id: digital_chunks_to_symbols_xx
+label: Chunks to Symbols
+
+parameters:
+- id: in_type
+ label: Input Type
+ dtype: enum
+ options: [int, short, byte]
+ option_attributes:
+ fcn: [i, s, b]
+ hide: part
+- id: out_type
+ label: Output Type
+ dtype: enum
+ options: [complex, float]
+ option_attributes:
+ fcn: [c, f]
+ table: [complex_vector, real_vector]
+ hide: part
+- id: symbol_table
+ label: Symbol Table
+ dtype: ${ out_type.table }
+- id: dimension
+ label: Dimension
+ dtype: int
+ default: '2'
+- id: num_ports
+ label: Num Ports
+ dtype: int
+ default: '1'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ in_type }
+ multiplicity: ${ num_ports }
+
+outputs:
+- domain: stream
+ dtype: ${ out_type }
+ multiplicity: ${ num_ports }
+
+asserts:
+- ${ num_ports > 0 }
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.chunks_to_symbols_${in_type.fcn}${out_type.fcn}(${symbol_table},
+ ${dimension})
+ callbacks:
+ - set_symbol_table(${symbol_table})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_chunks_to_symbols.xml b/gr-digital/grc/digital_chunks_to_symbols.xml
deleted file mode 100644
index 9c6f952ec..000000000
--- a/gr-digital/grc/digital_chunks_to_symbols.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Chunks to Symbols
-###################################################
- -->
-<block>
- <name>Chunks to Symbols</name>
- <key>digital_chunks_to_symbols_xx</key>
- <import>from gnuradio import digital</import>
- <make>digital.chunks_to_symbols_$(in_type.fcn)$(out_type.fcn)($symbol_table, $dimension)</make>
- <callback>set_symbol_table($symbol_table)</callback>
- <param>
- <name>Input Type</name>
- <key>in_type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:b</opt>
- </option>
- </param>
- <param>
- <name>Output Type</name>
- <key>out_type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- <opt>table:complex_vector</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- <opt>table:real_vector</opt>
- </option>
- </param>
- <param>
- <name>Symbol Table</name>
- <key>symbol_table</key>
- <type>$out_type.table</type>
- </param>
- <param>
- <name>Dimension</name>
- <key>dimension</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Num Ports</name>
- <key>num_ports</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$num_ports &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$in_type</type>
- <nports>$num_ports</nports>
- </sink>
- <source>
- <name>out</name>
- <type>$out_type</type>
- <nports>$num_ports</nports>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_clock_recovery_mm_xx.block.yml b/gr-digital/grc/digital_clock_recovery_mm_xx.block.yml
new file mode 100644
index 000000000..f4b8a9439
--- /dev/null
+++ b/gr-digital/grc/digital_clock_recovery_mm_xx.block.yml
@@ -0,0 +1,51 @@
+id: digital_clock_recovery_mm_xx
+label: Clock Recovery MM
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float]
+ option_attributes:
+ fcn: [cc, ff]
+ hide: part
+- id: omega
+ label: Omega
+ dtype: real
+ default: samp_per_sym*(1+0.0)
+- id: gain_omega
+ label: Gain Omega
+ dtype: real
+ default: 0.25*0.175*0.175
+- id: mu
+ label: Mu
+ dtype: real
+ default: '0.5'
+- id: gain_mu
+ label: Gain Mu
+ dtype: real
+ default: '0.175'
+- id: omega_relative_limit
+ label: Omega Relative Limit
+ dtype: real
+ default: '0.005'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.clock_recovery_mm_${type.fcn}(${omega}, ${gain_omega}, ${mu}, ${gain_mu},
+ ${omega_relative_limit})
+ callbacks:
+ - set_omega(${omega})
+ - set_gain_omega(${gain_omega})
+ - set_mu(${mu})
+ - set_gain_mu(${gain_mu})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_clock_recovery_mm_xx.xml b/gr-digital/grc/digital_clock_recovery_mm_xx.xml
deleted file mode 100644
index a0857686b..000000000
--- a/gr-digital/grc/digital_clock_recovery_mm_xx.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Clock Recovery MM
-###################################################
- -->
-<block>
- <name>Clock Recovery MM</name>
- <key>digital_clock_recovery_mm_xx</key>
- <import>from gnuradio import digital</import>
- <make>digital.clock_recovery_mm_$(type.fcn)($omega, $gain_omega, $mu, $gain_mu, $omega_relative_limit)</make>
- <callback>set_omega($omega)</callback>
- <callback>set_gain_omega($gain_omega)</callback>
- <callback>set_mu($mu)</callback>
- <callback>set_gain_mu($gain_mu)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- </param>
- <param>
- <name>Omega</name>
- <key>omega</key>
- <value>samp_per_sym*(1+0.0)</value>
- <type>real</type>
- </param>
- <param>
- <name>Gain Omega</name>
- <key>gain_omega</key>
- <value>0.25*0.175*0.175</value>
- <type>real</type>
- </param>
- <param>
- <name>Mu</name>
- <key>mu</key>
- <value>0.5</value>
- <type>real</type>
- </param>
- <param>
- <name>Gain Mu</name>
- <key>gain_mu</key>
- <value>0.175</value>
- <type>real</type>
- </param>
- <param>
- <name>Omega Relative Limit</name>
- <key>omega_relative_limit</key>
- <value>0.005</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_cma_equalizer_cc.block.yml b/gr-digital/grc/digital_cma_equalizer_cc.block.yml
new file mode 100644
index 000000000..64e83390d
--- /dev/null
+++ b/gr-digital/grc/digital_cma_equalizer_cc.block.yml
@@ -0,0 +1,33 @@
+id: digital_cma_equalizer_cc
+label: CMA Equalizer
+
+parameters:
+- id: num_taps
+ label: Num. Taps
+ dtype: int
+- id: modulus
+ label: Modulus
+ dtype: real
+- id: mu
+ label: Gain
+ dtype: real
+- id: sps
+ label: Samples per Symbol
+ dtype: int
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.cma_equalizer_cc(${num_taps}, ${modulus}, ${mu}, ${sps})
+ callbacks:
+ - set_gain(${mu})
+ - set_modulus(${modulus})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_cma_equalizer_cc.xml b/gr-digital/grc/digital_cma_equalizer_cc.xml
deleted file mode 100644
index 118c18e29..000000000
--- a/gr-digital/grc/digital_cma_equalizer_cc.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## CMA Equalizer
-###################################################
- -->
-<block>
- <name>CMA Equalizer</name>
- <key>digital_cma_equalizer_cc</key>
- <import>from gnuradio import digital</import>
- <make>digital.cma_equalizer_cc($num_taps, $modulus, $mu, $sps)</make>
- <callback>set_gain($mu)</callback>
- <callback>set_modulus($modulus)</callback>
- <param>
- <name>Num. Taps</name>
- <key>num_taps</key>
- <type>int</type>
- </param>
- <param>
- <name>Modulus</name>
- <key>modulus</key>
- <type>real</type>
- </param>
- <param>
- <name>Gain</name>
- <key>mu</key>
- <type>real</type>
- </param>
- <param>
- <name>Samples per Symbol</name>
- <key>sps</key>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_constellation.block.yml b/gr-digital/grc/digital_constellation.block.yml
new file mode 100644
index 000000000..b60414088
--- /dev/null
+++ b/gr-digital/grc/digital_constellation.block.yml
@@ -0,0 +1,72 @@
+id: variable_constellation
+label: Constellation Object
+category: Modulators
+
+parameters:
+- id: type
+ label: Constellation Type
+ dtype: enum
+ options: [calcdist, bpsk, qpsk, dqpsk, 8psk, 16qam]
+ option_labels: [Variable Constellation, BPSK, QPSK, DQPSK, 8PSK, 16QAM]
+- id: sym_map
+ label: Symbol Map
+ dtype: int_vector
+ default: '[0, 1, 3, 2]'
+ hide: ${ ( 'none' if str(type) == "calcdist" else 'all') }
+- id: const_points
+ label: Constellation Points
+ dtype: complex_vector
+ default: '[-1-1j, -1+1j, 1+1j, 1-1j]'
+ hide: ${ ( 'none' if str(type) == "calcdist" else 'all') }
+- id: rot_sym
+ label: Rotational Symmetry
+ dtype: int
+ default: '4'
+ hide: ${ ( 'none' if str(type) == "calcdist" else 'all') }
+- id: dims
+ label: Dimensionality
+ dtype: int
+ default: '1'
+ hide: ${ ( 'none' if str(type) == "calcdist" else 'all') }
+- id: precision
+ label: Soft Decisions Precision
+ dtype: int
+ default: '8'
+ hide: part
+- id: soft_dec_lut
+ label: Soft Decisions LUT
+ dtype: raw
+ default: None
+ hide: ${ ('part' if str(soft_dec_lut) == 'None' else 'none') }
+value: ${ digital.constellation_calcdist(const_points, sym_map, rot_sym, dims) if (str(type) == "calcdist") else digital.constellation_type}
+
+templates:
+ imports: from gnuradio import digital
+ var_make: '
+
+ % if str(type) == "calcdist":
+
+ self.${id} = ${id} = digital.constellation_calcdist(${const_points}, ${sym_map},
+ ${rot_sym}, ${dims}).base()
+
+ % else:
+
+ self.${id} = ${id} = digital.constellation_${type}().base()
+
+ % endif
+
+
+ % if str(soft_dec_lut).lower() == ''"auto"'' or str(soft_dec_lut).lower()
+ == "''auto''":
+
+ self.${id}.gen_soft_dec_lut(${precision})
+
+ % elif str(soft_dec_lut) != ''None'':
+
+ self.${id}.set_soft_dec_lut(${soft_dec_lut}, ${precision})
+
+ % endif
+
+ '
+
+file_format: 1
diff --git a/gr-digital/grc/digital_constellation.xml b/gr-digital/grc/digital_constellation.xml
deleted file mode 100644
index ef5364d24..000000000
--- a/gr-digital/grc/digital_constellation.xml
+++ /dev/null
@@ -1,113 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Create a Constellation Object
-###################################################
- -->
-<block>
- <name>Constellation Object</name>
- <key>variable_constellation</key>
- <category>Modulators</category>
- <import>from gnuradio import digital</import>
- <var_make>
-#if str($type) == "calcdist"
-self.$(id) = $(id) = digital.constellation_calcdist($const_points, $sym_map, $rot_sym, $dims).base()
-#else
-self.$(id) = $(id) = digital.constellation_$(type)().base()
-#end if
-
-#if str($soft_dec_lut).lower() == '"auto"' or str($soft_dec_lut).lower() == "'auto'"
-self.$(id).gen_soft_dec_lut($precision)
-#else if str($soft_dec_lut) != 'None'
-self.$(id).set_soft_dec_lut($soft_dec_lut, $precision)
-#end if
-</var_make>
-
-<var_value>
-#if str($type) == "calcdist"
-digital.constellation_calcdist($const_points, $sym_map, $rot_sym, $dims)
-#else
-digital.constellation_$(type)()
-#end if
-</var_value>
-
- <make></make>
- <!--<callback></callback>-->
-
- <param>
- <name>Constellation Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Variable Constellation</name>
- <key>calcdist</key>
- </option>
- <option>
- <name>BPSK</name>
- <key>bpsk</key>
- </option>
- <option>
- <name>QPSK</name>
- <key>qpsk</key>
- </option>
- <option>
- <name>DQPSK</name>
- <key>dqpsk</key>
- </option>
- <option>
- <name>8PSK</name>
- <key>8psk</key>
- </option>
- <option>
- <name>16QAM</name>
- <key>16qam</key>
- </option>
-
- </param>
- <param>
- <name>Symbol Map</name>
- <key>sym_map</key>
- <value>[0, 1, 3, 2]</value>
- <type>int_vector</type>
- <hide> #if str($type) == "calcdist" then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Constellation Points</name>
- <key>const_points</key>
- <value>[-1-1j, -1+1j, 1+1j, 1-1j]</value>
- <type>complex_vector</type>
- <hide> #if str($type) == "calcdist" then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Rotational Symmetry</name>
- <key>rot_sym</key>
- <value>4</value>
- <type>int</type>
- <hide> #if str($type) == "calcdist" then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimensionality</name>
- <key>dims</key>
- <value>1</value>
- <type>int</type>
- <hide> #if str($type) == "calcdist" then 'none' else 'all' #</hide>
- </param>
- <param>
- <name>Soft Decisions Precision</name>
- <key>precision</key>
- <value>8</value>
- <type>int</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Soft Decisions LUT</name>
- <key>soft_dec_lut</key>
- <value>None</value>
- <type>raw</type>
- <hide>#if str($soft_dec_lut) == 'None' then 'part' else 'none'#</hide>
- </param>
-</block>
diff --git a/gr-digital/grc/digital_constellation_decoder_cb.block.yml b/gr-digital/grc/digital_constellation_decoder_cb.block.yml
new file mode 100644
index 000000000..59d312d89
--- /dev/null
+++ b/gr-digital/grc/digital_constellation_decoder_cb.block.yml
@@ -0,0 +1,21 @@
+id: digital_constellation_decoder_cb
+label: Constellation Decoder
+
+parameters:
+- id: constellation
+ label: Constellation Object
+ dtype: raw
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.constellation_decoder_cb(${constellation})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_constellation_decoder_cb.xml b/gr-digital/grc/digital_constellation_decoder_cb.xml
deleted file mode 100644
index c7353e288..000000000
--- a/gr-digital/grc/digital_constellation_decoder_cb.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Constellation Decoder
-###################################################
- -->
-<block>
- <name>Constellation Decoder</name>
- <key>digital_constellation_decoder_cb</key>
- <import>from gnuradio import digital</import>
- <make>digital.constellation_decoder_cb($constellation)</make>
- <param>
- <name>Constellation Object</name>
- <key>constellation</key>
- <type>raw</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_constellation_modulator.block.yml b/gr-digital/grc/digital_constellation_modulator.block.yml
new file mode 100644
index 000000000..8be84449a
--- /dev/null
+++ b/gr-digital/grc/digital_constellation_modulator.block.yml
@@ -0,0 +1,58 @@
+id: digital_constellation_modulator
+label: Constellation Modulator
+
+parameters:
+- id: constellation
+ label: Constellation
+ dtype: raw
+- id: differential
+ label: Differential Encoding
+ dtype: bool
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: samples_per_symbol
+ label: Samples/Symbol
+ dtype: int
+ default: '2'
+- id: excess_bw
+ label: Excess BW
+ dtype: real
+ default: '0.35'
+- id: verbose
+ label: Verbose
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(verbose) == 'False' else 'none') }
+- id: log
+ label: Log
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(log) == 'False' else 'none') }
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import digital
+ make: |-
+ digital.generic_mod(
+ constellation=${constellation},
+ differential=${differential},
+ samples_per_symbol=${samples_per_symbol},
+ pre_diff_code=True,
+ excess_bw=${excess_bw},
+ verbose=${verbose},
+ log=${log},
+ )
+
+file_format: 1
diff --git a/gr-digital/grc/digital_constellation_modulator.xml b/gr-digital/grc/digital_constellation_modulator.xml
deleted file mode 100644
index 9905197f9..000000000
--- a/gr-digital/grc/digital_constellation_modulator.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2013 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-## Modulates any given constellation object
-###################################################
- -->
-<block>
- <name>Constellation Modulator</name>
- <key>digital_constellation_modulator</key>
- <import>from gnuradio import digital</import>
- <make>digital.generic_mod(
- constellation=$constellation,
- differential=$differential,
- samples_per_symbol=$samples_per_symbol,
- pre_diff_code=True,
- excess_bw=$excess_bw,
- verbose=$verbose,
- log=$log,
- )</make>
- <param>
- <name>Constellation</name>
- <key>constellation</key>
- <type>raw</type>
- </param>
- <param>
- <name>Differential Encoding</name>
- <key>differential</key>
- <value>True</value>
- <type>bool</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Samples/Symbol</name>
- <key>samples_per_symbol</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Excess BW</name>
- <key>excess_bw</key>
- <value>0.35</value>
- <type>real</type>
- </param>
- <param>
- <name>Verbose</name>
- <key>verbose</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Log</name>
- <key>log</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($log) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_constellation_receiver_cb.block.yml b/gr-digital/grc/digital_constellation_receiver_cb.block.yml
new file mode 100644
index 000000000..622134880
--- /dev/null
+++ b/gr-digital/grc/digital_constellation_receiver_cb.block.yml
@@ -0,0 +1,62 @@
+id: digital_constellation_receiver_cb
+label: Constellation Receiver
+
+parameters:
+- id: constellation
+ label: Constellation Object
+ dtype: raw
+- id: loop_bw
+ label: Loop Bandwidth
+ dtype: real
+- id: fmin
+ label: Minimum Freq Deviation
+ dtype: real
+- id: fmax
+ label: Maximum Freq Deviation
+ dtype: real
+- id: showports
+ label: Show Msg Ports
+ dtype: enum
+ default: 'True'
+ options: ['False', 'True']
+ option_labels: ['Yes', 'No']
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: complex
+- domain: message
+ id: set_constellation
+ optional: true
+ hide: ${ showports }
+- domain: message
+ id: rotate_phase
+ optional: true
+ hide: ${ showports }
+
+outputs:
+- domain: stream
+ dtype: byte
+- label: error
+ domain: stream
+ dtype: float
+ optional: true
+- label: phase
+ domain: stream
+ dtype: float
+ optional: true
+- label: frequency
+ domain: stream
+ dtype: float
+ optional: true
+- label: symbol
+ domain: stream
+ dtype: complex
+ optional: true
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.constellation_receiver_cb(${constellation}, ${loop_bw}, ${fmin},
+ ${fmax})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_constellation_receiver_cb.xml b/gr-digital/grc/digital_constellation_receiver_cb.xml
deleted file mode 100644
index 06155ecae..000000000
--- a/gr-digital/grc/digital_constellation_receiver_cb.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Constellation Receiver
-###################################################
- -->
-<block>
- <name>Constellation Receiver</name>
- <key>digital_constellation_receiver_cb</key>
- <import>from gnuradio import digital</import>
- <make>digital.constellation_receiver_cb($constellation, $loop_bw, $fmin, $fmax)</make>
- <param>
- <name>Constellation Object</name>
- <key>constellation</key>
- <type>raw</type>
- </param>
- <param>
- <name>Loop Bandwidth</name>
- <key>loop_bw</key>
- <type>real</type>
- </param>
- <param>
- <name>Minimum Freq Deviation</name>
- <key>fmin</key>
- <type>real</type>
- </param>
- <param>
- <name>Maximum Freq Deviation</name>
- <key>fmax</key>
- <type>real</type>
- </param>
-
- <param>
- <name>Show Msg Ports</name>
- <key>showports</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>False</key>
- </option>
- <option>
- <name>No</name>
- <key>True</key>
- </option>
- </param>
-
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
-
- <sink>
- <name>set_constellation</name>
- <type>message</type>
- <optional>1</optional>
- <hide>$showports</hide>
- </sink>
-
- <sink>
- <name>rotate_phase</name>
- <type>message</type>
- <optional>1</optional>
- <hide>$showports</hide>
- </sink>
-
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
- <source>
- <name>error</name>
- <type>float</type>
- <optional>1</optional>
- </source>
- <source>
- <name>phase</name>
- <type>float</type>
- <optional>1</optional>
- </source>
- <source>
- <name>frequency</name>
- <type>float</type>
- <optional>1</optional>
- </source>
- <source>
- <name>symbol</name>
- <type>complex</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_constellation_rect.block.yml b/gr-digital/grc/digital_constellation_rect.block.yml
new file mode 100644
index 000000000..e9e58001c
--- /dev/null
+++ b/gr-digital/grc/digital_constellation_rect.block.yml
@@ -0,0 +1,65 @@
+id: variable_constellation_rect
+label: Constellation Rect. Object
+category: Modulators
+
+parameters:
+- id: sym_map
+ label: Symbol Map
+ dtype: int_vector
+ default: '[0, 1, 3, 2]'
+- id: const_points
+ label: Constellation Points
+ dtype: complex_vector
+ default: '[-1-1j, -1+1j, 1+1j, 1-1j]'
+- id: rot_sym
+ label: Rotational Symmetry
+ dtype: int
+ default: '4'
+- id: real_sect
+ label: Real Sectors
+ dtype: int
+ default: '2'
+- id: imag_sect
+ label: Imaginary Sectors
+ dtype: int
+ default: '2'
+- id: w_real_sect
+ label: Width Real Sectors
+ dtype: int
+ default: '1'
+- id: w_imag_sect
+ label: Width Imaginary Sectors
+ dtype: int
+ default: '1'
+- id: precision
+ label: Soft bits precision
+ dtype: int
+ default: '8'
+ hide: part
+- id: soft_dec_lut
+ label: Soft Decisions LUT
+ dtype: raw
+ default: None
+ hide: ${ ('part' if str(soft_dec_lut) == 'None' else 'none') }
+value: ${ digital.constellation_rect(const_points, sym_map, rot_sym, real_sect, imag_sect,
+ w_real_sect, w_imag_sect) }
+
+templates:
+ imports: from gnuradio import digital
+ var_make: 'self.${id} = ${id} = digital.constellation_rect(${const_points}, ${sym_map},
+ ${rot_sym}, ${real_sect}, ${imag_sect}, ${w_real_sect}, ${w_imag_sect}).base()
+
+ % if str(soft_dec_lut).lower() == ''"auto"'' or str(soft_dec_lut).lower()
+ == "''auto''":
+
+ self.${id}.gen_soft_dec_lut(${precision})
+
+ % elif str(soft_dec_lut) != ''None'':
+
+ self.${id}.set_soft_dec_lut(${soft_dec_lut}, ${precision})
+
+ % endif
+
+ '
+
+file_format: 1
diff --git a/gr-digital/grc/digital_constellation_rect.xml b/gr-digital/grc/digital_constellation_rect.xml
deleted file mode 100644
index 9e50fe84b..000000000
--- a/gr-digital/grc/digital_constellation_rect.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Create a Rectangular Constellation Object
-###################################################
- -->
-<block>
- <name>Constellation Rect. Object</name>
- <key>variable_constellation_rect</key>
- <category>Modulators</category>
- <import>from gnuradio import digital</import>
- <var_make>self.$(id) = $(id) = digital.constellation_rect($const_points, $sym_map, $rot_sym, $real_sect, $imag_sect, $w_real_sect, $w_imag_sect).base()
-#if str($soft_dec_lut).lower() == '"auto"' or str($soft_dec_lut).lower() == "'auto'"
-self.$(id).gen_soft_dec_lut($precision)
-#else if str($soft_dec_lut) != 'None'
-self.$(id).set_soft_dec_lut($soft_dec_lut, $precision)
-#end if
-</var_make>
-
- <var_value>digital.constellation_rect($const_points, $sym_map, $rot_sym, $real_sect, $imag_sect, $w_real_sect, $w_imag_sect)</var_value>
-
- <make></make>
- <!--<callback>set_softbits($softbits_lut, $precision)</callback>-->
-
- <param>
- <name>Symbol Map</name>
- <key>sym_map</key>
- <value>[0, 1, 3, 2]</value>
- <type>int_vector</type>
- </param>
-
- <param>
- <name>Constellation Points</name>
- <key>const_points</key>
- <value>[-1-1j, -1+1j, 1+1j, 1-1j]</value>
- <type>complex_vector</type>
- </param>
-
- <param>
- <name>Rotational Symmetry</name>
- <key>rot_sym</key>
- <value>4</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Real Sectors</name>
- <key>real_sect</key>
- <value>2</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Imaginary Sectors</name>
- <key>imag_sect</key>
- <value>2</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Width Real Sectors</name>
- <key>w_real_sect</key>
- <value>1</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Width Imaginary Sectors</name>
- <key>w_imag_sect</key>
- <value>1</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Soft bits precision</name>
- <key>precision</key>
- <value>8</value>
- <type>int</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Soft Decisions LUT</name>
- <key>soft_dec_lut</key>
- <value>None</value>
- <type>raw</type>
- <hide>#if str($soft_dec_lut) == 'None' then 'part' else 'none'#</hide>
- </param>
-</block>
diff --git a/gr-digital/grc/digital_constellation_soft_decoder_cf.block.yml b/gr-digital/grc/digital_constellation_soft_decoder_cf.block.yml
new file mode 100644
index 000000000..2b352a7f2
--- /dev/null
+++ b/gr-digital/grc/digital_constellation_soft_decoder_cf.block.yml
@@ -0,0 +1,21 @@
+id: digital_constellation_soft_decoder_cf
+label: Constellation Soft Decoder
+
+parameters:
+- id: constellation
+ label: Constellation Object
+ dtype: raw
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.constellation_soft_decoder_cf(${constellation})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_constellation_soft_decoder_cf.xml b/gr-digital/grc/digital_constellation_soft_decoder_cf.xml
deleted file mode 100644
index 6b0995acc..000000000
--- a/gr-digital/grc/digital_constellation_soft_decoder_cf.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Constellation Decoder, soft bits out
-###################################################
- -->
-<block>
- <name>Constellation Soft Decoder</name>
- <key>digital_constellation_soft_decoder_cf</key>
- <import>from gnuradio import digital</import>
- <make>digital.constellation_soft_decoder_cf($constellation)</make>
- <param>
- <name>Constellation Object</name>
- <key>constellation</key>
- <type>raw</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_corr_est_cc.block.yml b/gr-digital/grc/digital_corr_est_cc.block.yml
new file mode 100644
index 000000000..b3a9698d1
--- /dev/null
+++ b/gr-digital/grc/digital_corr_est_cc.block.yml
@@ -0,0 +1,38 @@
+id: digital_corr_est_cc
+label: Correlation Estimator
+
+parameters:
+- id: symbols
+ label: Symbols
+ dtype: complex_vector
+- id: sps
+ label: Samples per Symbol
+ dtype: float
+- id: mark_delay
+ label: Tag marking delay
+ dtype: int
+- id: threshold
+ label: Threshold
+ dtype: float
+ default: '0.9'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+- label: corr
+ domain: stream
+ dtype: complex
+ optional: true
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.corr_est_cc(${symbols}, ${sps}, ${mark_delay}, ${threshold})
+ callbacks:
+ - set_mark_delay(${mark_delay})
+ - set_threshold(${threshold})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_corr_est_cc.xml b/gr-digital/grc/digital_corr_est_cc.xml
deleted file mode 100644
index 1a1c449ef..000000000
--- a/gr-digital/grc/digital_corr_est_cc.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>Correlation Estimator</name>
- <key>digital_corr_est_cc</key>
- <import>from gnuradio import digital</import>
- <make>digital.corr_est_cc($symbols, $sps, $mark_delay, $threshold)</make>
- <callback>set_mark_delay($mark_delay)</callback>
- <callback>set_threshold($threshold)</callback>
-
- <param>
- <name>Symbols</name>
- <key>symbols</key>
- <type>complex_vector</type>
- </param>
-
- <param>
- <name>Samples per Symbol</name>
- <key>sps</key>
- <type>float</type>
- </param>
-
- <param>
- <name>Tag marking delay</name>
- <key>mark_delay</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Threshold</name>
- <key>threshold</key>
- <value>0.9</value>
- <type>float</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-
- <source>
- <name>corr</name>
- <type>complex</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_correlate_access_code_bb.block.yml b/gr-digital/grc/digital_correlate_access_code_bb.block.yml
new file mode 100644
index 000000000..57394668b
--- /dev/null
+++ b/gr-digital/grc/digital_correlate_access_code_bb.block.yml
@@ -0,0 +1,25 @@
+id: digital_correlate_access_code_bb
+label: Correlate Access Code
+
+parameters:
+- id: access_code
+ label: Access Code
+ dtype: string
+ default: '101010'
+- id: threshold
+ label: Threshold
+ dtype: int
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.correlate_access_code_bb(${access_code}, ${threshold})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_correlate_access_code_bb.xml b/gr-digital/grc/digital_correlate_access_code_bb.xml
deleted file mode 100644
index 3941834c4..000000000
--- a/gr-digital/grc/digital_correlate_access_code_bb.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Correlate Access Code
-###################################################
- -->
-<block>
- <name>Correlate Access Code</name>
- <key>digital_correlate_access_code_bb</key>
- <import>from gnuradio import digital</import>
- <make>digital.correlate_access_code_bb($access_code, $threshold)</make>
- <param>
- <name>Access Code</name>
- <key>access_code</key>
- <value>101010</value>
- <type>string</type>
- </param>
- <param>
- <name>Threshold</name>
- <key>threshold</key>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_correlate_access_code_tag_xx.block.yml b/gr-digital/grc/digital_correlate_access_code_tag_xx.block.yml
new file mode 100644
index 000000000..6cf81129c
--- /dev/null
+++ b/gr-digital/grc/digital_correlate_access_code_tag_xx.block.yml
@@ -0,0 +1,40 @@
+id: digital_correlate_access_code_tag_xx
+label: Correlate Access Code - Tag
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [byte, float]
+ option_attributes:
+ fcn: [bb, ff]
+ hide: part
+- id: access_code
+ label: Access Code
+ dtype: string
+ default: '101010'
+- id: threshold
+ label: Threshold
+ dtype: int
+- id: tagname
+ label: Tag Name
+ dtype: string
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.correlate_access_code_tag_${type.fcn}(${access_code}, ${threshold},
+ ${tagname})
+ callbacks:
+ - set_access_code(${access_code})
+ - set_threshold(${threshold})
+ - set_tagname(${tagname})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_correlate_access_code_tag_xx.xml b/gr-digital/grc/digital_correlate_access_code_tag_xx.xml
deleted file mode 100644
index c7c137187..000000000
--- a/gr-digital/grc/digital_correlate_access_code_tag_xx.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Correlate Access Code
-###################################################
- -->
-<block>
- <name>Correlate Access Code - Tag</name>
- <key>digital_correlate_access_code_tag_xx</key>
- <import>from gnuradio import digital</import>
- <make>digital.correlate_access_code_tag_$(type.fcn)($access_code, $threshold, $tagname)</make>
- <callback>set_access_code($access_code)</callback>
- <callback>set_threshold($threshold)</callback>
- <callback>set_tagname($tagname)</callback>
-
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:bb</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- </param>
- <param>
- <name>Access Code</name>
- <key>access_code</key>
- <value>101010</value>
- <type>string</type>
- </param>
- <param>
- <name>Threshold</name>
- <key>threshold</key>
- <type>int</type>
- </param>
- <param>
- <name>Tag Name</name>
- <key>tagname</key>
- <type>string</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_correlate_access_code_xx_ts.block.yml b/gr-digital/grc/digital_correlate_access_code_xx_ts.block.yml
new file mode 100644
index 000000000..d51ba9833
--- /dev/null
+++ b/gr-digital/grc/digital_correlate_access_code_xx_ts.block.yml
@@ -0,0 +1,37 @@
+id: digital_correlate_access_code_xx_ts
+label: Correlate Access Code - Tag Stream
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [float, byte]
+ option_attributes:
+ fcn: [ff, bb]
+ hide: part
+- id: access_code
+ label: Access Code
+ dtype: string
+ default: '101010'
+- id: threshold
+ label: Threshold
+ dtype: int
+- id: tagname
+ label: Tag Name
+ dtype: string
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import digital
+ make: |-
+ digital.correlate_access_code_${type.fcn}_ts(${access_code},
+ ${threshold}, ${tagname})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_correlate_access_code_xx_ts.xml b/gr-digital/grc/digital_correlate_access_code_xx_ts.xml
deleted file mode 100644
index 467c2c84d..000000000
--- a/gr-digital/grc/digital_correlate_access_code_xx_ts.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Correlate Access Code - to tag stream
-###################################################
- -->
-<block>
- <name>Correlate Access Code - Tag Stream</name>
- <key>digital_correlate_access_code_xx_ts</key>
- <import>from gnuradio import digital</import>
- <make>digital.correlate_access_code_$(type.fcn)_ts($access_code,
- $threshold, $tagname)</make>
-
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:bb</opt>
- </option>
- </param>
-
- <param>
- <name>Access Code</name>
- <key>access_code</key>
- <value>101010</value>
- <type>string</type>
- </param>
-
- <param>
- <name>Threshold</name>
- <key>threshold</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Tag Name</name>
- <key>tagname</key>
- <type>string</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_costas_loop_cc.block.yml b/gr-digital/grc/digital_costas_loop_cc.block.yml
new file mode 100644
index 000000000..6134774f3
--- /dev/null
+++ b/gr-digital/grc/digital_costas_loop_cc.block.yml
@@ -0,0 +1,48 @@
+id: digital_costas_loop_cc
+label: Costas Loop
+
+parameters:
+- id: w
+ label: Loop Bandwidth
+ dtype: real
+- id: order
+ label: Order
+ dtype: int
+- id: use_snr
+ label: Use SNR
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: complex
+- domain: message
+ id: noise
+ optional: true
+
+outputs:
+- domain: stream
+ dtype: complex
+- label: frequency
+ domain: stream
+ dtype: float
+ optional: true
+- label: phase
+ domain: stream
+ dtype: float
+ optional: true
+- label: error
+ domain: stream
+ dtype: float
+ optional: true
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.costas_loop_cc(${w}, ${order}, ${use_snr})
+ callbacks:
+ - set_loop_bandwidth(${w})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_costas_loop_cc.xml b/gr-digital/grc/digital_costas_loop_cc.xml
deleted file mode 100644
index 23e3ca903..000000000
--- a/gr-digital/grc/digital_costas_loop_cc.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Costas Loop
-###################################################
- -->
-<block>
- <name>Costas Loop</name>
- <key>digital_costas_loop_cc</key>
- <import>from gnuradio import digital</import>
- <make>digital.costas_loop_cc($w, $order, $use_snr)</make>
- <callback>set_loop_bandwidth($w)</callback>
-
- <param>
- <name>Loop Bandwidth</name>
- <key>w</key>
- <type>real</type>
- </param>
-
- <param>
- <name>Order</name>
- <key>order</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Use SNR</name>
- <key>use_snr</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
-
- <sink>
- <name>noise</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
-
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-
- <!-- Optional Outputs -->
- <source>
- <name>frequency</name>
- <type>float</type>
- <optional>1</optional>
- </source>
- <source>
- <name>phase</name>
- <type>float</type>
- <optional>1</optional>
- </source>
- <source>
- <name>error</name>
- <type>float</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_cpmmod_bc.block.yml b/gr-digital/grc/digital_cpmmod_bc.block.yml
new file mode 100644
index 000000000..1a6435289
--- /dev/null
+++ b/gr-digital/grc/digital_cpmmod_bc.block.yml
@@ -0,0 +1,40 @@
+id: digital_cpmmod_bc
+label: Continuous Phase Modulation
+
+parameters:
+- id: type
+ label: CPM Type
+ dtype: enum
+ options: [analog.cpm.LREC, analog.cpm.LRC, analog.cpm.LSRC, analog.cpm.TFM, analog.cpm.GAUSSIAN]
+ option_labels: [L-REC (Rectangular phase response), L-RC (Raised Cosine), L-SRC
+ (Spectral raised cosine), TFM (Tamed frequency modulation), Gaussian]
+- id: mod_index
+ label: Modulation Index
+ dtype: real
+ default: '0.5'
+- id: samples_per_symbol
+ label: Samples/Symbol
+ dtype: int
+ default: '4'
+- id: L
+ label: Pulse Duration (Symbols)
+ dtype: int
+ default: '4'
+- id: beta
+ label: Phase Response Parameter (BT or Beta)
+ dtype: real
+ default: '0.3'
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import gr, digital, analog
+ make: digital.cpmmod_bc(${type}, ${mod_index}, ${samples_per_symbol}, ${L}, ${beta})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_cpmmod_bc.xml b/gr-digital/grc/digital_cpmmod_bc.xml
deleted file mode 100644
index 94231775c..000000000
--- a/gr-digital/grc/digital_cpmmod_bc.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Continuous Phase Modulation
-###################################################
- -->
-<block>
- <name>Continuous Phase Modulation</name>
- <key>digital_cpmmod_bc</key>
- <import>from gnuradio import gr, digital, analog</import>
- <make>digital.cpmmod_bc($type, $mod_index, $samples_per_symbol, $L, $beta)</make>
- <param>
- <name>CPM Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>L-REC (Rectangular phase response)</name>
- <key>analog.cpm.LREC</key>
- </option>
- <option>
- <name>L-RC (Raised Cosine)</name>
- <key>analog.cpm.LRC</key>
- </option>
- <option>
- <name>L-SRC (Spectral raised cosine)</name>
- <key>analog.cpm.LSRC</key>
- </option>
- <option>
- <name>TFM (Tamed frequency modulation)</name>
- <key>analog.cpm.TFM</key>
- </option>
- <option>
- <name>Gaussian</name>
- <key>analog.cpm.GAUSSIAN</key>
- </option>
- </param>
- <param>
- <name>Modulation Index</name>
- <key>mod_index</key>
- <value>0.5</value>
- <type>real</type>
- </param>
- <param>
- <name>Samples/Symbol</name>
- <key>samples_per_symbol</key>
- <value>4</value>
- <type>int</type>
- </param>
- <param>
- <name>Pulse Duration (Symbols)</name>
- <key>L</key>
- <value>4</value>
- <type>int</type>
- </param>
- <param>
- <name>Phase Response Parameter (BT or Beta)</name>
- <key>beta</key>
- <value>0.3</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_crc32_async_bb.block.yml b/gr-digital/grc/digital_crc32_async_bb.block.yml
new file mode 100644
index 000000000..19b673221
--- /dev/null
+++ b/gr-digital/grc/digital_crc32_async_bb.block.yml
@@ -0,0 +1,25 @@
+id: digital_crc32_async_bb
+label: Async CRC32
+
+parameters:
+- id: check
+ label: Mode
+ dtype: enum
+ options: ['False', 'True']
+ option_labels: [Generate CRC, Check CRC]
+
+inputs:
+- domain: message
+ id: in
+ optional: true
+
+outputs:
+- domain: message
+ id: out
+ optional: true
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.crc32_async_bb(${check})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_crc32_async_bb.xml b/gr-digital/grc/digital_crc32_async_bb.xml
deleted file mode 100644
index 84c60e60a..000000000
--- a/gr-digital/grc/digital_crc32_async_bb.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<block>
- <name>Async CRC32</name>
- <key>digital_crc32_async_bb</key>
- <import>from gnuradio import digital</import>
- <make>digital.crc32_async_bb($check)</make>
-
- <param>
- <name>Mode</name>
- <key>check</key>
- <type>enum</type>
- <option>
- <name>Generate CRC</name>
- <key>False</key>
- </option>
- <option>
- <name>Check CRC</name>
- <key>True</key>
- </option>
- </param>
-
- <sink>
- <name>in</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
-
- <source>
- <name>out</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_crc32_bb.block.yml b/gr-digital/grc/digital_crc32_bb.block.yml
new file mode 100644
index 000000000..9e88a63f7
--- /dev/null
+++ b/gr-digital/grc/digital_crc32_bb.block.yml
@@ -0,0 +1,33 @@
+id: digital_crc32_bb
+label: Stream CRC32
+
+parameters:
+- id: check
+ label: Mode
+ dtype: enum
+ options: ['False', 'True']
+ option_labels: [Generate CRC, Check CRC]
+- id: lengthtagname
+ label: Length tag name
+ dtype: string
+ default: '"packet_len"'
+- id: packed
+ label: Packed
+ dtype: bool
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.crc32_bb(${check}, ${lengthtagname}, ${packed})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_crc32_bb.xml b/gr-digital/grc/digital_crc32_bb.xml
deleted file mode 100644
index 2fc6c248d..000000000
--- a/gr-digital/grc/digital_crc32_bb.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<block>
- <name>Stream CRC32</name>
- <key>digital_crc32_bb</key>
- <import>from gnuradio import digital</import>
- <make>digital.crc32_bb($check, $lengthtagname, $packed)</make>
- <param>
- <name>Mode</name>
- <key>check</key>
- <type>enum</type>
- <option>
- <name>Generate CRC</name>
- <key>False</key>
- </option>
- <option>
- <name>Check CRC</name>
- <key>True</key>
- </option>
- </param>
- <param>
- <name>Length tag name</name>
- <key>lengthtagname</key>
- <value>"packet_len"</value>
- <type>string</type>
- </param>
- <param>
- <name>Packed</name>
- <key>packed</key>
- <value>True</value>
- <type>bool</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_descrambler_bb.block.yml b/gr-digital/grc/digital_descrambler_bb.block.yml
new file mode 100644
index 000000000..fbb65c0dd
--- /dev/null
+++ b/gr-digital/grc/digital_descrambler_bb.block.yml
@@ -0,0 +1,30 @@
+id: digital_descrambler_bb
+label: Descrambler
+
+parameters:
+- id: mask
+ label: Mask
+ dtype: hex
+ default: '0x8A'
+- id: seed
+ label: Seed
+ dtype: hex
+ default: '0x7F'
+- id: len
+ label: Length
+ dtype: int
+ default: '7'
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.descrambler_bb(${mask}, ${seed}, ${len})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_descrambler_bb.xml b/gr-digital/grc/digital_descrambler_bb.xml
deleted file mode 100644
index 4f52c7964..000000000
--- a/gr-digital/grc/digital_descrambler_bb.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Descrambler
-###################################################
- -->
-<block>
- <name>Descrambler</name>
- <key>digital_descrambler_bb</key>
- <import>from gnuradio import digital</import>
- <make>digital.descrambler_bb($mask, $seed, $len)</make>
- <param>
- <name>Mask</name>
- <key>mask</key>
- <value>0x8A</value>
- <type>hex</type>
- </param>
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>0x7F</value>
- <type>hex</type>
- </param>
- <param>
- <name>Length</name>
- <key>len</key>
- <value>7</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_diff_decoder_bb.block.yml b/gr-digital/grc/digital_diff_decoder_bb.block.yml
new file mode 100644
index 000000000..4b988007c
--- /dev/null
+++ b/gr-digital/grc/digital_diff_decoder_bb.block.yml
@@ -0,0 +1,21 @@
+id: digital_diff_decoder_bb
+label: Differential Decoder
+
+parameters:
+- id: modulus
+ label: Modulus
+ dtype: int
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.diff_decoder_bb(${modulus})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_diff_decoder_bb.xml b/gr-digital/grc/digital_diff_decoder_bb.xml
deleted file mode 100644
index a7c94b834..000000000
--- a/gr-digital/grc/digital_diff_decoder_bb.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Differential Decoder
-###################################################
- -->
-<block>
- <name>Differential Decoder</name>
- <key>digital_diff_decoder_bb</key>
- <import>from gnuradio import digital</import>
- <make>digital.diff_decoder_bb($modulus)</make>
- <param>
- <name>Modulus</name>
- <key>modulus</key>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_diff_encoder_bb.block.yml b/gr-digital/grc/digital_diff_encoder_bb.block.yml
new file mode 100644
index 000000000..45a5c7130
--- /dev/null
+++ b/gr-digital/grc/digital_diff_encoder_bb.block.yml
@@ -0,0 +1,21 @@
+id: digital_diff_encoder_bb
+label: Differential Encoder
+
+parameters:
+- id: modulus
+ label: Modulus
+ dtype: int
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.diff_encoder_bb(${modulus})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_diff_encoder_bb.xml b/gr-digital/grc/digital_diff_encoder_bb.xml
deleted file mode 100644
index 3885bed9a..000000000
--- a/gr-digital/grc/digital_diff_encoder_bb.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Differential Encoder
-###################################################
- -->
-<block>
- <name>Differential Encoder</name>
- <key>digital_diff_encoder_bb</key>
- <import>from gnuradio import digital</import>
- <make>digital.diff_encoder_bb($modulus)</make>
- <param>
- <name>Modulus</name>
- <key>modulus</key>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_diff_phasor_cc.block.yml b/gr-digital/grc/digital_diff_phasor_cc.block.yml
new file mode 100644
index 000000000..e63c71827
--- /dev/null
+++ b/gr-digital/grc/digital_diff_phasor_cc.block.yml
@@ -0,0 +1,16 @@
+id: digital_diff_phasor_cc
+label: Differential Phasor
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.diff_phasor_cc()
+
+file_format: 1
diff --git a/gr-digital/grc/digital_diff_phasor_cc.xml b/gr-digital/grc/digital_diff_phasor_cc.xml
deleted file mode 100644
index 506bf400b..000000000
--- a/gr-digital/grc/digital_diff_phasor_cc.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Differential Phasor
-###################################################
- -->
-<block>
- <name>Differential Phasor</name>
- <key>digital_diff_phasor_cc</key>
- <import>from gnuradio import digital</import>
- <make>digital.diff_phasor_cc()</make>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_dxpsk_demod.block.yml b/gr-digital/grc/digital_dxpsk_demod.block.yml
new file mode 100644
index 000000000..99e7f40e6
--- /dev/null
+++ b/gr-digital/grc/digital_dxpsk_demod.block.yml
@@ -0,0 +1,75 @@
+id: digital_dxpsk_demod
+label: DPSK Demod
+category: '[Core]/Deprecated'
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [dbpsk, dqpsk]
+ option_labels: [DBPSK, DQPSK]
+- id: samples_per_symbol
+ label: Samples/Symbol
+ dtype: int
+ default: '2'
+- id: excess_bw
+ label: Excess BW
+ dtype: real
+ default: '0.35'
+- id: freq_bw
+ label: FLL Bandwidth
+ dtype: real
+ default: 6.28/100.0
+- id: phase_bw
+ label: Phase Loop Bandwidth
+ dtype: real
+ default: 6.28/100.0
+- id: timing_bw
+ label: Timing Bandwidth
+ dtype: real
+ default: 6.28/100.0
+- id: mod_code
+ label: Gray Code
+ dtype: enum
+ options: ['"gray"', '"none"']
+ option_labels: ['Yes', 'No']
+- id: verbose
+ label: Verbose
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(verbose) == 'False' else 'none') }
+- id: log
+ label: Log
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(log) == 'False' else 'none') }
+- id: sync_out
+ label: Sync Out
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: "digital.${type}_demod(\n\tsamples_per_symbol=${samples_per_symbol},\n\t\
+ excess_bw=${excess_bw},\n\tfreq_bw=${freq_bw},\n\tphase_bw=${phase_bw},\n\t\
+ timing_bw=${timing_bw},\n\tmod_code=${mod_code},\n\tverbose=${verbose},\n\t\
+ log=${log}\n)"
+ callbacks:
+ - clock_recov.set_loop_bandwidth(${phase_bw})
+ - time_recov.set_loop_bandwidth(${timing_bw})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_dxpsk_demod.xml b/gr-digital/grc/digital_dxpsk_demod.xml
deleted file mode 100644
index 12089ad77..000000000
--- a/gr-digital/grc/digital_dxpsk_demod.xml
+++ /dev/null
@@ -1,154 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2009,2010,2011 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##DPSK2 Mod - 2, 4
-###################################################
- -->
-<block>
- <name>DPSK Demod</name>
- <key>digital_dxpsk_demod</key>
- <category>[Core]/Deprecated</category>
- <import>from gnuradio import digital</import>
- <make>digital.$(type)_demod(
- samples_per_symbol=$samples_per_symbol,
- excess_bw=$excess_bw,
- freq_bw=$freq_bw,
- phase_bw=$phase_bw,
- timing_bw=$timing_bw,
- mod_code=$mod_code,
- verbose=$verbose,
- log=$log
-)</make>
- <callback>clock_recov.set_loop_bandwidth($phase_bw)</callback>
- <callback>time_recov.set_loop_bandwidth($timing_bw)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>DBPSK</name>
- <key>dbpsk</key>
- </option>
- <option>
- <name>DQPSK</name>
- <key>dqpsk</key>
- </option>
- </param>
- <param>
- <name>Samples/Symbol</name>
- <key>samples_per_symbol</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Excess BW</name>
- <key>excess_bw</key>
- <value>0.35</value>
- <type>real</type>
- </param>
- <param>
- <name>FLL Bandwidth</name>
- <key>freq_bw</key>
- <value>6.28/100.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Phase Loop Bandwidth</name>
- <key>phase_bw</key>
- <value>6.28/100.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Timing Bandwidth</name>
- <key>timing_bw</key>
- <value>6.28/100.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Gray Code</name>
- <key>mod_code</key>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>"gray"</key>
- </option>
- <option>
- <name>No</name>
- <key>"none"</key>
- </option>
- </param>
- <param>
- <name>Verbose</name>
- <key>verbose</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Log</name>
- <key>log</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($log) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Sync Out</name>
- <key>sync_out</key>
- <value>False</value>
- <type>bool</type>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_dxpsk_mod.block.yml b/gr-digital/grc/digital_dxpsk_mod.block.yml
new file mode 100644
index 000000000..577baa442
--- /dev/null
+++ b/gr-digital/grc/digital_dxpsk_mod.block.yml
@@ -0,0 +1,52 @@
+id: digital_dxpsk_mod
+label: DPSK Mod
+category: '[Core]/Deprecated'
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [dbpsk, dqpsk]
+ option_labels: [DBPSK, DQPSK]
+- id: samples_per_symbol
+ label: Samples/Symbol
+ dtype: int
+ default: '2'
+- id: excess_bw
+ label: Excess BW
+ dtype: real
+ default: '0.35'
+- id: mod_code
+ label: Gray Code
+ dtype: enum
+ options: ['"gray"', '"none"']
+ option_labels: ['Yes', 'No']
+- id: verbose
+ label: Verbose
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(verbose) == 'False' else 'none') }
+- id: log
+ label: Log
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(log) == 'False' else 'none') }
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import digital
+ make: "digital.${type}_mod(\n\tsamples_per_symbol=${samples_per_symbol},\n\texcess_bw=${excess_bw},\n\
+ \tmod_code=${mod_code},\n\tverbose=${verbose},\n\tlog=${log})\n\t"
+
+file_format: 1
diff --git a/gr-digital/grc/digital_dxpsk_mod.xml b/gr-digital/grc/digital_dxpsk_mod.xml
deleted file mode 100644
index 4198b8805..000000000
--- a/gr-digital/grc/digital_dxpsk_mod.xml
+++ /dev/null
@@ -1,117 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2009,2010,2011 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-## DPSK Mod - 2, 4
-###################################################
- -->
-<block>
- <name>DPSK Mod</name>
- <key>digital_dxpsk_mod</key>
- <category>[Core]/Deprecated</category>
- <import>from gnuradio import digital</import>
- <make>digital.$(type)_mod(
- samples_per_symbol=$samples_per_symbol,
- excess_bw=$excess_bw,
- mod_code=$mod_code,
- verbose=$verbose,
- log=$log)
- </make>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>DBPSK</name>
- <key>dbpsk</key>
- </option>
- <option>
- <name>DQPSK</name>
- <key>dqpsk</key>
- </option>
- </param>
- <param>
- <name>Samples/Symbol</name>
- <key>samples_per_symbol</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Excess BW</name>
- <key>excess_bw</key>
- <value>0.35</value>
- <type>real</type>
- </param>
- <param>
- <name>Gray Code</name>
- <key>mod_code</key>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>"gray"</key>
- </option>
- <option>
- <name>No</name>
- <key>"none"</key>
- </option>
- </param>
- <param>
- <name>Verbose</name>
- <key>verbose</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Log</name>
- <key>log</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($log) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_fll_band_edge_cc.block.yml b/gr-digital/grc/digital_fll_band_edge_cc.block.yml
new file mode 100644
index 000000000..63b64912b
--- /dev/null
+++ b/gr-digital/grc/digital_fll_band_edge_cc.block.yml
@@ -0,0 +1,53 @@
+id: digital_fll_band_edge_cc
+label: FLL Band-Edge
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [cc]
+ option_labels: [Complex->Complex]
+ option_attributes:
+ input: [complex]
+ output: [complex]
+ hide: part
+- id: samps_per_sym
+ label: Samples Per Symbol
+ dtype: real
+- id: rolloff
+ label: Filter Rolloff Factor
+ dtype: real
+- id: filter_size
+ label: Prototype Filter Size
+ dtype: int
+- id: w
+ label: Loop Bandwidth
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+- label: freq
+ domain: stream
+ dtype: float
+ optional: true
+- label: phase
+ domain: stream
+ dtype: float
+ optional: true
+- label: error
+ domain: stream
+ dtype: float
+ optional: true
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.fll_band_edge_cc(${samps_per_sym}, ${rolloff}, ${filter_size}, ${w})
+ callbacks:
+ - set_loop_bandwidth(${w})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_fll_band_edge_cc.xml b/gr-digital/grc/digital_fll_band_edge_cc.xml
deleted file mode 100644
index e4da773db..000000000
--- a/gr-digital/grc/digital_fll_band_edge_cc.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## FLL using Band-Edge Filters
-###################################################
- -->
-<block>
- <name>FLL Band-Edge</name>
- <key>digital_fll_band_edge_cc</key>
- <import>from gnuradio import digital</import>
- <make>digital.fll_band_edge_cc($samps_per_sym, $rolloff, $filter_size, $w)</make>
- <callback>set_loop_bandwidth($w)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex->Complex</name>
- <key>cc</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- </option>
- </param>
-
- <param>
- <name>Samples Per Symbol</name>
- <key>samps_per_sym</key>
- <type>real</type>
- </param>
- <param>
- <name>Filter Rolloff Factor</name>
- <key>rolloff</key>
- <type>real</type>
- </param>
- <param>
- <name>Prototype Filter Size</name>
- <key>filter_size</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Loop Bandwidth</name>
- <key>w</key>
- <type>real</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
- <source>
- <name>freq</name>
- <type>float</type>
- <optional>1</optional>
- </source>
- <source>
- <name>phase</name>
- <type>float</type>
- <optional>1</optional>
- </source>
- <source>
- <name>error</name>
- <type>float</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_framer_sink_1.block.yml b/gr-digital/grc/digital_framer_sink_1.block.yml
new file mode 100644
index 000000000..a05a1bf0e
--- /dev/null
+++ b/gr-digital/grc/digital_framer_sink_1.block.yml
@@ -0,0 +1,17 @@
+id: digital_framer_sink_1
+label: Framer Sink 1
+
+parameters:
+- id: target_queue
+ label: Target Message Queue
+ dtype: raw
+
+inputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.framer_sink_1(${target_queue})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_framer_sink_1.xml b/gr-digital/grc/digital_framer_sink_1.xml
deleted file mode 100644
index 9124e6d0d..000000000
--- a/gr-digital/grc/digital_framer_sink_1.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Framer Sink 1
-###################################################
- -->
-<block>
- <name>Framer Sink 1</name>
- <key>digital_framer_sink_1</key>
- <import>from gnuradio import digital</import>
- <make>digital.framer_sink_1($target_queue)</make>
- <param>
- <name>Target Message Queue</name>
- <key>target_queue</key>
- <type>raw</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
-</block>
diff --git a/gr-digital/grc/digital_gfsk_demod.block.yml b/gr-digital/grc/digital_gfsk_demod.block.yml
new file mode 100644
index 000000000..9f6b33c6a
--- /dev/null
+++ b/gr-digital/grc/digital_gfsk_demod.block.yml
@@ -0,0 +1,58 @@
+id: digital_gfsk_demod
+label: GFSK Demod
+
+parameters:
+- id: samples_per_symbol
+ label: Samples/Symbol
+ dtype: int
+ default: '2'
+- id: sensitivity
+ label: Sensitivity
+ dtype: real
+ default: '1.0'
+- id: gain_mu
+ label: Gain Mu
+ dtype: real
+ default: '0.175'
+- id: mu
+ label: Mu
+ dtype: real
+ default: '0.5'
+- id: omega_relative_limit
+ label: Omega Relative Limit
+ dtype: real
+ default: '0.005'
+- id: freq_error
+ label: Freq Error
+ dtype: real
+ default: '0.0'
+- id: verbose
+ label: Verbose
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(verbose) == 'False' else 'none') }
+- id: log
+ label: Log
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(log) == 'False' else 'none') }
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: "digital.gfsk_demod(\n\tsamples_per_symbol=${samples_per_symbol},\n\tsensitivity=${sensitivity},\n\
+ \tgain_mu=${gain_mu},\n\tmu=${mu},\n\tomega_relative_limit=${omega_relative_limit},\n\
+ \tfreq_error=${freq_error},\n\tverbose=${verbose},\n\tlog=${log},\n)"
+
+file_format: 1
diff --git a/gr-digital/grc/digital_gfsk_demod.xml b/gr-digital/grc/digital_gfsk_demod.xml
deleted file mode 100644
index cbea39e63..000000000
--- a/gr-digital/grc/digital_gfsk_demod.xml
+++ /dev/null
@@ -1,95 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##GFSK Demod
-###################################################
- -->
-<block>
- <name>GFSK Demod</name>
- <key>digital_gfsk_demod</key>
- <import>from gnuradio import digital</import>
- <make>digital.gfsk_demod(
- samples_per_symbol=$samples_per_symbol,
- sensitivity=$sensitivity,
- gain_mu=$gain_mu,
- mu=$mu,
- omega_relative_limit=$omega_relative_limit,
- freq_error=$freq_error,
- verbose=$verbose,
- log=$log,
-)</make>
- <param>
- <name>Samples/Symbol</name>
- <key>samples_per_symbol</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Sensitivity</name>
- <key>sensitivity</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Gain Mu</name>
- <key>gain_mu</key>
- <value>0.175</value>
- <type>real</type>
- </param>
- <param>
- <name>Mu</name>
- <key>mu</key>
- <value>0.5</value>
- <type>real</type>
- </param>
- <param>
- <name>Omega Relative Limit</name>
- <key>omega_relative_limit</key>
- <value>0.005</value>
- <type>real</type>
- </param>
- <param>
- <name>Freq Error</name>
- <key>freq_error</key>
- <value>0.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Verbose</name>
- <key>verbose</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Log</name>
- <key>log</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($log) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_gfsk_mod.block.yml b/gr-digital/grc/digital_gfsk_mod.block.yml
new file mode 100644
index 000000000..3dda769a4
--- /dev/null
+++ b/gr-digital/grc/digital_gfsk_mod.block.yml
@@ -0,0 +1,45 @@
+id: digital_gfsk_mod
+label: GFSK Mod
+
+parameters:
+- id: samples_per_symbol
+ label: Samples/Symbol
+ dtype: int
+ default: '2'
+- id: sensitivity
+ label: Sensitivity
+ dtype: real
+ default: '1.0'
+- id: bt
+ label: BT
+ dtype: real
+ default: '0.35'
+- id: verbose
+ label: Verbose
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(verbose) == 'False' else 'none') }
+- id: log
+ label: Log
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(log) == 'False' else 'none') }
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import digital
+ make: "digital.gfsk_mod(\n\tsamples_per_symbol=${samples_per_symbol},\n\tsensitivity=${sensitivity},\n\
+ \tbt=${bt},\n\tverbose=${verbose},\n\tlog=${log},\n)"
+
+file_format: 1
diff --git a/gr-digital/grc/digital_gfsk_mod.xml b/gr-digital/grc/digital_gfsk_mod.xml
deleted file mode 100644
index 08e2c8479..000000000
--- a/gr-digital/grc/digital_gfsk_mod.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##GFSK Mod
-###################################################
- -->
-<block>
- <name>GFSK Mod</name>
- <key>digital_gfsk_mod</key>
- <import>from gnuradio import digital</import>
- <make>digital.gfsk_mod(
- samples_per_symbol=$samples_per_symbol,
- sensitivity=$sensitivity,
- bt=$bt,
- verbose=$verbose,
- log=$log,
-)</make>
- <param>
- <name>Samples/Symbol</name>
- <key>samples_per_symbol</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Sensitivity</name>
- <key>sensitivity</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>BT</name>
- <key>bt</key>
- <value>0.35</value>
- <type>real</type>
- </param>
- <param>
- <name>Verbose</name>
- <key>verbose</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Log</name>
- <key>log</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($log) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_glfsr_source_x.block.yml b/gr-digital/grc/digital_glfsr_source_x.block.yml
new file mode 100644
index 000000000..716b77b02
--- /dev/null
+++ b/gr-digital/grc/digital_glfsr_source_x.block.yml
@@ -0,0 +1,37 @@
+id: digital_glfsr_source_x
+label: GLFSR Source
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [float, byte]
+ option_attributes:
+ fcn: [f, b]
+ hide: part
+- id: degree
+ label: Degree
+ dtype: int
+- id: repeat
+ label: Repeat
+ dtype: enum
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: mask
+ label: Mask
+ dtype: int
+ default: '0'
+- id: seed
+ label: Seed
+ dtype: int
+ default: '1'
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.glfsr_source_${type.fcn}(${degree}, ${repeat}, ${mask}, ${seed})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_glfsr_source_x.xml b/gr-digital/grc/digital_glfsr_source_x.xml
deleted file mode 100644
index 654dfa71c..000000000
--- a/gr-digital/grc/digital_glfsr_source_x.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##GLFSR Source
-###################################################
- -->
-<block>
- <name>GLFSR Source</name>
- <key>digital_glfsr_source_x</key>
- <import>from gnuradio import digital</import>
- <make>digital.glfsr_source_$(type.fcn)($degree, $repeat, $mask, $seed)</make>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:b</opt>
- </option>
- </param>
- <param>
- <name>Degree</name>
- <key>degree</key>
- <type>int</type>
- </param>
- <param>
- <name>Repeat</name>
- <key>repeat</key>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Mask</name>
- <key>mask</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>1</value>
- <type>int</type>
- </param>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_gmsk_demod.block.yml b/gr-digital/grc/digital_gmsk_demod.block.yml
new file mode 100644
index 000000000..bbd3b4148
--- /dev/null
+++ b/gr-digital/grc/digital_gmsk_demod.block.yml
@@ -0,0 +1,54 @@
+id: digital_gmsk_demod
+label: GMSK Demod
+
+parameters:
+- id: samples_per_symbol
+ label: Samples/Symbol
+ dtype: int
+ default: '2'
+- id: gain_mu
+ label: Gain Mu
+ dtype: real
+ default: '0.175'
+- id: mu
+ label: Mu
+ dtype: real
+ default: '0.5'
+- id: omega_relative_limit
+ label: Omega Relative Limit
+ dtype: real
+ default: '0.005'
+- id: freq_error
+ label: Freq Error
+ dtype: real
+ default: '0.0'
+- id: verbose
+ label: Verbose
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(verbose) == 'False' else 'none') }
+- id: log
+ label: Log
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(log) == 'False' else 'none') }
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: "digital.gmsk_demod(\n\tsamples_per_symbol=${samples_per_symbol},\n\tgain_mu=${gain_mu},\n\
+ \tmu=${mu},\n\tomega_relative_limit=${omega_relative_limit},\n\tfreq_error=${freq_error},\n\
+ \tverbose=${verbose},\n\tlog=${log},\n)"
+
+file_format: 1
diff --git a/gr-digital/grc/digital_gmsk_demod.xml b/gr-digital/grc/digital_gmsk_demod.xml
deleted file mode 100644
index 4d57f1a17..000000000
--- a/gr-digital/grc/digital_gmsk_demod.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##GMSK Demod
-###################################################
- -->
-<block>
- <name>GMSK Demod</name>
- <key>digital_gmsk_demod</key>
- <import>from gnuradio import digital</import>
- <make>digital.gmsk_demod(
- samples_per_symbol=$samples_per_symbol,
- gain_mu=$gain_mu,
- mu=$mu,
- omega_relative_limit=$omega_relative_limit,
- freq_error=$freq_error,
- verbose=$verbose,
- log=$log,
-)</make>
- <param>
- <name>Samples/Symbol</name>
- <key>samples_per_symbol</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Gain Mu</name>
- <key>gain_mu</key>
- <value>0.175</value>
- <type>real</type>
- </param>
- <param>
- <name>Mu</name>
- <key>mu</key>
- <value>0.5</value>
- <type>real</type>
- </param>
- <param>
- <name>Omega Relative Limit</name>
- <key>omega_relative_limit</key>
- <value>0.005</value>
- <type>real</type>
- </param>
- <param>
- <name>Freq Error</name>
- <key>freq_error</key>
- <value>0.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Verbose</name>
- <key>verbose</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Log</name>
- <key>log</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($log) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_gmsk_mod.block.yml b/gr-digital/grc/digital_gmsk_mod.block.yml
new file mode 100644
index 000000000..0b0941bae
--- /dev/null
+++ b/gr-digital/grc/digital_gmsk_mod.block.yml
@@ -0,0 +1,41 @@
+id: digital_gmsk_mod
+label: GMSK Mod
+
+parameters:
+- id: samples_per_symbol
+ label: Samples/Symbol
+ dtype: int
+ default: '2'
+- id: bt
+ label: BT
+ dtype: real
+ default: '0.35'
+- id: verbose
+ label: Verbose
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(verbose) == 'False' else 'none') }
+- id: log
+ label: Log
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(log) == 'False' else 'none') }
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import digital
+ make: "digital.gmsk_mod(\n\tsamples_per_symbol=${samples_per_symbol},\n\tbt=${bt},\n\
+ \tverbose=${verbose},\n\tlog=${log},\n)"
+
+file_format: 1
diff --git a/gr-digital/grc/digital_gmsk_mod.xml b/gr-digital/grc/digital_gmsk_mod.xml
deleted file mode 100644
index 77f52ca2f..000000000
--- a/gr-digital/grc/digital_gmsk_mod.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##GMSK Mod
-###################################################
- -->
-<block>
- <name>GMSK Mod</name>
- <key>digital_gmsk_mod</key>
- <import>from gnuradio import digital</import>
- <make>digital.gmsk_mod(
- samples_per_symbol=$samples_per_symbol,
- bt=$bt,
- verbose=$verbose,
- log=$log,
-)</make>
- <param>
- <name>Samples/Symbol</name>
- <key>samples_per_symbol</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>BT</name>
- <key>bt</key>
- <value>0.35</value>
- <type>real</type>
- </param>
- <param>
- <name>Verbose</name>
- <key>verbose</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Log</name>
- <key>log</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($log) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_gmskmod_bc.block.yml b/gr-digital/grc/digital_gmskmod_bc.block.yml
new file mode 100644
index 000000000..4b9a51107
--- /dev/null
+++ b/gr-digital/grc/digital_gmskmod_bc.block.yml
@@ -0,0 +1,30 @@
+id: digital_gmskmod_bc
+label: GMSK Modulator
+
+parameters:
+- id: samples_per_symbol
+ label: Samples/Symbol
+ dtype: int
+ default: '2'
+- id: bt
+ label: 3 dB Time-Bandwith Product
+ dtype: real
+ default: '0.3'
+- id: L
+ label: Pulse Duration (Symbols)
+ dtype: int
+ default: '4'
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.gmskmod_bc(${samples_per_symbol}, ${L}, ${bt})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_gmskmod_bc.xml b/gr-digital/grc/digital_gmskmod_bc.xml
deleted file mode 100644
index 6cda687f7..000000000
--- a/gr-digital/grc/digital_gmskmod_bc.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## GMSK
-###################################################
- -->
-<block>
- <name>GMSK Modulator</name>
- <key>digital_gmskmod_bc</key>
- <import>from gnuradio import digital</import>
- <make>digital.gmskmod_bc($samples_per_symbol, $L, $bt)</make>
- <param>
- <name>Samples/Symbol</name>
- <key>samples_per_symbol</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>3 dB Time-Bandwith Product</name>
- <key>bt</key>
- <value>0.3</value>
- <type>real</type>
- </param>
- <param>
- <name>Pulse Duration (Symbols)</name>
- <key>L</key>
- <value>4</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_hdlc_deframer_bp.block.yml b/gr-digital/grc/digital_hdlc_deframer_bp.block.yml
new file mode 100644
index 000000000..38b31ca53
--- /dev/null
+++ b/gr-digital/grc/digital_hdlc_deframer_bp.block.yml
@@ -0,0 +1,26 @@
+id: digital_hdlc_deframer_bp
+label: HDLC Deframer
+
+parameters:
+- id: min
+ label: Min length
+ dtype: int
+ default: '32'
+- id: max
+ label: Max length
+ dtype: int
+ default: '500'
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: message
+ id: out
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.hdlc_deframer_bp(${min}, ${max})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_hdlc_deframer_bp.xml b/gr-digital/grc/digital_hdlc_deframer_bp.xml
deleted file mode 100644
index 3e78b891d..000000000
--- a/gr-digital/grc/digital_hdlc_deframer_bp.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>HDLC Deframer</name>
- <key>digital_hdlc_deframer_bp</key>
- <import>from gnuradio import digital</import>
- <make>digital.hdlc_deframer_bp($min, $max)</make>
- <param>
- <name>Min length</name>
- <key>min</key>
- <value>32</value>
- <type>int</type>
- </param>
- <param>
- <name>Max length</name>
- <key>max</key>
- <value>500</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>message</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_hdlc_framer_pb.block.yml b/gr-digital/grc/digital_hdlc_framer_pb.block.yml
new file mode 100644
index 000000000..f775a489e
--- /dev/null
+++ b/gr-digital/grc/digital_hdlc_framer_pb.block.yml
@@ -0,0 +1,21 @@
+id: digital_hdlc_framer_pb
+label: HDLC Framer
+
+parameters:
+- id: frame_tag_name
+ label: Frame tag name
+ dtype: string
+
+inputs:
+- domain: message
+ id: in
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.hdlc_framer_pb(${frame_tag_name})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_hdlc_framer_pb.xml b/gr-digital/grc/digital_hdlc_framer_pb.xml
deleted file mode 100644
index 8dc122d58..000000000
--- a/gr-digital/grc/digital_hdlc_framer_pb.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>HDLC Framer</name>
- <key>digital_hdlc_framer_pb</key>
- <import>from gnuradio import digital</import>
- <make>digital.hdlc_framer_pb($frame_tag_name)</make>
- <param>
- <name>Frame tag name</name>
- <key>frame_tag_name</key>
- <type>string</type>
- </param>
- <sink>
- <name>in</name>
- <type>message</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_header_payload_demux.block.yml b/gr-digital/grc/digital_header_payload_demux.block.yml
new file mode 100644
index 000000000..4f69a08f2
--- /dev/null
+++ b/gr-digital/grc/digital_header_payload_demux.block.yml
@@ -0,0 +1,85 @@
+id: digital_header_payload_demux
+label: Header/Payload Demux
+
+parameters:
+- id: header_len
+ label: Header Length (Symbols)
+ dtype: int
+- id: header_padding
+ label: Header Padding (Uncertainty / Symbols)
+ dtype: int
+ default: '0'
+- id: items_per_symbol
+ label: Items per symbol
+ dtype: int
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: guard_interval
+ label: Guard Interval (items)
+ dtype: int
+ default: '0'
+ hide: ${ ('none' if guard_interval else 'part') }
+- id: length_tag_key
+ label: Length tag key
+ dtype: string
+ default: '"frame_len"'
+- id: trigger_tag_key
+ label: Trigger tag key
+ dtype: string
+ default: '""'
+ hide: ${ ('none' if trigger_tag_key else 'part') }
+- id: output_symbols
+ label: Output Format
+ dtype: enum
+ options: ['False', 'True']
+ option_labels: [Items, Symbols]
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ itemsize: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: timing_tag_key
+ label: Timing tag key
+ dtype: string
+ default: '"rx_time"'
+- id: samp_rate
+ label: Sampling Rate
+ dtype: int
+ default: samp_rate
+- id: special_tags
+ label: Special Tag Keys
+ dtype: raw
+ default: (,)
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+- label: trigger
+ domain: stream
+ dtype: byte
+ optional: true
+- domain: message
+ id: header_data
+
+outputs:
+- label: out_hdr
+ domain: stream
+ dtype: ${ type }
+ vlen: '${ {True: items_per_symbol, False: 1}[output_symbols] }'
+- label: out_payload
+ domain: stream
+ dtype: ${ type }
+ vlen: '${ {True: items_per_symbol, False: 1}[output_symbols] }'
+
+templates:
+ imports: from gnuradio import digital
+ make: "digital.header_payload_demux(\n\t ${header_len},\n\t ${items_per_symbol},\n\
+ \t ${guard_interval},\n\t ${length_tag_key},\n\t ${trigger_tag_key},\n\t\
+ \ ${output_symbols},\n\t ${type.itemsize},\n\t ${timing_tag_key},\n \
+ \ ${samp_rate},\n ${special_tags},\n ${header_padding},\n\
+ \ )"
+
+file_format: 1
diff --git a/gr-digital/grc/digital_header_payload_demux.xml b/gr-digital/grc/digital_header_payload_demux.xml
deleted file mode 100644
index a2fe80e62..000000000
--- a/gr-digital/grc/digital_header_payload_demux.xml
+++ /dev/null
@@ -1,138 +0,0 @@
-<block>
- <name>Header/Payload Demux</name>
- <key>digital_header_payload_demux</key>
- <import>from gnuradio import digital</import>
- <make>digital.header_payload_demux(
- $header_len,
- $items_per_symbol,
- $guard_interval,
- $length_tag_key,
- $trigger_tag_key,
- $output_symbols,
- $(type.itemsize),
- $timing_tag_key,
- $samp_rate,
- $special_tags,
- $header_padding,
- )</make>
- <param>
- <name>Header Length (Symbols)</name>
- <key>header_len</key>
- <type>int</type>
- </param>
- <param>
- <name>Header Padding (Uncertainty / Symbols)</name>
- <key>header_padding</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Items per symbol</name>
- <key>items_per_symbol</key>
- <type>int</type>
- </param>
- <param>
- <name>Guard Interval (items)</name>
- <key>guard_interval</key>
- <value>0</value>
- <type>int</type>
- <hide>#if $guard_interval then 'none' else 'part'#</hide>
- </param>
- <param>
- <name>Length tag key</name>
- <key>length_tag_key</key>
- <value>"frame_len"</value>
- <type>string</type>
- </param>
- <param>
- <name>Trigger tag key</name>
- <key>trigger_tag_key</key>
- <value>""</value>
- <type>string</type>
- <hide>#if $trigger_tag_key then 'none' else 'part'#</hide>
- </param>
- <param>
- <name>Output Format</name>
- <key>output_symbols</key>
- <type>enum</type>
- <option>
- <name>Items</name>
- <key>False</key>
- </option>
- <option>
- <name>Symbols</name>
- <key>True</key>
- </option>
- </param>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>itemsize:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>itemsize:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>itemsize:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>itemsize:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>itemsize:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Timing tag key</name>
- <key>timing_tag_key</key>
- <value>"rx_time"</value>
- <type>string</type>
- </param>
- <param>
- <name>Sampling Rate</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>int</type>
- </param>
- <param>
- <name>Special Tag Keys</name>
- <key>special_tags</key>
- <value>(,)</value>
- <type>raw</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <sink>
- <name>trigger</name>
- <type>byte</type>
- <optional>1</optional>
- </sink>
- <sink>
- <name>header_data</name>
- <type>message</type>
- </sink>
- <source>
- <name>out_hdr</name>
- <type>$type</type>
- <vlen>{True: $items_per_symbol, False: 1}[$output_symbols]</vlen>
- </source>
- <source>
- <name>out_payload</name>
- <type>$type</type>
- <vlen>{True: $items_per_symbol, False: 1}[$output_symbols]</vlen>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_kurtotic_equalizer_cc.block.yml b/gr-digital/grc/digital_kurtotic_equalizer_cc.block.yml
new file mode 100644
index 000000000..d81aee7d4
--- /dev/null
+++ b/gr-digital/grc/digital_kurtotic_equalizer_cc.block.yml
@@ -0,0 +1,26 @@
+id: digital_kurtotic_equalizer_cc
+label: Kurtotic Equalizer
+
+parameters:
+- id: num_taps
+ label: Num. Taps
+ dtype: int
+- id: mu
+ label: Mu
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.kurtotic_equalizer_cc(${num_taps}, ${mu})
+ callbacks:
+ - set_gain(${mu})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_kurtotic_equalizer_cc.xml b/gr-digital/grc/digital_kurtotic_equalizer_cc.xml
deleted file mode 100644
index 8c4a2012d..000000000
--- a/gr-digital/grc/digital_kurtotic_equalizer_cc.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Kurtotic Equalizer
-###################################################
- -->
-<block>
- <name>Kurtotic Equalizer</name>
- <key>digital_kurtotic_equalizer_cc</key>
- <import>from gnuradio import digital</import>
- <make>digital.kurtotic_equalizer_cc($num_taps, $mu)</make>
- <callback>set_gain($mu)</callback>
- <param>
- <name>Num. Taps</name>
- <key>num_taps</key>
- <type>int</type>
- </param>
- <param>
- <name>Mu</name>
- <key>mu</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_lms_dd_equalizer_cc.block.yml b/gr-digital/grc/digital_lms_dd_equalizer_cc.block.yml
new file mode 100644
index 000000000..1c44ea285
--- /dev/null
+++ b/gr-digital/grc/digital_lms_dd_equalizer_cc.block.yml
@@ -0,0 +1,32 @@
+id: digital_lms_dd_equalizer_cc
+label: LMS DD Equalizer
+
+parameters:
+- id: mu
+ label: Gain
+ dtype: real
+- id: num_taps
+ label: Num. Taps
+ dtype: int
+- id: sps
+ label: Samples per Symbol
+ dtype: int
+- id: cnst
+ label: Constellation Object
+ dtype: raw
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.lms_dd_equalizer_cc(${num_taps}, ${mu}, ${sps}, ${cnst})
+ callbacks:
+ - set_gain(${mu})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_lms_dd_equalizer_cc.xml b/gr-digital/grc/digital_lms_dd_equalizer_cc.xml
deleted file mode 100644
index 0fd7d523b..000000000
--- a/gr-digital/grc/digital_lms_dd_equalizer_cc.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## LMS DD Equalizer
-###################################################
- -->
-<block>
- <name>LMS DD Equalizer</name>
- <key>digital_lms_dd_equalizer_cc</key>
- <import>from gnuradio import digital</import>
- <make>digital.lms_dd_equalizer_cc($num_taps, $mu, $sps, $cnst)</make>
- <callback>set_gain($mu)</callback>
- <param>
- <name>Gain</name>
- <key>mu</key>
- <type>real</type>
- </param>
- <param>
- <name>Num. Taps</name>
- <key>num_taps</key>
- <type>int</type>
- </param>
- <param>
- <name>Samples per Symbol</name>
- <key>sps</key>
- <type>int</type>
- </param>
- <param>
- <name>Constellation Object</name>
- <key>cnst</key>
- <type>raw</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_map_bb.block.yml b/gr-digital/grc/digital_map_bb.block.yml
new file mode 100644
index 000000000..8f1a33fb0
--- /dev/null
+++ b/gr-digital/grc/digital_map_bb.block.yml
@@ -0,0 +1,21 @@
+id: digital_map_bb
+label: Map
+
+parameters:
+- id: map
+ label: Map
+ dtype: int_vector
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.map_bb(${map})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_map_bb.xml b/gr-digital/grc/digital_map_bb.xml
deleted file mode 100644
index 1435c5ac7..000000000
--- a/gr-digital/grc/digital_map_bb.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Map
-###################################################
- -->
-<block>
- <name>Map</name>
- <key>digital_map_bb</key>
- <import>from gnuradio import digital</import>
- <make>digital.map_bb($map)</make>
- <param>
- <name>Map</name>
- <key>map</key>
- <type>int_vector</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_modulate_vector.block.yml b/gr-digital/grc/digital_modulate_vector.block.yml
new file mode 100644
index 000000000..a06cc211c
--- /dev/null
+++ b/gr-digital/grc/digital_modulate_vector.block.yml
@@ -0,0 +1,22 @@
+id: variable_modulate_vector
+label: Modulate Vector
+category: Modulators
+
+parameters:
+- id: mod
+ label: Modulator
+ dtype: raw
+- id: data
+ label: Data vector
+ dtype: int_vector
+- id: taps
+ label: Filter taps
+ dtype: float_vector
+value: ${ digital.modulate_vector_bc(mod .to_basic_block(), data, taps) }
+
+templates:
+ imports: from gnuradio import digital
+ var_make: self.${id} = ${id} = digital.modulate_vector_bc(${mod} .to_basic_block(),
+ ${data}, ${taps})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_modulate_vector.xml b/gr-digital/grc/digital_modulate_vector.xml
deleted file mode 100644
index 91614dd3f..000000000
--- a/gr-digital/grc/digital_modulate_vector.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-# modulate_vector_bc
-###################################################
- -->
-<block>
- <name>Modulate Vector</name>
- <key>variable_modulate_vector</key>
- <category>Modulators</category>
- <import>from gnuradio import digital</import>
- <var_make>self.$(id) = $(id) = digital.modulate_vector_bc($mod .to_basic_block(), $data, $taps)</var_make>
- <var_value>digital.modulate_vector_bc($mod .to_basic_block(), $data, $taps)</var_value>
- <make></make>
-
- <param>
- <name>Modulator</name>
- <key>mod</key>
- <value></value>
- <type>raw</type>
- </param>
- <param>
- <name>Data vector</name>
- <key>data</key>
- <value></value>
- <type>int_vector</type>
- </param>
- <param>
- <name>Filter taps</name>
- <key>taps</key>
- <value></value>
- <type>float_vector</type>
- </param>
-</block>
diff --git a/gr-digital/grc/digital_mpsk_snr_est_cc.block.yml b/gr-digital/grc/digital_mpsk_snr_est_cc.block.yml
new file mode 100644
index 000000000..7c39a2492
--- /dev/null
+++ b/gr-digital/grc/digital_mpsk_snr_est_cc.block.yml
@@ -0,0 +1,35 @@
+id: digital_mpsk_snr_est_cc
+label: MPSK SNR Estimator
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: ['0', '1', '2', '3']
+ option_labels: [Simple, Skewness, 2nd and 4th Moment, SVR]
+- id: tag_nsamples
+ label: Samples between tags
+ dtype: int
+ default: '10000'
+- id: alpha
+ label: Filter Alpha
+ dtype: real
+ default: '0.001'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.mpsk_snr_est_cc(${type}, ${tag_nsamples}, ${alpha})
+ callbacks:
+ - set_type(${type})
+ - set_tag_nsamples(${tag_nsamples})
+ - set_alpha(${alpha})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_mpsk_snr_est_cc.xml b/gr-digital/grc/digital_mpsk_snr_est_cc.xml
deleted file mode 100644
index 6039e5b13..000000000
--- a/gr-digital/grc/digital_mpsk_snr_est_cc.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##MPSK SNR Estimator
-###################################################
- -->
-<block>
- <name>MPSK SNR Estimator</name>
- <key>digital_mpsk_snr_est_cc</key>
- <import>from gnuradio import digital</import>
- <make>digital.mpsk_snr_est_cc($type, $tag_nsamples, $alpha)</make>
- <callback>set_type($type)</callback>
- <callback>set_tag_nsamples($tag_nsamples)</callback>
- <callback>set_alpha($alpha)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Simple</name>
- <key>0</key>
- </option>
- <option>
- <name>Skewness</name>
- <key>1</key>
- </option>
- <option>
- <name>2nd and 4th Moment</name>
- <key>2</key>
- </option>
- <option>
- <name>SVR</name>
- <key>3</key>
- </option>
- </param>
- <param>
- <name>Samples between tags</name>
- <key>tag_nsamples</key>
- <value>10000</value>
- <type>int</type>
- </param>
- <param>
- <name>Filter Alpha</name>
- <key>alpha</key>
- <value>0.001</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_msk_timing_recovery_cc.block.yml b/gr-digital/grc/digital_msk_timing_recovery_cc.block.yml
new file mode 100644
index 000000000..3f5ae678c
--- /dev/null
+++ b/gr-digital/grc/digital_msk_timing_recovery_cc.block.yml
@@ -0,0 +1,42 @@
+id: digital_msk_timing_recovery_cc
+label: MSK Timing Recovery
+
+parameters:
+- id: gain
+ label: Gain
+ dtype: float
+- id: sps
+ label: Samples per symbol
+ dtype: float
+- id: limit
+ label: Error limit
+ dtype: float
+- id: osps
+ label: Output samples per symbol
+ dtype: int
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+- label: err
+ domain: stream
+ dtype: float
+ optional: true
+- label: omega
+ domain: stream
+ dtype: float
+ optional: true
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.msk_timing_recovery_cc(${sps}, ${gain}, ${limit}, ${osps})
+ callbacks:
+ - set_gain(${gain})
+ - set_sps(${sps})
+ - set_limit(${limit})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_msk_timing_recovery_cc.xml b/gr-digital/grc/digital_msk_timing_recovery_cc.xml
deleted file mode 100644
index cda780d68..000000000
--- a/gr-digital/grc/digital_msk_timing_recovery_cc.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>MSK Timing Recovery</name>
- <key>digital_msk_timing_recovery_cc</key>
- <import>from gnuradio import digital</import>
- <make>digital.msk_timing_recovery_cc($sps, $gain, $limit, $osps)</make>
- <callback>set_gain($gain)</callback>
- <callback>set_sps($sps)</callback>
- <callback>set_limit($limit)</callback>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <type>float</type>
- </param>
- <param>
- <name>Samples per symbol</name>
- <key>sps</key>
- <type>float</type>
- </param>
- <param>
- <name>Error limit</name>
- <key>limit</key>
- <type>float</type>
- </param>
- <param>
- <name>Output samples per symbol</name>
- <key>osps</key>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
- <source>
- <name>err</name>
- <type>float</type>
- <optional>1</optional>
- </source>
- <source>
- <name>omega</name>
- <type>float</type>
- <optional>1</optional>
- </source>
-
-</block>
diff --git a/gr-digital/grc/digital_ofdm_carrier_allocator_cvc.block.yml b/gr-digital/grc/digital_ofdm_carrier_allocator_cvc.block.yml
new file mode 100644
index 000000000..ab260ab9d
--- /dev/null
+++ b/gr-digital/grc/digital_ofdm_carrier_allocator_cvc.block.yml
@@ -0,0 +1,44 @@
+id: digital_ofdm_carrier_allocator_cvc
+label: OFDM Carrier Allocator
+
+parameters:
+- id: fft_len
+ label: FFT length
+ dtype: int
+ default: fft_len
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: occupied_carriers
+ label: Occupied Carriers
+ dtype: raw
+- id: pilot_carriers
+ label: Pilot Carriers
+ dtype: raw
+ default: ()
+- id: pilot_symbols
+ label: Pilot Symbols
+ dtype: raw
+ default: ()
+- id: sync_words
+ label: Sync Words
+ dtype: raw
+ default: ()
+- id: len_tag_key
+ label: Length tag key
+ dtype: string
+ default: '"packet_len"'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ fft_len }
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.ofdm_carrier_allocator_cvc(${fft_len}, ${occupied_carriers}, ${pilot_carriers},
+ ${pilot_symbols}, ${sync_words}, ${len_tag_key})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_ofdm_carrier_allocator_cvc.xml b/gr-digital/grc/digital_ofdm_carrier_allocator_cvc.xml
deleted file mode 100644
index b9bdde543..000000000
--- a/gr-digital/grc/digital_ofdm_carrier_allocator_cvc.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>OFDM Carrier Allocator</name>
- <key>digital_ofdm_carrier_allocator_cvc</key>
- <import>from gnuradio import digital</import>
- <make>digital.ofdm_carrier_allocator_cvc($fft_len, $occupied_carriers, $pilot_carriers, $pilot_symbols, $sync_words, $len_tag_key)</make>
- <param>
- <name>FFT length</name>
- <key>fft_len</key>
- <value>fft_len</value>
- <type>int</type>
- </param>
- <param>
- <name>Occupied Carriers</name>
- <key>occupied_carriers</key>
- <type>raw</type>
- </param>
- <param>
- <name>Pilot Carriers</name>
- <key>pilot_carriers</key>
- <value>()</value>
- <type>raw</type>
- </param>
- <param>
- <name>Pilot Symbols</name>
- <key>pilot_symbols</key>
- <value>()</value>
- <type>raw</type>
- </param>
- <param>
- <name>Sync Words</name>
- <key>sync_words</key>
- <value>()</value>
- <type>raw</type>
- </param>
- <param>
- <name>Length tag key</name>
- <key>len_tag_key</key>
- <value>"packet_len"</value>
- <type>string</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- <vlen>$fft_len</vlen>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_ofdm_chanest_vcvc.block.yml b/gr-digital/grc/digital_ofdm_chanest_vcvc.block.yml
new file mode 100644
index 000000000..352c6ab5a
--- /dev/null
+++ b/gr-digital/grc/digital_ofdm_chanest_vcvc.block.yml
@@ -0,0 +1,53 @@
+id: digital_ofdm_chanest_vcvc
+label: OFDM Channel Estimation
+
+parameters:
+- id: sync_symbol1
+ label: Synch. symbol 1
+ dtype: complex_vector
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: sync_symbol2
+ label: Synch. symbol 2
+ dtype: complex_vector
+ default: ()
+- id: n_data_symbols
+ label: Number of data symbols
+ dtype: int
+ default: '1'
+- id: eq_noise_red_len
+ label: Channel taps noise reduction length
+ dtype: int
+ default: '0'
+ hide: all
+- id: max_carr_offset
+ label: Maximum carrier offset
+ dtype: int
+ default: '-1'
+ hide: ${ ('part' if max_carr_offset < 0 else 'none') }
+- id: force_one_symbol
+ label: Force One Synchronisation Symbol
+ dtype: enum
+ options: ['False', 'True']
+ option_labels: ['No', 'Yes']
+ hide: ${ ('part' if not force_one_symbol else 'none') }
+
+inputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ len(sync_symbol1) }
+
+outputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ len(sync_symbol1) }
+
+asserts:
+- ${ len(sync_symbol1) }
+- ${ len(sync_symbol2) == 0 or len(sync_symbol2) == len(sync_symbol1) }
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.ofdm_chanest_vcvc(${sync_symbol1}, ${sync_symbol2}, ${n_data_symbols},
+ ${eq_noise_red_len}, ${max_carr_offset}, ${force_one_symbol})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_ofdm_chanest_vcvc.xml b/gr-digital/grc/digital_ofdm_chanest_vcvc.xml
deleted file mode 100644
index 5cc214545..000000000
--- a/gr-digital/grc/digital_ofdm_chanest_vcvc.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>OFDM Channel Estimation</name>
- <key>digital_ofdm_chanest_vcvc</key>
- <import>from gnuradio import digital</import>
- <make>digital.ofdm_chanest_vcvc($sync_symbol1, $sync_symbol2, $n_data_symbols, $eq_noise_red_len, $max_carr_offset, $force_one_symbol)</make>
- <param>
- <name>Synch. symbol 1</name>
- <key>sync_symbol1</key>
- <type>complex_vector</type>
- </param>
- <param>
- <name>Synch. symbol 2</name>
- <key>sync_symbol2</key>
- <value>()</value>
- <type>complex_vector</type>
- </param>
- <param>
- <name>Number of data symbols</name>
- <key>n_data_symbols</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Channel taps noise reduction length</name>
- <key>eq_noise_red_len</key>
- <value>0</value>
- <type>int</type>
- <hide>all</hide>
- </param>
- <param>
- <name>Maximum carrier offset</name>
- <key>max_carr_offset</key>
- <value>-1</value>
- <type>int</type>
- <hide>#if $max_carr_offset &lt; 0 then 'part' else 'none'#</hide>
- </param>
- <param>
- <name>Force One Synchronisation Symbol</name>
- <key>force_one_symbol</key>
- <type>enum</type>
- <hide>#if not $force_one_symbol then 'part' else 'none'#</hide>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- </param>
- <check>len($sync_symbol1)</check>
- <check>len($sync_symbol2) == 0 or len($sync_symbol2) == len($sync_symbol1)</check>
- <sink>
- <name>in</name>
- <type>complex</type>
- <vlen>len($sync_symbol1)</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- <vlen>len($sync_symbol1)</vlen>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_ofdm_cyclic_prefixer.block.yml b/gr-digital/grc/digital_ofdm_cyclic_prefixer.block.yml
new file mode 100644
index 000000000..cd475a060
--- /dev/null
+++ b/gr-digital/grc/digital_ofdm_cyclic_prefixer.block.yml
@@ -0,0 +1,38 @@
+id: digital_ofdm_cyclic_prefixer
+label: OFDM Cyclic Prefixer
+
+parameters:
+- id: input_size
+ label: FFT Length
+ dtype: int
+ default: fft_len
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: cp_len
+ label: CP Length
+ dtype: int
+ default: fft_len/4
+- id: rolloff
+ label: Rolloff
+ dtype: int
+ default: '0'
+ hide: ${ ('none' if rolloff else 'part') }
+- id: tagname
+ label: Length Tag Key
+ dtype: string
+ default: '"frame_len"'
+
+inputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ input_size }
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.ofdm_cyclic_prefixer(${input_size}, ${input_size+cp_len}, ${rolloff},
+ ${tagname})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_ofdm_cyclic_prefixer.xml b/gr-digital/grc/digital_ofdm_cyclic_prefixer.xml
deleted file mode 100644
index ec5e02704..000000000
--- a/gr-digital/grc/digital_ofdm_cyclic_prefixer.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Copyright 2011 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##OFDM Cyclic Prefixer
-###################################################
- -->
-<block>
- <name>OFDM Cyclic Prefixer</name>
- <key>digital_ofdm_cyclic_prefixer</key>
- <import>from gnuradio import digital</import>
- <make>digital.ofdm_cyclic_prefixer($input_size, $input_size+$cp_len, $rolloff, $tagname)</make>
- <param>
- <name>FFT Length</name>
- <key>input_size</key>
- <value>fft_len</value>
- <type>int</type>
- </param>
- <param>
- <name>CP Length</name>
- <key>cp_len</key>
- <value>fft_len/4</value>
- <type>int</type>
- </param>
- <param>
- <name>Rolloff</name>
- <key>rolloff</key>
- <value>0</value>
- <type>int</type>
- <hide>#if $rolloff then 'none' else 'part'#</hide>
- </param>
- <param>
- <name>Length Tag Key</name>
- <key>tagname</key>
- <value>"frame_len"</value>
- <type>string</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- <vlen>$input_size</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_ofdm_frame_equalizer_vcvc.block.yml b/gr-digital/grc/digital_ofdm_frame_equalizer_vcvc.block.yml
new file mode 100644
index 000000000..b2eba18e6
--- /dev/null
+++ b/gr-digital/grc/digital_ofdm_frame_equalizer_vcvc.block.yml
@@ -0,0 +1,46 @@
+id: digital_ofdm_frame_equalizer_vcvc
+label: OFDM Frame Equalizer
+
+parameters:
+- id: fft_len
+ label: FFT length
+ dtype: int
+ default: fft_len
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: cp_len
+ label: CP length
+ dtype: int
+ default: fft_len/4
+- id: equalizer
+ label: Equalizer
+ dtype: raw
+- id: len_tag_key
+ label: Length Tag Key
+ dtype: string
+- id: propagate_channel_state
+ label: Propagate Channel State
+ dtype: enum
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: fixed_frame_len
+ label: Fixed frame length
+ dtype: int
+ default: '0'
+ hide: ${ ('none' if fixed_frame_len else 'part') }
+
+inputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ fft_len }
+
+outputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ fft_len }
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.ofdm_frame_equalizer_vcvc(${equalizer}, ${cp_len}, ${len_tag_key},
+ ${propagate_channel_state}, ${fixed_frame_len})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_ofdm_frame_equalizer_vcvc.xml b/gr-digital/grc/digital_ofdm_frame_equalizer_vcvc.xml
deleted file mode 100644
index 2a0c24e52..000000000
--- a/gr-digital/grc/digital_ofdm_frame_equalizer_vcvc.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<block>
- <name>OFDM Frame Equalizer</name>
- <key>digital_ofdm_frame_equalizer_vcvc</key>
- <import>from gnuradio import digital</import>
- <make>digital.ofdm_frame_equalizer_vcvc($equalizer, $cp_len, $len_tag_key, $propagate_channel_state, $fixed_frame_len)</make>
- <param>
- <name>FFT length</name>
- <key>fft_len</key>
- <value>fft_len</value>
- <type>int</type>
- </param>
- <param>
- <name>CP length</name>
- <key>cp_len</key>
- <value>fft_len/4</value>
- <type>int</type>
- </param>
- <param>
- <name>Equalizer</name>
- <key>equalizer</key>
- <type>raw</type>
- </param>
- <param>
- <name>Length Tag Key</name>
- <key>len_tag_key</key>
- <type>string</type>
- </param>
- <param>
- <name>Propagate Channel State</name>
- <key>propagate_channel_state</key>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Fixed frame length</name>
- <key>fixed_frame_len</key>
- <value>0</value>
- <type>int</type>
- <hide>#if $fixed_frame_len then 'none' else 'part'#</hide>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- <vlen>$fft_len</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- <vlen>$fft_len</vlen>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_ofdm_rx.block.yml b/gr-digital/grc/digital_ofdm_rx.block.yml
new file mode 100644
index 000000000..2a3928020
--- /dev/null
+++ b/gr-digital/grc/digital_ofdm_rx.block.yml
@@ -0,0 +1,95 @@
+id: digital_ofdm_rx
+label: OFDM Receiver
+
+parameters:
+- id: fft_len
+ label: FFT Length
+ dtype: int
+ default: '64'
+- id: cp_len
+ label: Cyclic Prefix Length
+ dtype: int
+ default: '16'
+- id: packet_len_key
+ label: Packet Length Tag Key
+ dtype: string
+ default: '"length"'
+- id: occupied_carriers
+ label: Occupied Carriers
+ dtype: raw
+ default: ()
+ hide: ${ 'none' if occupied_carriers else 'part' }
+- id: pilot_carriers
+ label: Pilot Carriers
+ dtype: raw
+ default: ()
+ hide: ${ 'none' if pilot_carriers else 'part' }
+- id: pilot_symbols
+ label: Pilot Symbols
+ dtype: raw
+ default: ()
+ hide: ${ 'none' if pilot_symbols else 'part' }
+- id: sync_word1
+ label: Sync Word 1
+ dtype: raw
+ default: ()
+ hide: ${ 'none' if sync_word1 else 'part' }
+- id: sync_word2
+ label: Sync Word 2
+ dtype: raw
+ default: ()
+ hide: ${ 'none' if sync_word2 else 'part' }
+- id: header_mod
+ label: Header Modulation
+ dtype: enum
+ options: ['"BPSK"', '"QPSK"']
+ option_labels: [BPSK, QPSK]
+ option_attributes:
+ bps: ['1', '2']
+- id: payload_mod
+ label: Payload Modulation
+ dtype: enum
+ options: ['"BPSK"', '"QPSK"', '"8-PSK"']
+ option_labels: [BPSK, QPSK, 8-PSK]
+ option_attributes:
+ bps: ['1', '2', '3']
+- id: scramble_bits
+ label: Scramble Bits
+ dtype: enum
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['No', 'Yes']
+ hide: ${ ('part' if scramble_bits else 'none') }
+- id: log
+ label: Log Debug Info
+ dtype: enum
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['No', 'Yes']
+ hide: ${ ('none' if log else 'part') }
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: byte
+
+asserts:
+- ${ fft_len > 0 }
+- ${ cp_len > 0 }
+- ${ cp_len < fft_len }
+
+templates:
+ imports: from gnuradio import digital
+ make: "digital.ofdm_rx(\n\t fft_len=${fft_len}, cp_len=${cp_len},\n\t frame_length_tag_key='frame_'+${packet_len_key},\n\
+ \t packet_length_tag_key=${packet_len_key},\n\t % if occupied_carriers:\n\
+ \t occupied_carriers=${occupied_carriers},\n\t % endif\n\t % if pilot_carriers:\n\
+ \t pilot_carriers=${pilot_carriers},\n\t % endif\n\t % if pilot_symbols:\n\
+ \t pilot_symbols=${pilot_symbols},\n\t % endif\n\t % if sync_word1:\n\t\
+ \ sync_word1=${sync_word1},\n\t % endif\n\t % if sync_word2:\n\t sync_word2=${sync_word2},\n\
+ \t % endif\n\t bps_header=${header_mod.bps},\n\t bps_payload=${payload_mod.bps},\n\
+ \t debug_log=${log},\n\t scramble_bits=${scramble_bits}\n\t )"
+
+file_format: 1
diff --git a/gr-digital/grc/digital_ofdm_rx.xml b/gr-digital/grc/digital_ofdm_rx.xml
deleted file mode 100644
index 9c2bf65e9..000000000
--- a/gr-digital/grc/digital_ofdm_rx.xml
+++ /dev/null
@@ -1,190 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>OFDM Receiver</name>
- <key>digital_ofdm_rx</key>
- <import>from gnuradio import digital</import>
- <make>digital.ofdm_rx(
- fft_len=$fft_len, cp_len=$cp_len,
- frame_length_tag_key='frame_'+$packet_len_key,
- packet_length_tag_key=$packet_len_key,
- #if $occupied_carriers()
- occupied_carriers=$occupied_carriers,
- #end if
- #if $pilot_carriers()
- pilot_carriers=$pilot_carriers,
- #end if
- #if $pilot_symbols()
- pilot_symbols=$pilot_symbols,
- #end if
- #if $sync_word1()
- sync_word1=$sync_word1,
- #end if
- #if $sync_word2()
- sync_word2=$sync_word2,
- #end if
- bps_header=$header_mod.bps,
- bps_payload=$payload_mod.bps,
- debug_log=$log,
- scramble_bits=$scramble_bits
- )</make>
- <param>
- <name>FFT Length</name>
- <key>fft_len</key>
- <value>64</value>
- <type>int</type>
- </param>
- <param>
- <name>Cyclic Prefix Length</name>
- <key>cp_len</key>
- <value>16</value>
- <type>int</type>
- </param>
- <param>
- <name>Packet Length Tag Key</name>
- <key>packet_len_key</key>
- <value>"length"</value>
- <type>string</type>
- </param>
- <param>
- <name>Occupied Carriers</name>
- <key>occupied_carriers</key>
- <value>()</value>
- <type>raw</type>
- <hide>
- #if $occupied_carriers()
- none
- #else
- part
- #end if
- </hide>
- </param>
- <param>
- <name>Pilot Carriers</name>
- <key>pilot_carriers</key>
- <value>()</value>
- <type>raw</type>
- <hide>
- #if $pilot_carriers()
- none
- #else
- part
- #end if
- </hide>
- </param>
- <param>
- <name>Pilot Symbols</name>
- <key>pilot_symbols</key>
- <value>()</value>
- <type>raw</type>
- <hide>
- #if $pilot_symbols()
- none
- #else
- part
- #end if
- </hide>
- </param>
- <param>
- <name>Sync Word 1</name>
- <key>sync_word1</key>
- <value>()</value>
- <type>raw</type>
- <hide>
- #if $sync_word1()
- none
- #else
- part
- #end if
- </hide>
- </param>
- <param>
- <name>Sync Word 2</name>
- <key>sync_word2</key>
- <value>()</value>
- <type>raw</type>
- <hide>
- #if $sync_word2()
- none
- #else
- part
- #end if
- </hide>
- </param>
- <param>
- <name>Header Modulation</name>
- <key>header_mod</key>
- <type>enum</type>
- <option>
- <name>BPSK</name>
- <key>"BPSK"</key>
- <opt>bps:1</opt>
- </option>
- <option>
- <name>QPSK</name>
- <key>"QPSK"</key>
- <opt>bps:2</opt>
- </option>
- </param>
- <param>
- <name>Payload Modulation</name>
- <key>payload_mod</key>
- <type>enum</type>
- <option>
- <name>BPSK</name>
- <key>"BPSK"</key>
- <opt>bps:1</opt>
- </option>
- <option>
- <name>QPSK</name>
- <key>"QPSK"</key>
- <opt>bps:2</opt>
- </option>
- <option>
- <name>8-PSK</name>
- <key>"8-PSK"</key>
- <opt>bps:3</opt>
- </option>
- </param>
- <param>
- <name>Scramble Bits</name>
- <key>scramble_bits</key>
- <value>False</value>
- <type>enum</type>
- <hide> #if $scramble_bits then 'part' else 'none'#</hide>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- </param>
- <param>
- <name>Log Debug Info</name>
- <key>log</key>
- <value>False</value>
- <type>enum</type>
- <hide> #if $log then 'none' else 'part'#</hide>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- </param>
- <check>$fft_len &gt; 0</check>
- <check>$cp_len &gt; 0</check>
- <check>$cp_len &lt; $fft_len</check>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
-
diff --git a/gr-digital/grc/digital_ofdm_serializer_vcc.block.yml b/gr-digital/grc/digital_ofdm_serializer_vcc.block.yml
new file mode 100644
index 000000000..d81dd569f
--- /dev/null
+++ b/gr-digital/grc/digital_ofdm_serializer_vcc.block.yml
@@ -0,0 +1,51 @@
+id: digital_ofdm_serializer_vcc
+label: OFDM Serializer
+
+parameters:
+- id: fft_len
+ label: FFT length
+ dtype: int
+ default: fft_len
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: occupied_carriers
+ label: Occupied Carriers
+ dtype: raw
+- id: len_tag_key
+ label: Length Tag Key
+ dtype: string
+- id: packet_len_tag_key
+ label: Packet Length Tag Key
+ dtype: string
+ default: '""'
+ hide: ${ ('none' if packet_len_tag_key else 'part') }
+- id: symbols_skipped
+ label: Symbols skipped
+ dtype: int
+ default: '0'
+ hide: ${ ('none' if symbols_skipped else 'part') }
+- id: carr_offset_key
+ label: Carrier Offset Key
+ dtype: string
+ default: '""'
+ hide: ${ ('none' if carr_offset_key else 'part') }
+- id: input_is_shifted
+ label: Input is shifted
+ dtype: bool
+ default: 'True'
+ hide: ${ ('part' if input_is_shifted else 'none') }
+
+inputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ fft_len }
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.ofdm_serializer_vcc(${fft_len}, ${occupied_carriers}, ${len_tag_key},
+ ${packet_len_tag_key}, ${symbols_skipped}, ${carr_offset_key}, ${input_is_shifted})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_ofdm_serializer_vcc.xml b/gr-digital/grc/digital_ofdm_serializer_vcc.xml
deleted file mode 100644
index 1c09cd94f..000000000
--- a/gr-digital/grc/digital_ofdm_serializer_vcc.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>OFDM Serializer</name>
- <key>digital_ofdm_serializer_vcc</key>
- <import>from gnuradio import digital</import>
- <make>digital.ofdm_serializer_vcc($fft_len, $occupied_carriers, $len_tag_key, $packet_len_tag_key, $symbols_skipped, $carr_offset_key, $input_is_shifted)</make>
- <param>
- <name>FFT length</name>
- <key>fft_len</key>
- <value>fft_len</value>
- <type>int</type>
- </param>
- <param>
- <name>Occupied Carriers</name>
- <key>occupied_carriers</key>
- <type>raw</type>
- </param>
- <param>
- <name>Length Tag Key</name>
- <key>len_tag_key</key>
- <type>string</type>
- </param>
- <param>
- <name>Packet Length Tag Key</name>
- <key>packet_len_tag_key</key>
- <value>""</value>
- <type>string</type>
- <hide>#if $packet_len_tag_key then 'none' else 'part'#</hide>
- </param>
- <param>
- <name>Symbols skipped</name>
- <key>symbols_skipped</key>
- <value>0</value>
- <type>int</type>
- <hide>#if $symbols_skipped then 'none' else 'part'#</hide>
- </param>
- <param>
- <name>Carrier Offset Key</name>
- <key>carr_offset_key</key>
- <value>""</value>
- <type>string</type>
- <hide>#if $carr_offset_key then 'none' else 'part'#</hide>
- </param>
- <param>
- <name>Input is shifted</name>
- <key>input_is_shifted</key>
- <value>True</value>
- <type>bool</type>
- <hide>#if $input_is_shifted then 'part' else 'none'#</hide>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- <vlen>$fft_len</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_ofdm_sync_sc_cfb.block.yml b/gr-digital/grc/digital_ofdm_sync_sc_cfb.block.yml
new file mode 100644
index 000000000..f1e2f3b13
--- /dev/null
+++ b/gr-digital/grc/digital_ofdm_sync_sc_cfb.block.yml
@@ -0,0 +1,35 @@
+id: digital_ofdm_sync_sc_cfb
+label: Schmidl & Cox OFDM synch.
+
+parameters:
+- id: fft_len
+ label: FFT length
+ dtype: int
+- id: cp_len
+ label: Cyclic Prefix length
+ dtype: int
+- id: use_even_carriers
+ label: Preamble Carriers
+ dtype: enum
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: [Odd, Even]
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- label: freq_offset
+ domain: stream
+ dtype: float
+- label: detect
+ domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.ofdm_sync_sc_cfb(${fft_len}, ${cp_len}, ${use_even_carriers})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_ofdm_sync_sc_cfb.xml b/gr-digital/grc/digital_ofdm_sync_sc_cfb.xml
deleted file mode 100644
index 4238df761..000000000
--- a/gr-digital/grc/digital_ofdm_sync_sc_cfb.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>Schmidl &amp; Cox OFDM synch.</name>
- <key>digital_ofdm_sync_sc_cfb</key>
- <import>from gnuradio import digital</import>
- <make>digital.ofdm_sync_sc_cfb($fft_len, $cp_len, $use_even_carriers)</make>
- <param>
- <name>FFT length</name>
- <key>fft_len</key>
- <type>int</type>
- </param>
- <param>
- <name>Cyclic Prefix length</name>
- <key>cp_len</key>
- <type>int</type>
- </param>
- <param>
- <name>Preamble Carriers</name>
- <key>use_even_carriers</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Odd</name>
- <key>False</key>
- </option>
- <option>
- <name>Even</name>
- <key>True</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>freq_offset</name>
- <type>float</type>
- </source>
- <source>
- <name>detect</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_ofdm_tx.block.yml b/gr-digital/grc/digital_ofdm_tx.block.yml
new file mode 100644
index 000000000..c81da0d27
--- /dev/null
+++ b/gr-digital/grc/digital_ofdm_tx.block.yml
@@ -0,0 +1,100 @@
+id: digital_ofdm_tx
+label: OFDM Transmitter
+
+parameters:
+- id: fft_len
+ label: FFT Length
+ dtype: int
+ default: '64'
+- id: cp_len
+ label: Cyclic Prefix Length
+ dtype: int
+ default: '16'
+- id: packet_len_key
+ label: Length Tag Name
+ dtype: string
+ default: length
+- id: occupied_carriers
+ label: Occupied Carriers
+ dtype: raw
+ default: ()
+ hide: ${ 'none' if occupied_carriers else 'part' }
+- id: pilot_carriers
+ label: Pilot Carriers
+ dtype: raw
+ default: ()
+ hide: ${ 'none' if pilot_carriers else 'part' }
+- id: pilot_symbols
+ label: Pilot Symbols
+ dtype: raw
+ default: ()
+ hide: ${ 'none' if pilot_symbols else 'part' }
+- id: sync_word1
+ label: Sync Word 1
+ dtype: raw
+ default: ()
+ hide: ${ 'none' if sync_word1 else 'part' }
+- id: sync_word2
+ label: Sync Word 2
+ dtype: raw
+ default: ()
+ hide: ${ 'none' if sync_word2 else 'part' }
+- id: header_mod
+ label: Header Modulation
+ dtype: enum
+ options: ['"BPSK"', '"QPSK"']
+ option_labels: [BPSK, QPSK]
+ option_attributes:
+ bps: ['1', '2']
+- id: payload_mod
+ label: Payload Modulation
+ dtype: enum
+ options: ['"BPSK"', '"QPSK"', '"8-PSK"']
+ option_labels: [BPSK, QPSK, 8-PSK]
+ option_attributes:
+ bps: ['1', '2', '3']
+- id: rolloff
+ label: Rolloff length (samples)
+ dtype: int
+ default: '0'
+- id: scramble_bits
+ label: Scramble Bits
+ dtype: enum
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['No', 'Yes']
+ hide: ${ ('part' if scramble_bits else 'none') }
+- id: log
+ label: Log Debug Info
+ dtype: enum
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['No', 'Yes']
+ hide: ${ ('none' if log else 'part') }
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: complex
+
+asserts:
+- ${ fft_len > 0 }
+- ${ cp_len > 0 }
+- ${ cp_len < fft_len }
+- ${ rolloff >= 0 }
+
+templates:
+ imports: from gnuradio import digital
+ make: "digital.ofdm_tx(\n\t fft_len=${fft_len}, cp_len=${cp_len},\n\t packet_length_tag_key=${packet_len_key},\n\
+ \t % if occupied_carriers:\n\t occupied_carriers=${occupied_carriers},\n\
+ \t % endif\n\t % if pilot_carriers:\n\t pilot_carriers=${pilot_carriers},\n\
+ \t % endif\n\t % if pilot_carriers:\n\t pilot_symbols=${pilot_symbols},\n\
+ \t % endif\n\t % if sync_word1:\n\t sync_word1=${sync_word1},\n\t % endif\n\
+ \t % if sync_word2:\n\t sync_word2=${sync_word2},\n\t % endif\n\t bps_header=${header_mod.bps},\n\
+ \t bps_payload=${payload_mod.bps},\n\t rolloff=${rolloff},\n\t debug_log=${log},\n\
+ \t scramble_bits=${scramble_bits}\n\t )"
+
+file_format: 1
diff --git a/gr-digital/grc/digital_ofdm_tx.xml b/gr-digital/grc/digital_ofdm_tx.xml
deleted file mode 100644
index bad0b2b13..000000000
--- a/gr-digital/grc/digital_ofdm_tx.xml
+++ /dev/null
@@ -1,196 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>OFDM Transmitter</name>
- <key>digital_ofdm_tx</key>
- <import>from gnuradio import digital</import>
- <make>digital.ofdm_tx(
- fft_len=$fft_len, cp_len=$cp_len,
- packet_length_tag_key=$packet_len_key,
- #if $occupied_carriers()
- occupied_carriers=$occupied_carriers,
- #end if
- #if $pilot_carriers()
- pilot_carriers=$pilot_carriers,
- #end if
- #if $pilot_carriers()
- pilot_symbols=$pilot_symbols,
- #end if
- #if $sync_word1()
- sync_word1=$sync_word1,
- #end if
- #if $sync_word2()
- sync_word2=$sync_word2,
- #end if
- bps_header=$header_mod.bps,
- bps_payload=$payload_mod.bps,
- rolloff=$rolloff,
- debug_log=$log,
- scramble_bits=$scramble_bits
- )</make>
- <param>
- <name>FFT Length</name>
- <key>fft_len</key>
- <value>64</value>
- <type>int</type>
- </param>
- <param>
- <name>Cyclic Prefix Length</name>
- <key>cp_len</key>
- <value>16</value>
- <type>int</type>
- </param>
- <param>
- <name>Length Tag Name</name>
- <key>packet_len_key</key>
- <value>length</value>
- <type>string</type>
- </param>
- <param>
- <name>Occupied Carriers</name>
- <key>occupied_carriers</key>
- <value>()</value>
- <type>raw</type>
- <hide>
- #if $occupied_carriers()
- none
- #else
- part
- #end if
- </hide>
- </param>
- <param>
- <name>Pilot Carriers</name>
- <key>pilot_carriers</key>
- <value>()</value>
- <type>raw</type>
- <hide>
- #if $pilot_carriers()
- none
- #else
- part
- #end if
- </hide>
- </param>
- <param>
- <name>Pilot Symbols</name>
- <key>pilot_symbols</key>
- <value>()</value>
- <type>raw</type>
- <hide>
- #if $pilot_symbols()
- none
- #else
- part
- #end if
- </hide>
- </param>
- <param>
- <name>Sync Word 1</name>
- <key>sync_word1</key>
- <value>()</value>
- <type>raw</type>
- <hide>
- #if $sync_word1()
- none
- #else
- part
- #end if
- </hide>
- </param>
- <param>
- <name>Sync Word 2</name>
- <key>sync_word2</key>
- <value>()</value>
- <type>raw</type>
- <hide>
- #if $sync_word2()
- none
- #else
- part
- #end if
- </hide>
- </param>
- <param>
- <name>Header Modulation</name>
- <key>header_mod</key>
- <type>enum</type>
- <option>
- <name>BPSK</name>
- <key>"BPSK"</key>
- <opt>bps:1</opt>
- </option>
- <option>
- <name>QPSK</name>
- <key>"QPSK"</key>
- <opt>bps:2</opt>
- </option>
- </param>
- <param>
- <name>Payload Modulation</name>
- <key>payload_mod</key>
- <type>enum</type>
- <option>
- <name>BPSK</name>
- <key>"BPSK"</key>
- <opt>bps:1</opt>
- </option>
- <option>
- <name>QPSK</name>
- <key>"QPSK"</key>
- <opt>bps:2</opt>
- </option>
- <option>
- <name>8-PSK</name>
- <key>"8-PSK"</key>
- <opt>bps:3</opt>
- </option>
- </param>
- <param>
- <name>Rolloff length (samples)</name>
- <key>rolloff</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Scramble Bits</name>
- <key>scramble_bits</key>
- <value>False</value>
- <type>enum</type>
- <hide> #if $scramble_bits then 'part' else 'none'#</hide>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- </param>
- <param>
- <name>Log Debug Info</name>
- <key>log</key>
- <value>False</value>
- <type>enum</type>
- <hide> #if $log then 'none' else 'part'#</hide>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- </param>
- <check>$fft_len &gt; 0</check>
- <check>$cp_len &gt; 0</check>
- <check>$cp_len &lt; $fft_len</check>
- <check>$rolloff &gt;= 0</check>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_packet_headergenerator_bb.block.yml b/gr-digital/grc/digital_packet_headergenerator_bb.block.yml
new file mode 100644
index 000000000..d77530450
--- /dev/null
+++ b/gr-digital/grc/digital_packet_headergenerator_bb.block.yml
@@ -0,0 +1,27 @@
+id: digital_packet_headergenerator_bb
+label: Packet Header Generator
+
+parameters:
+- id: header_formatter
+ label: Formatter Object
+ dtype: raw
+- id: len_tag_key
+ label: Length Tag Name
+ dtype: string
+ default: '"packet_len"'
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.packet_headergenerator_bb(${header_formatter}, ${len_tag_key})
+ callbacks:
+ - set_header_formatter(${header_formatter})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_packet_headergenerator_bb.xml b/gr-digital/grc/digital_packet_headergenerator_bb.xml
deleted file mode 100644
index f069b52a0..000000000
--- a/gr-digital/grc/digital_packet_headergenerator_bb.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<block>
- <name>Packet Header Generator</name>
- <key>digital_packet_headergenerator_bb</key>
- <import>from gnuradio import digital</import>
- <make>digital.packet_headergenerator_bb($header_formatter, $len_tag_key)</make>
- <callback>set_header_formatter($header_formatter)</callback>
- <param>
- <name>Formatter Object</name>
- <key>header_formatter</key>
- <type>raw</type>
- </param>
- <param>
- <name>Length Tag Name</name>
- <key>len_tag_key</key>
- <value>"packet_len"</value>
- <type>string</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_packet_headergenerator_bb_default.block.yml b/gr-digital/grc/digital_packet_headergenerator_bb_default.block.yml
new file mode 100644
index 000000000..f9af16aca
--- /dev/null
+++ b/gr-digital/grc/digital_packet_headergenerator_bb_default.block.yml
@@ -0,0 +1,25 @@
+id: digital_packet_headergenerator_bb_default
+label: Packet Header Generator (Default)
+
+parameters:
+- id: header_len
+ label: Header Length
+ dtype: int
+- id: len_tag_key
+ label: Length Tag Name
+ dtype: string
+ default: '"packet_len"'
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.packet_headergenerator_bb(${header_len}, ${len_tag_key})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_packet_headergenerator_bb_default.xml b/gr-digital/grc/digital_packet_headergenerator_bb_default.xml
deleted file mode 100644
index e89c340bf..000000000
--- a/gr-digital/grc/digital_packet_headergenerator_bb_default.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<block>
- <name>Packet Header Generator (Default)</name>
- <key>digital_packet_headergenerator_bb_default</key>
- <import>from gnuradio import digital</import>
- <make>digital.packet_headergenerator_bb($header_len, $len_tag_key)</make>
- <param>
- <name>Header Length</name>
- <key>header_len</key>
- <type>int</type>
- </param>
- <param>
- <name>Length Tag Name</name>
- <key>len_tag_key</key>
- <value>"packet_len"</value>
- <type>string</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
-
diff --git a/gr-digital/grc/digital_packet_headerparser_b.block.yml b/gr-digital/grc/digital_packet_headerparser_b.block.yml
new file mode 100644
index 000000000..f3a474108
--- /dev/null
+++ b/gr-digital/grc/digital_packet_headerparser_b.block.yml
@@ -0,0 +1,21 @@
+id: digital_packet_headerparser_b
+label: Packet Header Parser
+
+parameters:
+- id: header_formatter
+ label: Formatter Object
+ dtype: raw
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: message
+ id: header_data
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.packet_headerparser_b(${header_formatter})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_packet_headerparser_b.xml b/gr-digital/grc/digital_packet_headerparser_b.xml
deleted file mode 100644
index bab6bd22e..000000000
--- a/gr-digital/grc/digital_packet_headerparser_b.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<block>
- <name>Packet Header Parser</name>
- <key>digital_packet_headerparser_b</key>
- <import>from gnuradio import digital</import>
- <make>digital.packet_headerparser_b($header_formatter)</make>
- <param>
- <name>Formatter Object</name>
- <key>header_formatter</key>
- <type>raw</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>header_data</name>
- <type>message</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_packet_headerparser_b_default.block.yml b/gr-digital/grc/digital_packet_headerparser_b_default.block.yml
new file mode 100644
index 000000000..903a23cf3
--- /dev/null
+++ b/gr-digital/grc/digital_packet_headerparser_b_default.block.yml
@@ -0,0 +1,25 @@
+id: digital_packet_headerparser_b_default
+label: Packet Header Parser (Default)
+
+parameters:
+- id: header_len
+ label: Header Length
+ dtype: int
+- id: len_tag_key
+ label: Length Tag Name
+ dtype: string
+ default: '"packet_len"'
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: message
+ id: header_data
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.packet_headerparser_b(${header_len}, ${len_tag_key})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_packet_headerparser_b_default.xml b/gr-digital/grc/digital_packet_headerparser_b_default.xml
deleted file mode 100644
index 81a33ed77..000000000
--- a/gr-digital/grc/digital_packet_headerparser_b_default.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<block>
- <name>Packet Header Parser (Default)</name>
- <key>digital_packet_headerparser_b_default</key>
- <import>from gnuradio import digital</import>
- <make>digital.packet_headerparser_b($header_len, $len_tag_key)</make>
- <param>
- <name>Header Length</name>
- <key>header_len</key>
- <type>int</type>
- </param>
- <param>
- <name>Length Tag Name</name>
- <key>len_tag_key</key>
- <value>"packet_len"</value>
- <type>string</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>header_data</name>
- <type>message</type>
- </source>
-</block>
-
diff --git a/gr-digital/grc/digital_packet_sink.block.yml b/gr-digital/grc/digital_packet_sink.block.yml
new file mode 100644
index 000000000..a603226af
--- /dev/null
+++ b/gr-digital/grc/digital_packet_sink.block.yml
@@ -0,0 +1,24 @@
+id: digital_packet_sink
+label: Packet Sink
+
+parameters:
+- id: sync_vector
+ label: Sync Vector
+ dtype: int_vector
+- id: target_queue
+ label: Target Message Queue
+ dtype: raw
+- id: threshold
+ label: Threshold
+ dtype: int
+ default: '-1'
+
+inputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.packet_sink(${sync_vector}, ${target_queue}, ${threshold})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_packet_sink.xml b/gr-digital/grc/digital_packet_sink.xml
deleted file mode 100644
index 2c6653d7e..000000000
--- a/gr-digital/grc/digital_packet_sink.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Packet Sink
-###################################################
- -->
-<block>
- <name>Packet Sink</name>
- <key>digital_packet_sink</key>
- <import>from gnuradio import digital</import>
- <make>digital.packet_sink($sync_vector, $target_queue, $threshold)</make>
- <param>
- <name>Sync Vector</name>
- <key>sync_vector</key>
- <type>int_vector</type>
- </param>
- <param>
- <name>Target Message Queue</name>
- <key>target_queue</key>
- <type>raw</type>
- </param>
- <param>
- <name>Threshold</name>
- <key>threshold</key>
- <value>-1</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
-</block>
diff --git a/gr-digital/grc/digital_pfb_clock_sync.block.yml b/gr-digital/grc/digital_pfb_clock_sync.block.yml
new file mode 100644
index 000000000..d9fbca844
--- /dev/null
+++ b/gr-digital/grc/digital_pfb_clock_sync.block.yml
@@ -0,0 +1,69 @@
+id: digital_pfb_clock_sync_xxx
+label: Polyphase Clock Sync
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [ccf, fff]
+ option_labels: [Complex->Complex (Real Taps), Float->Float (Real Taps)]
+ option_attributes:
+ input: [complex, float]
+ output: [complex, float]
+ taps: [real_vector, real_vector]
+ hide: part
+- id: sps
+ label: Samples/Symbol
+ dtype: real
+- id: loop_bw
+ label: Loop Bandwidth
+ dtype: real
+- id: taps
+ label: Taps
+ dtype: real_vector
+- id: filter_size
+ label: Filter Size
+ dtype: int
+ default: '32'
+- id: init_phase
+ label: Initial Phase
+ dtype: real
+ default: '16'
+- id: max_dev
+ label: Maximum Rate Deviation
+ dtype: real
+ default: '1.5'
+- id: osps
+ label: Output SPS
+ dtype: int
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+- label: err
+ domain: stream
+ dtype: float
+ optional: true
+- label: rate
+ domain: stream
+ dtype: float
+ optional: true
+- label: phase
+ domain: stream
+ dtype: float
+ optional: true
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.pfb_clock_sync_${type}(${sps}, ${loop_bw}, ${taps}, ${filter_size},
+ ${init_phase}, ${max_dev}, ${osps})
+ callbacks:
+ - update_taps(${taps})
+ - set_loop_bandwidth(${loop_bw})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_pfb_clock_sync.xml b/gr-digital/grc/digital_pfb_clock_sync.xml
deleted file mode 100644
index c54417f2c..000000000
--- a/gr-digital/grc/digital_pfb_clock_sync.xml
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Polyphase Filter based Clock Sync
-###################################################
- -->
-<block>
- <name>Polyphase Clock Sync</name>
- <key>digital_pfb_clock_sync_xxx</key>
- <import>from gnuradio import digital</import>
- <make>digital.pfb_clock_sync_$(type)($sps, $loop_bw, $taps, $filter_size, $init_phase, $max_dev, $osps)</make>
- <callback>update_taps($taps)</callback>
- <callback>set_loop_bandwidth($loop_bw)</callback>
-
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex->Complex (Real Taps)</name>
- <key>ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Float->Float (Real Taps)</name>
- <key>fff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- <opt>taps:real_vector</opt>
- </option>
- </param>
-
- <param>
- <name>Samples/Symbol</name>
- <key>sps</key>
- <type>real</type>
- </param>
- <param>
- <name>Loop Bandwidth</name>
- <key>loop_bw</key>
- <type>real</type>
- </param>
- <param>
- <name>Taps</name>
- <key>taps</key>
- <type>real_vector</type>
- </param>
- <param>
- <name>Filter Size</name>
- <key>filter_size</key>
- <value>32</value>
- <type>int</type>
- </param>
- <param>
- <name>Initial Phase</name>
- <key>init_phase</key>
- <value>16</value>
- <type>real</type>
- </param>
- <param>
- <name>Maximum Rate Deviation</name>
- <key>max_dev</key>
- <value>1.5</value>
- <type>real</type>
- </param>
- <param>
- <name>Output SPS</name>
- <key>osps</key>
- <value>1</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
- <source>
- <name>err</name>
- <type>float</type>
- <optional>1</optional>
- </source>
- <source>
- <name>rate</name>
- <type>float</type>
- <optional>1</optional>
- </source>
- <source>
- <name>phase</name>
- <type>float</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_pn_correlator_cc.block.yml b/gr-digital/grc/digital_pn_correlator_cc.block.yml
new file mode 100644
index 000000000..e92415433
--- /dev/null
+++ b/gr-digital/grc/digital_pn_correlator_cc.block.yml
@@ -0,0 +1,29 @@
+id: digital_pn_correlator_cc
+label: PN Correlator
+
+parameters:
+- id: degree
+ label: Degree
+ dtype: int
+- id: mask
+ label: Mask
+ dtype: int
+ default: '0'
+- id: seed
+ label: Seed
+ dtype: int
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.pn_correlator_cc(${degree}, ${mask}, ${seed})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_pn_correlator_cc.xml b/gr-digital/grc/digital_pn_correlator_cc.xml
deleted file mode 100644
index 999cea15d..000000000
--- a/gr-digital/grc/digital_pn_correlator_cc.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##PN Correlator
-###################################################
- -->
-<block>
- <name>PN Correlator</name>
- <key>digital_pn_correlator_cc</key>
- <import>from gnuradio import digital</import>
- <make>digital.pn_correlator_cc($degree, $mask, $seed)</make>
- <param>
- <name>Degree</name>
- <key>degree</key>
- <type>int</type>
- </param>
- <param>
- <name>Mask</name>
- <key>mask</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>1</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_probe_density_b.block.yml b/gr-digital/grc/digital_probe_density_b.block.yml
new file mode 100644
index 000000000..e329c6568
--- /dev/null
+++ b/gr-digital/grc/digital_probe_density_b.block.yml
@@ -0,0 +1,24 @@
+id: digital_probe_density_b
+label: Probe Density
+
+parameters:
+- id: alpha
+ label: Alpha
+ dtype: real
+ default: '1'
+- id: probe_rate
+ label: Probe Rate
+ dtype: real
+ default: '10'
+
+inputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.probe_density_b(${alpha})
+ callbacks:
+ - set_alpha(${alpha})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_probe_density_b.xml b/gr-digital/grc/digital_probe_density_b.xml
deleted file mode 100644
index 8cf5dd894..000000000
--- a/gr-digital/grc/digital_probe_density_b.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Probe Density
-###################################################
- -->
-<block>
- <name>Probe Density</name>
- <key>digital_probe_density_b</key>
- <import>from gnuradio import digital</import>
- <make>digital.probe_density_b($alpha)</make>
- <callback>set_alpha($alpha)</callback>
- <param>
- <name>Alpha</name>
- <key>alpha</key>
- <value>1</value>
- <type>real</type>
- </param>
- <param>
- <name>Probe Rate</name>
- <key>probe_rate</key>
- <value>10</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
-</block>
diff --git a/gr-digital/grc/digital_probe_mpsk_snr_est_c.block.yml b/gr-digital/grc/digital_probe_mpsk_snr_est_c.block.yml
new file mode 100644
index 000000000..68e29c1e7
--- /dev/null
+++ b/gr-digital/grc/digital_probe_mpsk_snr_est_c.block.yml
@@ -0,0 +1,42 @@
+id: digital_probe_mpsk_snr_est_c
+label: MPSK SNR Estimator Probe
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: ['0', '1', '2', '3']
+ option_labels: [Simple, Skewness, 2nd and 4th Moment, SVR]
+- id: msg_nsamples
+ label: Samples between SNR messages
+ dtype: int
+ default: '10000'
+- id: alpha
+ label: Filter Alpha
+ dtype: real
+ default: '0.001'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: message
+ id: snr
+ optional: true
+- domain: message
+ id: signal
+ optional: true
+- domain: message
+ id: noise
+ optional: true
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.probe_mpsk_snr_est_c(${type}, ${msg_nsamples}, ${alpha})
+ callbacks:
+ - set_type(${type})
+ - set_msg_nsample(${msg_nsamples})
+ - set_alpha(${alpha})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_probe_mpsk_snr_est_c.xml b/gr-digital/grc/digital_probe_mpsk_snr_est_c.xml
deleted file mode 100644
index e49f7e7f5..000000000
--- a/gr-digital/grc/digital_probe_mpsk_snr_est_c.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##MPSK SNR Estimator
-###################################################
- -->
-<block>
- <name>MPSK SNR Estimator Probe</name>
- <key>digital_probe_mpsk_snr_est_c</key>
- <import>from gnuradio import digital</import>
- <make>digital.probe_mpsk_snr_est_c($type, $msg_nsamples, $alpha)</make>
- <callback>set_type($type)</callback>
- <callback>set_msg_nsample($msg_nsamples)</callback>
- <callback>set_alpha($alpha)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Simple</name>
- <key>0</key>
- </option>
- <option>
- <name>Skewness</name>
- <key>1</key>
- </option>
- <option>
- <name>2nd and 4th Moment</name>
- <key>2</key>
- </option>
- <option>
- <name>SVR</name>
- <key>3</key>
- </option>
- </param>
- <param>
- <name>Samples between SNR messages</name>
- <key>msg_nsamples</key>
- <value>10000</value>
- <type>int</type>
- </param>
- <param>
- <name>Filter Alpha</name>
- <key>alpha</key>
- <value>0.001</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>snr</name>
- <type>message</type>
- <optional>1</optional>
- </source>
- <source>
- <name>signal</name>
- <type>message</type>
- <optional>1</optional>
- </source>
- <source>
- <name>noise</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_protocol_formatter_async.block.yml b/gr-digital/grc/digital_protocol_formatter_async.block.yml
new file mode 100644
index 000000000..29975522f
--- /dev/null
+++ b/gr-digital/grc/digital_protocol_formatter_async.block.yml
@@ -0,0 +1,26 @@
+id: digital_protocol_formatter_async
+label: Protocol Formatter (Async)
+
+parameters:
+- id: format
+ label: Format Obj.
+ dtype: raw
+
+inputs:
+- domain: message
+ id: in
+ optional: true
+
+outputs:
+- domain: message
+ id: header
+ optional: true
+- domain: message
+ id: payload
+ optional: true
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.protocol_formatter_async(${format})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_protocol_formatter_async.xml b/gr-digital/grc/digital_protocol_formatter_async.xml
deleted file mode 100644
index 52a67eca3..000000000
--- a/gr-digital/grc/digital_protocol_formatter_async.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0"?>
-
-<block>
- <name>Protocol Formatter (Async)</name>
- <key>digital_protocol_formatter_async</key>
- <import>from gnuradio import digital</import>
- <make>digital.protocol_formatter_async($format)</make>
-
- <param>
- <name>Format Obj.</name>
- <key>format</key>
- <type>raw</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
-
- <source>
- <name>header</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-
- <source>
- <name>payload</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-
-</block>
diff --git a/gr-digital/grc/digital_protocol_formatter_bb.block.yml b/gr-digital/grc/digital_protocol_formatter_bb.block.yml
new file mode 100644
index 000000000..9141b5208
--- /dev/null
+++ b/gr-digital/grc/digital_protocol_formatter_bb.block.yml
@@ -0,0 +1,25 @@
+id: digital_protocol_formatter_bb
+label: Protocol Formatter
+
+parameters:
+- id: format
+ label: Format Obj.
+ dtype: raw
+- id: len_tag_key
+ label: Length Tag Name
+ dtype: string
+ default: '"packet_len"'
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.protocol_formatter_bb(${format}, ${len_tag_key})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_protocol_formatter_bb.xml b/gr-digital/grc/digital_protocol_formatter_bb.xml
deleted file mode 100644
index b37a791fa..000000000
--- a/gr-digital/grc/digital_protocol_formatter_bb.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-
-<block>
- <name>Protocol Formatter</name>
- <key>digital_protocol_formatter_bb</key>
- <import>from gnuradio import digital</import>
- <make>digital.protocol_formatter_bb($format, $len_tag_key)</make>
-
- <param>
- <name>Format Obj.</name>
- <key>format</key>
- <type>raw</type>
- </param>
-
- <param>
- <name>Length Tag Name</name>
- <key>len_tag_key</key>
- <value>"packet_len"</value>
- <type>string</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-
-</block>
diff --git a/gr-digital/grc/digital_protocol_parser_b.block.yml b/gr-digital/grc/digital_protocol_parser_b.block.yml
new file mode 100644
index 000000000..b09e48086
--- /dev/null
+++ b/gr-digital/grc/digital_protocol_parser_b.block.yml
@@ -0,0 +1,22 @@
+id: digital_protocol_parser_b
+label: Protocol Parser
+
+parameters:
+- id: format
+ label: Format Obj.
+ dtype: raw
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: message
+ id: info
+ optional: true
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.protocol_parser_b(${format})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_protocol_parser_b.xml b/gr-digital/grc/digital_protocol_parser_b.xml
deleted file mode 100644
index 27fb15e05..000000000
--- a/gr-digital/grc/digital_protocol_parser_b.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-
-<block>
- <name>Protocol Parser</name>
- <key>digital_protocol_parser_b</key>
- <import>from gnuradio import digital</import>
- <make>digital.protocol_parser_b($format)</make>
-
- <param>
- <name>Format Obj.</name>
- <key>format</key>
- <type>raw</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
-
- <source>
- <name>info</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_psk_demod.block.yml b/gr-digital/grc/digital_psk_demod.block.yml
new file mode 100644
index 000000000..fbb5d6000
--- /dev/null
+++ b/gr-digital/grc/digital_psk_demod.block.yml
@@ -0,0 +1,79 @@
+id: digital_psk_demod
+label: PSK Demod
+category: '[Core]/Deprecated'
+
+parameters:
+- id: constellation_points
+ label: Number of Constellation Points
+ dtype: int
+ default: '8'
+- id: differential
+ label: Differential Encoding
+ dtype: bool
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: samples_per_symbol
+ label: Samples/Symbol
+ dtype: int
+ default: '2'
+- id: excess_bw
+ label: Excess BW
+ dtype: real
+ default: '0.35'
+- id: freq_bw
+ label: Frequency BW
+ dtype: real
+ default: 6.28/100.0
+- id: timing_bw
+ label: Timing BW
+ dtype: real
+ default: 6.28/100.0
+- id: phase_bw
+ label: Phase BW
+ dtype: real
+ default: 6.28/100.0
+- id: mod_code
+ label: Gray Code
+ dtype: enum
+ options: ['"gray"', '"none"']
+ option_labels: ['Yes', 'No']
+- id: verbose
+ label: Verbose
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(verbose) == 'False' else 'none') }
+- id: log
+ label: Log
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(log) == 'False' else 'none') }
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: |-
+ digital.psk.psk_demod(
+ constellation_points=${constellation_points},
+ differential=${differential},
+ samples_per_symbol=${samples_per_symbol},
+ excess_bw=${excess_bw},
+ phase_bw=${phase_bw},
+ timing_bw=${timing_bw},
+ mod_code=${mod_code},
+ verbose=${verbose},
+ log=${log},
+ )
+
+file_format: 1
diff --git a/gr-digital/grc/digital_psk_demod.xml b/gr-digital/grc/digital_psk_demod.xml
deleted file mode 100644
index 02beed01a..000000000
--- a/gr-digital/grc/digital_psk_demod.xml
+++ /dev/null
@@ -1,146 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2009,2010,2011 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##PSK Demod
-###################################################
- -->
-<block>
- <name>PSK Demod</name>
- <key>digital_psk_demod</key>
- <category>[Core]/Deprecated</category>
- <import>from gnuradio import digital</import>
- <make>digital.psk.psk_demod(
- constellation_points=$constellation_points,
- differential=$differential,
- samples_per_symbol=$samples_per_symbol,
- excess_bw=$excess_bw,
- phase_bw=$phase_bw,
- timing_bw=$timing_bw,
- mod_code=$mod_code,
- verbose=$verbose,
- log=$log,
- )</make>
- <param>
- <name>Number of Constellation Points</name>
- <key>constellation_points</key>
- <value>8</value>
- <type>int</type>
- </param>
- <param>
- <name>Differential Encoding</name>
- <key>differential</key>
- <value>True</value>
- <type>bool</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Samples/Symbol</name>
- <key>samples_per_symbol</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Excess BW</name>
- <key>excess_bw</key>
- <value>0.35</value>
- <type>real</type>
- </param>
- <param>
- <name>Frequency BW</name>
- <key>freq_bw</key>
- <value>6.28/100.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Timing BW</name>
- <key>timing_bw</key>
- <value>6.28/100.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Phase BW</name>
- <key>phase_bw</key>
- <value>6.28/100.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Gray Code</name>
- <key>mod_code</key>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>"gray"</key>
- </option>
- <option>
- <name>No</name>
- <key>"none"</key>
- </option>
- </param>
- <param>
- <name>Verbose</name>
- <key>verbose</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Log</name>
- <key>log</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($log) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_psk_mod.block.yml b/gr-digital/grc/digital_psk_mod.block.yml
new file mode 100644
index 000000000..9145718fa
--- /dev/null
+++ b/gr-digital/grc/digital_psk_mod.block.yml
@@ -0,0 +1,65 @@
+id: digital_psk_mod
+label: PSK Mod
+category: '[Core]/Deprecated'
+
+parameters:
+- id: constellation_points
+ label: Number of Constellation Points
+ dtype: int
+ default: '8'
+- id: mod_code
+ label: Gray Code
+ dtype: enum
+ options: ['"gray"', '"none"']
+ option_labels: ['Yes', 'No']
+- id: differential
+ label: Differential Encoding
+ dtype: bool
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: samples_per_symbol
+ label: Samples/Symbol
+ dtype: int
+ default: '2'
+- id: excess_bw
+ label: Excess BW
+ dtype: real
+ default: '0.35'
+- id: verbose
+ label: Verbose
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(verbose) == 'False' else 'none') }
+- id: log
+ label: Log
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(log) == 'False' else 'none') }
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import digital
+ make: |-
+ digital.psk.psk_mod(
+ constellation_points=${constellation_points},
+ mod_code=${mod_code},
+ differential=${differential},
+ samples_per_symbol=${samples_per_symbol},
+ excess_bw=${excess_bw},
+ verbose=${verbose},
+ log=${log},
+ )
+
+file_format: 1
diff --git a/gr-digital/grc/digital_psk_mod.xml b/gr-digital/grc/digital_psk_mod.xml
deleted file mode 100644
index 43e60562e..000000000
--- a/gr-digital/grc/digital_psk_mod.xml
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2009,2010,2011 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##PSK Mod
-###################################################
- -->
-<block>
- <name>PSK Mod</name>
- <key>digital_psk_mod</key>
- <category>[Core]/Deprecated</category>
- <import>from gnuradio import digital</import>
- <make>digital.psk.psk_mod(
- constellation_points=$constellation_points,
- mod_code=$mod_code,
- differential=$differential,
- samples_per_symbol=$samples_per_symbol,
- excess_bw=$excess_bw,
- verbose=$verbose,
- log=$log,
- )</make>
- <param>
- <name>Number of Constellation Points</name>
- <key>constellation_points</key>
- <value>8</value>
- <type>int</type>
- </param>
- <param>
- <name>Gray Code</name>
- <key>mod_code</key>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>"gray"</key>
- </option>
- <option>
- <name>No</name>
- <key>"none"</key>
- </option>
- </param>
- <param>
- <name>Differential Encoding</name>
- <key>differential</key>
- <value>True</value>
- <type>bool</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Samples/Symbol</name>
- <key>samples_per_symbol</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Excess BW</name>
- <key>excess_bw</key>
- <value>0.35</value>
- <type>real</type>
- </param>
- <param>
- <name>Verbose</name>
- <key>verbose</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Log</name>
- <key>log</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($log) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_qam_demod.block.yml b/gr-digital/grc/digital_qam_demod.block.yml
new file mode 100644
index 000000000..5ed8f4dd1
--- /dev/null
+++ b/gr-digital/grc/digital_qam_demod.block.yml
@@ -0,0 +1,80 @@
+id: digital_qam_demod
+label: QAM Demod
+category: '[Core]/Deprecated'
+
+parameters:
+- id: constellation_points
+ label: Number of Constellation Points
+ dtype: int
+ default: '16'
+- id: differential
+ label: Differential Encoding
+ dtype: bool
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: samples_per_symbol
+ label: Samples/Symbol
+ dtype: int
+ default: '2'
+- id: excess_bw
+ label: Excess BW
+ dtype: real
+ default: '0.35'
+- id: freq_bw
+ label: Frequency BW
+ dtype: real
+ default: 6.28/100.0
+- id: timing_bw
+ label: Timing BW
+ dtype: real
+ default: 6.28/100.0
+- id: phase_bw
+ label: Phase BW
+ dtype: real
+ default: 6.28/100.0
+- id: mod_code
+ label: Gray Code
+ dtype: enum
+ options: ['"gray"', '"none"']
+ option_labels: ['Yes', 'No']
+- id: verbose
+ label: Verbose
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(verbose) == 'False' else 'none') }
+- id: log
+ label: Log
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(log) == 'False' else 'none') }
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: |-
+ digital.qam.qam_demod(
+ constellation_points=${constellation_points},
+ differential=${differential},
+ samples_per_symbol=${samples_per_symbol},
+ excess_bw=${excess_bw},
+ freq_bw=${freq_bw},
+ timing_bw=${timing_bw},
+ phase_bw=${phase_bw},
+ mod_code=${mod_code},
+ verbose=${verbose},
+ log=${log},
+ )
+
+file_format: 1
diff --git a/gr-digital/grc/digital_qam_demod.xml b/gr-digital/grc/digital_qam_demod.xml
deleted file mode 100644
index c9a6c6aa4..000000000
--- a/gr-digital/grc/digital_qam_demod.xml
+++ /dev/null
@@ -1,147 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2009,2010,2011 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##QAM Demod
-###################################################
- -->
-<block>
- <name>QAM Demod</name>
- <key>digital_qam_demod</key>
- <category>[Core]/Deprecated</category>
- <import>from gnuradio import digital</import>
- <make>digital.qam.qam_demod(
- constellation_points=$constellation_points,
- differential=$differential,
- samples_per_symbol=$samples_per_symbol,
- excess_bw=$excess_bw,
- freq_bw=$freq_bw,
- timing_bw=$timing_bw,
- phase_bw=$phase_bw,
- mod_code=$mod_code,
- verbose=$verbose,
- log=$log,
- )</make>
- <param>
- <name>Number of Constellation Points</name>
- <key>constellation_points</key>
- <value>16</value>
- <type>int</type>
- </param>
- <param>
- <name>Differential Encoding</name>
- <key>differential</key>
- <value>True</value>
- <type>bool</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Samples/Symbol</name>
- <key>samples_per_symbol</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Excess BW</name>
- <key>excess_bw</key>
- <value>0.35</value>
- <type>real</type>
- </param>
- <param>
- <name>Frequency BW</name>
- <key>freq_bw</key>
- <value>6.28/100.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Timing BW</name>
- <key>timing_bw</key>
- <value>6.28/100.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Phase BW</name>
- <key>phase_bw</key>
- <value>6.28/100.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Gray Code</name>
- <key>mod_code</key>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>"gray"</key>
- </option>
- <option>
- <name>No</name>
- <key>"none"</key>
- </option>
- </param>
- <param>
- <name>Verbose</name>
- <key>verbose</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Log</name>
- <key>log</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($log) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_qam_mod.block.yml b/gr-digital/grc/digital_qam_mod.block.yml
new file mode 100644
index 000000000..6cfcc2966
--- /dev/null
+++ b/gr-digital/grc/digital_qam_mod.block.yml
@@ -0,0 +1,65 @@
+id: digital_qam_mod
+label: QAM Mod
+category: '[Core]/Deprecated'
+
+parameters:
+- id: constellation_points
+ label: Number of Constellation Points
+ dtype: int
+ default: '16'
+- id: mod_code
+ label: Gray Code
+ dtype: enum
+ options: ['"gray"', '"none"']
+ option_labels: ['Yes', 'No']
+- id: differential
+ label: Differential Encoding
+ dtype: bool
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: samples_per_symbol
+ label: Samples/Symbol
+ dtype: int
+ default: '2'
+- id: excess_bw
+ label: Excess BW
+ dtype: real
+ default: '0.35'
+- id: verbose
+ label: Verbose
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(verbose) == 'False' else 'none') }
+- id: log
+ label: Log
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: ${ ('part' if str(log) == 'False' else 'none') }
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import digital
+ make: |-
+ digital.qam.qam_mod(
+ constellation_points=${constellation_points},
+ mod_code=${mod_code},
+ differential=${differential},
+ samples_per_symbol=${samples_per_symbol},
+ excess_bw=${excess_bw},
+ verbose=${verbose},
+ log=${log},
+ )
+
+file_format: 1
diff --git a/gr-digital/grc/digital_qam_mod.xml b/gr-digital/grc/digital_qam_mod.xml
deleted file mode 100644
index 5c3d5139d..000000000
--- a/gr-digital/grc/digital_qam_mod.xml
+++ /dev/null
@@ -1,126 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2009,2010,2011 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##QAM Mod
-###################################################
- -->
-<block>
- <name>QAM Mod</name>
- <key>digital_qam_mod</key>
- <category>[Core]/Deprecated</category>
- <import>from gnuradio import digital</import>
- <make>digital.qam.qam_mod(
- constellation_points=$constellation_points,
- mod_code=$mod_code,
- differential=$differential,
- samples_per_symbol=$samples_per_symbol,
- excess_bw=$excess_bw,
- verbose=$verbose,
- log=$log,
- )</make>
- <param>
- <name>Number of Constellation Points</name>
- <key>constellation_points</key>
- <value>16</value>
- <type>int</type>
- </param>
- <param>
- <name>Gray Code</name>
- <key>mod_code</key>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>"gray"</key>
- </option>
- <option>
- <name>No</name>
- <key>"none"</key>
- </option>
- </param>
- <param>
- <name>Differential Encoding</name>
- <key>differential</key>
- <value>True</value>
- <type>bool</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Samples/Symbol</name>
- <key>samples_per_symbol</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Excess BW</name>
- <key>excess_bw</key>
- <value>0.35</value>
- <type>real</type>
- </param>
- <param>
- <name>Verbose</name>
- <key>verbose</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($verbose) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Log</name>
- <key>log</key>
- <value>False</value>
- <type>bool</type>
- <hide>#if str($log) == 'False' then 'part' else 'none'#</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_scrambler_bb.block.yml b/gr-digital/grc/digital_scrambler_bb.block.yml
new file mode 100644
index 000000000..fb8b3cca1
--- /dev/null
+++ b/gr-digital/grc/digital_scrambler_bb.block.yml
@@ -0,0 +1,30 @@
+id: digital_scrambler_bb
+label: Scrambler
+
+parameters:
+- id: mask
+ label: Mask
+ dtype: hex
+ default: '0x8A'
+- id: seed
+ label: Seed
+ dtype: hex
+ default: '0x7F'
+- id: len
+ label: Length
+ dtype: int
+ default: '7'
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.scrambler_bb(${mask}, ${seed}, ${len})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_scrambler_bb.xml b/gr-digital/grc/digital_scrambler_bb.xml
deleted file mode 100644
index 9c40b49f6..000000000
--- a/gr-digital/grc/digital_scrambler_bb.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Descrambler
-###################################################
- -->
-<block>
- <name>Scrambler</name>
- <key>digital_scrambler_bb</key>
- <import>from gnuradio import digital</import>
- <make>digital.scrambler_bb($mask, $seed, $len)</make>
- <param>
- <name>Mask</name>
- <key>mask</key>
- <value>0x8A</value>
- <type>hex</type>
- </param>
- <param>
- <name>Seed</name>
- <key>seed</key>
- <value>0x7F</value>
- <type>hex</type>
- </param>
- <param>
- <name>Length</name>
- <key>len</key>
- <value>7</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_simple_correlator.block.yml b/gr-digital/grc/digital_simple_correlator.block.yml
new file mode 100644
index 000000000..aae613952
--- /dev/null
+++ b/gr-digital/grc/digital_simple_correlator.block.yml
@@ -0,0 +1,21 @@
+id: digital_simple_correlator
+label: Simple Correlator
+
+parameters:
+- id: payload_bytesize
+ label: Payload Byte Size
+ dtype: int
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.simple_correlator(${payload_bytesize})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_simple_correlator.xml b/gr-digital/grc/digital_simple_correlator.xml
deleted file mode 100644
index 3b70e59b1..000000000
--- a/gr-digital/grc/digital_simple_correlator.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Simple Correlator
-###################################################
- -->
-<block>
- <name>Simple Correlator</name>
- <key>digital_simple_correlator</key>
- <import>from gnuradio import digital</import>
- <make>digital.simple_correlator($payload_bytesize)</make>
- <param>
- <name>Payload Byte Size</name>
- <key>payload_bytesize</key>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_simple_framer.block.yml b/gr-digital/grc/digital_simple_framer.block.yml
new file mode 100644
index 000000000..f71194898
--- /dev/null
+++ b/gr-digital/grc/digital_simple_framer.block.yml
@@ -0,0 +1,21 @@
+id: digital_simple_framer
+label: Simple Framer
+
+parameters:
+- id: payload_bytesize
+ label: Payload Byte Size
+ dtype: int
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import digital
+ make: digital.simple_framer(${payload_bytesize})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_simple_framer.xml b/gr-digital/grc/digital_simple_framer.xml
deleted file mode 100644
index 2d57222f3..000000000
--- a/gr-digital/grc/digital_simple_framer.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Simple Framer
-###################################################
- -->
-<block>
- <name>Simple Framer</name>
- <key>digital_simple_framer</key>
- <import>from gnuradio import digital</import>
- <make>digital.simple_framer($payload_bytesize)</make>
- <param>
- <name>Payload Byte Size</name>
- <key>payload_bytesize</key>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-digital/grc/digital_symbol_sync_xx.block.yml b/gr-digital/grc/digital_symbol_sync_xx.block.yml
new file mode 100644
index 000000000..ec6382512
--- /dev/null
+++ b/gr-digital/grc/digital_symbol_sync_xx.block.yml
@@ -0,0 +1,108 @@
+id: digital_symbol_sync_xx
+label: Symbol Sync
+category: '[Core]/Synchronizers'
+
+parameters:
+- id: type
+ label: I/O Type
+ dtype: enum
+ options: [cc, ff]
+ option_labels: [Complex, Float]
+ option_attributes:
+ input: [complex, float]
+ output: [complex, float]
+ hide: part
+- id: ted_type
+ label: Timing Error Detector
+ dtype: enum
+ options: [digital.TED_MUELLER_AND_MULLER, digital.TED_MOD_MUELLER_AND_MULLER,
+ digital.TED_ZERO_CROSSING, digital.TED_GARDNER, digital.TED_EARLY_LATE, digital.TED_DANDREA_AND_MENGALI_GEN_MSK,
+ digital.TED_MENGALI_AND_DANDREA_GMSK, digital.TED_SIGNAL_TIMES_SLOPE_ML, digital.TED_SIGNUM_TIMES_SLOPE_ML]
+ option_labels: ["Mueller and M\xFCller", "Modified Mueller and M\xFCller", Zero
+ Crossing, Gardner, Early-Late, D'Andrea and Mengali Gen MSK, Mengali and
+ D'Andrea GMSK, 'y[n]y''[n] Maximum Likelyhood', 'sgn(y[n])y''[n] Maximum
+ Likelyhood']
+ option_attributes:
+ hide_constellation: [part, part, part, all, all, all, all, all, all]
+- id: constellation
+ label: TED Slicer Constellation
+ dtype: raw
+ default: digital.constellation_bpsk().base()
+ hide: ${ ted_type.hide_constellation }
+- id: sps
+ label: Samples per Symbol
+ dtype: real
+ default: sps
+- id: ted_gain
+ label: Expected TED Gain
+ dtype: real
+ default: '1.0'
+- id: loop_bw
+ label: Loop Bandwidth
+ dtype: real
+ default: '0.045'
+- id: damping
+ label: Damping Factor
+ dtype: real
+ default: '1.0'
+- id: max_dev
+ label: Maximum Deviation
+ dtype: real
+ default: '1.5'
+- id: osps
+ label: Output Samples/Symbol
+ dtype: int
+ default: '1'
+- id: resamp_type
+ label: Interpolating Resampler
+ dtype: enum
+ options: [digital.IR_MMSE_8TAP, digital.IR_PFB_NO_MF, digital.IR_PFB_MF]
+ option_labels: ['MMSE, 8 tap FIR', 'Polyphase Filterbank, MMSE', 'Polyphase Filterbank,
+ MF']
+ option_attributes:
+ hide_nfilters: [all, '', '']
+ hide_pfb_mf_taps: [all, all, '']
+- id: nfilters
+ label: Filterbank Arms
+ dtype: int
+ default: '128'
+ hide: ${ resamp_type.hide_nfilters }
+- id: pfb_mf_taps
+ label: PFB MF Taps
+ dtype: real_vector
+ default: '[]'
+ hide: ${ resamp_type.hide_pfb_mf_taps }
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+- label: error
+ domain: stream
+ dtype: float
+ optional: true
+- label: T_inst
+ domain: stream
+ dtype: float
+ optional: true
+- label: T_avg
+ domain: stream
+ dtype: float
+ optional: true
+
+templates:
+ imports: |-
+ from gnuradio import digital
+ from gnuradio import filter
+ make: digital.symbol_sync_${type}(${ted_type}, ${sps}, ${loop_bw}, ${damping},
+ ${ted_gain}, ${max_dev}, ${osps}, ${constellation}, ${resamp_type}, ${nfilters},
+ ${pfb_mf_taps})
+ callbacks:
+ - set_loop_bandwidth(${loop_bw})
+ - set_damping_factor(${damping})
+ - set_ted_gain(${ted_gain})
+
+file_format: 1
diff --git a/gr-digital/grc/digital_symbol_sync_xx.xml b/gr-digital/grc/digital_symbol_sync_xx.xml
deleted file mode 100644
index ffd2f5daf..000000000
--- a/gr-digital/grc/digital_symbol_sync_xx.xml
+++ /dev/null
@@ -1,207 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Copyright (C) 2016-2017 Free Software Foundation, Inc.
-
- This file is part of GNU Radio.
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
- -->
-
-<block>
- <name>Symbol Sync</name>
- <key>digital_symbol_sync_xx</key>
- <category>[Core]/Synchronizers</category>
- <import>from gnuradio import digital</import>
- <import>from gnuradio import filter</import>
- <make>digital.symbol_sync_$(type)($ted_type, $sps, $loop_bw, $damping, $ted_gain, $max_dev, $osps, $constellation, $resamp_type, $nfilters, $pfb_mf_taps)</make>
-
- <callback>set_loop_bandwidth($loop_bw)</callback>
- <callback>set_damping_factor($damping)</callback>
- <callback>set_ted_gain($ted_gain)</callback>
-
- <param>
- <name>I/O Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>cc</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>ff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- </option>
- </param>
- <param>
- <name>Timing Error Detector</name>
- <key>ted_type</key>
- <type>enum</type>
- <option>
- <name>Mueller and Müller</name>
- <key>digital.TED_MUELLER_AND_MULLER</key>
- <opt>hide_constellation:part</opt>
- </option>
- <option>
- <name>Modified Mueller and Müller</name>
- <key>digital.TED_MOD_MUELLER_AND_MULLER</key>
- <opt>hide_constellation:part</opt>
- </option>
- <option>
- <name>Zero Crossing</name>
- <key>digital.TED_ZERO_CROSSING</key>
- <opt>hide_constellation:part</opt>
- </option>
- <option>
- <name>Gardner</name>
- <key>digital.TED_GARDNER</key>
- <opt>hide_constellation:all</opt>
- </option>
- <option>
- <name>Early-Late</name>
- <key>digital.TED_EARLY_LATE</key>
- <opt>hide_constellation:all</opt>
- </option>
- <option>
- <name>D'Andrea and Mengali Gen MSK</name>
- <key>digital.TED_DANDREA_AND_MENGALI_GEN_MSK</key>
- <opt>hide_constellation:all</opt>
- </option>
- <option>
- <name>Mengali and D'Andrea GMSK</name>
- <key>digital.TED_MENGALI_AND_DANDREA_GMSK</key>
- <opt>hide_constellation:all</opt>
- </option>
- <option>
- <name>y[n]y'[n] Maximum Likelyhood</name>
- <key>digital.TED_SIGNAL_TIMES_SLOPE_ML</key>
- <opt>hide_constellation:all</opt>
- </option>
- <option>
- <name>sgn(y[n])y'[n] Maximum Likelyhood</name>
- <key>digital.TED_SIGNUM_TIMES_SLOPE_ML</key>
- <opt>hide_constellation:all</opt>
- </option>
- </param>
- <param>
- <name>TED Slicer Constellation</name>
- <key>constellation</key>
- <value>digital.constellation_bpsk().base()</value>
- <type>raw</type>
- <hide>$ted_type.hide_constellation</hide>
- </param>
- <param>
- <name>Samples per Symbol</name>
- <key>sps</key>
- <value>sps</value>
- <type>real</type>
- </param>
- <param>
- <name>Expected TED Gain</name>
- <key>ted_gain</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Loop Bandwidth</name>
- <key>loop_bw</key>
- <value>0.045</value>
- <type>real</type>
- </param>
- <param>
- <name>Damping Factor</name>
- <key>damping</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Maximum Deviation</name>
- <key>max_dev</key>
- <value>1.5</value>
- <type>real</type>
- </param>
- <param>
- <name>Output Samples/Symbol</name>
- <key>osps</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Interpolating Resampler</name>
- <key>resamp_type</key>
- <type>enum</type>
- <option>
- <name>MMSE, 8 tap FIR</name>
- <key>digital.IR_MMSE_8TAP</key>
- <opt>hide_nfilters:all</opt>
- <opt>hide_pfb_mf_taps:all</opt>
- </option>
- <option>
- <name>Polyphase Filterbank, MMSE</name>
- <key>digital.IR_PFB_NO_MF</key>
- <opt>hide_nfilters:</opt>
- <opt>hide_pfb_mf_taps:all</opt>
- </option>
- <option>
- <name>Polyphase Filterbank, MF</name>
- <key>digital.IR_PFB_MF</key>
- <opt>hide_nfilters:</opt>
- <opt>hide_pfb_mf_taps:</opt>
- </option>
- </param>
- <param>
- <name>Filterbank Arms</name>
- <key>nfilters</key>
- <value>128</value>
- <type>int</type>
- <hide>$resamp_type.hide_nfilters</hide>
- </param>
- <param>
- <name>PFB MF Taps</name>
- <key>pfb_mf_taps</key>
- <value>[]</value>
- <type>real_vector</type>
- <hide>$resamp_type.hide_pfb_mf_taps</hide>
- </param>
-
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
- <source>
- <name>error</name>
- <type>float</type>
- <optional>1</optional>
- </source>
- <source>
- <name>T_inst</name>
- <type>float</type>
- <optional>1</optional>
- </source>
- <source>
- <name>T_avg</name>
- <type>float</type>
- <optional>1</optional>
- </source>
-</block>
diff --git a/gr-digital/grc/variable_header_format_default.block.yml b/gr-digital/grc/variable_header_format_default.block.yml
new file mode 100644
index 000000000..d326eb2e8
--- /dev/null
+++ b/gr-digital/grc/variable_header_format_default.block.yml
@@ -0,0 +1,25 @@
+id: variable_header_format_default
+label: Default Header Format Obj.
+
+parameters:
+- id: access_code
+ label: Access Code
+ dtype: string
+ default: '0'
+- id: threshold
+ label: Threshold
+ dtype: int
+ default: '0'
+- id: bps
+ label: Payload Bits per Symbol
+ dtype: int
+ default: '1'
+value: ${ digital.header_format_default(access_code, threshold, bps) }
+
+templates:
+ imports: from gnuradio import digital
+ var_make: "\n% if int(access_code)==0 #:\nself.${id} = ${id} = digital.header_format_default(digital.packet_utils.default_access_code,\
+ \ ${threshold}, ${bps})\n% else:\nself.${id} = ${id} = digital.header_format_default(${access_code},\
+ \ ${threshold}, ${bps})\n% endif\n "
+
+file_format: 1
diff --git a/gr-digital/grc/variable_header_format_default.xml b/gr-digital/grc/variable_header_format_default.xml
deleted file mode 100644
index 88727600e..000000000
--- a/gr-digital/grc/variable_header_format_default.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-# header_format_default object
-###################################################
- -->
-<block>
- <name>Default Header Format Obj.</name>
- <key>variable_header_format_default</key>
- <import>from gnuradio import digital</import>
- <var_make>
-#if int($access_code())==0 #
-self.$(id) = $(id) = digital.header_format_default(digital.packet_utils.default_access_code, $threshold, $bps)
-#else
-self.$(id) = $(id) = digital.header_format_default($access_code, $threshold, $bps)
-#end if
- </var_make>
- <var_value>digital.header_format_default($access_code, $threshold, $bps)</var_value>
- <make></make>
-
- <param>
- <name>Access Code</name>
- <key>access_code</key>
- <value>0</value>
- <type>string</type>
- </param>
-
- <param>
- <name>Threshold</name>
- <key>threshold</key>
- <value>0</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Payload Bits per Symbol</name>
- <key>bps</key>
- <value>1</value>
- <type>int</type>
- </param>
-
-</block>
diff --git a/gr-digital/python/digital/CMakeLists.txt b/gr-digital/python/digital/CMakeLists.txt
index 8f88948a2..e9d58491c 100644
--- a/gr-digital/python/digital/CMakeLists.txt
+++ b/gr-digital/python/digital/CMakeLists.txt
@@ -78,6 +78,6 @@ if(ENABLE_TESTING)
file(GLOB py_qa_test_files "qa_*.py")
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gr-digital/python/digital/__init__.py b/gr-digital/python/digital/__init__.py
index 79b740644..90aa413a2 100644
--- a/gr-digital/python/digital/__init__.py
+++ b/gr-digital/python/digital/__init__.py
@@ -1,59 +1,63 @@
# Copyright 2011-2013 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
'''
Blocks and utilities for digital modulation and demodulation.
'''
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
# The presence of this file turns this directory into a Python package
import os
try:
- from digital_swig import *
+ from .digital_swig import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
- from digital_swig import *
-from psk import *
-from qam import *
-from qamlike import *
-from bpsk import *
-from qpsk import *
-from gmsk import *
-from gfsk import *
-from cpm import *
-from pkt import *
-from crc import *
-from modulation_utils import *
-from ofdm import *
-from ofdm_receiver import *
-from ofdm_sync_fixed import *
-from ofdm_sync_ml import *
-from ofdm_sync_pnac import *
-from ofdm_sync_pn import *
-from ofdm_txrx import ofdm_tx, ofdm_rx
-from soft_dec_lut_gen import *
-from psk_constellations import *
-from qam_constellations import *
-from constellation_map_generator import *
+ from .digital_swig import *
+
+from .psk import *
+from .qam import *
+from .qamlike import *
+from .bpsk import *
+from .qpsk import *
+from .gmsk import *
+from .gfsk import *
+from .cpm import *
+from .pkt import *
+from .crc import *
+from .modulation_utils import *
+from .ofdm import *
+from .ofdm_receiver import *
+from .ofdm_sync_fixed import *
+from .ofdm_sync_ml import *
+from .ofdm_sync_pnac import *
+from .ofdm_sync_pn import *
+from .ofdm_txrx import ofdm_tx, ofdm_rx
+from .soft_dec_lut_gen import *
+from .psk_constellations import *
+from .qam_constellations import *
+from .constellation_map_generator import *
-import packet_utils
-import ofdm_packet_utils
+from . import packet_utils
+from . import ofdm_packet_utils
diff --git a/gr-digital/python/digital/bpsk.py b/gr-digital/python/digital/bpsk.py
index 2ecaac338..6193622be 100644
--- a/gr-digital/python/digital/bpsk.py
+++ b/gr-digital/python/digital/bpsk.py
@@ -23,14 +23,17 @@
BPSK modulation and demodulation.
"""
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
from math import pi, log
from cmath import exp
from gnuradio import gr
from gnuradio.digital.generic_mod_demod import generic_mod, generic_demod
from gnuradio.digital.generic_mod_demod import shared_mod_args, shared_demod_args
-import digital_swig
-import modulation_utils
+from . import digital_swig
+from . import modulation_utils
# /////////////////////////////////////////////////////////////////////////////
# BPSK constellation
diff --git a/gr-digital/python/digital/constellation_map_generator.py b/gr-digital/python/digital/constellation_map_generator.py
index 1dedd8128..bd4158194 100644
--- a/gr-digital/python/digital/constellation_map_generator.py
+++ b/gr-digital/python/digital/constellation_map_generator.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
def constellation_map_generator(basis_cpoints, basis_symbols, k, pi):
'''
Uses the a basis constellation provided (e.g., from
diff --git a/gr-digital/python/digital/cpm.py b/gr-digital/python/digital/cpm.py
index 322c3f0bf..0752f01d6 100644
--- a/gr-digital/python/digital/cpm.py
+++ b/gr-digital/python/digital/cpm.py
@@ -1,37 +1,44 @@
#
-# CPM modulation and demodulation.
+# CPM modulation and demodulation.
#
#
# Copyright 2005-2007,2011 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
# See gnuradio-examples/python/digital for examples
+
+from math import pi
+import numpy
+
from gnuradio import gr, filter
from gnuradio import analog
from gnuradio import blocks
-from math import pi
-import numpy
+from . import digital_swig
+from . import modulation_utils
-import digital_swig
-import modulation_utils
# default values (used in __init__ and add_options)
_def_samples_per_symbol = 2
@@ -53,16 +60,16 @@ _def_log = False
class cpm_mod(gr.hier_block2):
"""
Hierarchical block for Continuous Phase modulation.
-
+
The input is a byte stream (unsigned char) representing packed
bits and the output is the complex modulated signal at baseband.
-
+
See Proakis for definition of generic CPM signals:
s(t)=exp(j phi(t))
phi(t)= 2 pi h int_0^t f(t') dt'
f(t)=sum_k a_k g(t-kT)
(normalizing assumption: int_0^infty g(t) dt = 1/2)
-
+
Args:
samples_per_symbol: samples per baud >= 2 (integer)
bits_per_symbol: bits per symbol (integer)
@@ -76,21 +83,21 @@ class cpm_mod(gr.hier_block2):
debug: Print modulation data to files? (boolean)
"""
- def __init__(self,
+ def __init__(self,
samples_per_symbol=_def_samples_per_symbol,
bits_per_symbol=_def_bits_per_symbol,
h_numerator=_def_h_numerator,
h_denominator=_def_h_denominator,
cpm_type=_def_cpm_type,
- bt=_def_bt,
- symbols_per_pulse=_def_symbols_per_pulse,
+ bt=_def_bt,
+ symbols_per_pulse=_def_symbols_per_pulse,
generic_taps=_def_generic_taps,
verbose=_def_verbose,
log=_def_log):
- gr.hier_block2.__init__(self, "cpm_mod",
- gr.io_signature(1, 1, gr.sizeof_char), # Input signature
- gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
+ gr.hier_block2.__init__(self, "cpm_mod",
+ gr.io_signature(1, 1, gr.sizeof_char), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
self._samples_per_symbol = samples_per_symbol
self._bits_per_symbol = bits_per_symbol
@@ -99,29 +106,29 @@ class cpm_mod(gr.hier_block2):
self._cpm_type = cpm_type
self._bt=bt
if cpm_type == 0 or cpm_type == 2 or cpm_type == 3: # CPFSK, RC, Generic
- self._symbols_per_pulse = symbols_per_pulse
+ self._symbols_per_pulse = symbols_per_pulse
elif cpm_type == 1: # GMSK
- self._symbols_per_pulse = 4
+ self._symbols_per_pulse = 4
else:
- raise TypeError, ("cpm_type must be an integer in {0,1,2,3}, is %r" % (cpm_type,))
+ raise TypeError("cpm_type must be an integer in {0,1,2,3}, is %r" % (cpm_type,))
self._generic_taps=numpy.array(generic_taps)
if samples_per_symbol < 2:
- raise TypeError, ("samples_per_symbol must be >= 2, is %r" % (samples_per_symbol,))
+ raise TypeError("samples_per_symbol must be >= 2, is %r" % (samples_per_symbol,))
self.nsymbols = 2**bits_per_symbol
self.sym_alphabet = numpy.arange(-(self.nsymbols-1),self.nsymbols,2).tolist()
- self.ntaps = int(self._symbols_per_pulse * samples_per_symbol)
- sensitivity = 2 * pi * h_numerator / h_denominator / samples_per_symbol
+ self.ntaps = int(self._symbols_per_pulse * samples_per_symbol)
+ sensitivity = 2 * pi * h_numerator / h_denominator / samples_per_symbol
# Unpack Bytes into bits_per_symbol groups
self.B2s = blocks.packed_to_unpacked_bb(bits_per_symbol,gr.GR_MSB_FIRST)
-
-
- # Turn it into symmetric PAM data.
+
+
+ # Turn it into symmetric PAM data.
self.pam = digital_swig.chunks_to_symbols_bf(self.sym_alphabet,1)
# Generate pulse (sum of taps = samples_per_symbol/2)
@@ -129,72 +136,72 @@ class cpm_mod(gr.hier_block2):
self.taps= (1.0/self._symbols_per_pulse/2,) * self.ntaps
elif cpm_type == 1: # GMSK
gaussian_taps = filter.firdes.gaussian(
- 1.0/2, # gain
+ 1.0 / 2, # gain
samples_per_symbol, # symbol_rate
bt, # bandwidth * symbol time
self.ntaps # number of taps
)
- sqwave = (1,) * samples_per_symbol # rectangular window
- self.taps = numpy.convolve(numpy.array(gaussian_taps),numpy.array(sqwave))
+ sqwave = (1,) * samples_per_symbol # rectangular window
+ self.taps = numpy.convolve(numpy.array(gaussian_taps),numpy.array(sqwave))
elif cpm_type == 2: # Raised Cosine
# generalize it for arbitrary roll-off factor
- self.taps = (1-numpy.cos(2*pi*numpy.arange(0,self.ntaps)/samples_per_symbol/self._symbols_per_pulse))/(2*self._symbols_per_pulse)
+ self.taps = (1-numpy.cos(2*pi*numpy.arange(0 / self.ntaps/samples_per_symbol/self._symbols_per_pulse)),(2*self._symbols_per_pulse))
elif cpm_type == 3: # Generic CPM
self.taps = generic_taps
else:
- raise TypeError, ("cpm_type must be an integer in {0,1,2,3}, is %r" % (cpm_type,))
+ raise TypeError("cpm_type must be an integer in {0,1,2,3}, is %r" % (cpm_type,))
self.filter = filter.pfb.arb_resampler_fff(samples_per_symbol, self.taps)
- # FM modulation
- self.fmmod = analog.frequency_modulator_fc(sensitivity)
-
+ # FM modulation
+ self.fmmod = analog.frequency_modulator_fc(sensitivity)
+
if verbose:
self._print_verbage()
-
+
if log:
self._setup_logging()
- # Connect
- self.connect(self, self.B2s, self.pam, self.filter, self.fmmod, self)
+ # Connect
+ self.connect(self, self.B2s, self.pam, self.filter, self.fmmod, self)
def samples_per_symbol(self):
return self._samples_per_symbol
-
- def bits_per_symbol(self):
+
+ def bits_per_symbol(self):
return self._bits_per_symbol
-
- def h_numerator(self):
+
+ def h_numerator(self):
return self._h_numerator
- def h_denominator(self):
+ def h_denominator(self):
return self._h_denominator
- def cpm_type(self):
+ def cpm_type(self):
return self._cpm_type
- def bt(self):
+ def bt(self):
return self._bt
- def symbols_per_pulse(self):
+ def symbols_per_pulse(self):
return self._symbols_per_pulse
def _print_verbage(self):
- print "Samples per symbol = %d" % self._samples_per_symbol
- print "Bits per symbol = %d" % self._bits_per_symbol
- print "h = " , self._h_numerator , " / " , self._h_denominator
- print "Symbol alphabet = " , self.sym_alphabet
- print "Symbols per pulse = %d" % self._symbols_per_pulse
- print "taps = " , self.taps
-
- print "CPM type = %d" % self._cpm_type
+ print("Samples per symbol = %d" % self._samples_per_symbol)
+ print("Bits per symbol = %d" % self._bits_per_symbol)
+ print("h = " , self._h_numerator , " / " , self._h_denominator)
+ print("Symbol alphabet = " , self.sym_alphabet)
+ print("Symbols per pulse = %d" % self._symbols_per_pulse)
+ print("taps = " , self.taps)
+
+ print("CPM type = %d" % self._cpm_type)
if self._cpm_type == 1:
- print "Gaussian filter BT = %.2f" % self._bt
+ print("Gaussian filter BT = %.2f" % self._bt)
def _setup_logging(self):
- print "Modulation logging turned on."
+ print("Modulation logging turned on.")
self.connect(self.B2s,
blocks.file_sink(gr.sizeof_float, "symbols.dat"))
self.connect(self.pam,
diff --git a/gr-digital/python/digital/crc.py b/gr-digital/python/digital/crc.py
index e228faaa9..31e98d368 100644
--- a/gr-digital/python/digital/crc.py
+++ b/gr-digital/python/digital/crc.py
@@ -1,26 +1,27 @@
+from __future__ import unicode_literals
#
# Copyright 2005,2007,2011 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
from gnuradio import gru
-import digital_swig as digital
+from . import digital_swig as digital
import struct
def gen_and_append_crc32(s):
diff --git a/gr-digital/python/digital/generic_mod_demod.py b/gr-digital/python/digital/generic_mod_demod.py
index b26966fbc..2a0d2c44c 100644
--- a/gr-digital/python/digital/generic_mod_demod.py
+++ b/gr-digital/python/digital/generic_mod_demod.py
@@ -19,32 +19,22 @@
# Boston, MA 02110-1301, USA.
#
-# See gnuradio-examples/python/digital for examples
-
"""
Generic modulation and demodulation.
"""
-from gnuradio import gr
-from modulation_utils import extract_kwargs_from_options_for_class
-from utils import mod_codes
-import digital_swig as digital
-import math
+# See gnuradio-examples/python/digital for examples
-try:
- from gnuradio import blocks
-except ImportError:
- import blocks_swig as blocks
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import unicode_literals
-try:
- from gnuradio import filter
-except ImportError:
- import filter_swig as filter
+from gnuradio import gr, blocks, filter, analog
+from .modulation_utils import extract_kwargs_from_options_for_class
+from .utils import mod_codes
+from . import digital_swig as digital
+import math
-try:
- from gnuradio import analog
-except ImportError:
- import analog_swig as analog
# default values (used in __init__ and add_options)
_def_samples_per_symbol = 2
@@ -113,9 +103,9 @@ class generic_mod(gr.hier_block2):
verbose=_def_verbose,
log=_def_log):
- gr.hier_block2.__init__(self, "generic_mod",
- gr.io_signature(1, 1, gr.sizeof_char), # Input signature
- gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
+ gr.hier_block2.__init__(self, "generic_mod",
+ gr.io_signature(1, 1, gr.sizeof_char), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
self._constellation = constellation
self._samples_per_symbol = samples_per_symbol
@@ -125,7 +115,7 @@ class generic_mod(gr.hier_block2):
self.pre_diff_code = pre_diff_code and self._constellation.apply_pre_diff_code()
if self._samples_per_symbol < 2:
- raise TypeError, ("sps must be >= 2, is %f" % self._samples_per_symbol)
+ raise TypeError("sps must be >= 2, is %f" % self._samples_per_symbol)
arity = pow(2,self.bits_per_symbol())
@@ -153,7 +143,7 @@ class generic_mod(gr.hier_block2):
self.rrc_filter = filter.pfb_arb_resampler_ccf(self._samples_per_symbol,
self.rrc_taps)
- # Connect
+ # Connect
self._blocks = [self, self.bytes2chunks]
if self.pre_diff_code:
self._blocks.append(self.symbol_mapper)
@@ -191,12 +181,12 @@ class generic_mod(gr.hier_block2):
def _print_verbage(self):
- print "\nModulator:"
- print "bits per symbol: %d" % self.bits_per_symbol()
- print "RRC roll-off factor: %.2f" % self._excess_bw
+ print("\nModulator:")
+ print("bits per symbol: %d" % self.bits_per_symbol())
+ print("RRC roll-off factor: %.2f" % self._excess_bw)
def _setup_logging(self):
- print "Modulation logging turned on."
+ print("Modulation logging turned on.")
self.connect(self.bytes2chunks,
blocks.file_sink(gr.sizeof_char, "tx_bytes2chunks.8b"))
if self.pre_diff_code:
@@ -249,9 +239,9 @@ class generic_demod(gr.hier_block2):
verbose=_def_verbose,
log=_def_log):
- gr.hier_block2.__init__(self, "generic_demod",
- gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
- gr.io_signature(1, 1, gr.sizeof_char)) # Output signature
+ gr.hier_block2.__init__(self, "generic_demod",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_char)) # Output signature
self._constellation = constellation
self._samples_per_symbol = samples_per_symbol
@@ -263,7 +253,7 @@ class generic_demod(gr.hier_block2):
self._differential = differential
if self._samples_per_symbol < 2:
- raise TypeError, ("sps must be >= 2, is %d" % self._samples_per_symbol)
+ raise TypeError("sps must be >= 2, is %d" % self._samples_per_symbol)
# Only apply a predifferential coding if the constellation also supports it.
self.pre_diff_code = pre_diff_code and self._constellation.apply_pre_diff_code()
@@ -328,15 +318,15 @@ class generic_demod(gr.hier_block2):
return self._constellation.bits_per_symbol()
def _print_verbage(self):
- print "\nDemodulator:"
- print "bits per symbol: %d" % self.bits_per_symbol()
- print "RRC roll-off factor: %.2f" % self._excess_bw
- print "FLL bandwidth: %.2e" % self._freq_bw
- print "Timing bandwidth: %.2e" % self._timing_bw
- print "Phase bandwidth: %.2e" % self._phase_bw
+ print("\nDemodulator:")
+ print("bits per symbol: %d" % self.bits_per_symbol())
+ print("RRC roll-off factor: %.2f" % self._excess_bw)
+ print("FLL bandwidth: %.2e" % self._freq_bw)
+ print("Timing bandwidth: %.2e" % self._timing_bw)
+ print("Phase bandwidth: %.2e" % self._phase_bw)
def _setup_logging(self):
- print "Modulation logging turned on."
+ print("Modulation logging turned on.")
self.connect(self.agc,
blocks.file_sink(gr.sizeof_gr_complex, "rx_agc.32fc"))
self.connect((self.freq_recov, 0),
diff --git a/gr-digital/python/digital/gfsk.py b/gr-digital/python/digital/gfsk.py
index 032302b10..8b86743bf 100644
--- a/gr-digital/python/digital/gfsk.py
+++ b/gr-digital/python/digital/gfsk.py
@@ -1,43 +1,42 @@
#
-# GFSK modulation and demodulation.
+# GFSK modulation and demodulation.
#
#
# Copyright 2005-2007,2012 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
# See gnuradio-examples/python/digital for examples
+import numpy
+
from gnuradio import gr
from gnuradio import analog
-from gnuradio import blocks
-import modulation_utils
-import digital_swig as digital
-from math import pi
-import numpy
-from pprint import pprint
-import inspect
+from gnuradio import blocks, filter
+from . import modulation_utils
+from . import digital_swig as digital
-try:
- from gnuradio import filter
-except ImportError:
- import filter_swig as filter
# default values (used in __init__ and add_options)
_def_samples_per_symbol = 2
@@ -69,22 +68,22 @@ class gfsk_mod(gr.hier_block2):
verbose=_def_verbose,
log=_def_log):
"""
- Hierarchical block for Gaussian Frequency Shift Key (GFSK)
- modulation.
+ Hierarchical block for Gaussian Frequency Shift Key (GFSK)
+ modulation.
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
Args:
samples_per_symbol: samples per baud >= 2 (integer)
bt: Gaussian filter bandwidth * symbol time (float)
verbose: Print information about modulator? (bool)
debug: Print modualtion data to files? (bool)
- """
+ """
- gr.hier_block2.__init__(self, "gfsk_mod",
- gr.io_signature(1, 1, gr.sizeof_char), # Input signature
- gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
+ gr.hier_block2.__init__(self, "gfsk_mod",
+ gr.io_signature(1, 1, gr.sizeof_char), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
samples_per_symbol = int(samples_per_symbol)
self._samples_per_symbol = samples_per_symbol
@@ -92,43 +91,43 @@ class gfsk_mod(gr.hier_block2):
self._differential = False
if not isinstance(samples_per_symbol, int) or samples_per_symbol < 2:
- raise TypeError, ("samples_per_symbol must be an integer >= 2, is %r" % (samples_per_symbol,))
+ raise TypeError("samples_per_symbol must be an integer >= 2, is %r" % (samples_per_symbol,))
- ntaps = 4 * samples_per_symbol # up to 3 bits in filter at once
- #sensitivity = (pi / 2) / samples_per_symbol # phase change per bit = pi / 2
+ ntaps = 4 * samples_per_symbol # up to 3 bits in filter at once
+ #sensitivity = (pi / 2) / samples_per_symbol # phase change per bit = pi / 2
- # Turn it into NRZ data.
- #self.nrz = digital.bytes_to_syms()
+ # Turn it into NRZ data.
+ #self.nrz = digital.bytes_to_syms()
self.unpack = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
self.nrz = digital.chunks_to_symbols_bf([-1, 1])
- # Form Gaussian filter
+ # Form Gaussian filter
# Generate Gaussian response (Needs to be convolved with window below).
- self.gaussian_taps = filter.firdes.gaussian(
- 1.0, # gain
- samples_per_symbol, # symbol_rate
- bt, # bandwidth * symbol time
- ntaps # number of taps
- )
-
- self.sqwave = (1,) * samples_per_symbol # rectangular window
- self.taps = numpy.convolve(numpy.array(self.gaussian_taps),numpy.array(self.sqwave))
- self.gaussian_filter = filter.interp_fir_filter_fff(samples_per_symbol, self.taps)
-
- # FM modulation
- self.fmmod = analog.frequency_modulator_fc(sensitivity)
-
- # small amount of output attenuation to prevent clipping USRP sink
- self.amp = blocks.multiply_const_cc(0.999)
-
+ self.gaussian_taps = filter.firdes.gaussian(
+ 1.0, # gain
+ samples_per_symbol, # symbol_rate
+ bt, # bandwidth * symbol time
+ ntaps # number of taps
+ )
+
+ self.sqwave = (1,) * samples_per_symbol # rectangular window
+ self.taps = numpy.convolve(numpy.array(self.gaussian_taps),numpy.array(self.sqwave))
+ self.gaussian_filter = filter.interp_fir_filter_fff(samples_per_symbol, self.taps)
+
+ # FM modulation
+ self.fmmod = analog.frequency_modulator_fc(sensitivity)
+
+ # small amount of output attenuation to prevent clipping USRP sink
+ self.amp = blocks.multiply_const_cc(0.999)
+
if verbose:
self._print_verbage()
-
+
if log:
self._setup_logging()
- # Connect & Initialize base class
- self.connect(self, self.unpack, self.nrz, self.gaussian_filter, self.fmmod, self.amp, self)
+ # Connect & Initialize base class
+ self.connect(self, self.unpack, self.nrz, self.gaussian_filter, self.fmmod, self.amp, self)
def samples_per_symbol(self):
return self._samples_per_symbol
@@ -138,12 +137,12 @@ class gfsk_mod(gr.hier_block2):
return 1
def _print_verbage(self):
- print "bits per symbol = %d" % self.bits_per_symbol()
- print "Gaussian filter bt = %.2f" % self._bt
+ print("bits per symbol = %d" % self.bits_per_symbol())
+ print("Gaussian filter bt = %.2f" % self._bt)
def _setup_logging(self):
- print "Modulation logging turned on."
+ print("Modulation logging turned on.")
self.connect(self.nrz,
blocks.file_sink(gr.sizeof_float, "nrz.dat"))
self.connect(self.gaussian_filter,
@@ -184,11 +183,11 @@ class gfsk_demod(gr.hier_block2):
verbose=_def_verbose,
log=_def_log):
"""
- Hierarchical block for Gaussian Minimum Shift Key (GFSK)
- demodulation.
+ Hierarchical block for Gaussian Minimum Shift Key (GFSK)
+ demodulation.
- The input is the complex modulated signal at baseband.
- The output is a stream of bits packed 1 bit per byte (the LSB)
+ The input is the complex modulated signal at baseband.
+ The output is a stream of bits packed 1 bit per byte (the LSB)
Args:
samples_per_symbol: samples per baud (integer)
@@ -196,18 +195,18 @@ class gfsk_demod(gr.hier_block2):
log: Print modualtion data to files? (bool)
Clock recovery parameters. These all have reasonable defaults.
-
+
Args:
gain_mu: controls rate of mu adjustment (float)
mu: fractional delay [0.0, 1.0] (float)
omega_relative_limit: sets max variation in omega (float, typically 0.000200 (200 ppm))
freq_error: bit rate error as a fraction
- float:
- """
+ float:
+ """
- gr.hier_block2.__init__(self, "gfsk_demod",
- gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
- gr.io_signature(1, 1, gr.sizeof_char)) # Output signature
+ gr.hier_block2.__init__(self, "gfsk_demod",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_char)) # Output signature
self._samples_per_symbol = samples_per_symbol
self._gain_mu = gain_mu
@@ -215,24 +214,24 @@ class gfsk_demod(gr.hier_block2):
self._omega_relative_limit = omega_relative_limit
self._freq_error = freq_error
self._differential = False
-
+
if samples_per_symbol < 2:
- raise TypeError, "samples_per_symbol >= 2, is %f" % samples_per_symbol
+ raise TypeError("samples_per_symbol >= 2, is %f" % samples_per_symbol)
self._omega = samples_per_symbol*(1+self._freq_error)
if not self._gain_mu:
self._gain_mu = 0.175
-
- self._gain_omega = .25 * self._gain_mu * self._gain_mu # critically damped
- # Demodulate FM
- #sensitivity = (pi / 2) / samples_per_symbol
- self.fmdemod = analog.quadrature_demod_cf(1.0 / sensitivity)
+ self._gain_omega = .25 * self._gain_mu * self._gain_mu # critically damped
- # the clock recovery block tracks the symbol clock and resamples as needed.
- # the output of the block is a stream of soft symbols (float)
- self.clock_recovery = digital.clock_recovery_mm_ff(self._omega, self._gain_omega,
+ # Demodulate FM
+ #sensitivity = (pi / 2) / samples_per_symbol
+ self.fmdemod = analog.quadrature_demod_cf(1.0 / sensitivity)
+
+ # the clock recovery block tracks the symbol clock and resamples as needed.
+ # the output of the block is a stream of soft symbols (float)
+ self.clock_recovery = digital.clock_recovery_mm_ff(self._omega, self._gain_omega,
self._mu, self._gain_mu,
self._omega_relative_limit)
@@ -241,12 +240,12 @@ class gfsk_demod(gr.hier_block2):
if verbose:
self._print_verbage()
-
+
if log:
self._setup_logging()
- # Connect & Initialize base class
- self.connect(self, self.fmdemod, self.clock_recovery, self.slicer, self)
+ # Connect & Initialize base class
+ self.connect(self, self.fmdemod, self.clock_recovery, self.slicer, self)
def samples_per_symbol(self):
return self._samples_per_symbol
@@ -256,16 +255,16 @@ class gfsk_demod(gr.hier_block2):
return 1
def _print_verbage(self):
- print "bits per symbol = %d" % self.bits_per_symbol()
- print "M&M clock recovery omega = %f" % self._omega
- print "M&M clock recovery gain mu = %f" % self._gain_mu
- print "M&M clock recovery mu = %f" % self._mu
- print "M&M clock recovery omega rel. limit = %f" % self._omega_relative_limit
- print "frequency error = %f" % self._freq_error
+ print("bits per symbol = %d" % self.bits_per_symbol())
+ print("M&M clock recovery omega = %f" % self._omega)
+ print("M&M clock recovery gain mu = %f" % self._gain_mu)
+ print("M&M clock recovery mu = %f" % self._mu)
+ print("M&M clock recovery omega rel. limit = %f" % self._omega_relative_limit)
+ print("frequency error = %f" % self._freq_error)
def _setup_logging(self):
- print "Demodulation logging turned on."
+ print("Demodulation logging turned on.")
self.connect(self.fmdemod,
blocks.file_sink(gr.sizeof_float, "fmdemod.dat"))
self.connect(self.clock_recovery,
diff --git a/gr-digital/python/digital/gmsk.py b/gr-digital/python/digital/gmsk.py
index e7a92a95d..5e25a3d3a 100644
--- a/gr-digital/python/digital/gmsk.py
+++ b/gr-digital/python/digital/gmsk.py
@@ -1,26 +1,31 @@
#
-# GMSK modulation and demodulation.
+# GMSK modulation and demodulation.
#
#
# Copyright 2005-2007,2012 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
# See gnuradio-examples/python/digital for examples
@@ -31,8 +36,8 @@ import inspect
import numpy
from gnuradio import gr, blocks, analog, filter
-import modulation_utils
-import digital_swig as digital
+from . import modulation_utils
+from . import digital_swig as digital
# default values (used in __init__ and add_options)
_def_samples_per_symbol = 2
@@ -58,10 +63,10 @@ class gmsk_mod(gr.hier_block2):
"""
Hierarchical block for Gaussian Minimum Shift Key (GMSK)
modulation.
-
+
The input is a byte stream (unsigned char with packed bits)
and the output is the complex modulated signal at baseband.
-
+
Args:
samples_per_symbol: samples per baud >= 2 (integer)
bt: Gaussian filter bandwidth * symbol time (float)
@@ -75,9 +80,9 @@ class gmsk_mod(gr.hier_block2):
verbose=_def_verbose,
log=_def_log):
- gr.hier_block2.__init__(self, "gmsk_mod",
- gr.io_signature(1, 1, gr.sizeof_char), # Input signature
- gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
+ gr.hier_block2.__init__(self, "gmsk_mod",
+ gr.io_signature(1, 1, gr.sizeof_char), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
samples_per_symbol = int(samples_per_symbol)
self._samples_per_symbol = samples_per_symbol
@@ -85,40 +90,40 @@ class gmsk_mod(gr.hier_block2):
self._differential = False
if not isinstance(samples_per_symbol, int) or samples_per_symbol < 2:
- raise TypeError, ("samples_per_symbol must be an integer >= 2, is %r" % (samples_per_symbol,))
+ raise TypeError("samples_per_symbol must be an integer >= 2, is %r" % (samples_per_symbol,))
- ntaps = 4 * samples_per_symbol # up to 3 bits in filter at once
- sensitivity = (pi / 2) / samples_per_symbol # phase change per bit = pi / 2
+ ntaps = 4 * samples_per_symbol # up to 3 bits in filter at once
+ sensitivity = (old_div(pi / 2), samples_per_symbol) # phase change per bit = pi / 2
- # Turn it into NRZ data.
- #self.nrz = digital.bytes_to_syms()
+ # Turn it into NRZ data.
+ #self.nrz = digital.bytes_to_syms()
self.unpack = blocks.packed_to_unpacked_bb(1, gr.GR_MSB_FIRST)
self.nrz = digital.chunks_to_symbols_bf([-1, 1], 1)
- # Form Gaussian filter
+ # Form Gaussian filter
# Generate Gaussian response (Needs to be convolved with window below).
- self.gaussian_taps = filter.firdes.gaussian(
- 1, # gain
- samples_per_symbol, # symbol_rate
- bt, # bandwidth * symbol time
- ntaps # number of taps
- )
-
- self.sqwave = (1,) * samples_per_symbol # rectangular window
- self.taps = numpy.convolve(numpy.array(self.gaussian_taps),numpy.array(self.sqwave))
- self.gaussian_filter = filter.interp_fir_filter_fff(samples_per_symbol, self.taps)
-
- # FM modulation
- self.fmmod = analog.frequency_modulator_fc(sensitivity)
-
+ self.gaussian_taps = filter.firdes.gaussian(
+ 1, # gain
+ samples_per_symbol, # symbol_rate
+ bt, # bandwidth * symbol time
+ ntaps # number of taps
+ )
+
+ self.sqwave = (1,) * samples_per_symbol # rectangular window
+ self.taps = numpy.convolve(numpy.array(self.gaussian_taps),numpy.array(self.sqwave))
+ self.gaussian_filter = filter.interp_fir_filter_fff(samples_per_symbol, self.taps)
+
+ # FM modulation
+ self.fmmod = analog.frequency_modulator_fc(sensitivity)
+
if verbose:
self._print_verbage()
-
+
if log:
self._setup_logging()
- # Connect & Initialize base class
- self.connect(self, self.unpack, self.nrz, self.gaussian_filter, self.fmmod, self)
+ # Connect & Initialize base class
+ self.connect(self, self.unpack, self.nrz, self.gaussian_filter, self.fmmod, self)
def samples_per_symbol(self):
return self._samples_per_symbol
@@ -128,12 +133,12 @@ class gmsk_mod(gr.hier_block2):
return 1
def _print_verbage(self):
- print "bits per symbol = %d" % self.bits_per_symbol()
- print "Gaussian filter bt = %.2f" % self._bt
+ print("bits per symbol = %d" % self.bits_per_symbol())
+ print("Gaussian filter bt = %.2f" % self._bt)
def _setup_logging(self):
- print "Modulation logging turned on."
+ print("Modulation logging turned on.")
self.connect(self.nrz,
blocks.file_sink(gr.sizeof_float, "nrz.dat"))
self.connect(self.gaussian_filter,
@@ -166,10 +171,10 @@ class gmsk_demod(gr.hier_block2):
"""
Hierarchical block for Gaussian Minimum Shift Key (GMSK)
demodulation.
-
+
The input is the complex modulated signal at baseband.
The output is a stream of bits packed 1 bit per byte (the LSB)
-
+
Args:
samples_per_symbol: samples per baud (integer)
gain_mu: controls rate of mu adjustment (float)
@@ -179,7 +184,7 @@ class gmsk_demod(gr.hier_block2):
verbose: Print information about modulator? (boolean)
log: Print modualtion data to files? (boolean)
"""
-
+
def __init__(self,
samples_per_symbol=_def_samples_per_symbol,
gain_mu=_def_gain_mu,
@@ -189,9 +194,9 @@ class gmsk_demod(gr.hier_block2):
verbose=_def_verbose,
log=_def_log):
- gr.hier_block2.__init__(self, "gmsk_demod",
- gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
- gr.io_signature(1, 1, gr.sizeof_char)) # Output signature
+ gr.hier_block2.__init__(self, "gmsk_demod",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_char)) # Output signature
self._samples_per_symbol = samples_per_symbol
self._gain_mu = gain_mu
@@ -199,24 +204,24 @@ class gmsk_demod(gr.hier_block2):
self._omega_relative_limit = omega_relative_limit
self._freq_error = freq_error
self._differential = False
-
+
if samples_per_symbol < 2:
- raise TypeError, "samples_per_symbol >= 2, is %f" % samples_per_symbol
+ raise TypeError("samples_per_symbol >= 2, is %f" % samples_per_symbol)
self._omega = samples_per_symbol*(1+self._freq_error)
if not self._gain_mu:
self._gain_mu = 0.175
-
- self._gain_omega = .25 * self._gain_mu * self._gain_mu # critically damped
- # Demodulate FM
- sensitivity = (pi / 2) / samples_per_symbol
- self.fmdemod = analog.quadrature_demod_cf(1.0 / sensitivity)
+ self._gain_omega = .25 * self._gain_mu * self._gain_mu # critically damped
- # the clock recovery block tracks the symbol clock and resamples as needed.
- # the output of the block is a stream of soft symbols (float)
- self.clock_recovery = digital.clock_recovery_mm_ff(self._omega, self._gain_omega,
+ # Demodulate FM
+ sensitivity = (old_div(pi / 2), samples_per_symbol)
+ self.fmdemod = analog.quadrature_demod_cf(1.0 / sensitivity)
+
+ # the clock recovery block tracks the symbol clock and resamples as needed.
+ # the output of the block is a stream of soft symbols (float)
+ self.clock_recovery = digital.clock_recovery_mm_ff(self._omega, self._gain_omega,
self._mu, self._gain_mu,
self._omega_relative_limit)
@@ -225,12 +230,12 @@ class gmsk_demod(gr.hier_block2):
if verbose:
self._print_verbage()
-
+
if log:
self._setup_logging()
- # Connect & Initialize base class
- self.connect(self, self.fmdemod, self.clock_recovery, self.slicer, self)
+ # Connect & Initialize base class
+ self.connect(self, self.fmdemod, self.clock_recovery, self.slicer, self)
def samples_per_symbol(self):
return self._samples_per_symbol
@@ -240,16 +245,16 @@ class gmsk_demod(gr.hier_block2):
return 1
def _print_verbage(self):
- print "bits per symbol = %d" % self.bits_per_symbol()
- print "M&M clock recovery omega = %f" % self._omega
- print "M&M clock recovery gain mu = %f" % self._gain_mu
- print "M&M clock recovery mu = %f" % self._mu
- print "M&M clock recovery omega rel. limit = %f" % self._omega_relative_limit
- print "frequency error = %f" % self._freq_error
+ print("bits per symbol = %d" % self.bits_per_symbol())
+ print("M&M clock recovery omega = %f" % self._omega)
+ print("M&M clock recovery gain mu = %f" % self._gain_mu)
+ print("M&M clock recovery mu = %f" % self._mu)
+ print("M&M clock recovery omega rel. limit = %f" % self._omega_relative_limit)
+ print("frequency error = %f" % self._freq_error)
def _setup_logging(self):
- print "Demodulation logging turned on."
+ print("Demodulation logging turned on.")
self.connect(self.fmdemod,
blocks.file_sink(gr.sizeof_float, "fmdemod.dat"))
self.connect(self.clock_recovery,
diff --git a/gr-digital/python/digital/modulation_utils.py b/gr-digital/python/digital/modulation_utils.py
index d499094d0..57d7ccdae 100644
--- a/gr-digital/python/digital/modulation_utils.py
+++ b/gr-digital/python/digital/modulation_utils.py
@@ -22,6 +22,7 @@
Miscellaneous utilities for managing mods and demods, as well as other items
useful in dealing with generalized handling of different modulations and demods.
"""
+from __future__ import unicode_literals
import inspect
diff --git a/gr-digital/python/digital/ofdm.py b/gr-digital/python/digital/ofdm.py
index 563b70ad0..db15a4d3f 100644
--- a/gr-digital/python/digital/ofdm.py
+++ b/gr-digital/python/digital/ofdm.py
@@ -1,33 +1,38 @@
#!/usr/bin/env python
#
# Copyright 2006-2008,2013 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
import math
from gnuradio import gr, fft
from gnuradio import blocks
-import digital_swig as digital
-import ofdm_packet_utils
-from ofdm_receiver import ofdm_receiver
+from . import digital_swig as digital
+from . import ofdm_packet_utils
+from .ofdm_receiver import ofdm_receiver
import gnuradio.gr.gr_threading as _threading
-import psk, qam
+from . import psk, qam
# /////////////////////////////////////////////////////////////////////////////
# mod/demod with packets as i/o
@@ -37,12 +42,12 @@ class ofdm_mod(gr.hier_block2):
"""
Modulates an OFDM stream. Based on the options fft_length, occupied_tones, and
cp_length, this block creates OFDM symbols using a specified modulation option.
-
+
Send packets by calling send_pkt
"""
def __init__(self, options, msgq_limit=2, pad_for_usrp=True):
"""
- Hierarchical block for sending packets
+ Hierarchical block for sending packets
Packets to be sent are enqueued by calling send_pkt.
The output is the complex modulated signal at baseband.
@@ -53,9 +58,9 @@ class ofdm_mod(gr.hier_block2):
pad_for_usrp: If true, packets are padded such that they end up a multiple of 128 samples
"""
- gr.hier_block2.__init__(self, "ofdm_mod",
- gr.io_signature(0, 0, 0), # Input signature
- gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
+ gr.hier_block2.__init__(self, "ofdm_mod",
+ gr.io_signature(0, 0, 0), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
self._pad_for_usrp = pad_for_usrp
self._modulation = options.modulation
@@ -66,7 +71,7 @@ class ofdm_mod(gr.hier_block2):
win = [] #[1 for i in range(self._fft_length)]
# Use freq domain to get doubled-up known symbol for correlation in time domain
- zeros_on_left = int(math.ceil((self._fft_length - self._occupied_tones)/2.0))
+ zeros_on_left = int(math.ceil((self._fft_length - self._occupied_tones) / 2.0))
ksfreq = known_symbols_4512_3[0:self._occupied_tones]
for i in range(len(ksfreq)):
if((zeros_on_left + i) & 1):
@@ -74,46 +79,46 @@ class ofdm_mod(gr.hier_block2):
# hard-coded known symbols
preambles = (ksfreq,)
-
+
padded_preambles = list()
for pre in preambles:
padded = self._fft_length*[0,]
padded[zeros_on_left : zeros_on_left + self._occupied_tones] = pre
padded_preambles.append(padded)
-
+
symbol_length = options.fft_length + options.cp_length
-
+
mods = {"bpsk": 2, "qpsk": 4, "8psk": 8, "qam8": 8, "qam16": 16, "qam64": 64, "qam256": 256}
arity = mods[self._modulation]
-
+
rot = 1
if self._modulation == "qpsk":
rot = (0.707+0.707j)
-
+
# FIXME: pass the constellation objects instead of just the points
if(self._modulation.find("psk") >= 0):
constel = psk.psk_constellation(arity)
- rotated_const = map(lambda pt: pt * rot, constel.points())
+ rotated_const = [pt * rot for pt in constel.points()]
elif(self._modulation.find("qam") >= 0):
constel = qam.qam_constellation(arity)
- rotated_const = map(lambda pt: pt * rot, constel.points())
- #print rotated_const
+ rotated_const = [pt * rot for pt in constel.points()]
+ #print(rotated_const)
self._pkt_input = digital.ofdm_mapper_bcv(rotated_const,
msgq_limit,
options.occupied_tones,
options.fft_length)
-
+
self.preambles = digital.ofdm_insert_preamble(self._fft_length,
padded_preambles)
self.ifft = fft.fft_vcc(self._fft_length, False, win, True)
self.cp_adder = digital.ofdm_cyclic_prefixer(self._fft_length,
symbol_length)
self.scale = blocks.multiply_const_cc(1.0 / math.sqrt(self._fft_length))
-
+
self.connect((self._pkt_input, 0), (self.preambles, 0))
self.connect((self._pkt_input, 1), (self.preambles, 1))
self.connect(self.preambles, self.ifft, self.cp_adder, self.scale, self)
-
+
if options.verbose:
self._print_verbage()
@@ -137,12 +142,12 @@ class ofdm_mod(gr.hier_block2):
if eof:
msg = gr.message(1) # tell self._pkt_input we're not sending any more packets
else:
- # print "original_payload =", string_to_hex_list(payload)
+ # print("original_payload =", string_to_hex_list(payload))
pkt = ofdm_packet_utils.make_packet(payload, 1, 1,
self._pad_for_usrp,
whitening=True)
-
- #print "pkt =", string_to_hex_list(pkt)
+
+ #print("pkt =", string_to_hex_list(pkt))
msg = gr.message_from_string(pkt)
self._pkt_input.msgq().insert_tail(msg)
@@ -164,11 +169,11 @@ class ofdm_mod(gr.hier_block2):
"""
Prints information about the OFDM modulator
"""
- print "\nOFDM Modulator:"
- print "Modulation Type: %s" % (self._modulation)
- print "FFT length: %3d" % (self._fft_length)
- print "Occupied Tones: %3d" % (self._occupied_tones)
- print "CP length: %3d" % (self._cp_length)
+ print("\nOFDM Modulator:")
+ print("Modulation Type: %s" % (self._modulation))
+ print("FFT length: %3d" % (self._fft_length))
+ print("Occupied Tones: %3d" % (self._occupied_tones))
+ print("CP length: %3d" % (self._cp_length))
class ofdm_demod(gr.hier_block2):
@@ -183,18 +188,18 @@ class ofdm_demod(gr.hier_block2):
def __init__(self, options, callback=None):
"""
- Hierarchical block for demodulating and deframing packets.
+ Hierarchical block for demodulating and deframing packets.
- The input is the complex modulated signal at baseband.
+ The input is the complex modulated signal at baseband.
Demodulated packets are sent to the handler.
Args:
options: pass modulation options from higher layers (fft length, occupied tones, etc.)
callback: function of two args: ok, payload (ok: bool; payload: string)
- """
- gr.hier_block2.__init__(self, "ofdm_demod",
- gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
- gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
+ """
+ gr.hier_block2.__init__(self, "ofdm_demod",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
self._rcvd_pktq = gr.msg_queue() # holds packets from the PHY
@@ -206,7 +211,7 @@ class ofdm_demod(gr.hier_block2):
self._snr = options.snr
# Use freq domain to get doubled-up known symbol for correlation in time domain
- zeros_on_left = int(math.ceil((self._fft_length - self._occupied_tones)/2.0))
+ zeros_on_left = int(math.ceil((self._fft_length - self._occupied_tones) / 2.0))
ksfreq = known_symbols_4512_3[0:self._occupied_tones]
for i in range(len(ksfreq)):
if((zeros_on_left + i) & 1):
@@ -224,7 +229,7 @@ class ofdm_demod(gr.hier_block2):
mods = {"bpsk": 2, "qpsk": 4, "8psk": 8, "qam8": 8, "qam16": 16, "qam64": 64, "qam256": 256}
arity = mods[self._modulation]
-
+
rot = 1
if self._modulation == "qpsk":
rot = (0.707+0.707j)
@@ -232,15 +237,15 @@ class ofdm_demod(gr.hier_block2):
# FIXME: pass the constellation objects instead of just the points
if(self._modulation.find("psk") >= 0):
constel = psk.psk_constellation(arity)
- rotated_const = map(lambda pt: pt * rot, constel.points())
+ rotated_const = [pt * rot for pt in constel.points()]
elif(self._modulation.find("qam") >= 0):
constel = qam.qam_constellation(arity)
- rotated_const = map(lambda pt: pt * rot, constel.points())
- #print rotated_const
+ rotated_const = [pt * rot for pt in constel.points()]
+ #print(rotated_const)
phgain = 0.25
frgain = phgain*phgain / 4.0
- self.ofdm_demod = digital.ofdm_frame_sink(rotated_const, range(arity),
+ self.ofdm_demod = digital.ofdm_frame_sink(rotated_const, list(range(arity)),
self._rcvd_pktq,
self._occupied_tones,
phgain, frgain)
@@ -263,7 +268,7 @@ class ofdm_demod(gr.hier_block2):
if options.verbose:
self._print_verbage()
-
+
self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback)
@staticmethod
@@ -286,11 +291,11 @@ class ofdm_demod(gr.hier_block2):
"""
Prints information about the OFDM demodulator
"""
- print "\nOFDM Demodulator:"
- print "Modulation Type: %s" % (self._modulation)
- print "FFT length: %3d" % (self._fft_length)
- print "Occupied Tones: %3d" % (self._occupied_tones)
- print "CP length: %3d" % (self._cp_length)
+ print("\nOFDM Demodulator:")
+ print("Modulation Type: %s" % (self._modulation))
+ print("FFT length: %3d" % (self._fft_length))
+ print("Occupied Tones: %3d" % (self._occupied_tones))
+ print("CP length: %3d" % (self._cp_length))
diff --git a/gr-digital/python/digital/ofdm_packet_utils.py b/gr-digital/python/digital/ofdm_packet_utils.py
index e9ca641c7..e26308a26 100644
--- a/gr-digital/python/digital/ofdm_packet_utils.py
+++ b/gr-digital/python/digital/ofdm_packet_utils.py
@@ -19,10 +19,15 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
import struct
import numpy
from gnuradio import gru
-import crc
+from . import crc
def conv_packed_binary_string_to_1_0_string(s):
"""
@@ -35,7 +40,7 @@ def conv_packed_binary_string_to_1_0_string(s):
t = (x >> i) & 0x1
r.append(t)
- return ''.join(map(lambda x: chr(x + ord('0')), r))
+ return ''.join([chr(x + ord('0')) for x in r])
def conv_1_0_string_to_packed_binary_string(s):
"""
@@ -46,7 +51,7 @@ def conv_1_0_string_to_packed_binary_string(s):
to get to a multiple of 8.
"""
if not is_1_0_string(s):
- raise ValueError, "Input must be a string containing only 0's and 1's"
+ raise ValueError("Input must be a string containing only 0's and 1's")
# pad to multiple of 8
padded = False
@@ -78,7 +83,7 @@ def is_1_0_string(s):
return True
def string_to_hex_list(s):
- return map(lambda x: hex(ord(x)), s)
+ return [hex(ord(x)) for x in s]
def whiten(s, o):
@@ -93,7 +98,7 @@ def dewhiten(s, o):
def make_header(payload_len, whitener_offset=0):
# Upper nibble is offset, lower 12 bits is len
val = ((whitener_offset & 0xf) << 12) | (payload_len & 0x0fff)
- #print "offset =", whitener_offset, " len =", payload_len, " val=", val
+ #print("offset =", whitener_offset, " len =", payload_len, " val=", val)
return struct.pack('!HH', val, val)
def make_packet(payload, samples_per_symbol, bits_per_symbol,
@@ -113,15 +118,15 @@ def make_packet(payload, samples_per_symbol, bits_per_symbol,
"""
if not whitener_offset >=0 and whitener_offset < 16:
- raise ValueError, "whitener_offset must be between 0 and 15, inclusive (%i)" % (whitener_offset,)
+ raise ValueError("whitener_offset must be between 0 and 15, inclusive (%i)" % (whitener_offset,))
payload_with_crc = crc.gen_and_append_crc32(payload)
- #print "outbound crc =", string_to_hex_list(payload_with_crc[-4:])
+ #print("outbound crc =", string_to_hex_list(payload_with_crc[-4:]))
L = len(payload_with_crc)
MAXLEN = len(random_mask_tuple)
if L > MAXLEN:
- raise ValueError, "len(payload) must be in [0, %d]" % (MAXLEN,)
+ raise ValueError("len(payload) must be in [0, %d]" % (MAXLEN,))
pkt_hd = make_header(L, whitener_offset)
pkt_dt = ''.join((payload_with_crc, '\x55'))
@@ -136,7 +141,7 @@ def make_packet(payload, samples_per_symbol, bits_per_symbol,
else:
pkt = pkt_hd + pkt_dt
- #print "make_packet: len(pkt) =", len(pkt)
+ #print("make_packet: len(pkt) =", len(pkt))
return pkt
@@ -157,7 +162,7 @@ def _npadding_bytes(pkt_byte_len, samples_per_symbol, bits_per_symbol):
number of bytes of padding to append.
"""
modulus = 128
- byte_modulus = gru.lcm(modulus/8, samples_per_symbol) * bits_per_symbol / samples_per_symbol
+ byte_modulus = gru.lcm(modulus / 8, samples_per_symbol) * bits_per_symbol / samples_per_symbol
r = pkt_byte_len % byte_modulus
if r == 0:
return 0
@@ -182,9 +187,9 @@ def unmake_packet(whitened_payload_with_crc, whitener_offset=0, dewhitening=1):
ok, payload = crc.check_crc32(payload_with_crc)
if 0:
- print "payload_with_crc =", string_to_hex_list(payload_with_crc)
- print "ok = %r, len(payload) = %d" % (ok, len(payload))
- print "payload =", string_to_hex_list(payload)
+ print("payload_with_crc =", string_to_hex_list(payload_with_crc))
+ print("ok = %r, len(payload) = %d" % (ok, len(payload)))
+ print("payload =", string_to_hex_list(payload))
return ok, payload
diff --git a/gr-digital/python/digital/ofdm_receiver.py b/gr-digital/python/digital/ofdm_receiver.py
index 4b7836b43..d23b338b7 100644
--- a/gr-digital/python/digital/ofdm_receiver.py
+++ b/gr-digital/python/digital/ofdm_receiver.py
@@ -1,24 +1,28 @@
#!/usr/bin/env python
#
# Copyright 2006-2008 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
import math
from numpy import fft
@@ -28,16 +32,12 @@ from gnuradio import analog
from gnuradio import blocks
from gnuradio import filter
-import digital_swig as digital
-from ofdm_sync_pn import ofdm_sync_pn
-from ofdm_sync_fixed import ofdm_sync_fixed
-from ofdm_sync_pnac import ofdm_sync_pnac
-from ofdm_sync_ml import ofdm_sync_ml
+from . import digital_swig as digital
+from .ofdm_sync_pn import ofdm_sync_pn
+from .ofdm_sync_fixed import ofdm_sync_fixed
+from .ofdm_sync_pnac import ofdm_sync_pnac
+from .ofdm_sync_ml import ofdm_sync_ml
-try:
- from gnuradio import filter
-except ImportError:
- import filter_swig as filter
class ofdm_receiver(gr.hier_block2):
"""
@@ -51,9 +51,9 @@ class ofdm_receiver(gr.hier_block2):
def __init__(self, fft_length, cp_length, occupied_tones, snr, ks, logging=False):
"""
- Hierarchical block for receiving OFDM symbols.
+ Hierarchical block for receiving OFDM symbols.
- The input is the complex modulated signal at baseband.
+ The input is the complex modulated signal at baseband.
Synchronized packets are sent back to the demodulator.
Args:
@@ -63,13 +63,13 @@ class ofdm_receiver(gr.hier_block2):
snr: estimated signal to noise ratio used to guide cyclic prefix synchronizer (float)
ks: known symbols used as preambles to each packet (list of lists)
logging: turn file logging on or off (bool)
- """
+ """
- gr.hier_block2.__init__(self, "ofdm_receiver",
- gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.hier_block2.__init__(self, "ofdm_receiver",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
gr.io_signature2(2, 2, gr.sizeof_gr_complex*occupied_tones, gr.sizeof_char)) # Output signature
-
- bw = (float(occupied_tones) / float(fft_length)) / 2.0
+
+ bw = (old_div(float(occupied_tones) / float(fft_length)), 2.0)
tb = bw*0.08
chan_coeffs = filter.firdes.low_pass (1.0, # gain
1.0, # sampling rate
@@ -77,13 +77,13 @@ class ofdm_receiver(gr.hier_block2):
tb, # width of trans. band
filter.firdes.WIN_HAMMING) # filter type
self.chan_filt = filter.fft_filter_ccc(1, chan_coeffs)
-
+
win = [1 for i in range(fft_length)]
- zeros_on_left = int(math.ceil((fft_length - occupied_tones)/2.0))
+ zeros_on_left = int(math.ceil((fft_length - occupied_tones) / 2.0))
ks0 = fft_length*[0,]
ks0[zeros_on_left : zeros_on_left + occupied_tones] = ks[0]
-
+
ks0 = fft.ifftshift(ks0)
ks0time = fft.ifft(ks0)
# ADD SCALING FACTOR
@@ -91,19 +91,19 @@ class ofdm_receiver(gr.hier_block2):
SYNC = "pn"
if SYNC == "ml":
- nco_sensitivity = -1.0/fft_length # correct for fine frequency
+ nco_sensitivity = -1.0 / fft_length # correct for fine frequency
self.ofdm_sync = ofdm_sync_ml(fft_length,
cp_length,
snr,
ks0time,
logging)
elif SYNC == "pn":
- nco_sensitivity = -2.0/fft_length # correct for fine frequency
+ nco_sensitivity = -2.0 / fft_length # correct for fine frequency
self.ofdm_sync = ofdm_sync_pn(fft_length,
cp_length,
logging)
elif SYNC == "pnac":
- nco_sensitivity = -2.0/fft_length # correct for fine frequency
+ nco_sensitivity = -2.0 / fft_length # correct for fine frequency
self.ofdm_sync = ofdm_sync_pnac(fft_length,
cp_length,
ks0time,
@@ -111,10 +111,10 @@ class ofdm_receiver(gr.hier_block2):
# for testing only; do not user over the air
# remove filter and filter delay for this
elif SYNC == "fixed":
- self.chan_filt = blocks.multiply_const_cc(1.0)
+ self.chan_filt = blocks.multiply_const_cc(1.0)
nsymbols = 18 # enter the number of symbols per packet
freq_offset = 0.0 # if you use a frequency offset, enter it here
- nco_sensitivity = -2.0/fft_length # correct for fine frequency
+ nco_sensitivity = -2.0 / fft_length # correct for fine frequency
self.ofdm_sync = ofdm_sync_fixed(fft_length,
cp_length,
nsymbols,
diff --git a/gr-digital/python/digital/ofdm_sync_fixed.py b/gr-digital/python/digital/ofdm_sync_fixed.py
index 9cbd59b94..891ba17d0 100644
--- a/gr-digital/python/digital/ofdm_sync_fixed.py
+++ b/gr-digital/python/digital/ofdm_sync_fixed.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
import math
from gnuradio import gr
from gnuradio import blocks
diff --git a/gr-digital/python/digital/ofdm_sync_ml.py b/gr-digital/python/digital/ofdm_sync_ml.py
index 3afd64709..6a03c2163 100644
--- a/gr-digital/python/digital/ofdm_sync_ml.py
+++ b/gr-digital/python/digital/ofdm_sync_ml.py
@@ -1,37 +1,31 @@
#!/usr/bin/env python
#
# Copyright 2007,2008 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import division
+from __future__ import unicode_literals
-import math
-from gnuradio import gr
-try:
- from gnuradio import filter
-except ImportError:
- import filter_swig as filter
+from gnuradio import gr, blocks, filter
-try:
- from gnuradio import blocks
-except ImportError:
- import blocks_swig as blocks
class ofdm_sync_ml(gr.hier_block2):
def __init__(self, fft_length, cp_length, snr, kstime, logging):
@@ -41,13 +35,13 @@ class ofdm_sync_ml(gr.hier_block2):
Signal Processing, vol. 45, no. 7, pp. 1800-1805, 1997.
'''
- gr.hier_block2.__init__(self, "ofdm_sync_ml",
- gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.hier_block2.__init__(self, "ofdm_sync_ml",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
gr.io_signature2(2, 2, gr.sizeof_float, gr.sizeof_char)) # Output signature
self.input = blocks.add_const_cc(0)
- SNR = 10.0**(snr/10.0)
+ SNR = 10.0**(snr / 10.0)
rho = SNR / (SNR + 1.0)
symbol_length = fft_length + cp_length
@@ -66,15 +60,15 @@ class ofdm_sync_ml(gr.hier_block2):
self.magsqrd2 = blocks.complex_to_mag_squared()
self.adder = blocks.add_ff()
- moving_sum_taps = [rho/2 for i in range(cp_length)]
+ moving_sum_taps = [rho / 2 for i in range(cp_length)]
self.moving_sum_filter = filter.fir_filter_fff(1,moving_sum_taps)
-
+
self.connect(self.input,self.magsqrd1)
self.connect(self.delay,self.magsqrd2)
self.connect(self.magsqrd1,(self.adder,0))
self.connect(self.magsqrd2,(self.adder,1))
self.connect(self.adder,self.moving_sum_filter)
-
+
# Correlation from ML Sync
self.conjg = blocks.conjugate_cc();
@@ -82,7 +76,7 @@ class ofdm_sync_ml(gr.hier_block2):
movingsum2_taps = [1.0 for i in range(cp_length)]
self.movingsum2 = filter.fir_filter_ccf(1,movingsum2_taps)
-
+
# Correlator data handler
self.c2mag = blocks.complex_to_mag()
self.angle = blocks.complex_to_arg()
@@ -104,7 +98,7 @@ class ofdm_sync_ml(gr.hier_block2):
# use the sync loop values to set the sampler and the NCO
# self.diff = theta
# self.angle = epsilon
-
+
self.connect(self.diff, self.pk_detect)
# The DPLL corrects for timing differences between CP correlations
@@ -115,7 +109,7 @@ class ofdm_sync_ml(gr.hier_block2):
self.connect(self.dpll, (self.sample_and_hold,1))
else:
self.connect(self.pk_detect, (self.sample_and_hold,1))
-
+
self.connect(self.angle, (self.sample_and_hold,0))
################################
@@ -130,7 +124,7 @@ class ofdm_sync_ml(gr.hier_block2):
self.div = blocks.divide_ff()
# The output signature of the correlation has a few spikes because the rest of the
- # system uses the repeated preamble symbol. It needs to work that generically if
+ # system uses the repeated preamble symbol. It needs to work that generically if
# anyone wants to use this against a WiMAX-like signal since it, too, repeats.
# The output theta of the correlator above is multiplied with this correlation to
# identify the proper peak and remove other products in this cross-correlation
@@ -139,17 +133,17 @@ class ofdm_sync_ml(gr.hier_block2):
self.f2b = blocks.float_to_char()
self.b2f = blocks.char_to_float()
self.mul = blocks.multiply_ff()
-
+
# Normalize the power of the corr output by the energy. This is not really needed
# and could be removed for performance, but it makes for a cleaner signal.
# if this is removed, the threshold value needs adjustment.
self.connect(self.input, self.kscorr, self.corrmag, (self.div,0))
self.connect(self.moving_sum_filter, (self.div,1))
-
+
self.connect(self.div, (self.mul,0))
self.connect(self.pk_detect, self.b2f, (self.mul,1))
self.connect(self.mul, self.slice)
-
+
# Set output signals
# Output 0: fine frequency correction value
# Output 1: timing signal
diff --git a/gr-digital/python/digital/ofdm_sync_pn.py b/gr-digital/python/digital/ofdm_sync_pn.py
index 0e79c67ca..119283067 100644
--- a/gr-digital/python/digital/ofdm_sync_pn.py
+++ b/gr-digital/python/digital/ofdm_sync_pn.py
@@ -1,38 +1,31 @@
#!/usr/bin/env python
#
# Copyright 2007,2008 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import division
+from __future__ import unicode_literals
-import math
-from numpy import fft
-from gnuradio import gr
-try:
- from gnuradio import filter
-except ImportError:
- import filter_swig as filter
+from gnuradio import gr, blocks, filter
-try:
- from gnuradio import blocks
-except ImportError:
- import blocks_swig as blocks
class ofdm_sync_pn(gr.hier_block2):
def __init__(self, fft_length, cp_length, logging=False):
@@ -52,7 +45,7 @@ class ofdm_sync_pn(gr.hier_block2):
# PN Sync
# Create a delay line
- self.delay = blocks.delay(gr.sizeof_gr_complex, fft_length/2)
+ self.delay = blocks.delay(gr.sizeof_gr_complex, fft_length / 2)
# Correlation from ML Sync
self.conjg = blocks.conjugate_cc();
@@ -98,10 +91,10 @@ class ofdm_sync_pn(gr.hier_block2):
self.connect(self.c2mag, (self.normalize,0))
# Create a moving sum filter for the corr output
- matched_filter_taps = [1.0/cp_length for i in range(cp_length)]
+ matched_filter_taps = [1.0 / cp_length for i in range(cp_length)]
self.matched_filter = filter.fir_filter_fff(1,matched_filter_taps)
self.connect(self.normalize, self.matched_filter)
-
+
self.connect(self.matched_filter, self.sub1, self.pk_detect)
#self.connect(self.matched_filter, self.pk_detect)
self.connect(self.pk_detect, (self.sample_and_hold,1))
diff --git a/gr-digital/python/digital/ofdm_sync_pnac.py b/gr-digital/python/digital/ofdm_sync_pnac.py
index 55a6c21f4..4d756f7ff 100644
--- a/gr-digital/python/digital/ofdm_sync_pnac.py
+++ b/gr-digital/python/digital/ofdm_sync_pnac.py
@@ -1,38 +1,31 @@
#!/usr/bin/env python
#
# Copyright 2007 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import division
+from __future__ import unicode_literals
-import math
-from numpy import fft
-from gnuradio import gr
-try:
- from gnuradio import filter
-except ImportError:
- import filter_swig as filter
+from gnuradio import gr, blocks, filter
-try:
- from gnuradio import blocks
-except ImportError:
- import blocks_swig as blocks
class ofdm_sync_pnac(gr.hier_block2):
def __init__(self, fft_length, cp_length, kstime, logging=False):
@@ -69,9 +62,9 @@ class ofdm_sync_pnac(gr.hier_block2):
kstime = [k.conjugate() for k in kstime[0:fft_length//2]]
kstime.reverse()
self.crosscorr_filter = filter.fir_filter_ccc(1, kstime)
-
+
# Create a delay line
- self.delay = blocks.delay(gr.sizeof_gr_complex, fft_length/2)
+ self.delay = blocks.delay(gr.sizeof_gr_complex, fft_length / 2)
# Correlation from ML Sync
self.conjg = blocks.conjugate_cc();
@@ -105,7 +98,7 @@ class ofdm_sync_pnac(gr.hier_block2):
self.connect(self.corr, self.c2mag)
self.connect(self.corr, self.angle)
self.connect(self.angle, (self.sample_and_hold,0))
-
+
# Get the power of the input signal to compare against the correlation
self.connect(self.crosscorr_filter, self.mag, self.power)
diff --git a/gr-digital/python/digital/ofdm_txrx.py b/gr-digital/python/digital/ofdm_txrx.py
index 6f96fc628..f90a57938 100644
--- a/gr-digital/python/digital/ofdm_txrx.py
+++ b/gr-digital/python/digital/ofdm_txrx.py
@@ -25,24 +25,21 @@ For simple configurations, no need to connect all the relevant OFDM blocks
to form an OFDM Tx/Rx--simply use these.
"""
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
# Reminder: All frequency-domain stuff is in shifted form, i.e. DC carrier
# in the middle!
+
import numpy
-from gnuradio import gr
-import digital_swig as digital
-from utils import tagged_streams
-try:
- # This will work when feature #505 is added.
- from gnuradio import fft
- from gnuradio import blocks
- from gnuradio import analog
-except ImportError:
- # Until then this will work.
- import fft_swig as fft
- import blocks_swig as blocks
- import analog_swig as analog
+from gnuradio import gr, blocks, fft, analog
+
+from . import digital_swig as digital
+
_def_fft_len = 64
_def_cp_len = 16
@@ -50,7 +47,7 @@ _def_frame_length_tag_key = "frame_length"
_def_packet_length_tag_key = "packet_length"
_def_packet_num_tag_key = "packet_num"
# Data and pilot carriers are same as in 802.11a
-_def_occupied_carriers = (range(-26, -21) + range(-20, -7) + range(-6, 0) + range(1, 7) + range(8, 21) + range(22, 27),)
+_def_occupied_carriers = (list(range(-26, -21)) + list(range(-20, -7)) + list(range(-6, 0)) + list(range(1, 7)) + list(range(8, 21)) + list(range(22, 27)),)
_def_pilot_carriers=((-21, -7, 7, 21,),)
_pilot_sym_scramble_seq = (
1,1,1,1, -1,-1,-1,1, -1,-1,-1,-1, 1,1,-1,1, -1,-1,1,1, -1,1,1,-1, 1,1,1,1, 1,1,-1,1,
@@ -112,7 +109,7 @@ def _get_constellation(bps):
try:
return constellation[bps]
except KeyError:
- print 'Modulation not supported.'
+ print('Modulation not supported.')
exit(1)
class ofdm_tx(gr.hier_block2):
diff --git a/gr-digital/python/digital/packet_utils.py b/gr-digital/python/digital/packet_utils.py
index de7e2988d..04d27125f 100644
--- a/gr-digital/python/digital/packet_utils.py
+++ b/gr-digital/python/digital/packet_utils.py
@@ -19,10 +19,18 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+
import struct
+
import numpy
+import six
+
from gnuradio import gru
-import crc
+from . import crc
+
def conv_packed_binary_string_to_1_0_string(s):
"""
@@ -35,7 +43,7 @@ def conv_packed_binary_string_to_1_0_string(s):
t = (x >> i) & 0x1
r.append(t)
- return ''.join(map(lambda x: chr(x + ord('0')), r))
+ return ''.join([chr(x + ord('0')) for x in r])
def conv_1_0_string_to_packed_binary_string(s):
"""
@@ -46,7 +54,7 @@ def conv_1_0_string_to_packed_binary_string(s):
to get to a multiple of 8.
"""
if not is_1_0_string(s):
- raise ValueError, "Input must be a string containing only 0's and 1's"
+ raise ValueError("Input must be a string containing only 0's and 1's")
# pad to multiple of 8
padded = False
@@ -83,7 +91,7 @@ def is_1_0_string(s):
return True
def string_to_hex_list(s):
- return map(lambda x: hex(ord(x)), s)
+ return [hex(ord(x)) for x in s]
def whiten(s, o):
@@ -98,8 +106,8 @@ def dewhiten(s, o):
def make_header(payload_len, whitener_offset=0):
# Upper nibble is offset, lower 12 bits is len
val = ((whitener_offset & 0xf) << 12) | (payload_len & 0x0fff)
- #print "offset =", whitener_offset, " len =", payload_len, " val=", val
- return struct.pack('!HH', val, val)
+ #print("offset =", whitener_offset, " len =", payload_len, " val=", val)
+ return struct.pack(b'!HH', val, val)
def make_packet(payload, samples_per_symbol, bits_per_symbol,
preamble=default_preamble, access_code=default_access_code,
@@ -123,13 +131,13 @@ def make_packet(payload, samples_per_symbol, bits_per_symbol,
and finally CRC-32.
"""
if not is_1_0_string(preamble):
- raise ValueError, "preamble must be a string containing only 0's and 1's (%r)" % (preamble,)
+ raise ValueError("preamble must be a string containing only 0's and 1's (%r)" % (preamble,))
if not is_1_0_string(access_code):
- raise ValueError, "access_code must be a string containing only 0's and 1's (%r)" % (access_code,)
+ raise ValueError("access_code must be a string containing only 0's and 1's (%r)" % (access_code,))
if not whitener_offset >=0 and whitener_offset < 16:
- raise ValueError, "whitener_offset must be between 0 and 15, inclusive (%i)" % (whitener_offset,)
+ raise ValueError("whitener_offset must be between 0 and 15, inclusive (%i)" % (whitener_offset,))
(packed_access_code, padded) = conv_1_0_string_to_packed_binary_string(access_code)
(packed_preamble, ignore) = conv_1_0_string_to_packed_binary_string(preamble)
@@ -138,24 +146,24 @@ def make_packet(payload, samples_per_symbol, bits_per_symbol,
payload_with_crc = crc.gen_and_append_crc32(payload)
else:
payload_with_crc = payload
- #print "outbound crc =", string_to_hex_list(payload_with_crc[-4:])
+ #print("outbound crc =", string_to_hex_list(payload_with_crc[-4:]))
L = len(payload_with_crc)
MAXLEN = len(random_mask_tuple)
if L > MAXLEN:
- raise ValueError, "len(payload) must be in [0, %d]" % (MAXLEN,)
+ raise ValueError("len(payload) must be in [0, %d]" % (MAXLEN,))
if whitening:
- pkt = ''.join((packed_preamble, packed_access_code, make_header(L, whitener_offset),
- whiten(payload_with_crc, whitener_offset), '\x55'))
+ pkt = b''.join((packed_preamble, packed_access_code, make_header(L, whitener_offset),
+ whiten(payload_with_crc, whitener_offset), b'\x55'))
else:
- pkt = ''.join((packed_preamble, packed_access_code, make_header(L, whitener_offset),
- (payload_with_crc), '\x55'))
+ pkt = b''.join((packed_preamble, packed_access_code, make_header(L, whitener_offset),
+ (payload_with_crc), b'\x55'))
if pad_for_usrp:
- pkt = pkt + (_npadding_bytes(len(pkt), int(samples_per_symbol), bits_per_symbol) * '\x55')
+ pkt = pkt + (_npadding_bytes(len(pkt), int(samples_per_symbol), bits_per_symbol) * b'\x55')
- #print "make_packet: len(pkt) =", len(pkt)
+ #print("make_packet: len(pkt) =", len(pkt))
return pkt
def _npadding_bytes(pkt_byte_len, samples_per_symbol, bits_per_symbol):
@@ -175,7 +183,7 @@ def _npadding_bytes(pkt_byte_len, samples_per_symbol, bits_per_symbol):
number of bytes of padding to append.
"""
modulus = 128
- byte_modulus = gru.lcm(modulus/8, samples_per_symbol) * bits_per_symbol / samples_per_symbol
+ byte_modulus = gru.lcm(modulus // 8, samples_per_symbol) * bits_per_symbol // samples_per_symbol
r = pkt_byte_len % byte_modulus
if r == 0:
return 0
@@ -206,10 +214,10 @@ def unmake_packet(whitened_payload_with_crc, whitener_offset=0,
ok = True
if 0:
- print "payload_with_crc =", string_to_hex_list(payload_with_crc)
- print "ok = %r, len(payload) = %d" % (ok, len(payload))
- print "payload =", string_to_hex_list(payload)
- print ""
+ print("payload_with_crc =", string_to_hex_list(payload_with_crc))
+ print("ok = %r, len(payload) = %d" % (ok, len(payload)))
+ print("payload =", string_to_hex_list(payload))
+ print("")
return ok, payload
diff --git a/gr-digital/python/digital/pkt.py b/gr-digital/python/digital/pkt.py
index fbdcaa3a6..585a2915c 100644
--- a/gr-digital/python/digital/pkt.py
+++ b/gr-digital/python/digital/pkt.py
@@ -1,34 +1,34 @@
#
# Copyright 2005, 2006, 2007 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import unicode_literals
from math import pi
-from gnuradio import gr
+from gnuradio import gr, blocks
import gnuradio.gr.gr_threading as _threading
-import packet_utils
-import digital_swig as digital
+from . import packet_utils
+from . import digital_swig as digital
-try:
- from gnuradio import blocks
-except ImportError:
- import blocks_swig as blocks
# /////////////////////////////////////////////////////////////////////////////
# mod/demod with packets as i/o
@@ -43,7 +43,7 @@ class mod_pkts(gr.hier_block2):
def __init__(self, modulator, preamble=None, access_code=None, msgq_limit=2,
pad_for_usrp=True, use_whitener_offset=False, modulate=True):
"""
- Hierarchical block for sending packets
+ Hierarchical block for sending packets
Packets to be sent are enqueued by calling send_pkt.
The output is the complex modulated signal at baseband.
@@ -54,29 +54,29 @@ class mod_pkts(gr.hier_block2):
msgq_limit: maximum number of messages in message queue (int)
pad_for_usrp: If true, packets are padded such that they end up a multiple of 128 samples
use_whitener_offset: If true, start of whitener XOR string is incremented each packet
-
+
See gmsk_mod for remaining parameters
"""
- gr.hier_block2.__init__(self, "mod_pkts",
- gr.io_signature(0, 0, 0), # Input signature
- gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
+ gr.hier_block2.__init__(self, "mod_pkts",
+ gr.io_signature(0, 0, 0), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
self._modulator = modulator
self._pad_for_usrp = pad_for_usrp
self._use_whitener_offset = use_whitener_offset
self._whitener_offset = 0
-
+
if access_code is None:
access_code = packet_utils.default_access_code
if not packet_utils.is_1_0_string(access_code):
- raise ValueError, "Invalid access_code %r. Must be string of 1's and 0's" % (access_code,)
+ raise ValueError("Invalid access_code %r. Must be string of 1's and 0's" % (access_code,))
self._access_code = access_code
-
+
if preamble is None:
preamble = packet_utils.default_preamble
if not packet_utils.is_1_0_string(preamble):
- raise ValueError, "Invalid preamble %r. Must be string of 1's and 0's" % (preamble,)
+ raise ValueError("Invalid preamble %r. Must be string of 1's and 0's" % (preamble,))
self._preamble = preamble
# accepts messages from the outside world
@@ -93,7 +93,7 @@ class mod_pkts(gr.hier_block2):
if eof:
msg = gr.message(1) # tell self._pkt_input we're not sending any more packets
else:
- # print "original_payload =", string_to_hex_list(payload)
+ # print("original_payload =", string_to_hex_list(payload))
pkt = packet_utils.make_packet(payload,
self._modulator.samples_per_symbol(),
self._modulator.bits_per_symbol(),
@@ -101,11 +101,11 @@ class mod_pkts(gr.hier_block2):
self._access_code,
self._pad_for_usrp,
self._whitener_offset)
- #print "pkt =", string_to_hex_list(pkt)
+ #print("pkt =", string_to_hex_list(pkt))
msg = gr.message_from_string(pkt)
if self._use_whitener_offset is True:
self._whitener_offset = (self._whitener_offset + 1) % 16
-
+
self._pkt_input.msgq().insert_tail(msg)
@@ -120,9 +120,9 @@ class demod_pkts(gr.hier_block2):
def __init__(self, demodulator, access_code=None, callback=None, threshold=-1):
"""
- Hierarchical block for demodulating and deframing packets.
+ Hierarchical block for demodulating and deframing packets.
- The input is the complex modulated signal at baseband.
+ The input is the complex modulated signal at baseband.
Demodulated packets are sent to the handler.
Args:
@@ -130,17 +130,17 @@ class demod_pkts(gr.hier_block2):
access_code: AKA sync vector (string of 1's and 0's)
callback: function of two args: ok, payload (ok: bool; payload: string)
threshold: detect access_code with up to threshold bits wrong (-1 -> use default) (int)
- """
+ """
- gr.hier_block2.__init__(self, "demod_pkts",
- gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
- gr.io_signature(0, 0, 0)) # Output signature
+ gr.hier_block2.__init__(self, "demod_pkts",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
+ gr.io_signature(0, 0, 0)) # Output signature
self._demodulator = demodulator
if access_code is None:
access_code = packet_utils.default_access_code
if not packet_utils.is_1_0_string(access_code):
- raise ValueError, "Invalid access_code %r. Must be string of 1's and 0's" % (access_code,)
+ raise ValueError("Invalid access_code %r. Must be string of 1's and 0's" % (access_code,))
self._access_code = access_code
if threshold == -1:
@@ -151,7 +151,7 @@ class demod_pkts(gr.hier_block2):
self.framer_sink = digital.framer_sink_1(self._rcvd_pktq)
self.connect(self, self._demodulator, self.correlator, self.framer_sink)
-
+
self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback)
diff --git a/gr-digital/python/digital/psk.py b/gr-digital/python/digital/psk.py
index 0e0c65ea2..5518ba55f 100644
--- a/gr-digital/python/digital/psk.py
+++ b/gr-digital/python/digital/psk.py
@@ -1,36 +1,40 @@
#
# Copyright 2005,2006,2011 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
"""
PSK modulation and demodulation.
"""
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
from math import pi, log
from cmath import exp
-import digital_swig
-import modulation_utils
-from utils import mod_codes, gray_code
-from generic_mod_demod import generic_mod, generic_demod
-from generic_mod_demod import shared_mod_args, shared_demod_args
+from . import digital_swig
+from . import modulation_utils
+from .utils import mod_codes, gray_code
+from .generic_mod_demod import generic_mod, generic_demod
+from .generic_mod_demod import shared_mod_args, shared_demod_args
# Default number of points in constellation.
_def_constellation_points = 4
@@ -56,7 +60,7 @@ def create_encodings(mod_code, arity, differential):
else:
raise ValueError('That modulation code is not implemented for this constellation.')
return (pre_diff_code, post_diff_code)
-
+
# /////////////////////////////////////////////////////////////////////////////
# PSK constellation
# /////////////////////////////////////////////////////////////////////////////
@@ -68,7 +72,7 @@ def psk_constellation(m=_def_constellation_points, mod_code=_def_mod_code,
"""
k = log(m) / log(2.0)
if (k != int(k)):
- raise StandardError('Number of constellation points must be a power of two.')
+ raise Exception('Number of constellation points must be a power of two.')
points = [exp(2*pi*(0+1j)*i/m) for i in range(0,m)]
pre_diff_code, post_diff_code = create_encodings(mod_code, m, differential)
if post_diff_code is not None:
@@ -84,7 +88,7 @@ def psk_constellation(m=_def_constellation_points, mod_code=_def_mod_code,
class psk_mod(generic_mod):
"""
Hierarchical block for RRC-filtered PSK modulation.
-
+
The input is a byte stream (unsigned char), treated as a series of packed
symbols. Symbols are grouped from MSB to LSB.
@@ -118,7 +122,7 @@ class psk_demod(generic_demod):
"""
Hierarchical block for RRC-filtered PSK modulation.
-
+
The input is a complex modulated signal at baseband.
The output is a stream of bytes, each representing a recovered bit.
diff --git a/gr-digital/python/digital/psk_constellations.py b/gr-digital/python/digital/psk_constellations.py
index ee3c2e607..781b076f1 100755..100644
--- a/gr-digital/python/digital/psk_constellations.py
+++ b/gr-digital/python/digital/psk_constellations.py
@@ -20,8 +20,10 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import absolute_import
+from __future__ import unicode_literals
import numpy
-from constellation_map_generator import constellation_map_generator
+from .constellation_map_generator import constellation_map_generator
'''
Note on the naming scheme. Each constellation is named using a prefix
diff --git a/gr-digital/python/digital/qa_binary_slicer_fb.py b/gr-digital/python/digital/qa_binary_slicer_fb.py
index 93e12dbb8..0b2879380 100755..100644
--- a/gr-digital/python/digital/qa_binary_slicer_fb.py
+++ b/gr-digital/python/digital/qa_binary_slicer_fb.py
@@ -1,24 +1,25 @@
#!/usr/bin/env python
#
# Copyright 2011-2013 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
import random
@@ -33,8 +34,8 @@ class test_binary_slicer_fb(gr_unittest.TestCase):
self.tb = None
def test_binary_slicer_fb(self):
- expected_result = ( 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1)
- src_data = (-1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1)
+ expected_result = ( 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1)
+ src_data = (-1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, 1, -1, 1, 1, 1, 1)
src_data = [s + (1 - random.random()) for s in src_data] # add some noise
src = blocks.vector_source_f(src_data)
op = digital.binary_slicer_fb()
@@ -45,11 +46,10 @@ class test_binary_slicer_fb(gr_unittest.TestCase):
self.tb.run() # run the graph and wait for it to finish
actual_result = dst.data() # fetch the contents of the sink
- #print "actual result", actual_result
- #print "expected result", expected_result
+ #print "actual result", actual_result
+ #print "expected result", expected_result
self.assertFloatTuplesAlmostEqual(expected_result, actual_result)
if __name__ == '__main__':
gr_unittest.run(test_binary_slicer_fb, "test_binary_slicer_fb.xml")
-
diff --git a/gr-digital/python/digital/qa_burst_shaper.py b/gr-digital/python/digital/qa_burst_shaper.py
index 36c6d0647..949a5f573 100755..100644
--- a/gr-digital/python/digital/qa_burst_shaper.py
+++ b/gr-digital/python/digital/qa_burst_shaper.py
@@ -21,6 +21,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest
from gnuradio import blocks, digital
import pmt
@@ -121,7 +122,7 @@ class qa_burst_shaper (gr_unittest.TestCase):
window = np.concatenate((-2.0*np.ones(5), -4.0*np.ones(5)))
tags = (make_length_tag(0, length),)
phasing = np.zeros(5)
- for i in xrange(5):
+ for i in range(5):
phasing[i] = ((-1.0)**i)
expected = np.concatenate((np.zeros(prepad), phasing*window[0:5],
np.ones(length), phasing*window[5:10],
@@ -154,7 +155,7 @@ class qa_burst_shaper (gr_unittest.TestCase):
-4.0*np.ones(5, dtype=complex)))
tags = (make_length_tag(0, length),)
phasing = np.zeros(5, dtype=complex)
- for i in xrange(5):
+ for i in range(5):
phasing[i] = complex((-1.0)**i)
expected = np.concatenate((np.zeros(prepad, dtype=complex),
phasing*window[0:5],
@@ -264,7 +265,7 @@ class qa_burst_shaper (gr_unittest.TestCase):
# checks
self.assertFloatTuplesAlmostEqual(sink.data(), expected, 6)
- for i in xrange(len(etags)):
+ for i in range(len(etags)):
self.assertTrue(compare_tags(sink.tags()[i], etags[i]))
def test_tag_gap (self):
@@ -303,7 +304,7 @@ class qa_burst_shaper (gr_unittest.TestCase):
# checks
self.assertFloatTuplesAlmostEqual(sink.data(), expected, 6)
- for i in xrange(len(etags)):
+ for i in range(len(etags)):
self.assertTrue(compare_tags(sink.tags()[i], etags[i]))
def test_tag_propagation (self):
diff --git a/gr-digital/python/digital/qa_chunks_to_symbols.py b/gr-digital/python/digital/qa_chunks_to_symbols.py
index 0d80f71d6..8a4266617 100755..100644
--- a/gr-digital/python/digital/qa_chunks_to_symbols.py
+++ b/gr-digital/python/digital/qa_chunks_to_symbols.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import pmt
from gnuradio import gr, gr_unittest, digital, blocks
@@ -138,12 +139,12 @@ class test_chunks_to_symbols(gr_unittest.TestCase):
def test_sf_callback(self):
- constA = [-3, -1, 1, 3]
+ constA = [-3, -1, 1, 3]
constB = [12, -12, 6, -6]
src_data = (0, 1, 2, 3, 3, 2, 1, 0)
expected_result=(12, -12, 6, -6, -6, 6, -12, 12)
- src = blocks.vector_source_s(src_data, False, 1, "")
+ src = blocks.vector_source_s(src_data, False, 1, "")
op = digital.chunks_to_symbols_sf(constA)
op.set_symbol_table(constB)
dst = blocks.vector_sink_f()
@@ -159,7 +160,7 @@ class test_chunks_to_symbols(gr_unittest.TestCase):
src_data = (0, 1, 2, 3, 3, 2, 1, 0)
expected_result=(12.0+1j, -12.0-1j, 6.0+1j, -6-1j, -6-1j, 6+1j, -12-1j, 12+1j)
- src = blocks.vector_source_s(src_data, False, 1, "")
+ src = blocks.vector_source_s(src_data, False, 1, "")
op = digital.chunks_to_symbols_sc(constA)
op.set_symbol_table(constB)
dst = blocks.vector_sink_c()
diff --git a/gr-digital/python/digital/qa_clock_recovery_mm.py b/gr-digital/python/digital/qa_clock_recovery_mm.py
index 878ea25c6..0618ec321 100755..100644
--- a/gr-digital/python/digital/qa_clock_recovery_mm.py
+++ b/gr-digital/python/digital/qa_clock_recovery_mm.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import random
import cmath
diff --git a/gr-digital/python/digital/qa_cma_equalizer.py b/gr-digital/python/digital/qa_cma_equalizer.py
index 6da391f70..228d95164 100755..100644
--- a/gr-digital/python/digital/qa_cma_equalizer.py
+++ b/gr-digital/python/digital/qa_cma_equalizer.py
@@ -1,48 +1,49 @@
#!/usr/bin/env python
#
# Copyright 2006,2007,2010,2011,2013 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; 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, digital, blocks
class test_cma_equalizer_fir(gr_unittest.TestCase):
def setUp(self):
- self.tb = gr.top_block()
+ self.tb = gr.top_block()
def tearDown(self):
- self.tb = None
-
+ self.tb = None
+
def transform(self, src_data):
- SRC = blocks.vector_source_c(src_data, False)
- EQU = digital.cma_equalizer_cc(4, 1.0, .001, 1)
- DST = blocks.vector_sink_c()
- self.tb.connect(SRC, EQU, DST)
- self.tb.run()
- return DST.data()
+ SRC = blocks.vector_source_c(src_data, False)
+ EQU = digital.cma_equalizer_cc(4, 1.0, .001, 1)
+ DST = blocks.vector_sink_c()
+ self.tb.connect(SRC, EQU, DST)
+ self.tb.run()
+ return DST.data()
def test_001_identity(self):
- # Constant modulus signal so no adjustments
- src_data = (1+0j, 0+1j, -1+0j, 0-1j)*1000
- expected_data = src_data
- result = self.transform(src_data)
+ # Constant modulus signal so no adjustments
+ src_data = (1+0j, 0+1j, -1+0j, 0-1j)*1000
+ expected_data = src_data
+ result = self.transform(src_data)
N = -500
self.assertComplexTuplesAlmostEqual(expected_data[N:], result[N:])
diff --git a/gr-digital/python/digital/qa_constellation.py b/gr-digital/python/digital/qa_constellation.py
index 42e49bb05..3436ce6f4 100644
--- a/gr-digital/python/digital/qa_constellation.py
+++ b/gr-digital/python/digital/qa_constellation.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import random, math
from cmath import exp, pi, log, sqrt
@@ -51,7 +53,7 @@ def twod_constell():
def threed_constell():
oned_points = ((1+0j), (0+1j), (-1+0j), (0-1j))
points = []
- r4 = range(0, 4)
+ r4 = list(range(0, 4))
for ia in r4:
for ib in r4:
for ic in r4:
@@ -143,7 +145,7 @@ def tested_constellations(easy=True, medium=True, difficult=True):
diff_poss = (True, False)
else:
diff_poss = (False,)
- poss_args = [[argname, argvalues, 0] for argname, argvalues in poss_args.items()]
+ poss_args = [[argname, argvalues, 0] for argname, argvalues in list(poss_args.items())]
for current_diff in diff_poss:
# Add an index into args to keep track of current position in argvalues
while True:
@@ -211,7 +213,7 @@ class test_constellation(gr_unittest.TestCase):
table = digital.soft_dec_table_generator(digital.sd_psk_4_0, prec, Es)
c.set_soft_dec_lut(table, prec)
- x = sqrt(2.0)/2.0
+ x = sqrt(2.0) / 2.0
step = (x.real+x.real) / (2**prec - 1)
samples = [ -x-x*1j, -x+x*1j,
x+x*1j, x-x*1j,
@@ -253,7 +255,7 @@ class test_constellation(gr_unittest.TestCase):
table = digital.soft_dec_table(constel, code, prec)
c.gen_soft_dec_lut(prec)
- x = sqrt(2.0)/2.0
+ x = sqrt(2.0) / 2.0
step = (x.real+x.real) / (2**prec - 1)
samples = [ -x-x*1j, -x+x*1j,
x+x*1j, x-x*1j,
@@ -293,7 +295,7 @@ class test_constellation(gr_unittest.TestCase):
table = digital.soft_dec_table(constel, code, prec)
c.gen_soft_dec_lut(prec)
- x = sqrt(2.0)/2.0
+ x = sqrt(2.0) / 2.0
step = (x.real+x.real) / (2**prec - 1)
samples = [ -x-x*1j, -x+x*1j,
x+x*1j, x-x*1j,
@@ -322,9 +324,9 @@ class mod_demod(gr.hier_block2):
# that they can work with shorts and ints as well as chars.
raise ValueError("Constellation cannot contain more than 256 points.")
- gr.hier_block2.__init__(self, "mod_demod",
- gr.io_signature(1, 1, gr.sizeof_char), # Input signature
- gr.io_signature(1, 1, gr.sizeof_char)) # Output signature
+ gr.hier_block2.__init__(self, "mod_demod",
+ gr.io_signature(1, 1, gr.sizeof_char), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_char)) # Output signature
arity = constellation.arity()
diff --git a/gr-digital/python/digital/qa_constellation_decoder_cb.py b/gr-digital/python/digital/qa_constellation_decoder_cb.py
index d3fbce91b..e7350be55 100755..100644
--- a/gr-digital/python/digital/qa_constellation_decoder_cb.py
+++ b/gr-digital/python/digital/qa_constellation_decoder_cb.py
@@ -1,24 +1,25 @@
#!/usr/bin/env python
#
# Copyright 2004,2007,2010-2013 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; 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, digital, blocks
@@ -32,9 +33,9 @@ class test_constellation_decoder(gr_unittest.TestCase):
def test_constellation_decoder_cb_bpsk(self):
cnst = digital.constellation_bpsk()
- src_data = (0.5 + 0.5j, 0.1 - 1.2j, -0.8 - 0.1j, -0.45 + 0.8j,
+ src_data = (0.5 + 0.5j, 0.1 - 1.2j, -0.8 - 0.1j, -0.45 + 0.8j,
0.8 + 1.0j, -0.5 + 0.1j, 0.1 - 1.2j)
- expected_result = ( 1, 1, 0, 0,
+ expected_result = ( 1, 1, 0, 0,
1, 0, 1)
src = blocks.vector_source_c(src_data)
op = digital.constellation_decoder_cb(cnst.base())
@@ -45,18 +46,18 @@ class test_constellation_decoder(gr_unittest.TestCase):
self.tb.run() # run the graph and wait for it to finish
actual_result = dst.data() # fetch the contents of the sink
- #print "actual result", actual_result
- #print "expected result", expected_result
+ #print "actual result", actual_result
+ #print "expected result", expected_result
self.assertFloatTuplesAlmostEqual(expected_result, actual_result)
def _test_constellation_decoder_cb_qpsk(self):
cnst = digital.constellation_qpsk()
- src_data = (0.5 + 0.5j, 0.1 - 1.2j, -0.8 - 0.1j, -0.45 + 0.8j,
+ src_data = (0.5 + 0.5j, 0.1 - 1.2j, -0.8 - 0.1j, -0.45 + 0.8j,
0.8 + 1.0j, -0.5 + 0.1j, 0.1 - 1.2j)
- expected_result = ( 3, 1, 0, 2,
+ expected_result = ( 3, 1, 0, 2,
3, 2, 1)
src = blocks.vector_source_c(src_data)
- op = digital_swig.constellation_decoder_cb(cnst.base())
+ op = digital.constellation_decoder_cb(cnst.base())
dst = blocks.vector_sink_b()
self.tb.connect(src, op)
@@ -64,11 +65,10 @@ class test_constellation_decoder(gr_unittest.TestCase):
self.tb.run() # run the graph and wait for it to finish
actual_result = dst.data() # fetch the contents of the sink
- #print "actual result", actual_result
- #print "expected result", expected_result
+ #print "actual result", actual_result
+ #print "expected result", expected_result
self.assertFloatTuplesAlmostEqual(expected_result, actual_result)
if __name__ == '__main__':
gr_unittest.run(test_constellation_decoder, "test_constellation_decoder.xml")
-
diff --git a/gr-digital/python/digital/qa_constellation_receiver.py b/gr-digital/python/digital/qa_constellation_receiver.py
index f0d7275d3..4850863fa 100755..100644
--- a/gr-digital/python/digital/qa_constellation_receiver.py
+++ b/gr-digital/python/digital/qa_constellation_receiver.py
@@ -1,24 +1,28 @@
#!/usr/bin/env python
#
# Copyright 2011,2013 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import absolute_import
+
import random
import math
@@ -53,12 +57,13 @@ TIMING_OFFSET = 1.0
FREQ_BW = 2*math.pi/100.0
PHASE_BW = 2*math.pi/100.0
+
class channel_model(gr.hier_block2):
def __init__(self, noise_voltage, freq, timing):
- gr.hier_block2.__init__(self, "channel_model",
- gr.io_signature(1, 1, gr.sizeof_gr_complex),
+ gr.hier_block2.__init__(self, "channel_model",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex),
gr.io_signature(1, 1, gr.sizeof_gr_complex))
-
+
timing_offset = filter.mmse_resampler_cc(0, timing)
noise_adder = blocks.add_cc()
@@ -74,16 +79,16 @@ class channel_model(gr.hier_block2):
self.connect(mixer_offset, (noise_adder,1))
self.connect(noise, (noise_adder,0))
self.connect(noise_adder, self)
-
+
class test_constellation_receiver(gr_unittest.TestCase):
-
+
# We ignore the first half of the output data since often it takes
# a while for the receiver to lock on.
ignore_fraction = 0.8
max_data_length = DATA_LENGTH * 6
max_num_samples = 1000
-
+
def test_basic(self):
"""
Tests a bunch of different constellations by using generic
@@ -172,7 +177,7 @@ class rec_test_tb(gr.top_block):
super(rec_test_tb, self).__init__()
# Transmission Blocks
if src_data is None:
- self.src_data = tuple([rndm.randint(0,1) for i in range(0, data_length)])
+ self.src_data = tuple([random.randint(0,1) for i in range(0, data_length)])
else:
self.src_data = src_data
packer = blocks.unpacked_to_packed_bb(1, gr.GR_MSB_FIRST)
@@ -182,7 +187,7 @@ class rec_test_tb(gr.top_block):
if freq_offset:
channel = channel_model(NOISE_VOLTAGE, FREQUENCY_OFFSET, TIMING_OFFSET)
else:
- channel = channel_model(NOISE_VOLTAGE, 0, TIMING_OFFSET)
+ channel = channel_model(NOISE_VOLTAGE, 0, TIMING_OFFSET)
# Receiver Blocks
if freq_offset:
demod = generic_demod(constellation, differential=differential,
diff --git a/gr-digital/python/digital/qa_constellation_soft_decoder_cf.py b/gr-digital/python/digital/qa_constellation_soft_decoder_cf.py
index 872aed015..629d52c0a 100644
--- a/gr-digital/python/digital/qa_constellation_soft_decoder_cf.py
+++ b/gr-digital/python/digital/qa_constellation_soft_decoder_cf.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, digital, blocks
from math import sqrt
from numpy import random, vectorize
@@ -36,7 +37,7 @@ class test_constellation_soft_decoder(gr_unittest.TestCase):
cnst_pts, code = const_gen()
Es = max([abs(c) for c in cnst_pts])
lut = digital.soft_dec_table_generator(const_sd_gen, prec, Es)
- expected_result = list()
+ expected_result = list()
for s in src_data:
res = digital.calc_soft_dec_from_table(s, lut, prec, sqrt(2.0))
expected_result += res
@@ -52,14 +53,14 @@ class test_constellation_soft_decoder(gr_unittest.TestCase):
self.tb.run()
actual_result = dst.data() # fetch the contents of the sink
- #print "actual result", actual_result
- #print "expected result", expected_result
+ #print "actual result", actual_result
+ #print "expected result", expected_result
self.assertFloatTuplesAlmostEqual(expected_result, actual_result, 5)
def helper_no_lut(self, prec, src_data, const_gen, const_sd_gen):
cnst_pts, code = const_gen()
cnst = digital.constellation_calcdist(cnst_pts, code, 2, 1)
- expected_result = list()
+ expected_result = list()
for s in src_data:
res = digital.calc_soft_dec(s, cnst.points(), code)
expected_result += res
@@ -73,8 +74,8 @@ class test_constellation_soft_decoder(gr_unittest.TestCase):
self.tb.run()
actual_result = dst.data() # fetch the contents of the sink
- #print "actual result", actual_result
- #print "expected result", expected_result
+ #print "actual result", actual_result
+ #print "expected result", expected_result
# Double vs. float precision issues between Python and C++, so
# use only 4 decimals in comparisons.
diff --git a/gr-digital/python/digital/qa_correlate_access_code.py b/gr-digital/python/digital/qa_correlate_access_code.py
index 0302e8131..405147b98 100755..100644
--- a/gr-digital/python/digital/qa_correlate_access_code.py
+++ b/gr-digital/python/digital/qa_correlate_access_code.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, digital, blocks
default_access_code = '\xAC\xDD\xA4\xE2\xF2\x8C\x20\xFC'
@@ -35,7 +36,7 @@ def string_to_1_0_list(s):
return r
def to_1_0_string(L):
- return ''.join(map(lambda x: chr(x + ord('0')), L))
+ return ''.join([chr(x + ord('0')) for x in L])
class test_correlate_access_code(gr_unittest.TestCase):
diff --git a/gr-digital/python/digital/qa_correlate_access_code_XX_ts.py b/gr-digital/python/digital/qa_correlate_access_code_XX_ts.py
index 5429ce1e0..7666c3bda 100755..100644
--- a/gr-digital/python/digital/qa_correlate_access_code_XX_ts.py
+++ b/gr-digital/python/digital/qa_correlate_access_code_XX_ts.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, digital, blocks
import pmt
@@ -35,7 +36,7 @@ def string_to_1_0_list(s):
return r
def to_1_0_string(L):
- return ''.join(map(lambda x: chr(x + ord('0')), L))
+ return ''.join([chr(x + ord('0')) for x in L])
class test_correlate_access_code_XX_ts(gr_unittest.TestCase):
@@ -51,7 +52,7 @@ class test_correlate_access_code_XX_ts(gr_unittest.TestCase):
packet = header + payload
pad = (0,) * 64
src_data = (0, 0, 1, 1, 1, 1, 0, 1, 1) + tuple(string_to_1_0_list(packet)) + pad
- expected = tuple(map(long, src_data[9+32:-len(pad)]))
+ expected = tuple(map(int, src_data[9+32:-len(pad)]))
src = blocks.vector_source_b(src_data)
op = digital.correlate_access_code_bb_ts("1011", 0, "sync")
dst = blocks.vector_sink_b()
diff --git a/gr-digital/python/digital/qa_correlate_access_code_tag.py b/gr-digital/python/digital/qa_correlate_access_code_tag.py
index 378333c28..be5848d9a 100755..100644
--- a/gr-digital/python/digital/qa_correlate_access_code_tag.py
+++ b/gr-digital/python/digital/qa_correlate_access_code_tag.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, digital, blocks
default_access_code = '\xAC\xDD\xA4\xE2\xF2\x8C\x20\xFC'
@@ -35,7 +36,7 @@ def string_to_1_0_list(s):
return r
def to_1_0_string(L):
- return ''.join(map(lambda x: chr(x + ord('0')), L))
+ return ''.join([chr(x + ord('0')) for x in L])
class test_correlate_access_code(gr_unittest.TestCase):
diff --git a/gr-digital/python/digital/qa_costas_loop_cc.py b/gr-digital/python/digital/qa_costas_loop_cc.py
index e48f45cc2..283a9199d 100755..100644
--- a/gr-digital/python/digital/qa_costas_loop_cc.py
+++ b/gr-digital/python/digital/qa_costas_loop_cc.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import random
import cmath
@@ -57,7 +59,7 @@ class test_costas_loop_cc(gr_unittest.TestCase):
order = 2
self.test = digital.costas_loop_cc(natfreq, order)
- data = [complex(2*random.randint(0,1)-1, 0) for i in xrange(100)]
+ data = [complex(2*random.randint(0,1)-1, 0) for i in range(100)]
self.src = blocks.vector_source_c(data, False)
self.snk = blocks.vector_sink_c()
@@ -76,7 +78,7 @@ class test_costas_loop_cc(gr_unittest.TestCase):
self.test = digital.costas_loop_cc(natfreq, order)
rot = cmath.exp(0.2j) # some small rotation
- data = [complex(2*random.randint(0,1)-1, 0) for i in xrange(100)]
+ data = [complex(2*random.randint(0,1)-1, 0) for i in range(100)]
N = 40 # settling time
expected_result = data[N:]
@@ -102,7 +104,7 @@ class test_costas_loop_cc(gr_unittest.TestCase):
rot = cmath.exp(0.2j) # some small rotation
data = [complex(2*random.randint(0,1)-1, 2*random.randint(0,1)-1)
- for i in xrange(100)]
+ for i in range(100)]
N = 40 # settling time
expected_result = data[N:]
@@ -126,9 +128,9 @@ class test_costas_loop_cc(gr_unittest.TestCase):
order = 8
self.test = digital.costas_loop_cc(natfreq, order)
- rot = cmath.exp(-cmath.pi/8.0j) # rotate to match Costas rotation
+ rot = cmath.exp(-cmath.pi / 8.0j) # rotate to match Costas rotation
const = psk.psk_constellation(order)
- data = [random.randint(0,7) for i in xrange(100)]
+ data = [random.randint(0,7) for i in range(100)]
data = [2*rot*const.points()[d] for d in data]
N = 40 # settling time
diff --git a/gr-digital/python/digital/qa_cpm.py b/gr-digital/python/digital/qa_cpm.py
index 6468ed507..47a6fa23b 100755..100644
--- a/gr-digital/python/digital/qa_cpm.py
+++ b/gr-digital/python/digital/qa_cpm.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import numpy
from gnuradio import gr, gr_unittest, digital, analog, blocks
diff --git a/gr-digital/python/digital/qa_crc32.py b/gr-digital/python/digital/qa_crc32.py
index 9252825ad..6d3d2fa3c 100755..100644
--- a/gr-digital/python/digital/qa_crc32.py
+++ b/gr-digital/python/digital/qa_crc32.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import random
import cmath
diff --git a/gr-digital/python/digital/qa_crc32_bb.py b/gr-digital/python/digital/qa_crc32_bb.py
index 5e45bfb1b..53ea6f3de 100755..100644
--- a/gr-digital/python/digital/qa_crc32_bb.py
+++ b/gr-digital/python/digital/qa_crc32_bb.py
@@ -19,6 +19,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks, digital
import pmt
@@ -33,7 +34,7 @@ class qa_crc32_bb (gr_unittest.TestCase):
def test_001_crc_len (self):
""" Make sure the output of a CRC set is 4 bytes longer than the input. """
- data = range(16)
+ data = list(range(16))
src = blocks.vector_source_b(data)
crc = digital.crc32_bb(False, self.tsb_key)
sink = blocks.tsb_vector_sink_b(tsb_key=self.tsb_key)
@@ -69,7 +70,7 @@ class qa_crc32_bb (gr_unittest.TestCase):
def test_003_crc_correct_lentag (self):
tag_name = "length"
pack_len = 8
- packets = range(pack_len*2)
+ packets = list(range(pack_len*2))
tag1 = gr.tag_t()
tag1.offset = 0
tag1.key = pmt.string_to_symbol(tag_name)
@@ -107,7 +108,7 @@ class qa_crc32_bb (gr_unittest.TestCase):
tags_found = {'tag1': False, 'tag2': False, 'tag3': False}
for tag in sink.tags():
key = pmt.symbol_to_string(tag.key)
- if key in correct_offsets.keys():
+ if key in list(correct_offsets.keys()):
tags_found[key] = True
self.assertEqual(correct_offsets[key], tag.offset)
self.assertTrue(all(tags_found.values()))
@@ -160,7 +161,7 @@ class qa_crc32_bb (gr_unittest.TestCase):
def test_006_crc_len (self):
""" Make sure the output of a CRC set is 32 (unpacked) bytes longer than the input. """
- data = range(16)
+ data = list(range(16))
src = blocks.vector_source_b(data)
crc = digital.crc32_bb(False, self.tsb_key, False)
sink = blocks.tsb_vector_sink_b(tsb_key=self.tsb_key)
@@ -196,7 +197,7 @@ class qa_crc32_bb (gr_unittest.TestCase):
def test_008_crc_correct_lentag (self):
tag_name = "length"
pack_len = 8
- packets = range(pack_len*2)
+ packets = list(range(pack_len*2))
tag1 = gr.tag_t()
tag1.offset = 0
tag1.key = pmt.string_to_symbol(tag_name)
@@ -234,7 +235,7 @@ class qa_crc32_bb (gr_unittest.TestCase):
tags_found = {'tag1': False, 'tag2': False, 'tag3': False}
for tag in sink.tags():
key = pmt.symbol_to_string(tag.key)
- if key in correct_offsets.keys():
+ if key in list(correct_offsets.keys()):
tags_found[key] = True
self.assertEqual(correct_offsets[key], tag.offset)
self.assertTrue(all(tags_found.values()))
diff --git a/gr-digital/python/digital/qa_diff_encoder.py b/gr-digital/python/digital/qa_diff_encoder.py
index 410b937fb..58d757d0c 100755..100644
--- a/gr-digital/python/digital/qa_diff_encoder.py
+++ b/gr-digital/python/digital/qa_diff_encoder.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import random
from gnuradio import gr, gr_unittest, digital, blocks
diff --git a/gr-digital/python/digital/qa_diff_phasor_cc.py b/gr-digital/python/digital/qa_diff_phasor_cc.py
index 7cae4870c..72063cf92 100755..100644
--- a/gr-digital/python/digital/qa_diff_phasor_cc.py
+++ b/gr-digital/python/digital/qa_diff_phasor_cc.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, digital, blocks
class test_diff_phasor(gr_unittest.TestCase):
diff --git a/gr-digital/python/digital/qa_digital.py b/gr-digital/python/digital/qa_digital.py
index 63a167dec..d443b08fd 100755..100644
--- a/gr-digital/python/digital/qa_digital.py
+++ b/gr-digital/python/digital/qa_digital.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, digital
class test_digital(gr_unittest.TestCase):
diff --git a/gr-digital/python/digital/qa_fll_band_edge.py b/gr-digital/python/digital/qa_fll_band_edge.py
index 17c5fa85f..a4859565e 100755..100644
--- a/gr-digital/python/digital/qa_fll_band_edge.py
+++ b/gr-digital/python/digital/qa_fll_band_edge.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import random
import math
@@ -48,7 +50,7 @@ class test_fll_band_edge_cc(gr_unittest.TestCase):
# Create a set of 1's and -1's, pulse shape and interpolate to sps
random.seed(0)
- data = [2.0*random.randint(0, 2) - 1.0 for i in xrange(200)]
+ data = [2.0*random.randint(0, 2) - 1.0 for i in range(200)]
self.src = blocks.vector_source_c(data, False)
self.rrc = filter.interp_fir_filter_ccf(sps, rrc_taps)
diff --git a/gr-digital/python/digital/qa_framer_sink.py b/gr-digital/python/digital/qa_framer_sink.py
index 4b260c14e..555bc121f 100755..100644
--- a/gr-digital/python/digital/qa_framer_sink.py
+++ b/gr-digital/python/digital/qa_framer_sink.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, digital, blocks
default_access_code = '\xAC\xDD\xA4\xE2\xF2\x8C\x20\xFC'
@@ -34,7 +35,7 @@ def string_to_1_0_list(s):
return r
def to_1_0_string(L):
- return ''.join(map(lambda x: chr(x + ord('0')), L))
+ return ''.join([chr(x + ord('0')) for x in L])
class test_framker_sink(gr_unittest.TestCase):
diff --git a/gr-digital/python/digital/qa_glfsr_source.py b/gr-digital/python/digital/qa_glfsr_source.py
index f39c40819..2c1921e11 100755..100644
--- a/gr-digital/python/digital/qa_glfsr_source.py
+++ b/gr-digital/python/digital/qa_glfsr_source.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, digital, blocks
class test_glfsr_source(gr_unittest.TestCase):
@@ -32,8 +33,8 @@ class test_glfsr_source(gr_unittest.TestCase):
def test_000_make_b(self):
src = digital.glfsr_source_b(16)
- self.assertEquals(src.mask(), 0x8016)
- self.assertEquals(src.period(), 2**16-1)
+ self.assertEqual(src.mask(), 0x8016)
+ self.assertEqual(src.period(), 2**16-1)
def test_001_degree_b(self):
self.assertRaises(RuntimeError,
@@ -46,11 +47,11 @@ class test_glfsr_source(gr_unittest.TestCase):
src = digital.glfsr_source_b(degree, False)
b2f = digital.chunks_to_symbols_bf((-1.0,1.0), 1)
dst = blocks.vector_sink_f()
- del self.tb # Discard existing top block
- self.tb = gr.top_block()
+ del self.tb # Discard existing top block
+ self.tb = gr.top_block()
self.tb.connect(src, b2f, dst)
self.tb.run()
- self.tb.disconnect_all()
+ self.tb.disconnect_all()
actual_result = dst.data()
R = auto_correlate(actual_result)
self.assertEqual(R[0], float(len(R))) # Auto-correlation peak at origin
@@ -59,8 +60,8 @@ class test_glfsr_source(gr_unittest.TestCase):
def test_003_make_f(self):
src = digital.glfsr_source_f(16)
- self.assertEquals(src.mask(), 0x8016)
- self.assertEquals(src.period(), 2**16-1)
+ self.assertEqual(src.mask(), 0x8016)
+ self.assertEqual(src.period(), 2**16-1)
def test_004_degree_f(self):
self.assertRaises(RuntimeError,
@@ -71,8 +72,8 @@ class test_glfsr_source(gr_unittest.TestCase):
for degree in range(1,11): # Higher degrees take too long to correlate
src = digital.glfsr_source_f(degree, False)
dst = blocks.vector_sink_f()
- del self.tb # Discard existing top block
- self.tb = gr.top_block()
+ del self.tb # Discard existing top block
+ self.tb = gr.top_block()
self.tb.connect(src, dst)
self.tb.run()
diff --git a/gr-digital/python/digital/qa_hdlc_framer.py b/gr-digital/python/digital/qa_hdlc_framer.py
index 6fed26454..4aa8280e8 100755..100644
--- a/gr-digital/python/digital/qa_hdlc_framer.py
+++ b/gr-digital/python/digital/qa_hdlc_framer.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, digital, blocks
import pmt
import numpy
@@ -45,7 +46,7 @@ class test_hdlc_framer(gr_unittest.TestCase):
self.tb.msg_connect(deframe, "out", debug, "store")
self.tb.start()
msg = pmt.cons(pmt.PMT_NIL, pmt.init_u8vector(len(src_data),src_data))
- for i in xrange(npkts):
+ for i in range(npkts):
frame.to_basic_block()._post(pmt.intern("in"), msg)
sleep(0.2)
self.tb.stop()
@@ -53,7 +54,7 @@ class test_hdlc_framer(gr_unittest.TestCase):
rxmsg = debug.get_message(0)
result_len = pmt.blob_length(pmt.cdr(rxmsg))
msg_data = []
- for j in xrange(result_len):
+ for j in range(result_len):
msg_data.append(pmt.u8vector_ref(pmt.cdr(rxmsg), j))
self.assertEqual(src_data, msg_data)
diff --git a/gr-digital/python/digital/qa_header_payload_demux.py b/gr-digital/python/digital/qa_header_payload_demux.py
index f36d71067..d77f7c689 100755..100644
--- a/gr-digital/python/digital/qa_header_payload_demux.py
+++ b/gr-digital/python/digital/qa_header_payload_demux.py
@@ -20,15 +20,19 @@
#
from __future__ import print_function
+from __future__ import division
+
import time
import random
import numpy
+
from gnuradio import gr
from gnuradio import gr_unittest
from gnuradio import digital
from gnuradio import blocks
import pmt
+
def make_tag(key, value, offset):
tag = gr.tag_t()
tag.offset = offset
@@ -55,7 +59,7 @@ class HeaderToMessageBlock(gr.sync_block):
self.msg_count = 0
def work(self, input_items, output_items):
- for i in xrange(len(input_items[0])/self.header_len):
+ for i in range(len(input_items[0]) // self.header_len):
msg = self.messages[self.msg_count] or False
#print("Sending message: {0}".format(msg))
self.message_port_pub(pmt.intern('header_data'), pmt.to_pmt(msg))
@@ -227,7 +231,7 @@ class qa_header_payload_demux (gr_unittest.TestCase):
header_padding = 1
payload = tuple(range(5, 20))
data_signal = (0,) * n_zeros + header + payload
- trigger_signal = [0,] * len(data_signal)
+ trigger_signal = [0] * len(data_signal)
trigger_signal[n_zeros] = 1
# This is dropped:
testtag1 = make_tag('tag1', 0, 0)
@@ -296,7 +300,7 @@ class qa_header_payload_demux (gr_unittest.TestCase):
payload_offset = -1
payload = tuple(range(5, 20))
data_signal = (0,) * n_zeros + header + payload + (0,) * 100
- trigger_signal = [0,] * len(data_signal)
+ trigger_signal = [0] * len(data_signal)
trigger_signal[n_zeros] = 1
# This goes on output 1, item 3 + 1 (for payload offset)
testtag4 = make_tag('tag4', 314, n_zeros + len(header) + 3)
@@ -379,13 +383,13 @@ class qa_header_payload_demux (gr_unittest.TestCase):
data_src = blocks.vector_source_f(data_signal, False, tags=(testtag1, testtag2, testtag3, testtag4))
trigger_src = blocks.vector_source_b(trigger_signal, False)
hpd = digital.header_payload_demux(
- len(header) / items_per_symbol, # Header length (in symbols)
- items_per_symbol, # Items per symbols
- gi, # Items per guard time
- "frame_len", # Frame length tag key
- "detect", # Trigger tag key
- True, # Output symbols (not items)
- gr.sizeof_float # Bytes per item
+ len(header) // items_per_symbol, # Header length (in symbols)
+ items_per_symbol, # Items per symbols
+ gi, # Items per guard time
+ "frame_len", # Frame length tag key
+ "detect", # Trigger tag key
+ True, # Output symbols (not items)
+ gr.sizeof_float # Bytes per item
)
self.assertEqual(pmt.length(hpd.message_ports_in()), 2) #extra system port defined for you
header_sink = blocks.vector_sink_f(items_per_symbol)
@@ -548,7 +552,7 @@ class qa_header_payload_demux (gr_unittest.TestCase):
indexes = []
burst_sizes = []
total_payload_len = 0
- for burst_count in xrange(n_bursts):
+ for burst_count in range(n_bursts):
gap_size = random.randint(0, max_gap)
signal += [0] * gap_size
is_failure = random.random() < fail_rate
@@ -577,7 +581,7 @@ class qa_header_payload_demux (gr_unittest.TestCase):
### Go, go, go
# The divide-by-20 means we'll usually get the same random seed
# between the first run and the XML run.
- random_seed = int(time.time()/20)
+ random_seed = int(time.time() / 20)
random.seed(random_seed)
print("Random seed: {0}".format(random_seed))
n_bursts = 400
@@ -621,4 +625,3 @@ class qa_header_payload_demux (gr_unittest.TestCase):
if __name__ == '__main__':
gr_unittest.run(qa_header_payload_demux, "qa_header_payload_demux.xml")
-
diff --git a/gr-digital/python/digital/qa_lfsr.py b/gr-digital/python/digital/qa_lfsr.py
index 8b8872ab3..8cc97a018 100755..100644
--- a/gr-digital/python/digital/qa_lfsr.py
+++ b/gr-digital/python/digital/qa_lfsr.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import math
from gnuradio import gr, gr_unittest, digital
@@ -37,7 +38,7 @@ class test_lfsr(gr_unittest.TestCase):
l = digital.lfsr(1, 1, reglen)
result_data = []
- for i in xrange(4*(reglen+1)):
+ for i in range(4*(reglen+1)):
result_data.append(l.next_bit())
expected_result = 4*([1,] + reglen*[0,])
diff --git a/gr-digital/python/digital/qa_lms_equalizer.py b/gr-digital/python/digital/qa_lms_equalizer.py
index 7768c1f07..fa79993f8 100755..100644
--- a/gr-digital/python/digital/qa_lms_equalizer.py
+++ b/gr-digital/python/digital/qa_lms_equalizer.py
@@ -1,51 +1,52 @@
#!/usr/bin/env python
#
# Copyright 2006,2007,2010,2011,2013 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; 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, digital, blocks
class test_lms_dd_equalizer(gr_unittest.TestCase):
def setUp(self):
- self.tb = gr.top_block()
+ self.tb = gr.top_block()
def tearDown(self):
- self.tb = None
-
+ self.tb = None
+
def transform(self, src_data, gain, const):
- SRC = blocks.vector_source_c(src_data, False)
- EQU = digital.lms_dd_equalizer_cc(4, gain, 1, const.base())
- DST = blocks.vector_sink_c()
- self.tb.connect(SRC, EQU, DST)
- self.tb.run()
- return DST.data()
+ SRC = blocks.vector_source_c(src_data, False)
+ EQU = digital.lms_dd_equalizer_cc(4, gain, 1, const.base())
+ DST = blocks.vector_sink_c()
+ self.tb.connect(SRC, EQU, DST)
+ self.tb.run()
+ return DST.data()
def test_001_identity(self):
- # Constant modulus signal so no adjustments
+ # Constant modulus signal so no adjustments
const = digital.constellation_qpsk()
- src_data = const.points()*1000
+ src_data = const.points()*1000
N = 100 # settling time
- expected_data = src_data[N:]
- result = self.transform(src_data, 0.1, const)[N:]
+ expected_data = src_data[N:]
+ result = self.transform(src_data, 0.1, const)[N:]
N = -500
self.assertComplexTuplesAlmostEqual(expected_data[N:], result[N:], 5)
diff --git a/gr-digital/python/digital/qa_map.py b/gr-digital/python/digital/qa_map.py
index 604fa084d..0b71b2814 100755..100644
--- a/gr-digital/python/digital/qa_map.py
+++ b/gr-digital/python/digital/qa_map.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, digital, blocks
class test_map(gr_unittest.TestCase):
@@ -32,7 +33,7 @@ class test_map(gr_unittest.TestCase):
def helper(self, symbols):
src_data = [0, 1, 2, 3, 0, 1, 2, 3]
- expected_data = map(lambda x: symbols[x], src_data)
+ expected_data = [symbols[x] for x in src_data]
src = blocks.vector_source_b(src_data)
op = digital.map_bb(symbols)
dst = blocks.vector_sink_b()
diff --git a/gr-digital/python/digital/qa_mpsk_snr_est.py b/gr-digital/python/digital/qa_mpsk_snr_est.py
index 97d31c768..dcc7dcc69 100755..100644
--- a/gr-digital/python/digital/qa_mpsk_snr_est.py
+++ b/gr-digital/python/digital/qa_mpsk_snr_est.py
@@ -19,6 +19,7 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#
+
import random
from gnuradio import gr, gr_unittest, digital, blocks
@@ -34,15 +35,15 @@ class test_mpsk_snr_est(gr_unittest.TestCase):
random.seed(0) # make repeatable
N = 10000
- self._noise = [get_n_cplx() for i in xrange(N)]
- self._bits = [get_cplx() for i in xrange(N)]
+ self._noise = [get_n_cplx() for i in range(N)]
+ self._bits = [get_cplx() for i in range(N)]
def tearDown(self):
self.tb = None
def mpsk_snr_est_setup(self, op):
result = []
- for i in xrange(1,6):
+ for i in range(1,6):
src_data = [b+(i*n) for b,n in zip(self._bits, self._noise)]
src = blocks.vector_source_c(src_data)
@@ -57,7 +58,7 @@ class test_mpsk_snr_est(gr_unittest.TestCase):
return result
def test_mpsk_snr_est_simple(self):
- expected_result = [8.20, 4.99, 3.23, 2.01, 1.03]
+ expected_result = [8.20, 4.99, 3.23, 2.01, 1.03]
N = 10000
alpha = 0.001
@@ -67,7 +68,7 @@ class test_mpsk_snr_est(gr_unittest.TestCase):
self.assertFloatTuplesAlmostEqual(expected_result, actual_result, 2)
def test_mpsk_snr_est_skew(self):
- expected_result = [8.31, 1.83, -1.68, -3.56, -4.68]
+ expected_result = [8.31, 1.83, -1.68, -3.56, -4.68]
N = 10000
alpha = 0.001
@@ -77,7 +78,7 @@ class test_mpsk_snr_est(gr_unittest.TestCase):
self.assertFloatTuplesAlmostEqual(expected_result, actual_result, 2)
def test_mpsk_snr_est_m2m4(self):
- expected_result = [8.01, 3.19, 1.97, 2.15, 2.65]
+ expected_result = [8.01, 3.19, 1.97, 2.15, 2.65]
N = 10000
alpha = 0.001
@@ -87,7 +88,7 @@ class test_mpsk_snr_est(gr_unittest.TestCase):
self.assertFloatTuplesAlmostEqual(expected_result, actual_result, 2)
def test_mpsk_snr_est_svn(self):
- expected_result = [7.91, 3.01, 1.77, 1.97, 2.49]
+ expected_result = [7.91, 3.01, 1.77, 1.97, 2.49]
N = 10000
alpha = 0.001
@@ -97,10 +98,10 @@ class test_mpsk_snr_est(gr_unittest.TestCase):
self.assertFloatTuplesAlmostEqual(expected_result, actual_result, 2)
def test_probe_mpsk_snr_est_m2m4(self):
- expected_result = [8.01, 3.19, 1.97, 2.15, 2.65]
+ expected_result = [8.01, 3.19, 1.97, 2.15, 2.65]
actual_result = []
- for i in xrange(1,6):
+ for i in range(1,6):
src_data = [b+(i*n) for b,n in zip(self._bits, self._noise)]
src = blocks.vector_source_c(src_data)
diff --git a/gr-digital/python/digital/qa_ofdm_carrier_allocator_cvc.py b/gr-digital/python/digital/qa_ofdm_carrier_allocator_cvc.py
index befb15ac4..4ffe61b8e 100755..100644
--- a/gr-digital/python/digital/qa_ofdm_carrier_allocator_cvc.py
+++ b/gr-digital/python/digital/qa_ofdm_carrier_allocator_cvc.py
@@ -1,23 +1,24 @@
#!/usr/bin/env python
# Copyright 2012-2014 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; 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, digital, blocks
import pmt
@@ -41,7 +42,7 @@ class qa_digital_carrier_allocator_cvc (gr_unittest.TestCase):
pilot_symbols = ((1j,),)
occupied_carriers = ((0, 1, 2),)
pilot_carriers = ((3,),)
- sync_word = (range(fft_len),)
+ sync_word = (list(range(fft_len)),)
expected_result = tuple(sync_word[0] + [1j, 0, 0, 1, 2, 3])
# ^ DC carrier
src = blocks.vector_source_c(tx_symbols, False, 1)
@@ -164,7 +165,7 @@ class qa_digital_carrier_allocator_cvc (gr_unittest.TestCase):
- add some random tags
- don't shift
"""
- tx_symbols = range(1, 16); # 15 symbols
+ tx_symbols = list(range(1, 16)); # 15 symbols
pilot_symbols = ((1j, 2j), (3j, 4j))
occupied_carriers = ((1, 3, 4, 11, 12, 14), (1, 2, 4, 11, 13, 14),)
pilot_carriers = ((2, 13), (3, 12))
@@ -203,7 +204,7 @@ class qa_digital_carrier_allocator_cvc (gr_unittest.TestCase):
correct_offsets = {'tag1': 0, 'tag2': 1, 'tag3': 3, 'tag4': 5}
for tag in sink.tags():
key = pmt.symbol_to_string(tag.key)
- if key in tags_found.keys():
+ if key in list(tags_found.keys()):
tags_found[key] = True
self.assertEqual(correct_offsets[key], tag.offset)
self.assertTrue(all(tags_found.values()))
diff --git a/gr-digital/python/digital/qa_ofdm_chanest_vcvc.py b/gr-digital/python/digital/qa_ofdm_chanest_vcvc.py
index d63b65d01..e39247da0 100755..100644
--- a/gr-digital/python/digital/qa_ofdm_chanest_vcvc.py
+++ b/gr-digital/python/digital/qa_ofdm_chanest_vcvc.py
@@ -19,6 +19,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import sys
import numpy
import random
@@ -203,7 +205,7 @@ class qa_ofdm_chanest_vcvc (gr_unittest.TestCase):
tx_data = shift_tuple(sync_symbol1, carr_offset) + \
shift_tuple(sync_symbol2, carr_offset) + \
shift_tuple(data_symbol, carr_offset)
- channel = range(fft_len)
+ channel = list(range(fft_len))
src = blocks.vector_source_c(tx_data, False, fft_len)
chan = blocks.multiply_const_vcc(channel)
chanest = digital.ofdm_chanest_vcvc(sync_symbol1, sync_symbol2, 1)
@@ -234,7 +236,7 @@ class qa_ofdm_chanest_vcvc (gr_unittest.TestCase):
n_iter = 20 # The more the accurater
def run_flow_graph(sync_sym1, sync_sym2, data_sym):
top_block = gr.top_block()
- carr_offset = random.randint(-max_offset/2, max_offset/2) * 2
+ carr_offset = random.randint(-max_offset / 2, max_offset / 2) * 2
tx_data = shift_tuple(sync_sym1, carr_offset) + \
shift_tuple(sync_sym2, carr_offset) + \
shift_tuple(data_sym, carr_offset)
@@ -265,14 +267,14 @@ class qa_ofdm_chanest_vcvc (gr_unittest.TestCase):
rx_sym_est[i] = (sink.data()[i] / channel_est[i]).real
return (carr_offset, list(shift_tuple(rx_sym_est, -carr_offset_hat)))
bit_errors = 0
- for k in xrange(n_iter):
+ for k in range(n_iter):
sync_sym = [(random.randint(0, 1) * 2 - 1) * syncsym_mask[i] for i in range(fft_len)]
ref_sym = [(random.randint(0, 1) * 2 - 1) * carrier_mask[i] for i in range(fft_len)]
data_sym = [(random.randint(0, 1) * 2 - 1) * carrier_mask[i] for i in range(fft_len)]
data_sym[26] = 1
(carr_offset, rx_sym) = run_flow_graph(sync_sym, ref_sym, data_sym)
rx_sym_est = [0,] * fft_len
- for i in xrange(fft_len):
+ for i in range(fft_len):
if carrier_mask[i] == 0:
continue
rx_sym_est[i] = {True: 1, False: -1}[rx_sym[i] > 0]
diff --git a/gr-digital/python/digital/qa_ofdm_cyclic_prefixer.py b/gr-digital/python/digital/qa_ofdm_cyclic_prefixer.py
index ecc1c426d..fc486fa6a 100755..100644
--- a/gr-digital/python/digital/qa_ofdm_cyclic_prefixer.py
+++ b/gr-digital/python/digital/qa_ofdm_cyclic_prefixer.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, digital, blocks
import pmt
@@ -37,7 +39,7 @@ class test_ofdm_cyclic_prefixer (gr_unittest.TestCase):
cp_len = 2
expected_result = (6, 7, 0, 1, 2, 3, 4, 5, 6, 7,
6, 7, 0, 1, 2, 3, 4, 5, 6, 7)
- src = blocks.vector_source_c(range(fft_len) * 2, False, fft_len)
+ src = blocks.vector_source_c(list(range(fft_len)) * 2, False, fft_len)
cp = digital.ofdm_cyclic_prefixer(fft_len, fft_len + cp_len)
sink = blocks.vector_sink_c()
self.tb.connect(src, cp, sink)
@@ -49,9 +51,9 @@ class test_ofdm_cyclic_prefixer (gr_unittest.TestCase):
fft_len = 8
cp_len = 2
rolloff = 2
- expected_result = (7.0/2, 8, 1, 2, 3, 4, 5, 6, 7, 8, # 1.0/2
- 7.0/2+1.0/2, 8, 1, 2, 3, 4, 5, 6, 7, 8)
- src = blocks.vector_source_c(range(1, fft_len+1) * 2, False, fft_len)
+ expected_result = (7.0 / 2, 8, 1, 2, 3, 4, 5, 6, 7, 8, # 1.0/2
+ 7.0 / 2+1.0 / 2, 8, 1, 2, 3, 4, 5, 6, 7, 8)
+ src = blocks.vector_source_c(list(range(1, fft_len+1)) * 2, False, fft_len)
cp = digital.ofdm_cyclic_prefixer(fft_len, fft_len + cp_len, rolloff)
sink = blocks.vector_sink_c()
self.tb.connect(src, cp, sink)
@@ -63,13 +65,13 @@ class test_ofdm_cyclic_prefixer (gr_unittest.TestCase):
fft_len = 8
cp_len = 2
tag_name = "ts_last"
- expected_result = (7.0/2, 8, 1, 2, 3, 4, 5, 6, 7, 8, # 1.0/2
- 7.0/2+1.0/2, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1.0/2)
+ expected_result = (7.0 / 2, 8, 1, 2, 3, 4, 5, 6, 7, 8, # 1.0/2
+ 7.0 / 2+1.0 / 2, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1.0 / 2)
tag2 = gr.tag_t()
tag2.offset = 1
tag2.key = pmt.string_to_symbol("random_tag")
tag2.value = pmt.from_long(42)
- src = blocks.vector_source_c(range(1, fft_len+1) * 2, False, fft_len, (tag2,))
+ src = blocks.vector_source_c(list(range(1, fft_len+1)) * 2, False, fft_len, (tag2,))
cp = digital.ofdm_cyclic_prefixer(fft_len, fft_len + cp_len, 2, tag_name)
sink = blocks.tsb_vector_sink_c(tsb_key=tag_name)
self.tb.connect(src, blocks.stream_to_tagged_stream(gr.sizeof_gr_complex, fft_len, 2, tag_name), cp, sink)
diff --git a/gr-digital/python/digital/qa_ofdm_frame_equalizer_vcvc.py b/gr-digital/python/digital/qa_ofdm_frame_equalizer_vcvc.py
index 1b3ffb773..482147e33 100755..100644
--- a/gr-digital/python/digital/qa_ofdm_frame_equalizer_vcvc.py
+++ b/gr-digital/python/digital/qa_ofdm_frame_equalizer_vcvc.py
@@ -1,23 +1,25 @@
#!/usr/bin/env python
# Copyright 2012,2013 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import division
import numpy
@@ -220,7 +222,7 @@ class qa_ofdm_frame_equalizer_vcvc (gr_unittest.TestCase):
eq = digital.ofdm_frame_equalizer_vcvc(equalizer.base(), 0, self.tsb_key, True)
self.tb.connect(
src,
- blocks.stream_to_tagged_stream(gr.sizeof_gr_complex, fft_len, len(tx_data)/fft_len, self.tsb_key),
+ blocks.stream_to_tagged_stream(gr.sizeof_gr_complex, fft_len, len(tx_data) // fft_len, self.tsb_key),
eq,
sink
)
@@ -278,7 +280,7 @@ class qa_ofdm_frame_equalizer_vcvc (gr_unittest.TestCase):
sink = blocks.tsb_vector_sink_c(vlen=fft_len, tsb_key=self.tsb_key)
self.tb.connect(
src,
- blocks.stream_to_tagged_stream(gr.sizeof_gr_complex, fft_len, len(tx_data)/fft_len, self.tsb_key),
+ blocks.stream_to_tagged_stream(gr.sizeof_gr_complex, fft_len, len(tx_data) // fft_len, self.tsb_key),
eq,
sink
)
@@ -360,7 +362,7 @@ class qa_ofdm_frame_equalizer_vcvc (gr_unittest.TestCase):
sink = blocks.tsb_vector_sink_c(fft_len, tsb_key=self.tsb_key)
self.tb.connect(
src,
- blocks.stream_to_tagged_stream(gr.sizeof_gr_complex, fft_len, len(tx_data)/fft_len, self.tsb_key),
+ blocks.stream_to_tagged_stream(gr.sizeof_gr_complex, fft_len, len(tx_data) // fft_len, self.tsb_key),
eq,
sink
)
diff --git a/gr-digital/python/digital/qa_ofdm_serializer_vcc.py b/gr-digital/python/digital/qa_ofdm_serializer_vcc.py
index 8a60b9788..a53aafccb 100755..100644
--- a/gr-digital/python/digital/qa_ofdm_serializer_vcc.py
+++ b/gr-digital/python/digital/qa_ofdm_serializer_vcc.py
@@ -1,24 +1,26 @@
#!/usr/bin/env python
#
# Copyright 2012-2014 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import division
import numpy
@@ -42,7 +44,7 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase):
0, 13, 1j, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 2j, 0, 0)
expected_result = tuple(range(1, 16)) + (0, 0, 0)
occupied_carriers = ((1, 3, 4, 11, 12, 14), (1, 2, 4, 11, 13, 14),)
- n_syms = len(tx_symbols)/fft_len
+ n_syms = len(tx_symbols) // fft_len
src = blocks.vector_source_c(tx_symbols, False, fft_len)
serializer = digital.ofdm_serializer_vcc(fft_len, occupied_carriers, self.tsb_key, "", 0, "", False)
sink = blocks.tsb_vector_sink_c(tsb_key=self.tsb_key)
@@ -60,7 +62,7 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase):
)
expected_result = tuple(range(18))
occupied_carriers = ((13, 14, 15, 1, 2, 3), (-4, -2, -1, 1, 2, 4),)
- n_syms = len(tx_symbols)/fft_len
+ n_syms = len(tx_symbols) // fft_len
src = blocks.vector_source_c(tx_symbols, False, fft_len)
serializer = digital.ofdm_serializer_vcc(fft_len, occupied_carriers, self.tsb_key)
sink = blocks.tsb_vector_sink_c(tsb_key=self.tsb_key)
@@ -71,14 +73,14 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase):
def test_002_with_offset (self):
""" Standard test, carrier offset """
fft_len = 16
- tx_symbols = range(1, 16);
+ tx_symbols = list(range(1, 16));
tx_symbols = (0, 0, 1, 1j, 2, 3, 0, 0, 0, 0, 0, 0, 4, 5, 2j, 6,
0, 0, 7, 8, 3j, 9, 0, 0, 0, 0, 0, 0, 10, 4j, 11, 12,
0, 0, 13, 1j, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 2j, 0)
carr_offset = 1 # Compare this with tx_symbols from the previous test
expected_result = tuple(range(1, 16)) + (0, 0, 0)
occupied_carriers = ((1, 3, 4, 11, 12, 14), (1, 2, 4, 11, 13, 14),)
- n_syms = len(tx_symbols)/fft_len
+ n_syms = len(tx_symbols) // fft_len
offsettag = gr.tag_t()
offsettag.offset = 0
offsettag.key = pmt.string_to_symbol("ofdm_sync_carr_offset")
@@ -156,7 +158,7 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase):
pilot_carriers,
pilot_symbols, (),
self.tsb_key)
- tx_ifft = fft.fft_vcc(fft_len, False, (1.0/fft_len,)*fft_len, True)
+ tx_ifft = fft.fft_vcc(fft_len, False, (1.0 / fft_len,)*fft_len, True)
oscillator = analog.sig_source_c(1.0, analog.GR_COS_WAVE, freq_offset, 1.0)
mixer = blocks.multiply_cc()
rx_fft = fft.fft_vcc(fft_len, True, (), True)
@@ -182,13 +184,13 @@ class qa_ofdm_serializer_vcc (gr_unittest.TestCase):
def test_005_packet_len_tag (self):
""" Standard test """
fft_len = 16
- tx_symbols = range(1, 16);
+ tx_symbols = list(range(1, 16));
tx_symbols = (0, 1, 1j, 2, 3, 0, 0, 0, 0, 0, 0, 4, 5, 2j, 6, 0,
0, 7, 8, 3j, 9, 0, 0, 0, 0, 0, 0, 10, 4j, 11, 12, 0,
0, 13, 1j, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 2j, 0, 0)
expected_result = tuple(range(1, 16))
occupied_carriers = ((1, 3, 4, 11, 12, 14), (1, 2, 4, 11, 13, 14),)
- n_syms = len(tx_symbols)/fft_len
+ n_syms = len(tx_symbols) // fft_len
packet_len_tsb_key = "packet_len"
tag2 = gr.tag_t()
tag2.offset = 0
diff --git a/gr-digital/python/digital/qa_ofdm_sync_sc_cfb.py b/gr-digital/python/digital/qa_ofdm_sync_sc_cfb.py
index 1558c5d51..610d883b6 100755..100644
--- a/gr-digital/python/digital/qa_ofdm_sync_sc_cfb.py
+++ b/gr-digital/python/digital/qa_ofdm_sync_sc_cfb.py
@@ -1,24 +1,26 @@
#!/usr/bin/env python
#
# Copyright 2012,2013 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import division
import numpy
import random
@@ -44,7 +46,7 @@ class qa_ofdm_sync_sc_cfb (gr_unittest.TestCase):
fft_len = 32
cp_len = 4
sig_len = (fft_len + cp_len) * 10
- sync_symbol = [(random.randint(0, 1)*2)-1 for x in range(fft_len/2)] * 2
+ sync_symbol = [(random.randint(0, 1)*2)-1 for x in range(fft_len // 2)] * 2
tx_signal = [0,] * n_zeros + \
sync_symbol[-cp_len:] + \
sync_symbol + \
@@ -60,8 +62,8 @@ class qa_ofdm_sync_sc_cfb (gr_unittest.TestCase):
self.tb.connect((sync, 0), sink_freq)
self.tb.connect((sync, 1), sink_detect)
self.tb.run()
- sig1_detect = sink_detect.data()[0:len(tx_signal)/2]
- sig2_detect = sink_detect.data()[len(tx_signal)/2:]
+ sig1_detect = sink_detect.data()[0:len(tx_signal) // 2]
+ sig2_detect = sink_detect.data()[len(tx_signal) // 2:]
self.assertTrue(abs(sig1_detect.index(1) - (n_zeros + fft_len + cp_len)) < cp_len)
self.assertTrue(abs(sig2_detect.index(1) - (n_zeros + fft_len + cp_len)) < cp_len)
self.assertEqual(numpy.sum(sig1_detect), 1)
@@ -75,7 +77,7 @@ class qa_ofdm_sync_sc_cfb (gr_unittest.TestCase):
max_freq_offset = 2*numpy.pi/fft_len # Otherwise, it's coarse
freq_offset = ((2 * random.random()) - 1) * max_freq_offset
sig_len = (fft_len + cp_len) * 10
- sync_symbol = [(random.randint(0, 1)*2)-1 for x in range(fft_len/2)] * 2
+ sync_symbol = [(random.randint(0, 1)*2)-1 for x in range(fft_len // 2)] * 2
tx_signal = sync_symbol[-cp_len:] + \
sync_symbol + \
[(random.randint(0, 1)*2)-1 for x in range(sig_len)]
@@ -99,8 +101,8 @@ class qa_ofdm_sync_sc_cfb (gr_unittest.TestCase):
fft_len = 32
cp_len = 4
tx_signal = []
- for i in xrange(n_bursts):
- sync_symbol = [(random.randint(0, 1)*2)-1 for x in range(fft_len/2)] * 2
+ for i in range(n_bursts):
+ sync_symbol = [(random.randint(0, 1)*2)-1 for x in range(fft_len // 2)] * 2
tx_signal += [0,] * random.randint(0, 2*fft_len) + \
sync_symbol[-cp_len:] + \
sync_symbol + \
@@ -139,8 +141,8 @@ Detection error was: %d """ % (numpy.sum(sink_detect.data()) - n_bursts)
tagname = "packet_length"
min_packet_length = 10
max_packet_length = 50
- sync_sequence = [random.randint(0, 1)*2-1 for x in range(fft_len/2)]
- for i in xrange(n_bursts):
+ sync_sequence = [random.randint(0, 1)*2-1 for x in range(fft_len // 2)]
+ for i in range(n_bursts):
packet_length = random.randint(min_packet_length,
max_packet_length+1)
packet = [random.randint(0, 255) for i in range(packet_length)]
diff --git a/gr-digital/python/digital/qa_ofdm_txrx.py b/gr-digital/python/digital/qa_ofdm_txrx.py
index ac267d238..2e8d10131 100755..100644
--- a/gr-digital/python/digital/qa_ofdm_txrx.py
+++ b/gr-digital/python/digital/qa_ofdm_txrx.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import random
import numpy
diff --git a/gr-digital/python/digital/qa_packet_format.py b/gr-digital/python/digital/qa_packet_format.py
index ae1a79f1f..6b2e9e958 100644
--- a/gr-digital/python/digital/qa_packet_format.py
+++ b/gr-digital/python/digital/qa_packet_format.py
@@ -21,6 +21,8 @@
#
import time, struct
+import six
+
import pmt
from gnuradio import gr, gr_unittest, digital, blocks
from gnuradio.digital import packet_utils
@@ -57,6 +59,7 @@ class test_packet_format_fb(gr_unittest.TestCase):
self.tb.start()
while (snk_hdr.num_messages() < 1) and (snk_pld.num_messages() < 1):
time.sleep(0.1)
+
self.tb.stop()
self.tb.wait()
@@ -65,14 +68,14 @@ class test_packet_format_fb(gr_unittest.TestCase):
result_hdr = pmt.u8vector_elements(result_hdr_pmt)
result_pld = pmt.u8vector_elements(result_pld_pmt)
- header = "".join([chr(r) for r in result_hdr])
- payload = "".join([chr(r) for r in result_pld])
+ header = "".join(chr(r) for r in result_hdr)
+ payload = "".join(chr(r) for r in result_pld)
access_code = packet_utils.conv_1_0_string_to_packed_binary_string(packet_utils.default_access_code)[0]
rx_access_code = header[0:len(access_code)]
length = len(send_str)
- rx_length = struct.unpack_from("!H", header, len(access_code))[0]
+ rx_length = struct.unpack_from(b"!H", six.b(header), len(access_code))[0]
self.assertEqual(access_code, rx_access_code)
self.assertEqual(length, rx_length)
@@ -158,16 +161,16 @@ class test_packet_format_fb(gr_unittest.TestCase):
result_hdr = pmt.u8vector_elements(result_hdr_pmt)
result_pld = pmt.u8vector_elements(result_pld_pmt)
- header = "".join([chr(r) for r in result_hdr])
- payload = "".join([chr(r) for r in result_pld])
+ header = "".join(chr(r) for r in result_hdr)
+ payload = "".join(chr(r) for r in result_pld)
access_code = packet_utils.conv_1_0_string_to_packed_binary_string(packet_utils.default_access_code)[0]
rx_access_code = header[0:len(access_code)]
length = len(send_str)
- rx_length = struct.unpack_from("!H", header, len(access_code))[0]
- rx_bps = struct.unpack_from("!H", header, len(access_code)+4)[0]
- rx_counter = struct.unpack_from("!H", header, len(access_code)+6)[0]
+ rx_length = struct.unpack_from(b"!H", six.b(header), len(access_code))[0]
+ rx_bps = struct.unpack_from(b"!H", six.b(header), len(access_code)+4)[0]
+ rx_counter = struct.unpack_from(b"!H", six.b(header), len(access_code)+6)[0]
self.assertEqual(access_code, rx_access_code)
self.assertEqual(length, rx_length)
diff --git a/gr-digital/python/digital/qa_packet_headergenerator_bb.py b/gr-digital/python/digital/qa_packet_headergenerator_bb.py
index d2677ce22..1ca0e85d8 100755..100644
--- a/gr-digital/python/digital/qa_packet_headergenerator_bb.py
+++ b/gr-digital/python/digital/qa_packet_headergenerator_bb.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, digital, blocks
from gnuradio.gr import packet_utils
import pmt
diff --git a/gr-digital/python/digital/qa_packet_headerparser_b.py b/gr-digital/python/digital/qa_packet_headerparser_b.py
index fb4226d6f..3e22fa910 100755..100644
--- a/gr-digital/python/digital/qa_packet_headerparser_b.py
+++ b/gr-digital/python/digital/qa_packet_headerparser_b.py
@@ -19,6 +19,7 @@
# Boston, MA 02110-1301, USA.
#
+
import time
import random
@@ -77,7 +78,7 @@ class qa_packet_headerparser_b (gr_unittest.TestCase):
header_len = 32
packet_len_tagname = "packet_len"
packet_lengths = [random.randint(1, 100) for x in range(N)]
- data, tags = tagged_streams.packets_to_vectors([range(packet_lengths[i]) for i in range(N)], packet_len_tagname)
+ data, tags = tagged_streams.packets_to_vectors([list(range(packet_lengths[i])) for i in range(N)], packet_len_tagname)
src = blocks.vector_source_b(data, False, 1, tags)
header_gen = digital.packet_headergenerator_bb(header_len, packet_len_tagname)
header_parser = digital.packet_headerparser_b(header_len, packet_len_tagname)
@@ -89,7 +90,7 @@ class qa_packet_headerparser_b (gr_unittest.TestCase):
self.tb.stop()
self.tb.wait()
self.assertEqual(sink.num_messages(), N)
- for i in xrange(N):
+ for i in range(N):
msg = pmt.to_python(sink.get_message(i))
self.assertEqual(msg, {'packet_len': packet_lengths[i], 'packet_num': i})
@@ -110,7 +111,7 @@ class qa_packet_headerparser_b (gr_unittest.TestCase):
frame_len_tagname = "frame_len"
src = blocks.vector_source_b(encoded_headers)
header_formatter = digital.packet_header_ofdm(
- (range(32),range(4),range(8)), # 32/4/8 carriers are occupied (which doesn't matter here)
+ (list(range(32)),list(range(4)),list(range(8))), # 32/4/8 carriers are occupied (which doesn't matter here)
1, # 1 OFDM symbol per header (= 32 bits)
packet_len_tagname,
frame_len_tagname,
@@ -141,10 +142,10 @@ class qa_packet_headerparser_b (gr_unittest.TestCase):
packet_length = 23
packet_len_tagname = "packet_len"
frame_len_tagname = "frame_len"
- data, tags = tagged_streams.packets_to_vectors([range(packet_length),range(packet_length),], packet_len_tagname)
+ data, tags = tagged_streams.packets_to_vectors([list(range(packet_length)),list(range(packet_length)),], packet_len_tagname)
src = blocks.vector_source_b(data, False, 1, tags)
header_formatter = digital.packet_header_ofdm(
- (range(32),), # 32 carriers are occupied (which doesn't matter here)
+ (list(range(32)),), # 32 carriers are occupied (which doesn't matter here)
1, # 1 OFDM symbol per header (= 32 bits)
packet_len_tagname,
frame_len_tagname,
diff --git a/gr-digital/python/digital/qa_pfb_clock_sync.py b/gr-digital/python/digital/qa_pfb_clock_sync.py
index e16a99338..77980d19e 100755..100644
--- a/gr-digital/python/digital/qa_pfb_clock_sync.py
+++ b/gr-digital/python/digital/qa_pfb_clock_sync.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import random
import cmath
import time
@@ -39,9 +41,9 @@ class test_pfb_clock_sync(gr_unittest.TestCase):
excess_bw = 0.35
sps = 4
- loop_bw = cmath.pi/100.0
+ loop_bw = cmath.pi / 100.0
nfilts = 32
- init_phase = nfilts/2
+ init_phase = nfilts / 2
max_rate_deviation = 0.5
osps = 1
@@ -92,9 +94,9 @@ class test_pfb_clock_sync(gr_unittest.TestCase):
excess_bw = 0.35
sps = 4
- loop_bw = cmath.pi/100.0
+ loop_bw = cmath.pi / 100.0
nfilts = 32
- init_phase = nfilts/2
+ init_phase = nfilts / 2
max_rate_deviation = 0.5
osps = 1
@@ -146,9 +148,9 @@ class test_pfb_clock_sync(gr_unittest.TestCase):
excess_bw1 = 0.22
sps = 4
- loop_bw = cmath.pi/100.0
+ loop_bw = cmath.pi / 100.0
nfilts = 32
- init_phase = nfilts/2
+ init_phase = nfilts / 2
max_rate_deviation = 0.5
osps = 1
@@ -184,9 +186,9 @@ class test_pfb_clock_sync(gr_unittest.TestCase):
excess_bw1 = 0.22
sps = 4
- loop_bw = cmath.pi/100.0
+ loop_bw = cmath.pi / 100.0
nfilts = 32
- init_phase = nfilts/2
+ init_phase = nfilts / 2
max_rate_deviation = 0.5
osps = 1
diff --git a/gr-digital/python/digital/qa_pn_correlator_cc.py b/gr-digital/python/digital/qa_pn_correlator_cc.py
index 92041d9ed..111801b5c 100755..100644
--- a/gr-digital/python/digital/qa_pn_correlator_cc.py
+++ b/gr-digital/python/digital/qa_pn_correlator_cc.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, digital, blocks
class test_pn_correlator_cc(gr_unittest.TestCase):
diff --git a/gr-digital/python/digital/qa_probe_density.py b/gr-digital/python/digital/qa_probe_density.py
index 752d95da3..e4450cd09 100755..100644
--- a/gr-digital/python/digital/qa_probe_density.py
+++ b/gr-digital/python/digital/qa_probe_density.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+
from gnuradio import gr, gr_unittest, digital, blocks
class test_probe_density(gr_unittest.TestCase):
@@ -62,7 +64,7 @@ class test_probe_density(gr_unittest.TestCase):
self.tb.run()
result_data = op.density()
- print result_data
+ print(result_data)
self.assertAlmostEqual(expected_data, result_data, 5)
if __name__ == '__main__':
diff --git a/gr-digital/python/digital/qa_scrambler.py b/gr-digital/python/digital/qa_scrambler.py
index 522b23245..93f77a9ef 100755..100644
--- a/gr-digital/python/digital/qa_scrambler.py
+++ b/gr-digital/python/digital/qa_scrambler.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, digital, blocks
import pmt
@@ -29,7 +30,7 @@ def additive_scramble_lfsr(mask, seed, reglen, bpb, data):
out = []
for d in data:
scramble_word = 0
- for i in xrange(0,bpb):
+ for i in range(0,bpb):
scramble_word ^= l.next_bit() << i
out.append(d ^ scramble_word)
return tuple(out)
@@ -121,7 +122,7 @@ class test_scrambler(gr_unittest.TestCase):
reset_tag3 = gr.tag_t()
reset_tag3.key = pmt.string_to_symbol(reset_tag_key)
reset_tag3.offset = 20
- src = blocks.vector_source_b(src_data * 3, False, 1, (reset_tag1, reset_tag2, reset_tag3))
+ src = blocks.vector_source_b([s * 3 for s in src_data], False, 1, (reset_tag1, reset_tag2, reset_tag3))
scrambler = digital.additive_scrambler_bb(0x8a, 0x7f, 7, 0, 8, reset_tag_key)
dst = blocks.vector_sink_b()
self.tb.connect(src, scrambler, dst)
diff --git a/gr-digital/python/digital/qa_simple_correlator.py b/gr-digital/python/digital/qa_simple_correlator.py
index f39fb62dd..9c0352e89 100755..100644
--- a/gr-digital/python/digital/qa_simple_correlator.py
+++ b/gr-digital/python/digital/qa_simple_correlator.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks, filter, digital
class test_simple_correlator(gr_unittest.TestCase):
diff --git a/gr-digital/python/digital/qa_simple_framer.py b/gr-digital/python/digital/qa_simple_framer.py
index cf9934648..fb1ac0dfd 100755..100644
--- a/gr-digital/python/digital/qa_simple_framer.py
+++ b/gr-digital/python/digital/qa_simple_framer.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, digital, blocks
class test_simple_framer(gr_unittest.TestCase):
diff --git a/gr-digital/python/digital/qam.py b/gr-digital/python/digital/qam.py
index 518be7894..be4b7efa7 100644
--- a/gr-digital/python/digital/qam.py
+++ b/gr-digital/python/digital/qam.py
@@ -1,37 +1,40 @@
#
# Copyright 2005,2006,2011,2013 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
"""
QAM modulation and demodulation.
"""
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
from math import pi, sqrt, log
from gnuradio import gr
-from generic_mod_demod import generic_mod, generic_demod
-from generic_mod_demod import shared_mod_args, shared_demod_args
-from utils.gray_code import gray_code
-from utils import mod_codes
-import modulation_utils
-import digital_swig as digital
+from .generic_mod_demod import generic_mod, generic_demod
+from .generic_mod_demod import shared_mod_args, shared_demod_args
+from .utils.gray_code import gray_code
+from .utils import mod_codes
+from . import modulation_utils
+from . import digital_swig as digital
# Default number of points in constellation.
_def_constellation_points = 16
@@ -42,7 +45,7 @@ _def_differential = True
_def_mod_code = mod_codes.NO_CODE
def is_power_of_four(x):
- v = log(x)/log(4)
+ v = log(x) / log(4)
return int(v) == v
def get_bit(x, n):
@@ -52,7 +55,7 @@ def get_bit(x, n):
def get_bits(x, n, k):
""" Get the k bits of integer x starting at bit n(from little end)."""
# Remove the n smallest bits
- v = x >> n
+ v = x >> n
# Remove all bits bigger than n+k-1
return v % pow(2, k)
@@ -74,7 +77,7 @@ def make_differential_constellation(m, gray_coded):
k = int(log(m) / log(2.0))
# First create a constellation for one quadrant containing m/4 points.
# The quadrant has 'side' points along each side of a quadrant.
- side = int(sqrtm/2)
+ side = int(sqrtm / 2)
if gray_coded:
# Number rows and columns using gray codes.
gcs = gray_code(side)
@@ -83,7 +86,7 @@ def make_differential_constellation(m, gray_coded):
else:
i_gcs = dict([(i, i) for i in range(0, side)])
# The distance between points is found.
- step = 1/(side-0.5)
+ step = 1 / (side-0.5)
gc_to_x = [(i_gcs[gc]+0.5)*step for gc in range(0, side)]
@@ -100,7 +103,7 @@ def make_differential_constellation(m, gray_coded):
return complex(-gc_to_x[gc_x], -gc_to_x[gc_y])
if quad == 3:
return complex(gc_to_x[gc_y], -gc_to_x[gc_x])
- raise StandardError("Impossible!")
+ raise Exception("Impossible!")
# First two bits determine quadrant.
# Next (k-2)/2 bits determine x position.
@@ -108,8 +111,8 @@ def make_differential_constellation(m, gray_coded):
# How x and y relate to real and imag depends on quadrant (see get_c function).
const_map = []
for i in range(m):
- y = get_bits(i, 0, (k-2)/2)
- x = get_bits(i, (k-2)/2, (k-2)/2)
+ y = get_bits(i, 0, (k-2) // 2)
+ x = get_bits(i, (k-2) // 2, (k-2) // 2)
quad = get_bits(i, k-2, 2)
const_map.append(get_c(x, y, quad))
@@ -127,17 +130,17 @@ def make_non_differential_constellation(m, gray_coded):
# Get inverse gray codes.
i_gcs = mod_codes.invert_code(gcs)
else:
- i_gcs = range(0, side)
+ i_gcs = list(range(0, side))
# The distance between points is found.
- step = 2.0/(side-1)
+ step = 2.0 / (side-1)
gc_to_x = [-1 + i_gcs[gc]*step for gc in range(0, side)]
# First k/2 bits determine x position.
# Following k/2 bits determine y position.
const_map = []
for i in range(m):
- y = gc_to_x[get_bits(i, 0, k/2)]
- x = gc_to_x[get_bits(i, k/2, k/2)]
+ y = gc_to_x[get_bits(i, 0, k // 2)]
+ x = gc_to_x[get_bits(i, k // 2, k // 2)]
const_map.append(complex(x,y))
return const_map
@@ -170,7 +173,7 @@ def qam_constellation(constellation_points=_def_constellation_points,
else:
points = make_non_differential_constellation(constellation_points, gray_coded)
side = int(sqrt(constellation_points))
- width = 2.0/(side-1)
+ width = 2.0 / (side-1)
# No pre-diff code
# Should add one so that we can gray-code the quadrant bits too.
@@ -242,8 +245,8 @@ def large_ampls_to_corners_mapping(side, points, width):
sector = real_x * side + imag_x
# If this sector is a normal constellation sector then
# use the center point.
- c = ((real_x-side/2.0+0.5)*width +
- (imag_x-side/2.0+0.5)*width*1j)
+ c = ((real_x-side / 2.0+0.5)*width +
+ (imag_x-side / 2.0+0.5)*width*1j)
if (real_x >= extra_layers and real_x < side-extra_layers
and imag_x >= extra_layers and imag_x < side-extra_layers):
# This is not an edge row/column. Find closest point.
@@ -254,7 +257,7 @@ def large_ampls_to_corners_mapping(side, points, width):
sector_values.append(index)
return sector_values
-
+
# /////////////////////////////////////////////////////////////////////////////
# QAM modulator
# /////////////////////////////////////////////////////////////////////////////
@@ -262,10 +265,10 @@ def large_ampls_to_corners_mapping(side, points, width):
class qam_mod(generic_mod):
"""
Hierarchical block for RRC-filtered QAM modulation.
-
+
The input is a byte stream (unsigned char) and the
output is the complex modulated signal at baseband.
-
+
Args:
constellation_points: Number of constellation points (must be a power of four) (integer).
mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE).
@@ -280,10 +283,10 @@ class qam_mod(generic_mod):
*args, **kwargs):
"""
- Hierarchical block for RRC-filtered QAM modulation.
+ Hierarchical block for RRC-filtered QAM modulation.
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
Args:
constellation_points: Number of constellation points.
@@ -292,7 +295,7 @@ class qam_mod(generic_mod):
if we want gray coding, see digital.utils.mod_codes)
See generic_mod block for list of additional parameters.
- """
+ """
constellation = qam_constellation(constellation_points, differential,
mod_code)
@@ -309,10 +312,10 @@ class qam_mod(generic_mod):
class qam_demod(generic_demod):
"""
Hierarchical block for RRC-filtered QAM modulation.
-
+
The input is a byte stream (unsigned char) and the
output is the complex modulated signal at baseband.
-
+
Args:
constellation_points: Number of constellation points (must be a power of four) (integer).
mod_code: Whether to use a gray_code (digital.mod_codes.GRAY_CODE) or not (digital.mod_codes.NO_CODE).
@@ -327,10 +330,10 @@ class qam_demod(generic_demod):
large_ampls_to_corner = False,
*args, **kwargs):
"""
- Hierarchical block for RRC-filtered QAM modulation.
+ Hierarchical block for RRC-filtered QAM modulation.
- The input is a byte stream (unsigned char) and the
- output is the complex modulated signal at baseband.
+ The input is a byte stream (unsigned char) and the
+ output is the complex modulated signal at baseband.
Args:
constellation_points: Number of constellation points.
diff --git a/gr-digital/python/digital/qam_constellations.py b/gr-digital/python/digital/qam_constellations.py
index cd895c590..c0d7805f8 100755..100644
--- a/gr-digital/python/digital/qam_constellations.py
+++ b/gr-digital/python/digital/qam_constellations.py
@@ -20,8 +20,11 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
import numpy
-from constellation_map_generator import constellation_map_generator
+from .constellation_map_generator import constellation_map_generator
'''
Note on the naming scheme. Each constellation is named using a prefix
@@ -242,8 +245,8 @@ def sd_qam_16_0x0_0_1_2_3(x, Es=1):
'''
dist = Es*numpy.sqrt(2)
- boundary = dist/3.0
- dist0 = dist/6.0
+ boundary = dist / 3.0
+ dist0 = dist / 6.0
# print "Sample: ", x
# print "Es: ", Es
# print "Distance: ", dist
@@ -270,7 +273,7 @@ def sd_qam_16_0x0_0_1_2_3(x, Es=1):
b2 = -abs(x_re) + boundary
b0 = -abs(x_im) + boundary
- return [(Es/2.0)*b3, (Es/2.0)*b2, (Es/2.0)*b1, (Es/2.0)*b0]
+ return [(Es / 2.0)*b3, (Es / 2.0)*b2, (Es / 2.0)*b1, (Es / 2.0)*b0]
sd_qam_16 = sd_qam_16_0x0_0_1_2_3
sd_qam_16_0 = sd_qam_16
diff --git a/gr-digital/python/digital/qamlike.py b/gr-digital/python/digital/qamlike.py
index 2f8c85533..286eabd89 100644
--- a/gr-digital/python/digital/qamlike.py
+++ b/gr-digital/python/digital/qamlike.py
@@ -1,33 +1,35 @@
# Copyright 2013 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
"""
This file contains constellations that are similar to QAM, but are not perfect squares.
"""
+from __future__ import absolute_import
+from __future__ import unicode_literals
-import digital_swig
-from qam import large_ampls_to_corners_mapping
+from . import digital_swig
+from .qam import large_ampls_to_corners_mapping
def qam32_holeinside_constellation(large_ampls_to_corners=False):
# First make constellation for one quadrant.
- # 0 1 2
+ # 0 1 2
# 2 - 010 111 110
# 1 - 011 101 100
# 0 - 000 001
@@ -72,4 +74,3 @@ def qam32_holeinside_constellation(large_ampls_to_corners=False):
constellation = digital_swig.constellation_expl_rect(
points, pre_diff_code, 4, side, side, width, width, sector_values)
return constellation
-
diff --git a/gr-digital/python/digital/qpsk.py b/gr-digital/python/digital/qpsk.py
index c5230ef24..830388399 100644
--- a/gr-digital/python/digital/qpsk.py
+++ b/gr-digital/python/digital/qpsk.py
@@ -24,13 +24,15 @@ QPSK modulation.
Demodulation is not included since the generic_mod_demod
"""
+from __future__ import absolute_import
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio.digital.generic_mod_demod import generic_mod, generic_demod
from gnuradio.digital.generic_mod_demod import shared_mod_args, shared_demod_args
-from utils import mod_codes
-import digital_swig as digital
-import modulation_utils
+from .utils import mod_codes
+from . import digital_swig as digital
+from . import modulation_utils
# The default encoding (e.g. gray-code, set-partition)
_def_mod_code = mod_codes.GRAY_CODE
diff --git a/gr-digital/python/digital/soft_dec_lut_gen.py b/gr-digital/python/digital/soft_dec_lut_gen.py
index f51727770..fc69f7f67 100644
--- a/gr-digital/python/digital/soft_dec_lut_gen.py
+++ b/gr-digital/python/digital/soft_dec_lut_gen.py
@@ -20,6 +20,10 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
import numpy
def soft_dec_table_generator(soft_dec_gen, prec, Es=1):
@@ -123,6 +127,7 @@ def soft_dec_table(constel, symbols, prec, npwr=1):
xrng = numpy.linspace(re_min, re_max, npts)
table = []
+
for y in yrng:
for x in xrng:
pt = complex(x, y)
@@ -196,8 +201,8 @@ def calc_soft_dec(sample, constel, symbols, npwr=1):
M = len(constel)
k = int(numpy.log2(M))
- tmp = 2*k*[0,]
- s = k*[0,]
+ tmp = 2*k*[0]
+ s = k*[0]
for i in range(M):
# Calculate the distance between the sample and the current
@@ -206,7 +211,7 @@ def calc_soft_dec(sample, constel, symbols, npwr=1):
# Calculate the probability factor from the distance and the
# scaled noise power.
- d = numpy.exp(-dist/npwr)
+ d = numpy.exp(-dist / npwr)
for j in range(k):
# Get the bit at the jth index
@@ -235,21 +240,21 @@ def show_table(table):
pp = ""
subi = 1
subj = 0
- for i in reversed(xrange(prec+1)):
+ for i in reversed(list(range(prec+1))):
if(i == prec//2):
pp += "-----" + prec*((nbits*8)+3)*"-" + "\n"
subi = 0
continue
- for j in xrange(prec+1):
+ for j in range(prec+1):
if(j == prec//2):
pp += "| "
subj = 1
else:
item = table[prec*(i-subi) + (j-subj)]
pp += "( "
- for t in xrange(nbits-1, -1, -1):
+ for t in range(nbits-1, -1, -1):
pp += "{0: .4f} ".format(item[t])
pp += ") "
pp += "\n"
subj = 0
- print pp
+ print(pp)
diff --git a/gr-digital/python/digital/test_soft_decisions.py b/gr-digital/python/digital/test_soft_decisions.py
index 878058ebb..eba31bab7 100755..100644
--- a/gr-digital/python/digital/test_soft_decisions.py
+++ b/gr-digital/python/digital/test_soft_decisions.py
@@ -1,30 +1,35 @@
#!/usr/bin/env python
#
# Copyright 2013 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
import numpy, pylab, sys
from gnuradio import digital
-from soft_dec_lut_gen import soft_dec_table, calc_soft_dec_from_table, calc_soft_dec
-from psk_constellations import psk_4_0, psk_4_1, psk_4_2, psk_4_3, psk_4_4, psk_4_5, psk_4_6, psk_4_7, sd_psk_4_0, sd_psk_4_1, sd_psk_4_2, sd_psk_4_3, sd_psk_4_4, sd_psk_4_5, sd_psk_4_6, sd_psk_4_7
-from qam_constellations import qam_16_0, sd_qam_16_0
+from .soft_dec_lut_gen import soft_dec_table, calc_soft_dec_from_table, calc_soft_dec
+from .psk_constellations import psk_4_0, psk_4_1, psk_4_2, psk_4_3, psk_4_4, psk_4_5, psk_4_6, psk_4_7, sd_psk_4_0, sd_psk_4_1, sd_psk_4_2, sd_psk_4_3, sd_psk_4_4, sd_psk_4_5, sd_psk_4_6, sd_psk_4_7
+from .qam_constellations import qam_16_0, sd_qam_16_0
def test_qpsk(i, sample, prec):
qpsk_const_list = [psk_4_0, psk_4_1, psk_4_2, psk_4_3,
@@ -61,7 +66,7 @@ def test_qpsk(i, sample, prec):
y_cpp_table, y_cpp_raw_calc, constel, code, c)
def test_qam16(i, sample, prec):
- sample = sample/1
+ sample = sample / 1
qam_const_list = [qam_16_0, ]
qam_lut_gen_list = [sd_qam_16_0, ]
@@ -114,12 +119,12 @@ if __name__ == "__main__":
k = numpy.log2(len(constel))
- print "Sample: ", x
- print "Python Generator Calculated: ", (y_python_gen_calc)
- print "Python Generator Table: ", (y_python_table)
- print "Python Raw calc: ", (y_python_raw_calc)
- print "C++ Table calc: ", (y_cpp_table)
- print "C++ Raw calc: ", (y_cpp_raw_calc)
+ print("Sample: ", x)
+ print("Python Generator Calculated: ", (y_python_gen_calc))
+ print("Python Generator Table: ", (y_python_table))
+ print("Python Raw calc: ", (y_python_raw_calc))
+ print("C++ Table calc: ", (y_cpp_table))
+ print("C++ Raw calc: ", (y_cpp_raw_calc))
fig = pylab.figure(1)
sp1 = fig.add_subplot(1,1,1)
diff --git a/gr-digital/python/digital/utils/alignment.py b/gr-digital/python/digital/utils/alignment.py
index f3ad3781e..e9292a4bc 100644
--- a/gr-digital/python/digital/utils/alignment.py
+++ b/gr-digital/python/digital/utils/alignment.py
@@ -41,6 +41,8 @@ This module contains functions for aligning sequences.
(100, -20)
"""
+from __future__ import division
+from __future__ import unicode_literals
import random
@@ -63,7 +65,7 @@ def compare_sequences(d1, d2, offset, sample_indices=None):
"""
max_index = min(len(d1), len(d2)+offset)
if sample_indices is None:
- sample_indices = range(0, max_index)
+ sample_indices = list(range(0, max_index))
correct = 0
total = 0
for i in sample_indices:
@@ -84,8 +86,8 @@ def random_sample(size, num_samples=def_num_samples, seed=None):
if num_samples > size:
indices = set(range(0, size))
else:
- if num_samples > size/2:
- num_samples = num_samples/2
+ if num_samples > size / 2:
+ num_samples = num_samples / 2
indices = set([])
while len(indices) < num_samples:
index = rndm.randint(0, size-1)
@@ -119,8 +121,8 @@ def align_sequences(d1, d2,
best_offset = None
best_compared = None
best_correct = None
- pos_range = range(0, min(len(d1), max_offset))
- neg_range = range(-1, -min(len(d2), max_offset), -1)
+ pos_range = list(range(0, min(len(d1), max_offset)))
+ neg_range = list(range(-1, -min(len(d2), max_offset), -1))
# Interleave the positive and negative offsets.
int_range = [item for items in zip(pos_range, neg_range) for item in items]
for offset in int_range:
diff --git a/gr-digital/python/digital/utils/gray_code.py b/gr-digital/python/digital/utils/gray_code.py
index 926a1ded1..ad8827408 100644
--- a/gr-digital/python/digital/utils/gray_code.py
+++ b/gr-digital/python/digital/utils/gray_code.py
@@ -1,25 +1,27 @@
#!/usr/bin/env python
#
# Copyright 2011 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
+from __future__ import division
+from __future__ import unicode_literals
class GrayCodeGenerator(object):
"""
Generates and caches gray codes.
@@ -41,7 +43,7 @@ class GrayCodeGenerator(object):
if len(self.gcs) < length:
self.generate_new_gray_code(length)
return self.gcs[:length]
-
+
def generate_new_gray_code(self, length):
"""
Generates new gray code and places into cache.
@@ -49,7 +51,7 @@ class GrayCodeGenerator(object):
while len(self.gcs) < length:
if self.i == self.lp2:
# if i is a power of two then gray number is of form 1100000...
- result = self.i + self.i/2
+ result = self.i + self.i // 2
else:
# if not we take advantage of the symmetry of all but the last bit
# around a power of two.
diff --git a/gr-digital/python/digital/utils/mod_codes.py b/gr-digital/python/digital/utils/mod_codes.py
index f55fe41b8..586ab1999 100644
--- a/gr-digital/python/digital/utils/mod_codes.py
+++ b/gr-digital/python/digital/utils/mod_codes.py
@@ -21,6 +21,7 @@
#
# Constants used to represent what coding to use.
+from __future__ import unicode_literals
GRAY_CODE = 'gray'
SET_PARTITION_CODE = 'set-partition'
NO_CODE = 'none'
diff --git a/gr-digital/python/digital/utils/tagged_streams.py b/gr-digital/python/digital/utils/tagged_streams.py
index 4b393bfc2..68267a293 100644
--- a/gr-digital/python/digital/utils/tagged_streams.py
+++ b/gr-digital/python/digital/utils/tagged_streams.py
@@ -1,27 +1,30 @@
#!/usr/bin/env python
#
# Copyright 2013 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio 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.
-#
+#
# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
# DEPRECATED -- Marked for removal in 3.8
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
import pmt
@@ -30,9 +33,9 @@ def make_lengthtags(lengths, offsets, tagname='length', vlen=1):
assert(len(offsets) == len(lengths))
for offset, length in zip(offsets, lengths):
tag = gr.tag_t()
- tag.offset = offset/vlen
+ tag.offset = offset / vlen
tag.key = pmt.string_to_symbol(tagname)
- tag.value = pmt.from_long(length/vlen)
+ tag.value = pmt.from_long(length / vlen)
tags.append(tag)
return tags
@@ -75,7 +78,7 @@ def count_bursts(data, tags, lengthtagname, vlen=1):
if pos in lengths:
if in_packet:
print("Got tag at pos {0} current packet_pos is {1}".format(pos, packet_pos))
- raise StandardError("Received packet tag while in packet.")
+ raise Exception("Received packet tag while in packet.")
packet_pos = -1
packet_length = lengths[pos]
in_packet = True
@@ -127,9 +130,9 @@ def packets_to_vectors(packets, lengthtagname, vlen=1):
for packet in packets:
data.extend(packet)
tag = gr.tag_t()
- tag.offset = offset/vlen
+ tag.offset = offset // vlen
tag.key = pmt.string_to_symbol(lengthtagname)
- tag.value = pmt.from_long(len(packet)/vlen)
+ tag.value = pmt.from_long(len(packet) // vlen)
tags.append(tag)
offset = offset + len(packet)
return data, tags
diff --git a/gr-digital/swig/digital_swig.py.in b/gr-digital/swig/digital_swig.py.in
index d5d55a0f4..a4326d134 100644
--- a/gr-digital/swig/digital_swig.py.in
+++ b/gr-digital/swig/digital_swig.py.in
@@ -19,6 +19,8 @@
# Boston, MA 02110-1301, USA.
#
-from digital_swig0 import *
-from digital_swig1 import *
-from digital_swig2 import *
+from __future__ import absolute_import
+
+from .digital_swig0 import *
+from .digital_swig1 import *
+from .digital_swig2 import *
diff --git a/gr-dtv/examples/atsc_ctrlport_monitor.py b/gr-dtv/examples/atsc_ctrlport_monitor.py
index 25c52afd6..5329da2d4 100755..100644
--- a/gr-dtv/examples/atsc_ctrlport_monitor.py
+++ b/gr-dtv/examples/atsc_ctrlport_monitor.py
@@ -18,6 +18,10 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
import sys
import matplotlib
matplotlib.use("QT4Agg")
@@ -37,12 +41,12 @@ the link quality. This also gets the equalizer taps of the receiver
and displays the frequency response.
"""
-class atsc_ctrlport_monitor:
+class atsc_ctrlport_monitor(object):
def __init__(self, host, port):
argv = [None, host, port]
radiosys = GNURadioControlPortClient(argv=argv, rpcmethod='thrift')
self.radio = radiosys.client
- print self.radio
+ print(self.radio)
vt_init_key = 'dtv_atsc_viterbi_decoder0::decoder_metrics'
@@ -108,17 +112,17 @@ class atsc_ctrlport_monitor:
ntaps = len(eqdata.value)
taps.set_ydata(eqdata.value)
- taps.set_xdata(xrange(ntaps))
+ taps.set_xdata(list(range(ntaps)))
self._sp0.set_xlim(0, ntaps)
self._sp0.set_ylim(min(eqdata.value), max(eqdata.value))
fs = 6.25e6
- freq = scipy.linspace(-fs/2, fs/2, 10000)
+ freq = scipy.linspace(-fs / 2, fs / 2, 10000)
H = fftpack.fftshift(fftpack.fft(eqdata.value, 10000))
HdB = 20.0*scipy.log10(abs(H))
psd.set_ydata(HdB)
psd.set_xdata(freq)
- self._sp1.set_xlim(0, fs/2)
+ self._sp1.set_xlim(0, fs / 2)
self._sp1.set_ylim([min(HdB), max(HdB)])
self._sp1.set_yticks([min(HdB), max(HdB)])
self._sp1.set_yticklabels(["min", "max"])
diff --git a/gr-dtv/grc/CMakeLists.txt b/gr-dtv/grc/CMakeLists.txt
index e226d0997..3ed47f231 100644
--- a/gr-dtv/grc/CMakeLists.txt
+++ b/gr-dtv/grc/CMakeLists.txt
@@ -18,60 +18,59 @@
# Boston, MA 02110-1301, USA.
install(FILES
- dtv_atsc_deinterleaver.xml
- dtv_atsc_depad.xml
- dtv_atsc_derandomizer.xml
- dtv_atsc_equalizer.xml
- dtv_atsc_fpll.xml
- dtv_atsc_fs_checker.xml
- dtv_atsc_rs_decoder.xml
- dtv_atsc_rx.xml
- dtv_atsc_rx_filter.xml
- dtv_atsc_sync.xml
- dtv_atsc_viterbi_decoder.xml
- dtv_block_tree.xml
- dtv_atsc_pad.xml
- dtv_atsc_randomizer.xml
- dtv_atsc_rs_encoder.xml
- dtv_atsc_interleaver.xml
- dtv_atsc_trellis_encoder.xml
- dtv_atsc_field_sync_mux.xml
- dtv_dvb_bbheader_bb.xml
- dtv_dvb_bbscrambler_bb.xml
- dtv_dvb_bch_bb.xml
- dtv_dvb_ldpc_bb.xml
- dtv_dvbt2_interleaver_bb.xml
- dtv_dvbt2_modulator_bc.xml
- dtv_dvbt2_cellinterleaver_cc.xml
- dtv_dvbt2_framemapper_cc.xml
- dtv_dvbt2_freqinterleaver_cc.xml
- dtv_dvbt2_pilotgenerator_cc.xml
- dtv_dvbt2_paprtr_cc.xml
- dtv_dvbt2_p1insertion_cc.xml
- dtv_dvbt2_miso_cc.xml
- dtv_dvbs2_interleaver_bb.xml
- dtv_dvbs2_modulator_bc.xml
- dtv_dvbs2_physical_cc.xml
- dtv_dvbt_energy_dispersal.xml
- dtv_dvbt_reed_solomon_enc.xml
- dtv_dvbt_convolutional_interleaver.xml
- dtv_dvbt_inner_coder.xml
- dtv_dvbt_bit_inner_interleaver.xml
- dtv_dvbt_symbol_inner_interleaver.xml
- dtv_dvbt_map.xml
- dtv_dvbt_reference_signals.xml
- dtv_dvbt_ofdm_sym_acquisition.xml
- dtv_dvbt_demod_reference_signals.xml
- dtv_dvbt_demap.xml
- dtv_dvbt_bit_inner_deinterleaver.xml
- dtv_dvbt_viterbi_decoder.xml
- dtv_dvbt_convolutional_deinterleaver.xml
- dtv_dvbt_reed_solomon_dec.xml
- dtv_dvbt_energy_descramble.xml
- dtv_catv_transport_framing_enc_bb.xml
- dtv_catv_reed_solomon_enc_bb.xml
- dtv_catv_randomizer_bb.xml
- dtv_catv_frame_sync_enc_bb.xml
- dtv_catv_trellis_enc_bb.xml
+ dtv_atsc_deinterleaver.block.yml
+ dtv_atsc_depad.block.yml
+ dtv_atsc_derandomizer.block.yml
+ dtv_atsc_equalizer.block.yml
+ dtv_atsc_fpll.block.yml
+ dtv_atsc_fs_checker.block.yml
+ dtv_atsc_rs_decoder.block.yml
+ dtv_atsc_rx.block.yml
+ dtv_atsc_rx_filter.block.yml
+ dtv_atsc_sync.block.yml
+ dtv_atsc_viterbi_decoder.block.yml
+ dtv_atsc_pad.block.yml
+ dtv_atsc_randomizer.block.yml
+ dtv_atsc_rs_encoder.block.yml
+ dtv_atsc_interleaver.block.yml
+ dtv_atsc_trellis_encoder.block.yml
+ dtv_atsc_field_sync_mux.block.yml
+ dtv_dvb_bbheader_bb.block.yml
+ dtv_dvb_bbscrambler_bb.block.yml
+ dtv_dvb_bch_bb.block.yml
+ dtv_dvb_ldpc_bb.block.yml
+ dtv_dvbt2_interleaver_bb.block.yml
+ dtv_dvbt2_modulator_bc.block.yml
+ dtv_dvbt2_cellinterleaver_cc.block.yml
+ dtv_dvbt2_framemapper_cc.block.yml
+ dtv_dvbt2_freqinterleaver_cc.block.yml
+ dtv_dvbt2_pilotgenerator_cc.block.yml
+ dtv_dvbt2_paprtr_cc.block.yml
+ dtv_dvbt2_p1insertion_cc.block.yml
+ dtv_dvbt2_miso_cc.block.yml
+ dtv_dvbs2_interleaver_bb.block.yml
+ dtv_dvbs2_modulator_bc.block.yml
+ dtv_dvbs2_physical_cc.block.yml
+ dtv_dvbt_energy_dispersal.block.yml
+ dtv_dvbt_reed_solomon_enc.block.yml
+ dtv_dvbt_convolutional_interleaver.block.yml
+ dtv_dvbt_inner_coder.block.yml
+ dtv_dvbt_bit_inner_interleaver.block.yml
+ dtv_dvbt_symbol_inner_interleaver.block.yml
+ dtv_dvbt_map.block.yml
+ dtv_dvbt_reference_signals.block.yml
+ dtv_dvbt_ofdm_sym_acquisition.block.yml
+ dtv_dvbt_demod_reference_signals.block.yml
+ dtv_dvbt_demap.block.yml
+ dtv_dvbt_bit_inner_deinterleaver.block.yml
+ dtv_dvbt_viterbi_decoder.block.yml
+ dtv_dvbt_convolutional_deinterleaver.block.yml
+ dtv_dvbt_reed_solomon_dec.block.yml
+ dtv_dvbt_energy_descramble.block.yml
+ dtv_catv_transport_framing_enc_bb.block.yml
+ dtv_catv_reed_solomon_enc_bb.block.yml
+ dtv_catv_randomizer_bb.block.yml
+ dtv_catv_frame_sync_enc_bb.block.yml
+ dtv_catv_trellis_enc_bb.block.yml
DESTINATION ${GRC_BLOCKS_DIR}
)
diff --git a/gr-dtv/grc/dtv.tree.yml b/gr-dtv/grc/dtv.tree.yml
new file mode 100644
index 000000000..ad0b0cafb
--- /dev/null
+++ b/gr-dtv/grc/dtv.tree.yml
@@ -0,0 +1,62 @@
+'[Core]':
+- Digital Television:
+ - ATSC:
+ - dtv_atsc_deinterleaver
+ - dtv_atsc_depad
+ - dtv_atsc_derandomizer
+ - dtv_atsc_equalizer
+ - dtv_atsc_fpll
+ - dtv_atsc_fs_checker
+ - dtv_atsc_rs_decoder
+ - dtv_atsc_rx
+ - dtv_atsc_rx_filter
+ - dtv_atsc_sync
+ - dtv_atsc_viterbi_decoder
+ - dtv_atsc_pad
+ - dtv_atsc_randomizer
+ - dtv_atsc_rs_encoder
+ - dtv_atsc_interleaver
+ - dtv_atsc_trellis_encoder
+ - dtv_atsc_field_sync_mux
+ - DVB:
+ - dtv_dvb_bbheader_bb
+ - dtv_dvb_bbscrambler_bb
+ - dtv_dvb_bch_bb
+ - dtv_dvb_ldpc_bb
+ - DVB-T2:
+ - dtv_dvbt2_interleaver_bb
+ - dtv_dvbt2_modulator_bc
+ - dtv_dvbt2_cellinterleaver_cc
+ - dtv_dvbt2_framemapper_cc
+ - dtv_dvbt2_freqinterleaver_cc
+ - dtv_dvbt2_pilotgenerator_cc
+ - dtv_dvbt2_paprtr_cc
+ - dtv_dvbt2_p1insertion_cc
+ - dtv_dvbt2_miso_cc
+ - DVB-S2:
+ - dtv_dvbs2_interleaver_bb
+ - dtv_dvbs2_modulator_bc
+ - dtv_dvbs2_physical_cc
+ - DVB-T:
+ - dtv_dvbt_energy_dispersal
+ - dtv_dvbt_reed_solomon_enc
+ - dtv_dvbt_convolutional_interleaver
+ - dtv_dvbt_inner_coder
+ - dtv_dvbt_bit_inner_interleaver
+ - dtv_dvbt_symbol_inner_interleaver
+ - dtv_dvbt_map
+ - dtv_dvbt_reference_signals
+ - dtv_dvbt_ofdm_sym_acquisition
+ - dtv_dvbt_demod_reference_signals
+ - dtv_dvbt_demap
+ - dtv_dvbt_bit_inner_deinterleaver
+ - dtv_dvbt_viterbi_decoder
+ - dtv_dvbt_convolutional_deinterleaver
+ - dtv_dvbt_reed_solomon_dec
+ - dtv_dvbt_energy_descramble
+ - ITU-T J.83B:
+ - dtv_catv_transport_framing_enc_bb
+ - dtv_catv_reed_solomon_enc_bb
+ - dtv_catv_randomizer_bb
+ - dtv_catv_frame_sync_enc_bb
+ - dtv_catv_trellis_enc_bb
diff --git a/gr-dtv/grc/dtv_atsc_deinterleaver.block.yml b/gr-dtv/grc/dtv_atsc_deinterleaver.block.yml
new file mode 100644
index 000000000..538480977
--- /dev/null
+++ b/gr-dtv/grc/dtv_atsc_deinterleaver.block.yml
@@ -0,0 +1,18 @@
+id: dtv_atsc_deinterleaver
+label: ATSC Deinterleaver
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: 256
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: 256
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.atsc_deinterleaver()
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_atsc_deinterleaver.xml b/gr-dtv/grc/dtv_atsc_deinterleaver.xml
deleted file mode 100644
index 051ea7755..000000000
--- a/gr-dtv/grc/dtv_atsc_deinterleaver.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## ATSC Deinterleaver
-###################################################
- -->
-<block>
- <name>ATSC Deinterleaver</name>
- <key>dtv_atsc_deinterleaver</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.atsc_deinterleaver()</make>
-
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>256</vlen>
- </sink>
-
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>256</vlen>
- </source>
-
-</block>
diff --git a/gr-dtv/grc/dtv_atsc_depad.block.yml b/gr-dtv/grc/dtv_atsc_depad.block.yml
new file mode 100644
index 000000000..463de2018
--- /dev/null
+++ b/gr-dtv/grc/dtv_atsc_depad.block.yml
@@ -0,0 +1,17 @@
+id: dtv_atsc_depad
+label: ATSC Depad
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: 256
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.atsc_depad()
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_atsc_depad.xml b/gr-dtv/grc/dtv_atsc_depad.xml
deleted file mode 100644
index 95a138091..000000000
--- a/gr-dtv/grc/dtv_atsc_depad.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## ATSC Depad
-###################################################
- -->
-<block>
- <name>ATSC Depad</name>
- <key>dtv_atsc_depad</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.atsc_depad()</make>
-
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>256</vlen>
- </sink>
-
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-
-</block>
diff --git a/gr-dtv/grc/dtv_atsc_derandomizer.block.yml b/gr-dtv/grc/dtv_atsc_derandomizer.block.yml
new file mode 100644
index 000000000..c64e7032f
--- /dev/null
+++ b/gr-dtv/grc/dtv_atsc_derandomizer.block.yml
@@ -0,0 +1,18 @@
+id: dtv_atsc_derandomizer
+label: ATSC Derandomizer
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: 256
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: 256
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.atsc_derandomizer()
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_atsc_derandomizer.xml b/gr-dtv/grc/dtv_atsc_derandomizer.xml
deleted file mode 100644
index 5473f47e8..000000000
--- a/gr-dtv/grc/dtv_atsc_derandomizer.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## ATSC Derandomizer
-###################################################
- -->
-<block>
- <name>ATSC Derandomizer</name>
- <key>dtv_atsc_derandomizer</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.atsc_derandomizer()</make>
-
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>256</vlen>
- </sink>
-
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>256</vlen>
- </source>
-
-</block>
diff --git a/gr-dtv/grc/dtv_atsc_equalizer.block.yml b/gr-dtv/grc/dtv_atsc_equalizer.block.yml
new file mode 100644
index 000000000..e6b5b3c03
--- /dev/null
+++ b/gr-dtv/grc/dtv_atsc_equalizer.block.yml
@@ -0,0 +1,18 @@
+id: dtv_atsc_equalizer
+label: ATSC Equalizer
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: 4096
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: 4096
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.atsc_equalizer()
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_atsc_equalizer.xml b/gr-dtv/grc/dtv_atsc_equalizer.xml
deleted file mode 100644
index 7faf65fd2..000000000
--- a/gr-dtv/grc/dtv_atsc_equalizer.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## ATSC Equalizer
-###################################################
- -->
-<block>
- <name>ATSC Equalizer</name>
- <key>dtv_atsc_equalizer</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.atsc_equalizer()</make>
-
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>4096</vlen>
- </sink>
-
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>4096</vlen>
- </source>
-
-</block>
diff --git a/gr-dtv/grc/dtv_atsc_field_sync_mux.block.yml b/gr-dtv/grc/dtv_atsc_field_sync_mux.block.yml
new file mode 100644
index 000000000..767d56d5d
--- /dev/null
+++ b/gr-dtv/grc/dtv_atsc_field_sync_mux.block.yml
@@ -0,0 +1,18 @@
+id: dtv_atsc_field_sync_mux
+label: ATSC Field Sync Mux
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: 256
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: 1024
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.atsc_field_sync_mux()
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_atsc_field_sync_mux.xml b/gr-dtv/grc/dtv_atsc_field_sync_mux.xml
deleted file mode 100644
index 0037a9340..000000000
--- a/gr-dtv/grc/dtv_atsc_field_sync_mux.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## ATSC Field Sync Mux
-###################################################
- -->
-<block>
- <name>ATSC Field Sync Mux</name>
- <key>dtv_atsc_field_sync_mux</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.atsc_field_sync_mux()</make>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>256</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>1024</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_atsc_fpll.block.yml b/gr-dtv/grc/dtv_atsc_fpll.block.yml
new file mode 100644
index 000000000..39568a853
--- /dev/null
+++ b/gr-dtv/grc/dtv_atsc_fpll.block.yml
@@ -0,0 +1,21 @@
+id: dtv_atsc_fpll
+label: ATSC Receiver FPLL
+
+parameters:
+- id: rate
+ label: Sample Rate
+ dtype: float
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.atsc_fpll(${rate})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_atsc_fpll.xml b/gr-dtv/grc/dtv_atsc_fpll.xml
deleted file mode 100644
index 00d28ce8b..000000000
--- a/gr-dtv/grc/dtv_atsc_fpll.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## ATSC Receiver PLL
-###################################################
- -->
-<block>
- <name>ATSC Receiver FPLL</name>
- <key>dtv_atsc_fpll</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.atsc_fpll($rate)</make>
-
- <param>
- <name>Sample Rate</name>
- <key>rate</key>
- <type>float</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-
-</block>
diff --git a/gr-dtv/grc/dtv_atsc_fs_checker.block.yml b/gr-dtv/grc/dtv_atsc_fs_checker.block.yml
new file mode 100644
index 000000000..fbf97a925
--- /dev/null
+++ b/gr-dtv/grc/dtv_atsc_fs_checker.block.yml
@@ -0,0 +1,18 @@
+id: dtv_atsc_fs_checker
+label: ATSC Field Sync Checker
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: 4096
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: 4096
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.atsc_fs_checker()
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_atsc_fs_checker.xml b/gr-dtv/grc/dtv_atsc_fs_checker.xml
deleted file mode 100644
index 4c733d53b..000000000
--- a/gr-dtv/grc/dtv_atsc_fs_checker.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## ATSC Field Sync Checker
-###################################################
- -->
-<block>
- <name>ATSC Field Sync Checker</name>
- <key>dtv_atsc_fs_checker</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.atsc_fs_checker()</make>
-
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>4096</vlen>
- </sink>
-
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>4096</vlen>
- </source>
-
-</block>
diff --git a/gr-dtv/grc/dtv_atsc_interleaver.block.yml b/gr-dtv/grc/dtv_atsc_interleaver.block.yml
new file mode 100644
index 000000000..65f769d0e
--- /dev/null
+++ b/gr-dtv/grc/dtv_atsc_interleaver.block.yml
@@ -0,0 +1,18 @@
+id: dtv_atsc_interleaver
+label: ATSC Interleaver
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: 256
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: 256
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.atsc_interleaver()
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_atsc_interleaver.xml b/gr-dtv/grc/dtv_atsc_interleaver.xml
deleted file mode 100644
index 3b1045c58..000000000
--- a/gr-dtv/grc/dtv_atsc_interleaver.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## ATSC Interleaver
-###################################################
- -->
-<block>
- <name>ATSC Interleaver</name>
- <key>dtv_atsc_interleaver</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.atsc_interleaver()</make>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>256</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>256</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_atsc_pad.block.yml b/gr-dtv/grc/dtv_atsc_pad.block.yml
new file mode 100644
index 000000000..a25d866f7
--- /dev/null
+++ b/gr-dtv/grc/dtv_atsc_pad.block.yml
@@ -0,0 +1,17 @@
+id: dtv_atsc_pad
+label: ATSC Pad
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: 256
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.atsc_pad()
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_atsc_pad.xml b/gr-dtv/grc/dtv_atsc_pad.xml
deleted file mode 100644
index 87b8921e3..000000000
--- a/gr-dtv/grc/dtv_atsc_pad.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## ATSC Pad
-###################################################
- -->
-<block>
- <name>ATSC Pad</name>
- <key>dtv_atsc_pad</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.atsc_pad()</make>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>256</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_atsc_randomizer.block.yml b/gr-dtv/grc/dtv_atsc_randomizer.block.yml
new file mode 100644
index 000000000..909fad6ec
--- /dev/null
+++ b/gr-dtv/grc/dtv_atsc_randomizer.block.yml
@@ -0,0 +1,18 @@
+id: dtv_atsc_randomizer
+label: ATSC Randomizer
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: 256
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: 256
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.atsc_randomizer()
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_atsc_randomizer.xml b/gr-dtv/grc/dtv_atsc_randomizer.xml
deleted file mode 100644
index 73c0991e1..000000000
--- a/gr-dtv/grc/dtv_atsc_randomizer.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## ATSC Randomizer
-###################################################
- -->
-<block>
- <name>ATSC Randomizer</name>
- <key>dtv_atsc_randomizer</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.atsc_randomizer()</make>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>256</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>256</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_atsc_rs_decoder.block.yml b/gr-dtv/grc/dtv_atsc_rs_decoder.block.yml
new file mode 100644
index 000000000..b65eb33fc
--- /dev/null
+++ b/gr-dtv/grc/dtv_atsc_rs_decoder.block.yml
@@ -0,0 +1,18 @@
+id: dtv_atsc_rs_decoder
+label: "ATSC Reed\u2013Solomon Decoder"
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: 256
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: 256
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.atsc_rs_decoder()
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_atsc_rs_decoder.xml b/gr-dtv/grc/dtv_atsc_rs_decoder.xml
deleted file mode 100644
index 18a3053f0..000000000
--- a/gr-dtv/grc/dtv_atsc_rs_decoder.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## ATSC Reed–Solomon Decoder
-###################################################
- -->
-<block>
- <name>ATSC Reed–Solomon Decoder</name>
- <key>dtv_atsc_rs_decoder</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.atsc_rs_decoder()</make>
-
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>256</vlen>
- </sink>
-
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>256</vlen>
- </source>
-
-</block>
diff --git a/gr-dtv/grc/dtv_atsc_rs_encoder.block.yml b/gr-dtv/grc/dtv_atsc_rs_encoder.block.yml
new file mode 100644
index 000000000..04d1ff368
--- /dev/null
+++ b/gr-dtv/grc/dtv_atsc_rs_encoder.block.yml
@@ -0,0 +1,18 @@
+id: dtv_atsc_rs_encoder
+label: ATSC RS Encoder
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: 256
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: 256
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.atsc_rs_encoder()
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_atsc_rs_encoder.xml b/gr-dtv/grc/dtv_atsc_rs_encoder.xml
deleted file mode 100644
index af35523e0..000000000
--- a/gr-dtv/grc/dtv_atsc_rs_encoder.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## ATSC Reed-Solomom Encoder
-###################################################
- -->
-<block>
- <name>ATSC RS Encoder</name>
- <key>dtv_atsc_rs_encoder</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.atsc_rs_encoder()</make>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>256</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>256</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_atsc_rx.block.yml b/gr-dtv/grc/dtv_atsc_rx.block.yml
new file mode 100644
index 000000000..499c196e2
--- /dev/null
+++ b/gr-dtv/grc/dtv_atsc_rx.block.yml
@@ -0,0 +1,24 @@
+id: dtv_atsc_rx
+label: ATSC Receive Pipeline
+
+parameters:
+- id: rate
+ label: Input Rate
+ dtype: float
+- id: sps
+ label: Oversampling Ratio
+ dtype: float
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.atsc_rx(${rate},${sps})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_atsc_rx.xml b/gr-dtv/grc/dtv_atsc_rx.xml
deleted file mode 100644
index 900769609..000000000
--- a/gr-dtv/grc/dtv_atsc_rx.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## ATSC Receive Pipeline
-###################################################
- -->
-<block>
- <name>ATSC Receive Pipeline</name>
- <key>dtv_atsc_rx</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.atsc_rx($rate,$sps)</make>
-
- <param>
- <name>Input Rate</name>
- <key>rate</key>
- <type>float</type>
- </param>
-
- <param>
- <name>Oversampling Ratio</name>
- <key>sps</key>
- <type>float</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-
-</block>
diff --git a/gr-dtv/grc/dtv_atsc_rx_filter.block.yml b/gr-dtv/grc/dtv_atsc_rx_filter.block.yml
new file mode 100644
index 000000000..0a352727c
--- /dev/null
+++ b/gr-dtv/grc/dtv_atsc_rx_filter.block.yml
@@ -0,0 +1,24 @@
+id: dtv_atsc_rx_filter
+label: ATSC RX Filter
+
+parameters:
+- id: rate
+ label: Input Rate
+ dtype: float
+- id: sps
+ label: Oversampling Ratio
+ dtype: float
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.atsc_rx_filter(${rate},${sps})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_atsc_rx_filter.xml b/gr-dtv/grc/dtv_atsc_rx_filter.xml
deleted file mode 100644
index bc8bf0914..000000000
--- a/gr-dtv/grc/dtv_atsc_rx_filter.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## ATSC RX Filter
-###################################################
- -->
-<block>
- <name>ATSC RX Filter</name>
- <key>dtv_atsc_rx_filter</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.atsc_rx_filter($rate,$sps)</make>
-
- <param>
- <name>Input Rate</name>
- <key>rate</key>
- <type>float</type>
- </param>
-
- <param>
- <name>Oversampling Ratio</name>
- <key>sps</key>
- <type>float</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-
-</block>
diff --git a/gr-dtv/grc/dtv_atsc_sync.block.yml b/gr-dtv/grc/dtv_atsc_sync.block.yml
new file mode 100644
index 000000000..b4a3ac3d9
--- /dev/null
+++ b/gr-dtv/grc/dtv_atsc_sync.block.yml
@@ -0,0 +1,22 @@
+id: dtv_atsc_sync
+label: ATSC Receiver SYNC
+
+parameters:
+- id: rate
+ label: Sample Rate
+ dtype: float
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: 4096
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.atsc_sync(${rate})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_atsc_sync.xml b/gr-dtv/grc/dtv_atsc_sync.xml
deleted file mode 100644
index a9528f84a..000000000
--- a/gr-dtv/grc/dtv_atsc_sync.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## ATSC Receiver Sync
-###################################################
- -->
-<block>
- <name>ATSC Receiver SYNC</name>
- <key>dtv_atsc_sync</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.atsc_sync($rate)</make>
-
- <param>
- <name>Sample Rate</name>
- <key>rate</key>
- <type>float</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>4096</vlen>
- </source>
-
-</block>
diff --git a/gr-dtv/grc/dtv_atsc_trellis_encoder.block.yml b/gr-dtv/grc/dtv_atsc_trellis_encoder.block.yml
new file mode 100644
index 000000000..417e3f19d
--- /dev/null
+++ b/gr-dtv/grc/dtv_atsc_trellis_encoder.block.yml
@@ -0,0 +1,18 @@
+id: dtv_atsc_trellis_encoder
+label: ATSC Trellis Encoder
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: 256
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: 256
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.atsc_trellis_encoder()
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_atsc_trellis_encoder.xml b/gr-dtv/grc/dtv_atsc_trellis_encoder.xml
deleted file mode 100644
index 218907500..000000000
--- a/gr-dtv/grc/dtv_atsc_trellis_encoder.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## ATSC Trellis Encoder
-###################################################
- -->
-<block>
- <name>ATSC Trellis Encoder</name>
- <key>dtv_atsc_trellis_encoder</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.atsc_trellis_encoder()</make>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>256</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>256</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_atsc_viterbi_decoder.block.yml b/gr-dtv/grc/dtv_atsc_viterbi_decoder.block.yml
new file mode 100644
index 000000000..bb77b072b
--- /dev/null
+++ b/gr-dtv/grc/dtv_atsc_viterbi_decoder.block.yml
@@ -0,0 +1,18 @@
+id: dtv_atsc_viterbi_decoder
+label: ATSC Viterbi Decoder
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: 4096
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: 256
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.atsc_viterbi_decoder()
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_atsc_viterbi_decoder.xml b/gr-dtv/grc/dtv_atsc_viterbi_decoder.xml
deleted file mode 100644
index 23d58d08a..000000000
--- a/gr-dtv/grc/dtv_atsc_viterbi_decoder.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## ATSC Equalizer
-###################################################
- -->
-<block>
- <name>ATSC Viterbi Decoder</name>
- <key>dtv_atsc_viterbi_decoder</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.atsc_viterbi_decoder()</make>
-
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>4096</vlen>
- </sink>
-
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>256</vlen>
- </source>
-
-</block>
diff --git a/gr-dtv/grc/dtv_block_tree.xml b/gr-dtv/grc/dtv_block_tree.xml
deleted file mode 100644
index 8dcbd1812..000000000
--- a/gr-dtv/grc/dtv_block_tree.xml
+++ /dev/null
@@ -1,106 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2014,2015,2016 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##Block Tree for GR DTV blocks.
-###################################################
- -->
-<cat>
- <name>[Core]</name>
- <cat>
- <name>Digital Television</name>
- <cat>
- <name>ATSC</name>
- <block>dtv_atsc_deinterleaver</block>
- <block>dtv_atsc_depad</block>
- <block>dtv_atsc_derandomizer</block>
- <block>dtv_atsc_equalizer</block>
- <block>dtv_atsc_fpll</block>
- <block>dtv_atsc_fs_checker</block>
- <block>dtv_atsc_rs_decoder</block>
- <block>dtv_atsc_rx</block>
- <block>dtv_atsc_rx_filter</block>
- <block>dtv_atsc_sync</block>
- <block>dtv_atsc_viterbi_decoder</block>
- <block>dtv_atsc_pad</block>
- <block>dtv_atsc_randomizer</block>
- <block>dtv_atsc_rs_encoder</block>
- <block>dtv_atsc_interleaver</block>
- <block>dtv_atsc_trellis_encoder</block>
- <block>dtv_atsc_field_sync_mux</block>
- </cat>
- <cat>
- <name>DVB</name>
- <block>dtv_dvb_bbheader_bb</block>
- <block>dtv_dvb_bbscrambler_bb</block>
- <block>dtv_dvb_bch_bb</block>
- <block>dtv_dvb_ldpc_bb</block>
- </cat>
- <cat>
- <name>DVB-T2</name>
- <block>dtv_dvbt2_interleaver_bb</block>
- <block>dtv_dvbt2_modulator_bc</block>
- <block>dtv_dvbt2_cellinterleaver_cc</block>
- <block>dtv_dvbt2_framemapper_cc</block>
- <block>dtv_dvbt2_freqinterleaver_cc</block>
- <block>dtv_dvbt2_pilotgenerator_cc</block>
- <block>dtv_dvbt2_paprtr_cc</block>
- <block>dtv_dvbt2_p1insertion_cc</block>
- <block>dtv_dvbt2_miso_cc</block>
- </cat>
- <cat>
- <name>DVB-S2</name>
- <block>dtv_dvbs2_interleaver_bb</block>
- <block>dtv_dvbs2_modulator_bc</block>
- <block>dtv_dvbs2_physical_cc</block>
- </cat>
- <cat>
- <name>DVB-T</name>
- <block>dtv_dvbt_energy_dispersal</block>
- <block>dtv_dvbt_reed_solomon_enc</block>
- <block>dtv_dvbt_convolutional_interleaver</block>
- <block>dtv_dvbt_inner_coder</block>
- <block>dtv_dvbt_bit_inner_interleaver</block>
- <block>dtv_dvbt_symbol_inner_interleaver</block>
- <block>dtv_dvbt_map</block>
- <block>dtv_dvbt_reference_signals</block>
- <block>dtv_dvbt_ofdm_sym_acquisition</block>
- <block>dtv_dvbt_demod_reference_signals</block>
- <block>dtv_dvbt_demap</block>
- <block>dtv_dvbt_bit_inner_deinterleaver</block>
- <block>dtv_dvbt_viterbi_decoder</block>
- <block>dtv_dvbt_convolutional_deinterleaver</block>
- <block>dtv_dvbt_reed_solomon_dec</block>
- <block>dtv_dvbt_energy_descramble</block>
- </cat>
- <cat>
- <name>ITU-T J.83B</name>
- <block>dtv_catv_transport_framing_enc_bb</block>
- <block>dtv_catv_reed_solomon_enc_bb</block>
- <block>dtv_catv_randomizer_bb</block>
- <block>dtv_catv_frame_sync_enc_bb</block>
- <block>dtv_catv_trellis_enc_bb</block>
- </cat>
- </cat>
-</cat>
diff --git a/gr-dtv/grc/dtv_catv_frame_sync_enc_bb.block.yml b/gr-dtv/grc/dtv_catv_frame_sync_enc_bb.block.yml
new file mode 100644
index 000000000..d629a1669
--- /dev/null
+++ b/gr-dtv/grc/dtv_catv_frame_sync_enc_bb.block.yml
@@ -0,0 +1,29 @@
+id: dtv_catv_frame_sync_enc_bb
+label: Frame Sync Encoder
+
+parameters:
+- id: constellation
+ label: Constellation
+ dtype: enum
+ options: [CATV_MOD_64QAM, CATV_MOD_256QAM]
+ option_labels: [64QAM, 256QAM]
+ option_attributes:
+ val: [dtv.CATV_MOD_64QAM, dtv.CATV_MOD_256QAM]
+- id: ctrlword
+ label: Control Word
+ dtype: int
+ default: '6'
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.catv_frame_sync_enc_bb(${constellation.val}, ${ctrlword})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_catv_frame_sync_enc_bb.xml b/gr-dtv/grc/dtv_catv_frame_sync_enc_bb.xml
deleted file mode 100644
index 11f05164b..000000000
--- a/gr-dtv/grc/dtv_catv_frame_sync_enc_bb.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Frame Sync Encoder
-###################################################
- -->
-<block>
- <name>Frame Sync Encoder</name>
- <key>dtv_catv_frame_sync_enc_bb</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.catv_frame_sync_enc_bb($constellation.val, $ctrlword)</make>
- <param>
- <name>Constellation</name>
- <key>constellation</key>
- <type>enum</type>
- <option>
- <name>64QAM</name>
- <key>CATV_MOD_64QAM</key>
- <opt>val:dtv.CATV_MOD_64QAM</opt>
- </option>
- <option>
- <name>256QAM</name>
- <key>CATV_MOD_256QAM</key>
- <opt>val:dtv.CATV_MOD_256QAM</opt>
- </option>
- </param>
- <param>
- <name>Control Word</name>
- <key>ctrlword</key>
- <value>6</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_catv_randomizer_bb.block.yml b/gr-dtv/grc/dtv_catv_randomizer_bb.block.yml
new file mode 100644
index 000000000..1be423454
--- /dev/null
+++ b/gr-dtv/grc/dtv_catv_randomizer_bb.block.yml
@@ -0,0 +1,25 @@
+id: dtv_catv_randomizer_bb
+label: Randomizer
+
+parameters:
+- id: constellation
+ label: Constellation
+ dtype: enum
+ options: [CATV_MOD_64QAM, CATV_MOD_256QAM]
+ option_labels: [64QAM, 256QAM]
+ option_attributes:
+ val: [dtv.CATV_MOD_64QAM, dtv.CATV_MOD_256QAM]
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.catv_randomizer_bb(${constellation.val})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_catv_randomizer_bb.xml b/gr-dtv/grc/dtv_catv_randomizer_bb.xml
deleted file mode 100644
index d0da5a251..000000000
--- a/gr-dtv/grc/dtv_catv_randomizer_bb.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Randomizer
-###################################################
- -->
-<block>
- <name>Randomizer</name>
- <key>dtv_catv_randomizer_bb</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.catv_randomizer_bb($constellation.val)</make>
- <param>
- <name>Constellation</name>
- <key>constellation</key>
- <type>enum</type>
- <option>
- <name>64QAM</name>
- <key>CATV_MOD_64QAM</key>
- <opt>val:dtv.CATV_MOD_64QAM</opt>
- </option>
- <option>
- <name>256QAM</name>
- <key>CATV_MOD_256QAM</key>
- <opt>val:dtv.CATV_MOD_256QAM</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_catv_reed_solomon_enc_bb.block.yml b/gr-dtv/grc/dtv_catv_reed_solomon_enc_bb.block.yml
new file mode 100644
index 000000000..fa51b3bab
--- /dev/null
+++ b/gr-dtv/grc/dtv_catv_reed_solomon_enc_bb.block.yml
@@ -0,0 +1,16 @@
+id: dtv_catv_reed_solomon_enc_bb
+label: Reed-Solomon Encoder
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.catv_reed_solomon_enc_bb()
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_catv_reed_solomon_enc_bb.xml b/gr-dtv/grc/dtv_catv_reed_solomon_enc_bb.xml
deleted file mode 100644
index a5dfdc2a5..000000000
--- a/gr-dtv/grc/dtv_catv_reed_solomon_enc_bb.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Reed Solomon Encoder
-###################################################
- -->
-<block>
- <name>Reed-Solomon Encoder</name>
- <key>dtv_catv_reed_solomon_enc_bb</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.catv_reed_solomon_enc_bb()</make>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_catv_transport_framing_enc_bb.block.yml b/gr-dtv/grc/dtv_catv_transport_framing_enc_bb.block.yml
new file mode 100644
index 000000000..3f269d170
--- /dev/null
+++ b/gr-dtv/grc/dtv_catv_transport_framing_enc_bb.block.yml
@@ -0,0 +1,16 @@
+id: dtv_catv_transport_framing_enc_bb
+label: Transport Framing Encoder
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.catv_transport_framing_enc_bb()
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_catv_transport_framing_enc_bb.xml b/gr-dtv/grc/dtv_catv_transport_framing_enc_bb.xml
deleted file mode 100644
index d0b6bf382..000000000
--- a/gr-dtv/grc/dtv_catv_transport_framing_enc_bb.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Transport Framing Encoder
-###################################################
- -->
-<block>
- <name>Transport Framing Encoder</name>
- <key>dtv_catv_transport_framing_enc_bb</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.catv_transport_framing_enc_bb()</make>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_catv_trellis_enc_bb.block.yml b/gr-dtv/grc/dtv_catv_trellis_enc_bb.block.yml
new file mode 100644
index 000000000..aafba8ed2
--- /dev/null
+++ b/gr-dtv/grc/dtv_catv_trellis_enc_bb.block.yml
@@ -0,0 +1,25 @@
+id: dtv_catv_trellis_enc_bb
+label: Trellis Encoder
+
+parameters:
+- id: constellation
+ label: Constellation
+ dtype: enum
+ options: [CATV_MOD_64QAM, CATV_MOD_256QAM]
+ option_labels: [64QAM, 256QAM]
+ option_attributes:
+ val: [dtv.CATV_MOD_64QAM, dtv.CATV_MOD_256QAM]
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.catv_trellis_enc_bb(${constellation.val})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_catv_trellis_enc_bb.xml b/gr-dtv/grc/dtv_catv_trellis_enc_bb.xml
deleted file mode 100644
index a1d2d4619..000000000
--- a/gr-dtv/grc/dtv_catv_trellis_enc_bb.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Trellis Encoder
-###################################################
- -->
-<block>
- <name>Trellis Encoder</name>
- <key>dtv_catv_trellis_enc_bb</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.catv_trellis_enc_bb($constellation.val)</make>
- <param>
- <name>Constellation</name>
- <key>constellation</key>
- <type>enum</type>
- <option>
- <name>64QAM</name>
- <key>CATV_MOD_64QAM</key>
- <opt>val:dtv.CATV_MOD_64QAM</opt>
- </option>
- <option>
- <name>256QAM</name>
- <key>CATV_MOD_256QAM</key>
- <opt>val:dtv.CATV_MOD_256QAM</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvb_bbheader_bb.block.yml b/gr-dtv/grc/dtv_dvb_bbheader_bb.block.yml
new file mode 100644
index 000000000..7f51427af
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvb_bbheader_bb.block.yml
@@ -0,0 +1,154 @@
+id: dtv_dvb_bbheader_bb
+label: BBheader
+
+parameters:
+- id: standard
+ label: Standard
+ dtype: enum
+ options: [STANDARD_DVBS2, STANDARD_DVBT2]
+ option_labels: [DVB-S2, DVB-T2]
+ option_attributes:
+ hide_dvbs2: ['', all]
+ hide_dvbt2: [all, '']
+ val: [dtv.STANDARD_DVBS2, dtv.STANDARD_DVBT2]
+- id: framesize1
+ label: FECFRAME size
+ dtype: enum
+ options: [FECFRAME_NORMAL, FECFRAME_SHORT]
+ option_labels: [Normal, Short]
+ option_attributes:
+ hide_medium: [all, all]
+ hide_normal: ['', all]
+ hide_short: [all, '']
+ val: [dtv.FECFRAME_NORMAL, dtv.FECFRAME_SHORT]
+ hide: ${ standard.hide_dvbt2 }
+- id: framesize2
+ label: FECFRAME size
+ dtype: enum
+ options: [FECFRAME_NORMAL, FECFRAME_MEDIUM, FECFRAME_SHORT]
+ option_labels: [Normal, Medium, Short]
+ option_attributes:
+ hide_medium: [all, '', all]
+ hide_normal: ['', all, all]
+ hide_short: [all, all, '']
+ val: [dtv.FECFRAME_NORMAL, dtv.FECFRAME_MEDIUM, dtv.FECFRAME_SHORT]
+ hide: ${ standard.hide_dvbs2 }
+- id: rate1
+ label: Code rate
+ dtype: enum
+ options: [C1_2, C3_5, C2_3, C3_4, C4_5, C5_6]
+ option_labels: [1/2, 3/5, 2/3, 3/4, 4/5, 5/6]
+ option_attributes:
+ val: [dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4, dtv.C4_5, dtv.C5_6]
+ hide: ${ (framesize1.hide_normal if str(standard) == 'STANDARD_DVBT2' else 'all')
+ }
+- id: rate2
+ label: Code rate
+ dtype: enum
+ options: [C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6]
+ option_labels: [1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6]
+ option_attributes:
+ val: [dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4, dtv.C4_5,
+ dtv.C5_6]
+ hide: ${ (framesize1.hide_short if str(standard) == 'STANDARD_DVBT2' else 'all')
+ }
+- id: rate3
+ label: Code rate
+ dtype: enum
+ options: [C1_4, C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6, C8_9, C9_10, C2_9_VLSNR,
+ C13_45, C9_20, C90_180, C96_180, C11_20, C100_180, C104_180, C26_45, C18_30,
+ C28_45, C23_36, C116_180, C20_30, C124_180, C25_36, C128_180, C13_18, C132_180,
+ C22_30, C135_180, C140_180, C7_9, C154_180]
+ option_labels: [1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6, 8/9, 9/10, 2/9 VL-SNR,
+ 13/45, 9/20, 90/180, 96/180, 11/20, 100/180, 104/180, 26/45, 18/30, 28/45,
+ 23/36, 116/180, 20/30, 124/180, 25/36, 128/180, 13/18, 132/180, 22/30, 135/180,
+ 140/180, 7/9, 154/180]
+ option_attributes:
+ val: [dtv.C1_4, dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4,
+ dtv.C4_5, dtv.C5_6, dtv.C8_9, dtv.C9_10, dtv.C2_9_VLSNR, dtv.C13_45, dtv.C9_20,
+ dtv.C90_180, dtv.C96_180, dtv.C11_20, dtv.C100_180, dtv.C104_180, dtv.C26_45,
+ dtv.C18_30, dtv.C28_45, dtv.C23_36, dtv.C116_180, dtv.C20_30, dtv.C124_180,
+ dtv.C25_36, dtv.C128_180, dtv.C13_18, dtv.C132_180, dtv.C22_30, dtv.C135_180,
+ dtv.C140_180, dtv.C7_9, dtv.C154_180]
+ hide: ${ (framesize2.hide_normal if str(standard) == 'STANDARD_DVBS2' else 'all')
+ }
+- id: rate4
+ label: Code rate
+ dtype: enum
+ options: [C1_5_MEDIUM, C11_45_MEDIUM, C1_3_MEDIUM]
+ option_labels: [1/5, 11/45, 1/3]
+ option_attributes:
+ val: [dtv.C1_5_MEDIUM, dtv.C11_45_MEDIUM, dtv.C1_3_MEDIUM]
+ hide: ${ (framesize2.hide_medium if str(standard) == 'STANDARD_DVBS2' else 'all')
+ }
+- id: rate5
+ label: Code rate
+ dtype: enum
+ options: [C1_4, C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6, C8_9, C11_45,
+ C4_15, C14_45, C7_15, C8_15, C26_45, C32_45, C1_5_VLSNR_SF2, C11_45_VLSNR_SF2,
+ C1_5_VLSNR, C4_15_VLSNR, C1_3_VLSNR]
+ option_labels: [1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6, 8/9, 11/45, 4/15,
+ 14/45, 7/15, 8/15, 26/45, 32/45, 1/5 VL-SNR SF2, 11/45 VL-SNR SF2, 1/5 VL-SNR,
+ 4/15 VL-SNR, 1/3 VL-SNR]
+ option_attributes:
+ val: [dtv.C1_4, dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4,
+ dtv.C4_5, dtv.C5_6, dtv.C8_9, dtv.C11_45, dtv.C4_15, dtv.C14_45, dtv.C7_15,
+ dtv.C8_15, dtv.C26_45, dtv.C32_45, dtv.C1_5_VLSNR_SF2, dtv.C11_45_VLSNR_SF2,
+ dtv.C1_5_VLSNR, dtv.C4_15_VLSNR, dtv.C1_3_VLSNR]
+ hide: ${ (framesize2.hide_short if str(standard) == 'STANDARD_DVBS2' else 'all')
+ }
+- id: rolloff
+ label: Rolloff factor
+ dtype: enum
+ options: [RO_0_35, RO_0_25, RO_0_20, RO_0_15, RO_0_10, RO_0_05]
+ option_labels: ['0.35', '0.25', '0.20', '0.15', '0.10', '0.05']
+ option_attributes:
+ val: [dtv.RO_0_35, dtv.RO_0_25, dtv.RO_0_20, dtv.RO_0_15, dtv.RO_0_10, dtv.RO_0_05]
+ hide: ${ standard.hide_dvbs2 }
+- id: mode
+ label: Baseband Framing Mode
+ dtype: enum
+ options: [INPUTMODE_NORMAL, INPUTMODE_HIEFF]
+ option_labels: [Normal, High Efficiency]
+ option_attributes:
+ val: [dtv.INPUTMODE_NORMAL, dtv.INPUTMODE_HIEFF]
+ hide: ${ standard.hide_dvbt2 }
+- id: inband
+ label: In-band Signalling
+ dtype: enum
+ options: [INBAND_OFF, INBAND_ON]
+ option_labels: ['Off', Type B]
+ option_attributes:
+ hide_rate: [all, '']
+ val: [dtv.INBAND_OFF, dtv.INBAND_ON]
+ hide: ${ standard.hide_dvbt2 }
+- id: fecblocks
+ label: FEC blocks per frame
+ dtype: int
+ default: '168'
+ hide: ${ inband.hide_rate }
+- id: tsrate
+ label: Transport Stream Rate
+ dtype: int
+ default: '4000000'
+ hide: ${ inband.hide_rate }
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import dtv
+ make: "dtv.dvb_bbheader_bb(${standard.val}, \n% if str(standard) == 'STANDARD_DVBT2':\n\
+ ${framesize1.val}, \n% else:\n${framesize2.val}, \n% endif\n% if str(standard)\
+ \ == 'STANDARD_DVBT2':\n% if str(framesize1) == 'FECFRAME_NORMAL':\n${rate1.val},\
+ \ \n% else:\n${rate2.val}, \n% endif\n% else:\n% if str(framesize2) == 'FECFRAME_NORMAL':\n\
+ ${rate3.val}, \n% elif str(framesize2) == 'FECFRAME_MEDIUM':\n${rate4.val},\
+ \ \n% else:\n${rate5.val}, \n% endif\n% endif\n${rolloff.val}, ${mode.val},\
+ \ ${inband.val}, ${fecblocks}, ${tsrate})"
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvb_bbheader_bb.xml b/gr-dtv/grc/dtv_dvb_bbheader_bb.xml
deleted file mode 100644
index b18b87b60..000000000
--- a/gr-dtv/grc/dtv_dvb_bbheader_bb.xml
+++ /dev/null
@@ -1,596 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB Baseband Header
-###################################################
- -->
-<block>
- <name>BBheader</name>
- <key>dtv_dvb_bbheader_bb</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvb_bbheader_bb($standard.val, #slurp
-#if str($standard) == 'STANDARD_DVBT2'
-$framesize1.val, #slurp
-#else
-$framesize2.val, #slurp
-#end if
-#if str($standard) == 'STANDARD_DVBT2'
-#if str($framesize1) == 'FECFRAME_NORMAL'
-$rate1.val, #slurp
-#else
-$rate2.val, #slurp
-#end if
-#else
-#if str($framesize2) == 'FECFRAME_NORMAL'
-$rate3.val, #slurp
-#else if str($framesize2) == 'FECFRAME_MEDIUM'
-$rate4.val, #slurp
-#else
-$rate5.val, #slurp
-#end if
-#end if
-$rolloff.val, $mode.val, $inband.val, $fecblocks, $tsrate)</make>
- <param>
- <name>Standard</name>
- <key>standard</key>
- <type>enum</type>
- <option>
- <name>DVB-S2</name>
- <key>STANDARD_DVBS2</key>
- <opt>val:dtv.STANDARD_DVBS2</opt>
- <opt>hide_dvbs2:</opt>
- <opt>hide_dvbt2:all</opt>
- </option>
- <option>
- <name>DVB-T2</name>
- <key>STANDARD_DVBT2</key>
- <opt>val:dtv.STANDARD_DVBT2</opt>
- <opt>hide_dvbs2:all</opt>
- <opt>hide_dvbt2:</opt>
- </option>
- </param>
- <param>
- <name>FECFRAME size</name>
- <key>framesize1</key>
- <type>enum</type>
- <hide>$standard.hide_dvbt2</hide>
- <option>
- <name>Normal</name>
- <key>FECFRAME_NORMAL</key>
- <opt>val:dtv.FECFRAME_NORMAL</opt>
- <opt>hide_normal:</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:all</opt>
- </option>
- <option>
- <name>Short</name>
- <key>FECFRAME_SHORT</key>
- <opt>val:dtv.FECFRAME_SHORT</opt>
- <opt>hide_normal:all</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:</opt>
- </option>
- </param>
- <param>
- <name>FECFRAME size</name>
- <key>framesize2</key>
- <type>enum</type>
- <hide>$standard.hide_dvbs2</hide>
- <option>
- <name>Normal</name>
- <key>FECFRAME_NORMAL</key>
- <opt>val:dtv.FECFRAME_NORMAL</opt>
- <opt>hide_normal:</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:all</opt>
- </option>
- <option>
- <name>Medium</name>
- <key>FECFRAME_MEDIUM</key>
- <opt>val:dtv.FECFRAME_MEDIUM</opt>
- <opt>hide_normal:all</opt>
- <opt>hide_medium:</opt>
- <opt>hide_short:all</opt>
- </option>
- <option>
- <name>Short</name>
- <key>FECFRAME_SHORT</key>
- <opt>val:dtv.FECFRAME_SHORT</opt>
- <opt>hide_normal:all</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate1</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBT2' then $framesize1.hide_normal else 'all'</hide>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate2</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBT2' then $framesize1.hide_short else 'all'</hide>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate3</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBS2' then $framesize2.hide_normal else 'all'</hide>
- <option>
- <name>1/4</name>
- <key>C1_4</key>
- <opt>val:dtv.C1_4</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>8/9</name>
- <key>C8_9</key>
- <opt>val:dtv.C8_9</opt>
- </option>
- <option>
- <name>9/10</name>
- <key>C9_10</key>
- <opt>val:dtv.C9_10</opt>
- </option>
- <option>
- <name>2/9 VL-SNR</name>
- <key>C2_9_VLSNR</key>
- <opt>val:dtv.C2_9_VLSNR</opt>
- </option>
- <option>
- <name>13/45</name>
- <key>C13_45</key>
- <opt>val:dtv.C13_45</opt>
- </option>
- <option>
- <name>9/20</name>
- <key>C9_20</key>
- <opt>val:dtv.C9_20</opt>
- </option>
- <option>
- <name>90/180</name>
- <key>C90_180</key>
- <opt>val:dtv.C90_180</opt>
- </option>
- <option>
- <name>96/180</name>
- <key>C96_180</key>
- <opt>val:dtv.C96_180</opt>
- </option>
- <option>
- <name>11/20</name>
- <key>C11_20</key>
- <opt>val:dtv.C11_20</opt>
- </option>
- <option>
- <name>100/180</name>
- <key>C100_180</key>
- <opt>val:dtv.C100_180</opt>
- </option>
- <option>
- <name>104/180</name>
- <key>C104_180</key>
- <opt>val:dtv.C104_180</opt>
- </option>
- <option>
- <name>26/45</name>
- <key>C26_45</key>
- <opt>val:dtv.C26_45</opt>
- </option>
- <option>
- <name>18/30</name>
- <key>C18_30</key>
- <opt>val:dtv.C18_30</opt>
- </option>
- <option>
- <name>28/45</name>
- <key>C28_45</key>
- <opt>val:dtv.C28_45</opt>
- </option>
- <option>
- <name>23/36</name>
- <key>C23_36</key>
- <opt>val:dtv.C23_36</opt>
- </option>
- <option>
- <name>116/180</name>
- <key>C116_180</key>
- <opt>val:dtv.C116_180</opt>
- </option>
- <option>
- <name>20/30</name>
- <key>C20_30</key>
- <opt>val:dtv.C20_30</opt>
- </option>
- <option>
- <name>124/180</name>
- <key>C124_180</key>
- <opt>val:dtv.C124_180</opt>
- </option>
- <option>
- <name>25/36</name>
- <key>C25_36</key>
- <opt>val:dtv.C25_36</opt>
- </option>
- <option>
- <name>128/180</name>
- <key>C128_180</key>
- <opt>val:dtv.C128_180</opt>
- </option>
- <option>
- <name>13/18</name>
- <key>C13_18</key>
- <opt>val:dtv.C13_18</opt>
- </option>
- <option>
- <name>132/180</name>
- <key>C132_180</key>
- <opt>val:dtv.C132_180</opt>
- </option>
- <option>
- <name>22/30</name>
- <key>C22_30</key>
- <opt>val:dtv.C22_30</opt>
- </option>
- <option>
- <name>135/180</name>
- <key>C135_180</key>
- <opt>val:dtv.C135_180</opt>
- </option>
- <option>
- <name>140/180</name>
- <key>C140_180</key>
- <opt>val:dtv.C140_180</opt>
- </option>
- <option>
- <name>7/9</name>
- <key>C7_9</key>
- <opt>val:dtv.C7_9</opt>
- </option>
- <option>
- <name>154/180</name>
- <key>C154_180</key>
- <opt>val:dtv.C154_180</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate4</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBS2' then $framesize2.hide_medium else 'all'</hide>
- <option>
- <name>1/5</name>
- <key>C1_5_MEDIUM</key>
- <opt>val:dtv.C1_5_MEDIUM</opt>
- </option>
- <option>
- <name>11/45</name>
- <key>C11_45_MEDIUM</key>
- <opt>val:dtv.C11_45_MEDIUM</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3_MEDIUM</key>
- <opt>val:dtv.C1_3_MEDIUM</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate5</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBS2' then $framesize2.hide_short else 'all'</hide>
- <option>
- <name>1/4</name>
- <key>C1_4</key>
- <opt>val:dtv.C1_4</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>8/9</name>
- <key>C8_9</key>
- <opt>val:dtv.C8_9</opt>
- </option>
- <option>
- <name>11/45</name>
- <key>C11_45</key>
- <opt>val:dtv.C11_45</opt>
- </option>
- <option>
- <name>4/15</name>
- <key>C4_15</key>
- <opt>val:dtv.C4_15</opt>
- </option>
- <option>
- <name>14/45</name>
- <key>C14_45</key>
- <opt>val:dtv.C14_45</opt>
- </option>
- <option>
- <name>7/15</name>
- <key>C7_15</key>
- <opt>val:dtv.C7_15</opt>
- </option>
- <option>
- <name>8/15</name>
- <key>C8_15</key>
- <opt>val:dtv.C8_15</opt>
- </option>
- <option>
- <name>26/45</name>
- <key>C26_45</key>
- <opt>val:dtv.C26_45</opt>
- </option>
- <option>
- <name>32/45</name>
- <key>C32_45</key>
- <opt>val:dtv.C32_45</opt>
- </option>
- <option>
- <name>1/5 VL-SNR SF2</name>
- <key>C1_5_VLSNR_SF2</key>
- <opt>val:dtv.C1_5_VLSNR_SF2</opt>
- </option>
- <option>
- <name>11/45 VL-SNR SF2</name>
- <key>C11_45_VLSNR_SF2</key>
- <opt>val:dtv.C11_45_VLSNR_SF2</opt>
- </option>
- <option>
- <name>1/5 VL-SNR</name>
- <key>C1_5_VLSNR</key>
- <opt>val:dtv.C1_5_VLSNR</opt>
- </option>
- <option>
- <name>4/15 VL-SNR</name>
- <key>C4_15_VLSNR</key>
- <opt>val:dtv.C4_15_VLSNR</opt>
- </option>
- <option>
- <name>1/3 VL-SNR</name>
- <key>C1_3_VLSNR</key>
- <opt>val:dtv.C1_3_VLSNR</opt>
- </option>
- </param>
- <param>
- <name>Rolloff factor</name>
- <key>rolloff</key>
- <type>enum</type>
- <hide>$standard.hide_dvbs2</hide>
- <option>
- <name>0.35</name>
- <key>RO_0_35</key>
- <opt>val:dtv.RO_0_35</opt>
- </option>
- <option>
- <name>0.25</name>
- <key>RO_0_25</key>
- <opt>val:dtv.RO_0_25</opt>
- </option>
- <option>
- <name>0.20</name>
- <key>RO_0_20</key>
- <opt>val:dtv.RO_0_20</opt>
- </option>
- <option>
- <name>0.15</name>
- <key>RO_0_15</key>
- <opt>val:dtv.RO_0_15</opt>
- </option>
- <option>
- <name>0.10</name>
- <key>RO_0_10</key>
- <opt>val:dtv.RO_0_10</opt>
- </option>
- <option>
- <name>0.05</name>
- <key>RO_0_05</key>
- <opt>val:dtv.RO_0_05</opt>
- </option>
- </param>
- <param>
- <name>Baseband Framing Mode</name>
- <key>mode</key>
- <type>enum</type>
- <hide>$standard.hide_dvbt2</hide>
- <option>
- <name>Normal</name>
- <key>INPUTMODE_NORMAL</key>
- <opt>val:dtv.INPUTMODE_NORMAL</opt>
- </option>
- <option>
- <name>High Efficiency</name>
- <key>INPUTMODE_HIEFF</key>
- <opt>val:dtv.INPUTMODE_HIEFF</opt>
- </option>
- </param>
- <param>
- <name>In-band Signalling</name>
- <key>inband</key>
- <type>enum</type>
- <hide>$standard.hide_dvbt2</hide>
- <option>
- <name>Off</name>
- <key>INBAND_OFF</key>
- <opt>val:dtv.INBAND_OFF</opt>
- <opt>hide_rate:all</opt>
- </option>
- <option>
- <name>Type B</name>
- <key>INBAND_ON</key>
- <opt>val:dtv.INBAND_ON</opt>
- <opt>hide_rate:</opt>
- </option>
- </param>
- <param>
- <name>FEC blocks per frame</name>
- <key>fecblocks</key>
- <value>168</value>
- <type>int</type>
- <hide>$inband.hide_rate</hide>
- </param>
- <param>
- <name>Transport Stream Rate</name>
- <key>tsrate</key>
- <value>4000000</value>
- <type>int</type>
- <hide>$inband.hide_rate</hide>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvb_bbscrambler_bb.block.yml b/gr-dtv/grc/dtv_dvb_bbscrambler_bb.block.yml
new file mode 100644
index 000000000..c1e2a7685
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvb_bbscrambler_bb.block.yml
@@ -0,0 +1,118 @@
+id: dtv_dvb_bbscrambler_bb
+label: BBscrambler
+
+parameters:
+- id: standard
+ label: Standard
+ dtype: enum
+ options: [STANDARD_DVBS2, STANDARD_DVBT2]
+ option_labels: [DVB-S2, DVB-T2]
+ option_attributes:
+ hide_dvbs2: ['', all]
+ hide_dvbt2: [all, '']
+ val: [dtv.STANDARD_DVBS2, dtv.STANDARD_DVBT2]
+- id: framesize1
+ label: FECFRAME size
+ dtype: enum
+ options: [FECFRAME_NORMAL, FECFRAME_SHORT]
+ option_labels: [Normal, Short]
+ option_attributes:
+ hide_medium: [all, all]
+ hide_normal: ['', all]
+ hide_short: [all, '']
+ val: [dtv.FECFRAME_NORMAL, dtv.FECFRAME_SHORT]
+ hide: ${ standard.hide_dvbt2 }
+- id: framesize2
+ label: FECFRAME size
+ dtype: enum
+ options: [FECFRAME_NORMAL, FECFRAME_MEDIUM, FECFRAME_SHORT]
+ option_labels: [Normal, Medium, Short]
+ option_attributes:
+ hide_medium: [all, '', all]
+ hide_normal: ['', all, all]
+ hide_short: [all, all, '']
+ val: [dtv.FECFRAME_NORMAL, dtv.FECFRAME_MEDIUM, dtv.FECFRAME_SHORT]
+ hide: ${ standard.hide_dvbs2 }
+- id: rate1
+ label: Code rate
+ dtype: enum
+ options: [C1_2, C3_5, C2_3, C3_4, C4_5, C5_6]
+ option_labels: [1/2, 3/5, 2/3, 3/4, 4/5, 5/6]
+ option_attributes:
+ val: [dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4, dtv.C4_5, dtv.C5_6]
+ hide: ${ (framesize1.hide_normal if str(standard) == 'STANDARD_DVBT2' else 'all')
+ }
+- id: rate2
+ label: Code rate
+ dtype: enum
+ options: [C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6]
+ option_labels: [1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6]
+ option_attributes:
+ val: [dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4, dtv.C4_5,
+ dtv.C5_6]
+ hide: ${ (framesize1.hide_short if str(standard) == 'STANDARD_DVBT2' else 'all')
+ }
+- id: rate3
+ label: Code rate
+ dtype: enum
+ options: [C1_4, C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6, C8_9, C9_10, C2_9_VLSNR,
+ C13_45, C9_20, C90_180, C96_180, C11_20, C100_180, C104_180, C26_45, C18_30,
+ C28_45, C23_36, C116_180, C20_30, C124_180, C25_36, C128_180, C13_18, C132_180,
+ C22_30, C135_180, C140_180, C7_9, C154_180]
+ option_labels: [1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6, 8/9, 9/10, 2/9 VL-SNR,
+ 13/45, 9/20, 90/180, 96/180, 11/20, 100/180, 104/180, 26/45, 18/30, 28/45,
+ 23/36, 116/180, 20/30, 124/180, 25/36, 128/180, 13/18, 132/180, 22/30, 135/180,
+ 140/180, 7/9, 154/180]
+ option_attributes:
+ val: [dtv.C1_4, dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4,
+ dtv.C4_5, dtv.C5_6, dtv.C8_9, dtv.C9_10, dtv.C2_9_VLSNR, dtv.C13_45, dtv.C9_20,
+ dtv.C90_180, dtv.C96_180, dtv.C11_20, dtv.C100_180, dtv.C104_180, dtv.C26_45,
+ dtv.C18_30, dtv.C28_45, dtv.C23_36, dtv.C116_180, dtv.C20_30, dtv.C124_180,
+ dtv.C25_36, dtv.C128_180, dtv.C13_18, dtv.C132_180, dtv.C22_30, dtv.C135_180,
+ dtv.C140_180, dtv.C7_9, dtv.C154_180]
+ hide: ${ (framesize2.hide_normal if str(standard) == 'STANDARD_DVBS2' else 'all')
+ }
+- id: rate4
+ label: Code rate
+ dtype: enum
+ options: [C1_5_MEDIUM, C11_45_MEDIUM, C1_3_MEDIUM]
+ option_labels: [1/5, 11/45, 1/3]
+ option_attributes:
+ val: [dtv.C1_5_MEDIUM, dtv.C11_45_MEDIUM, dtv.C1_3_MEDIUM]
+ hide: ${ (framesize2.hide_medium if str(standard) == 'STANDARD_DVBS2' else 'all')
+ }
+- id: rate5
+ label: Code rate
+ dtype: enum
+ options: [C1_4, C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6, C8_9, C11_45,
+ C4_15, C14_45, C7_15, C8_15, C26_45, C32_45, C1_5_VLSNR_SF2, C11_45_VLSNR_SF2,
+ C1_5_VLSNR, C4_15_VLSNR, C1_3_VLSNR]
+ option_labels: [1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6, 8/9, 11/45, 4/15,
+ 14/45, 7/15, 8/15, 26/45, 32/45, 1/5 VL-SNR SF2, 11/45 VL-SNR SF2, 1/5 VL-SNR,
+ 4/15 VL-SNR, 1/3 VL-SNR]
+ option_attributes:
+ val: [dtv.C1_4, dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4,
+ dtv.C4_5, dtv.C5_6, dtv.C8_9, dtv.C11_45, dtv.C4_15, dtv.C14_45, dtv.C7_15,
+ dtv.C8_15, dtv.C26_45, dtv.C32_45, dtv.C1_5_VLSNR_SF2, dtv.C11_45_VLSNR_SF2,
+ dtv.C1_5_VLSNR, dtv.C4_15_VLSNR, dtv.C1_3_VLSNR]
+ hide: ${ (framesize2.hide_short if str(standard) == 'STANDARD_DVBS2' else 'all')
+ }
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import dtv
+ make: "dtv.dvb_bbscrambler_bb(${standard.val}, \n% if str(standard) == 'STANDARD_DVBT2':\n\
+ ${framesize1.val}, \n% else:\n${framesize2.val}, \n% endif\n% if str(standard)\
+ \ == 'STANDARD_DVBT2':\n% if str(framesize1) == 'FECFRAME_NORMAL':\n${rate1.val}\n\
+ % else:\n${rate2.val}\n% endif\n% else:\n% if str(framesize2) == 'FECFRAME_NORMAL':\n\
+ ${rate3.val}\n% elif str(framesize2) == 'FECFRAME_MEDIUM':\n${rate4.val}\n\
+ % else:\n${rate5.val}\n% endif\n% endif\n)"
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvb_bbscrambler_bb.xml b/gr-dtv/grc/dtv_dvb_bbscrambler_bb.xml
deleted file mode 100644
index 2fba572d3..000000000
--- a/gr-dtv/grc/dtv_dvb_bbscrambler_bb.xml
+++ /dev/null
@@ -1,512 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB Baseband Scrambler
-###################################################
- -->
-<block>
- <name>BBscrambler</name>
- <key>dtv_dvb_bbscrambler_bb</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvb_bbscrambler_bb($standard.val, #slurp
-#if str($standard) == 'STANDARD_DVBT2'
-$framesize1.val, #slurp
-#else
-$framesize2.val, #slurp
-#end if
-#if str($standard) == 'STANDARD_DVBT2'
-#if str($framesize1) == 'FECFRAME_NORMAL'
-$rate1.val#slurp
-#else
-$rate2.val#slurp
-#end if
-#else
-#if str($framesize2) == 'FECFRAME_NORMAL'
-$rate3.val#slurp
-#else if str($framesize2) == 'FECFRAME_MEDIUM'
-$rate4.val#slurp
-#else
-$rate5.val#slurp
-#end if
-#end if
-)</make>
- <param>
- <name>Standard</name>
- <key>standard</key>
- <type>enum</type>
- <option>
- <name>DVB-S2</name>
- <key>STANDARD_DVBS2</key>
- <opt>val:dtv.STANDARD_DVBS2</opt>
- <opt>hide_dvbs2:</opt>
- <opt>hide_dvbt2:all</opt>
- </option>
- <option>
- <name>DVB-T2</name>
- <key>STANDARD_DVBT2</key>
- <opt>val:dtv.STANDARD_DVBT2</opt>
- <opt>hide_dvbs2:all</opt>
- <opt>hide_dvbt2:</opt>
- </option>
- </param>
- <param>
- <name>FECFRAME size</name>
- <key>framesize1</key>
- <type>enum</type>
- <hide>$standard.hide_dvbt2</hide>
- <option>
- <name>Normal</name>
- <key>FECFRAME_NORMAL</key>
- <opt>val:dtv.FECFRAME_NORMAL</opt>
- <opt>hide_normal:</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:all</opt>
- </option>
- <option>
- <name>Short</name>
- <key>FECFRAME_SHORT</key>
- <opt>val:dtv.FECFRAME_SHORT</opt>
- <opt>hide_normal:all</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:</opt>
- </option>
- </param>
- <param>
- <name>FECFRAME size</name>
- <key>framesize2</key>
- <type>enum</type>
- <hide>$standard.hide_dvbs2</hide>
- <option>
- <name>Normal</name>
- <key>FECFRAME_NORMAL</key>
- <opt>val:dtv.FECFRAME_NORMAL</opt>
- <opt>hide_normal:</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:all</opt>
- </option>
- <option>
- <name>Medium</name>
- <key>FECFRAME_MEDIUM</key>
- <opt>val:dtv.FECFRAME_MEDIUM</opt>
- <opt>hide_normal:all</opt>
- <opt>hide_medium:</opt>
- <opt>hide_short:all</opt>
- </option>
- <option>
- <name>Short</name>
- <key>FECFRAME_SHORT</key>
- <opt>val:dtv.FECFRAME_SHORT</opt>
- <opt>hide_normal:all</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate1</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBT2' then $framesize1.hide_normal else 'all'</hide>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate2</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBT2' then $framesize1.hide_short else 'all'</hide>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate3</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBS2' then $framesize2.hide_normal else 'all'</hide>
- <option>
- <name>1/4</name>
- <key>C1_4</key>
- <opt>val:dtv.C1_4</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>8/9</name>
- <key>C8_9</key>
- <opt>val:dtv.C8_9</opt>
- </option>
- <option>
- <name>9/10</name>
- <key>C9_10</key>
- <opt>val:dtv.C9_10</opt>
- </option>
- <option>
- <name>2/9 VL-SNR</name>
- <key>C2_9_VLSNR</key>
- <opt>val:dtv.C2_9_VLSNR</opt>
- </option>
- <option>
- <name>13/45</name>
- <key>C13_45</key>
- <opt>val:dtv.C13_45</opt>
- </option>
- <option>
- <name>9/20</name>
- <key>C9_20</key>
- <opt>val:dtv.C9_20</opt>
- </option>
- <option>
- <name>90/180</name>
- <key>C90_180</key>
- <opt>val:dtv.C90_180</opt>
- </option>
- <option>
- <name>96/180</name>
- <key>C96_180</key>
- <opt>val:dtv.C96_180</opt>
- </option>
- <option>
- <name>11/20</name>
- <key>C11_20</key>
- <opt>val:dtv.C11_20</opt>
- </option>
- <option>
- <name>100/180</name>
- <key>C100_180</key>
- <opt>val:dtv.C100_180</opt>
- </option>
- <option>
- <name>104/180</name>
- <key>C104_180</key>
- <opt>val:dtv.C104_180</opt>
- </option>
- <option>
- <name>26/45</name>
- <key>C26_45</key>
- <opt>val:dtv.C26_45</opt>
- </option>
- <option>
- <name>18/30</name>
- <key>C18_30</key>
- <opt>val:dtv.C18_30</opt>
- </option>
- <option>
- <name>28/45</name>
- <key>C28_45</key>
- <opt>val:dtv.C28_45</opt>
- </option>
- <option>
- <name>23/36</name>
- <key>C23_36</key>
- <opt>val:dtv.C23_36</opt>
- </option>
- <option>
- <name>116/180</name>
- <key>C116_180</key>
- <opt>val:dtv.C116_180</opt>
- </option>
- <option>
- <name>20/30</name>
- <key>C20_30</key>
- <opt>val:dtv.C20_30</opt>
- </option>
- <option>
- <name>124/180</name>
- <key>C124_180</key>
- <opt>val:dtv.C124_180</opt>
- </option>
- <option>
- <name>25/36</name>
- <key>C25_36</key>
- <opt>val:dtv.C25_36</opt>
- </option>
- <option>
- <name>128/180</name>
- <key>C128_180</key>
- <opt>val:dtv.C128_180</opt>
- </option>
- <option>
- <name>13/18</name>
- <key>C13_18</key>
- <opt>val:dtv.C13_18</opt>
- </option>
- <option>
- <name>132/180</name>
- <key>C132_180</key>
- <opt>val:dtv.C132_180</opt>
- </option>
- <option>
- <name>22/30</name>
- <key>C22_30</key>
- <opt>val:dtv.C22_30</opt>
- </option>
- <option>
- <name>135/180</name>
- <key>C135_180</key>
- <opt>val:dtv.C135_180</opt>
- </option>
- <option>
- <name>140/180</name>
- <key>C140_180</key>
- <opt>val:dtv.C140_180</opt>
- </option>
- <option>
- <name>7/9</name>
- <key>C7_9</key>
- <opt>val:dtv.C7_9</opt>
- </option>
- <option>
- <name>154/180</name>
- <key>C154_180</key>
- <opt>val:dtv.C154_180</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate4</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBS2' then $framesize2.hide_medium else 'all'</hide>
- <option>
- <name>1/5</name>
- <key>C1_5_MEDIUM</key>
- <opt>val:dtv.C1_5_MEDIUM</opt>
- </option>
- <option>
- <name>11/45</name>
- <key>C11_45_MEDIUM</key>
- <opt>val:dtv.C11_45_MEDIUM</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3_MEDIUM</key>
- <opt>val:dtv.C1_3_MEDIUM</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate5</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBS2' then $framesize2.hide_short else 'all'</hide>
- <option>
- <name>1/4</name>
- <key>C1_4</key>
- <opt>val:dtv.C1_4</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>8/9</name>
- <key>C8_9</key>
- <opt>val:dtv.C8_9</opt>
- </option>
- <option>
- <name>11/45</name>
- <key>C11_45</key>
- <opt>val:dtv.C11_45</opt>
- </option>
- <option>
- <name>4/15</name>
- <key>C4_15</key>
- <opt>val:dtv.C4_15</opt>
- </option>
- <option>
- <name>14/45</name>
- <key>C14_45</key>
- <opt>val:dtv.C14_45</opt>
- </option>
- <option>
- <name>7/15</name>
- <key>C7_15</key>
- <opt>val:dtv.C7_15</opt>
- </option>
- <option>
- <name>8/15</name>
- <key>C8_15</key>
- <opt>val:dtv.C8_15</opt>
- </option>
- <option>
- <name>26/45</name>
- <key>C26_45</key>
- <opt>val:dtv.C26_45</opt>
- </option>
- <option>
- <name>32/45</name>
- <key>C32_45</key>
- <opt>val:dtv.C32_45</opt>
- </option>
- <option>
- <name>1/5 VL-SNR SF2</name>
- <key>C1_5_VLSNR_SF2</key>
- <opt>val:dtv.C1_5_VLSNR_SF2</opt>
- </option>
- <option>
- <name>11/45 VL-SNR SF2</name>
- <key>C11_45_VLSNR_SF2</key>
- <opt>val:dtv.C11_45_VLSNR_SF2</opt>
- </option>
- <option>
- <name>1/5 VL-SNR</name>
- <key>C1_5_VLSNR</key>
- <opt>val:dtv.C1_5_VLSNR</opt>
- </option>
- <option>
- <name>4/15 VL-SNR</name>
- <key>C4_15_VLSNR</key>
- <opt>val:dtv.C4_15_VLSNR</opt>
- </option>
- <option>
- <name>1/3 VL-SNR</name>
- <key>C1_3_VLSNR</key>
- <opt>val:dtv.C1_3_VLSNR</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvb_bch_bb.block.yml b/gr-dtv/grc/dtv_dvb_bch_bb.block.yml
new file mode 100644
index 000000000..bfde8654f
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvb_bch_bb.block.yml
@@ -0,0 +1,118 @@
+id: dtv_dvb_bch_bb
+label: BCH Encoder
+
+parameters:
+- id: standard
+ label: Standard
+ dtype: enum
+ options: [STANDARD_DVBS2, STANDARD_DVBT2]
+ option_labels: [DVB-S2, DVB-T2]
+ option_attributes:
+ hide_dvbs2: ['', all]
+ hide_dvbt2: [all, '']
+ val: [dtv.STANDARD_DVBS2, dtv.STANDARD_DVBT2]
+- id: framesize1
+ label: FECFRAME size
+ dtype: enum
+ options: [FECFRAME_NORMAL, FECFRAME_SHORT]
+ option_labels: [Normal, Short]
+ option_attributes:
+ hide_medium: [all, all]
+ hide_normal: ['', all]
+ hide_short: [all, '']
+ val: [dtv.FECFRAME_NORMAL, dtv.FECFRAME_SHORT]
+ hide: ${ standard.hide_dvbt2 }
+- id: framesize2
+ label: FECFRAME size
+ dtype: enum
+ options: [FECFRAME_NORMAL, FECFRAME_MEDIUM, FECFRAME_SHORT]
+ option_labels: [Normal, Medium, Short]
+ option_attributes:
+ hide_medium: [all, '', all]
+ hide_normal: ['', all, all]
+ hide_short: [all, all, '']
+ val: [dtv.FECFRAME_NORMAL, dtv.FECFRAME_MEDIUM, dtv.FECFRAME_SHORT]
+ hide: ${ standard.hide_dvbs2 }
+- id: rate1
+ label: Code rate
+ dtype: enum
+ options: [C1_2, C3_5, C2_3, C3_4, C4_5, C5_6]
+ option_labels: [1/2, 3/5, 2/3, 3/4, 4/5, 5/6]
+ option_attributes:
+ val: [dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4, dtv.C4_5, dtv.C5_6]
+ hide: ${ (framesize1.hide_normal if str(standard) == 'STANDARD_DVBT2' else 'all')
+ }
+- id: rate2
+ label: Code rate
+ dtype: enum
+ options: [C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6]
+ option_labels: [1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6]
+ option_attributes:
+ val: [dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4, dtv.C4_5,
+ dtv.C5_6]
+ hide: ${ (framesize1.hide_short if str(standard) == 'STANDARD_DVBT2' else 'all')
+ }
+- id: rate3
+ label: Code rate
+ dtype: enum
+ options: [C1_4, C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6, C8_9, C9_10, C2_9_VLSNR,
+ C13_45, C9_20, C90_180, C96_180, C11_20, C100_180, C104_180, C26_45, C18_30,
+ C28_45, C23_36, C116_180, C20_30, C124_180, C25_36, C128_180, C13_18, C132_180,
+ C22_30, C135_180, C140_180, C7_9, C154_180]
+ option_labels: [1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6, 8/9, 9/10, 2/9 VL-SNR,
+ 13/45, 9/20, 90/180, 96/180, 11/20, 100/180, 104/180, 26/45, 18/30, 28/45,
+ 23/36, 116/180, 20/30, 124/180, 25/36, 128/180, 13/18, 132/180, 22/30, 135/180,
+ 140/180, 7/9, 154/180]
+ option_attributes:
+ val: [dtv.C1_4, dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4,
+ dtv.C4_5, dtv.C5_6, dtv.C8_9, dtv.C9_10, dtv.C2_9_VLSNR, dtv.C13_45, dtv.C9_20,
+ dtv.C90_180, dtv.C96_180, dtv.C11_20, dtv.C100_180, dtv.C104_180, dtv.C26_45,
+ dtv.C18_30, dtv.C28_45, dtv.C23_36, dtv.C116_180, dtv.C20_30, dtv.C124_180,
+ dtv.C25_36, dtv.C128_180, dtv.C13_18, dtv.C132_180, dtv.C22_30, dtv.C135_180,
+ dtv.C140_180, dtv.C7_9, dtv.C154_180]
+ hide: ${ (framesize2.hide_normal if str(standard) == 'STANDARD_DVBS2' else 'all')
+ }
+- id: rate4
+ label: Code rate
+ dtype: enum
+ options: [C1_5_MEDIUM, C11_45_MEDIUM, C1_3_MEDIUM]
+ option_labels: [1/5, 11/45, 1/3]
+ option_attributes:
+ val: [dtv.C1_5_MEDIUM, dtv.C11_45_MEDIUM, dtv.C1_3_MEDIUM]
+ hide: ${ (framesize2.hide_medium if str(standard) == 'STANDARD_DVBS2' else 'all')
+ }
+- id: rate5
+ label: Code rate
+ dtype: enum
+ options: [C1_4, C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6, C8_9, C11_45,
+ C4_15, C14_45, C7_15, C8_15, C26_45, C32_45, C1_5_VLSNR_SF2, C11_45_VLSNR_SF2,
+ C1_5_VLSNR, C4_15_VLSNR, C1_3_VLSNR]
+ option_labels: [1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6, 8/9, 11/45, 4/15,
+ 14/45, 7/15, 8/15, 26/45, 32/45, 1/5 VL-SNR SF2, 11/45 VL-SNR SF2, 1/5 VL-SNR,
+ 4/15 VL-SNR, 1/3 VL-SNR]
+ option_attributes:
+ val: [dtv.C1_4, dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4,
+ dtv.C4_5, dtv.C5_6, dtv.C8_9, dtv.C11_45, dtv.C4_15, dtv.C14_45, dtv.C7_15,
+ dtv.C8_15, dtv.C26_45, dtv.C32_45, dtv.C1_5_VLSNR_SF2, dtv.C11_45_VLSNR_SF2,
+ dtv.C1_5_VLSNR, dtv.C4_15_VLSNR, dtv.C1_3_VLSNR]
+ hide: ${ (framesize2.hide_short if str(standard) == 'STANDARD_DVBS2' else 'all')
+ }
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import dtv
+ make: "dtv.dvb_bch_bb(${standard.val}, \n% if str(standard) == 'STANDARD_DVBT2':\n\
+ ${framesize1.val}, \n% else:\n${framesize2.val}, \n% endif\n% if str(standard)\
+ \ == 'STANDARD_DVBT2':\n% if str(framesize1) == 'FECFRAME_NORMAL':\n${rate1.val}\n\
+ % else:\n${rate2.val}\n% endif\n% else:\n% if str(framesize2) == 'FECFRAME_NORMAL':\n\
+ ${rate3.val}\n% elif str(framesize2) == 'FECFRAME_MEDIUM':\n${rate4.val}\n\
+ % else:\n${rate5.val}\n% endif\n% endif\n)"
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvb_bch_bb.xml b/gr-dtv/grc/dtv_dvb_bch_bb.xml
deleted file mode 100644
index 01b446b7c..000000000
--- a/gr-dtv/grc/dtv_dvb_bch_bb.xml
+++ /dev/null
@@ -1,512 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB BCH Encoder
-###################################################
- -->
-<block>
- <name>BCH Encoder</name>
- <key>dtv_dvb_bch_bb</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvb_bch_bb($standard.val, #slurp
-#if str($standard) == 'STANDARD_DVBT2'
-$framesize1.val, #slurp
-#else
-$framesize2.val, #slurp
-#end if
-#if str($standard) == 'STANDARD_DVBT2'
-#if str($framesize1) == 'FECFRAME_NORMAL'
-$rate1.val#slurp
-#else
-$rate2.val#slurp
-#end if
-#else
-#if str($framesize2) == 'FECFRAME_NORMAL'
-$rate3.val#slurp
-#else if str($framesize2) == 'FECFRAME_MEDIUM'
-$rate4.val#slurp
-#else
-$rate5.val#slurp
-#end if
-#end if
-)</make>
- <param>
- <name>Standard</name>
- <key>standard</key>
- <type>enum</type>
- <option>
- <name>DVB-S2</name>
- <key>STANDARD_DVBS2</key>
- <opt>val:dtv.STANDARD_DVBS2</opt>
- <opt>hide_dvbs2:</opt>
- <opt>hide_dvbt2:all</opt>
- </option>
- <option>
- <name>DVB-T2</name>
- <key>STANDARD_DVBT2</key>
- <opt>val:dtv.STANDARD_DVBT2</opt>
- <opt>hide_dvbs2:all</opt>
- <opt>hide_dvbt2:</opt>
- </option>
- </param>
- <param>
- <name>FECFRAME size</name>
- <key>framesize1</key>
- <type>enum</type>
- <hide>$standard.hide_dvbt2</hide>
- <option>
- <name>Normal</name>
- <key>FECFRAME_NORMAL</key>
- <opt>val:dtv.FECFRAME_NORMAL</opt>
- <opt>hide_normal:</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:all</opt>
- </option>
- <option>
- <name>Short</name>
- <key>FECFRAME_SHORT</key>
- <opt>val:dtv.FECFRAME_SHORT</opt>
- <opt>hide_normal:all</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:</opt>
- </option>
- </param>
- <param>
- <name>FECFRAME size</name>
- <key>framesize2</key>
- <type>enum</type>
- <hide>$standard.hide_dvbs2</hide>
- <option>
- <name>Normal</name>
- <key>FECFRAME_NORMAL</key>
- <opt>val:dtv.FECFRAME_NORMAL</opt>
- <opt>hide_normal:</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:all</opt>
- </option>
- <option>
- <name>Medium</name>
- <key>FECFRAME_MEDIUM</key>
- <opt>val:dtv.FECFRAME_MEDIUM</opt>
- <opt>hide_normal:all</opt>
- <opt>hide_medium:</opt>
- <opt>hide_short:all</opt>
- </option>
- <option>
- <name>Short</name>
- <key>FECFRAME_SHORT</key>
- <opt>val:dtv.FECFRAME_SHORT</opt>
- <opt>hide_normal:all</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate1</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBT2' then $framesize1.hide_normal else 'all'</hide>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate2</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBT2' then $framesize1.hide_short else 'all'</hide>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate3</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBS2' then $framesize2.hide_normal else 'all'</hide>
- <option>
- <name>1/4</name>
- <key>C1_4</key>
- <opt>val:dtv.C1_4</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>8/9</name>
- <key>C8_9</key>
- <opt>val:dtv.C8_9</opt>
- </option>
- <option>
- <name>9/10</name>
- <key>C9_10</key>
- <opt>val:dtv.C9_10</opt>
- </option>
- <option>
- <name>2/9 VL-SNR</name>
- <key>C2_9_VLSNR</key>
- <opt>val:dtv.C2_9_VLSNR</opt>
- </option>
- <option>
- <name>13/45</name>
- <key>C13_45</key>
- <opt>val:dtv.C13_45</opt>
- </option>
- <option>
- <name>9/20</name>
- <key>C9_20</key>
- <opt>val:dtv.C9_20</opt>
- </option>
- <option>
- <name>90/180</name>
- <key>C90_180</key>
- <opt>val:dtv.C90_180</opt>
- </option>
- <option>
- <name>96/180</name>
- <key>C96_180</key>
- <opt>val:dtv.C96_180</opt>
- </option>
- <option>
- <name>11/20</name>
- <key>C11_20</key>
- <opt>val:dtv.C11_20</opt>
- </option>
- <option>
- <name>100/180</name>
- <key>C100_180</key>
- <opt>val:dtv.C100_180</opt>
- </option>
- <option>
- <name>104/180</name>
- <key>C104_180</key>
- <opt>val:dtv.C104_180</opt>
- </option>
- <option>
- <name>26/45</name>
- <key>C26_45</key>
- <opt>val:dtv.C26_45</opt>
- </option>
- <option>
- <name>18/30</name>
- <key>C18_30</key>
- <opt>val:dtv.C18_30</opt>
- </option>
- <option>
- <name>28/45</name>
- <key>C28_45</key>
- <opt>val:dtv.C28_45</opt>
- </option>
- <option>
- <name>23/36</name>
- <key>C23_36</key>
- <opt>val:dtv.C23_36</opt>
- </option>
- <option>
- <name>116/180</name>
- <key>C116_180</key>
- <opt>val:dtv.C116_180</opt>
- </option>
- <option>
- <name>20/30</name>
- <key>C20_30</key>
- <opt>val:dtv.C20_30</opt>
- </option>
- <option>
- <name>124/180</name>
- <key>C124_180</key>
- <opt>val:dtv.C124_180</opt>
- </option>
- <option>
- <name>25/36</name>
- <key>C25_36</key>
- <opt>val:dtv.C25_36</opt>
- </option>
- <option>
- <name>128/180</name>
- <key>C128_180</key>
- <opt>val:dtv.C128_180</opt>
- </option>
- <option>
- <name>13/18</name>
- <key>C13_18</key>
- <opt>val:dtv.C13_18</opt>
- </option>
- <option>
- <name>132/180</name>
- <key>C132_180</key>
- <opt>val:dtv.C132_180</opt>
- </option>
- <option>
- <name>22/30</name>
- <key>C22_30</key>
- <opt>val:dtv.C22_30</opt>
- </option>
- <option>
- <name>135/180</name>
- <key>C135_180</key>
- <opt>val:dtv.C135_180</opt>
- </option>
- <option>
- <name>140/180</name>
- <key>C140_180</key>
- <opt>val:dtv.C140_180</opt>
- </option>
- <option>
- <name>7/9</name>
- <key>C7_9</key>
- <opt>val:dtv.C7_9</opt>
- </option>
- <option>
- <name>154/180</name>
- <key>C154_180</key>
- <opt>val:dtv.C154_180</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate4</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBS2' then $framesize2.hide_medium else 'all'</hide>
- <option>
- <name>1/5</name>
- <key>C1_5_MEDIUM</key>
- <opt>val:dtv.C1_5_MEDIUM</opt>
- </option>
- <option>
- <name>11/45</name>
- <key>C11_45_MEDIUM</key>
- <opt>val:dtv.C11_45_MEDIUM</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3_MEDIUM</key>
- <opt>val:dtv.C1_3_MEDIUM</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate5</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBS2' then $framesize2.hide_short else 'all'</hide>
- <option>
- <name>1/4</name>
- <key>C1_4</key>
- <opt>val:dtv.C1_4</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>8/9</name>
- <key>C8_9</key>
- <opt>val:dtv.C8_9</opt>
- </option>
- <option>
- <name>11/45</name>
- <key>C11_45</key>
- <opt>val:dtv.C11_45</opt>
- </option>
- <option>
- <name>4/15</name>
- <key>C4_15</key>
- <opt>val:dtv.C4_15</opt>
- </option>
- <option>
- <name>14/45</name>
- <key>C14_45</key>
- <opt>val:dtv.C14_45</opt>
- </option>
- <option>
- <name>7/15</name>
- <key>C7_15</key>
- <opt>val:dtv.C7_15</opt>
- </option>
- <option>
- <name>8/15</name>
- <key>C8_15</key>
- <opt>val:dtv.C8_15</opt>
- </option>
- <option>
- <name>26/45</name>
- <key>C26_45</key>
- <opt>val:dtv.C26_45</opt>
- </option>
- <option>
- <name>32/45</name>
- <key>C32_45</key>
- <opt>val:dtv.C32_45</opt>
- </option>
- <option>
- <name>1/5 VL-SNR SF2</name>
- <key>C1_5_VLSNR_SF2</key>
- <opt>val:dtv.C1_5_VLSNR_SF2</opt>
- </option>
- <option>
- <name>11/45 VL-SNR SF2</name>
- <key>C11_45_VLSNR_SF2</key>
- <opt>val:dtv.C11_45_VLSNR_SF2</opt>
- </option>
- <option>
- <name>1/5 VL-SNR</name>
- <key>C1_5_VLSNR</key>
- <opt>val:dtv.C1_5_VLSNR</opt>
- </option>
- <option>
- <name>4/15 VL-SNR</name>
- <key>C4_15_VLSNR</key>
- <opt>val:dtv.C4_15_VLSNR</opt>
- </option>
- <option>
- <name>1/3 VL-SNR</name>
- <key>C1_3_VLSNR</key>
- <opt>val:dtv.C1_3_VLSNR</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvb_ldpc_bb.block.yml b/gr-dtv/grc/dtv_dvb_ldpc_bb.block.yml
new file mode 100644
index 000000000..435e039d5
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvb_ldpc_bb.block.yml
@@ -0,0 +1,126 @@
+id: dtv_dvb_ldpc_bb
+label: LDPC Encoder
+
+parameters:
+- id: standard
+ label: Standard
+ dtype: enum
+ options: [STANDARD_DVBS2, STANDARD_DVBT2]
+ option_labels: [DVB-S2, DVB-T2]
+ option_attributes:
+ hide_dvbs2: ['', all]
+ hide_dvbt2: [all, '']
+ val: [dtv.STANDARD_DVBS2, dtv.STANDARD_DVBT2]
+- id: framesize1
+ label: FECFRAME size
+ dtype: enum
+ options: [FECFRAME_NORMAL, FECFRAME_SHORT]
+ option_labels: [Normal, Short]
+ option_attributes:
+ hide_medium: [all, all]
+ hide_normal: ['', all]
+ hide_short: [all, '']
+ val: [dtv.FECFRAME_NORMAL, dtv.FECFRAME_SHORT]
+ hide: ${ standard.hide_dvbt2 }
+- id: framesize2
+ label: FECFRAME size
+ dtype: enum
+ options: [FECFRAME_NORMAL, FECFRAME_MEDIUM, FECFRAME_SHORT]
+ option_labels: [Normal, Medium, Short]
+ option_attributes:
+ hide_medium: [all, '', all]
+ hide_normal: ['', all, all]
+ hide_short: [all, all, '']
+ val: [dtv.FECFRAME_NORMAL, dtv.FECFRAME_MEDIUM, dtv.FECFRAME_SHORT]
+ hide: ${ standard.hide_dvbs2 }
+- id: rate1
+ label: Code rate
+ dtype: enum
+ options: [C1_2, C3_5, C2_3, C3_4, C4_5, C5_6]
+ option_labels: [1/2, 3/5, 2/3, 3/4, 4/5, 5/6]
+ option_attributes:
+ val: [dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4, dtv.C4_5, dtv.C5_6]
+ hide: ${ (framesize1.hide_normal if str(standard) == 'STANDARD_DVBT2' else 'all')
+ }
+- id: rate2
+ label: Code rate
+ dtype: enum
+ options: [C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6]
+ option_labels: [1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6]
+ option_attributes:
+ val: [dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4, dtv.C4_5,
+ dtv.C5_6]
+ hide: ${ (framesize1.hide_short if str(standard) == 'STANDARD_DVBT2' else 'all')
+ }
+- id: rate3
+ label: Code rate
+ dtype: enum
+ options: [C1_4, C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6, C8_9, C9_10, C2_9_VLSNR,
+ C13_45, C9_20, C90_180, C96_180, C11_20, C100_180, C104_180, C26_45, C18_30,
+ C28_45, C23_36, C116_180, C20_30, C124_180, C25_36, C128_180, C13_18, C132_180,
+ C22_30, C135_180, C140_180, C7_9, C154_180]
+ option_labels: [1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6, 8/9, 9/10, 2/9 VL-SNR,
+ 13/45, 9/20, 90/180, 96/180, 11/20, 100/180, 104/180, 26/45, 18/30, 28/45,
+ 23/36, 116/180, 20/30, 124/180, 25/36, 128/180, 13/18, 132/180, 22/30, 135/180,
+ 140/180, 7/9, 154/180]
+ option_attributes:
+ val: [dtv.C1_4, dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4,
+ dtv.C4_5, dtv.C5_6, dtv.C8_9, dtv.C9_10, dtv.C2_9_VLSNR, dtv.C13_45, dtv.C9_20,
+ dtv.C90_180, dtv.C96_180, dtv.C11_20, dtv.C100_180, dtv.C104_180, dtv.C26_45,
+ dtv.C18_30, dtv.C28_45, dtv.C23_36, dtv.C116_180, dtv.C20_30, dtv.C124_180,
+ dtv.C25_36, dtv.C128_180, dtv.C13_18, dtv.C132_180, dtv.C22_30, dtv.C135_180,
+ dtv.C140_180, dtv.C7_9, dtv.C154_180]
+ hide: ${ (framesize2.hide_normal if str(standard) == 'STANDARD_DVBS2' else 'all')
+ }
+- id: rate4
+ label: Code rate
+ dtype: enum
+ options: [C1_5_MEDIUM, C11_45_MEDIUM, C1_3_MEDIUM]
+ option_labels: [1/5, 11/45, 1/3]
+ option_attributes:
+ val: [dtv.C1_5_MEDIUM, dtv.C11_45_MEDIUM, dtv.C1_3_MEDIUM]
+ hide: ${ (framesize2.hide_medium if str(standard) == 'STANDARD_DVBS2' else 'all')
+ }
+- id: rate5
+ label: Code rate
+ dtype: enum
+ options: [C1_4, C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6, C8_9, C11_45,
+ C4_15, C14_45, C7_15, C8_15, C26_45, C32_45, C1_5_VLSNR_SF2, C11_45_VLSNR_SF2,
+ C1_5_VLSNR, C4_15_VLSNR, C1_3_VLSNR]
+ option_labels: [1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6, 8/9, 11/45, 4/15,
+ 14/45, 7/15, 8/15, 26/45, 32/45, 1/5 VL-SNR SF2, 11/45 VL-SNR SF2, 1/5 VL-SNR,
+ 4/15 VL-SNR, 1/3 VL-SNR]
+ option_attributes:
+ val: [dtv.C1_4, dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4,
+ dtv.C4_5, dtv.C5_6, dtv.C8_9, dtv.C11_45, dtv.C4_15, dtv.C14_45, dtv.C7_15,
+ dtv.C8_15, dtv.C26_45, dtv.C32_45, dtv.C1_5_VLSNR_SF2, dtv.C11_45_VLSNR_SF2,
+ dtv.C1_5_VLSNR, dtv.C4_15_VLSNR, dtv.C1_3_VLSNR]
+ hide: ${ (framesize2.hide_short if str(standard) == 'STANDARD_DVBS2' else 'all')
+ }
+- id: constellation
+ label: Constellation
+ dtype: enum
+ options: [MOD_OTHER, MOD_128APSK]
+ option_labels: [Other, 128APSK]
+ option_attributes:
+ val: [dtv.MOD_OTHER, dtv.MOD_128APSK]
+ hide: ${ standard.hide_dvbs2 }
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import dtv
+ make: "dtv.dvb_ldpc_bb(${standard.val}, \n% if str(standard) == 'STANDARD_DVBT2':\n\
+ ${framesize1.val}, \n% else:\n${framesize2.val}, \n% endif\n% if str(standard)\
+ \ == 'STANDARD_DVBT2':\n% if str(framesize1) == 'FECFRAME_NORMAL':\n${rate1.val},\
+ \ \n% else:\n${rate2.val}, \n% endif\n% else:\n% if str(framesize2) == 'FECFRAME_NORMAL':\n\
+ ${rate3.val}, \n% elif str(framesize2) == 'FECFRAME_MEDIUM':\n${rate4.val},\
+ \ \n% else:\n${rate5.val}, \n% endif\n% endif\n${constellation.val})"
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvb_ldpc_bb.xml b/gr-dtv/grc/dtv_dvb_ldpc_bb.xml
deleted file mode 100644
index f1cff1609..000000000
--- a/gr-dtv/grc/dtv_dvb_ldpc_bb.xml
+++ /dev/null
@@ -1,528 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB LDPC Encoder
-###################################################
- -->
-<block>
- <name>LDPC Encoder</name>
- <key>dtv_dvb_ldpc_bb</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvb_ldpc_bb($standard.val, #slurp
-#if str($standard) == 'STANDARD_DVBT2'
-$framesize1.val, #slurp
-#else
-$framesize2.val, #slurp
-#end if
-#if str($standard) == 'STANDARD_DVBT2'
-#if str($framesize1) == 'FECFRAME_NORMAL'
-$rate1.val, #slurp
-#else
-$rate2.val, #slurp
-#end if
-#else
-#if str($framesize2) == 'FECFRAME_NORMAL'
-$rate3.val, #slurp
-#else if str($framesize2) == 'FECFRAME_MEDIUM'
-$rate4.val, #slurp
-#else
-$rate5.val, #slurp
-#end if
-#end if
-$constellation.val)</make>
- <param>
- <name>Standard</name>
- <key>standard</key>
- <type>enum</type>
- <option>
- <name>DVB-S2</name>
- <key>STANDARD_DVBS2</key>
- <opt>val:dtv.STANDARD_DVBS2</opt>
- <opt>hide_dvbs2:</opt>
- <opt>hide_dvbt2:all</opt>
- </option>
- <option>
- <name>DVB-T2</name>
- <key>STANDARD_DVBT2</key>
- <opt>val:dtv.STANDARD_DVBT2</opt>
- <opt>hide_dvbs2:all</opt>
- <opt>hide_dvbt2:</opt>
- </option>
- </param>
- <param>
- <name>FECFRAME size</name>
- <key>framesize1</key>
- <type>enum</type>
- <hide>$standard.hide_dvbt2</hide>
- <option>
- <name>Normal</name>
- <key>FECFRAME_NORMAL</key>
- <opt>val:dtv.FECFRAME_NORMAL</opt>
- <opt>hide_normal:</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:all</opt>
- </option>
- <option>
- <name>Short</name>
- <key>FECFRAME_SHORT</key>
- <opt>val:dtv.FECFRAME_SHORT</opt>
- <opt>hide_normal:all</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:</opt>
- </option>
- </param>
- <param>
- <name>FECFRAME size</name>
- <key>framesize2</key>
- <type>enum</type>
- <hide>$standard.hide_dvbs2</hide>
- <option>
- <name>Normal</name>
- <key>FECFRAME_NORMAL</key>
- <opt>val:dtv.FECFRAME_NORMAL</opt>
- <opt>hide_normal:</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:all</opt>
- </option>
- <option>
- <name>Medium</name>
- <key>FECFRAME_MEDIUM</key>
- <opt>val:dtv.FECFRAME_MEDIUM</opt>
- <opt>hide_normal:all</opt>
- <opt>hide_medium:</opt>
- <opt>hide_short:all</opt>
- </option>
- <option>
- <name>Short</name>
- <key>FECFRAME_SHORT</key>
- <opt>val:dtv.FECFRAME_SHORT</opt>
- <opt>hide_normal:all</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate1</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBT2' then $framesize1.hide_normal else 'all'</hide>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate2</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBT2' then $framesize1.hide_short else 'all'</hide>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate3</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBS2' then $framesize2.hide_normal else 'all'</hide>
- <option>
- <name>1/4</name>
- <key>C1_4</key>
- <opt>val:dtv.C1_4</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>8/9</name>
- <key>C8_9</key>
- <opt>val:dtv.C8_9</opt>
- </option>
- <option>
- <name>9/10</name>
- <key>C9_10</key>
- <opt>val:dtv.C9_10</opt>
- </option>
- <option>
- <name>2/9 VL-SNR</name>
- <key>C2_9_VLSNR</key>
- <opt>val:dtv.C2_9_VLSNR</opt>
- </option>
- <option>
- <name>13/45</name>
- <key>C13_45</key>
- <opt>val:dtv.C13_45</opt>
- </option>
- <option>
- <name>9/20</name>
- <key>C9_20</key>
- <opt>val:dtv.C9_20</opt>
- </option>
- <option>
- <name>90/180</name>
- <key>C90_180</key>
- <opt>val:dtv.C90_180</opt>
- </option>
- <option>
- <name>96/180</name>
- <key>C96_180</key>
- <opt>val:dtv.C96_180</opt>
- </option>
- <option>
- <name>11/20</name>
- <key>C11_20</key>
- <opt>val:dtv.C11_20</opt>
- </option>
- <option>
- <name>100/180</name>
- <key>C100_180</key>
- <opt>val:dtv.C100_180</opt>
- </option>
- <option>
- <name>104/180</name>
- <key>C104_180</key>
- <opt>val:dtv.C104_180</opt>
- </option>
- <option>
- <name>26/45</name>
- <key>C26_45</key>
- <opt>val:dtv.C26_45</opt>
- </option>
- <option>
- <name>18/30</name>
- <key>C18_30</key>
- <opt>val:dtv.C18_30</opt>
- </option>
- <option>
- <name>28/45</name>
- <key>C28_45</key>
- <opt>val:dtv.C28_45</opt>
- </option>
- <option>
- <name>23/36</name>
- <key>C23_36</key>
- <opt>val:dtv.C23_36</opt>
- </option>
- <option>
- <name>116/180</name>
- <key>C116_180</key>
- <opt>val:dtv.C116_180</opt>
- </option>
- <option>
- <name>20/30</name>
- <key>C20_30</key>
- <opt>val:dtv.C20_30</opt>
- </option>
- <option>
- <name>124/180</name>
- <key>C124_180</key>
- <opt>val:dtv.C124_180</opt>
- </option>
- <option>
- <name>25/36</name>
- <key>C25_36</key>
- <opt>val:dtv.C25_36</opt>
- </option>
- <option>
- <name>128/180</name>
- <key>C128_180</key>
- <opt>val:dtv.C128_180</opt>
- </option>
- <option>
- <name>13/18</name>
- <key>C13_18</key>
- <opt>val:dtv.C13_18</opt>
- </option>
- <option>
- <name>132/180</name>
- <key>C132_180</key>
- <opt>val:dtv.C132_180</opt>
- </option>
- <option>
- <name>22/30</name>
- <key>C22_30</key>
- <opt>val:dtv.C22_30</opt>
- </option>
- <option>
- <name>135/180</name>
- <key>C135_180</key>
- <opt>val:dtv.C135_180</opt>
- </option>
- <option>
- <name>140/180</name>
- <key>C140_180</key>
- <opt>val:dtv.C140_180</opt>
- </option>
- <option>
- <name>7/9</name>
- <key>C7_9</key>
- <opt>val:dtv.C7_9</opt>
- </option>
- <option>
- <name>154/180</name>
- <key>C154_180</key>
- <opt>val:dtv.C154_180</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate4</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBS2' then $framesize2.hide_medium else 'all'</hide>
- <option>
- <name>1/5</name>
- <key>C1_5_MEDIUM</key>
- <opt>val:dtv.C1_5_MEDIUM</opt>
- </option>
- <option>
- <name>11/45</name>
- <key>C11_45_MEDIUM</key>
- <opt>val:dtv.C11_45_MEDIUM</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3_MEDIUM</key>
- <opt>val:dtv.C1_3_MEDIUM</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate5</key>
- <type>enum</type>
- <hide>#if str($standard) == 'STANDARD_DVBS2' then $framesize2.hide_short else 'all'</hide>
- <option>
- <name>1/4</name>
- <key>C1_4</key>
- <opt>val:dtv.C1_4</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>8/9</name>
- <key>C8_9</key>
- <opt>val:dtv.C8_9</opt>
- </option>
- <option>
- <name>11/45</name>
- <key>C11_45</key>
- <opt>val:dtv.C11_45</opt>
- </option>
- <option>
- <name>4/15</name>
- <key>C4_15</key>
- <opt>val:dtv.C4_15</opt>
- </option>
- <option>
- <name>14/45</name>
- <key>C14_45</key>
- <opt>val:dtv.C14_45</opt>
- </option>
- <option>
- <name>7/15</name>
- <key>C7_15</key>
- <opt>val:dtv.C7_15</opt>
- </option>
- <option>
- <name>8/15</name>
- <key>C8_15</key>
- <opt>val:dtv.C8_15</opt>
- </option>
- <option>
- <name>26/45</name>
- <key>C26_45</key>
- <opt>val:dtv.C26_45</opt>
- </option>
- <option>
- <name>32/45</name>
- <key>C32_45</key>
- <opt>val:dtv.C32_45</opt>
- </option>
- <option>
- <name>1/5 VL-SNR SF2</name>
- <key>C1_5_VLSNR_SF2</key>
- <opt>val:dtv.C1_5_VLSNR_SF2</opt>
- </option>
- <option>
- <name>11/45 VL-SNR SF2</name>
- <key>C11_45_VLSNR_SF2</key>
- <opt>val:dtv.C11_45_VLSNR_SF2</opt>
- </option>
- <option>
- <name>1/5 VL-SNR</name>
- <key>C1_5_VLSNR</key>
- <opt>val:dtv.C1_5_VLSNR</opt>
- </option>
- <option>
- <name>4/15 VL-SNR</name>
- <key>C4_15_VLSNR</key>
- <opt>val:dtv.C4_15_VLSNR</opt>
- </option>
- <option>
- <name>1/3 VL-SNR</name>
- <key>C1_3_VLSNR</key>
- <opt>val:dtv.C1_3_VLSNR</opt>
- </option>
- </param>
- <param>
- <name>Constellation</name>
- <key>constellation</key>
- <type>enum</type>
- <hide>$standard.hide_dvbs2</hide>
- <option>
- <name>Other</name>
- <key>MOD_OTHER</key>
- <opt>val:dtv.MOD_OTHER</opt>
- </option>
- <option>
- <name>128APSK</name>
- <key>MOD_128APSK</key>
- <opt>val:dtv.MOD_128APSK</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbs2_interleaver_bb.block.yml b/gr-dtv/grc/dtv_dvbs2_interleaver_bb.block.yml
new file mode 100644
index 000000000..ad9c79c1b
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbs2_interleaver_bb.block.yml
@@ -0,0 +1,86 @@
+id: dtv_dvbs2_interleaver_bb
+label: Interleaver
+
+parameters:
+- id: framesize
+ label: FECFRAME size
+ dtype: enum
+ options: [FECFRAME_NORMAL, FECFRAME_MEDIUM, FECFRAME_SHORT]
+ option_labels: [Normal, Medium, Short]
+ option_attributes:
+ hide_medium: [all, '', all]
+ hide_normal: ['', all, all]
+ hide_short: [all, all, '']
+ val: [dtv.FECFRAME_NORMAL, dtv.FECFRAME_MEDIUM, dtv.FECFRAME_SHORT]
+- id: rate1
+ label: Code rate
+ dtype: enum
+ options: [C1_4, C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6, C8_9, C9_10, C2_9_VLSNR,
+ C13_45, C9_20, C90_180, C96_180, C11_20, C100_180, C104_180, C26_45, C18_30,
+ C28_45, C23_36, C116_180, C20_30, C124_180, C25_36, C128_180, C13_18, C132_180,
+ C22_30, C135_180, C140_180, C7_9, C154_180]
+ option_labels: [1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6, 8/9, 9/10, 2/9 VL-SNR,
+ 13/45, 9/20, 90/180, 96/180, 11/20, 100/180, 104/180, 26/45, 18/30, 28/45,
+ 23/36, 116/180, 20/30, 124/180, 25/36, 128/180, 13/18, 132/180, 22/30, 135/180,
+ 140/180, 7/9, 154/180]
+ option_attributes:
+ val: [dtv.C1_4, dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4,
+ dtv.C4_5, dtv.C5_6, dtv.C8_9, dtv.C9_10, dtv.C2_9_VLSNR, dtv.C13_45, dtv.C9_20,
+ dtv.C90_180, dtv.C96_180, dtv.C11_20, dtv.C100_180, dtv.C104_180, dtv.C26_45,
+ dtv.C18_30, dtv.C28_45, dtv.C23_36, dtv.C116_180, dtv.C20_30, dtv.C124_180,
+ dtv.C25_36, dtv.C128_180, dtv.C13_18, dtv.C132_180, dtv.C22_30, dtv.C135_180,
+ dtv.C140_180, dtv.C7_9, dtv.C154_180]
+ hide: ${ framesize.hide_normal }
+- id: rate2
+ label: Code rate
+ dtype: enum
+ options: [C1_5_MEDIUM, C11_45_MEDIUM, C1_3_MEDIUM]
+ option_labels: [1/5, 11/45, 1/3]
+ option_attributes:
+ val: [dtv.C1_5_MEDIUM, dtv.C11_45_MEDIUM, dtv.C1_3_MEDIUM]
+ hide: ${ framesize.hide_medium }
+- id: rate3
+ label: Code rate
+ dtype: enum
+ options: [C1_4, C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6, C8_9, C11_45,
+ C4_15, C14_45, C7_15, C8_15, C26_45, C32_45, C1_5_VLSNR_SF2, C11_45_VLSNR_SF2,
+ C1_5_VLSNR, C4_15_VLSNR, C1_3_VLSNR]
+ option_labels: [1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6, 8/9, 11/45, 4/15,
+ 14/45, 7/15, 8/15, 26/45, 32/45, 1/5 VL-SNR SF2, 11/45 VL-SNR SF2, 1/5 VL-SNR,
+ 4/15 VL-SNR, 1/3 VL-SNR]
+ option_attributes:
+ val: [dtv.C1_4, dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4,
+ dtv.C4_5, dtv.C5_6, dtv.C8_9, dtv.C11_45, dtv.C4_15, dtv.C14_45, dtv.C7_15,
+ dtv.C8_15, dtv.C26_45, dtv.C32_45, dtv.C1_5_VLSNR_SF2, dtv.C11_45_VLSNR_SF2,
+ dtv.C1_5_VLSNR, dtv.C4_15_VLSNR, dtv.C1_3_VLSNR]
+ hide: ${ framesize.hide_short }
+- id: constellation
+ label: Constellation
+ dtype: enum
+ options: [MOD_QPSK, MOD_8PSK, MOD_8APSK, MOD_16APSK, MOD_8_8APSK, MOD_32APSK,
+ MOD_4_12_16APSK, MOD_4_8_4_16APSK, MOD_64APSK, MOD_8_16_20_20APSK, MOD_4_12_20_28APSK,
+ MOD_128APSK, MOD_256APSK, MOD_BPSK, MOD_BPSK_SF2]
+ option_labels: [QPSK, 8PSK, 8APSK, 16APSK, 8+8APSK, 32APSK, 4+12+16rbAPSK, 4+8+4+16APSK,
+ 64APSK, 8+16+20+20APSK, 4+12+20+28APSK, 128APSK, 256APSK, PI/2 BPSK, PI/2
+ BPSK-SF2]
+ option_attributes:
+ val: [dtv.MOD_QPSK, dtv.MOD_8PSK, dtv.MOD_8APSK, dtv.MOD_16APSK, dtv.MOD_8_8APSK,
+ dtv.MOD_32APSK, dtv.MOD_4_12_16APSK, dtv.MOD_4_8_4_16APSK, dtv.MOD_64APSK,
+ dtv.MOD_8_16_20_20APSK, dtv.MOD_4_12_20_28APSK, dtv.MOD_128APSK, dtv.MOD_256APSK,
+ dtv.MOD_BPSK, dtv.MOD_BPSK_SF2]
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import dtv
+ make: "dtv.dvbs2_interleaver_bb(${framesize.val}, \n% if str(framesize) == 'FECFRAME_NORMAL':\n\
+ ${rate1.val}, \n% elif str(framesize) == 'FECFRAME_MEDIUM':\n${rate2.val},\
+ \ \n% else:\n${rate3.val}, \n% endif\n${constellation.val})"
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbs2_interleaver_bb.xml b/gr-dtv/grc/dtv_dvbs2_interleaver_bb.xml
deleted file mode 100644
index 675f70d26..000000000
--- a/gr-dtv/grc/dtv_dvbs2_interleaver_bb.xml
+++ /dev/null
@@ -1,455 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-S2 Bit Interleaver
-###################################################
- -->
-<block>
- <name>Interleaver</name>
- <key>dtv_dvbs2_interleaver_bb</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbs2_interleaver_bb($framesize.val, #slurp
-#if str($framesize) == 'FECFRAME_NORMAL'
-$rate1.val, #slurp
-#else if str($framesize) == 'FECFRAME_MEDIUM'
-$rate2.val, #slurp
-#else
-$rate3.val, #slurp
-#end if
-$constellation.val)</make>
- <param>
- <name>FECFRAME size</name>
- <key>framesize</key>
- <type>enum</type>
- <option>
- <name>Normal</name>
- <key>FECFRAME_NORMAL</key>
- <opt>val:dtv.FECFRAME_NORMAL</opt>
- <opt>hide_normal:</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:all</opt>
- </option>
- <option>
- <name>Medium</name>
- <key>FECFRAME_MEDIUM</key>
- <opt>val:dtv.FECFRAME_MEDIUM</opt>
- <opt>hide_normal:all</opt>
- <opt>hide_medium:</opt>
- <opt>hide_short:all</opt>
- </option>
- <option>
- <name>Short</name>
- <key>FECFRAME_SHORT</key>
- <opt>val:dtv.FECFRAME_SHORT</opt>
- <opt>hide_normal:all</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate1</key>
- <type>enum</type>
- <hide>$framesize.hide_normal</hide>
- <option>
- <name>1/4</name>
- <key>C1_4</key>
- <opt>val:dtv.C1_4</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>8/9</name>
- <key>C8_9</key>
- <opt>val:dtv.C8_9</opt>
- </option>
- <option>
- <name>9/10</name>
- <key>C9_10</key>
- <opt>val:dtv.C9_10</opt>
- </option>
- <option>
- <name>2/9 VL-SNR</name>
- <key>C2_9_VLSNR</key>
- <opt>val:dtv.C2_9_VLSNR</opt>
- </option>
- <option>
- <name>13/45</name>
- <key>C13_45</key>
- <opt>val:dtv.C13_45</opt>
- </option>
- <option>
- <name>9/20</name>
- <key>C9_20</key>
- <opt>val:dtv.C9_20</opt>
- </option>
- <option>
- <name>90/180</name>
- <key>C90_180</key>
- <opt>val:dtv.C90_180</opt>
- </option>
- <option>
- <name>96/180</name>
- <key>C96_180</key>
- <opt>val:dtv.C96_180</opt>
- </option>
- <option>
- <name>11/20</name>
- <key>C11_20</key>
- <opt>val:dtv.C11_20</opt>
- </option>
- <option>
- <name>100/180</name>
- <key>C100_180</key>
- <opt>val:dtv.C100_180</opt>
- </option>
- <option>
- <name>104/180</name>
- <key>C104_180</key>
- <opt>val:dtv.C104_180</opt>
- </option>
- <option>
- <name>26/45</name>
- <key>C26_45</key>
- <opt>val:dtv.C26_45</opt>
- </option>
- <option>
- <name>18/30</name>
- <key>C18_30</key>
- <opt>val:dtv.C18_30</opt>
- </option>
- <option>
- <name>28/45</name>
- <key>C28_45</key>
- <opt>val:dtv.C28_45</opt>
- </option>
- <option>
- <name>23/36</name>
- <key>C23_36</key>
- <opt>val:dtv.C23_36</opt>
- </option>
- <option>
- <name>116/180</name>
- <key>C116_180</key>
- <opt>val:dtv.C116_180</opt>
- </option>
- <option>
- <name>20/30</name>
- <key>C20_30</key>
- <opt>val:dtv.C20_30</opt>
- </option>
- <option>
- <name>124/180</name>
- <key>C124_180</key>
- <opt>val:dtv.C124_180</opt>
- </option>
- <option>
- <name>25/36</name>
- <key>C25_36</key>
- <opt>val:dtv.C25_36</opt>
- </option>
- <option>
- <name>128/180</name>
- <key>C128_180</key>
- <opt>val:dtv.C128_180</opt>
- </option>
- <option>
- <name>13/18</name>
- <key>C13_18</key>
- <opt>val:dtv.C13_18</opt>
- </option>
- <option>
- <name>132/180</name>
- <key>C132_180</key>
- <opt>val:dtv.C132_180</opt>
- </option>
- <option>
- <name>22/30</name>
- <key>C22_30</key>
- <opt>val:dtv.C22_30</opt>
- </option>
- <option>
- <name>135/180</name>
- <key>C135_180</key>
- <opt>val:dtv.C135_180</opt>
- </option>
- <option>
- <name>140/180</name>
- <key>C140_180</key>
- <opt>val:dtv.C140_180</opt>
- </option>
- <option>
- <name>7/9</name>
- <key>C7_9</key>
- <opt>val:dtv.C7_9</opt>
- </option>
- <option>
- <name>154/180</name>
- <key>C154_180</key>
- <opt>val:dtv.C154_180</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate2</key>
- <type>enum</type>
- <hide>$framesize.hide_medium</hide>
- <option>
- <name>1/5</name>
- <key>C1_5_MEDIUM</key>
- <opt>val:dtv.C1_5_MEDIUM</opt>
- </option>
- <option>
- <name>11/45</name>
- <key>C11_45_MEDIUM</key>
- <opt>val:dtv.C11_45_MEDIUM</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3_MEDIUM</key>
- <opt>val:dtv.C1_3_MEDIUM</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate3</key>
- <type>enum</type>
- <hide>$framesize.hide_short</hide>
- <option>
- <name>1/4</name>
- <key>C1_4</key>
- <opt>val:dtv.C1_4</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>8/9</name>
- <key>C8_9</key>
- <opt>val:dtv.C8_9</opt>
- </option>
- <option>
- <name>11/45</name>
- <key>C11_45</key>
- <opt>val:dtv.C11_45</opt>
- </option>
- <option>
- <name>4/15</name>
- <key>C4_15</key>
- <opt>val:dtv.C4_15</opt>
- </option>
- <option>
- <name>14/45</name>
- <key>C14_45</key>
- <opt>val:dtv.C14_45</opt>
- </option>
- <option>
- <name>7/15</name>
- <key>C7_15</key>
- <opt>val:dtv.C7_15</opt>
- </option>
- <option>
- <name>8/15</name>
- <key>C8_15</key>
- <opt>val:dtv.C8_15</opt>
- </option>
- <option>
- <name>26/45</name>
- <key>C26_45</key>
- <opt>val:dtv.C26_45</opt>
- </option>
- <option>
- <name>32/45</name>
- <key>C32_45</key>
- <opt>val:dtv.C32_45</opt>
- </option>
- <option>
- <name>1/5 VL-SNR SF2</name>
- <key>C1_5_VLSNR_SF2</key>
- <opt>val:dtv.C1_5_VLSNR_SF2</opt>
- </option>
- <option>
- <name>11/45 VL-SNR SF2</name>
- <key>C11_45_VLSNR_SF2</key>
- <opt>val:dtv.C11_45_VLSNR_SF2</opt>
- </option>
- <option>
- <name>1/5 VL-SNR</name>
- <key>C1_5_VLSNR</key>
- <opt>val:dtv.C1_5_VLSNR</opt>
- </option>
- <option>
- <name>4/15 VL-SNR</name>
- <key>C4_15_VLSNR</key>
- <opt>val:dtv.C4_15_VLSNR</opt>
- </option>
- <option>
- <name>1/3 VL-SNR</name>
- <key>C1_3_VLSNR</key>
- <opt>val:dtv.C1_3_VLSNR</opt>
- </option>
- </param>
- <param>
- <name>Constellation</name>
- <key>constellation</key>
- <type>enum</type>
- <option>
- <name>QPSK</name>
- <key>MOD_QPSK</key>
- <opt>val:dtv.MOD_QPSK</opt>
- </option>
- <option>
- <name>8PSK</name>
- <key>MOD_8PSK</key>
- <opt>val:dtv.MOD_8PSK</opt>
- </option>
- <option>
- <name>8APSK</name>
- <key>MOD_8APSK</key>
- <opt>val:dtv.MOD_8APSK</opt>
- </option>
- <option>
- <name>16APSK</name>
- <key>MOD_16APSK</key>
- <opt>val:dtv.MOD_16APSK</opt>
- </option>
- <option>
- <name>8+8APSK</name>
- <key>MOD_8_8APSK</key>
- <opt>val:dtv.MOD_8_8APSK</opt>
- </option>
- <option>
- <name>32APSK</name>
- <key>MOD_32APSK</key>
- <opt>val:dtv.MOD_32APSK</opt>
- </option>
- <option>
- <name>4+12+16rbAPSK</name>
- <key>MOD_4_12_16APSK</key>
- <opt>val:dtv.MOD_4_12_16APSK</opt>
- </option>
- <option>
- <name>4+8+4+16APSK</name>
- <key>MOD_4_8_4_16APSK</key>
- <opt>val:dtv.MOD_4_8_4_16APSK</opt>
- </option>
- <option>
- <name>64APSK</name>
- <key>MOD_64APSK</key>
- <opt>val:dtv.MOD_64APSK</opt>
- </option>
- <option>
- <name>8+16+20+20APSK</name>
- <key>MOD_8_16_20_20APSK</key>
- <opt>val:dtv.MOD_8_16_20_20APSK</opt>
- </option>
- <option>
- <name>4+12+20+28APSK</name>
- <key>MOD_4_12_20_28APSK</key>
- <opt>val:dtv.MOD_4_12_20_28APSK</opt>
- </option>
- <option>
- <name>128APSK</name>
- <key>MOD_128APSK</key>
- <opt>val:dtv.MOD_128APSK</opt>
- </option>
- <option>
- <name>256APSK</name>
- <key>MOD_256APSK</key>
- <opt>val:dtv.MOD_256APSK</opt>
- </option>
- <option>
- <name>PI/2 BPSK</name>
- <key>MOD_BPSK</key>
- <opt>val:dtv.MOD_BPSK</opt>
- </option>
- <option>
- <name>PI/2 BPSK-SF2</name>
- <key>MOD_BPSK_SF2</key>
- <opt>val:dtv.MOD_BPSK_SF2</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbs2_modulator_bc.block.yml b/gr-dtv/grc/dtv_dvbs2_modulator_bc.block.yml
new file mode 100644
index 000000000..07d6cd58f
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbs2_modulator_bc.block.yml
@@ -0,0 +1,102 @@
+id: dtv_dvbs2_modulator_bc
+label: DVB-S2X Modulator
+
+parameters:
+- id: framesize
+ label: FECFRAME size
+ dtype: enum
+ options: [FECFRAME_NORMAL, FECFRAME_MEDIUM, FECFRAME_SHORT]
+ option_labels: [Normal, Medium, Short]
+ option_attributes:
+ hide_medium: [all, '', all]
+ hide_normal: ['', all, all]
+ hide_short: [all, all, '']
+ val: [dtv.FECFRAME_NORMAL, dtv.FECFRAME_MEDIUM, dtv.FECFRAME_SHORT]
+ hide: ${ constellation.hide_dvb }
+- id: rate1
+ label: Code rate
+ dtype: enum
+ options: [C1_4, C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6, C8_9, C9_10, C2_9_VLSNR,
+ C13_45, C9_20, C90_180, C96_180, C11_20, C100_180, C104_180, C26_45, C18_30,
+ C28_45, C23_36, C116_180, C20_30, C124_180, C25_36, C128_180, C13_18, C132_180,
+ C22_30, C135_180, C140_180, C7_9, C154_180]
+ option_labels: [1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6, 8/9, 9/10, 2/9 VL-SNR,
+ 13/45, 9/20, 90/180, 96/180, 11/20, 100/180, 104/180, 26/45, 18/30, 28/45,
+ 23/36, 116/180, 20/30, 124/180, 25/36, 128/180, 13/18, 132/180, 22/30, 135/180,
+ 140/180, 7/9, 154/180]
+ option_attributes:
+ val: [dtv.C1_4, dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4,
+ dtv.C4_5, dtv.C5_6, dtv.C8_9, dtv.C9_10, dtv.C2_9_VLSNR, dtv.C13_45, dtv.C9_20,
+ dtv.C90_180, dtv.C96_180, dtv.C11_20, dtv.C100_180, dtv.C104_180, dtv.C26_45,
+ dtv.C18_30, dtv.C28_45, dtv.C23_36, dtv.C116_180, dtv.C20_30, dtv.C124_180,
+ dtv.C25_36, dtv.C128_180, dtv.C13_18, dtv.C132_180, dtv.C22_30, dtv.C135_180,
+ dtv.C140_180, dtv.C7_9, dtv.C154_180]
+ hide: ${ (constellation.hide_dvb if str(constellation) == 'MOD_8VSB' or str(constellation)
+ == 'MOD_64QAM' or str(constellation) == 'MOD_256QAM' else framesize.hide_normal)
+ }
+- id: rate2
+ label: Code rate
+ dtype: enum
+ options: [C1_5_MEDIUM, C11_45_MEDIUM, C1_3_MEDIUM]
+ option_labels: [1/5, 11/45, 1/3]
+ option_attributes:
+ val: [dtv.C1_5_MEDIUM, dtv.C11_45_MEDIUM, dtv.C1_3_MEDIUM]
+ hide: ${ (constellation.hide_dvb if str(constellation) == 'MOD_8VSB' or str(constellation)
+ == 'MOD_64QAM' or str(constellation) == 'MOD_256QAM' else framesize.hide_medium)
+ }
+- id: rate3
+ label: Code rate
+ dtype: enum
+ options: [C1_4, C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6, C8_9, C11_45,
+ C4_15, C14_45, C7_15, C8_15, C26_45, C32_45, C1_5_VLSNR_SF2, C11_45_VLSNR_SF2,
+ C1_5_VLSNR, C4_15_VLSNR, C1_3_VLSNR]
+ option_labels: [1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6, 8/9, 11/45, 4/15,
+ 14/45, 7/15, 8/15, 26/45, 32/45, 1/5 VL-SNR SF2, 11/45 VL-SNR SF2, 1/5 VL-SNR,
+ 4/15 VL-SNR, 1/3 VL-SNR]
+ option_attributes:
+ val: [dtv.C1_4, dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4,
+ dtv.C4_5, dtv.C5_6, dtv.C8_9, dtv.C11_45, dtv.C4_15, dtv.C14_45, dtv.C7_15,
+ dtv.C8_15, dtv.C26_45, dtv.C32_45, dtv.C1_5_VLSNR_SF2, dtv.C11_45_VLSNR_SF2,
+ dtv.C1_5_VLSNR, dtv.C4_15_VLSNR, dtv.C1_3_VLSNR]
+ hide: ${ (constellation.hide_dvb if str(constellation) == 'MOD_8VSB' or str(constellation)
+ == 'MOD_64QAM' or str(constellation) == 'MOD_256QAM' else framesize.hide_short)
+ }
+- id: constellation
+ label: Constellation
+ dtype: enum
+ options: [MOD_QPSK, MOD_8PSK, MOD_8APSK, MOD_16APSK, MOD_8_8APSK, MOD_32APSK,
+ MOD_4_12_16APSK, MOD_4_8_4_16APSK, MOD_64APSK, MOD_8_16_20_20APSK, MOD_4_12_20_28APSK,
+ MOD_128APSK, MOD_256APSK, MOD_64QAM, MOD_256QAM, MOD_BPSK, MOD_BPSK_SF2, MOD_8VSB]
+ option_labels: [QPSK, 8PSK, 8APSK, 16APSK, 8+8APSK, 32APSK, 4+12+16rbAPSK, 4+8+4+16APSK,
+ 64APSK, 8+16+20+20APSK, 4+12+20+28APSK, 128APSK, 256APSK, 64QAM (ITU-T J.83B),
+ 256QAM (ITU-T J.83B), PI/2 BPSK, PI/2 BPSK-SF2, 8VSB (ATSC)]
+ option_attributes:
+ hide_dvb: ['', '', '', '', '', '', '', '', '', '', '', '', '', all, all, '',
+ '', all]
+ val: [dtv.MOD_QPSK, dtv.MOD_8PSK, dtv.MOD_8APSK, dtv.MOD_16APSK, dtv.MOD_8_8APSK,
+ dtv.MOD_32APSK, dtv.MOD_4_12_16APSK, dtv.MOD_4_8_4_16APSK, dtv.MOD_64APSK,
+ dtv.MOD_8_16_20_20APSK, dtv.MOD_4_12_20_28APSK, dtv.MOD_128APSK, dtv.MOD_256APSK,
+ dtv.MOD_64QAM, dtv.MOD_256QAM, dtv.MOD_BPSK, dtv.MOD_BPSK_SF2, dtv.MOD_8VSB]
+- id: interpolation
+ label: 2X Interpolation
+ dtype: enum
+ options: [INTERPOLATION_OFF, INTERPOLATION_ON]
+ option_labels: ['Off', 'On']
+ option_attributes:
+ val: [dtv.INTERPOLATION_OFF, dtv.INTERPOLATION_ON]
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import dtv
+ make: "dtv.dvbs2_modulator_bc(${framesize.val},\n% if str(framesize) == 'FECFRAME_NORMAL':\n\
+ ${rate1.val}, \n% elif str(framesize) == 'FECFRAME_MEDIUM':\n${rate2.val},\
+ \ \n% else:\n${rate3.val}, \n% endif\n${constellation.val}, ${interpolation.val})"
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbs2_modulator_bc.xml b/gr-dtv/grc/dtv_dvbs2_modulator_bc.xml
deleted file mode 100644
index d6b9f1004..000000000
--- a/gr-dtv/grc/dtv_dvbs2_modulator_bc.xml
+++ /dev/null
@@ -1,504 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-S2X Modulator
-###################################################
- -->
-<block>
- <name>DVB-S2X Modulator</name>
- <key>dtv_dvbs2_modulator_bc</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbs2_modulator_bc($framesize.val,
-#if str($framesize) == 'FECFRAME_NORMAL'
-$rate1.val, #slurp
-#else if str($framesize) == 'FECFRAME_MEDIUM'
-$rate2.val, #slurp
-#else
-$rate3.val, #slurp
-#end if
-$constellation.val, $interpolation.val)</make>
- <param>
- <name>FECFRAME size</name>
- <key>framesize</key>
- <type>enum</type>
- <hide>$constellation.hide_dvb</hide>
- <option>
- <name>Normal</name>
- <key>FECFRAME_NORMAL</key>
- <opt>val:dtv.FECFRAME_NORMAL</opt>
- <opt>hide_normal:</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:all</opt>
- </option>
- <option>
- <name>Medium</name>
- <key>FECFRAME_MEDIUM</key>
- <opt>val:dtv.FECFRAME_MEDIUM</opt>
- <opt>hide_normal:all</opt>
- <opt>hide_medium:</opt>
- <opt>hide_short:all</opt>
- </option>
- <option>
- <name>Short</name>
- <key>FECFRAME_SHORT</key>
- <opt>val:dtv.FECFRAME_SHORT</opt>
- <opt>hide_normal:all</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate1</key>
- <type>enum</type>
- <hide>#if str($constellation) == 'MOD_8VSB' or str($constellation) == 'MOD_64QAM' or str($constellation) == 'MOD_256QAM' then $constellation.hide_dvb else $framesize.hide_normal</hide>
- <option>
- <name>1/4</name>
- <key>C1_4</key>
- <opt>val:dtv.C1_4</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>8/9</name>
- <key>C8_9</key>
- <opt>val:dtv.C8_9</opt>
- </option>
- <option>
- <name>9/10</name>
- <key>C9_10</key>
- <opt>val:dtv.C9_10</opt>
- </option>
- <option>
- <name>2/9 VL-SNR</name>
- <key>C2_9_VLSNR</key>
- <opt>val:dtv.C2_9_VLSNR</opt>
- </option>
- <option>
- <name>13/45</name>
- <key>C13_45</key>
- <opt>val:dtv.C13_45</opt>
- </option>
- <option>
- <name>9/20</name>
- <key>C9_20</key>
- <opt>val:dtv.C9_20</opt>
- </option>
- <option>
- <name>90/180</name>
- <key>C90_180</key>
- <opt>val:dtv.C90_180</opt>
- </option>
- <option>
- <name>96/180</name>
- <key>C96_180</key>
- <opt>val:dtv.C96_180</opt>
- </option>
- <option>
- <name>11/20</name>
- <key>C11_20</key>
- <opt>val:dtv.C11_20</opt>
- </option>
- <option>
- <name>100/180</name>
- <key>C100_180</key>
- <opt>val:dtv.C100_180</opt>
- </option>
- <option>
- <name>104/180</name>
- <key>C104_180</key>
- <opt>val:dtv.C104_180</opt>
- </option>
- <option>
- <name>26/45</name>
- <key>C26_45</key>
- <opt>val:dtv.C26_45</opt>
- </option>
- <option>
- <name>18/30</name>
- <key>C18_30</key>
- <opt>val:dtv.C18_30</opt>
- </option>
- <option>
- <name>28/45</name>
- <key>C28_45</key>
- <opt>val:dtv.C28_45</opt>
- </option>
- <option>
- <name>23/36</name>
- <key>C23_36</key>
- <opt>val:dtv.C23_36</opt>
- </option>
- <option>
- <name>116/180</name>
- <key>C116_180</key>
- <opt>val:dtv.C116_180</opt>
- </option>
- <option>
- <name>20/30</name>
- <key>C20_30</key>
- <opt>val:dtv.C20_30</opt>
- </option>
- <option>
- <name>124/180</name>
- <key>C124_180</key>
- <opt>val:dtv.C124_180</opt>
- </option>
- <option>
- <name>25/36</name>
- <key>C25_36</key>
- <opt>val:dtv.C25_36</opt>
- </option>
- <option>
- <name>128/180</name>
- <key>C128_180</key>
- <opt>val:dtv.C128_180</opt>
- </option>
- <option>
- <name>13/18</name>
- <key>C13_18</key>
- <opt>val:dtv.C13_18</opt>
- </option>
- <option>
- <name>132/180</name>
- <key>C132_180</key>
- <opt>val:dtv.C132_180</opt>
- </option>
- <option>
- <name>22/30</name>
- <key>C22_30</key>
- <opt>val:dtv.C22_30</opt>
- </option>
- <option>
- <name>135/180</name>
- <key>C135_180</key>
- <opt>val:dtv.C135_180</opt>
- </option>
- <option>
- <name>140/180</name>
- <key>C140_180</key>
- <opt>val:dtv.C140_180</opt>
- </option>
- <option>
- <name>7/9</name>
- <key>C7_9</key>
- <opt>val:dtv.C7_9</opt>
- </option>
- <option>
- <name>154/180</name>
- <key>C154_180</key>
- <opt>val:dtv.C154_180</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate2</key>
- <type>enum</type>
- <hide>#if str($constellation) == 'MOD_8VSB' or str($constellation) == 'MOD_64QAM' or str($constellation) == 'MOD_256QAM' then $constellation.hide_dvb else $framesize.hide_medium</hide>
- <option>
- <name>1/5</name>
- <key>C1_5_MEDIUM</key>
- <opt>val:dtv.C1_5_MEDIUM</opt>
- </option>
- <option>
- <name>11/45</name>
- <key>C11_45_MEDIUM</key>
- <opt>val:dtv.C11_45_MEDIUM</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3_MEDIUM</key>
- <opt>val:dtv.C1_3_MEDIUM</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate3</key>
- <type>enum</type>
- <hide>#if str($constellation) == 'MOD_8VSB' or str($constellation) == 'MOD_64QAM' or str($constellation) == 'MOD_256QAM' then $constellation.hide_dvb else $framesize.hide_short</hide>
- <option>
- <name>1/4</name>
- <key>C1_4</key>
- <opt>val:dtv.C1_4</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>8/9</name>
- <key>C8_9</key>
- <opt>val:dtv.C8_9</opt>
- </option>
- <option>
- <name>11/45</name>
- <key>C11_45</key>
- <opt>val:dtv.C11_45</opt>
- </option>
- <option>
- <name>4/15</name>
- <key>C4_15</key>
- <opt>val:dtv.C4_15</opt>
- </option>
- <option>
- <name>14/45</name>
- <key>C14_45</key>
- <opt>val:dtv.C14_45</opt>
- </option>
- <option>
- <name>7/15</name>
- <key>C7_15</key>
- <opt>val:dtv.C7_15</opt>
- </option>
- <option>
- <name>8/15</name>
- <key>C8_15</key>
- <opt>val:dtv.C8_15</opt>
- </option>
- <option>
- <name>26/45</name>
- <key>C26_45</key>
- <opt>val:dtv.C26_45</opt>
- </option>
- <option>
- <name>32/45</name>
- <key>C32_45</key>
- <opt>val:dtv.C32_45</opt>
- </option>
- <option>
- <name>1/5 VL-SNR SF2</name>
- <key>C1_5_VLSNR_SF2</key>
- <opt>val:dtv.C1_5_VLSNR_SF2</opt>
- </option>
- <option>
- <name>11/45 VL-SNR SF2</name>
- <key>C11_45_VLSNR_SF2</key>
- <opt>val:dtv.C11_45_VLSNR_SF2</opt>
- </option>
- <option>
- <name>1/5 VL-SNR</name>
- <key>C1_5_VLSNR</key>
- <opt>val:dtv.C1_5_VLSNR</opt>
- </option>
- <option>
- <name>4/15 VL-SNR</name>
- <key>C4_15_VLSNR</key>
- <opt>val:dtv.C4_15_VLSNR</opt>
- </option>
- <option>
- <name>1/3 VL-SNR</name>
- <key>C1_3_VLSNR</key>
- <opt>val:dtv.C1_3_VLSNR</opt>
- </option>
- </param>
- <param>
- <name>Constellation</name>
- <key>constellation</key>
- <type>enum</type>
- <option>
- <name>QPSK</name>
- <key>MOD_QPSK</key>
- <opt>val:dtv.MOD_QPSK</opt>
- <opt>hide_dvb:</opt>
- </option>
- <option>
- <name>8PSK</name>
- <key>MOD_8PSK</key>
- <opt>val:dtv.MOD_8PSK</opt>
- <opt>hide_dvb:</opt>
- </option>
- <option>
- <name>8APSK</name>
- <key>MOD_8APSK</key>
- <opt>val:dtv.MOD_8APSK</opt>
- <opt>hide_dvb:</opt>
- </option>
- <option>
- <name>16APSK</name>
- <key>MOD_16APSK</key>
- <opt>val:dtv.MOD_16APSK</opt>
- <opt>hide_dvb:</opt>
- </option>
- <option>
- <name>8+8APSK</name>
- <key>MOD_8_8APSK</key>
- <opt>val:dtv.MOD_8_8APSK</opt>
- <opt>hide_dvb:</opt>
- </option>
- <option>
- <name>32APSK</name>
- <key>MOD_32APSK</key>
- <opt>val:dtv.MOD_32APSK</opt>
- <opt>hide_dvb:</opt>
- </option>
- <option>
- <name>4+12+16rbAPSK</name>
- <key>MOD_4_12_16APSK</key>
- <opt>val:dtv.MOD_4_12_16APSK</opt>
- <opt>hide_dvb:</opt>
- </option>
- <option>
- <name>4+8+4+16APSK</name>
- <key>MOD_4_8_4_16APSK</key>
- <opt>val:dtv.MOD_4_8_4_16APSK</opt>
- <opt>hide_dvb:</opt>
- </option>
- <option>
- <name>64APSK</name>
- <key>MOD_64APSK</key>
- <opt>val:dtv.MOD_64APSK</opt>
- <opt>hide_dvb:</opt>
- </option>
- <option>
- <name>8+16+20+20APSK</name>
- <key>MOD_8_16_20_20APSK</key>
- <opt>val:dtv.MOD_8_16_20_20APSK</opt>
- <opt>hide_dvb:</opt>
- </option>
- <option>
- <name>4+12+20+28APSK</name>
- <key>MOD_4_12_20_28APSK</key>
- <opt>val:dtv.MOD_4_12_20_28APSK</opt>
- <opt>hide_dvb:</opt>
- </option>
- <option>
- <name>128APSK</name>
- <key>MOD_128APSK</key>
- <opt>val:dtv.MOD_128APSK</opt>
- <opt>hide_dvb:</opt>
- </option>
- <option>
- <name>256APSK</name>
- <key>MOD_256APSK</key>
- <opt>val:dtv.MOD_256APSK</opt>
- <opt>hide_dvb:</opt>
- </option>
- <option>
- <name>64QAM (ITU-T J.83B)</name>
- <key>MOD_64QAM</key>
- <opt>val:dtv.MOD_64QAM</opt>
- <opt>hide_dvb:all</opt>
- </option>
- <option>
- <name>256QAM (ITU-T J.83B)</name>
- <key>MOD_256QAM</key>
- <opt>val:dtv.MOD_256QAM</opt>
- <opt>hide_dvb:all</opt>
- </option>
- <option>
- <name>PI/2 BPSK</name>
- <key>MOD_BPSK</key>
- <opt>val:dtv.MOD_BPSK</opt>
- <opt>hide_dvb:</opt>
- </option>
- <option>
- <name>PI/2 BPSK-SF2</name>
- <key>MOD_BPSK_SF2</key>
- <opt>val:dtv.MOD_BPSK_SF2</opt>
- <opt>hide_dvb:</opt>
- </option>
- <option>
- <name>8VSB (ATSC)</name>
- <key>MOD_8VSB</key>
- <opt>val:dtv.MOD_8VSB</opt>
- <opt>hide_dvb:all</opt>
- </option>
- </param>
- <param>
- <name>2X Interpolation</name>
- <key>interpolation</key>
- <type>enum</type>
- <option>
- <name>Off</name>
- <key>INTERPOLATION_OFF</key>
- <opt>val:dtv.INTERPOLATION_OFF</opt>
- </option>
- <option>
- <name>On</name>
- <key>INTERPOLATION_ON</key>
- <opt>val:dtv.INTERPOLATION_ON</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbs2_physical_cc.block.yml b/gr-dtv/grc/dtv_dvbs2_physical_cc.block.yml
new file mode 100644
index 000000000..261b2f6b0
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbs2_physical_cc.block.yml
@@ -0,0 +1,98 @@
+id: dtv_dvbs2_physical_cc
+label: Physical Layer Framer
+
+parameters:
+- id: framesize
+ label: FECFRAME size
+ dtype: enum
+ options: [FECFRAME_NORMAL, FECFRAME_MEDIUM, FECFRAME_SHORT]
+ option_labels: [Normal, Medium, Short]
+ option_attributes:
+ hide_medium: [all, '', all]
+ hide_normal: ['', all, all]
+ hide_short: [all, all, '']
+ val: [dtv.FECFRAME_NORMAL, dtv.FECFRAME_MEDIUM, dtv.FECFRAME_SHORT]
+- id: rate1
+ label: Code rate
+ dtype: enum
+ options: [C1_4, C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6, C8_9, C9_10, C2_9_VLSNR,
+ C13_45, C9_20, C90_180, C96_180, C11_20, C100_180, C104_180, C26_45, C18_30,
+ C28_45, C23_36, C116_180, C20_30, C124_180, C25_36, C128_180, C13_18, C132_180,
+ C22_30, C135_180, C140_180, C7_9, C154_180]
+ option_labels: [1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6, 8/9, 9/10, 2/9 VL-SNR,
+ 13/45, 9/20, 90/180, 96/180, 11/20, 100/180, 104/180, 26/45, 18/30, 28/45,
+ 23/36, 116/180, 20/30, 124/180, 25/36, 128/180, 13/18, 132/180, 22/30, 135/180,
+ 140/180, 7/9, 154/180]
+ option_attributes:
+ val: [dtv.C1_4, dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4,
+ dtv.C4_5, dtv.C5_6, dtv.C8_9, dtv.C9_10, dtv.C2_9_VLSNR, dtv.C13_45, dtv.C9_20,
+ dtv.C90_180, dtv.C96_180, dtv.C11_20, dtv.C100_180, dtv.C104_180, dtv.C26_45,
+ dtv.C18_30, dtv.C28_45, dtv.C23_36, dtv.C116_180, dtv.C20_30, dtv.C124_180,
+ dtv.C25_36, dtv.C128_180, dtv.C13_18, dtv.C132_180, dtv.C22_30, dtv.C135_180,
+ dtv.C140_180, dtv.C7_9, dtv.C154_180]
+ hide: ${ framesize.hide_normal }
+- id: rate2
+ label: Code rate
+ dtype: enum
+ options: [C1_5_MEDIUM, C11_45_MEDIUM, C1_3_MEDIUM]
+ option_labels: [1/5, 11/45, 1/3]
+ option_attributes:
+ val: [dtv.C1_5_MEDIUM, dtv.C11_45_MEDIUM, dtv.C1_3_MEDIUM]
+ hide: ${ framesize.hide_medium }
+- id: rate3
+ label: Code rate
+ dtype: enum
+ options: [C1_4, C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6, C8_9, C11_45,
+ C4_15, C14_45, C7_15, C8_15, C26_45, C32_45, C1_5_VLSNR_SF2, C11_45_VLSNR_SF2,
+ C1_5_VLSNR, C4_15_VLSNR, C1_3_VLSNR]
+ option_labels: [1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6, 8/9, 11/45, 4/15,
+ 14/45, 7/15, 8/15, 26/45, 32/45, 1/5 VL-SNR SF2, 11/45 VL-SNR SF2, 1/5 VL-SNR,
+ 4/15 VL-SNR, 1/3 VL-SNR]
+ option_attributes:
+ val: [dtv.C1_4, dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4,
+ dtv.C4_5, dtv.C5_6, dtv.C8_9, dtv.C11_45, dtv.C4_15, dtv.C14_45, dtv.C7_15,
+ dtv.C8_15, dtv.C26_45, dtv.C32_45, dtv.C1_5_VLSNR_SF2, dtv.C11_45_VLSNR_SF2,
+ dtv.C1_5_VLSNR, dtv.C4_15_VLSNR, dtv.C1_3_VLSNR]
+ hide: ${ framesize.hide_short }
+- id: constellation
+ label: Constellation
+ dtype: enum
+ options: [MOD_QPSK, MOD_8PSK, MOD_8APSK, MOD_16APSK, MOD_8_8APSK, MOD_32APSK,
+ MOD_4_12_16APSK, MOD_4_8_4_16APSK, MOD_64APSK, MOD_8_16_20_20APSK, MOD_4_12_20_28APSK,
+ MOD_128APSK, MOD_256APSK, MOD_BPSK, MOD_BPSK_SF2]
+ option_labels: [QPSK, 8PSK, 8APSK, 16APSK, 8+8APSK, 32APSK, 4+12+16rbAPSK, 4+8+4+16APSK,
+ 64APSK, 8+16+20+20APSK, 4+12+20+28APSK, 128APSK, 256APSK, PI/2 BPSK, PI/2
+ BPSK-SF2]
+ option_attributes:
+ val: [dtv.MOD_QPSK, dtv.MOD_8PSK, dtv.MOD_8APSK, dtv.MOD_16APSK, dtv.MOD_8_8APSK,
+ dtv.MOD_32APSK, dtv.MOD_4_12_16APSK, dtv.MOD_4_8_4_16APSK, dtv.MOD_64APSK,
+ dtv.MOD_8_16_20_20APSK, dtv.MOD_4_12_20_28APSK, dtv.MOD_128APSK, dtv.MOD_256APSK,
+ dtv.MOD_BPSK, dtv.MOD_BPSK_SF2]
+- id: pilots
+ label: Pilots
+ dtype: enum
+ options: [PILOTS_OFF, PILOTS_ON]
+ option_labels: ['Off', 'On']
+ option_attributes:
+ val: [dtv.PILOTS_OFF, dtv.PILOTS_ON]
+- id: goldcode
+ label: Gold Code
+ dtype: int
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import dtv
+ make: "dtv.dvbs2_physical_cc(${framesize.val}, \n% if str(framesize) == 'FECFRAME_NORMAL':\n\
+ ${rate1.val}, \n% elif str(framesize) == 'FECFRAME_MEDIUM':\n${rate2.val},\
+ \ \n% else:\n${rate3.val}, \n% endif\n${constellation.val}, ${pilots.val},\
+ \ ${goldcode})"
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbs2_physical_cc.xml b/gr-dtv/grc/dtv_dvbs2_physical_cc.xml
deleted file mode 100644
index 91d03ae9a..000000000
--- a/gr-dtv/grc/dtv_dvbs2_physical_cc.xml
+++ /dev/null
@@ -1,476 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-S2 Physical Layer Framer
-###################################################
- -->
-<block>
- <name>Physical Layer Framer</name>
- <key>dtv_dvbs2_physical_cc</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbs2_physical_cc($framesize.val, #slurp
-#if str($framesize) == 'FECFRAME_NORMAL'
-$rate1.val, #slurp
-#else if str($framesize) == 'FECFRAME_MEDIUM'
-$rate2.val, #slurp
-#else
-$rate3.val, #slurp
-#end if
-$constellation.val, $pilots.val, $goldcode)</make>
- <param>
- <name>FECFRAME size</name>
- <key>framesize</key>
- <type>enum</type>
- <option>
- <name>Normal</name>
- <key>FECFRAME_NORMAL</key>
- <opt>val:dtv.FECFRAME_NORMAL</opt>
- <opt>hide_normal:</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:all</opt>
- </option>
- <option>
- <name>Medium</name>
- <key>FECFRAME_MEDIUM</key>
- <opt>val:dtv.FECFRAME_MEDIUM</opt>
- <opt>hide_normal:all</opt>
- <opt>hide_medium:</opt>
- <opt>hide_short:all</opt>
- </option>
- <option>
- <name>Short</name>
- <key>FECFRAME_SHORT</key>
- <opt>val:dtv.FECFRAME_SHORT</opt>
- <opt>hide_normal:all</opt>
- <opt>hide_medium:all</opt>
- <opt>hide_short:</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate1</key>
- <type>enum</type>
- <hide>$framesize.hide_normal</hide>
- <option>
- <name>1/4</name>
- <key>C1_4</key>
- <opt>val:dtv.C1_4</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>8/9</name>
- <key>C8_9</key>
- <opt>val:dtv.C8_9</opt>
- </option>
- <option>
- <name>9/10</name>
- <key>C9_10</key>
- <opt>val:dtv.C9_10</opt>
- </option>
- <option>
- <name>2/9 VL-SNR</name>
- <key>C2_9_VLSNR</key>
- <opt>val:dtv.C2_9_VLSNR</opt>
- </option>
- <option>
- <name>13/45</name>
- <key>C13_45</key>
- <opt>val:dtv.C13_45</opt>
- </option>
- <option>
- <name>9/20</name>
- <key>C9_20</key>
- <opt>val:dtv.C9_20</opt>
- </option>
- <option>
- <name>90/180</name>
- <key>C90_180</key>
- <opt>val:dtv.C90_180</opt>
- </option>
- <option>
- <name>96/180</name>
- <key>C96_180</key>
- <opt>val:dtv.C96_180</opt>
- </option>
- <option>
- <name>11/20</name>
- <key>C11_20</key>
- <opt>val:dtv.C11_20</opt>
- </option>
- <option>
- <name>100/180</name>
- <key>C100_180</key>
- <opt>val:dtv.C100_180</opt>
- </option>
- <option>
- <name>104/180</name>
- <key>C104_180</key>
- <opt>val:dtv.C104_180</opt>
- </option>
- <option>
- <name>26/45</name>
- <key>C26_45</key>
- <opt>val:dtv.C26_45</opt>
- </option>
- <option>
- <name>18/30</name>
- <key>C18_30</key>
- <opt>val:dtv.C18_30</opt>
- </option>
- <option>
- <name>28/45</name>
- <key>C28_45</key>
- <opt>val:dtv.C28_45</opt>
- </option>
- <option>
- <name>23/36</name>
- <key>C23_36</key>
- <opt>val:dtv.C23_36</opt>
- </option>
- <option>
- <name>116/180</name>
- <key>C116_180</key>
- <opt>val:dtv.C116_180</opt>
- </option>
- <option>
- <name>20/30</name>
- <key>C20_30</key>
- <opt>val:dtv.C20_30</opt>
- </option>
- <option>
- <name>124/180</name>
- <key>C124_180</key>
- <opt>val:dtv.C124_180</opt>
- </option>
- <option>
- <name>25/36</name>
- <key>C25_36</key>
- <opt>val:dtv.C25_36</opt>
- </option>
- <option>
- <name>128/180</name>
- <key>C128_180</key>
- <opt>val:dtv.C128_180</opt>
- </option>
- <option>
- <name>13/18</name>
- <key>C13_18</key>
- <opt>val:dtv.C13_18</opt>
- </option>
- <option>
- <name>132/180</name>
- <key>C132_180</key>
- <opt>val:dtv.C132_180</opt>
- </option>
- <option>
- <name>22/30</name>
- <key>C22_30</key>
- <opt>val:dtv.C22_30</opt>
- </option>
- <option>
- <name>135/180</name>
- <key>C135_180</key>
- <opt>val:dtv.C135_180</opt>
- </option>
- <option>
- <name>140/180</name>
- <key>C140_180</key>
- <opt>val:dtv.C140_180</opt>
- </option>
- <option>
- <name>7/9</name>
- <key>C7_9</key>
- <opt>val:dtv.C7_9</opt>
- </option>
- <option>
- <name>154/180</name>
- <key>C154_180</key>
- <opt>val:dtv.C154_180</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate2</key>
- <type>enum</type>
- <hide>$framesize.hide_medium</hide>
- <option>
- <name>1/5</name>
- <key>C1_5_MEDIUM</key>
- <opt>val:dtv.C1_5_MEDIUM</opt>
- </option>
- <option>
- <name>11/45</name>
- <key>C11_45_MEDIUM</key>
- <opt>val:dtv.C11_45_MEDIUM</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3_MEDIUM</key>
- <opt>val:dtv.C1_3_MEDIUM</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate3</key>
- <type>enum</type>
- <hide>$framesize.hide_short</hide>
- <option>
- <name>1/4</name>
- <key>C1_4</key>
- <opt>val:dtv.C1_4</opt>
- </option>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>8/9</name>
- <key>C8_9</key>
- <opt>val:dtv.C8_9</opt>
- </option>
- <option>
- <name>11/45</name>
- <key>C11_45</key>
- <opt>val:dtv.C11_45</opt>
- </option>
- <option>
- <name>4/15</name>
- <key>C4_15</key>
- <opt>val:dtv.C4_15</opt>
- </option>
- <option>
- <name>14/45</name>
- <key>C14_45</key>
- <opt>val:dtv.C14_45</opt>
- </option>
- <option>
- <name>7/15</name>
- <key>C7_15</key>
- <opt>val:dtv.C7_15</opt>
- </option>
- <option>
- <name>8/15</name>
- <key>C8_15</key>
- <opt>val:dtv.C8_15</opt>
- </option>
- <option>
- <name>26/45</name>
- <key>C26_45</key>
- <opt>val:dtv.C26_45</opt>
- </option>
- <option>
- <name>32/45</name>
- <key>C32_45</key>
- <opt>val:dtv.C32_45</opt>
- </option>
- <option>
- <name>1/5 VL-SNR SF2</name>
- <key>C1_5_VLSNR_SF2</key>
- <opt>val:dtv.C1_5_VLSNR_SF2</opt>
- </option>
- <option>
- <name>11/45 VL-SNR SF2</name>
- <key>C11_45_VLSNR_SF2</key>
- <opt>val:dtv.C11_45_VLSNR_SF2</opt>
- </option>
- <option>
- <name>1/5 VL-SNR</name>
- <key>C1_5_VLSNR</key>
- <opt>val:dtv.C1_5_VLSNR</opt>
- </option>
- <option>
- <name>4/15 VL-SNR</name>
- <key>C4_15_VLSNR</key>
- <opt>val:dtv.C4_15_VLSNR</opt>
- </option>
- <option>
- <name>1/3 VL-SNR</name>
- <key>C1_3_VLSNR</key>
- <opt>val:dtv.C1_3_VLSNR</opt>
- </option>
- </param>
- <param>
- <name>Constellation</name>
- <key>constellation</key>
- <type>enum</type>
- <option>
- <name>QPSK</name>
- <key>MOD_QPSK</key>
- <opt>val:dtv.MOD_QPSK</opt>
- </option>
- <option>
- <name>8PSK</name>
- <key>MOD_8PSK</key>
- <opt>val:dtv.MOD_8PSK</opt>
- </option>
- <option>
- <name>8APSK</name>
- <key>MOD_8APSK</key>
- <opt>val:dtv.MOD_8APSK</opt>
- </option>
- <option>
- <name>16APSK</name>
- <key>MOD_16APSK</key>
- <opt>val:dtv.MOD_16APSK</opt>
- </option>
- <option>
- <name>8+8APSK</name>
- <key>MOD_8_8APSK</key>
- <opt>val:dtv.MOD_8_8APSK</opt>
- </option>
- <option>
- <name>32APSK</name>
- <key>MOD_32APSK</key>
- <opt>val:dtv.MOD_32APSK</opt>
- </option>
- <option>
- <name>4+12+16rbAPSK</name>
- <key>MOD_4_12_16APSK</key>
- <opt>val:dtv.MOD_4_12_16APSK</opt>
- </option>
- <option>
- <name>4+8+4+16APSK</name>
- <key>MOD_4_8_4_16APSK</key>
- <opt>val:dtv.MOD_4_8_4_16APSK</opt>
- </option>
- <option>
- <name>64APSK</name>
- <key>MOD_64APSK</key>
- <opt>val:dtv.MOD_64APSK</opt>
- </option>
- <option>
- <name>8+16+20+20APSK</name>
- <key>MOD_8_16_20_20APSK</key>
- <opt>val:dtv.MOD_8_16_20_20APSK</opt>
- </option>
- <option>
- <name>4+12+20+28APSK</name>
- <key>MOD_4_12_20_28APSK</key>
- <opt>val:dtv.MOD_4_12_20_28APSK</opt>
- </option>
- <option>
- <name>128APSK</name>
- <key>MOD_128APSK</key>
- <opt>val:dtv.MOD_128APSK</opt>
- </option>
- <option>
- <name>256APSK</name>
- <key>MOD_256APSK</key>
- <opt>val:dtv.MOD_256APSK</opt>
- </option>
- <option>
- <name>PI/2 BPSK</name>
- <key>MOD_BPSK</key>
- <opt>val:dtv.MOD_BPSK</opt>
- </option>
- <option>
- <name>PI/2 BPSK-SF2</name>
- <key>MOD_BPSK_SF2</key>
- <opt>val:dtv.MOD_BPSK_SF2</opt>
- </option>
- </param>
- <param>
- <name>Pilots</name>
- <key>pilots</key>
- <type>enum</type>
- <option>
- <name>Off</name>
- <key>PILOTS_OFF</key>
- <opt>val:dtv.PILOTS_OFF</opt>
- </option>
- <option>
- <name>On</name>
- <key>PILOTS_ON</key>
- <opt>val:dtv.PILOTS_ON</opt>
- </option>
- </param>
- <param>
- <name>Gold Code</name>
- <key>goldcode</key>
- <value>0</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt2_cellinterleaver_cc.block.yml b/gr-dtv/grc/dtv_dvbt2_cellinterleaver_cc.block.yml
new file mode 100644
index 000000000..4f292fca0
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt2_cellinterleaver_cc.block.yml
@@ -0,0 +1,41 @@
+id: dtv_dvbt2_cellinterleaver_cc
+label: Cell/Time Interleaver
+
+parameters:
+- id: framesize
+ label: FECFRAME size
+ dtype: enum
+ options: [FECFRAME_NORMAL, FECFRAME_SHORT]
+ option_labels: [Normal, Short]
+ option_attributes:
+ val: [dtv.FECFRAME_NORMAL, dtv.FECFRAME_SHORT]
+- id: constellation
+ label: Constellation
+ dtype: enum
+ options: [MOD_QPSK, MOD_16QAM, MOD_64QAM, MOD_256QAM]
+ option_labels: [QPSK, 16QAM, 64QAM, 256QAM]
+ option_attributes:
+ val: [dtv.MOD_QPSK, dtv.MOD_16QAM, dtv.MOD_64QAM, dtv.MOD_256QAM]
+- id: fecblocks
+ label: FEC blocks per frame
+ dtype: int
+ default: '168'
+- id: tiblocks
+ label: TI blocks per frame
+ dtype: int
+ default: '3'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt2_cellinterleaver_cc(${framesize.val}, ${constellation.val}, ${fecblocks},
+ ${tiblocks})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt2_cellinterleaver_cc.xml b/gr-dtv/grc/dtv_dvbt2_cellinterleaver_cc.xml
deleted file mode 100644
index 0f3aa76f5..000000000
--- a/gr-dtv/grc/dtv_dvbt2_cellinterleaver_cc.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T2 Cell and Time Interleaver
-###################################################
- -->
-<block>
- <name>Cell/Time Interleaver</name>
- <key>dtv_dvbt2_cellinterleaver_cc</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt2_cellinterleaver_cc($framesize.val, $constellation.val, $fecblocks, $tiblocks)</make>
- <param>
- <name>FECFRAME size</name>
- <key>framesize</key>
- <type>enum</type>
- <option>
- <name>Normal</name>
- <key>FECFRAME_NORMAL</key>
- <opt>val:dtv.FECFRAME_NORMAL</opt>
- </option>
- <option>
- <name>Short</name>
- <key>FECFRAME_SHORT</key>
- <opt>val:dtv.FECFRAME_SHORT</opt>
- </option>
- </param>
- <param>
- <name>Constellation</name>
- <key>constellation</key>
- <type>enum</type>
- <option>
- <name>QPSK</name>
- <key>MOD_QPSK</key>
- <opt>val:dtv.MOD_QPSK</opt>
- </option>
- <option>
- <name>16QAM</name>
- <key>MOD_16QAM</key>
- <opt>val:dtv.MOD_16QAM</opt>
- </option>
- <option>
- <name>64QAM</name>
- <key>MOD_64QAM</key>
- <opt>val:dtv.MOD_64QAM</opt>
- </option>
- <option>
- <name>256QAM</name>
- <key>MOD_256QAM</key>
- <opt>val:dtv.MOD_256QAM</opt>
- </option>
- </param>
- <param>
- <name>FEC blocks per frame</name>
- <key>fecblocks</key>
- <value>168</value>
- <type>int</type>
- </param>
- <param>
- <name>TI blocks per frame</name>
- <key>tiblocks</key>
- <value>3</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt2_framemapper_cc.block.yml b/gr-dtv/grc/dtv_dvbt2_framemapper_cc.block.yml
new file mode 100644
index 000000000..3459c13af
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt2_framemapper_cc.block.yml
@@ -0,0 +1,203 @@
+id: dtv_dvbt2_framemapper_cc
+label: Frame Mapper
+
+parameters:
+- id: framesize
+ label: FECFRAME size
+ dtype: enum
+ options: [FECFRAME_NORMAL, FECFRAME_SHORT]
+ option_labels: [Normal, Short]
+ option_attributes:
+ val: [dtv.FECFRAME_NORMAL, dtv.FECFRAME_SHORT]
+- id: rate
+ label: Code rate
+ dtype: enum
+ options: [C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6]
+ option_labels: [1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6]
+ option_attributes:
+ val: [dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4, dtv.C4_5,
+ dtv.C5_6]
+- id: constellation
+ label: Constellation
+ dtype: enum
+ options: [MOD_QPSK, MOD_16QAM, MOD_64QAM, MOD_256QAM]
+ option_labels: [QPSK, 16QAM, 64QAM, 256QAM]
+ option_attributes:
+ val: [dtv.MOD_QPSK, dtv.MOD_16QAM, dtv.MOD_64QAM, dtv.MOD_256QAM]
+- id: rotation
+ label: Constellation rotation
+ dtype: enum
+ options: [ROTATION_OFF, ROTATION_ON]
+ option_labels: ['Off', 'On']
+ option_attributes:
+ val: [dtv.ROTATION_OFF, dtv.ROTATION_ON]
+- id: fecblocks
+ label: FEC blocks per frame
+ dtype: int
+ default: '168'
+- id: tiblocks
+ label: TI blocks per frame
+ dtype: int
+ default: '3'
+- id: carriermode
+ label: Extended Carrier Mode
+ dtype: enum
+ options: [CARRIERS_NORMAL, CARRIERS_EXTENDED]
+ option_labels: [Normal, Extended]
+ option_attributes:
+ val: [dtv.CARRIERS_NORMAL, dtv.CARRIERS_EXTENDED]
+- id: fftsize1
+ label: FFT Size
+ dtype: enum
+ options: [FFTSIZE_1K, FFTSIZE_2K, FFTSIZE_4K, FFTSIZE_8K, FFTSIZE_8K_T2GI, FFTSIZE_16K,
+ FFTSIZE_32K, FFTSIZE_32K_T2GI]
+ option_labels: [1K, 2K, 4K, 8K, 8K DVB-T2 GI, 16K, 32K, 32K DVB-T2 GI]
+ option_attributes:
+ val: [dtv.FFTSIZE_1K, dtv.FFTSIZE_2K, dtv.FFTSIZE_4K, dtv.FFTSIZE_8K, dtv.FFTSIZE_8K_T2GI,
+ dtv.FFTSIZE_16K, dtv.FFTSIZE_32K, dtv.FFTSIZE_32K_T2GI]
+ hide: ${ (preamble1.hide_base if str(version) == 'VERSION_111' else preamble2.hide_base)
+ }
+- id: fftsize2
+ label: FFT Size
+ dtype: enum
+ options: [FFTSIZE_2K, FFTSIZE_4K, FFTSIZE_8K, FFTSIZE_8K_T2GI, FFTSIZE_16K, FFTSIZE_16K_T2GI]
+ option_labels: [2K, 4K, 8K, 8K DVB-T2 GI, 16K, 16K DVB-T2 GI]
+ option_attributes:
+ val: [dtv.FFTSIZE_2K, dtv.FFTSIZE_4K, dtv.FFTSIZE_8K, dtv.FFTSIZE_8K_T2GI,
+ dtv.FFTSIZE_16K, dtv.FFTSIZE_16K_T2GI]
+ hide: ${ (preamble1.hide_lite if str(version) == 'VERSION_111' else preamble2.hide_lite)
+ }
+- id: guardinterval
+ label: Guard Interval
+ dtype: enum
+ options: [GI_1_32, GI_1_16, GI_1_8, GI_1_4, GI_1_128, GI_19_128, GI_19_256]
+ option_labels: [1/32, 1/16, 1/8, 1/4, 1/128, 19/128, 19/256]
+ option_attributes:
+ val: [dtv.GI_1_32, dtv.GI_1_16, dtv.GI_1_8, dtv.GI_1_4, dtv.GI_1_128, dtv.GI_19_128,
+ dtv.GI_19_256]
+- id: l1constellation
+ label: L1 Constellation
+ dtype: enum
+ options: [L1_MOD_BPSK, L1_MOD_QPSK, L1_MOD_16QAM, L1_MOD_64QAM]
+ option_labels: [BPSK, QPSK, 16QAM, 64QAM]
+ option_attributes:
+ val: [dtv.L1_MOD_BPSK, dtv.L1_MOD_QPSK, dtv.L1_MOD_16QAM, dtv.L1_MOD_64QAM]
+- id: pilotpattern
+ label: Pilot Pattern
+ dtype: enum
+ options: [PILOT_PP1, PILOT_PP2, PILOT_PP3, PILOT_PP4, PILOT_PP5, PILOT_PP6, PILOT_PP7,
+ PILOT_PP8]
+ option_labels: [PP1, PP2, PP3, PP4, PP5, PP6, PP7, PP8]
+ option_attributes:
+ val: [dtv.PILOT_PP1, dtv.PILOT_PP2, dtv.PILOT_PP3, dtv.PILOT_PP4, dtv.PILOT_PP5,
+ dtv.PILOT_PP6, dtv.PILOT_PP7, dtv.PILOT_PP8]
+- id: t2frames
+ label: T2 Frames per Super-frame
+ dtype: int
+ default: '2'
+- id: numdatasyms
+ label: Number of Data Symbols
+ dtype: int
+ default: '100'
+- id: paprmode1
+ label: PAPR Mode
+ dtype: enum
+ options: [PAPR_OFF, PAPR_ACE, PAPR_TR, PAPR_BOTH]
+ option_labels: ['Off', Active Constellation Extension, Tone Reservation, Both
+ ACE and TR]
+ option_attributes:
+ val: [dtv.PAPR_OFF, dtv.PAPR_ACE, dtv.PAPR_TR, dtv.PAPR_BOTH]
+ hide: ${ version.hide_111 }
+- id: paprmode2
+ label: PAPR Mode
+ dtype: enum
+ options: [PAPR_OFF, PAPR_ACE, PAPR_TR, PAPR_BOTH]
+ option_labels: [P2 Only, Active Constellation Extension, Tone Reservation, Both
+ ACE and TR]
+ option_attributes:
+ val: [dtv.PAPR_OFF, dtv.PAPR_ACE, dtv.PAPR_TR, dtv.PAPR_BOTH]
+ hide: ${ version.hide_131 }
+- id: version
+ label: Specification Version
+ dtype: enum
+ options: [VERSION_111, VERSION_131]
+ option_labels: [1.1.1, 1.3.1]
+ option_attributes:
+ hide_111: ['', all]
+ hide_131: [all, '']
+ val: [dtv.VERSION_111, dtv.VERSION_131]
+- id: preamble1
+ label: Preamble
+ dtype: enum
+ options: [PREAMBLE_T2_SISO, PREAMBLE_T2_MISO]
+ option_labels: [T2 SISO, T2 MISO]
+ option_attributes:
+ hide_base: ['', '']
+ hide_lite: [all, all]
+ val: [dtv.PREAMBLE_T2_SISO, dtv.PREAMBLE_T2_MISO]
+ hide: ${ version.hide_111 }
+- id: preamble2
+ label: Preamble
+ dtype: enum
+ options: [PREAMBLE_T2_SISO, PREAMBLE_T2_MISO, PREAMBLE_T2_LITE_SISO, PREAMBLE_T2_LITE_MISO]
+ option_labels: [T2 SISO, T2 MISO, T2-Lite SISO, T2-Lite MISO]
+ option_attributes:
+ hide_base: ['', '', all, all]
+ hide_lite: [all, all, '', '']
+ val: [dtv.PREAMBLE_T2_SISO, dtv.PREAMBLE_T2_MISO, dtv.PREAMBLE_T2_LITE_SISO,
+ dtv.PREAMBLE_T2_LITE_MISO]
+ hide: ${ version.hide_131 }
+- id: inputmode
+ label: Baseband Framing Mode
+ dtype: enum
+ options: [INPUTMODE_NORMAL, INPUTMODE_HIEFF]
+ option_labels: [Normal, High Efficiency]
+ option_attributes:
+ val: [dtv.INPUTMODE_NORMAL, dtv.INPUTMODE_HIEFF]
+ hide: ${ version.hide_131 }
+- id: reservedbiasbits
+ label: Reserved Bits Bias Balancing
+ dtype: enum
+ options: [RESERVED_OFF, RESERVED_ON]
+ option_labels: ['Off', 'On']
+ option_attributes:
+ val: [dtv.RESERVED_OFF, dtv.RESERVED_ON]
+ hide: ${ version.hide_131 }
+- id: l1scrambled
+ label: L1-post Scrambling
+ dtype: enum
+ options: [L1_SCRAMBLED_OFF, L1_SCRAMBLED_ON]
+ option_labels: ['Off', 'On']
+ option_attributes:
+ val: [dtv.L1_SCRAMBLED_OFF, dtv.L1_SCRAMBLED_ON]
+ hide: ${ version.hide_131 }
+- id: inband
+ label: In-band Signalling
+ dtype: enum
+ options: [INBAND_OFF, INBAND_ON]
+ option_labels: ['Off', Type B]
+ option_attributes:
+ val: [dtv.INBAND_OFF, dtv.INBAND_ON]
+ hide: ${ version.hide_131 }
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import dtv
+ make: "dtv.dvbt2_framemapper_cc(${framesize.val}, ${rate.val}, ${constellation.val},\
+ \ ${rotation.val}, ${fecblocks}, ${tiblocks}, ${carriermode.val}, \n% if str(version)\
+ \ == 'VERSION_111':\n${fftsize1.val}, \n% else:\n% if str(preamble2) == 'PREAMBLE_T2_SISO'\
+ \ or str(preamble2) == 'PREAMBLE_T2_MISO':\n${fftsize1.val}, \n% else:\n${fftsize2.val},\
+ \ \n% endif\n% endif\n${guardinterval.val}, ${l1constellation.val}, ${pilotpattern.val},\
+ \ ${t2frames}, ${numdatasyms}, \n% if str(version) == 'VERSION_111':\n${paprmode1.val},\
+ \ \n% else:\n${paprmode2.val}, \n% endif\n${version.val}, \n% if str(version)\
+ \ == 'VERSION_111':\n${preamble1.val}, \n% else:\n${preamble2.val}, \n% endif\n\
+ ${inputmode.val}, ${reservedbiasbits.val}, ${l1scrambled.val}, ${inband.val})"
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt2_framemapper_cc.xml b/gr-dtv/grc/dtv_dvbt2_framemapper_cc.xml
deleted file mode 100644
index e795c8a1d..000000000
--- a/gr-dtv/grc/dtv_dvbt2_framemapper_cc.xml
+++ /dev/null
@@ -1,562 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T2 Frame Mapper
-###################################################
- -->
-<block>
- <name>Frame Mapper</name>
- <key>dtv_dvbt2_framemapper_cc</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt2_framemapper_cc($framesize.val, $rate.val, $constellation.val, $rotation.val, $fecblocks, $tiblocks, $carriermode.val, #slurp
-#if str($version) == 'VERSION_111'
-$fftsize1.val, #slurp
-#else
-#if str($preamble2) == 'PREAMBLE_T2_SISO' or str($preamble2) == 'PREAMBLE_T2_MISO'
-$fftsize1.val, #slurp
-#else
-$fftsize2.val, #slurp
-#end if
-#end if
-$guardinterval.val, $l1constellation.val, $pilotpattern.val, $t2frames, $numdatasyms, #slurp
-#if str($version) == 'VERSION_111'
-$paprmode1.val, #slurp
-#else
-$paprmode2.val, #slurp
-#end if
-$version.val, #slurp
-#if str($version) == 'VERSION_111'
-$preamble1.val, #slurp
-#else
-$preamble2.val, #slurp
-#end if
-$inputmode.val, $reservedbiasbits.val, $l1scrambled.val, $inband.val)</make>
- <param>
- <name>FECFRAME size</name>
- <key>framesize</key>
- <type>enum</type>
- <option>
- <name>Normal</name>
- <key>FECFRAME_NORMAL</key>
- <opt>val:dtv.FECFRAME_NORMAL</opt>
- </option>
- <option>
- <name>Short</name>
- <key>FECFRAME_SHORT</key>
- <opt>val:dtv.FECFRAME_SHORT</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate</key>
- <type>enum</type>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- </param>
- <param>
- <name>Constellation</name>
- <key>constellation</key>
- <type>enum</type>
- <option>
- <name>QPSK</name>
- <key>MOD_QPSK</key>
- <opt>val:dtv.MOD_QPSK</opt>
- </option>
- <option>
- <name>16QAM</name>
- <key>MOD_16QAM</key>
- <opt>val:dtv.MOD_16QAM</opt>
- </option>
- <option>
- <name>64QAM</name>
- <key>MOD_64QAM</key>
- <opt>val:dtv.MOD_64QAM</opt>
- </option>
- <option>
- <name>256QAM</name>
- <key>MOD_256QAM</key>
- <opt>val:dtv.MOD_256QAM</opt>
- </option>
- </param>
- <param>
- <name>Constellation rotation</name>
- <key>rotation</key>
- <type>enum</type>
- <option>
- <name>Off</name>
- <key>ROTATION_OFF</key>
- <opt>val:dtv.ROTATION_OFF</opt>
- </option>
- <option>
- <name>On</name>
- <key>ROTATION_ON</key>
- <opt>val:dtv.ROTATION_ON</opt>
- </option>
- </param>
- <param>
- <name>FEC blocks per frame</name>
- <key>fecblocks</key>
- <value>168</value>
- <type>int</type>
- </param>
- <param>
- <name>TI blocks per frame</name>
- <key>tiblocks</key>
- <value>3</value>
- <type>int</type>
- </param>
- <param>
- <name>Extended Carrier Mode</name>
- <key>carriermode</key>
- <type>enum</type>
- <option>
- <name>Normal</name>
- <key>CARRIERS_NORMAL</key>
- <opt>val:dtv.CARRIERS_NORMAL</opt>
- </option>
- <option>
- <name>Extended</name>
- <key>CARRIERS_EXTENDED</key>
- <opt>val:dtv.CARRIERS_EXTENDED</opt>
- </option>
- </param>
- <param>
- <name>FFT Size</name>
- <key>fftsize1</key>
- <type>enum</type>
- <hide>#if str($version) == 'VERSION_111' then $preamble1.hide_base else $preamble2.hide_base</hide>
- <option>
- <name>1K</name>
- <key>FFTSIZE_1K</key>
- <opt>val:dtv.FFTSIZE_1K</opt>
- </option>
- <option>
- <name>2K</name>
- <key>FFTSIZE_2K</key>
- <opt>val:dtv.FFTSIZE_2K</opt>
- </option>
- <option>
- <name>4K</name>
- <key>FFTSIZE_4K</key>
- <opt>val:dtv.FFTSIZE_4K</opt>
- </option>
- <option>
- <name>8K</name>
- <key>FFTSIZE_8K</key>
- <opt>val:dtv.FFTSIZE_8K</opt>
- </option>
- <option>
- <name>8K DVB-T2 GI</name>
- <key>FFTSIZE_8K_T2GI</key>
- <opt>val:dtv.FFTSIZE_8K_T2GI</opt>
- </option>
- <option>
- <name>16K</name>
- <key>FFTSIZE_16K</key>
- <opt>val:dtv.FFTSIZE_16K</opt>
- </option>
- <option>
- <name>32K</name>
- <key>FFTSIZE_32K</key>
- <opt>val:dtv.FFTSIZE_32K</opt>
- </option>
- <option>
- <name>32K DVB-T2 GI</name>
- <key>FFTSIZE_32K_T2GI</key>
- <opt>val:dtv.FFTSIZE_32K_T2GI</opt>
- </option>
- </param>
- <param>
- <name>FFT Size</name>
- <key>fftsize2</key>
- <type>enum</type>
- <hide>#if str($version) == 'VERSION_111' then $preamble1.hide_lite else $preamble2.hide_lite</hide>
- <option>
- <name>2K</name>
- <key>FFTSIZE_2K</key>
- <opt>val:dtv.FFTSIZE_2K</opt>
- </option>
- <option>
- <name>4K</name>
- <key>FFTSIZE_4K</key>
- <opt>val:dtv.FFTSIZE_4K</opt>
- </option>
- <option>
- <name>8K</name>
- <key>FFTSIZE_8K</key>
- <opt>val:dtv.FFTSIZE_8K</opt>
- </option>
- <option>
- <name>8K DVB-T2 GI</name>
- <key>FFTSIZE_8K_T2GI</key>
- <opt>val:dtv.FFTSIZE_8K_T2GI</opt>
- </option>
- <option>
- <name>16K</name>
- <key>FFTSIZE_16K</key>
- <opt>val:dtv.FFTSIZE_16K</opt>
- </option>
- <option>
- <name>16K DVB-T2 GI</name>
- <key>FFTSIZE_16K_T2GI</key>
- <opt>val:dtv.FFTSIZE_16K_T2GI</opt>
- </option>
- </param>
- <param>
- <name>Guard Interval</name>
- <key>guardinterval</key>
- <type>enum</type>
- <option>
- <name>1/32</name>
- <key>GI_1_32</key>
- <opt>val:dtv.GI_1_32</opt>
- </option>
- <option>
- <name>1/16</name>
- <key>GI_1_16</key>
- <opt>val:dtv.GI_1_16</opt>
- </option>
- <option>
- <name>1/8</name>
- <key>GI_1_8</key>
- <opt>val:dtv.GI_1_8</opt>
- </option>
- <option>
- <name>1/4</name>
- <key>GI_1_4</key>
- <opt>val:dtv.GI_1_4</opt>
- </option>
- <option>
- <name>1/128</name>
- <key>GI_1_128</key>
- <opt>val:dtv.GI_1_128</opt>
- </option>
- <option>
- <name>19/128</name>
- <key>GI_19_128</key>
- <opt>val:dtv.GI_19_128</opt>
- </option>
- <option>
- <name>19/256</name>
- <key>GI_19_256</key>
- <opt>val:dtv.GI_19_256</opt>
- </option>
- </param>
- <param>
- <name>L1 Constellation</name>
- <key>l1constellation</key>
- <type>enum</type>
- <option>
- <name>BPSK</name>
- <key>L1_MOD_BPSK</key>
- <opt>val:dtv.L1_MOD_BPSK</opt>
- </option>
- <option>
- <name>QPSK</name>
- <key>L1_MOD_QPSK</key>
- <opt>val:dtv.L1_MOD_QPSK</opt>
- </option>
- <option>
- <name>16QAM</name>
- <key>L1_MOD_16QAM</key>
- <opt>val:dtv.L1_MOD_16QAM</opt>
- </option>
- <option>
- <name>64QAM</name>
- <key>L1_MOD_64QAM</key>
- <opt>val:dtv.L1_MOD_64QAM</opt>
- </option>
- </param>
- <param>
- <name>Pilot Pattern</name>
- <key>pilotpattern</key>
- <type>enum</type>
- <option>
- <name>PP1</name>
- <key>PILOT_PP1</key>
- <opt>val:dtv.PILOT_PP1</opt>
- </option>
- <option>
- <name>PP2</name>
- <key>PILOT_PP2</key>
- <opt>val:dtv.PILOT_PP2</opt>
- </option>
- <option>
- <name>PP3</name>
- <key>PILOT_PP3</key>
- <opt>val:dtv.PILOT_PP3</opt>
- </option>
- <option>
- <name>PP4</name>
- <key>PILOT_PP4</key>
- <opt>val:dtv.PILOT_PP4</opt>
- </option>
- <option>
- <name>PP5</name>
- <key>PILOT_PP5</key>
- <opt>val:dtv.PILOT_PP5</opt>
- </option>
- <option>
- <name>PP6</name>
- <key>PILOT_PP6</key>
- <opt>val:dtv.PILOT_PP6</opt>
- </option>
- <option>
- <name>PP7</name>
- <key>PILOT_PP7</key>
- <opt>val:dtv.PILOT_PP7</opt>
- </option>
- <option>
- <name>PP8</name>
- <key>PILOT_PP8</key>
- <opt>val:dtv.PILOT_PP8</opt>
- </option>
- </param>
- <param>
- <name>T2 Frames per Super-frame</name>
- <key>t2frames</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Number of Data Symbols</name>
- <key>numdatasyms</key>
- <value>100</value>
- <type>int</type>
- </param>
- <param>
- <name>PAPR Mode</name>
- <key>paprmode1</key>
- <type>enum</type>
- <hide>$version.hide_111</hide>
- <option>
- <name>Off</name>
- <key>PAPR_OFF</key>
- <opt>val:dtv.PAPR_OFF</opt>
- </option>
- <option>
- <name>Active Constellation Extension</name>
- <key>PAPR_ACE</key>
- <opt>val:dtv.PAPR_ACE</opt>
- </option>
- <option>
- <name>Tone Reservation</name>
- <key>PAPR_TR</key>
- <opt>val:dtv.PAPR_TR</opt>
- </option>
- <option>
- <name>Both ACE and TR</name>
- <key>PAPR_BOTH</key>
- <opt>val:dtv.PAPR_BOTH</opt>
- </option>
- </param>
- <param>
- <name>PAPR Mode</name>
- <key>paprmode2</key>
- <type>enum</type>
- <hide>$version.hide_131</hide>
- <option>
- <name>P2 Only</name>
- <key>PAPR_OFF</key>
- <opt>val:dtv.PAPR_OFF</opt>
- </option>
- <option>
- <name>Active Constellation Extension</name>
- <key>PAPR_ACE</key>
- <opt>val:dtv.PAPR_ACE</opt>
- </option>
- <option>
- <name>Tone Reservation</name>
- <key>PAPR_TR</key>
- <opt>val:dtv.PAPR_TR</opt>
- </option>
- <option>
- <name>Both ACE and TR</name>
- <key>PAPR_BOTH</key>
- <opt>val:dtv.PAPR_BOTH</opt>
- </option>
- </param>
- <param>
- <name>Specification Version</name>
- <key>version</key>
- <type>enum</type>
- <option>
- <name>1.1.1</name>
- <key>VERSION_111</key>
- <opt>val:dtv.VERSION_111</opt>
- <opt>hide_111:</opt>
- <opt>hide_131:all</opt>
- </option>
- <option>
- <name>1.3.1</name>
- <key>VERSION_131</key>
- <opt>val:dtv.VERSION_131</opt>
- <opt>hide_111:all</opt>
- <opt>hide_131:</opt>
- </option>
- </param>
- <param>
- <name>Preamble</name>
- <key>preamble1</key>
- <type>enum</type>
- <hide>$version.hide_111</hide>
- <option>
- <name>T2 SISO</name>
- <key>PREAMBLE_T2_SISO</key>
- <opt>val:dtv.PREAMBLE_T2_SISO</opt>
- <opt>hide_lite:all</opt>
- <opt>hide_base:</opt>
- </option>
- <option>
- <name>T2 MISO</name>
- <key>PREAMBLE_T2_MISO</key>
- <opt>val:dtv.PREAMBLE_T2_MISO</opt>
- <opt>hide_lite:all</opt>
- <opt>hide_base:</opt>
- </option>
- </param>
- <param>
- <name>Preamble</name>
- <key>preamble2</key>
- <type>enum</type>
- <hide>$version.hide_131</hide>
- <option>
- <name>T2 SISO</name>
- <key>PREAMBLE_T2_SISO</key>
- <opt>val:dtv.PREAMBLE_T2_SISO</opt>
- <opt>hide_lite:all</opt>
- <opt>hide_base:</opt>
- </option>
- <option>
- <name>T2 MISO</name>
- <key>PREAMBLE_T2_MISO</key>
- <opt>val:dtv.PREAMBLE_T2_MISO</opt>
- <opt>hide_lite:all</opt>
- <opt>hide_base:</opt>
- </option>
- <option>
- <name>T2-Lite SISO</name>
- <key>PREAMBLE_T2_LITE_SISO</key>
- <opt>val:dtv.PREAMBLE_T2_LITE_SISO</opt>
- <opt>hide_lite:</opt>
- <opt>hide_base:all</opt>
- </option>
- <option>
- <name>T2-Lite MISO</name>
- <key>PREAMBLE_T2_LITE_MISO</key>
- <opt>val:dtv.PREAMBLE_T2_LITE_MISO</opt>
- <opt>hide_lite:</opt>
- <opt>hide_base:all</opt>
- </option>
- </param>
- <param>
- <name>Baseband Framing Mode</name>
- <key>inputmode</key>
- <type>enum</type>
- <hide>$version.hide_131</hide>
- <option>
- <name>Normal</name>
- <key>INPUTMODE_NORMAL</key>
- <opt>val:dtv.INPUTMODE_NORMAL</opt>
- </option>
- <option>
- <name>High Efficiency</name>
- <key>INPUTMODE_HIEFF</key>
- <opt>val:dtv.INPUTMODE_HIEFF</opt>
- </option>
- </param>
- <param>
- <name>Reserved Bits Bias Balancing</name>
- <key>reservedbiasbits</key>
- <type>enum</type>
- <hide>$version.hide_131</hide>
- <option>
- <name>Off</name>
- <key>RESERVED_OFF</key>
- <opt>val:dtv.RESERVED_OFF</opt>
- </option>
- <option>
- <name>On</name>
- <key>RESERVED_ON</key>
- <opt>val:dtv.RESERVED_ON</opt>
- </option>
- </param>
- <param>
- <name>L1-post Scrambling</name>
- <key>l1scrambled</key>
- <type>enum</type>
- <hide>$version.hide_131</hide>
- <option>
- <name>Off</name>
- <key>L1_SCRAMBLED_OFF</key>
- <opt>val:dtv.L1_SCRAMBLED_OFF</opt>
- </option>
- <option>
- <name>On</name>
- <key>L1_SCRAMBLED_ON</key>
- <opt>val:dtv.L1_SCRAMBLED_ON</opt>
- </option>
- </param>
- <param>
- <name>In-band Signalling</name>
- <key>inband</key>
- <type>enum</type>
- <hide>$version.hide_131</hide>
- <option>
- <name>Off</name>
- <key>INBAND_OFF</key>
- <opt>val:dtv.INBAND_OFF</opt>
- </option>
- <option>
- <name>Type B</name>
- <key>INBAND_ON</key>
- <opt>val:dtv.INBAND_ON</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt2_freqinterleaver_cc.block.yml b/gr-dtv/grc/dtv_dvbt2_freqinterleaver_cc.block.yml
new file mode 100644
index 000000000..990d4b800
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt2_freqinterleaver_cc.block.yml
@@ -0,0 +1,104 @@
+id: dtv_dvbt2_freqinterleaver_cc
+label: Frequency Interleaver
+
+parameters:
+- id: carriermode
+ label: Extended Carrier Mode
+ dtype: enum
+ options: [CARRIERS_NORMAL, CARRIERS_EXTENDED]
+ option_labels: [Normal, Extended]
+ option_attributes:
+ val: [dtv.CARRIERS_NORMAL, dtv.CARRIERS_EXTENDED]
+- id: fftsize
+ label: FFT Size
+ dtype: enum
+ options: [FFTSIZE_1K, FFTSIZE_2K, FFTSIZE_4K, FFTSIZE_8K, FFTSIZE_8K_T2GI, FFTSIZE_16K,
+ FFTSIZE_16K_T2GI, FFTSIZE_32K, FFTSIZE_32K_T2GI]
+ option_labels: [1K, 2K, 4K, 8K, 8K DVB-T2 GI, 16K, 16K DVB-T2 GI, 32K, 32K DVB-T2
+ GI]
+ option_attributes:
+ val: [dtv.FFTSIZE_1K, dtv.FFTSIZE_2K, dtv.FFTSIZE_4K, dtv.FFTSIZE_8K, dtv.FFTSIZE_8K_T2GI,
+ dtv.FFTSIZE_16K, dtv.FFTSIZE_16K_T2GI, dtv.FFTSIZE_32K, dtv.FFTSIZE_32K_T2GI]
+- id: pilotpattern
+ label: Pilot Pattern
+ dtype: enum
+ options: [PILOT_PP1, PILOT_PP2, PILOT_PP3, PILOT_PP4, PILOT_PP5, PILOT_PP6, PILOT_PP7,
+ PILOT_PP8]
+ option_labels: [PP1, PP2, PP3, PP4, PP5, PP6, PP7, PP8]
+ option_attributes:
+ val: [dtv.PILOT_PP1, dtv.PILOT_PP2, dtv.PILOT_PP3, dtv.PILOT_PP4, dtv.PILOT_PP5,
+ dtv.PILOT_PP6, dtv.PILOT_PP7, dtv.PILOT_PP8]
+- id: guardinterval
+ label: Guard Interval
+ dtype: enum
+ options: [GI_1_32, GI_1_16, GI_1_8, GI_1_4, GI_1_128, GI_19_128, GI_19_256]
+ option_labels: [1/32, 1/16, 1/8, 1/4, 1/128, 19/128, 19/256]
+ option_attributes:
+ val: [dtv.GI_1_32, dtv.GI_1_16, dtv.GI_1_8, dtv.GI_1_4, dtv.GI_1_128, dtv.GI_19_128,
+ dtv.GI_19_256]
+- id: numdatasyms
+ label: Number of Data Symbols
+ dtype: int
+ default: '100'
+- id: paprmode1
+ label: PAPR Mode
+ dtype: enum
+ options: [PAPR_OFF, PAPR_ACE, PAPR_TR, PAPR_BOTH]
+ option_labels: ['Off', Active Constellation Extension, Tone Reservation, Both
+ ACE and TR]
+ option_attributes:
+ val: [dtv.PAPR_OFF, dtv.PAPR_ACE, dtv.PAPR_TR, dtv.PAPR_BOTH]
+ hide: ${ version.hide_111 }
+- id: paprmode2
+ label: PAPR Mode
+ dtype: enum
+ options: [PAPR_OFF, PAPR_ACE, PAPR_TR, PAPR_BOTH]
+ option_labels: [P2 Only, Active Constellation Extension, Tone Reservation, Both
+ ACE and TR]
+ option_attributes:
+ val: [dtv.PAPR_OFF, dtv.PAPR_ACE, dtv.PAPR_TR, dtv.PAPR_BOTH]
+ hide: ${ version.hide_131 }
+- id: version
+ label: Specification Version
+ dtype: enum
+ options: [VERSION_111, VERSION_131]
+ option_labels: [1.1.1, 1.3.1]
+ option_attributes:
+ hide_111: ['', all]
+ hide_131: [all, '']
+ val: [dtv.VERSION_111, dtv.VERSION_131]
+- id: preamble1
+ label: Preamble
+ dtype: enum
+ options: [PREAMBLE_T2_SISO, PREAMBLE_T2_MISO]
+ option_labels: [T2 SISO, T2 MISO]
+ option_attributes:
+ val: [dtv.PREAMBLE_T2_SISO, dtv.PREAMBLE_T2_MISO]
+ hide: ${ version.hide_111 }
+- id: preamble2
+ label: Preamble
+ dtype: enum
+ options: [PREAMBLE_T2_SISO, PREAMBLE_T2_MISO, PREAMBLE_T2_LITE_SISO, PREAMBLE_T2_LITE_MISO]
+ option_labels: [T2 SISO, T2 MISO, T2-Lite SISO, T2-Lite MISO]
+ option_attributes:
+ val: [dtv.PREAMBLE_T2_SISO, dtv.PREAMBLE_T2_MISO, dtv.PREAMBLE_T2_LITE_SISO,
+ dtv.PREAMBLE_T2_LITE_MISO]
+ hide: ${ version.hide_131 }
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import dtv
+ make: "dtv.dvbt2_freqinterleaver_cc(${carriermode.val}, ${fftsize.val}, ${pilotpattern.val},\
+ \ ${guardinterval.val}, ${numdatasyms}, \n% if str(version) == 'VERSION_111':\n\
+ ${paprmode1.val}, \n% else:\n${paprmode2.val}, \n% endif\n${version.val},\
+ \ \n% if str(version) == 'VERSION_111':\n${preamble1.val}\n% else:\n${preamble2.val}\n\
+ % endif\n)"
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt2_freqinterleaver_cc.xml b/gr-dtv/grc/dtv_dvbt2_freqinterleaver_cc.xml
deleted file mode 100644
index bd7ba2bbf..000000000
--- a/gr-dtv/grc/dtv_dvbt2_freqinterleaver_cc.xml
+++ /dev/null
@@ -1,301 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T2 Frequency Interleaver
-###################################################
- -->
-<block>
- <name>Frequency Interleaver</name>
- <key>dtv_dvbt2_freqinterleaver_cc</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt2_freqinterleaver_cc($carriermode.val, $fftsize.val, $pilotpattern.val, $guardinterval.val, $numdatasyms, #slurp
-#if str($version) == 'VERSION_111'
-$paprmode1.val, #slurp
-#else
-$paprmode2.val, #slurp
-#end if
-$version.val, #slurp
-#if str($version) == 'VERSION_111'
-$preamble1.val#slurp
-#else
-$preamble2.val#slurp
-#end if
-)</make>
- <param>
- <name>Extended Carrier Mode</name>
- <key>carriermode</key>
- <type>enum</type>
- <option>
- <name>Normal</name>
- <key>CARRIERS_NORMAL</key>
- <opt>val:dtv.CARRIERS_NORMAL</opt>
- </option>
- <option>
- <name>Extended</name>
- <key>CARRIERS_EXTENDED</key>
- <opt>val:dtv.CARRIERS_EXTENDED</opt>
- </option>
- </param>
- <param>
- <name>FFT Size</name>
- <key>fftsize</key>
- <type>enum</type>
- <option>
- <name>1K</name>
- <key>FFTSIZE_1K</key>
- <opt>val:dtv.FFTSIZE_1K</opt>
- </option>
- <option>
- <name>2K</name>
- <key>FFTSIZE_2K</key>
- <opt>val:dtv.FFTSIZE_2K</opt>
- </option>
- <option>
- <name>4K</name>
- <key>FFTSIZE_4K</key>
- <opt>val:dtv.FFTSIZE_4K</opt>
- </option>
- <option>
- <name>8K</name>
- <key>FFTSIZE_8K</key>
- <opt>val:dtv.FFTSIZE_8K</opt>
- </option>
- <option>
- <name>8K DVB-T2 GI</name>
- <key>FFTSIZE_8K_T2GI</key>
- <opt>val:dtv.FFTSIZE_8K_T2GI</opt>
- </option>
- <option>
- <name>16K</name>
- <key>FFTSIZE_16K</key>
- <opt>val:dtv.FFTSIZE_16K</opt>
- </option>
- <option>
- <name>16K DVB-T2 GI</name>
- <key>FFTSIZE_16K_T2GI</key>
- <opt>val:dtv.FFTSIZE_16K_T2GI</opt>
- </option>
- <option>
- <name>32K</name>
- <key>FFTSIZE_32K</key>
- <opt>val:dtv.FFTSIZE_32K</opt>
- </option>
- <option>
- <name>32K DVB-T2 GI</name>
- <key>FFTSIZE_32K_T2GI</key>
- <opt>val:dtv.FFTSIZE_32K_T2GI</opt>
- </option>
- </param>
- <param>
- <name>Pilot Pattern</name>
- <key>pilotpattern</key>
- <type>enum</type>
- <option>
- <name>PP1</name>
- <key>PILOT_PP1</key>
- <opt>val:dtv.PILOT_PP1</opt>
- </option>
- <option>
- <name>PP2</name>
- <key>PILOT_PP2</key>
- <opt>val:dtv.PILOT_PP2</opt>
- </option>
- <option>
- <name>PP3</name>
- <key>PILOT_PP3</key>
- <opt>val:dtv.PILOT_PP3</opt>
- </option>
- <option>
- <name>PP4</name>
- <key>PILOT_PP4</key>
- <opt>val:dtv.PILOT_PP4</opt>
- </option>
- <option>
- <name>PP5</name>
- <key>PILOT_PP5</key>
- <opt>val:dtv.PILOT_PP5</opt>
- </option>
- <option>
- <name>PP6</name>
- <key>PILOT_PP6</key>
- <opt>val:dtv.PILOT_PP6</opt>
- </option>
- <option>
- <name>PP7</name>
- <key>PILOT_PP7</key>
- <opt>val:dtv.PILOT_PP7</opt>
- </option>
- <option>
- <name>PP8</name>
- <key>PILOT_PP8</key>
- <opt>val:dtv.PILOT_PP8</opt>
- </option>
- </param>
- <param>
- <name>Guard Interval</name>
- <key>guardinterval</key>
- <type>enum</type>
- <option>
- <name>1/32</name>
- <key>GI_1_32</key>
- <opt>val:dtv.GI_1_32</opt>
- </option>
- <option>
- <name>1/16</name>
- <key>GI_1_16</key>
- <opt>val:dtv.GI_1_16</opt>
- </option>
- <option>
- <name>1/8</name>
- <key>GI_1_8</key>
- <opt>val:dtv.GI_1_8</opt>
- </option>
- <option>
- <name>1/4</name>
- <key>GI_1_4</key>
- <opt>val:dtv.GI_1_4</opt>
- </option>
- <option>
- <name>1/128</name>
- <key>GI_1_128</key>
- <opt>val:dtv.GI_1_128</opt>
- </option>
- <option>
- <name>19/128</name>
- <key>GI_19_128</key>
- <opt>val:dtv.GI_19_128</opt>
- </option>
- <option>
- <name>19/256</name>
- <key>GI_19_256</key>
- <opt>val:dtv.GI_19_256</opt>
- </option>
- </param>
- <param>
- <name>Number of Data Symbols</name>
- <key>numdatasyms</key>
- <value>100</value>
- <type>int</type>
- </param>
- <param>
- <name>PAPR Mode</name>
- <key>paprmode1</key>
- <type>enum</type>
- <hide>$version.hide_111</hide>
- <option>
- <name>Off</name>
- <key>PAPR_OFF</key>
- <opt>val:dtv.PAPR_OFF</opt>
- </option>
- <option>
- <name>Active Constellation Extension</name>
- <key>PAPR_ACE</key>
- <opt>val:dtv.PAPR_ACE</opt>
- </option>
- <option>
- <name>Tone Reservation</name>
- <key>PAPR_TR</key>
- <opt>val:dtv.PAPR_TR</opt>
- </option>
- <option>
- <name>Both ACE and TR</name>
- <key>PAPR_BOTH</key>
- <opt>val:dtv.PAPR_BOTH</opt>
- </option>
- </param>
- <param>
- <name>PAPR Mode</name>
- <key>paprmode2</key>
- <type>enum</type>
- <hide>$version.hide_131</hide>
- <option>
- <name>P2 Only</name>
- <key>PAPR_OFF</key>
- <opt>val:dtv.PAPR_OFF</opt>
- </option>
- <option>
- <name>Active Constellation Extension</name>
- <key>PAPR_ACE</key>
- <opt>val:dtv.PAPR_ACE</opt>
- </option>
- <option>
- <name>Tone Reservation</name>
- <key>PAPR_TR</key>
- <opt>val:dtv.PAPR_TR</opt>
- </option>
- <option>
- <name>Both ACE and TR</name>
- <key>PAPR_BOTH</key>
- <opt>val:dtv.PAPR_BOTH</opt>
- </option>
- </param>
- <param>
- <name>Specification Version</name>
- <key>version</key>
- <type>enum</type>
- <option>
- <name>1.1.1</name>
- <key>VERSION_111</key>
- <opt>val:dtv.VERSION_111</opt>
- <opt>hide_111:</opt>
- <opt>hide_131:all</opt>
- </option>
- <option>
- <name>1.3.1</name>
- <key>VERSION_131</key>
- <opt>val:dtv.VERSION_131</opt>
- <opt>hide_111:all</opt>
- <opt>hide_131:</opt>
- </option>
- </param>
- <param>
- <name>Preamble</name>
- <key>preamble1</key>
- <type>enum</type>
- <hide>$version.hide_111</hide>
- <option>
- <name>T2 SISO</name>
- <key>PREAMBLE_T2_SISO</key>
- <opt>val:dtv.PREAMBLE_T2_SISO</opt>
- </option>
- <option>
- <name>T2 MISO</name>
- <key>PREAMBLE_T2_MISO</key>
- <opt>val:dtv.PREAMBLE_T2_MISO</opt>
- </option>
- </param>
- <param>
- <name>Preamble</name>
- <key>preamble2</key>
- <type>enum</type>
- <hide>$version.hide_131</hide>
- <option>
- <name>T2 SISO</name>
- <key>PREAMBLE_T2_SISO</key>
- <opt>val:dtv.PREAMBLE_T2_SISO</opt>
- </option>
- <option>
- <name>T2 MISO</name>
- <key>PREAMBLE_T2_MISO</key>
- <opt>val:dtv.PREAMBLE_T2_MISO</opt>
- </option>
- <option>
- <name>T2-Lite SISO</name>
- <key>PREAMBLE_T2_LITE_SISO</key>
- <opt>val:dtv.PREAMBLE_T2_LITE_SISO</opt>
- </option>
- <option>
- <name>T2-Lite MISO</name>
- <key>PREAMBLE_T2_LITE_MISO</key>
- <opt>val:dtv.PREAMBLE_T2_LITE_MISO</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt2_interleaver_bb.block.yml b/gr-dtv/grc/dtv_dvbt2_interleaver_bb.block.yml
new file mode 100644
index 000000000..c7ca95599
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt2_interleaver_bb.block.yml
@@ -0,0 +1,40 @@
+id: dtv_dvbt2_interleaver_bb
+label: Bit Interleaver
+
+parameters:
+- id: framesize
+ label: FECFRAME size
+ dtype: enum
+ options: [FECFRAME_NORMAL, FECFRAME_SHORT]
+ option_labels: [Normal, Short]
+ option_attributes:
+ val: [dtv.FECFRAME_NORMAL, dtv.FECFRAME_SHORT]
+- id: rate
+ label: Code rate
+ dtype: enum
+ options: [C1_3, C2_5, C1_2, C3_5, C2_3, C3_4, C4_5, C5_6]
+ option_labels: [1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6]
+ option_attributes:
+ val: [dtv.C1_3, dtv.C2_5, dtv.C1_2, dtv.C3_5, dtv.C2_3, dtv.C3_4, dtv.C4_5,
+ dtv.C5_6]
+- id: constellation
+ label: Constellation
+ dtype: enum
+ options: [MOD_QPSK, MOD_16QAM, MOD_64QAM, MOD_256QAM]
+ option_labels: [QPSK, 16QAM, 64QAM, 256QAM]
+ option_attributes:
+ val: [dtv.MOD_QPSK, dtv.MOD_16QAM, dtv.MOD_64QAM, dtv.MOD_256QAM]
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt2_interleaver_bb(${framesize.val}, ${rate.val}, ${constellation.val})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt2_interleaver_bb.xml b/gr-dtv/grc/dtv_dvbt2_interleaver_bb.xml
deleted file mode 100644
index 0e4e1eaf4..000000000
--- a/gr-dtv/grc/dtv_dvbt2_interleaver_bb.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T2 Bit Interleaver
-###################################################
- -->
-<block>
- <name>Bit Interleaver</name>
- <key>dtv_dvbt2_interleaver_bb</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt2_interleaver_bb($framesize.val, $rate.val, $constellation.val)</make>
- <param>
- <name>FECFRAME size</name>
- <key>framesize</key>
- <type>enum</type>
- <option>
- <name>Normal</name>
- <key>FECFRAME_NORMAL</key>
- <opt>val:dtv.FECFRAME_NORMAL</opt>
- </option>
- <option>
- <name>Short</name>
- <key>FECFRAME_SHORT</key>
- <opt>val:dtv.FECFRAME_SHORT</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>rate</key>
- <type>enum</type>
- <option>
- <name>1/3</name>
- <key>C1_3</key>
- <opt>val:dtv.C1_3</opt>
- </option>
- <option>
- <name>2/5</name>
- <key>C2_5</key>
- <opt>val:dtv.C2_5</opt>
- </option>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>3/5</name>
- <key>C3_5</key>
- <opt>val:dtv.C3_5</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>4/5</name>
- <key>C4_5</key>
- <opt>val:dtv.C4_5</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- </param>
- <param>
- <name>Constellation</name>
- <key>constellation</key>
- <type>enum</type>
- <option>
- <name>QPSK</name>
- <key>MOD_QPSK</key>
- <opt>val:dtv.MOD_QPSK</opt>
- </option>
- <option>
- <name>16QAM</name>
- <key>MOD_16QAM</key>
- <opt>val:dtv.MOD_16QAM</opt>
- </option>
- <option>
- <name>64QAM</name>
- <key>MOD_64QAM</key>
- <opt>val:dtv.MOD_64QAM</opt>
- </option>
- <option>
- <name>256QAM</name>
- <key>MOD_256QAM</key>
- <opt>val:dtv.MOD_256QAM</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt2_miso_cc.block.yml b/gr-dtv/grc/dtv_dvbt2_miso_cc.block.yml
new file mode 100644
index 000000000..81550c9c1
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt2_miso_cc.block.yml
@@ -0,0 +1,86 @@
+id: dtv_dvbt2_miso_cc
+label: MISO Processing
+
+parameters:
+- id: carriermode
+ label: Extended Carrier Mode
+ dtype: enum
+ options: [CARRIERS_NORMAL, CARRIERS_EXTENDED]
+ option_labels: [Normal, Extended]
+ option_attributes:
+ val: [dtv.CARRIERS_NORMAL, dtv.CARRIERS_EXTENDED]
+- id: fftsize
+ label: FFT Size
+ dtype: enum
+ options: [FFTSIZE_1K, FFTSIZE_2K, FFTSIZE_4K, FFTSIZE_8K, FFTSIZE_8K_T2GI, FFTSIZE_16K,
+ FFTSIZE_16K_T2GI, FFTSIZE_32K, FFTSIZE_32K_T2GI]
+ option_labels: [1K, 2K, 4K, 8K, 8K DVB-T2 GI, 16K, 16K DVB-T2 GI, 32K, 32K DVB-T2
+ GI]
+ option_attributes:
+ val: [dtv.FFTSIZE_1K, dtv.FFTSIZE_2K, dtv.FFTSIZE_4K, dtv.FFTSIZE_8K, dtv.FFTSIZE_8K_T2GI,
+ dtv.FFTSIZE_16K, dtv.FFTSIZE_16K_T2GI, dtv.FFTSIZE_32K, dtv.FFTSIZE_32K_T2GI]
+- id: pilotpattern
+ label: Pilot Pattern
+ dtype: enum
+ options: [PILOT_PP1, PILOT_PP2, PILOT_PP3, PILOT_PP4, PILOT_PP5, PILOT_PP6, PILOT_PP7,
+ PILOT_PP8]
+ option_labels: [PP1, PP2, PP3, PP4, PP5, PP6, PP7, PP8]
+ option_attributes:
+ val: [dtv.PILOT_PP1, dtv.PILOT_PP2, dtv.PILOT_PP3, dtv.PILOT_PP4, dtv.PILOT_PP5,
+ dtv.PILOT_PP6, dtv.PILOT_PP7, dtv.PILOT_PP8]
+- id: guardinterval
+ label: Guard Interval
+ dtype: enum
+ options: [GI_1_32, GI_1_16, GI_1_8, GI_1_4, GI_1_128, GI_19_128, GI_19_256]
+ option_labels: [1/32, 1/16, 1/8, 1/4, 1/128, 19/128, 19/256]
+ option_attributes:
+ val: [dtv.GI_1_32, dtv.GI_1_16, dtv.GI_1_8, dtv.GI_1_4, dtv.GI_1_128, dtv.GI_19_128,
+ dtv.GI_19_256]
+- id: numdatasyms
+ label: Number of Data Symbols
+ dtype: int
+ default: '100'
+- id: paprmode1
+ label: PAPR Mode
+ dtype: enum
+ options: [PAPR_OFF, PAPR_ACE, PAPR_TR, PAPR_BOTH]
+ option_labels: ['Off', Active Constellation Extension, Tone Reservation, Both
+ ACE and TR]
+ option_attributes:
+ val: [dtv.PAPR_OFF, dtv.PAPR_ACE, dtv.PAPR_TR, dtv.PAPR_BOTH]
+ hide: ${ version.hide_111 }
+- id: paprmode2
+ label: PAPR Mode
+ dtype: enum
+ options: [PAPR_OFF, PAPR_ACE, PAPR_TR, PAPR_BOTH]
+ option_labels: [P2 Only, Active Constellation Extension, Tone Reservation, Both
+ ACE and TR]
+ option_attributes:
+ val: [dtv.PAPR_OFF, dtv.PAPR_ACE, dtv.PAPR_TR, dtv.PAPR_BOTH]
+ hide: ${ version.hide_131 }
+- id: version
+ label: Specification Version
+ dtype: enum
+ options: [VERSION_111, VERSION_131]
+ option_labels: [1.1.1, 1.3.1]
+ option_attributes:
+ hide_111: ['', all]
+ hide_131: [all, '']
+ val: [dtv.VERSION_111, dtv.VERSION_131]
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+ multiplicity: '2'
+
+templates:
+ imports: from gnuradio import dtv
+ make: "dtv.dvbt2_miso_cc(${carriermode.val}, ${fftsize.val}, ${pilotpattern.val},\
+ \ ${guardinterval.val}, ${numdatasyms}, \n% if str(version) == 'VERSION_111':\n\
+ ${paprmode1.val}, \n% else:\n${paprmode2.val}, \n% endif\n)"
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt2_miso_cc.xml b/gr-dtv/grc/dtv_dvbt2_miso_cc.xml
deleted file mode 100644
index 1ef4d2afc..000000000
--- a/gr-dtv/grc/dtv_dvbt2_miso_cc.xml
+++ /dev/null
@@ -1,254 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T2 MISO Processing
-###################################################
- -->
-<block>
- <name>MISO Processing</name>
- <key>dtv_dvbt2_miso_cc</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt2_miso_cc($carriermode.val, $fftsize.val, $pilotpattern.val, $guardinterval.val, $numdatasyms, #slurp
-#if str($version) == 'VERSION_111'
-$paprmode1.val, #slurp
-#else
-$paprmode2.val, #slurp
-#end if
-)</make>
- <param>
- <name>Extended Carrier Mode</name>
- <key>carriermode</key>
- <type>enum</type>
- <option>
- <name>Normal</name>
- <key>CARRIERS_NORMAL</key>
- <opt>val:dtv.CARRIERS_NORMAL</opt>
- </option>
- <option>
- <name>Extended</name>
- <key>CARRIERS_EXTENDED</key>
- <opt>val:dtv.CARRIERS_EXTENDED</opt>
- </option>
- </param>
- <param>
- <name>FFT Size</name>
- <key>fftsize</key>
- <type>enum</type>
- <option>
- <name>1K</name>
- <key>FFTSIZE_1K</key>
- <opt>val:dtv.FFTSIZE_1K</opt>
- </option>
- <option>
- <name>2K</name>
- <key>FFTSIZE_2K</key>
- <opt>val:dtv.FFTSIZE_2K</opt>
- </option>
- <option>
- <name>4K</name>
- <key>FFTSIZE_4K</key>
- <opt>val:dtv.FFTSIZE_4K</opt>
- </option>
- <option>
- <name>8K</name>
- <key>FFTSIZE_8K</key>
- <opt>val:dtv.FFTSIZE_8K</opt>
- </option>
- <option>
- <name>8K DVB-T2 GI</name>
- <key>FFTSIZE_8K_T2GI</key>
- <opt>val:dtv.FFTSIZE_8K_T2GI</opt>
- </option>
- <option>
- <name>16K</name>
- <key>FFTSIZE_16K</key>
- <opt>val:dtv.FFTSIZE_16K</opt>
- </option>
- <option>
- <name>16K DVB-T2 GI</name>
- <key>FFTSIZE_16K_T2GI</key>
- <opt>val:dtv.FFTSIZE_16K_T2GI</opt>
- </option>
- <option>
- <name>32K</name>
- <key>FFTSIZE_32K</key>
- <opt>val:dtv.FFTSIZE_32K</opt>
- </option>
- <option>
- <name>32K DVB-T2 GI</name>
- <key>FFTSIZE_32K_T2GI</key>
- <opt>val:dtv.FFTSIZE_32K_T2GI</opt>
- </option>
- </param>
- <param>
- <name>Pilot Pattern</name>
- <key>pilotpattern</key>
- <type>enum</type>
- <option>
- <name>PP1</name>
- <key>PILOT_PP1</key>
- <opt>val:dtv.PILOT_PP1</opt>
- </option>
- <option>
- <name>PP2</name>
- <key>PILOT_PP2</key>
- <opt>val:dtv.PILOT_PP2</opt>
- </option>
- <option>
- <name>PP3</name>
- <key>PILOT_PP3</key>
- <opt>val:dtv.PILOT_PP3</opt>
- </option>
- <option>
- <name>PP4</name>
- <key>PILOT_PP4</key>
- <opt>val:dtv.PILOT_PP4</opt>
- </option>
- <option>
- <name>PP5</name>
- <key>PILOT_PP5</key>
- <opt>val:dtv.PILOT_PP5</opt>
- </option>
- <option>
- <name>PP6</name>
- <key>PILOT_PP6</key>
- <opt>val:dtv.PILOT_PP6</opt>
- </option>
- <option>
- <name>PP7</name>
- <key>PILOT_PP7</key>
- <opt>val:dtv.PILOT_PP7</opt>
- </option>
- <option>
- <name>PP8</name>
- <key>PILOT_PP8</key>
- <opt>val:dtv.PILOT_PP8</opt>
- </option>
- </param>
- <param>
- <name>Guard Interval</name>
- <key>guardinterval</key>
- <type>enum</type>
- <option>
- <name>1/32</name>
- <key>GI_1_32</key>
- <opt>val:dtv.GI_1_32</opt>
- </option>
- <option>
- <name>1/16</name>
- <key>GI_1_16</key>
- <opt>val:dtv.GI_1_16</opt>
- </option>
- <option>
- <name>1/8</name>
- <key>GI_1_8</key>
- <opt>val:dtv.GI_1_8</opt>
- </option>
- <option>
- <name>1/4</name>
- <key>GI_1_4</key>
- <opt>val:dtv.GI_1_4</opt>
- </option>
- <option>
- <name>1/128</name>
- <key>GI_1_128</key>
- <opt>val:dtv.GI_1_128</opt>
- </option>
- <option>
- <name>19/128</name>
- <key>GI_19_128</key>
- <opt>val:dtv.GI_19_128</opt>
- </option>
- <option>
- <name>19/256</name>
- <key>GI_19_256</key>
- <opt>val:dtv.GI_19_256</opt>
- </option>
- </param>
- <param>
- <name>Number of Data Symbols</name>
- <key>numdatasyms</key>
- <value>100</value>
- <type>int</type>
- </param>
- <param>
- <name>PAPR Mode</name>
- <key>paprmode1</key>
- <type>enum</type>
- <hide>$version.hide_111</hide>
- <option>
- <name>Off</name>
- <key>PAPR_OFF</key>
- <opt>val:dtv.PAPR_OFF</opt>
- </option>
- <option>
- <name>Active Constellation Extension</name>
- <key>PAPR_ACE</key>
- <opt>val:dtv.PAPR_ACE</opt>
- </option>
- <option>
- <name>Tone Reservation</name>
- <key>PAPR_TR</key>
- <opt>val:dtv.PAPR_TR</opt>
- </option>
- <option>
- <name>Both ACE and TR</name>
- <key>PAPR_BOTH</key>
- <opt>val:dtv.PAPR_BOTH</opt>
- </option>
- </param>
- <param>
- <name>PAPR Mode</name>
- <key>paprmode2</key>
- <type>enum</type>
- <hide>$version.hide_131</hide>
- <option>
- <name>P2 Only</name>
- <key>PAPR_OFF</key>
- <opt>val:dtv.PAPR_OFF</opt>
- </option>
- <option>
- <name>Active Constellation Extension</name>
- <key>PAPR_ACE</key>
- <opt>val:dtv.PAPR_ACE</opt>
- </option>
- <option>
- <name>Tone Reservation</name>
- <key>PAPR_TR</key>
- <opt>val:dtv.PAPR_TR</opt>
- </option>
- <option>
- <name>Both ACE and TR</name>
- <key>PAPR_BOTH</key>
- <opt>val:dtv.PAPR_BOTH</opt>
- </option>
- </param>
- <param>
- <name>Specification Version</name>
- <key>version</key>
- <type>enum</type>
- <option>
- <name>1.1.1</name>
- <key>VERSION_111</key>
- <opt>val:dtv.VERSION_111</opt>
- <opt>hide_111:</opt>
- <opt>hide_131:all</opt>
- </option>
- <option>
- <name>1.3.1</name>
- <key>VERSION_131</key>
- <opt>val:dtv.VERSION_131</opt>
- <opt>hide_111:all</opt>
- <opt>hide_131:</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- <nports>2</nports>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt2_modulator_bc.block.yml b/gr-dtv/grc/dtv_dvbt2_modulator_bc.block.yml
new file mode 100644
index 000000000..5b1a9dd83
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt2_modulator_bc.block.yml
@@ -0,0 +1,39 @@
+id: dtv_dvbt2_modulator_bc
+label: DVB-T2 Modulator
+
+parameters:
+- id: framesize
+ label: FECFRAME size
+ dtype: enum
+ options: [FECFRAME_NORMAL, FECFRAME_SHORT]
+ option_labels: [Normal, Short]
+ option_attributes:
+ val: [dtv.FECFRAME_NORMAL, dtv.FECFRAME_SHORT]
+- id: constellation
+ label: Constellation
+ dtype: enum
+ options: [MOD_QPSK, MOD_16QAM, MOD_64QAM, MOD_256QAM]
+ option_labels: [QPSK, 16QAM, 64QAM, 256QAM]
+ option_attributes:
+ val: [dtv.MOD_QPSK, dtv.MOD_16QAM, dtv.MOD_64QAM, dtv.MOD_256QAM]
+- id: rotation
+ label: Constellation rotation
+ dtype: enum
+ options: [ROTATION_OFF, ROTATION_ON]
+ option_labels: ['Off', 'On']
+ option_attributes:
+ val: [dtv.ROTATION_OFF, dtv.ROTATION_ON]
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt2_modulator_bc(${framesize.val}, ${constellation.val}, ${rotation.val})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt2_modulator_bc.xml b/gr-dtv/grc/dtv_dvbt2_modulator_bc.xml
deleted file mode 100644
index 6bf17b831..000000000
--- a/gr-dtv/grc/dtv_dvbt2_modulator_bc.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T2 QPSK/QAM Modulator
-###################################################
- -->
-<block>
- <name>DVB-T2 Modulator</name>
- <key>dtv_dvbt2_modulator_bc</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt2_modulator_bc($framesize.val, $constellation.val, $rotation.val)</make>
- <param>
- <name>FECFRAME size</name>
- <key>framesize</key>
- <type>enum</type>
- <option>
- <name>Normal</name>
- <key>FECFRAME_NORMAL</key>
- <opt>val:dtv.FECFRAME_NORMAL</opt>
- </option>
- <option>
- <name>Short</name>
- <key>FECFRAME_SHORT</key>
- <opt>val:dtv.FECFRAME_SHORT</opt>
- </option>
- </param>
- <param>
- <name>Constellation</name>
- <key>constellation</key>
- <type>enum</type>
- <option>
- <name>QPSK</name>
- <key>MOD_QPSK</key>
- <opt>val:dtv.MOD_QPSK</opt>
- </option>
- <option>
- <name>16QAM</name>
- <key>MOD_16QAM</key>
- <opt>val:dtv.MOD_16QAM</opt>
- </option>
- <option>
- <name>64QAM</name>
- <key>MOD_64QAM</key>
- <opt>val:dtv.MOD_64QAM</opt>
- </option>
- <option>
- <name>256QAM</name>
- <key>MOD_256QAM</key>
- <opt>val:dtv.MOD_256QAM</opt>
- </option>
- </param>
- <param>
- <name>Constellation rotation</name>
- <key>rotation</key>
- <type>enum</type>
- <option>
- <name>Off</name>
- <key>ROTATION_OFF</key>
- <opt>val:dtv.ROTATION_OFF</opt>
- </option>
- <option>
- <name>On</name>
- <key>ROTATION_ON</key>
- <opt>val:dtv.ROTATION_ON</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt2_p1insertion_cc.block.yml b/gr-dtv/grc/dtv_dvbt2_p1insertion_cc.block.yml
new file mode 100644
index 000000000..ad9ab8519
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt2_p1insertion_cc.block.yml
@@ -0,0 +1,106 @@
+id: dtv_dvbt2_p1insertion_cc
+label: P1 Symbol Insertion
+
+parameters:
+- id: carriermode
+ label: Extended Carrier Mode
+ dtype: enum
+ options: [CARRIERS_NORMAL, CARRIERS_EXTENDED]
+ option_labels: [Normal, Extended]
+ option_attributes:
+ val: [dtv.CARRIERS_NORMAL, dtv.CARRIERS_EXTENDED]
+- id: fftsize1
+ label: FFT Size
+ dtype: enum
+ options: [FFTSIZE_1K, FFTSIZE_2K, FFTSIZE_4K, FFTSIZE_8K, FFTSIZE_8K_T2GI, FFTSIZE_16K,
+ FFTSIZE_32K, FFTSIZE_32K_T2GI]
+ option_labels: [1K, 2K, 4K, 8K, 8K DVB-T2 GI, 16K, 32K, 32K DVB-T2 GI]
+ option_attributes:
+ val: [dtv.FFTSIZE_1K, dtv.FFTSIZE_2K, dtv.FFTSIZE_4K, dtv.FFTSIZE_8K, dtv.FFTSIZE_8K_T2GI,
+ dtv.FFTSIZE_16K, dtv.FFTSIZE_32K, dtv.FFTSIZE_32K_T2GI]
+ hide: ${ (preamble1.hide_base if str(version) == 'VERSION_111' else preamble2.hide_base)
+ }
+- id: fftsize2
+ label: FFT Size
+ dtype: enum
+ options: [FFTSIZE_2K, FFTSIZE_4K, FFTSIZE_8K, FFTSIZE_8K_T2GI, FFTSIZE_16K, FFTSIZE_16K_T2GI]
+ option_labels: [2K, 4K, 8K, 8K DVB-T2 GI, 16K, 16K DVB-T2 GI]
+ option_attributes:
+ val: [dtv.FFTSIZE_2K, dtv.FFTSIZE_4K, dtv.FFTSIZE_8K, dtv.FFTSIZE_8K_T2GI,
+ dtv.FFTSIZE_16K, dtv.FFTSIZE_16K_T2GI]
+ hide: ${ (preamble1.hide_lite if str(version) == 'VERSION_111' else preamble2.hide_lite)
+ }
+- id: guardinterval
+ label: Guard Interval
+ dtype: enum
+ options: [GI_1_32, GI_1_16, GI_1_8, GI_1_4, GI_1_128, GI_19_128, GI_19_256]
+ option_labels: [1/32, 1/16, 1/8, 1/4, 1/128, 19/128, 19/256]
+ option_attributes:
+ val: [dtv.GI_1_32, dtv.GI_1_16, dtv.GI_1_8, dtv.GI_1_4, dtv.GI_1_128, dtv.GI_19_128,
+ dtv.GI_19_256]
+- id: numdatasyms
+ label: Number of Data Symbols
+ dtype: int
+ default: '100'
+- id: version
+ label: Specification Version
+ dtype: enum
+ options: [VERSION_111, VERSION_131]
+ option_labels: [1.1.1, 1.3.1]
+ option_attributes:
+ hide_111: ['', all]
+ hide_131: [all, '']
+ val: [dtv.VERSION_111, dtv.VERSION_131]
+- id: preamble1
+ label: Preamble
+ dtype: enum
+ options: [PREAMBLE_T2_SISO, PREAMBLE_T2_MISO]
+ option_labels: [T2 SISO, T2 MISO]
+ option_attributes:
+ hide_base: ['', '']
+ hide_lite: [all, all]
+ val: [dtv.PREAMBLE_T2_SISO, dtv.PREAMBLE_T2_MISO]
+ hide: ${ version.hide_111 }
+- id: preamble2
+ label: Preamble
+ dtype: enum
+ options: [PREAMBLE_T2_SISO, PREAMBLE_T2_MISO, PREAMBLE_T2_LITE_SISO, PREAMBLE_T2_LITE_MISO]
+ option_labels: [T2 SISO, T2 MISO, T2-Lite SISO, T2-Lite MISO]
+ option_attributes:
+ hide_base: ['', '', all, all]
+ hide_lite: [all, all, '', '']
+ val: [dtv.PREAMBLE_T2_SISO, dtv.PREAMBLE_T2_MISO, dtv.PREAMBLE_T2_LITE_SISO,
+ dtv.PREAMBLE_T2_LITE_MISO]
+ hide: ${ version.hide_131 }
+- id: showlevels
+ label: Show Peak IQ Levels
+ dtype: enum
+ options: [SHOWLEVELS_OFF, SHOWLEVELS_ON]
+ option_labels: ['Off', 'On']
+ option_attributes:
+ hide_vclip: [all, '']
+ val: [dtv.SHOWLEVELS_OFF, dtv.SHOWLEVELS_ON]
+- id: vclip
+ label: Vclip
+ dtype: float
+ default: '3.3'
+ hide: ${ showlevels.hide_vclip }
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import dtv
+ make: "dtv.dvbt2_p1insertion_cc(${carriermode.val}, \n% if str(version) == 'VERSION_111':\n\
+ ${fftsize1.val}, \n% else:\n% if str(preamble2) == 'PREAMBLE_T2_SISO' or str(preamble2)\
+ \ == 'PREAMBLE_T2_MISO':\n${fftsize1.val}, \n% else:\n${fftsize2.val}, \n\
+ % endif\n% endif\n${guardinterval.val}, ${numdatasyms}, \n% if str(version)\
+ \ == 'VERSION_111':\n${preamble1.val}, \n% else:\n${preamble2.val}, \n% endif\n\
+ ${showlevels.val}, ${vclip})"
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt2_p1insertion_cc.xml b/gr-dtv/grc/dtv_dvbt2_p1insertion_cc.xml
deleted file mode 100644
index c73cf72ae..000000000
--- a/gr-dtv/grc/dtv_dvbt2_p1insertion_cc.xml
+++ /dev/null
@@ -1,276 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T2 P1 Symbol Insertion
-###################################################
- -->
-<block>
- <name>P1 Symbol Insertion</name>
- <key>dtv_dvbt2_p1insertion_cc</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt2_p1insertion_cc($carriermode.val, #slurp
-#if str($version) == 'VERSION_111'
-$fftsize1.val, #slurp
-#else
-#if str($preamble2) == 'PREAMBLE_T2_SISO' or str($preamble2) == 'PREAMBLE_T2_MISO'
-$fftsize1.val, #slurp
-#else
-$fftsize2.val, #slurp
-#end if
-#end if
-$guardinterval.val, $numdatasyms, #slurp
-#if str($version) == 'VERSION_111'
-$preamble1.val, #slurp
-#else
-$preamble2.val, #slurp
-#end if
-$showlevels.val, $vclip)</make>
- <param>
- <name>Extended Carrier Mode</name>
- <key>carriermode</key>
- <type>enum</type>
- <option>
- <name>Normal</name>
- <key>CARRIERS_NORMAL</key>
- <opt>val:dtv.CARRIERS_NORMAL</opt>
- </option>
- <option>
- <name>Extended</name>
- <key>CARRIERS_EXTENDED</key>
- <opt>val:dtv.CARRIERS_EXTENDED</opt>
- </option>
- </param>
- <param>
- <name>FFT Size</name>
- <key>fftsize1</key>
- <type>enum</type>
- <hide>#if str($version) == 'VERSION_111' then $preamble1.hide_base else $preamble2.hide_base</hide>
- <option>
- <name>1K</name>
- <key>FFTSIZE_1K</key>
- <opt>val:dtv.FFTSIZE_1K</opt>
- </option>
- <option>
- <name>2K</name>
- <key>FFTSIZE_2K</key>
- <opt>val:dtv.FFTSIZE_2K</opt>
- </option>
- <option>
- <name>4K</name>
- <key>FFTSIZE_4K</key>
- <opt>val:dtv.FFTSIZE_4K</opt>
- </option>
- <option>
- <name>8K</name>
- <key>FFTSIZE_8K</key>
- <opt>val:dtv.FFTSIZE_8K</opt>
- </option>
- <option>
- <name>8K DVB-T2 GI</name>
- <key>FFTSIZE_8K_T2GI</key>
- <opt>val:dtv.FFTSIZE_8K_T2GI</opt>
- </option>
- <option>
- <name>16K</name>
- <key>FFTSIZE_16K</key>
- <opt>val:dtv.FFTSIZE_16K</opt>
- </option>
- <option>
- <name>32K</name>
- <key>FFTSIZE_32K</key>
- <opt>val:dtv.FFTSIZE_32K</opt>
- </option>
- <option>
- <name>32K DVB-T2 GI</name>
- <key>FFTSIZE_32K_T2GI</key>
- <opt>val:dtv.FFTSIZE_32K_T2GI</opt>
- </option>
- </param>
- <param>
- <name>FFT Size</name>
- <key>fftsize2</key>
- <type>enum</type>
- <hide>#if str($version) == 'VERSION_111' then $preamble1.hide_lite else $preamble2.hide_lite</hide>
- <option>
- <name>2K</name>
- <key>FFTSIZE_2K</key>
- <opt>val:dtv.FFTSIZE_2K</opt>
- </option>
- <option>
- <name>4K</name>
- <key>FFTSIZE_4K</key>
- <opt>val:dtv.FFTSIZE_4K</opt>
- </option>
- <option>
- <name>8K</name>
- <key>FFTSIZE_8K</key>
- <opt>val:dtv.FFTSIZE_8K</opt>
- </option>
- <option>
- <name>8K DVB-T2 GI</name>
- <key>FFTSIZE_8K_T2GI</key>
- <opt>val:dtv.FFTSIZE_8K_T2GI</opt>
- </option>
- <option>
- <name>16K</name>
- <key>FFTSIZE_16K</key>
- <opt>val:dtv.FFTSIZE_16K</opt>
- </option>
- <option>
- <name>16K DVB-T2 GI</name>
- <key>FFTSIZE_16K_T2GI</key>
- <opt>val:dtv.FFTSIZE_16K_T2GI</opt>
- </option>
- </param>
- <param>
- <name>Guard Interval</name>
- <key>guardinterval</key>
- <type>enum</type>
- <option>
- <name>1/32</name>
- <key>GI_1_32</key>
- <opt>val:dtv.GI_1_32</opt>
- </option>
- <option>
- <name>1/16</name>
- <key>GI_1_16</key>
- <opt>val:dtv.GI_1_16</opt>
- </option>
- <option>
- <name>1/8</name>
- <key>GI_1_8</key>
- <opt>val:dtv.GI_1_8</opt>
- </option>
- <option>
- <name>1/4</name>
- <key>GI_1_4</key>
- <opt>val:dtv.GI_1_4</opt>
- </option>
- <option>
- <name>1/128</name>
- <key>GI_1_128</key>
- <opt>val:dtv.GI_1_128</opt>
- </option>
- <option>
- <name>19/128</name>
- <key>GI_19_128</key>
- <opt>val:dtv.GI_19_128</opt>
- </option>
- <option>
- <name>19/256</name>
- <key>GI_19_256</key>
- <opt>val:dtv.GI_19_256</opt>
- </option>
- </param>
- <param>
- <name>Number of Data Symbols</name>
- <key>numdatasyms</key>
- <value>100</value>
- <type>int</type>
- </param>
- <param>
- <name>Specification Version</name>
- <key>version</key>
- <type>enum</type>
- <option>
- <name>1.1.1</name>
- <key>VERSION_111</key>
- <opt>val:dtv.VERSION_111</opt>
- <opt>hide_111:</opt>
- <opt>hide_131:all</opt>
- </option>
- <option>
- <name>1.3.1</name>
- <key>VERSION_131</key>
- <opt>val:dtv.VERSION_131</opt>
- <opt>hide_111:all</opt>
- <opt>hide_131:</opt>
- </option>
- </param>
- <param>
- <name>Preamble</name>
- <key>preamble1</key>
- <type>enum</type>
- <hide>$version.hide_111</hide>
- <option>
- <name>T2 SISO</name>
- <key>PREAMBLE_T2_SISO</key>
- <opt>val:dtv.PREAMBLE_T2_SISO</opt>
- <opt>hide_lite:all</opt>
- <opt>hide_base:</opt>
- </option>
- <option>
- <name>T2 MISO</name>
- <key>PREAMBLE_T2_MISO</key>
- <opt>val:dtv.PREAMBLE_T2_MISO</opt>
- <opt>hide_lite:all</opt>
- <opt>hide_base:</opt>
- </option>
- </param>
- <param>
- <name>Preamble</name>
- <key>preamble2</key>
- <type>enum</type>
- <hide>$version.hide_131</hide>
- <option>
- <name>T2 SISO</name>
- <key>PREAMBLE_T2_SISO</key>
- <opt>val:dtv.PREAMBLE_T2_SISO</opt>
- <opt>hide_lite:all</opt>
- <opt>hide_base:</opt>
- </option>
- <option>
- <name>T2 MISO</name>
- <key>PREAMBLE_T2_MISO</key>
- <opt>val:dtv.PREAMBLE_T2_MISO</opt>
- <opt>hide_lite:all</opt>
- <opt>hide_base:</opt>
- </option>
- <option>
- <name>T2-Lite SISO</name>
- <key>PREAMBLE_T2_LITE_SISO</key>
- <opt>val:dtv.PREAMBLE_T2_LITE_SISO</opt>
- <opt>hide_lite:</opt>
- <opt>hide_base:all</opt>
- </option>
- <option>
- <name>T2-Lite MISO</name>
- <key>PREAMBLE_T2_LITE_MISO</key>
- <opt>val:dtv.PREAMBLE_T2_LITE_MISO</opt>
- <opt>hide_lite:</opt>
- <opt>hide_base:all</opt>
- </option>
- </param>
- <param>
- <name>Show Peak IQ Levels</name>
- <key>showlevels</key>
- <type>enum</type>
- <option>
- <name>Off</name>
- <key>SHOWLEVELS_OFF</key>
- <opt>val:dtv.SHOWLEVELS_OFF</opt>
- <opt>hide_vclip:all</opt>
- </option>
- <option>
- <name>On</name>
- <key>SHOWLEVELS_ON</key>
- <opt>val:dtv.SHOWLEVELS_ON</opt>
- <opt>hide_vclip:</opt>
- </option>
- </param>
- <param>
- <name>Vclip</name>
- <key>vclip</key>
- <value>3.3</value>
- <type>float</type>
- <hide>$showlevels.hide_vclip</hide>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt2_paprtr_cc.block.yml b/gr-dtv/grc/dtv_dvbt2_paprtr_cc.block.yml
new file mode 100644
index 000000000..0e1d6c285
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt2_paprtr_cc.block.yml
@@ -0,0 +1,105 @@
+id: dtv_dvbt2_paprtr_cc
+label: Tone Reservation PAPR
+
+parameters:
+- id: carriermode
+ label: Extended Carrier Mode
+ dtype: enum
+ options: [CARRIERS_NORMAL, CARRIERS_EXTENDED]
+ option_labels: [Normal, Extended]
+ option_attributes:
+ val: [dtv.CARRIERS_NORMAL, dtv.CARRIERS_EXTENDED]
+- id: fftsize
+ label: FFT Size
+ dtype: enum
+ options: [FFTSIZE_1K, FFTSIZE_2K, FFTSIZE_4K, FFTSIZE_8K, FFTSIZE_8K_T2GI, FFTSIZE_16K,
+ FFTSIZE_16K_T2GI, FFTSIZE_32K, FFTSIZE_32K_T2GI]
+ option_labels: [1K, 2K, 4K, 8K, 8K DVB-T2 GI, 16K, 16K DVB-T2 GI, 32K, 32K DVB-T2
+ GI]
+ option_attributes:
+ val: [dtv.FFTSIZE_1K, dtv.FFTSIZE_2K, dtv.FFTSIZE_4K, dtv.FFTSIZE_8K, dtv.FFTSIZE_8K_T2GI,
+ dtv.FFTSIZE_16K, dtv.FFTSIZE_16K_T2GI, dtv.FFTSIZE_32K, dtv.FFTSIZE_32K_T2GI]
+ vlength: ['1024', '2048', '4096', '8192', '8192', '16384', '16384', '32768',
+ '32768']
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: pilotpattern
+ label: Pilot Pattern
+ dtype: enum
+ options: [PILOT_PP1, PILOT_PP2, PILOT_PP3, PILOT_PP4, PILOT_PP5, PILOT_PP6, PILOT_PP7,
+ PILOT_PP8]
+ option_labels: [PP1, PP2, PP3, PP4, PP5, PP6, PP7, PP8]
+ option_attributes:
+ val: [dtv.PILOT_PP1, dtv.PILOT_PP2, dtv.PILOT_PP3, dtv.PILOT_PP4, dtv.PILOT_PP5,
+ dtv.PILOT_PP6, dtv.PILOT_PP7, dtv.PILOT_PP8]
+- id: guardinterval
+ label: Guard Interval
+ dtype: enum
+ options: [GI_1_32, GI_1_16, GI_1_8, GI_1_4, GI_1_128, GI_19_128, GI_19_256]
+ option_labels: [1/32, 1/16, 1/8, 1/4, 1/128, 19/128, 19/256]
+ option_attributes:
+ val: [dtv.GI_1_32, dtv.GI_1_16, dtv.GI_1_8, dtv.GI_1_4, dtv.GI_1_128, dtv.GI_19_128,
+ dtv.GI_19_256]
+- id: numdatasyms
+ label: Number of Data Symbols
+ dtype: int
+ default: '100'
+- id: paprmode1
+ label: PAPR Mode
+ dtype: enum
+ options: [PAPR_OFF, PAPR_ACE, PAPR_TR, PAPR_BOTH]
+ option_labels: ['Off', Active Constellation Extension, Tone Reservation, Both
+ ACE and TR]
+ option_attributes:
+ hide_vclip: [all, all, '', '']
+ val: [dtv.PAPR_OFF, dtv.PAPR_ACE, dtv.PAPR_TR, dtv.PAPR_BOTH]
+ hide: ${ version.hide_111 }
+- id: paprmode2
+ label: PAPR Mode
+ dtype: enum
+ options: [PAPR_OFF, PAPR_ACE, PAPR_TR, PAPR_BOTH]
+ option_labels: [P2 Only, Active Constellation Extension, Tone Reservation, Both
+ ACE and TR]
+ option_attributes:
+ hide_vclip: [all, all, '', '']
+ val: [dtv.PAPR_OFF, dtv.PAPR_ACE, dtv.PAPR_TR, dtv.PAPR_BOTH]
+ hide: ${ version.hide_131 }
+- id: version
+ label: Specification Version
+ dtype: enum
+ options: [VERSION_111, VERSION_131]
+ option_labels: [1.1.1, 1.3.1]
+ option_attributes:
+ hide_111: ['', all]
+ hide_131: [all, '']
+ val: [dtv.VERSION_111, dtv.VERSION_131]
+- id: vclip
+ label: Vclip
+ dtype: float
+ default: '3.3'
+ hide: ${ (paprmode1.hide_vclip if str(version) == 'VERSION_111' else paprmode2.hide_vclip)
+ }
+- id: iterations
+ label: Iterations
+ dtype: int
+ default: '10'
+ hide: ${ (paprmode1.hide_vclip if str(version) == 'VERSION_111' else paprmode2.hide_vclip)
+ }
+
+inputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ fftsize.vlength }
+
+outputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ fftsize.vlength }
+
+templates:
+ imports: from gnuradio import dtv
+ make: "dtv.dvbt2_paprtr_cc(${carriermode.val}, ${fftsize.val}, ${pilotpattern.val},\
+ \ ${guardinterval.val}, ${numdatasyms}, \n% if str(version) == 'VERSION_111':\n\
+ ${paprmode1.val}, \n% else:\n${paprmode2.val}, \n% endif\n${version.val},\
+ \ ${vclip}, ${iterations}, ${fftsize.vlength})"
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt2_paprtr_cc.xml b/gr-dtv/grc/dtv_dvbt2_paprtr_cc.xml
deleted file mode 100644
index 4fa37ef5b..000000000
--- a/gr-dtv/grc/dtv_dvbt2_paprtr_cc.xml
+++ /dev/null
@@ -1,286 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T2 Tone Reservation PAPR
-###################################################
- -->
-<block>
- <name>Tone Reservation PAPR</name>
- <key>dtv_dvbt2_paprtr_cc</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt2_paprtr_cc($carriermode.val, $fftsize.val, $pilotpattern.val, $guardinterval.val, $numdatasyms, #slurp
-#if str($version) == 'VERSION_111'
-$paprmode1.val, #slurp
-#else
-$paprmode2.val, #slurp
-#end if
-$version.val, $vclip, $iterations, $fftsize.vlength)</make>
- <param>
- <name>Extended Carrier Mode</name>
- <key>carriermode</key>
- <type>enum</type>
- <option>
- <name>Normal</name>
- <key>CARRIERS_NORMAL</key>
- <opt>val:dtv.CARRIERS_NORMAL</opt>
- </option>
- <option>
- <name>Extended</name>
- <key>CARRIERS_EXTENDED</key>
- <opt>val:dtv.CARRIERS_EXTENDED</opt>
- </option>
- </param>
- <param>
- <name>FFT Size</name>
- <key>fftsize</key>
- <type>enum</type>
- <option>
- <name>1K</name>
- <key>FFTSIZE_1K</key>
- <opt>val:dtv.FFTSIZE_1K</opt>
- <opt>vlength:1024</opt>
- </option>
- <option>
- <name>2K</name>
- <key>FFTSIZE_2K</key>
- <opt>val:dtv.FFTSIZE_2K</opt>
- <opt>vlength:2048</opt>
- </option>
- <option>
- <name>4K</name>
- <key>FFTSIZE_4K</key>
- <opt>val:dtv.FFTSIZE_4K</opt>
- <opt>vlength:4096</opt>
- </option>
- <option>
- <name>8K</name>
- <key>FFTSIZE_8K</key>
- <opt>val:dtv.FFTSIZE_8K</opt>
- <opt>vlength:8192</opt>
- </option>
- <option>
- <name>8K DVB-T2 GI</name>
- <key>FFTSIZE_8K_T2GI</key>
- <opt>val:dtv.FFTSIZE_8K_T2GI</opt>
- <opt>vlength:8192</opt>
- </option>
- <option>
- <name>16K</name>
- <key>FFTSIZE_16K</key>
- <opt>val:dtv.FFTSIZE_16K</opt>
- <opt>vlength:16384</opt>
- </option>
- <option>
- <name>16K DVB-T2 GI</name>
- <key>FFTSIZE_16K_T2GI</key>
- <opt>val:dtv.FFTSIZE_16K_T2GI</opt>
- <opt>vlength:16384</opt>
- </option>
- <option>
- <name>32K</name>
- <key>FFTSIZE_32K</key>
- <opt>val:dtv.FFTSIZE_32K</opt>
- <opt>vlength:32768</opt>
- </option>
- <option>
- <name>32K DVB-T2 GI</name>
- <key>FFTSIZE_32K_T2GI</key>
- <opt>val:dtv.FFTSIZE_32K_T2GI</opt>
- <opt>vlength:32768</opt>
- </option>
- </param>
- <param>
- <name>Pilot Pattern</name>
- <key>pilotpattern</key>
- <type>enum</type>
- <option>
- <name>PP1</name>
- <key>PILOT_PP1</key>
- <opt>val:dtv.PILOT_PP1</opt>
- </option>
- <option>
- <name>PP2</name>
- <key>PILOT_PP2</key>
- <opt>val:dtv.PILOT_PP2</opt>
- </option>
- <option>
- <name>PP3</name>
- <key>PILOT_PP3</key>
- <opt>val:dtv.PILOT_PP3</opt>
- </option>
- <option>
- <name>PP4</name>
- <key>PILOT_PP4</key>
- <opt>val:dtv.PILOT_PP4</opt>
- </option>
- <option>
- <name>PP5</name>
- <key>PILOT_PP5</key>
- <opt>val:dtv.PILOT_PP5</opt>
- </option>
- <option>
- <name>PP6</name>
- <key>PILOT_PP6</key>
- <opt>val:dtv.PILOT_PP6</opt>
- </option>
- <option>
- <name>PP7</name>
- <key>PILOT_PP7</key>
- <opt>val:dtv.PILOT_PP7</opt>
- </option>
- <option>
- <name>PP8</name>
- <key>PILOT_PP8</key>
- <opt>val:dtv.PILOT_PP8</opt>
- </option>
- </param>
- <param>
- <name>Guard Interval</name>
- <key>guardinterval</key>
- <type>enum</type>
- <option>
- <name>1/32</name>
- <key>GI_1_32</key>
- <opt>val:dtv.GI_1_32</opt>
- </option>
- <option>
- <name>1/16</name>
- <key>GI_1_16</key>
- <opt>val:dtv.GI_1_16</opt>
- </option>
- <option>
- <name>1/8</name>
- <key>GI_1_8</key>
- <opt>val:dtv.GI_1_8</opt>
- </option>
- <option>
- <name>1/4</name>
- <key>GI_1_4</key>
- <opt>val:dtv.GI_1_4</opt>
- </option>
- <option>
- <name>1/128</name>
- <key>GI_1_128</key>
- <opt>val:dtv.GI_1_128</opt>
- </option>
- <option>
- <name>19/128</name>
- <key>GI_19_128</key>
- <opt>val:dtv.GI_19_128</opt>
- </option>
- <option>
- <name>19/256</name>
- <key>GI_19_256</key>
- <opt>val:dtv.GI_19_256</opt>
- </option>
- </param>
- <param>
- <name>Number of Data Symbols</name>
- <key>numdatasyms</key>
- <value>100</value>
- <type>int</type>
- </param>
- <param>
- <name>PAPR Mode</name>
- <key>paprmode1</key>
- <type>enum</type>
- <hide>$version.hide_111</hide>
- <option>
- <name>Off</name>
- <key>PAPR_OFF</key>
- <opt>val:dtv.PAPR_OFF</opt>
- <opt>hide_vclip:all</opt>
- </option>
- <option>
- <name>Active Constellation Extension</name>
- <key>PAPR_ACE</key>
- <opt>val:dtv.PAPR_ACE</opt>
- <opt>hide_vclip:all</opt>
- </option>
- <option>
- <name>Tone Reservation</name>
- <key>PAPR_TR</key>
- <opt>val:dtv.PAPR_TR</opt>
- <opt>hide_vclip:</opt>
- </option>
- <option>
- <name>Both ACE and TR</name>
- <key>PAPR_BOTH</key>
- <opt>val:dtv.PAPR_BOTH</opt>
- <opt>hide_vclip:</opt>
- </option>
- </param>
- <param>
- <name>PAPR Mode</name>
- <key>paprmode2</key>
- <type>enum</type>
- <hide>$version.hide_131</hide>
- <option>
- <name>P2 Only</name>
- <key>PAPR_OFF</key>
- <opt>val:dtv.PAPR_OFF</opt>
- <opt>hide_vclip:all</opt>
- </option>
- <option>
- <name>Active Constellation Extension</name>
- <key>PAPR_ACE</key>
- <opt>val:dtv.PAPR_ACE</opt>
- <opt>hide_vclip:all</opt>
- </option>
- <option>
- <name>Tone Reservation</name>
- <key>PAPR_TR</key>
- <opt>val:dtv.PAPR_TR</opt>
- <opt>hide_vclip:</opt>
- </option>
- <option>
- <name>Both ACE and TR</name>
- <key>PAPR_BOTH</key>
- <opt>val:dtv.PAPR_BOTH</opt>
- <opt>hide_vclip:</opt>
- </option>
- </param>
- <param>
- <name>Specification Version</name>
- <key>version</key>
- <type>enum</type>
- <option>
- <name>1.1.1</name>
- <key>VERSION_111</key>
- <opt>val:dtv.VERSION_111</opt>
- <opt>hide_111:</opt>
- <opt>hide_131:all</opt>
- </option>
- <option>
- <name>1.3.1</name>
- <key>VERSION_131</key>
- <opt>val:dtv.VERSION_131</opt>
- <opt>hide_111:all</opt>
- <opt>hide_131:</opt>
- </option>
- </param>
- <param>
- <name>Vclip</name>
- <key>vclip</key>
- <value>3.3</value>
- <type>float</type>
- <hide>#if str($version) == 'VERSION_111' then $paprmode1.hide_vclip else $paprmode2.hide_vclip</hide>
- </param>
- <param>
- <name>Iterations</name>
- <key>iterations</key>
- <value>10</value>
- <type>int</type>
- <hide>#if str($version) == 'VERSION_111' then $paprmode1.hide_vclip else $paprmode2.hide_vclip</hide>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- <vlen>$fftsize.vlength</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- <vlen>$fftsize.vlength</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt2_pilotgenerator_cc.block.yml b/gr-dtv/grc/dtv_dvbt2_pilotgenerator_cc.block.yml
new file mode 100644
index 000000000..083b86056
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt2_pilotgenerator_cc.block.yml
@@ -0,0 +1,137 @@
+id: dtv_dvbt2_pilotgenerator_cc
+label: Pilot Generator and IFFT
+
+parameters:
+- id: carriermode
+ label: Extended Carrier Mode
+ dtype: enum
+ options: [CARRIERS_NORMAL, CARRIERS_EXTENDED]
+ option_labels: [Normal, Extended]
+ option_attributes:
+ val: [dtv.CARRIERS_NORMAL, dtv.CARRIERS_EXTENDED]
+- id: fftsize
+ label: FFT Size
+ dtype: enum
+ options: [FFTSIZE_1K, FFTSIZE_2K, FFTSIZE_4K, FFTSIZE_8K, FFTSIZE_8K_T2GI, FFTSIZE_16K,
+ FFTSIZE_16K_T2GI, FFTSIZE_32K, FFTSIZE_32K_T2GI]
+ option_labels: [1K, 2K, 4K, 8K, 8K DVB-T2 GI, 16K, 16K DVB-T2 GI, 32K, 32K DVB-T2
+ GI]
+ option_attributes:
+ val: [dtv.FFTSIZE_1K, dtv.FFTSIZE_2K, dtv.FFTSIZE_4K, dtv.FFTSIZE_8K, dtv.FFTSIZE_8K_T2GI,
+ dtv.FFTSIZE_16K, dtv.FFTSIZE_16K_T2GI, dtv.FFTSIZE_32K, dtv.FFTSIZE_32K_T2GI]
+ vlength: ['1024', '2048', '4096', '8192', '8192', '16384', '16384', '32768',
+ '32768']
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: pilotpattern
+ label: Pilot Pattern
+ dtype: enum
+ options: [PILOT_PP1, PILOT_PP2, PILOT_PP3, PILOT_PP4, PILOT_PP5, PILOT_PP6, PILOT_PP7,
+ PILOT_PP8]
+ option_labels: [PP1, PP2, PP3, PP4, PP5, PP6, PP7, PP8]
+ option_attributes:
+ val: [dtv.PILOT_PP1, dtv.PILOT_PP2, dtv.PILOT_PP3, dtv.PILOT_PP4, dtv.PILOT_PP5,
+ dtv.PILOT_PP6, dtv.PILOT_PP7, dtv.PILOT_PP8]
+- id: guardinterval
+ label: Guard Interval
+ dtype: enum
+ options: [GI_1_32, GI_1_16, GI_1_8, GI_1_4, GI_1_128, GI_19_128, GI_19_256]
+ option_labels: [1/32, 1/16, 1/8, 1/4, 1/128, 19/128, 19/256]
+ option_attributes:
+ val: [dtv.GI_1_32, dtv.GI_1_16, dtv.GI_1_8, dtv.GI_1_4, dtv.GI_1_128, dtv.GI_19_128,
+ dtv.GI_19_256]
+- id: numdatasyms
+ label: Number of Data Symbols
+ dtype: int
+ default: '100'
+- id: paprmode1
+ label: PAPR Mode
+ dtype: enum
+ options: [PAPR_OFF, PAPR_ACE, PAPR_TR, PAPR_BOTH]
+ option_labels: ['Off', Active Constellation Extension, Tone Reservation, Both
+ ACE and TR]
+ option_attributes:
+ val: [dtv.PAPR_OFF, dtv.PAPR_ACE, dtv.PAPR_TR, dtv.PAPR_BOTH]
+ hide: ${ version.hide_111 }
+- id: paprmode2
+ label: PAPR Mode
+ dtype: enum
+ options: [PAPR_OFF, PAPR_ACE, PAPR_TR, PAPR_BOTH]
+ option_labels: [P2 Only, Active Constellation Extension, Tone Reservation, Both
+ ACE and TR]
+ option_attributes:
+ val: [dtv.PAPR_OFF, dtv.PAPR_ACE, dtv.PAPR_TR, dtv.PAPR_BOTH]
+ hide: ${ version.hide_131 }
+- id: version
+ label: Specification Version
+ dtype: enum
+ options: [VERSION_111, VERSION_131]
+ option_labels: [1.1.1, 1.3.1]
+ option_attributes:
+ hide_111: ['', all]
+ hide_131: [all, '']
+ val: [dtv.VERSION_111, dtv.VERSION_131]
+- id: preamble1
+ label: Preamble
+ dtype: enum
+ options: [PREAMBLE_T2_SISO, PREAMBLE_T2_MISO]
+ option_labels: [T2 SISO, T2 MISO]
+ option_attributes:
+ hide_miso: [all, '']
+ val: [dtv.PREAMBLE_T2_SISO, dtv.PREAMBLE_T2_MISO]
+ hide: ${ version.hide_111 }
+- id: preamble2
+ label: Preamble
+ dtype: enum
+ options: [PREAMBLE_T2_SISO, PREAMBLE_T2_MISO, PREAMBLE_T2_LITE_SISO, PREAMBLE_T2_LITE_MISO]
+ option_labels: [T2 SISO, T2 MISO, T2-Lite SISO, T2-Lite MISO]
+ option_attributes:
+ hide_miso: [all, '', all, '']
+ val: [dtv.PREAMBLE_T2_SISO, dtv.PREAMBLE_T2_MISO, dtv.PREAMBLE_T2_LITE_SISO,
+ dtv.PREAMBLE_T2_LITE_MISO]
+ hide: ${ version.hide_131 }
+- id: misogroup
+ label: MISO Group
+ dtype: enum
+ options: [MISO_TX1, MISO_TX2]
+ option_labels: [TX1, TX2]
+ option_attributes:
+ val: [dtv.MISO_TX1, dtv.MISO_TX2]
+ hide: ${ (preamble1.hide_miso if str(version) == 'VERSION_111' else preamble2.hide_miso)
+ }
+- id: equalization
+ label: Sin(x)/x Equalization
+ dtype: enum
+ options: [EQUALIZATION_OFF, EQUALIZATION_ON]
+ option_labels: ['Off', 'On']
+ option_attributes:
+ hide_bandwidth: [all, '']
+ val: [dtv.EQUALIZATION_OFF, dtv.EQUALIZATION_ON]
+- id: bandwidth
+ label: Bandwidth
+ dtype: enum
+ options: [BANDWIDTH_1_7_MHZ, BANDWIDTH_5_0_MHZ, BANDWIDTH_6_0_MHZ, BANDWIDTH_7_0_MHZ,
+ BANDWIDTH_8_0_MHZ, BANDWIDTH_10_0_MHZ]
+ option_labels: [1.7 MHz, 5 MHz, 6 MHz, 7 MHz, 8 MHz, 10 MHz]
+ option_attributes:
+ val: [dtv.BANDWIDTH_1_7_MHZ, dtv.BANDWIDTH_5_0_MHZ, dtv.BANDWIDTH_6_0_MHZ,
+ dtv.BANDWIDTH_7_0_MHZ, dtv.BANDWIDTH_8_0_MHZ, dtv.BANDWIDTH_10_0_MHZ]
+ hide: ${ equalization.hide_bandwidth }
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ fftsize.vlength }
+
+templates:
+ imports: from gnuradio import dtv
+ make: "dtv.dvbt2_pilotgenerator_cc(${carriermode.val}, ${fftsize.val}, ${pilotpattern.val},\
+ \ ${guardinterval.val}, ${numdatasyms}, \n% if str(version) == 'VERSION_111':\n\
+ ${paprmode1.val}, \n% else:\n${paprmode2.val}, \n% endif\n${version.val},\
+ \ \n% if str(version) == 'VERSION_111':\n${preamble1.val}, \n% else:\n${preamble2.val},\
+ \ \n% endif\n${misogroup.val}, ${equalization.val}, ${bandwidth.val}, ${fftsize.vlength})"
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt2_pilotgenerator_cc.xml b/gr-dtv/grc/dtv_dvbt2_pilotgenerator_cc.xml
deleted file mode 100644
index fdcac6489..000000000
--- a/gr-dtv/grc/dtv_dvbt2_pilotgenerator_cc.xml
+++ /dev/null
@@ -1,386 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T2 Pilot Generator
-###################################################
- -->
-<block>
- <name>Pilot Generator and IFFT</name>
- <key>dtv_dvbt2_pilotgenerator_cc</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt2_pilotgenerator_cc($carriermode.val, $fftsize.val, $pilotpattern.val, $guardinterval.val, $numdatasyms, #slurp
-#if str($version) == 'VERSION_111'
-$paprmode1.val, #slurp
-#else
-$paprmode2.val, #slurp
-#end if
-$version.val, #slurp
-#if str($version) == 'VERSION_111'
-$preamble1.val, #slurp
-#else
-$preamble2.val, #slurp
-#end if
-$misogroup.val, $equalization.val, $bandwidth.val, $fftsize.vlength)</make>
- <param>
- <name>Extended Carrier Mode</name>
- <key>carriermode</key>
- <type>enum</type>
- <option>
- <name>Normal</name>
- <key>CARRIERS_NORMAL</key>
- <opt>val:dtv.CARRIERS_NORMAL</opt>
- </option>
- <option>
- <name>Extended</name>
- <key>CARRIERS_EXTENDED</key>
- <opt>val:dtv.CARRIERS_EXTENDED</opt>
- </option>
- </param>
- <param>
- <name>FFT Size</name>
- <key>fftsize</key>
- <type>enum</type>
- <option>
- <name>1K</name>
- <key>FFTSIZE_1K</key>
- <opt>val:dtv.FFTSIZE_1K</opt>
- <opt>vlength:1024</opt>
- </option>
- <option>
- <name>2K</name>
- <key>FFTSIZE_2K</key>
- <opt>val:dtv.FFTSIZE_2K</opt>
- <opt>vlength:2048</opt>
- </option>
- <option>
- <name>4K</name>
- <key>FFTSIZE_4K</key>
- <opt>val:dtv.FFTSIZE_4K</opt>
- <opt>vlength:4096</opt>
- </option>
- <option>
- <name>8K</name>
- <key>FFTSIZE_8K</key>
- <opt>val:dtv.FFTSIZE_8K</opt>
- <opt>vlength:8192</opt>
- </option>
- <option>
- <name>8K DVB-T2 GI</name>
- <key>FFTSIZE_8K_T2GI</key>
- <opt>val:dtv.FFTSIZE_8K_T2GI</opt>
- <opt>vlength:8192</opt>
- </option>
- <option>
- <name>16K</name>
- <key>FFTSIZE_16K</key>
- <opt>val:dtv.FFTSIZE_16K</opt>
- <opt>vlength:16384</opt>
- </option>
- <option>
- <name>16K DVB-T2 GI</name>
- <key>FFTSIZE_16K_T2GI</key>
- <opt>val:dtv.FFTSIZE_16K_T2GI</opt>
- <opt>vlength:16384</opt>
- </option>
- <option>
- <name>32K</name>
- <key>FFTSIZE_32K</key>
- <opt>val:dtv.FFTSIZE_32K</opt>
- <opt>vlength:32768</opt>
- </option>
- <option>
- <name>32K DVB-T2 GI</name>
- <key>FFTSIZE_32K_T2GI</key>
- <opt>val:dtv.FFTSIZE_32K_T2GI</opt>
- <opt>vlength:32768</opt>
- </option>
- </param>
- <param>
- <name>Pilot Pattern</name>
- <key>pilotpattern</key>
- <type>enum</type>
- <option>
- <name>PP1</name>
- <key>PILOT_PP1</key>
- <opt>val:dtv.PILOT_PP1</opt>
- </option>
- <option>
- <name>PP2</name>
- <key>PILOT_PP2</key>
- <opt>val:dtv.PILOT_PP2</opt>
- </option>
- <option>
- <name>PP3</name>
- <key>PILOT_PP3</key>
- <opt>val:dtv.PILOT_PP3</opt>
- </option>
- <option>
- <name>PP4</name>
- <key>PILOT_PP4</key>
- <opt>val:dtv.PILOT_PP4</opt>
- </option>
- <option>
- <name>PP5</name>
- <key>PILOT_PP5</key>
- <opt>val:dtv.PILOT_PP5</opt>
- </option>
- <option>
- <name>PP6</name>
- <key>PILOT_PP6</key>
- <opt>val:dtv.PILOT_PP6</opt>
- </option>
- <option>
- <name>PP7</name>
- <key>PILOT_PP7</key>
- <opt>val:dtv.PILOT_PP7</opt>
- </option>
- <option>
- <name>PP8</name>
- <key>PILOT_PP8</key>
- <opt>val:dtv.PILOT_PP8</opt>
- </option>
- </param>
- <param>
- <name>Guard Interval</name>
- <key>guardinterval</key>
- <type>enum</type>
- <option>
- <name>1/32</name>
- <key>GI_1_32</key>
- <opt>val:dtv.GI_1_32</opt>
- </option>
- <option>
- <name>1/16</name>
- <key>GI_1_16</key>
- <opt>val:dtv.GI_1_16</opt>
- </option>
- <option>
- <name>1/8</name>
- <key>GI_1_8</key>
- <opt>val:dtv.GI_1_8</opt>
- </option>
- <option>
- <name>1/4</name>
- <key>GI_1_4</key>
- <opt>val:dtv.GI_1_4</opt>
- </option>
- <option>
- <name>1/128</name>
- <key>GI_1_128</key>
- <opt>val:dtv.GI_1_128</opt>
- </option>
- <option>
- <name>19/128</name>
- <key>GI_19_128</key>
- <opt>val:dtv.GI_19_128</opt>
- </option>
- <option>
- <name>19/256</name>
- <key>GI_19_256</key>
- <opt>val:dtv.GI_19_256</opt>
- </option>
- </param>
- <param>
- <name>Number of Data Symbols</name>
- <key>numdatasyms</key>
- <value>100</value>
- <type>int</type>
- </param>
- <param>
- <name>PAPR Mode</name>
- <key>paprmode1</key>
- <type>enum</type>
- <hide>$version.hide_111</hide>
- <option>
- <name>Off</name>
- <key>PAPR_OFF</key>
- <opt>val:dtv.PAPR_OFF</opt>
- </option>
- <option>
- <name>Active Constellation Extension</name>
- <key>PAPR_ACE</key>
- <opt>val:dtv.PAPR_ACE</opt>
- </option>
- <option>
- <name>Tone Reservation</name>
- <key>PAPR_TR</key>
- <opt>val:dtv.PAPR_TR</opt>
- </option>
- <option>
- <name>Both ACE and TR</name>
- <key>PAPR_BOTH</key>
- <opt>val:dtv.PAPR_BOTH</opt>
- </option>
- </param>
- <param>
- <name>PAPR Mode</name>
- <key>paprmode2</key>
- <type>enum</type>
- <hide>$version.hide_131</hide>
- <option>
- <name>P2 Only</name>
- <key>PAPR_OFF</key>
- <opt>val:dtv.PAPR_OFF</opt>
- </option>
- <option>
- <name>Active Constellation Extension</name>
- <key>PAPR_ACE</key>
- <opt>val:dtv.PAPR_ACE</opt>
- </option>
- <option>
- <name>Tone Reservation</name>
- <key>PAPR_TR</key>
- <opt>val:dtv.PAPR_TR</opt>
- </option>
- <option>
- <name>Both ACE and TR</name>
- <key>PAPR_BOTH</key>
- <opt>val:dtv.PAPR_BOTH</opt>
- </option>
- </param>
- <param>
- <name>Specification Version</name>
- <key>version</key>
- <type>enum</type>
- <option>
- <name>1.1.1</name>
- <key>VERSION_111</key>
- <opt>val:dtv.VERSION_111</opt>
- <opt>hide_111:</opt>
- <opt>hide_131:all</opt>
- </option>
- <option>
- <name>1.3.1</name>
- <key>VERSION_131</key>
- <opt>val:dtv.VERSION_131</opt>
- <opt>hide_111:all</opt>
- <opt>hide_131:</opt>
- </option>
- </param>
- <param>
- <name>Preamble</name>
- <key>preamble1</key>
- <type>enum</type>
- <hide>$version.hide_111</hide>
- <option>
- <name>T2 SISO</name>
- <key>PREAMBLE_T2_SISO</key>
- <opt>val:dtv.PREAMBLE_T2_SISO</opt>
- <opt>hide_miso:all</opt>
- </option>
- <option>
- <name>T2 MISO</name>
- <key>PREAMBLE_T2_MISO</key>
- <opt>val:dtv.PREAMBLE_T2_MISO</opt>
- <opt>hide_miso:</opt>
- </option>
- </param>
- <param>
- <name>Preamble</name>
- <key>preamble2</key>
- <type>enum</type>
- <hide>$version.hide_131</hide>
- <option>
- <name>T2 SISO</name>
- <key>PREAMBLE_T2_SISO</key>
- <opt>val:dtv.PREAMBLE_T2_SISO</opt>
- <opt>hide_miso:all</opt>
- </option>
- <option>
- <name>T2 MISO</name>
- <key>PREAMBLE_T2_MISO</key>
- <opt>val:dtv.PREAMBLE_T2_MISO</opt>
- <opt>hide_miso:</opt>
- </option>
- <option>
- <name>T2-Lite SISO</name>
- <key>PREAMBLE_T2_LITE_SISO</key>
- <opt>val:dtv.PREAMBLE_T2_LITE_SISO</opt>
- <opt>hide_miso:all</opt>
- </option>
- <option>
- <name>T2-Lite MISO</name>
- <key>PREAMBLE_T2_LITE_MISO</key>
- <opt>val:dtv.PREAMBLE_T2_LITE_MISO</opt>
- <opt>hide_miso:</opt>
- </option>
- </param>
- <param>
- <name>MISO Group</name>
- <key>misogroup</key>
- <type>enum</type>
- <hide>#if str($version) == 'VERSION_111' then $preamble1.hide_miso else $preamble2.hide_miso</hide>
- <option>
- <name>TX1</name>
- <key>MISO_TX1</key>
- <opt>val:dtv.MISO_TX1</opt>
- </option>
- <option>
- <name>TX2</name>
- <key>MISO_TX2</key>
- <opt>val:dtv.MISO_TX2</opt>
- </option>
- </param>
- <param>
- <name>Sin(x)/x Equalization</name>
- <key>equalization</key>
- <type>enum</type>
- <option>
- <name>Off</name>
- <key>EQUALIZATION_OFF</key>
- <opt>val:dtv.EQUALIZATION_OFF</opt>
- <opt>hide_bandwidth:all</opt>
- </option>
- <option>
- <name>On</name>
- <key>EQUALIZATION_ON</key>
- <opt>val:dtv.EQUALIZATION_ON</opt>
- <opt>hide_bandwidth:</opt>
- </option>
- </param>
- <param>
- <name>Bandwidth</name>
- <key>bandwidth</key>
- <type>enum</type>
- <hide>$equalization.hide_bandwidth</hide>
- <option>
- <name>1.7 MHz</name>
- <key>BANDWIDTH_1_7_MHZ</key>
- <opt>val:dtv.BANDWIDTH_1_7_MHZ</opt>
- </option>
- <option>
- <name>5 MHz</name>
- <key>BANDWIDTH_5_0_MHZ</key>
- <opt>val:dtv.BANDWIDTH_5_0_MHZ</opt>
- </option>
- <option>
- <name>6 MHz</name>
- <key>BANDWIDTH_6_0_MHZ</key>
- <opt>val:dtv.BANDWIDTH_6_0_MHZ</opt>
- </option>
- <option>
- <name>7 MHz</name>
- <key>BANDWIDTH_7_0_MHZ</key>
- <opt>val:dtv.BANDWIDTH_7_0_MHZ</opt>
- </option>
- <option>
- <name>8 MHz</name>
- <key>BANDWIDTH_8_0_MHZ</key>
- <opt>val:dtv.BANDWIDTH_8_0_MHZ</opt>
- </option>
- <option>
- <name>10 MHz</name>
- <key>BANDWIDTH_10_0_MHZ</key>
- <opt>val:dtv.BANDWIDTH_10_0_MHZ</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- <vlen>$fftsize.vlength</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt_bit_inner_deinterleaver.block.yml b/gr-dtv/grc/dtv_dvbt_bit_inner_deinterleaver.block.yml
new file mode 100644
index 000000000..0431f3088
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt_bit_inner_deinterleaver.block.yml
@@ -0,0 +1,47 @@
+id: dtv_dvbt_bit_inner_deinterleaver
+label: Bit Inner Deinterleaver
+
+parameters:
+- id: constellation
+ label: Constellation Type
+ dtype: enum
+ options: [qpsk, 16qam, 64qam]
+ option_labels: [QPSK, 16QAM, 64QAM]
+ option_attributes:
+ val: [dtv.MOD_QPSK, dtv.MOD_16QAM, dtv.MOD_64QAM]
+- id: hierarchy
+ label: Hierarchy Type
+ dtype: enum
+ options: [nh, alpha1, alpha2, alpha4]
+ option_labels: [Non Hierarchical, Alpha 1, Alpha 2, Alpha 4]
+ option_attributes:
+ num_streams: ['1', '2', '2', '2']
+ val: [dtv.NH, dtv.ALPHA1, dtv.ALPHA2, dtv.ALPHA4]
+ hide: part
+- id: transmission_mode
+ label: Transmission Mode
+ dtype: enum
+ options: [T2k, T8k]
+ option_labels: [2K, 8K]
+ option_attributes:
+ payload_length: ['1512', '6048']
+ val: [dtv.T2k, dtv.T8k]
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ transmission_mode.payload_length }
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ transmission_mode.payload_length }
+ multiplicity: ${ hierarchy.num_streams }
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt_bit_inner_deinterleaver(${transmission_mode.payload_length}, ${constellation.val},
+ ${hierarchy.val}, ${transmission_mode.val})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt_bit_inner_deinterleaver.xml b/gr-dtv/grc/dtv_dvbt_bit_inner_deinterleaver.xml
deleted file mode 100644
index ff338d211..000000000
--- a/gr-dtv/grc/dtv_dvbt_bit_inner_deinterleaver.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T Bit Inner Deinterleaver
-###################################################
- -->
-<block>
- <name>Bit Inner Deinterleaver</name>
- <key>dtv_dvbt_bit_inner_deinterleaver</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt_bit_inner_deinterleaver($transmission_mode.payload_length, $constellation.val, $hierarchy.val, $transmission_mode.val)</make>
- <param>
- <name>Constellation Type</name>
- <key>constellation</key>
- <type>enum</type>
- <option>
- <name>QPSK</name>
- <key>qpsk</key>
- <opt>val:dtv.MOD_QPSK</opt>
- </option>
- <option>
- <name>16QAM</name>
- <key>16qam</key>
- <opt>val:dtv.MOD_16QAM</opt>
- </option>
- <option>
- <name>64QAM</name>
- <key>64qam</key>
- <opt>val:dtv.MOD_64QAM</opt>
- </option>
- </param>
- <param>
- <name>Hierarchy Type</name>
- <key>hierarchy</key>
- <type>enum</type>
- <option>
- <name>Non Hierarchical</name>
- <key>nh</key>
- <opt>val:dtv.NH</opt>
- <opt>num_streams:1</opt>
- </option>
- <option>
- <name>Alpha 1</name>
- <key>alpha1</key>
- <opt>val:dtv.ALPHA1</opt>
- <opt>num_streams:2</opt>
- </option>
- <option>
- <name>Alpha 2</name>
- <key>alpha2</key>
- <opt>val:dtv.ALPHA2</opt>
- <opt>num_streams:2</opt>
- </option>
- <option>
- <name>Alpha 4</name>
- <key>alpha4</key>
- <opt>val:dtv.ALPHA4</opt>
- <opt>num_streams:2</opt>
- </option>
- </param>
- <param>
- <name>Transmission Mode</name>
- <key>transmission_mode</key>
- <type>enum</type>
- <option>
- <name>2K</name>
- <key>T2k</key>
- <opt>val:dtv.T2k</opt>
- <opt>payload_length:1512</opt>
- </option>
- <option>
- <name>8K</name>
- <key>T8k</key>
- <opt>val:dtv.T8k</opt>
- <opt>payload_length:6048</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>$transmission_mode.payload_length</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>$transmission_mode.payload_length</vlen>
- <nports>$hierarchy.num_streams</nports>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt_bit_inner_interleaver.block.yml b/gr-dtv/grc/dtv_dvbt_bit_inner_interleaver.block.yml
new file mode 100644
index 000000000..1d9b40473
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt_bit_inner_interleaver.block.yml
@@ -0,0 +1,47 @@
+id: dtv_dvbt_bit_inner_interleaver
+label: Bit Inner Interleaver
+
+parameters:
+- id: constellation
+ label: Constellation Type
+ dtype: enum
+ options: [qpsk, 16qam, 64qam]
+ option_labels: [QPSK, 16QAM, 64QAM]
+ option_attributes:
+ val: [dtv.MOD_QPSK, dtv.MOD_16QAM, dtv.MOD_64QAM]
+- id: hierarchy
+ label: Hierarchy Type
+ dtype: enum
+ options: [nh, alpha1, alpha2, alpha4]
+ option_labels: [Non Hierarchical, Alpha 1, Alpha 2, Alpha 4]
+ option_attributes:
+ num_streams: ['1', '2', '2', '2']
+ val: [dtv.NH, dtv.ALPHA1, dtv.ALPHA2, dtv.ALPHA4]
+ hide: part
+- id: transmission_mode
+ label: Transmission Mode
+ dtype: enum
+ options: [T2k, T8k]
+ option_labels: [2K, 8K]
+ option_attributes:
+ payload_length: ['1512', '6048']
+ val: [dtv.T2k, dtv.T8k]
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ transmission_mode.payload_length }
+ multiplicity: ${ hierarchy.num_streams }
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ transmission_mode.payload_length }
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt_bit_inner_interleaver(${transmission_mode.payload_length}, ${constellation.val},
+ ${hierarchy.val}, ${transmission_mode.val})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt_bit_inner_interleaver.xml b/gr-dtv/grc/dtv_dvbt_bit_inner_interleaver.xml
deleted file mode 100644
index 31f1c2cfa..000000000
--- a/gr-dtv/grc/dtv_dvbt_bit_inner_interleaver.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T Bit Inner Interleaver
-###################################################
- -->
-<block>
- <name>Bit Inner Interleaver</name>
- <key>dtv_dvbt_bit_inner_interleaver</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt_bit_inner_interleaver($transmission_mode.payload_length, $constellation.val, $hierarchy.val, $transmission_mode.val)</make>
- <param>
- <name>Constellation Type</name>
- <key>constellation</key>
- <type>enum</type>
- <option>
- <name>QPSK</name>
- <key>qpsk</key>
- <opt>val:dtv.MOD_QPSK</opt>
- </option>
- <option>
- <name>16QAM</name>
- <key>16qam</key>
- <opt>val:dtv.MOD_16QAM</opt>
- </option>
- <option>
- <name>64QAM</name>
- <key>64qam</key>
- <opt>val:dtv.MOD_64QAM</opt>
- </option>
- </param>
- <param>
- <name>Hierarchy Type</name>
- <key>hierarchy</key>
- <type>enum</type>
- <option>
- <name>Non Hierarchical</name>
- <key>nh</key>
- <opt>val:dtv.NH</opt>
- <opt>num_streams:1</opt>
- </option>
- <option>
- <name>Alpha 1</name>
- <key>alpha1</key>
- <opt>val:dtv.ALPHA1</opt>
- <opt>num_streams:2</opt>
- </option>
- <option>
- <name>Alpha 2</name>
- <key>alpha2</key>
- <opt>val:dtv.ALPHA2</opt>
- <opt>num_streams:2</opt>
- </option>
- <option>
- <name>Alpha 4</name>
- <key>alpha4</key>
- <opt>val:dtv.ALPHA4</opt>
- <opt>num_streams:2</opt>
- </option>
- </param>
- <param>
- <name>Transmission Mode</name>
- <key>transmission_mode</key>
- <type>enum</type>
- <option>
- <name>2K</name>
- <key>T2k</key>
- <opt>val:dtv.T2k</opt>
- <opt>payload_length:1512</opt>
- </option>
- <option>
- <name>8K</name>
- <key>T8k</key>
- <opt>val:dtv.T8k</opt>
- <opt>payload_length:6048</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>$transmission_mode.payload_length</vlen>
- <nports>$hierarchy.num_streams</nports>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>$transmission_mode.payload_length</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt_convolutional_deinterleaver.block.yml b/gr-dtv/grc/dtv_dvbt_convolutional_deinterleaver.block.yml
new file mode 100644
index 000000000..b4b5708bc
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt_convolutional_deinterleaver.block.yml
@@ -0,0 +1,39 @@
+id: dtv_dvbt_convolutional_deinterleaver
+label: Convolutional Deinterleaver
+
+parameters:
+- id: blocks
+ label: Blocks (12 Bytes)
+ dtype: int
+ default: '136'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: I
+ label: Number of Shift registers
+ dtype: int
+ default: '12'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: M
+ label: Depth of shift registers
+ dtype: int
+ default: '17'
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: 1
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ blocks*I }
+
+asserts:
+- ${ blocks > 0 }
+- ${ I > 0 }
+- ${ M > 0 }
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt_convolutional_deinterleaver(${blocks}, ${I}, ${M})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt_convolutional_deinterleaver.xml b/gr-dtv/grc/dtv_dvbt_convolutional_deinterleaver.xml
deleted file mode 100644
index 315920bd4..000000000
--- a/gr-dtv/grc/dtv_dvbt_convolutional_deinterleaver.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T Convolutional Deinterleaver
-###################################################
- -->
-<block>
- <name>Convolutional Deinterleaver</name>
- <key>dtv_dvbt_convolutional_deinterleaver</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt_convolutional_deinterleaver($blocks, $I, $M)</make>
- <param>
- <name>Blocks (12 Bytes)</name>
- <key>blocks</key>
- <value>136</value>
- <type>int</type>
- </param>
- <param>
- <name>Number of Shift registers</name>
- <key>I</key>
- <value>12</value>
- <type>int</type>
- </param>
- <param>
- <name>Depth of shift registers</name>
- <key>M</key>
- <value>17</value>
- <type>int</type>
- </param>
- <check>$blocks &gt; 0</check>
- <check>$I &gt; 0</check>
- <check>$M &gt; 0</check>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>1</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>$blocks*$I</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt_convolutional_interleaver.block.yml b/gr-dtv/grc/dtv_dvbt_convolutional_interleaver.block.yml
new file mode 100644
index 000000000..e47f1d09e
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt_convolutional_interleaver.block.yml
@@ -0,0 +1,39 @@
+id: dtv_dvbt_convolutional_interleaver
+label: Convolutional Interleaver
+
+parameters:
+- id: blocks
+ label: Blocks (12 Bytes)
+ dtype: int
+ default: '136'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: I
+ label: Number of Shift registers
+ dtype: int
+ default: '12'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: M
+ label: Depth of shift registers
+ dtype: int
+ default: '17'
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ blocks*I }
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: 1
+
+asserts:
+- ${ blocks > 0 }
+- ${ I > 0 }
+- ${ M > 0 }
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt_convolutional_interleaver(${blocks}, ${I}, ${M})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt_convolutional_interleaver.xml b/gr-dtv/grc/dtv_dvbt_convolutional_interleaver.xml
deleted file mode 100644
index 04518dd62..000000000
--- a/gr-dtv/grc/dtv_dvbt_convolutional_interleaver.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T Convolutional Interleaver
-###################################################
- -->
-<block>
- <name>Convolutional Interleaver</name>
- <key>dtv_dvbt_convolutional_interleaver</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt_convolutional_interleaver($blocks, $I, $M)</make>
- <param>
- <name>Blocks (12 Bytes)</name>
- <key>blocks</key>
- <value>136</value>
- <type>int</type>
- </param>
- <param>
- <name>Number of Shift registers</name>
- <key>I</key>
- <value>12</value>
- <type>int</type>
- </param>
- <param>
- <name>Depth of shift registers</name>
- <key>M</key>
- <value>17</value>
- <type>int</type>
- </param>
- <check>$blocks &gt; 0</check>
- <check>$I &gt; 0</check>
- <check>$M &gt; 0</check>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>$blocks*$I</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>1</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt_demap.block.yml b/gr-dtv/grc/dtv_dvbt_demap.block.yml
new file mode 100644
index 000000000..857bcf346
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt_demap.block.yml
@@ -0,0 +1,48 @@
+id: dtv_dvbt_demap
+label: DVB-T Demap
+
+parameters:
+- id: constellation
+ label: Constellation Type
+ dtype: enum
+ options: [qpsk, 16qam, 64qam]
+ option_labels: [QPSK, 16QAM, 64QAM]
+ option_attributes:
+ val: [dtv.MOD_QPSK, dtv.MOD_16QAM, dtv.MOD_64QAM]
+- id: hierarchy
+ label: Hierarchy Type
+ dtype: enum
+ options: [nh, alpha1, alpha2, alpha4]
+ option_labels: [Non Hierarchical, Alpha 1, Alpha 2, Alpha 4]
+ option_attributes:
+ val: [dtv.NH, dtv.ALPHA1, dtv.ALPHA2, dtv.ALPHA4]
+- id: transmission_mode
+ label: Transmission Mode
+ dtype: enum
+ options: [T2k, T8k]
+ option_labels: [2K, 8K]
+ option_attributes:
+ payload_length: ['1512', '6048']
+ val: [dtv.T2k, dtv.T8k]
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: gain
+ label: Gain
+ dtype: complex
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ transmission_mode.payload_length }
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ transmission_mode.payload_length }
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt_demap(${transmission_mode.payload_length}, ${constellation.val},
+ ${hierarchy.val}, ${transmission_mode.val}, ${gain})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt_demap.xml b/gr-dtv/grc/dtv_dvbt_demap.xml
deleted file mode 100644
index 2268ed7cf..000000000
--- a/gr-dtv/grc/dtv_dvbt_demap.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T Demap
-###################################################
- -->
-<block>
- <name>DVB-T Demap</name>
- <key>dtv_dvbt_demap</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt_demap($transmission_mode.payload_length, $constellation.val, $hierarchy.val, $transmission_mode.val, $gain)</make>
- <param>
- <name>Constellation Type</name>
- <key>constellation</key>
- <type>enum</type>
- <option>
- <name>QPSK</name>
- <key>qpsk</key>
- <opt>val:dtv.MOD_QPSK</opt>
- </option>
- <option>
- <name>16QAM</name>
- <key>16qam</key>
- <opt>val:dtv.MOD_16QAM</opt>
- </option>
- <option>
- <name>64QAM</name>
- <key>64qam</key>
- <opt>val:dtv.MOD_64QAM</opt>
- </option>
- </param>
- <param>
- <name>Hierarchy Type</name>
- <key>hierarchy</key>
- <type>enum</type>
- <option>
- <name>Non Hierarchical</name>
- <key>nh</key>
- <opt>val:dtv.NH</opt>
- </option>
- <option>
- <name>Alpha 1</name>
- <key>alpha1</key>
- <opt>val:dtv.ALPHA1</opt>
- </option>
- <option>
- <name>Alpha 2</name>
- <key>alpha2</key>
- <opt>val:dtv.ALPHA2</opt>
- </option>
- <option>
- <name>Alpha 4</name>
- <key>alpha4</key>
- <opt>val:dtv.ALPHA4</opt>
- </option>
- </param>
- <param>
- <name>Transmission Mode</name>
- <key>transmission_mode</key>
- <type>enum</type>
- <option>
- <name>2K</name>
- <key>T2k</key>
- <opt>val:dtv.T2k</opt>
- <opt>payload_length:1512</opt>
- </option>
- <option>
- <name>8K</name>
- <key>T8k</key>
- <opt>val:dtv.T8k</opt>
- <opt>payload_length:6048</opt>
- </option>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1</value>
- <type>complex</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- <vlen>$transmission_mode.payload_length</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>$transmission_mode.payload_length</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt_demod_reference_signals.block.yml b/gr-dtv/grc/dtv_dvbt_demod_reference_signals.block.yml
new file mode 100644
index 000000000..a700f54eb
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt_demod_reference_signals.block.yml
@@ -0,0 +1,86 @@
+id: dtv_dvbt_demod_reference_signals
+label: Demod Reference Signals
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+- id: constellation
+ label: Constellation Type
+ dtype: enum
+ options: [qpsk, 16qam, 64qam]
+ option_labels: [QPSK, 16QAM, 64QAM]
+ option_attributes:
+ val: [dtv.MOD_QPSK, dtv.MOD_16QAM, dtv.MOD_64QAM]
+- id: hierarchy
+ label: Hierarchy Type
+ dtype: enum
+ options: [nh, alpha1, alpha2, alpha4]
+ option_labels: [Non Hierarchical, Alpha 1, Alpha 2, Alpha 4]
+ option_attributes:
+ val: [dtv.NH, dtv.ALPHA1, dtv.ALPHA2, dtv.ALPHA4]
+- id: code_rate_hp
+ label: Code rate HP
+ dtype: enum
+ options: [C1_2, C2_3, C3_4, C5_6, C7_8]
+ option_labels: [1/2, 2/3, 3/4, 5/6, 7/8]
+ option_attributes:
+ val: [dtv.C1_2, dtv.C2_3, dtv.C3_4, dtv.C5_6, dtv.C7_8]
+- id: code_rate_lp
+ label: Code rate LP
+ dtype: enum
+ options: [C1_2, C2_3, C3_4, C5_6, C7_8]
+ option_labels: [1/2, 2/3, 3/4, 5/6, 7/8]
+ option_attributes:
+ val: [dtv.C1_2, dtv.C2_3, dtv.C3_4, dtv.C5_6, dtv.C7_8]
+- id: guard_interval
+ label: Guard Interval
+ dtype: enum
+ options: [GI_1_32, GI_1_16, GI_1_8, GI_1_4]
+ option_labels: [1/32, 1/16, 1/8, 1/4]
+ option_attributes:
+ val: [dtv.GI_1_32, dtv.GI_1_16, dtv.GI_1_8, dtv.GI_1_4]
+- id: transmission_mode
+ label: Transmission Mode
+ dtype: enum
+ options: [T2k, T8k]
+ option_labels: [2K, 8K]
+ option_attributes:
+ fft_length: ['2048', '8192']
+ payload_length: ['1512', '6048']
+ val: [dtv.T2k, dtv.T8k]
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: include_cell_id
+ label: Include Cell ID
+ dtype: enum
+ options: [call_id_yes, cell_id_no]
+ option_labels: ['Yes', 'No']
+ option_attributes:
+ val: ['1', '0']
+- id: cell_id
+ label: Cell Id
+ dtype: int
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ transmission_mode.fft_length }
+
+outputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ transmission_mode.payload_length }
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt_demod_reference_signals(${type.size}, ${transmission_mode.fft_length},
+ ${transmission_mode.payload_length}, ${constellation.val}, ${hierarchy.val},
+ ${code_rate_hp.val}, ${code_rate_lp.val}, ${guard_interval.val}, ${transmission_mode.val},
+ ${include_cell_id.val}, ${cell_id})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt_demod_reference_signals.xml b/gr-dtv/grc/dtv_dvbt_demod_reference_signals.xml
deleted file mode 100644
index f92469b7e..000000000
--- a/gr-dtv/grc/dtv_dvbt_demod_reference_signals.xml
+++ /dev/null
@@ -1,222 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Demod Reference Signals
-###################################################
- -->
-<block>
- <name>Demod Reference Signals</name>
- <key>dtv_dvbt_demod_reference_signals</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt_demod_reference_signals($type.size, $transmission_mode.fft_length, $transmission_mode.payload_length, $constellation.val, $hierarchy.val, $code_rate_hp.val, $code_rate_lp.val, $guard_interval.val, $transmission_mode.val, $include_cell_id.val, $cell_id)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Constellation Type</name>
- <key>constellation</key>
- <type>enum</type>
- <option>
- <name>QPSK</name>
- <key>qpsk</key>
- <opt>val:dtv.MOD_QPSK</opt>
- </option>
- <option>
- <name>16QAM</name>
- <key>16qam</key>
- <opt>val:dtv.MOD_16QAM</opt>
- </option>
- <option>
- <name>64QAM</name>
- <key>64qam</key>
- <opt>val:dtv.MOD_64QAM</opt>
- </option>
- </param>
- <param>
- <name>Hierarchy Type</name>
- <key>hierarchy</key>
- <type>enum</type>
- <option>
- <name>Non Hierarchical</name>
- <key>nh</key>
- <opt>val:dtv.NH</opt>
- </option>
- <option>
- <name>Alpha 1</name>
- <key>alpha1</key>
- <opt>val:dtv.ALPHA1</opt>
- </option>
- <option>
- <name>Alpha 2</name>
- <key>alpha2</key>
- <opt>val:dtv.ALPHA2</opt>
- </option>
- <option>
- <name>Alpha 4</name>
- <key>alpha4</key>
- <opt>val:dtv.ALPHA4</opt>
- </option>
- </param>
- <param>
- <name>Code rate HP</name>
- <key>code_rate_hp</key>
- <type>enum</type>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>7/8</name>
- <key>C7_8</key>
- <opt>val:dtv.C7_8</opt>
- </option>
- </param>
- <param>
- <name>Code rate LP</name>
- <key>code_rate_lp</key>
- <type>enum</type>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>7/8</name>
- <key>C7_8</key>
- <opt>val:dtv.C7_8</opt>
- </option>
- </param>
- <param>
- <name>Guard Interval</name>
- <key>guard_interval</key>
- <type>enum</type>
- <option>
- <name>1/32</name>
- <key>GI_1_32</key>
- <opt>val:dtv.GI_1_32</opt>
- </option>
- <option>
- <name>1/16</name>
- <key>GI_1_16</key>
- <opt>val:dtv.GI_1_16</opt>
- </option>
- <option>
- <name>1/8</name>
- <key>GI_1_8</key>
- <opt>val:dtv.GI_1_8</opt>
- </option>
- <option>
- <name>1/4</name>
- <key>GI_1_4</key>
- <opt>val:dtv.GI_1_4</opt>
- </option>
- </param>
- <param>
- <name>Transmission Mode</name>
- <key>transmission_mode</key>
- <type>enum</type>
- <option>
- <name>2K</name>
- <key>T2k</key>
- <opt>val:dtv.T2k</opt>
- <opt>fft_length:2048</opt>
- <opt>payload_length:1512</opt>
- </option>
- <option>
- <name>8K</name>
- <key>T8k</key>
- <opt>val:dtv.T8k</opt>
- <opt>fft_length:8192</opt>
- <opt>payload_length:6048</opt>
- </option>
- </param>
- <param>
- <name>Include Cell ID</name>
- <key>include_cell_id</key>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>call_id_yes</key>
- <opt>val:1</opt>
- </option>
- <option>
- <name>No</name>
- <key>cell_id_no</key>
- <opt>val:0</opt>
- </option>
- </param>
- <param>
- <name>Cell Id</name>
- <key>cell_id</key>
- <value>0</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- <vlen>$transmission_mode.fft_length</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- <vlen>$transmission_mode.payload_length</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt_energy_descramble.block.yml b/gr-dtv/grc/dtv_dvbt_energy_descramble.block.yml
new file mode 100644
index 000000000..9ca3fee19
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt_energy_descramble.block.yml
@@ -0,0 +1,27 @@
+id: dtv_dvbt_energy_descramble
+label: Energy Descramble
+
+parameters:
+- id: nsize
+ label: Blocks(188 Bytes)
+ dtype: int
+ default: '8'
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: 188*8
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: 1
+
+asserts:
+- ${ nsize > 0 }
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt_energy_descramble(${nsize})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt_energy_descramble.xml b/gr-dtv/grc/dtv_dvbt_energy_descramble.xml
deleted file mode 100644
index 689f85424..000000000
--- a/gr-dtv/grc/dtv_dvbt_energy_descramble.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T Energy Descramble
-###################################################
- -->
-<block>
- <name>Energy Descramble</name>
- <key>dtv_dvbt_energy_descramble</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt_energy_descramble($nsize)</make>
- <param>
- <name>Blocks(188 Bytes)</name>
- <key>nsize</key>
- <value>8</value>
- <type>int</type>
- </param>
- <check>$nsize &gt; 0</check>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>188*8</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>1</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt_energy_dispersal.block.yml b/gr-dtv/grc/dtv_dvbt_energy_dispersal.block.yml
new file mode 100644
index 000000000..1b7628fb6
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt_energy_dispersal.block.yml
@@ -0,0 +1,28 @@
+id: dtv_dvbt_energy_dispersal
+label: Energy Dispersal
+
+parameters:
+- id: nsize
+ label: Blocks(1504 Bytes)
+ dtype: int
+ default: '8'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: 1
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ 1504*nsize }
+
+asserts:
+- ${ nsize > 0 }
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt_energy_dispersal(${nsize})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt_energy_dispersal.xml b/gr-dtv/grc/dtv_dvbt_energy_dispersal.xml
deleted file mode 100644
index 50746c8e4..000000000
--- a/gr-dtv/grc/dtv_dvbt_energy_dispersal.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T Energy Dispersal
-###################################################
- -->
-<block>
- <name>Energy Dispersal</name>
- <key>dtv_dvbt_energy_dispersal</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt_energy_dispersal($nsize)</make>
- <param>
- <name>Blocks(1504 Bytes)</name>
- <key>nsize</key>
- <value>8</value>
- <type>int</type>
- </param>
- <check>$nsize &gt; 0</check>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>1</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>1504*$nsize</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt_inner_coder.block.yml b/gr-dtv/grc/dtv_dvbt_inner_coder.block.yml
new file mode 100644
index 000000000..ca9c2eda4
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt_inner_coder.block.yml
@@ -0,0 +1,57 @@
+id: dtv_dvbt_inner_coder
+label: Inner Coder
+
+parameters:
+- id: ninput
+ label: Input length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: noutput
+ label: Output length
+ dtype: int
+ default: '1512'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: constellation
+ label: Constellation Type
+ dtype: enum
+ options: [qpsk, 16qam, 64qam]
+ option_labels: [QPSK, 16QAM, 64QAM]
+ option_attributes:
+ val: [dtv.MOD_QPSK, dtv.MOD_16QAM, dtv.MOD_64QAM]
+- id: hierarchy
+ label: Hierarchy Type
+ dtype: enum
+ options: [nh, alpha1, alpha2, alpha4]
+ option_labels: [Non Hierarchical, Alpha 1, Alpha 2, Alpha 4]
+ option_attributes:
+ val: [dtv.NH, dtv.ALPHA1, dtv.ALPHA2, dtv.ALPHA4]
+- id: code_rate
+ label: Code rate
+ dtype: enum
+ options: [C1_2, C2_3, C3_4, C5_6, C7_8]
+ option_labels: [1/2, 2/3, 3/4, 5/6, 7/8]
+ option_attributes:
+ val: [dtv.C1_2, dtv.C2_3, dtv.C3_4, dtv.C5_6, dtv.C7_8]
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ ninput }
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ noutput }
+
+asserts:
+- ${ ninput > 0 }
+- ${ noutput > 0 }
+- ${ noutput >= ninput }
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt_inner_coder(${ninput}, ${noutput}, ${constellation.val}, ${hierarchy.val},
+ ${code_rate.val})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt_inner_coder.xml b/gr-dtv/grc/dtv_dvbt_inner_coder.xml
deleted file mode 100644
index 4751065dd..000000000
--- a/gr-dtv/grc/dtv_dvbt_inner_coder.xml
+++ /dev/null
@@ -1,112 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T Inner Coder
-###################################################
- -->
-<block>
- <name>Inner Coder</name>
- <key>dtv_dvbt_inner_coder</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt_inner_coder($ninput, $noutput, $constellation.val, $hierarchy.val, $code_rate.val)</make>
- <param>
- <name>Input length</name>
- <key>ninput</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Output length</name>
- <key>noutput</key>
- <value>1512</value>
- <type>int</type>
- </param>
- <param>
- <name>Constellation Type</name>
- <key>constellation</key>
- <type>enum</type>
- <option>
- <name>QPSK</name>
- <key>qpsk</key>
- <opt>val:dtv.MOD_QPSK</opt>
- </option>
- <option>
- <name>16QAM</name>
- <key>16qam</key>
- <opt>val:dtv.MOD_16QAM</opt>
- </option>
- <option>
- <name>64QAM</name>
- <key>64qam</key>
- <opt>val:dtv.MOD_64QAM</opt>
- </option>
- </param>
- <param>
- <name>Hierarchy Type</name>
- <key>hierarchy</key>
- <type>enum</type>
- <option>
- <name>Non Hierarchical</name>
- <key>nh</key>
- <opt>val:dtv.NH</opt>
- </option>
- <option>
- <name>Alpha 1</name>
- <key>alpha1</key>
- <opt>val:dtv.ALPHA1</opt>
- </option>
- <option>
- <name>Alpha 2</name>
- <key>alpha2</key>
- <opt>val:dtv.ALPHA2</opt>
- </option>
- <option>
- <name>Alpha 4</name>
- <key>alpha4</key>
- <opt>val:dtv.ALPHA4</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>code_rate</key>
- <type>enum</type>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>7/8</name>
- <key>C7_8</key>
- <opt>val:dtv.C7_8</opt>
- </option>
- </param>
- <check>$ninput &gt; 0</check>
- <check>$noutput &gt; 0</check>
- <check>$noutput &gt;= $ninput</check>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>$ninput</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>$noutput</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt_map.block.yml b/gr-dtv/grc/dtv_dvbt_map.block.yml
new file mode 100644
index 000000000..76ffa0400
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt_map.block.yml
@@ -0,0 +1,48 @@
+id: dtv_dvbt_map
+label: DVB-T Map
+
+parameters:
+- id: constellation
+ label: Constellation Type
+ dtype: enum
+ options: [qpsk, 16qam, 64qam]
+ option_labels: [QPSK, 16QAM, 64QAM]
+ option_attributes:
+ val: [dtv.MOD_QPSK, dtv.MOD_16QAM, dtv.MOD_64QAM]
+- id: hierarchy
+ label: Hierarchy Type
+ dtype: enum
+ options: [nh, alpha1, alpha2, alpha4]
+ option_labels: [Non Hierarchical, Alpha 1, Alpha 2, Alpha 4]
+ option_attributes:
+ val: [dtv.NH, dtv.ALPHA1, dtv.ALPHA2, dtv.ALPHA4]
+- id: transmission_mode
+ label: Transmission Mode
+ dtype: enum
+ options: [T2k, T8k]
+ option_labels: [2K, 8K]
+ option_attributes:
+ payload_length: ['1512', '6048']
+ val: [dtv.T2k, dtv.T8k]
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: gain
+ label: Gain
+ dtype: complex
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ transmission_mode.payload_length }
+
+outputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ transmission_mode.payload_length }
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt_map(${transmission_mode.payload_length}, ${constellation.val},
+ ${hierarchy.val}, ${transmission_mode.val}, ${gain})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt_map.xml b/gr-dtv/grc/dtv_dvbt_map.xml
deleted file mode 100644
index 705a50803..000000000
--- a/gr-dtv/grc/dtv_dvbt_map.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T Map
-###################################################
- -->
-<block>
- <name>DVB-T Map</name>
- <key>dtv_dvbt_map</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt_map($transmission_mode.payload_length, $constellation.val, $hierarchy.val, $transmission_mode.val, $gain)</make>
- <param>
- <name>Constellation Type</name>
- <key>constellation</key>
- <type>enum</type>
- <option>
- <name>QPSK</name>
- <key>qpsk</key>
- <opt>val:dtv.MOD_QPSK</opt>
- </option>
- <option>
- <name>16QAM</name>
- <key>16qam</key>
- <opt>val:dtv.MOD_16QAM</opt>
- </option>
- <option>
- <name>64QAM</name>
- <key>64qam</key>
- <opt>val:dtv.MOD_64QAM</opt>
- </option>
- </param>
- <param>
- <name>Hierarchy Type</name>
- <key>hierarchy</key>
- <type>enum</type>
- <option>
- <name>Non Hierarchical</name>
- <key>nh</key>
- <opt>val:dtv.NH</opt>
- </option>
- <option>
- <name>Alpha 1</name>
- <key>alpha1</key>
- <opt>val:dtv.ALPHA1</opt>
- </option>
- <option>
- <name>Alpha 2</name>
- <key>alpha2</key>
- <opt>val:dtv.ALPHA2</opt>
- </option>
- <option>
- <name>Alpha 4</name>
- <key>alpha4</key>
- <opt>val:dtv.ALPHA4</opt>
- </option>
- </param>
- <param>
- <name>Transmission Mode</name>
- <key>transmission_mode</key>
- <type>enum</type>
- <option>
- <name>2K</name>
- <key>T2k</key>
- <opt>val:dtv.T2k</opt>
- <opt>payload_length:1512</opt>
- </option>
- <option>
- <name>8K</name>
- <key>T8k</key>
- <opt>val:dtv.T8k</opt>
- <opt>payload_length:6048</opt>
- </option>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1</value>
- <type>complex</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>$transmission_mode.payload_length</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- <vlen>$transmission_mode.payload_length</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt_ofdm_sym_acquisition.block.yml b/gr-dtv/grc/dtv_dvbt_ofdm_sym_acquisition.block.yml
new file mode 100644
index 000000000..fc0065448
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt_ofdm_sym_acquisition.block.yml
@@ -0,0 +1,45 @@
+id: dtv_dvbt_ofdm_sym_acquisition
+label: OFDM Symbol Acquisition
+
+parameters:
+- id: type
+ label: Output Type
+ dtype: enum
+ default: float
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ fcn: [c, f, i, s, b]
+ hide: part
+- id: fft_length
+ label: FFT Length
+ dtype: int
+ default: '2048'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: occupied_tones
+ label: Occupied Tones
+ dtype: int
+ default: '1705'
+- id: cp_length
+ label: Cyclic Prefix Length
+ dtype: int
+ default: '64'
+- id: snr
+ label: SNR
+ dtype: real
+ default: '10'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ fft_length }
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt_ofdm_sym_acquisition(1, ${fft_length}, ${occupied_tones}, ${cp_length},
+ ${snr})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt_ofdm_sym_acquisition.xml b/gr-dtv/grc/dtv_dvbt_ofdm_sym_acquisition.xml
deleted file mode 100644
index a75dcc02c..000000000
--- a/gr-dtv/grc/dtv_dvbt_ofdm_sym_acquisition.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## OFDM Symbol Acquisition
-###################################################
- -->
-<block>
- <name>OFDM Symbol Acquisition</name>
- <key>dtv_dvbt_ofdm_sym_acquisition</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt_ofdm_sym_acquisition(1, $fft_length, $occupied_tones, $cp_length, $snr)</make>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <value>float</value>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>fcn:i</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:b</opt>
- </option>
- </param>
- <param>
- <name>FFT Length</name>
- <key>fft_length</key>
- <value>2048</value>
- <type>int</type>
- </param>
- <param>
- <name>Occupied Tones</name>
- <key>occupied_tones</key>
- <value>1705</value>
- <type>int</type>
- </param>
- <param>
- <name>Cyclic Prefix Length</name>
- <key>cp_length</key>
- <value>64</value>
- <type>int</type>
- </param>
- <param>
- <name>SNR</name>
- <key>snr</key>
- <value>10</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$fft_length</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt_reed_solomon_dec.block.yml b/gr-dtv/grc/dtv_dvbt_reed_solomon_dec.block.yml
new file mode 100644
index 000000000..e037c42e0
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt_reed_solomon_dec.block.yml
@@ -0,0 +1,57 @@
+id: dtv_dvbt_reed_solomon_dec
+label: Reed-Solomon Decoder
+
+parameters:
+- id: p
+ label: p
+ dtype: int
+ default: '2'
+- id: m
+ label: m
+ dtype: int
+ default: '8'
+- id: gfpoly
+ label: GF polynomial
+ dtype: raw
+ default: '0x11d'
+- id: n
+ label: N
+ dtype: int
+ default: '255'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: k
+ label: K
+ dtype: int
+ default: '239'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: t
+ label: t
+ dtype: int
+ default: '8'
+- id: s
+ label: Shortening size
+ dtype: int
+ default: '51'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: blocks
+ label: Blocks
+ dtype: int
+ default: '8'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ blocks*(n-s) }
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ blocks*(k-s) }
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt_reed_solomon_dec(${p}, ${m}, ${gfpoly}, ${n}, ${k}, ${t}, ${s},
+ ${blocks})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt_reed_solomon_dec.xml b/gr-dtv/grc/dtv_dvbt_reed_solomon_dec.xml
deleted file mode 100644
index 798a6d40f..000000000
--- a/gr-dtv/grc/dtv_dvbt_reed_solomon_dec.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T Reed Solomon Decoder
-###################################################
- -->
-<block>
- <name>Reed-Solomon Decoder</name>
- <key>dtv_dvbt_reed_solomon_dec</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt_reed_solomon_dec($p, $m, $gfpoly, $n, $k, $t, $s, $blocks)</make>
- <param>
- <name>p</name>
- <key>p</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>m</name>
- <key>m</key>
- <value>8</value>
- <type>int</type>
- </param>
- <param>
- <name>GF polynomial</name>
- <key>gfpoly</key>
- <value>0x11d</value>
- <type>raw</type>
- </param>
- <param>
- <name>N</name>
- <key>n</key>
- <value>255</value>
- <type>int</type>
- </param>
- <param>
- <name>K</name>
- <key>k</key>
- <value>239</value>
- <type>int</type>
- </param>
- <param>
- <name>t</name>
- <key>t</key>
- <value>8</value>
- <type>int</type>
- </param>
- <param>
- <name>Shortening size</name>
- <key>s</key>
- <value>51</value>
- <type>int</type>
- </param>
- <param>
- <name>Blocks</name>
- <key>blocks</key>
- <value>8</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>$blocks*($n-$s)</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>$blocks*($k-$s)</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt_reed_solomon_enc.block.yml b/gr-dtv/grc/dtv_dvbt_reed_solomon_enc.block.yml
new file mode 100644
index 000000000..af463cad4
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt_reed_solomon_enc.block.yml
@@ -0,0 +1,57 @@
+id: dtv_dvbt_reed_solomon_enc
+label: Reed-Solomon Encoder
+
+parameters:
+- id: p
+ label: p
+ dtype: int
+ default: '2'
+- id: m
+ label: m
+ dtype: int
+ default: '8'
+- id: gfpoly
+ label: GF polynomial
+ dtype: raw
+ default: '0x11d'
+- id: n
+ label: N
+ dtype: int
+ default: '255'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: k
+ label: K
+ dtype: int
+ default: '239'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: t
+ label: t
+ dtype: int
+ default: '8'
+- id: s
+ label: Shortening size
+ dtype: int
+ default: '51'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: blocks
+ label: Blocks
+ dtype: int
+ default: '8'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ blocks*(k-s) }
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ blocks*(n-s) }
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt_reed_solomon_enc(${p}, ${m}, ${gfpoly}, ${n}, ${k}, ${t}, ${s},
+ ${blocks})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt_reed_solomon_enc.xml b/gr-dtv/grc/dtv_dvbt_reed_solomon_enc.xml
deleted file mode 100644
index 3dd57a7df..000000000
--- a/gr-dtv/grc/dtv_dvbt_reed_solomon_enc.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T Reed Solomon Encoder
-###################################################
- -->
-<block>
- <name>Reed-Solomon Encoder</name>
- <key>dtv_dvbt_reed_solomon_enc</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt_reed_solomon_enc($p, $m, $gfpoly, $n, $k, $t, $s, $blocks)</make>
- <param>
- <name>p</name>
- <key>p</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>m</name>
- <key>m</key>
- <value>8</value>
- <type>int</type>
- </param>
- <param>
- <name>GF polynomial</name>
- <key>gfpoly</key>
- <value>0x11d</value>
- <type>raw</type>
- </param>
- <param>
- <name>N</name>
- <key>n</key>
- <value>255</value>
- <type>int</type>
- </param>
- <param>
- <name>K</name>
- <key>k</key>
- <value>239</value>
- <type>int</type>
- </param>
- <param>
- <name>t</name>
- <key>t</key>
- <value>8</value>
- <type>int</type>
- </param>
- <param>
- <name>Shortening size</name>
- <key>s</key>
- <value>51</value>
- <type>int</type>
- </param>
- <param>
- <name>Blocks</name>
- <key>blocks</key>
- <value>8</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>$blocks*($k-$s)</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>$blocks*($n-$s)</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt_reference_signals.block.yml b/gr-dtv/grc/dtv_dvbt_reference_signals.block.yml
new file mode 100644
index 000000000..d693b5ae1
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt_reference_signals.block.yml
@@ -0,0 +1,86 @@
+id: dtv_dvbt_reference_signals
+label: Reference Signals
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+- id: constellation
+ label: Constellation Type
+ dtype: enum
+ options: [qpsk, 16qam, 64qam]
+ option_labels: [QPSK, 16QAM, 64QAM]
+ option_attributes:
+ val: [dtv.MOD_QPSK, dtv.MOD_16QAM, dtv.MOD_64QAM]
+- id: hierarchy
+ label: Hierarchy Type
+ dtype: enum
+ options: [nh, alpha1, alpha2, alpha4]
+ option_labels: [Non Hierarchical, Alpha 1, Alpha 2, Alpha 4]
+ option_attributes:
+ val: [dtv.NH, dtv.ALPHA1, dtv.ALPHA2, dtv.ALPHA4]
+- id: code_rate_hp
+ label: Code rate HP
+ dtype: enum
+ options: [C1_2, C2_3, C3_4, C5_6, C7_8]
+ option_labels: [1/2, 2/3, 3/4, 5/6, 7/8]
+ option_attributes:
+ val: [dtv.C1_2, dtv.C2_3, dtv.C3_4, dtv.C5_6, dtv.C7_8]
+- id: code_rate_lp
+ label: Code rate LP
+ dtype: enum
+ options: [C1_2, C2_3, C3_4, C5_6, C7_8]
+ option_labels: [1/2, 2/3, 3/4, 5/6, 7/8]
+ option_attributes:
+ val: [dtv.C1_2, dtv.C2_3, dtv.C3_4, dtv.C5_6, dtv.C7_8]
+- id: guard_interval
+ label: Guard Interval
+ dtype: enum
+ options: [GI_1_32, GI_1_16, GI_1_8, GI_1_4]
+ option_labels: [1/32, 1/16, 1/8, 1/4]
+ option_attributes:
+ val: [dtv.GI_1_32, dtv.GI_1_16, dtv.GI_1_8, dtv.GI_1_4]
+- id: transmission_mode
+ label: Transmission Mode
+ dtype: enum
+ options: [T2k, T8k]
+ option_labels: [2K, 8K]
+ option_attributes:
+ fft_length: ['2048', '8192']
+ payload_length: ['1512', '6048']
+ val: [dtv.T2k, dtv.T8k]
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: include_cell_id
+ label: Include Cell ID
+ dtype: enum
+ options: [call_id_yes, cell_id_no]
+ option_labels: ['Yes', 'No']
+ option_attributes:
+ val: ['1', '0']
+- id: cell_id
+ label: Cell Id
+ dtype: int
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ transmission_mode.payload_length }
+
+outputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ transmission_mode.fft_length }
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt_reference_signals(${type.size}, ${transmission_mode.payload_length},
+ ${transmission_mode.fft_length}, ${constellation.val}, ${hierarchy.val}, ${code_rate_hp.val},
+ ${code_rate_lp.val}, ${guard_interval.val}, ${transmission_mode.val}, ${include_cell_id.val},
+ ${cell_id})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt_reference_signals.xml b/gr-dtv/grc/dtv_dvbt_reference_signals.xml
deleted file mode 100644
index 3a4282cc5..000000000
--- a/gr-dtv/grc/dtv_dvbt_reference_signals.xml
+++ /dev/null
@@ -1,222 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Reference Signals
-###################################################
- -->
-<block>
- <name>Reference Signals</name>
- <key>dtv_dvbt_reference_signals</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt_reference_signals($type.size, $transmission_mode.payload_length, $transmission_mode.fft_length, $constellation.val, $hierarchy.val, $code_rate_hp.val, $code_rate_lp.val, $guard_interval.val, $transmission_mode.val, $include_cell_id.val, $cell_id)</make>
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Constellation Type</name>
- <key>constellation</key>
- <type>enum</type>
- <option>
- <name>QPSK</name>
- <key>qpsk</key>
- <opt>val:dtv.MOD_QPSK</opt>
- </option>
- <option>
- <name>16QAM</name>
- <key>16qam</key>
- <opt>val:dtv.MOD_16QAM</opt>
- </option>
- <option>
- <name>64QAM</name>
- <key>64qam</key>
- <opt>val:dtv.MOD_64QAM</opt>
- </option>
- </param>
- <param>
- <name>Hierarchy Type</name>
- <key>hierarchy</key>
- <type>enum</type>
- <option>
- <name>Non Hierarchical</name>
- <key>nh</key>
- <opt>val:dtv.NH</opt>
- </option>
- <option>
- <name>Alpha 1</name>
- <key>alpha1</key>
- <opt>val:dtv.ALPHA1</opt>
- </option>
- <option>
- <name>Alpha 2</name>
- <key>alpha2</key>
- <opt>val:dtv.ALPHA2</opt>
- </option>
- <option>
- <name>Alpha 4</name>
- <key>alpha4</key>
- <opt>val:dtv.ALPHA4</opt>
- </option>
- </param>
- <param>
- <name>Code rate HP</name>
- <key>code_rate_hp</key>
- <type>enum</type>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>7/8</name>
- <key>C7_8</key>
- <opt>val:dtv.C7_8</opt>
- </option>
- </param>
- <param>
- <name>Code rate LP</name>
- <key>code_rate_lp</key>
- <type>enum</type>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>7/8</name>
- <key>C7_8</key>
- <opt>val:dtv.C7_8</opt>
- </option>
- </param>
- <param>
- <name>Guard Interval</name>
- <key>guard_interval</key>
- <type>enum</type>
- <option>
- <name>1/32</name>
- <key>GI_1_32</key>
- <opt>val:dtv.GI_1_32</opt>
- </option>
- <option>
- <name>1/16</name>
- <key>GI_1_16</key>
- <opt>val:dtv.GI_1_16</opt>
- </option>
- <option>
- <name>1/8</name>
- <key>GI_1_8</key>
- <opt>val:dtv.GI_1_8</opt>
- </option>
- <option>
- <name>1/4</name>
- <key>GI_1_4</key>
- <opt>val:dtv.GI_1_4</opt>
- </option>
- </param>
- <param>
- <name>Transmission Mode</name>
- <key>transmission_mode</key>
- <type>enum</type>
- <option>
- <name>2K</name>
- <key>T2k</key>
- <opt>val:dtv.T2k</opt>
- <opt>fft_length:2048</opt>
- <opt>payload_length:1512</opt>
- </option>
- <option>
- <name>8K</name>
- <key>T8k</key>
- <opt>val:dtv.T8k</opt>
- <opt>fft_length:8192</opt>
- <opt>payload_length:6048</opt>
- </option>
- </param>
- <param>
- <name>Include Cell ID</name>
- <key>include_cell_id</key>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>call_id_yes</key>
- <opt>val:1</opt>
- </option>
- <option>
- <name>No</name>
- <key>cell_id_no</key>
- <opt>val:0</opt>
- </option>
- </param>
- <param>
- <name>Cell Id</name>
- <key>cell_id</key>
- <value>0</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- <vlen>$transmission_mode.payload_length</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- <vlen>$transmission_mode.fft_length</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt_symbol_inner_interleaver.block.yml b/gr-dtv/grc/dtv_dvbt_symbol_inner_interleaver.block.yml
new file mode 100644
index 000000000..d516f0ec7
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt_symbol_inner_interleaver.block.yml
@@ -0,0 +1,37 @@
+id: dtv_dvbt_symbol_inner_interleaver
+label: Symbol Inner Interleaver
+
+parameters:
+- id: transmission_mode
+ label: Transmission Mode
+ dtype: enum
+ options: [T2k, T8k]
+ option_labels: [2K, 8K]
+ option_attributes:
+ fft_length: ['2048', '8192']
+ payload_length: ['1512', '6048']
+ val: [dtv.T2k, dtv.T8k]
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: direction
+ label: Direction
+ dtype: enum
+ options: [Interleave, Deinterleave]
+ option_attributes:
+ val: ['1', '0']
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ transmission_mode.payload_length }
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: ${ transmission_mode.payload_length }
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt_symbol_inner_interleaver(${transmission_mode.payload_length}, ${transmission_mode.val},
+ ${direction.val})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt_symbol_inner_interleaver.xml b/gr-dtv/grc/dtv_dvbt_symbol_inner_interleaver.xml
deleted file mode 100644
index f440769a4..000000000
--- a/gr-dtv/grc/dtv_dvbt_symbol_inner_interleaver.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T Symbol Inner Interleaver
-###################################################
- -->
-<block>
- <name>Symbol Inner Interleaver</name>
- <key>dtv_dvbt_symbol_inner_interleaver</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt_symbol_inner_interleaver($transmission_mode.payload_length, $transmission_mode.val, $direction.val)</make>
- <param>
- <name>Transmission Mode</name>
- <key>transmission_mode</key>
- <type>enum</type>
- <option>
- <name>2K</name>
- <key>T2k</key>
- <opt>val:dtv.T2k</opt>
- <opt>fft_length:2048</opt>
- <opt>payload_length:1512</opt>
- </option>
- <option>
- <name>8K</name>
- <key>T8k</key>
- <opt>val:dtv.T8k</opt>
- <opt>fft_length:8192</opt>
- <opt>payload_length:6048</opt>
- </option>
- </param>
- <param>
- <name>Direction</name>
- <key>direction</key>
- <type>enum</type>
- <option>
- <name>Interleave</name>
- <key>Interleave</key>
- <opt>val:1</opt>
- </option>
- <option>
- <name>Deinterleave</name>
- <key>Deinterleave</key>
- <opt>val:0</opt>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>$transmission_mode.payload_length</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>$transmission_mode.payload_length</vlen>
- </source>
-</block>
diff --git a/gr-dtv/grc/dtv_dvbt_viterbi_decoder.block.yml b/gr-dtv/grc/dtv_dvbt_viterbi_decoder.block.yml
new file mode 100644
index 000000000..367b58101
--- /dev/null
+++ b/gr-dtv/grc/dtv_dvbt_viterbi_decoder.block.yml
@@ -0,0 +1,51 @@
+id: dtv_dvbt_viterbi_decoder
+label: Viterbi Decoder
+
+parameters:
+- id: constellation
+ label: Constellation Type
+ dtype: enum
+ options: [qpsk, 16qam, 64qam]
+ option_labels: [QPSK, 16QAM, 64QAM]
+ option_attributes:
+ val: [dtv.MOD_QPSK, dtv.MOD_16QAM, dtv.MOD_64QAM]
+- id: hierarchy
+ label: Hierarchy Type
+ dtype: enum
+ options: [nh, alpha1, alpha2, alpha4]
+ option_labels: [Non Hierarchical, Alpha 1, Alpha 2, Alpha 4]
+ option_attributes:
+ val: [dtv.NH, dtv.ALPHA1, dtv.ALPHA2, dtv.ALPHA4]
+- id: code_rate
+ label: Code rate
+ dtype: enum
+ options: [C1_2, C2_3, C3_4, C5_6, C7_8]
+ option_labels: [1/2, 2/3, 3/4, 5/6, 7/8]
+ option_attributes:
+ val: [dtv.C1_2, dtv.C2_3, dtv.C3_4, dtv.C5_6, dtv.C7_8]
+- id: type
+ label: Type
+ dtype: enum
+ options: [i, s, b]
+ option_labels: [Int, Short, Byte]
+ option_attributes:
+ io: [int, short, byte]
+ hide: part
+- id: block_size
+ label: Block Size
+ dtype: int
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: ${ type.io }
+
+templates:
+ imports: from gnuradio import dtv
+ make: dtv.dvbt_viterbi_decoder(${constellation.val}, ${hierarchy.val}, ${code_rate.val},
+ ${block_size})
+
+file_format: 1
diff --git a/gr-dtv/grc/dtv_dvbt_viterbi_decoder.xml b/gr-dtv/grc/dtv_dvbt_viterbi_decoder.xml
deleted file mode 100644
index 1dde80c28..000000000
--- a/gr-dtv/grc/dtv_dvbt_viterbi_decoder.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DVB-T Viterbi Decoder
-###################################################
- -->
-<block>
- <name>Viterbi Decoder</name>
- <key>dtv_dvbt_viterbi_decoder</key>
- <import>from gnuradio import dtv</import>
- <make>dtv.dvbt_viterbi_decoder($constellation.val, $hierarchy.val, $code_rate.val, $block_size)</make>
- <param>
- <name>Constellation Type</name>
- <key>constellation</key>
- <type>enum</type>
- <option>
- <name>QPSK</name>
- <key>qpsk</key>
- <opt>val:dtv.MOD_QPSK</opt>
- </option>
- <option>
- <name>16QAM</name>
- <key>16qam</key>
- <opt>val:dtv.MOD_16QAM</opt>
- </option>
- <option>
- <name>64QAM</name>
- <key>64qam</key>
- <opt>val:dtv.MOD_64QAM</opt>
- </option>
- </param>
- <param>
- <name>Hierarchy Type</name>
- <key>hierarchy</key>
- <type>enum</type>
- <option>
- <name>Non Hierarchical</name>
- <key>nh</key>
- <opt>val:dtv.NH</opt>
- </option>
- <option>
- <name>Alpha 1</name>
- <key>alpha1</key>
- <opt>val:dtv.ALPHA1</opt>
- </option>
- <option>
- <name>Alpha 2</name>
- <key>alpha2</key>
- <opt>val:dtv.ALPHA2</opt>
- </option>
- <option>
- <name>Alpha 4</name>
- <key>alpha4</key>
- <opt>val:dtv.ALPHA4</opt>
- </option>
- </param>
- <param>
- <name>Code rate</name>
- <key>code_rate</key>
- <type>enum</type>
- <option>
- <name>1/2</name>
- <key>C1_2</key>
- <opt>val:dtv.C1_2</opt>
- </option>
- <option>
- <name>2/3</name>
- <key>C2_3</key>
- <opt>val:dtv.C2_3</opt>
- </option>
- <option>
- <name>3/4</name>
- <key>C3_4</key>
- <opt>val:dtv.C3_4</opt>
- </option>
- <option>
- <name>5/6</name>
- <key>C5_6</key>
- <opt>val:dtv.C5_6</opt>
- </option>
- <option>
- <name>7/8</name>
- <key>C7_8</key>
- <opt>val:dtv.C7_8</opt>
- </option>
- </param>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>i</key>
- <opt>io:int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>s</key>
- <opt>io:short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>b</key>
- <opt>io:byte</opt>
- </option>
- </param>
- <param>
- <name>Block Size</name>
- <key>block_size</key>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.io</type>
- </source>
-</block>
diff --git a/gr-dtv/python/dtv/CMakeLists.txt b/gr-dtv/python/dtv/CMakeLists.txt
index e39b21cbb..caf19d8d9 100644
--- a/gr-dtv/python/dtv/CMakeLists.txt
+++ b/gr-dtv/python/dtv/CMakeLists.txt
@@ -44,6 +44,6 @@ if(ENABLE_TESTING)
file(GLOB py_qa_test_files "qa_*.py")
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gr-dtv/python/dtv/__init__.py b/gr-dtv/python/dtv/__init__.py
index 8d2b8bfbc..82bd56211 100644
--- a/gr-dtv/python/dtv/__init__.py
+++ b/gr-dtv/python/dtv/__init__.py
@@ -24,14 +24,17 @@
'''
Blocks and utilities for digital TV module.
'''
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
import os
try:
- from dtv_swig import *
+ from .dtv_swig import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
- from dtv_swig import *
+ from .dtv_swig import *
# Import pure python code here
-from atsc_rx import *
+from .atsc_rx import *
diff --git a/gr-dtv/python/dtv/atsc_rx.py b/gr-dtv/python/dtv/atsc_rx.py
index 75c61f43f..d728f0945 100644
--- a/gr-dtv/python/dtv/atsc_rx.py
+++ b/gr-dtv/python/dtv/atsc_rx.py
@@ -19,8 +19,10 @@
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
+from __future__ import absolute_import
+from __future__ import unicode_literals
from gnuradio import gr, filter, analog
-from atsc_rx_filter import *
+from .atsc_rx_filter import *
class atsc_rx(gr.hier_block2):
def __init__(self, input_rate, sps):
@@ -53,17 +55,17 @@ class atsc_rx(gr.hier_block2):
# Remove convolutional trellis coding
vit = dtv.atsc_viterbi_decoder()
- # Remove convolutional interleaving
- dei = dtv.atsc_deinterleaver()
+ # Remove convolutional interleaving
+ dei = dtv.atsc_deinterleaver()
- # Reed-Solomon decode
- rsd = dtv.atsc_rs_decoder()
+ # Reed-Solomon decode
+ rsd = dtv.atsc_rs_decoder()
- # Derandomize MPEG2-TS packet
- der = dtv.atsc_derandomizer()
+ # Derandomize MPEG2-TS packet
+ der = dtv.atsc_derandomizer()
- # Remove padding from packet
- dep = dtv.atsc_depad()
+ # Remove padding from packet
+ dep = dtv.atsc_depad()
# Connect pipeline
self.connect(self, rx_filt, pll, dcr, agc, btl, fsc, equ)
diff --git a/gr-dtv/python/dtv/atsc_rx_filter.py b/gr-dtv/python/dtv/atsc_rx_filter.py
index e860fa265..b5df161a5 100644
--- a/gr-dtv/python/dtv/atsc_rx_filter.py
+++ b/gr-dtv/python/dtv/atsc_rx_filter.py
@@ -19,8 +19,10 @@
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr, filter
-import dtv_swig as dtv
+from . import dtv_swig as dtv
# FIXME move these into separate constants module
ATSC_CHANNEL_BW = 6.0e6
@@ -38,10 +40,10 @@ class atsc_rx_filter(gr.hier_block2):
nfilts = 16
output_rate = ATSC_SYMBOL_RATE*sps # Desired oversampled sample rate
filter_rate = input_rate*nfilts
- symbol_rate = ATSC_SYMBOL_RATE/2.0 # One-sided bandwidth of sideband
+ symbol_rate = ATSC_SYMBOL_RATE / 2.0 # One-sided bandwidth of sideband
excess_bw = 0.1152 #1.0-(0.5*ATSC_SYMBOL_RATE/ATSC_CHANNEL_BW) # ~10.3%
ntaps = int((2*ATSC_RRC_SYMS+1)*sps*nfilts)
- interp = output_rate/input_rate
+ interp = output_rate / input_rate
gain = nfilts*symbol_rate/filter_rate
rrc_taps = filter.firdes.root_raised_cosine(gain, # Filter gain
filter_rate, # PFB filter prototype rate
diff --git a/gr-dtv/python/dtv/qa_dtv.py b/gr-dtv/python/dtv/qa_dtv.py
index a0f6edf80..cebdeb595 100755..100644
--- a/gr-dtv/python/dtv/qa_dtv.py
+++ b/gr-dtv/python/dtv/qa_dtv.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, dtv
class test_dtv(gr_unittest.TestCase):
diff --git a/gr-fec/grc/CMakeLists.txt b/gr-fec/grc/CMakeLists.txt
index f61603df2..5214189b9 100644
--- a/gr-fec/grc/CMakeLists.txt
+++ b/gr-fec/grc/CMakeLists.txt
@@ -18,9 +18,9 @@
# Boston, MA 02110-1301, USA.
########################################################################
-file(GLOB xml_files "*.xml")
+file(GLOB yml_files "*.yml")
install(FILES
- ${xml_files}
+ ${yml_files}
DESTINATION ${GRC_BLOCKS_DIR}
)
diff --git a/gr-fec/grc/fec.tree.yml b/gr-fec/grc/fec.tree.yml
new file mode 100644
index 000000000..e9109ba31
--- /dev/null
+++ b/gr-fec/grc/fec.tree.yml
@@ -0,0 +1,43 @@
+'[Core]':
+- Error Coding:
+ - Decoders:
+ - variable_cc_decoder_def
+ - variable_repetition_decoder_def
+ - variable_ldpc_decoder_def
+ - variable_ldpc_bit_flip_decoder_def
+ - variable_tpc_decoder_def
+ - variable_dummy_decoder_def
+ - variable_polar_decoder_sc_def
+ - variable_polar_decoder_sc_list_def
+ - variable_polar_decoder_sc_systematic_def
+ - Encoders:
+ - variable_cc_encoder_def
+ - variable_ccsds_encoder_def
+ - variable_repetition_encoder_def
+ - variable_tpc_encoder_def
+ - variable_ldpc_encoder_def
+ - variable_ldpc_encoder_G_def
+ - variable_ldpc_encoder_H_def
+ - variable_polar_encoder_def
+ - variable_polar_encoder_systematic_def
+ - variable_dummy_encoder_def
+ - fec_extended_encoder
+ - fec_extended_async_encoder
+ - fec_extended_tagged_encoder
+ - fec_extended_decoder
+ - fec_extended_tagged_decoder
+ - fec_generic_encoder
+ - fec_generic_decoder
+ - fec_tagged_encoder
+ - fec_tagged_decoder
+ - fec_async_encoder
+ - fec_async_decoder
+ - fec_decode_ccsds_27_fb
+ - fec_encode_ccsds_27_bb
+ - fec_puncture_xx
+ - fec_depuncture_bb
+ - fec_ber_bf
+ - fec_bercurve_generator
+ - variable_polar_code_configurator
+ - variable_ldpc_H_matrix_def
+ - variable_ldpc_G_matrix_def
diff --git a/gr-fec/grc/fec_async_decoder.block.yml b/gr-fec/grc/fec_async_decoder.block.yml
new file mode 100644
index 000000000..94c3e148f
--- /dev/null
+++ b/gr-fec/grc/fec_async_decoder.block.yml
@@ -0,0 +1,43 @@
+id: fec_async_decoder
+label: FEC Async Decoder
+
+parameters:
+- id: decoder
+ label: Decoder Obj.
+ dtype: raw
+- id: mtu
+ label: MTU (bytes)
+ dtype: int
+ default: '1500'
+- id: packed
+ label: Packed
+ dtype: enum
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['No', 'Yes']
+ hide: part
+- id: rev_pack
+ label: Rev. Packing
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: ${ ('part' if packed == 'True' else 'all') }
+
+inputs:
+- domain: message
+ id: in
+ optional: true
+
+outputs:
+- domain: message
+ id: out
+ optional: true
+
+templates:
+ imports: from gnuradio import fec
+ make: fec.async_decoder(${decoder}, ${packed}, ${rev_pack}, ${mtu})
+
+documentation: ""
+
+file_format: 1
diff --git a/gr-fec/grc/fec_async_decoder.xml b/gr-fec/grc/fec_async_decoder.xml
deleted file mode 100644
index 9b67d869e..000000000
--- a/gr-fec/grc/fec_async_decoder.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>FEC Async Decoder</name>
- <key>fec_async_decoder</key>
- <import>from gnuradio import fec</import>
- <make>fec.async_decoder($decoder, $packed, $rev_pack, $mtu)</make>
-
- <param>
- <name>Decoder Obj.</name>
- <key>decoder</key>
- <type>raw</type>
- </param>
-
- <param>
- <name>MTU (bytes)</name>
- <key>mtu</key>
- <value>1500</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Packed</name>
- <key>packed</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- </param>
-
- <param>
- <name>Rev. Packing</name>
- <key>rev_pack</key>
- <value>True</value>
- <type>enum</type>
- <hide>#if $packed() == 'True' then 'part' else 'all'#</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <sink>
- <name>in</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
-
- <source>
- <name>out</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-
- <doc>
- </doc>
-
-</block>
diff --git a/gr-fec/grc/fec_async_encoder.block.yml b/gr-fec/grc/fec_async_encoder.block.yml
new file mode 100644
index 000000000..4b3902196
--- /dev/null
+++ b/gr-fec/grc/fec_async_encoder.block.yml
@@ -0,0 +1,50 @@
+id: fec_async_encoder
+label: FEC Async Encoder
+
+parameters:
+- id: encoder
+ label: Encoder Obj.
+ dtype: raw
+- id: mtu
+ label: MTU (bytes)
+ dtype: int
+ default: '1500'
+- id: packed
+ label: Packed
+ dtype: enum
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['No', 'Yes']
+ hide: part
+- id: rev_unpack
+ label: Rev. Unpacking
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: ${ ('part' if packed == 'True' else 'all') }
+- id: rev_pack
+ label: Rev. Packing
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: ${ ('part' if packed == 'True' else 'all') }
+
+inputs:
+- domain: message
+ id: in
+ optional: true
+
+outputs:
+- domain: message
+ id: out
+ optional: true
+
+templates:
+ imports: from gnuradio import fec
+ make: fec.async_encoder(${encoder}, ${packed}, ${rev_unpack}, ${rev_pack}, ${mtu})
+
+documentation: ""
+
+file_format: 1
diff --git a/gr-fec/grc/fec_async_encoder.xml b/gr-fec/grc/fec_async_encoder.xml
deleted file mode 100644
index 68d516fc6..000000000
--- a/gr-fec/grc/fec_async_encoder.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>FEC Async Encoder</name>
- <key>fec_async_encoder</key>
- <import>from gnuradio import fec</import>
- <make>fec.async_encoder($encoder, $packed, $rev_unpack, $rev_pack, $mtu)</make>
-
- <param>
- <name>Encoder Obj.</name>
- <key>encoder</key>
- <type>raw</type>
- </param>
-
- <param>
- <name>MTU (bytes)</name>
- <key>mtu</key>
- <value>1500</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Packed</name>
- <key>packed</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- </param>
-
- <param>
- <name>Rev. Unpacking</name>
- <key>rev_unpack</key>
- <value>True</value>
- <type>enum</type>
- <hide>#if $packed() == 'True' then 'part' else 'all'#</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Rev. Packing</name>
- <key>rev_pack</key>
- <value>True</value>
- <type>enum</type>
- <hide>#if $packed() == 'True' then 'part' else 'all'#</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <sink>
- <name>in</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
-
- <source>
- <name>out</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-
- <doc>
- </doc>
-
-</block>
diff --git a/gr-fec/grc/fec_ber_bf.block.yml b/gr-fec/grc/fec_ber_bf.block.yml
new file mode 100644
index 000000000..65bb2747f
--- /dev/null
+++ b/gr-fec/grc/fec_ber_bf.block.yml
@@ -0,0 +1,37 @@
+id: fec_ber_bf
+label: BER
+
+parameters:
+- id: test_mode
+ label: Test Mode
+ dtype: enum
+ default: 'False'
+ options: ['False', 'True']
+- id: berminerrors
+ label: BER Min. Errors
+ dtype: int
+ default: '100'
+ hide: ${ ('part' if test_mode else 'all') }
+- id: berlimit
+ label: BER Limit
+ dtype: float
+ default: '-7.0'
+ hide: ${ ('part' if test_mode else 'all') }
+
+inputs:
+- label: in0
+ domain: stream
+ dtype: byte
+- label: in1
+ domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import fec
+ make: fec.ber_bf(${test_mode}, ${berminerrors}, ${berlimit})
+
+file_format: 1
diff --git a/gr-fec/grc/fec_ber_bf.xml b/gr-fec/grc/fec_ber_bf.xml
deleted file mode 100644
index 6d8d85e9f..000000000
--- a/gr-fec/grc/fec_ber_bf.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>BER</name>
- <key>fec_ber_bf</key>
- <import>from gnuradio import fec</import>
- <make>fec.ber_bf($test_mode, $berminerrors, $berlimit)</make>
-
- <param>
- <name>Test Mode</name>
- <key>test_mode</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>False</name>
- <key>False</key>
- </option>
- <option>
- <name>True</name>
- <key>True</key>
- </option>
- </param>
-
- <param>
- <name>BER Min. Errors</name>
- <key>berminerrors</key>
- <value>100</value>
- <type>int</type>
- <hide>#if $test_mode() then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <name>BER Limit</name>
- <key>berlimit</key>
- <value>-7.0</value>
- <type>float</type>
- <hide>#if $test_mode() then 'part' else 'all'#</hide>
- </param>
-
- <sink>
- <name>in0</name>
- <type>byte</type>
- </sink>
-
- <sink>
- <name>in1</name>
- <type>byte</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-
-</block> \ No newline at end of file
diff --git a/gr-fec/grc/fec_bercurve_generator.block.yml b/gr-fec/grc/fec_bercurve_generator.block.yml
new file mode 100644
index 000000000..565a0cf6c
--- /dev/null
+++ b/gr-fec/grc/fec_bercurve_generator.block.yml
@@ -0,0 +1,63 @@
+id: fec_bercurve_generator
+label: BER Curve Gen.
+
+parameters:
+- id: esno
+ label: Es/N0
+ dtype: raw
+ default: numpy.arange(0.0, 4.0, .5)
+ hide: part
+- id: samp_rate
+ label: Sample Rate
+ dtype: float
+ default: '3200000'
+- id: encoder_list
+ label: Encoder list
+ dtype: raw
+ default: '0'
+- id: decoder_list
+ label: Decoder list
+ dtype: raw
+ default: '0'
+- id: puncpat
+ label: Puncture Pat.
+ dtype: string
+ default: '''11'''
+- id: threadtype
+ label: Threading Type
+ dtype: enum
+ options: ['"capillary"', '"ordinary"', '"none"']
+ option_labels: [Capillary, Ordinary, None]
+ hide: part
+- id: seed
+ label: Noise Seed
+ dtype: int
+ default: '0'
+ hide: part
+
+outputs:
+- domain: stream
+ dtype: byte
+ multiplicity: ${ len(esno)*2 }
+
+templates:
+ imports: |-
+ from gnuradio import fec
+ import numpy
+ make: "fec.bercurve_generator(\n\t${encoder_list}, \\#size\n\t${decoder_list},\
+ \ \\#name\n\t${esno}, \\#range of esnos\n\t${samp_rate}, \\#throttle\n \
+ \ ${threadtype}, \\#threading mode\n\t${puncpat}, \\#puncture pattern\n\
+ \ ${seed} \\# noise gen. seed\n)\n "
+
+documentation: |-
+ Note that this block tries to launch many parallel codes to run simultaneously. Thus, it requires that the definitions for each encoder and decoder (specified in the "Encoder list" and "Decoder list") be configured with a parallelism > 0. If the parallelism for one of the encoder or decoder definition blocks is configured to 0, you will likely see an error like:
+
+ generic_decoder=decoder_list[i],
+ TypeError: 'generic_decoder_sptr' object does not support indexing
+
+ or
+
+ generic_encoder=encoder_list[i],
+ TypeError: 'generic_encoder_sptr' object does not support indexing
+
+file_format: 1
diff --git a/gr-fec/grc/fec_bercurve_generator.xml b/gr-fec/grc/fec_bercurve_generator.xml
deleted file mode 100644
index 5dfc7c671..000000000
--- a/gr-fec/grc/fec_bercurve_generator.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## BER Curve Generator
-###################################################
- -->
-<block>
- <name>BER Curve Gen.</name>
- <key>fec_bercurve_generator</key>
- <import>from gnuradio import fec</import>
- <import>import numpy</import>
- <make>fec.bercurve_generator(
- $encoder_list, \#size
- $decoder_list, \#name
- $esno, \#range of esnos
- $samp_rate, \#throttle
- $threadtype, \#threading mode
- $puncpat, \#puncture pattern
- $seed \# noise gen. seed
-)
- </make>
-
- <param>
- <name>Es/N0</name>
- <key>esno</key>
- <value>numpy.arange(0.0, 4.0, .5)</value>
- <type>raw</type>
- </param>
-
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <value>3200000</value>
- <type>float</type>
- </param>
-
- <param>
- <name>Encoder list</name>
- <key>encoder_list</key>
- <value>0</value>
- <type>raw</type>
- </param>
-
- <param>
- <name>Decoder list</name>
- <key>decoder_list</key>
- <value>0</value>
- <type>raw</type>
- </param>
-
- <param>
- <name>Puncture Pat.</name>
- <key>puncpat</key>
- <value>'11'</value>
- <type>string</type>
- </param>
-
- <param>
- <name>Threading Type</name>
- <key>threadtype</key>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Capillary</name>
- <key>"capillary"</key>
- </option>
- <option>
- <name>Ordinary</name>
- <key>"ordinary"</key>
- </option>
- <option>
- <name>None</name>
- <key>"none"</key>
- </option>
- </param>
-
- <param>
- <name>Noise Seed</name>
- <key>seed</key>
- <value>0</value>
- <type>int</type>
- <hide>part</hide>
- </param>
-
- <bus_source>1</bus_source>
-
- <source>
- <name>out</name>
- <type>byte</type>
- <nports>len($esno)*2</nports>
- </source>
-
- <doc>
- Note that this block tries to launch many parallel codes to run simultaneously. Thus, it requires that the definitions for each encoder and decoder (specified in the "Encoder list" and "Decoder list") be configured with a parallelism > 0. If the parallelism for one of the encoder or decoder definition blocks is configured to 0, you will likely see an error like:
-
- generic_decoder=decoder_list[i],
- TypeError: 'generic_decoder_sptr' object does not support indexing
-
- or
-
- generic_encoder=encoder_list[i],
- TypeError: 'generic_encoder_sptr' object does not support indexing
- </doc>
-</block>
diff --git a/gr-fec/grc/fec_block_tree.xml b/gr-fec/grc/fec_block_tree.xml
deleted file mode 100644
index b1535e3c4..000000000
--- a/gr-fec/grc/fec_block_tree.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Block Tree for gr-fec
-###################################################
- -->
-<cat>
- <name>[Core]</name>
- <cat>
- <name>Error Coding</name>
- <cat>
- <name>Decoders</name>
- <block>variable_cc_decoder_def</block>
- <block>variable_repetition_decoder_def</block>
- <block>variable_ldpc_decoder_def</block>
- <block>variable_ldpc_bit_flip_decoder_def</block>
- <block>variable_tpc_decoder_def</block>
- <block>variable_dummy_decoder_def</block>
- <block>variable_polar_decoder_sc_def</block>
- <block>variable_polar_decoder_sc_list_def</block>
- <block>variable_polar_decoder_sc_systematic_def</block>
- </cat>
- <cat>
- <name>Encoders</name>
- <block>variable_cc_encoder_def</block>
- <block>variable_ccsds_encoder_def</block>
- <block>variable_repetition_encoder_def</block>
- <block>variable_tpc_encoder_def</block>
- <block>variable_ldpc_encoder_def</block>
- <block>variable_ldpc_encoder_G_def</block>
- <block>variable_ldpc_encoder_H_def</block>
- <block>variable_polar_encoder_def</block>
- <block>variable_polar_encoder_systematic_def</block>
- <block>variable_dummy_encoder_def</block>
- </cat>
- <block>fec_extended_encoder</block>
- <block>fec_extended_async_encoder</block>
- <block>fec_extended_tagged_encoder</block>
- <block>fec_extended_decoder</block>
- <block>fec_extended_tagged_decoder</block>
- <block>fec_generic_encoder</block>
- <block>fec_generic_decoder</block>
- <block>fec_tagged_encoder</block>
- <block>fec_tagged_decoder</block>
- <block>fec_async_encoder</block>
- <block>fec_async_decoder</block>
- <block>fec_decode_ccsds_27_fb</block>
- <block>fec_encode_ccsds_27_bb</block>
- <block>fec_puncture_xx</block>
- <block>fec_depuncture_bb</block>
- <block>fec_ber_bf</block>
- <block>fec_bercurve_generator</block>
- <block>variable_polar_code_configurator</block>
- <block>variable_ldpc_H_matrix_def</block>
- <block>variable_ldpc_G_matrix_def</block>
- </cat>
-</cat>
diff --git a/gr-fec/grc/fec_decode_ccsds_27_bb.block.yml b/gr-fec/grc/fec_decode_ccsds_27_bb.block.yml
new file mode 100644
index 000000000..310b54e4e
--- /dev/null
+++ b/gr-fec/grc/fec_decode_ccsds_27_bb.block.yml
@@ -0,0 +1,16 @@
+id: fec_encode_ccsds_27_bb
+label: Encode CCSDS 27
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import fec
+ make: fec.encode_ccsds_27_bb()
+
+file_format: 1
diff --git a/gr-fec/grc/fec_decode_ccsds_27_bb.xml b/gr-fec/grc/fec_decode_ccsds_27_bb.xml
deleted file mode 100644
index ea11837c1..000000000
--- a/gr-fec/grc/fec_decode_ccsds_27_bb.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Encode CCSDS 27
-###################################################
- -->
-<block>
- <name>Encode CCSDS 27</name>
- <key>fec_encode_ccsds_27_bb</key>
- <import>from gnuradio import fec</import>
- <make>fec.encode_ccsds_27_bb()</make>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-fec/grc/fec_decode_ccsds_27_fb.block.yml b/gr-fec/grc/fec_decode_ccsds_27_fb.block.yml
new file mode 100644
index 000000000..51eed3783
--- /dev/null
+++ b/gr-fec/grc/fec_decode_ccsds_27_fb.block.yml
@@ -0,0 +1,16 @@
+id: fec_decode_ccsds_27_fb
+label: Decode CCSDS 27
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import fec
+ make: fec.decode_ccsds_27_fb()
+
+file_format: 1
diff --git a/gr-fec/grc/fec_decode_ccsds_27_fb.xml b/gr-fec/grc/fec_decode_ccsds_27_fb.xml
deleted file mode 100644
index f7bd9d3b5..000000000
--- a/gr-fec/grc/fec_decode_ccsds_27_fb.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Decode CCSDS 27
-###################################################
- -->
-<block>
- <name>Decode CCSDS 27</name>
- <key>fec_decode_ccsds_27_fb</key>
- <import>from gnuradio import fec</import>
- <make>fec.decode_ccsds_27_fb()</make>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-fec/grc/fec_decoder.block.yml b/gr-fec/grc/fec_decoder.block.yml
new file mode 100644
index 000000000..b90a4749c
--- /dev/null
+++ b/gr-fec/grc/fec_decoder.block.yml
@@ -0,0 +1,41 @@
+id: fec_generic_decoder
+label: FEC Decoder
+
+parameters:
+- id: decoder
+ label: Decoder Object
+ dtype: raw
+ default: decoder_variable
+- id: itype
+ label: Input Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: otype
+ label: Output Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ itype }
+
+outputs:
+- domain: stream
+ dtype: ${ otype }
+
+templates:
+ imports: from gnuradio import fec
+ make: fec.decoder(${decoder}, ${itype.size}, ${otype.size})
+
+documentation: |-
+ This is a GNU Radio adaptor for any FEC decoder following the generic_decoder API in the fec module. Input and output are flexible to accomodate decoders that, say, modulate their encoded results into complex or float types.
+
+file_format: 1
diff --git a/gr-fec/grc/fec_decoder.xml b/gr-fec/grc/fec_decoder.xml
deleted file mode 100644
index dd9d08d5f..000000000
--- a/gr-fec/grc/fec_decoder.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>FEC Decoder</name>
- <key>fec_generic_decoder</key>
- <import>from gnuradio import fec</import>
- <make>fec.decoder($decoder, $itype.size, $otype.size)</make>
-
- <param>
- <name>Decoder Object</name>
- <key>decoder</key>
- <value>decoder_variable</value>
- <type>raw</type>
- </param>
-
- <param>
- <name>Input Type</name>
- <key>itype</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
-
- <param>
- <name>Output Type</name>
- <key>otype</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
-
- <sink>
- <name>in</name>
- <type>$itype</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>$otype</type>
- </source>
-
- <doc>
- This is a GNU Radio adaptor for any FEC decoder following the generic_decoder API in the fec module. Input and output are flexible to accomodate decoders that, say, modulate their encoded results into complex or float types.
- </doc>
-
-</block> \ No newline at end of file
diff --git a/gr-fec/grc/fec_depuncture_bb.block.yml b/gr-fec/grc/fec_depuncture_bb.block.yml
new file mode 100644
index 000000000..24a3e62fc
--- /dev/null
+++ b/gr-fec/grc/fec_depuncture_bb.block.yml
@@ -0,0 +1,33 @@
+id: fec_depuncture_bb
+label: Depuncture
+
+parameters:
+- id: puncsize
+ label: Puncture Size
+ dtype: int
+- id: puncpat
+ label: Puncture Pattern
+ dtype: int
+- id: delay
+ label: Delay
+ dtype: int
+ default: '0'
+- id: sym
+ label: Symbol
+ dtype: int
+ default: '127'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import fec
+ make: fec.depuncture_bb(${puncsize}, ${puncpat}, ${delay}, ${sym})
+
+file_format: 1
diff --git a/gr-fec/grc/fec_depuncture_bb.xml b/gr-fec/grc/fec_depuncture_bb.xml
deleted file mode 100644
index 03dec9bd7..000000000
--- a/gr-fec/grc/fec_depuncture_bb.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>Depuncture</name>
- <key>fec_depuncture_bb</key>
- <import>from gnuradio import fec</import>
- <make>fec.depuncture_bb($puncsize, $puncpat, $delay, $sym)</make>
-
- <param>
- <name>Puncture Size</name>
- <key>puncsize</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Puncture Pattern</name>
- <key>puncpat</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Delay</name>
- <key>delay</key>
- <value>0</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Symbol</name>
- <key>sym</key>
- <value>127</value>
- <type>int</type>
- <hide>part</hide>
- </param>
-
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-
-</block>
diff --git a/gr-fec/grc/fec_encoder.block.yml b/gr-fec/grc/fec_encoder.block.yml
new file mode 100644
index 000000000..f530d806d
--- /dev/null
+++ b/gr-fec/grc/fec_encoder.block.yml
@@ -0,0 +1,41 @@
+id: fec_generic_encoder
+label: FEC Encoder
+
+parameters:
+- id: encoder
+ label: Constituent Encoder
+ dtype: raw
+ default: encoder_variable
+- id: itype
+ label: Input Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: otype
+ label: Output Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ itype }
+
+outputs:
+- domain: stream
+ dtype: ${ otype }
+
+templates:
+ imports: from gnuradio import fec
+ make: fec.encoder(${encoder}, ${itype.size}, ${otype.size})
+
+documentation: |-
+ This is a GNU Radio adaptor for any FEC encoder following the generic_encoder API in the fec module. Input and output are flexible to accomodate encoders that, say, modulate their encoded results into complex or float types.
+
+file_format: 1
diff --git a/gr-fec/grc/fec_encoder.xml b/gr-fec/grc/fec_encoder.xml
deleted file mode 100644
index defb7c3b4..000000000
--- a/gr-fec/grc/fec_encoder.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>FEC Encoder</name>
- <key>fec_generic_encoder</key>
- <import>from gnuradio import fec</import>
- <make>fec.encoder($encoder, $itype.size, $otype.size)</make>
-
- <param>
- <name>Constituent Encoder</name>
- <key>encoder</key>
- <value>encoder_variable</value>
- <type>raw</type>
- </param>
-
- <param>
- <name>Input Type</name>
- <key>itype</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
-
- <param>
- <name>Output Type</name>
- <key>otype</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
-
- <sink>
- <name>in</name>
- <type>$itype</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>$otype</type>
- </source>
-
- <doc>
- This is a GNU Radio adaptor for any FEC encoder following the generic_encoder API in the fec module. Input and output are flexible to accomodate encoders that, say, modulate their encoded results into complex or float types.
- </doc>
-
-</block> \ No newline at end of file
diff --git a/gr-fec/grc/fec_extended_async_encoder.block.yml b/gr-fec/grc/fec_extended_async_encoder.block.yml
new file mode 100644
index 000000000..87fb0918e
--- /dev/null
+++ b/gr-fec/grc/fec_extended_async_encoder.block.yml
@@ -0,0 +1,30 @@
+id: fec_extended_async_encoder
+label: FEC Extended Async Encoder
+
+parameters:
+- id: encoder_list
+ label: Encoder Objects
+ dtype: raw
+ default: encoder_variable
+- id: puncpat
+ label: Puncture Pattern
+ dtype: string
+ default: '''11'''
+
+inputs:
+- domain: message
+ id: in
+ optional: true
+
+outputs:
+- domain: message
+ id: out
+ optional: true
+
+templates:
+ imports: from gnuradio import fec
+ make: fec.extended_async_encoder(encoder_obj_list=${encoder_list}, puncpat=${puncpat})
+
+documentation: ""
+
+file_format: 1
diff --git a/gr-fec/grc/fec_extended_async_encoder.xml b/gr-fec/grc/fec_extended_async_encoder.xml
deleted file mode 100644
index e61696bcc..000000000
--- a/gr-fec/grc/fec_extended_async_encoder.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>FEC Extended Async Encoder</name>
- <key>fec_extended_async_encoder</key>
- <import>from gnuradio import fec</import>
- <make>fec.extended_async_encoder(encoder_obj_list=$encoder_list, puncpat=$puncpat)</make>
-
- <param>
- <name>Encoder Objects</name>
- <key>encoder_list</key>
- <value>encoder_variable</value>
- <type>raw</type>
- </param>
-
- <param>
- <name>Puncture Pattern</name>
- <key>puncpat</key>
- <value>'11'</value>
- <type>string</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
-
- <source>
- <name>out</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-
- <doc>
-
- </doc>
-
-</block>
diff --git a/gr-fec/grc/fec_extended_decoder.block.yml b/gr-fec/grc/fec_extended_decoder.block.yml
new file mode 100644
index 000000000..6e8fb23db
--- /dev/null
+++ b/gr-fec/grc/fec_extended_decoder.block.yml
@@ -0,0 +1,44 @@
+id: fec_extended_decoder
+label: FEC Extended Decoder
+
+parameters:
+- id: value
+ label: fake val
+ dtype: string
+ default: fec_extended_decoder
+ hide: all
+- id: decoder_list
+ label: Decoder Objects
+ dtype: raw
+ default: decoder_variable
+- id: threadtype
+ label: Threading Type
+ dtype: enum
+ options: [capillary, ordinary, none]
+ option_attributes:
+ arg: ['''capillary''', '''ordinary''', ' None']
+- id: ann
+ label: Annihilator
+ dtype: raw
+ default: None
+- id: puncpat
+ label: Puncture Pattern
+ dtype: string
+ default: '''11'''
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import fec
+ make: fec.extended_decoder(decoder_obj_list=${decoder_list}, threading=${threadtype.arg},
+ ann=${ann}, puncpat=${puncpat}, integration_period=10000)
+
+documentation: ""
+
+file_format: 1
diff --git a/gr-fec/grc/fec_extended_decoder.xml b/gr-fec/grc/fec_extended_decoder.xml
deleted file mode 100644
index 9ed2f06bd..000000000
--- a/gr-fec/grc/fec_extended_decoder.xml
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>FEC Extended Decoder</name>
- <key>fec_extended_decoder</key>
- <import>from gnuradio import fec</import>
- <make>fec.extended_decoder(decoder_obj_list=$decoder_list, threading=$threadtype.arg, ann=$ann, puncpat=$puncpat, integration_period=10000)</make>
-
- <param>
- <name>fake val</name>
- <key>value</key>
- <value>fec_extended_decoder</value>
- <type>string</type>
- <hide>all</hide>
- </param>
-
- <param>
- <name>Decoder Objects</name>
- <key>decoder_list</key>
- <value>decoder_variable</value>
- <type>raw</type>
- </param>
-
- <param>
- <name>Threading Type</name>
- <key>threadtype</key>
- <type>enum</type>
- <option>
- <name>Capillary</name>
- <key>capillary</key>
- <opt>arg:'capillary'</opt>
- </option>
- <option>
- <name>Ordinary</name>
- <key>ordinary</key>
- <opt>arg:'ordinary'</opt>
- </option>
- <option>
- <name>None</name>
- <key>none</key>
- <opt>arg: None</opt>
- </option>
- </param>
-
- <param>
- <name>Annihilator</name>
- <key>ann</key>
- <value>None</value>
- <type>raw</type>
- </param>
-
- <param>
- <name>Puncture Pattern</name>
- <key>puncpat</key>
- <value>'11'</value>
- <type>string</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-
- <doc>
-
- </doc>
-
-</block>
diff --git a/gr-fec/grc/fec_extended_encoder.block.yml b/gr-fec/grc/fec_extended_encoder.block.yml
new file mode 100644
index 000000000..b478e9bbf
--- /dev/null
+++ b/gr-fec/grc/fec_extended_encoder.block.yml
@@ -0,0 +1,35 @@
+id: fec_extended_encoder
+label: FEC Extended Encoder
+
+parameters:
+- id: encoder_list
+ label: Encoder Objects
+ dtype: raw
+ default: encoder_variable
+- id: threadtype
+ label: Threading Type
+ dtype: enum
+ options: [capillary, ordinary, none]
+ option_attributes:
+ arg: ['''capillary''', '''ordinary''', ' None']
+- id: puncpat
+ label: Puncture Pattern
+ dtype: string
+ default: '''11'''
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import fec
+ make: fec.extended_encoder(encoder_obj_list=${encoder_list}, threading=${threadtype.arg},
+ puncpat=${puncpat})
+
+documentation: ""
+
+file_format: 1
diff --git a/gr-fec/grc/fec_extended_encoder.xml b/gr-fec/grc/fec_extended_encoder.xml
deleted file mode 100644
index d2a3ec87d..000000000
--- a/gr-fec/grc/fec_extended_encoder.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>FEC Extended Encoder</name>
- <key>fec_extended_encoder</key>
- <import>from gnuradio import fec</import>
- <make>fec.extended_encoder(encoder_obj_list=$encoder_list, threading=$threadtype.arg, puncpat=$puncpat)</make>
-
- <param>
- <name>Encoder Objects</name>
- <key>encoder_list</key>
- <value>encoder_variable</value>
- <type>raw</type>
- </param>
-
- <param>
- <name>Threading Type</name>
- <key>threadtype</key>
- <type>enum</type>
- <option>
- <name>Capillary</name>
- <key>capillary</key>
- <opt>arg:'capillary'</opt>
- </option>
- <option>
- <name>Ordinary</name>
- <key>ordinary</key>
- <opt>arg:'ordinary'</opt>
- </option>
- <option>
- <name>None</name>
- <key>none</key>
- <opt>arg: None</opt>
- </option>
- </param>
-
- <param>
- <name>Puncture Pattern</name>
- <key>puncpat</key>
- <value>'11'</value>
- <type>string</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-
- <doc>
-
- </doc>
-
-</block>
diff --git a/gr-fec/grc/fec_extended_tagged_decoder.block.yml b/gr-fec/grc/fec_extended_tagged_decoder.block.yml
new file mode 100644
index 000000000..7a22e092f
--- /dev/null
+++ b/gr-fec/grc/fec_extended_tagged_decoder.block.yml
@@ -0,0 +1,47 @@
+id: fec_extended_tagged_decoder
+label: FEC Extended Tagged Decoder
+
+parameters:
+- id: value
+ label: fake val
+ dtype: string
+ default: fec_extended_decoder
+ hide: all
+- id: decoder_list
+ label: Decoder Objects
+ dtype: raw
+ default: decoder_variable
+- id: mtu
+ label: MTU (bytes)
+ dtype: int
+ default: '1500'
+- id: ann
+ label: Annihilator
+ dtype: raw
+ default: None
+- id: puncpat
+ label: Puncture Pattern
+ dtype: string
+ default: '''11'''
+- id: lentagname
+ label: Length Tag Name
+ dtype: string
+ default: None
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import fec
+ make: self.${id} = ${id} = fec.extended_tagged_decoder(decoder_obj_list=${decoder_list},
+ ann=${ann}, puncpat=${puncpat}, integration_period=10000, lentagname=${lentagname},
+ mtu=${mtu})
+
+documentation: ""
+
+file_format: 1
diff --git a/gr-fec/grc/fec_extended_tagged_decoder.xml b/gr-fec/grc/fec_extended_tagged_decoder.xml
deleted file mode 100644
index 59f34d4df..000000000
--- a/gr-fec/grc/fec_extended_tagged_decoder.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>FEC Extended Tagged Decoder</name>
- <key>fec_extended_tagged_decoder</key>
- <import>from gnuradio import fec</import>
- <make>self.$(id) = $(id) = fec.extended_tagged_decoder(decoder_obj_list=$decoder_list, ann=$ann, puncpat=$puncpat, integration_period=10000, lentagname=$lentagname, mtu=$mtu)</make>
-
- <param>
- <name>fake val</name>
- <key>value</key>
- <value>fec_extended_decoder</value>
- <type>string</type>
- <hide>all</hide>
- </param>
-
- <param>
- <name>Decoder Objects</name>
- <key>decoder_list</key>
- <value>decoder_variable</value>
- <type>raw</type>
- </param>
-
- <param>
- <name>MTU (bytes)</name>
- <key>mtu</key>
- <value>1500</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Annihilator</name>
- <key>ann</key>
- <value>None</value>
- <type>raw</type>
- </param>
-
- <param>
- <name>Puncture Pattern</name>
- <key>puncpat</key>
- <value>'11'</value>
- <type>string</type>
- </param>
-
- <param>
- <name>Length Tag Name</name>
- <key>lentagname</key>
- <value>None</value>
- <type>string</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-
- <doc>
-
- </doc>
-
-</block>
diff --git a/gr-fec/grc/fec_extended_tagged_encoder.block.yml b/gr-fec/grc/fec_extended_tagged_encoder.block.yml
new file mode 100644
index 000000000..e59ab3365
--- /dev/null
+++ b/gr-fec/grc/fec_extended_tagged_encoder.block.yml
@@ -0,0 +1,37 @@
+id: fec_extended_tagged_encoder
+label: FEC Extended Tagged Encoder
+
+parameters:
+- id: encoder_list
+ label: Encoder Objects
+ dtype: raw
+ default: encoder_variable
+- id: mtu
+ label: MTU (bytes)
+ dtype: int
+ default: '1500'
+- id: puncpat
+ label: Puncture Pattern
+ dtype: string
+ default: '''11'''
+- id: lentagname
+ label: Length Tag Name
+ dtype: string
+ default: None
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import fec
+ make: fec.extended_tagged_encoder(encoder_obj_list=${encoder_list}, puncpat=${puncpat},
+ lentagname=${lentagname}, mtu=${mtu})
+
+documentation: ""
+
+file_format: 1
diff --git a/gr-fec/grc/fec_extended_tagged_encoder.xml b/gr-fec/grc/fec_extended_tagged_encoder.xml
deleted file mode 100644
index 92df08079..000000000
--- a/gr-fec/grc/fec_extended_tagged_encoder.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>FEC Extended Tagged Encoder</name>
- <key>fec_extended_tagged_encoder</key>
- <import>from gnuradio import fec</import>
- <make>fec.extended_tagged_encoder(encoder_obj_list=$encoder_list, puncpat=$puncpat, lentagname=$lentagname, mtu=$mtu)</make>
-
- <param>
- <name>Encoder Objects</name>
- <key>encoder_list</key>
- <value>encoder_variable</value>
- <type>raw</type>
- </param>
-
- <param>
- <name>MTU (bytes)</name>
- <key>mtu</key>
- <value>1500</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Puncture Pattern</name>
- <key>puncpat</key>
- <value>'11'</value>
- <type>string</type>
- </param>
-
- <param>
- <name>Length Tag Name</name>
- <key>lentagname</key>
- <value>None</value>
- <type>string</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-
- <doc>
-
- </doc>
-
-</block>
diff --git a/gr-fec/grc/fec_puncture_xx.block.yml b/gr-fec/grc/fec_puncture_xx.block.yml
new file mode 100644
index 000000000..de7cf16ca
--- /dev/null
+++ b/gr-fec/grc/fec_puncture_xx.block.yml
@@ -0,0 +1,35 @@
+id: fec_puncture_xx
+label: Puncture
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [byte, float]
+ option_attributes:
+ fcn: [bb, ff]
+ hide: part
+- id: puncsize
+ label: Puncture Size
+ dtype: int
+- id: puncpat
+ label: Puncture Pattern
+ dtype: int
+- id: delay
+ label: Delay
+ dtype: int
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import fec
+ make: fec.puncture_${type.fcn}(${puncsize}, ${puncpat}, ${delay})
+
+file_format: 1
diff --git a/gr-fec/grc/fec_puncture_xx.xml b/gr-fec/grc/fec_puncture_xx.xml
deleted file mode 100644
index 1075a1c06..000000000
--- a/gr-fec/grc/fec_puncture_xx.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>Puncture</name>
- <key>fec_puncture_xx</key>
- <import>from gnuradio import fec</import>
- <make>fec.puncture_$(type.fcn)($puncsize, $puncpat, $delay)</make>
-
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:bb</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- </param>
-
- <param>
- <name>Puncture Size</name>
- <key>puncsize</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Puncture Pattern</name>
- <key>puncpat</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Delay</name>
- <key>delay</key>
- <value>0</value>
- <type>int</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-
-</block>
diff --git a/gr-fec/grc/fec_tagged_decoder.block.yml b/gr-fec/grc/fec_tagged_decoder.block.yml
new file mode 100644
index 000000000..7856bb679
--- /dev/null
+++ b/gr-fec/grc/fec_tagged_decoder.block.yml
@@ -0,0 +1,47 @@
+id: fec_tagged_decoder
+label: FEC Tagged Decoder
+
+parameters:
+- id: decoder
+ label: Constituent Decoder
+ dtype: raw
+ default: decoder_variable
+- id: mtu
+ label: MTU (bytes)
+ dtype: int
+ default: '1500'
+- id: itype
+ label: Input Type
+ dtype: enum
+ options: [byte, float]
+ option_attributes:
+ size: [gr.sizeof_char, gr.sizeof_float]
+ hide: part
+- id: otype
+ label: Output Type
+ dtype: enum
+ options: [byte, float]
+ option_attributes:
+ size: [gr.sizeof_char, gr.sizeof_float]
+ hide: part
+- id: lentagname
+ label: Length Tag Name
+ dtype: string
+ default: '"pkt_len"'
+
+inputs:
+- domain: stream
+ dtype: ${ itype }
+
+outputs:
+- domain: stream
+ dtype: ${ otype }
+
+templates:
+ imports: from gnuradio import fec
+ make: fec.tagged_decoder(${decoder}, ${itype.size}, ${otype.size}, ${lentagname},
+ ${mtu})
+
+documentation: ""
+
+file_format: 1
diff --git a/gr-fec/grc/fec_tagged_decoder.xml b/gr-fec/grc/fec_tagged_decoder.xml
deleted file mode 100644
index 1ea20bd08..000000000
--- a/gr-fec/grc/fec_tagged_decoder.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>FEC Tagged Decoder</name>
- <key>fec_tagged_decoder</key>
- <import>from gnuradio import fec</import>
- <make>fec.tagged_decoder($decoder, $itype.size, $otype.size, $lentagname, $mtu)</make>
-
- <param>
- <name>Constituent Decoder</name>
- <key>decoder</key>
- <value>decoder_variable</value>
- <type>raw</type>
- </param>
-
- <param>
- <name>MTU (bytes)</name>
- <key>mtu</key>
- <value>1500</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Input Type</name>
- <key>itype</key>
- <type>enum</type>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- </param>
-
- <param>
- <name>Output Type</name>
- <key>otype</key>
- <type>enum</type>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- </param>
-
- <param>
- <name>Length Tag Name</name>
- <key>lentagname</key>
- <value>"pkt_len"</value>
- <type>string</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>$itype</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>$otype</type>
- </source>
-
- <doc>
- </doc>
-
-</block>
diff --git a/gr-fec/grc/fec_tagged_encoder.block.yml b/gr-fec/grc/fec_tagged_encoder.block.yml
new file mode 100644
index 000000000..bf675e418
--- /dev/null
+++ b/gr-fec/grc/fec_tagged_encoder.block.yml
@@ -0,0 +1,47 @@
+id: fec_tagged_encoder
+label: FEC Tagged Encoder
+
+parameters:
+- id: encoder
+ label: Constituent Encoder
+ dtype: raw
+ default: encoder_variable
+- id: mtu
+ label: MTU (bytes)
+ dtype: int
+ default: '1500'
+- id: itype
+ label: Input Type
+ dtype: enum
+ options: [byte, float]
+ option_attributes:
+ size: [gr.sizeof_char, gr.sizeof_float]
+ hide: part
+- id: otype
+ label: Output Type
+ dtype: enum
+ options: [byte, float]
+ option_attributes:
+ size: [gr.sizeof_char, gr.sizeof_float]
+ hide: part
+- id: lentagname
+ label: Length Tag Name
+ dtype: string
+ default: '"pkt_len"'
+
+inputs:
+- domain: stream
+ dtype: ${ itype }
+
+outputs:
+- domain: stream
+ dtype: ${ otype }
+
+templates:
+ imports: from gnuradio import fec
+ make: fec.tagged_encoder(${encoder}, ${itype.size}, ${otype.size}, ${lentagname},
+ ${mtu})
+
+documentation: ""
+
+file_format: 1
diff --git a/gr-fec/grc/fec_tagged_encoder.xml b/gr-fec/grc/fec_tagged_encoder.xml
deleted file mode 100644
index 30fa20e45..000000000
--- a/gr-fec/grc/fec_tagged_encoder.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>FEC Tagged Encoder</name>
- <key>fec_tagged_encoder</key>
- <import>from gnuradio import fec</import>
- <make>fec.tagged_encoder($encoder, $itype.size, $otype.size, $lentagname, $mtu)</make>
-
- <param>
- <name>Constituent Encoder</name>
- <key>encoder</key>
- <value>encoder_variable</value>
- <type>raw</type>
- </param>
-
- <param>
- <name>MTU (bytes)</name>
- <key>mtu</key>
- <value>1500</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Input Type</name>
- <key>itype</key>
- <type>enum</type>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- </param>
-
- <param>
- <name>Output Type</name>
- <key>otype</key>
- <type>enum</type>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- </param>
-
- <param>
- <name>Length Tag Name</name>
- <key>lentagname</key>
- <value>"pkt_len"</value>
- <type>string</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>$itype</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>$otype</type>
- </source>
-
- <doc>
- </doc>
-
-</block>
diff --git a/gr-fec/grc/ldpc_decoder_def_list.block.yml b/gr-fec/grc/ldpc_decoder_def_list.block.yml
new file mode 100644
index 000000000..8dc32bdc3
--- /dev/null
+++ b/gr-fec/grc/ldpc_decoder_def_list.block.yml
@@ -0,0 +1,53 @@
+id: variable_ldpc_decoder_def
+label: LDPC Decoder Definition
+
+parameters:
+- id: value
+ label: Ignore Me
+ dtype: raw
+ default: '"ok"'
+ hide: all
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ default: '0'
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '4'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '4'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: file
+ label: AList File
+ dtype: file_open
+- id: sigma
+ label: Sigma
+ dtype: float
+ default: '0.5'
+- id: max_iter
+ label: Max Iterations
+ dtype: int
+ default: '50'
+value: ${ value }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "\n% if int(ndim)==0 #:\nself.${id} = ${id} = fec.ldpc_decoder.make(${file},\
+ \ ${sigma}, ${max_iter}); \n% elif int(ndim)==1 #:\nself.${id} = ${id} = map(\
+ \ (lambda a: fec.ldpc_decoder.make(${file}, ${sigma}, ${max_iter})), range(0,${dim1})\
+ \ ); \n% else:\nself.${id} = ${id} = map( (lambda b: map( ( lambda a: fec.ldpc_decoder.make(${file},\
+ \ ${sigma}, ${max_iter})), range(0,${dim2}) ) ), range(0,${dim1})); \n% endif"
+
+documentation: |-
+ This is a soft-decision decoder that uses belief propagation (also known as message passing) that is described at:
+
+ www.cs.toronto.edu/~radford/ftp/LDPC-2012-02-11/decoding.html
+
+ Designed for a memoryless AWGN channel, it assumes a noise variance of the value specified for sigma.
+
+file_format: 1
diff --git a/gr-fec/grc/ldpc_decoder_def_list.xml b/gr-fec/grc/ldpc_decoder_def_list.xml
deleted file mode 100644
index 007f85505..000000000
--- a/gr-fec/grc/ldpc_decoder_def_list.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>LDPC Decoder Definition</name>
- <key>variable_ldpc_decoder_def</key>
- <import>from gnuradio import fec</import>
- <var_make>
-#if int($ndim())==0 #
-self.$(id) = $(id) = fec.ldpc_decoder.make($file, $sigma, $max_iter); #slurp
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map( (lambda a: fec.ldpc_decoder.make($file, $sigma, $max_iter)), range(0,$dim1) ); #slurp
-#else
-self.$(id) = $(id) = map( (lambda b: map( ( lambda a: fec.ldpc_decoder.make($file, $sigma, $max_iter)), range(0,$dim2) ) ), range(0,$dim1)); #slurp
-#end if</var_make>
- <make></make>
-
-<!-- This definition below is wierd, it seems required for the GRC to be happy, im confused -->
- <param>
- <name>Ignore Me</name>
- <key>value</key>
- <value>"ok"</value>
- <type>raw</type>
- <hide>all</hide>
- </param>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value>0</value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>4</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>4</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>AList File</name>
- <key>file</key>
- <type>file_open</type>
- </param>
-
- <param>
- <name>Sigma</name>
- <key>sigma</key>
- <value>0.5</value>
- <type>float</type>
- </param>
-
- <param>
- <name>Max Iterations</name>
- <key>max_iter</key>
- <value>50</value>
- <type>int</type>
- </param>
-
- <doc>
-This is a soft-decision decoder that uses belief propagation (also known as message passing) that is described at:
-
-www.cs.toronto.edu/~radford/ftp/LDPC-2012-02-11/decoding.html
-
-Designed for a memoryless AWGN channel, it assumes a noise variance of the value specified for sigma.
- </doc>
-</block>
diff --git a/gr-fec/grc/ldpc_encoder_def_list.block.yml b/gr-fec/grc/ldpc_encoder_def_list.block.yml
new file mode 100644
index 000000000..cc31e960d
--- /dev/null
+++ b/gr-fec/grc/ldpc_encoder_def_list.block.yml
@@ -0,0 +1,38 @@
+id: variable_ldpc_encoder_def
+label: LDPC Encoder Definition
+
+parameters:
+- id: value
+ label: Ignore Me
+ dtype: raw
+ default: '"ok"'
+ hide: all
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ default: '0'
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '4'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: file
+ label: AList File
+ dtype: file_open
+value: ${ fec.ldpc_encoder_make(file) }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "\n% if int(ndim)==0 #:\nself.${id} = ${id} = fec.ldpc_encoder_make(${file});\
+ \ \n% elif int(ndim)==1 #:\nself.${id} = ${id} = map( (lambda a: fec.ldpc_encoder_make(${file})),\
+ \ range(0,${dim1}) ); \n% else:\nself.${id} = ${id} = map( (lambda b: map(\
+ \ ( lambda a: fec.ldpc_encoder_make(${file})), range(0,${dim2}) ) ), range(0,${dim1}));\
+ \ \n% endif"
+
+file_format: 1
diff --git a/gr-fec/grc/ldpc_encoder_def_list.xml b/gr-fec/grc/ldpc_encoder_def_list.xml
deleted file mode 100755
index 985568afc..000000000
--- a/gr-fec/grc/ldpc_encoder_def_list.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0"?>
-
-<block>
- <name>LDPC Encoder Definition</name>
- <key>variable_ldpc_encoder_def</key>
- <import>from gnuradio import fec</import>
- <var_make>
-#if int($ndim())==0 #
-self.$(id) = $(id) = fec.ldpc_encoder_make($file); #slurp
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map( (lambda a: fec.ldpc_encoder_make($file)), range(0,$dim1) ); #slurp
-#else
-self.$(id) = $(id) = map( (lambda b: map( ( lambda a: fec.ldpc_encoder_make($file)), range(0,$dim2) ) ), range(0,$dim1)); #slurp
-#end if</var_make>
- <var_value>fec.ldpc_encoder_make($file)</var_value>
- <make></make>
-
- <param>
- <name>Ignore Me</name>
- <key>value</key>
- <value>"ok"</value>
- <type>raw</type>
- <hide>all</hide>
- </param>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value>0</value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>4</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>AList File</name>
- <key>file</key>
- <value></value>
- <type>file_open</type>
- </param>
-
-</block>
diff --git a/gr-fec/grc/tpc_decoder_def_list.block.yml b/gr-fec/grc/tpc_decoder_def_list.block.yml
new file mode 100644
index 000000000..94fb55b1b
--- /dev/null
+++ b/gr-fec/grc/tpc_decoder_def_list.block.yml
@@ -0,0 +1,77 @@
+id: variable_tpc_decoder_def
+label: TPC Decoder Definition
+
+parameters:
+- id: value
+ label: Ignore Me
+ dtype: raw
+ default: '"ok"'
+ hide: all
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ default: '0'
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '4'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '4'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: row_poly
+ label: Row Encoder Polynomials
+ dtype: int_vector
+ default: '[3]'
+- id: col_poly
+ label: Column Encoder Polynomials
+ dtype: int_vector
+ default: '[43]'
+- id: krow
+ label: K Row
+ dtype: int
+ default: '26'
+- id: kcol
+ label: K Col
+ dtype: int
+ default: '6'
+- id: bval
+ label: B
+ dtype: int
+ default: '9'
+- id: qval
+ label: Q
+ dtype: int
+ default: '3'
+- id: max_iter
+ label: NUM Turbo Iterations
+ dtype: int
+ default: '6'
+- id: decoder_type
+ label: Decoder Type
+ dtype: enum
+ options: ['0', '1', '2', '3', '4']
+ option_labels: [Linear LOG-MAP, MAX LOG-MAP, Constant LOG-MAP, LOG-MAP (LUT Correction
+ Factor), LOG-MAP (C Correction Factor)]
+value: ${ value }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "\n% if int(ndim)==0 #:\nself.${id} = ${id} = fec.tpc_decoder_make(${row_poly},\
+ \ ${col_poly}, ${krow}, ${kcol}, ${bval}, ${qval}, ${max_iter}, ${decoder_type});\
+ \ \n% elif int(ndim)==1 #:\nself.${id} = ${id} = map( (lambda a: fec.tpc_decoder_make(${row_poly},\
+ \ ${col_poly}, ${krow}, ${kcol}, ${bval}, ${qval}, ${max_iter}, ${decoder_type})),\
+ \ range(0,${dim1}) ); \n% else:\nself.${id} = ${id} = map( (lambda b: map(\
+ \ ( lambda a: fec.tpc_decoder_make(${row_poly}, ${col_poly}, ${krow}, ${kcol},\
+ \ ${bval}, ${qval}, ${max_iter}, ${decoder_type})), range(0,${dim2}) ) ),\
+ \ range(0,${dim1})); \n% endif"
+
+documentation: |-
+ This instantiates a 1-dim array or 2-dim array fo Turbo Product Encoders (TPC).
+ Restrictions: B and Q must be carefully chosen such that when the matrices are setup,
+ and the first B outputs are removed, they (the first B outputs) are all 0's.
+
+file_format: 1
diff --git a/gr-fec/grc/tpc_decoder_def_list.xml b/gr-fec/grc/tpc_decoder_def_list.xml
deleted file mode 100644
index aac08dbb7..000000000
--- a/gr-fec/grc/tpc_decoder_def_list.xml
+++ /dev/null
@@ -1,142 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>TPC Decoder Definition</name>
- <key>variable_tpc_decoder_def</key>
- <import>from gnuradio import fec</import>
- <var_make>
-#if int($ndim())==0 #
-self.$(id) = $(id) = fec.tpc_decoder_make($row_poly, $col_poly, $krow, $kcol, $bval, $qval, $max_iter, $decoder_type); #slurp
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map( (lambda a: fec.tpc_decoder_make($row_poly, $col_poly, $krow, $kcol, $bval, $qval, $max_iter, $decoder_type)), range(0,$dim1) ); #slurp
-#else
-self.$(id) = $(id) = map( (lambda b: map( ( lambda a: fec.tpc_decoder_make($row_poly, $col_poly, $krow, $kcol, $bval, $qval, $max_iter, $decoder_type)), range(0,$dim2) ) ), range(0,$dim1)); #slurp
-#end if</var_make>
- <make></make>
-
-<!-- This definition below is wierd, it seems required for the GRC to be happy, im confused -->
- <param>
- <name>Ignore Me</name>
- <key>value</key>
- <value>"ok"</value>
- <type>raw</type>
- <hide>all</hide>
- </param>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value>0</value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>4</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>4</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Row Encoder Polynomials</name>
- <key>row_poly</key>
- <value>[3]</value>
- <type>int_vector</type>
- </param>
-
- <param>
- <name>Column Encoder Polynomials</name>
- <key>col_poly</key>
- <value>[43]</value>
- <type>int_vector</type>
- </param>
-
- <param>
- <name>K Row</name>
- <key>krow</key>
- <value>26</value>
- <type>int</type>
- </param>
-
- <param>
- <name>K Col</name>
- <key>kcol</key>
- <value>6</value>
- <type>int</type>
- </param>
-
- <param>
- <name>B</name>
- <key>bval</key>
- <value>9</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Q</name>
- <key>qval</key>
- <value>3</value>
- <type>int</type>
- </param>
-
- <param>
- <name>NUM Turbo Iterations</name>
- <key>max_iter</key>
- <value>6</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Decoder Type</name>
- <key>decoder_type</key>
- <value></value>
- <type>enum</type>
- <option>
- <name>Linear LOG-MAP</name>
- <key>0</key>
- </option>
- <option>
- <name>MAX LOG-MAP</name>
- <key>1</key>
- </option>
- <option>
- <name>Constant LOG-MAP</name>
- <key>2</key>
- </option>
- <option>
- <name>LOG-MAP (LUT Correction Factor)</name>
- <key>3</key>
- </option>
- <option>
- <name>LOG-MAP (C Correction Factor)</name>
- <key>4</key>
- </option>
- </param>
-
-
- <doc>
- This instantiates a 1-dim array or 2-dim array fo Turbo Product Encoders (TPC).
- Restrictions: B and Q must be carefully chosen such that when the matrices are setup,
- and the first B outputs are removed, they (the first B outputs) are all 0's.
- </doc>
-</block>
diff --git a/gr-fec/grc/tpc_encoder_def_list.block.yml b/gr-fec/grc/tpc_encoder_def_list.block.yml
new file mode 100644
index 000000000..9e4720775
--- /dev/null
+++ b/gr-fec/grc/tpc_encoder_def_list.block.yml
@@ -0,0 +1,66 @@
+id: variable_tpc_encoder_def
+label: TPC Encoder Definition
+
+parameters:
+- id: value
+ label: Ignore Me
+ dtype: raw
+ default: '"ok"'
+ hide: all
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ default: '0'
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '4'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '4'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: row_poly
+ label: Row Encoder Polynomials
+ dtype: int_vector
+ default: '[3]'
+- id: col_poly
+ label: Column Encoder Polynomials
+ dtype: int_vector
+ default: '[43]'
+- id: krow
+ label: K Row
+ dtype: int
+ default: '26'
+- id: kcol
+ label: K Col
+ dtype: int
+ default: '6'
+- id: bval
+ label: B
+ dtype: int
+ default: '9'
+- id: qval
+ label: Q
+ dtype: int
+ default: '3'
+value: ${ value }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "\n% if int(ndim)==0 #:\nself.${id} = ${id} = fec.tpc_encoder_make(${row_poly},\
+ \ ${col_poly}, ${krow}, ${kcol}, ${bval}, ${qval}); \n% elif int(ndim)==1\
+ \ #:\nself.${id} = ${id} = map( (lambda a: fec.tpc_encoder_make(${row_poly},\
+ \ ${col_poly}, ${krow}, ${kcol}, ${bval}, ${qval})), range(0,${dim1}) ); \n\
+ % else:\nself.${id} = ${id} = map( (lambda b: map( ( lambda a: fec.tpc_encoder_make(${row_poly},\
+ \ ${col_poly}, ${krow}, ${kcol}, ${bval}, ${qval})), range(0,${dim2}) ) ),\
+ \ range(0,${dim1})); \n% endif"
+
+documentation: |-
+ This instantiates a 1-dim array or 2-dim array fo Turbo Product Encoders (TPC).
+ Restrictions: B and Q must be carefully chosen such that when the matrices are setup,
+ and the first B outputs are removed, they (the first B outputs) are all 0's.
+
+file_format: 1
diff --git a/gr-fec/grc/tpc_encoder_def_list.xml b/gr-fec/grc/tpc_encoder_def_list.xml
deleted file mode 100755
index c035795b5..000000000
--- a/gr-fec/grc/tpc_encoder_def_list.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>TPC Encoder Definition</name>
- <key>variable_tpc_encoder_def</key>
- <import>from gnuradio import fec</import>
- <var_make>
-#if int($ndim())==0 #
-self.$(id) = $(id) = fec.tpc_encoder_make($row_poly, $col_poly, $krow, $kcol, $bval, $qval); #slurp
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map( (lambda a: fec.tpc_encoder_make($row_poly, $col_poly, $krow, $kcol, $bval, $qval)), range(0,$dim1) ); #slurp
-#else
-self.$(id) = $(id) = map( (lambda b: map( ( lambda a: fec.tpc_encoder_make($row_poly, $col_poly, $krow, $kcol, $bval, $qval)), range(0,$dim2) ) ), range(0,$dim1)); #slurp
-#end if</var_make>
- <make></make>
-
-<!-- This definition below is wierd, it seems required for the GRC to be happy, im confused -->
- <param>
- <name>Ignore Me</name>
- <key>value</key>
- <value>"ok"</value>
- <type>raw</type>
- <hide>all</hide>
- </param>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value>0</value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>4</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>4</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Row Encoder Polynomials</name>
- <key>row_poly</key>
- <value>[3]</value>
- <type>int_vector</type>
- </param>
-
- <param>
- <name>Column Encoder Polynomials</name>
- <key>col_poly</key>
- <value>[43]</value>
- <type>int_vector</type>
- </param>
-
- <param>
- <name>K Row</name>
- <key>krow</key>
- <value>26</value>
- <type>int</type>
- </param>
-
- <param>
- <name>K Col</name>
- <key>kcol</key>
- <value>6</value>
- <type>int</type>
- </param>
-
- <param>
- <name>B</name>
- <key>bval</key>
- <value>9</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Q</name>
- <key>qval</key>
- <value>3</value>
- <type>int</type>
- </param>
-
- <doc>
- This instantiates a 1-dim array or 2-dim array fo Turbo Product Encoders (TPC).
- Restrictions: B and Q must be carefully chosen such that when the matrices are setup,
- and the first B outputs are removed, they (the first B outputs) are all 0's.
- </doc>
-</block>
diff --git a/gr-fec/grc/variable_cc_decoder_def_list.block.yml b/gr-fec/grc/variable_cc_decoder_def_list.block.yml
new file mode 100644
index 000000000..0dd4aa86b
--- /dev/null
+++ b/gr-fec/grc/variable_cc_decoder_def_list.block.yml
@@ -0,0 +1,76 @@
+id: variable_cc_decoder_def
+label: CC Decoder Definition
+
+parameters:
+- id: value
+ label: Ignore Me
+ dtype: raw
+ default: '"ok"'
+ hide: all
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ default: '0'
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: framebits
+ label: Frame Bits
+ dtype: int
+ default: '2048'
+- id: k
+ label: Constraint Length (K)
+ dtype: int
+ default: '7'
+- id: rate
+ label: Rate Inverse (1/R) (1/2) --> 2
+ dtype: int
+ default: '2'
+- id: polys
+ label: Polynomials
+ dtype: int_vector
+ default: '[79,109]'
+- id: state_start
+ label: Start State
+ dtype: int
+ default: '0'
+- id: state_end
+ label: End State
+ dtype: int
+ default: '-1'
+- id: mode
+ label: Streaming Behavior
+ dtype: enum
+ options: [fec.CC_STREAMING, fec.CC_TERMINATED, fec.CC_TAILBITING, fec.CC_TRUNCATED]
+ option_labels: [Streaming, Terminated, Tailbiting, Truncated]
+- id: padding
+ label: Byte Padding
+ dtype: enum
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['No', 'Yes']
+value: ${ fec.cc_decoder.make(framebits, k, rate, polys, state_start, state_end, mode,
+ padding) }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "\n% if int(ndim)==0 #:\nself.${id} = ${id} = fec.cc_decoder.make(${framebits},\
+ \ ${k}, ${rate}, ${polys}, ${state_start}, ${state_end}, ${mode}, ${padding})\n\
+ % elif int(ndim)==1 #:\nself.${id} = ${id} = map( (lambda a: fec.cc_decoder.make(${framebits},\
+ \ ${k}, ${rate}, ${polys}, ${state_start}, ${state_end}, ${mode}, ${padding})),\
+ \ range(0,${dim1}) ); \n% else:\nself.${id} = ${id} = map( (lambda b: map(\
+ \ ( lambda a: fec.cc_decoder.make(${framebits}, ${k}, ${rate}, ${polys}, ${state_start},\
+ \ ${state_end}, ${mode}, ${padding})), range(0,${dim2}) ) ), range(0,${dim1}));\
+ \ \n% endif\n "
+
+documentation: ""
+
+file_format: 1
diff --git a/gr-fec/grc/variable_cc_decoder_def_list.xml b/gr-fec/grc/variable_cc_decoder_def_list.xml
deleted file mode 100644
index daa7c73ef..000000000
--- a/gr-fec/grc/variable_cc_decoder_def_list.xml
+++ /dev/null
@@ -1,148 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-# FEC CC DECODER
-###################################################
- -->
-<block>
- <name>CC Decoder Definition</name>
- <key>variable_cc_decoder_def</key>
- <import>from gnuradio import fec</import>
- <var_make>
-#if int($ndim())==0 #
-self.$(id) = $(id) = fec.cc_decoder.make($framebits, $k, $rate, $polys, $state_start, $state_end, $mode, $padding)
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map( (lambda a: fec.cc_decoder.make($framebits, $k, $rate, $polys, $state_start, $state_end, $mode, $padding)), range(0,$dim1) ); #slurp
-#else
-self.$(id) = $(id) = map( (lambda b: map( ( lambda a: fec.cc_decoder.make($framebits, $k, $rate, $polys, $state_start, $state_end, $mode, $padding)), range(0,$dim2) ) ), range(0,$dim1)); #slurp
-#end if
- </var_make>
- <var_value>fec.cc_decoder.make($framebits, $k, $rate, $polys, $state_start, $state_end, $mode, $padding)</var_value>
- <make></make>
-
- <param>
- <name>Ignore Me</name>
- <key>value</key>
- <value>"ok"</value>
- <type>raw</type>
- <hide>all</hide>
- </param>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value>0</value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Frame Bits</name>
- <key>framebits</key>
- <value>2048</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Constraint Length (K)</name>
- <key>k</key>
- <value>7</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Rate Inverse (1/R) (1/2) --> 2</name>
- <key>rate</key>
- <value>2</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Polynomials</name>
- <key>polys</key>
- <value>[79,109]</value>
- <type>int_vector</type>
- </param>
-
- <param>
- <name>Start State</name>
- <key>state_start</key>
- <value>0</value>
- <type>int</type>
- </param>
-
- <param>
- <name>End State</name>
- <key>state_end</key>
- <value>-1</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Streaming Behavior</name>
- <key>mode</key>
- <value></value>
- <type>enum</type>
- <option>
- <name>Streaming</name>
- <key>fec.CC_STREAMING</key>
- </option>
- <option>
- <name>Terminated</name>
- <key>fec.CC_TERMINATED</key>
- </option>
- <option>
- <name>Tailbiting</name>
- <key>fec.CC_TAILBITING</key>
- </option>
- <option>
- <name>Truncated</name>
- <key>fec.CC_TRUNCATED</key>
- </option>
- </param>
-
- <param>
- <name>Byte Padding</name>
- <key>padding</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- </param>
-
- <doc>
- </doc>
-</block>
diff --git a/gr-fec/grc/variable_cc_encoder_def_list.block.yml b/gr-fec/grc/variable_cc_encoder_def_list.block.yml
new file mode 100644
index 000000000..43f330a61
--- /dev/null
+++ b/gr-fec/grc/variable_cc_encoder_def_list.block.yml
@@ -0,0 +1,66 @@
+id: variable_cc_encoder_def
+label: CC Encoder Definition
+
+parameters:
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ default: '0'
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: framebits
+ label: Frame Bits
+ dtype: int
+ default: '2048'
+- id: k
+ label: Constraint Length (K)
+ dtype: int
+ default: '7'
+- id: rate
+ label: Rate Inverse (1/R) (1/2) --> 2
+ dtype: int
+ default: '2'
+- id: polys
+ label: Polynomials
+ dtype: int_vector
+ default: '[79,109]'
+- id: state_start
+ label: Start State
+ dtype: int
+ default: '0'
+- id: mode
+ label: Streaming Behavior
+ dtype: enum
+ options: [fec.CC_STREAMING, fec.CC_TERMINATED, fec.CC_TAILBITING, fec.CC_TRUNCATED]
+ option_labels: [Streaming, Terminated, Tailbiting, Truncated]
+- id: padding
+ label: Byte Padding
+ dtype: enum
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['No', 'Yes']
+value: ${ fec.cc_encoder_make(framebits, k, rate, polys, state_start, mode, padding)
+ }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "\n% if int(ndim)==0 #:\nself.${id} = ${id} = fec.cc_encoder_make(${framebits},\
+ \ ${k}, ${rate}, ${polys}, ${state_start}, ${mode}, ${padding})\n% elif int(ndim)==1\
+ \ #:\nself.${id} = ${id} = map( (lambda a: fec.cc_encoder_make(${framebits},\
+ \ ${k}, ${rate}, ${polys}, ${state_start}, ${mode}, ${padding})), range(0,${dim1})\
+ \ ); \n% else:\nself.${id} = ${id} = map( (lambda b: map( ( lambda a: fec.cc_encoder_make(${framebits},\
+ \ ${k}, ${rate}, ${polys}, ${state_start}, ${mode}, ${padding})), range(0,${dim2})\
+ \ ) ), range(0,${dim1})); \n% endif\n "
+
+documentation: ""
+
+file_format: 1
diff --git a/gr-fec/grc/variable_cc_encoder_def_list.xml b/gr-fec/grc/variable_cc_encoder_def_list.xml
deleted file mode 100644
index 92965204d..000000000
--- a/gr-fec/grc/variable_cc_encoder_def_list.xml
+++ /dev/null
@@ -1,133 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-# FEC MAKING FOR GREAT JUSTICE
-###################################################
- -->
-<block>
- <name>CC Encoder Definition</name>
- <key>variable_cc_encoder_def</key>
- <import>from gnuradio import fec</import>
- <var_make>
-#if int($ndim())==0 #
-self.$(id) = $(id) = fec.cc_encoder_make($framebits, $k, $rate, $polys, $state_start, $mode, $padding)
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map( (lambda a: fec.cc_encoder_make($framebits, $k, $rate, $polys, $state_start, $mode, $padding)), range(0,$dim1) ); #slurp
-#else
-self.$(id) = $(id) = map( (lambda b: map( ( lambda a: fec.cc_encoder_make($framebits, $k, $rate, $polys, $state_start, $mode, $padding)), range(0,$dim2) ) ), range(0,$dim1)); #slurp
-#end if
- </var_make>
- <var_value>fec.cc_encoder_make($framebits, $k, $rate, $polys, $state_start, $mode, $padding)</var_value>
- <make></make>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value>0</value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Frame Bits</name>
- <key>framebits</key>
- <value>2048</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Constraint Length (K)</name>
- <key>k</key>
- <value>7</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Rate Inverse (1/R) (1/2) --> 2</name>
- <key>rate</key>
- <value>2</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Polynomials</name>
- <key>polys</key>
- <value>[79,109]</value>
- <type>int_vector</type>
- </param>
-
- <param>
- <name>Start State</name>
- <key>state_start</key>
- <value>0</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Streaming Behavior</name>
- <key>mode</key>
- <value></value>
- <type>enum</type>
- <option>
- <name>Streaming</name>
- <key>fec.CC_STREAMING</key>
- </option>
- <option>
- <name>Terminated</name>
- <key>fec.CC_TERMINATED</key>
- </option>
- <option>
- <name>Tailbiting</name>
- <key>fec.CC_TAILBITING</key>
- </option>
- <option>
- <name>Truncated</name>
- <key>fec.CC_TRUNCATED</key>
- </option>
- </param>
-
- <param>
- <name>Byte Padding</name>
- <key>padding</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- </param>
-
- <doc>
- </doc>
-</block>
diff --git a/gr-fec/grc/variable_ccsds_encoder_def_list.block.yml b/gr-fec/grc/variable_ccsds_encoder_def_list.block.yml
new file mode 100644
index 000000000..7a412dde9
--- /dev/null
+++ b/gr-fec/grc/variable_ccsds_encoder_def_list.block.yml
@@ -0,0 +1,46 @@
+id: variable_ccsds_encoder_def
+label: CCSDS Encoder Definition
+
+parameters:
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ default: '0'
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: framebits
+ label: Frame Bits
+ dtype: int
+ default: '2048'
+- id: state_start
+ label: Start State
+ dtype: int
+ default: '0'
+- id: mode
+ label: Streaming Behavior
+ dtype: enum
+ options: [fec.CC_STREAMING, fec.CC_TERMINATED, fec.CC_TAILBITING, fec.CC_TRUNCATED]
+ option_labels: [Streaming, Terminated, Tailbiting, Truncated]
+value: ${ fec.ccsds_encoder_make(framebits, state_start, mode) }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "\n% if int(ndim)==0 #:\nself.${id} = ${id} = fec.ccsds_encoder_make(${framebits},\
+ \ ${state_start}, ${mode})\n% elif int(ndim)==1 #:\nself.${id} = ${id} = map(\
+ \ (lambda a: fec.ccsds_encoder_make(${framebits}, ${state_start}, ${mode})),\
+ \ range(0,${dim1}) ); \n% else:\nself.${id} = ${id} = map( (lambda b: map(\
+ \ ( lambda a: fec.ccsds_encoder_make(${framebits}, ${state_start}, ${mode})),\
+ \ range(0,${dim2}) ) ), range(0,${dim1})); \n% endif\n "
+
+documentation: ""
+
+file_format: 1
diff --git a/gr-fec/grc/variable_ccsds_encoder_def_list.xml b/gr-fec/grc/variable_ccsds_encoder_def_list.xml
deleted file mode 100644
index d925fd1a7..000000000
--- a/gr-fec/grc/variable_ccsds_encoder_def_list.xml
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-# FEC MAKING FOR GREAT JUSTICE
-###################################################
- -->
-<block>
- <name>CCSDS Encoder Definition</name>
- <key>variable_ccsds_encoder_def</key>
- <import>from gnuradio import fec</import>
- <var_make>
-#if int($ndim())==0 #
-self.$(id) = $(id) = fec.ccsds_encoder_make($framebits, $state_start, $mode)
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map( (lambda a: fec.ccsds_encoder_make($framebits, $state_start, $mode)), range(0,$dim1) ); #slurp
-#else
-self.$(id) = $(id) = map( (lambda b: map( ( lambda a: fec.ccsds_encoder_make($framebits, $state_start, $mode)), range(0,$dim2) ) ), range(0,$dim1)); #slurp
-#end if
- </var_make>
- <var_value>fec.ccsds_encoder_make($framebits, $state_start, $mode)</var_value>
- <make></make>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value>0</value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Frame Bits</name>
- <key>framebits</key>
- <value>2048</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Start State</name>
- <key>state_start</key>
- <value>0</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Streaming Behavior</name>
- <key>mode</key>
- <value></value>
- <type>enum</type>
- <option>
- <name>Streaming</name>
- <key>fec.CC_STREAMING</key>
- </option>
- <option>
- <name>Terminated</name>
- <key>fec.CC_TERMINATED</key>
- </option>
- <option>
- <name>Tailbiting</name>
- <key>fec.CC_TAILBITING</key>
- </option>
- <option>
- <name>Truncated</name>
- <key>fec.CC_TRUNCATED</key>
- </option>
- </param>
-
- <doc>
- </doc>
-</block>
diff --git a/gr-fec/grc/variable_dummy_decoder_def_list.block.yml b/gr-fec/grc/variable_dummy_decoder_def_list.block.yml
new file mode 100644
index 000000000..14d0ff42d
--- /dev/null
+++ b/gr-fec/grc/variable_dummy_decoder_def_list.block.yml
@@ -0,0 +1,40 @@
+id: variable_dummy_decoder_def
+label: Dummy Decoder Definition
+
+parameters:
+- id: value
+ label: Ignore Me
+ dtype: raw
+ default: '"ok"'
+ hide: all
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: framebits
+ label: Frame Bits
+ dtype: int
+ default: '2048'
+value: ${ fec.dummy_decoder.make(framebits) }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "\n% if int(ndim)==0 #:\nself.${id} = ${id} = fec.dummy_decoder.make(${framebits})\n\
+ % elif int(ndim)==1 #:\nself.${id} = ${id} = map((lambda a: fec.dummy_decoder.make(${framebits})),\
+ \ range(0,${dim1})) \n% else:\nself.${id} = ${id} = map((lambda b: map((lambda\
+ \ a: fec.dummy_decoder.make(${framebits})), range(0,${dim2}))), range(0,${dim1}))\
+ \ \n% endif\n "
+
+documentation: ""
+
+file_format: 1
diff --git a/gr-fec/grc/variable_dummy_decoder_def_list.xml b/gr-fec/grc/variable_dummy_decoder_def_list.xml
deleted file mode 100644
index 4a27971c8..000000000
--- a/gr-fec/grc/variable_dummy_decoder_def_list.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-# FEC DUMMY DECODER
-###################################################
- -->
-<block>
- <name>Dummy Decoder Definition</name>
- <key>variable_dummy_decoder_def</key>
- <import>from gnuradio import fec</import>
- <var_make>
-#if int($ndim())==0 #
-self.$(id) = $(id) = fec.dummy_decoder.make($framebits)
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map((lambda a: fec.dummy_decoder.make($framebits)), range(0,$dim1)) #slurp
-#else
-self.$(id) = $(id) = map((lambda b: map((lambda a: fec.dummy_decoder.make($framebits)), range(0,$dim2))), range(0,$dim1)) #slurp
-#end if
- </var_make>
- <var_value>fec.dummy_decoder.make($framebits)</var_value>
- <make></make>
-
- <param>
- <name>Ignore Me</name>
- <key>value</key>
- <value>"ok"</value>
- <type>raw</type>
- <hide>all</hide>
- </param>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value></value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Frame Bits</name>
- <key>framebits</key>
- <value>2048</value>
- <type>int</type>
- </param>
-
- <doc>
- </doc>
-</block>
diff --git a/gr-fec/grc/variable_dummy_encoder_def_list.block.yml b/gr-fec/grc/variable_dummy_encoder_def_list.block.yml
new file mode 100644
index 000000000..cb9181bcd
--- /dev/null
+++ b/gr-fec/grc/variable_dummy_encoder_def_list.block.yml
@@ -0,0 +1,36 @@
+id: variable_dummy_encoder_def
+label: Dummy Encoder Definition
+
+parameters:
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ default: '0'
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: framebits
+ label: Frame Bits
+ dtype: int
+ default: '2048'
+value: ${ fec.dummy_encoder_make(framebits) }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "\n% if int(ndim)==0 #:\nself.${id} = ${id} = fec.dummy_encoder_make(${framebits})\n\
+ % elif int(ndim)==1 #:\nself.${id} = ${id} = map((lambda a: fec.dummy_encoder_make(${framebits})),\
+ \ range(0,${dim1})) \n% else:\nself.${id} = ${id} = map((lambda b: map((lambda\
+ \ a: fec.dummy_encoder_make(${framebits})), range(0,${dim2}))), range(0,${dim1}))\
+ \ \n% endif\n "
+
+documentation: ""
+
+file_format: 1
diff --git a/gr-fec/grc/variable_dummy_encoder_def_list.xml b/gr-fec/grc/variable_dummy_encoder_def_list.xml
deleted file mode 100644
index 351fddada..000000000
--- a/gr-fec/grc/variable_dummy_encoder_def_list.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-# FEC DUMMY ENCODER
-###################################################
- -->
-<block>
- <name>Dummy Encoder Definition</name>
- <key>variable_dummy_encoder_def</key>
- <import>from gnuradio import fec</import>
- <var_make>
-#if int($ndim())==0 #
-self.$(id) = $(id) = fec.dummy_encoder_make($framebits)
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map((lambda a: fec.dummy_encoder_make($framebits)), range(0,$dim1)) #slurp
-#else
-self.$(id) = $(id) = map((lambda b: map((lambda a: fec.dummy_encoder_make($framebits)), range(0,$dim2))), range(0,$dim1)) #slurp
-#end if
- </var_make>
- <var_value>fec.dummy_encoder_make($framebits)</var_value>
- <make></make>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value>0</value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Frame Bits</name>
- <key>framebits</key>
- <value>2048</value>
- <type>int</type>
- </param>
-
- <doc>
- </doc>
-</block>
diff --git a/gr-fec/grc/variable_ldpc_G_matrix_object.block.yml b/gr-fec/grc/variable_ldpc_G_matrix_object.block.yml
new file mode 100644
index 000000000..24f0cb3cb
--- /dev/null
+++ b/gr-fec/grc/variable_ldpc_G_matrix_object.block.yml
@@ -0,0 +1,31 @@
+id: variable_ldpc_G_matrix_def
+label: LDPC Generator Matrix
+
+parameters:
+- id: value
+ label: Ignore Me
+ dtype: raw
+ default: '"ok"'
+ hide: all
+- id: filename
+ label: File
+ dtype: file_open
+value: ${ value }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: self.${id} = ${id} = fec.ldpc_G_matrix(${filename})
+
+documentation: |-
+ This block creates a LDPC Generator Matrix variable.
+
+ This variable can be used by:
+ 1) LDPC Encoder Definition (via Generator) block
+ 2) LDPC Bit Flip Decoder Definition block
+
+ Provide an alist file, which contains a Generator matrix, G, in the standard format G = [I P], where I is an identity matrix and P is the parity submatrix.
+
+ The format of alist files is described at:
+ http://www.inference.phy.cam.ac.uk/mackay/codes/alist.html
+
+file_format: 1
diff --git a/gr-fec/grc/variable_ldpc_G_matrix_object.xml b/gr-fec/grc/variable_ldpc_G_matrix_object.xml
deleted file mode 100644
index cd9360c7f..000000000
--- a/gr-fec/grc/variable_ldpc_G_matrix_object.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-# FEC LDPC MATRIX OBJECT
-###################################################
- -->
-
-<block>
- <name>LDPC Generator Matrix</name>
- <key>variable_ldpc_G_matrix_def</key>
- <import>from gnuradio import fec</import>
- <var_make>self.$(id) = $(id) = fec.ldpc_G_matrix($filename)</var_make>
-
- <make></make>
-
- <param>
- <name>Ignore Me</name>
- <key>value</key>
- <value>"ok"</value>
- <type>raw</type>
- <hide>all</hide>
- </param>
-
- <param>
- <name>File</name>
- <key>filename</key>
- <value></value>
- <type>file_open</type>
- </param>
-
- <doc>
-This block creates a LDPC Generator Matrix variable.
-
-This variable can be used by:
- 1) LDPC Encoder Definition (via Generator) block
- 2) LDPC Bit Flip Decoder Definition block
-
-Provide an alist file, which contains a Generator matrix, G, in the standard format G = [I P], where I is an identity matrix and P is the parity submatrix.
-
-The format of alist files is described at:
-http://www.inference.phy.cam.ac.uk/mackay/codes/alist.html
- </doc>
-</block>
diff --git a/gr-fec/grc/variable_ldpc_H_matrix_object.block.yml b/gr-fec/grc/variable_ldpc_H_matrix_object.block.yml
new file mode 100644
index 000000000..f2d1a640b
--- /dev/null
+++ b/gr-fec/grc/variable_ldpc_H_matrix_object.block.yml
@@ -0,0 +1,40 @@
+id: variable_ldpc_H_matrix_def
+label: LDPC Parity Check Matrix
+
+parameters:
+- id: value
+ label: Ignore Me
+ dtype: raw
+ default: '"ok"'
+ hide: all
+- id: filename
+ label: File
+ dtype: file_open
+- id: gap
+ label: Gap
+ dtype: int
+value: ${ value }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: self.${id} = ${id} = fec.ldpc_H_matrix(${filename}, ${gap})
+
+documentation: |-
+ This block creates a FEC LDPC Parity Check Matrix variable.
+
+ This variable can be used by:
+ 1) LDPC Encoder Definition (via Parity Check) block
+ 2) LDPC Bit Flip Decoder Definition block
+
+ The format of alist files is described at:
+ http://www.inference.phy.cam.ac.uk/mackay/codes/alist.html
+
+ The specific format of this parity check matrix is described by Richardson and Urbanke in Appendix A of their book: Modern Coding Theory (ISBN 978-0-521-85229-6).
+
+ As an example, see the file {$target}/share/gnuradio/fec/ldpc/n_1800_k_0902_gap_28.alist, which is used by the FEC example flowgraph ber_curve_gen_ldpc.grc.
+
+ There is a small library of encoding-ready alist files at {$target}/share/gnuradio/fec/ldpc.
+
+ To convert a parity check matrix to the appropriate format required for this encoder, use the python functions in {$target}/lib/python2.7/dist-packages/gnuradio/fec/LDPC/Generate_LDPC_matrix.py.
+
+file_format: 1
diff --git a/gr-fec/grc/variable_ldpc_H_matrix_object.xml b/gr-fec/grc/variable_ldpc_H_matrix_object.xml
deleted file mode 100644
index 1bfb6be06..000000000
--- a/gr-fec/grc/variable_ldpc_H_matrix_object.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-# FEC LDPC PARITY CHECK MATRIX OBJECT
-###################################################
- -->
-<block>
- <name>LDPC Parity Check Matrix</name>
- <key>variable_ldpc_H_matrix_def</key>
- <import>from gnuradio import fec</import>
- <var_make>self.$(id) = $(id) = fec.ldpc_H_matrix($filename, $gap)</var_make>
-
- <make></make>
-
- <param>
- <name>Ignore Me</name>
- <key>value</key>
- <value>"ok"</value>
- <type>raw</type>
- <hide>all</hide>
- </param>
-
- <param>
- <name>File</name>
- <key>filename</key>
- <value></value>
- <type>file_open</type>
- </param>
-
- <param>
- <name>Gap</name>
- <key>gap</key>
- <value></value>
- <type>int</type>
- </param>
-
- <doc>
-This block creates a FEC LDPC Parity Check Matrix variable.
-
-This variable can be used by:
- 1) LDPC Encoder Definition (via Parity Check) block
- 2) LDPC Bit Flip Decoder Definition block
-
-The format of alist files is described at:
-http://www.inference.phy.cam.ac.uk/mackay/codes/alist.html
-
-The specific format of this parity check matrix is described by Richardson and Urbanke in Appendix A of their book: Modern Coding Theory (ISBN 978-0-521-85229-6).
-
-As an example, see the file {$target}/share/gnuradio/fec/ldpc/n_1800_k_0902_gap_28.alist, which is used by the FEC example flowgraph ber_curve_gen_ldpc.grc.
-
-There is a small library of encoding-ready alist files at {$target}/share/gnuradio/fec/ldpc.
-
-To convert a parity check matrix to the appropriate format required for this encoder, use the python functions in {$target}/lib/python2.7/dist-packages/gnuradio/fec/LDPC/Generate_LDPC_matrix.py.
- </doc>
-</block>
diff --git a/gr-fec/grc/variable_ldpc_bit_flip_decoder.block.yml b/gr-fec/grc/variable_ldpc_bit_flip_decoder.block.yml
new file mode 100644
index 000000000..4f66f0730
--- /dev/null
+++ b/gr-fec/grc/variable_ldpc_bit_flip_decoder.block.yml
@@ -0,0 +1,51 @@
+id: variable_ldpc_bit_flip_decoder_def
+label: LDPC Bit Flip Decoder Definition
+
+parameters:
+- id: value
+ label: Ignore Me
+ dtype: raw
+ default: '"ok"'
+ hide: all
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: max_iterations
+ label: Max Iterations
+ dtype: int
+ default: '100'
+- id: matrix_object
+ label: LDPC FEC Matrix ID
+ dtype: raw
+value: ${ value }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "\n% if int(ndim)==0 #:\nself.${id} = ${id} = fec.ldpc_bit_flip_decoder.make(${matrix_object}.get_base_sptr(),\
+ \ ${max_iterations})\n% elif int(ndim)==1 #:\nself.${id} = ${id} = map((lambda\
+ \ a: fec.ldpc_bit_flip_decoder.make(${matrix_object}.get_base_sptr(), ${max_iterations})),\
+ \ range(0,${dim1})) \n% else:\nself.${id} = ${id} = map((lambda b: map((lambda\
+ \ a: fec.ldpc_bit_flip_decoder.make(${matrix_object}.get_base_sptr(), ${max_iterations})),\
+ \ range(0,${dim2}))), range(0,${dim1})) \n% endif"
+
+documentation: |-
+ This block creates a LDPC Bit Flip Decoder Definition variable.
+
+ The decoder requires knowledge of the matrix used to create (encode) the codewords. In the LDPC FEC Matrix ID field, input the ID of either a:
+ 1) LDPC Generator Matrix variable, or
+ 2) LDPC Parity Check Matrix variable
+
+ Max iterations may be increased from 100 for possibly better performance, but significantly higher number of iterations may slow things down.
+
+file_format: 1
diff --git a/gr-fec/grc/variable_ldpc_bit_flip_decoder.xml b/gr-fec/grc/variable_ldpc_bit_flip_decoder.xml
deleted file mode 100644
index d905ce27f..000000000
--- a/gr-fec/grc/variable_ldpc_bit_flip_decoder.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-# FEC LDPC BIT FLIP DECODER
-###################################################
- -->
-<block>
- <name>LDPC Bit Flip Decoder Definition</name>
- <key>variable_ldpc_bit_flip_decoder_def</key>
- <import>from gnuradio import fec</import>
- <var_make>
-#if int($ndim())==0 #
-self.$(id) = $(id) = fec.ldpc_bit_flip_decoder.make(${matrix_object}.get_base_sptr(), $max_iterations)
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map((lambda a: fec.ldpc_bit_flip_decoder.make(${matrix_object}.get_base_sptr(), $max_iterations)), range(0,$dim1)) #slurp
-#else
-self.$(id) = $(id) = map((lambda b: map((lambda a: fec.ldpc_bit_flip_decoder.make(${matrix_object}.get_base_sptr(), $max_iterations)), range(0,$dim2))), range(0,$dim1)) #slurp
-#end if</var_make>
- <make></make>
-
- <param>
- <name>Ignore Me</name>
- <key>value</key>
- <value>"ok"</value>
- <type>raw</type>
- <hide>all</hide>
- </param>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value></value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Max Iterations</name>
- <key>max_iterations</key>
- <value>100</value>
- <type>int</type>
- </param>
-
- <param>
- <name>LDPC FEC Matrix ID</name>
- <key>matrix_object</key>
- <type>raw</type>
- </param>
-
- <doc>
-This block creates a LDPC Bit Flip Decoder Definition variable.
-
-The decoder requires knowledge of the matrix used to create (encode) the codewords. In the LDPC FEC Matrix ID field, input the ID of either a:
- 1) LDPC Generator Matrix variable, or
- 2) LDPC Parity Check Matrix variable
-
-Max iterations may be increased from 100 for possibly better performance, but significantly higher number of iterations may slow things down.
- </doc>
-</block>
diff --git a/gr-fec/grc/variable_ldpc_encoder_G.block.yml b/gr-fec/grc/variable_ldpc_encoder_G.block.yml
new file mode 100644
index 000000000..f35f47370
--- /dev/null
+++ b/gr-fec/grc/variable_ldpc_encoder_G.block.yml
@@ -0,0 +1,42 @@
+id: variable_ldpc_encoder_G_def
+label: LDPC Encoder Definition (via Generator)
+
+parameters:
+- id: value
+ label: Ignore Me
+ dtype: raw
+ default: '"ok"'
+ hide: all
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: G
+ label: LDPC Generator Matrix
+ dtype: raw
+value: ${ value }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "\n% if int(ndim)==0 #:\nself.${id} = ${id} = fec.ldpc_gen_mtrx_encoder_make(${G})\n\
+ % elif int(ndim)==1 #:\nself.${id} = ${id} = map((lambda a: fec.ldpc_gen_mtrx_encoder_make(${G})),\
+ \ range(0,${dim1})) \n% else:\nself.${id} = ${id} = map((lambda b: map((lambda\
+ \ a: fec.ldpc_gen_mtrx_encoder_make(${G})), range(0,${dim2}))), range(0,${dim1}))\
+ \ \n% endif"
+
+documentation: |-
+ Given a generator matrix in systematic form, G = [I|P], where I is the identity matrix and P is the parity submatrix, the information word s is encoded into a codeword x via:
+
+ x = G'*s
+
+file_format: 1
diff --git a/gr-fec/grc/variable_ldpc_encoder_G.xml b/gr-fec/grc/variable_ldpc_encoder_G.xml
deleted file mode 100644
index 3b4dbeee2..000000000
--- a/gr-fec/grc/variable_ldpc_encoder_G.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-# FEC LDPC ENCODER DEFINITION (VIA GENERATOR)
-###################################################
- -->
-
-<block>
- <name>LDPC Encoder Definition (via Generator)</name>
- <key>variable_ldpc_encoder_G_def</key>
- <import>from gnuradio import fec</import>
- <var_make>
-#if int($ndim())==0 #
-self.$(id) = $(id) = fec.ldpc_gen_mtrx_encoder_make($G)
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map((lambda a: fec.ldpc_gen_mtrx_encoder_make($G)), range(0,$dim1)) #slurp
-#else
-self.$(id) = $(id) = map((lambda b: map((lambda a: fec.ldpc_gen_mtrx_encoder_make($G)), range(0,$dim2))), range(0,$dim1)) #slurp
-#end if</var_make>
- <make></make>
-
- <param>
- <name>Ignore Me</name>
- <key>value</key>
- <value>"ok"</value>
- <type>raw</type>
- <hide>all</hide>
- </param>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value></value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>LDPC Generator Matrix</name>
- <key>G</key>
- <value></value>
- <type>raw</type>
- </param>
-
- <doc>
-Given a generator matrix in systematic form, G = [I|P], where I is the identity matrix and P is the parity submatrix, the information word s is encoded into a codeword x via:
-
-x = G'*s
- </doc>
-</block>
diff --git a/gr-fec/grc/variable_ldpc_encoder_H.block.yml b/gr-fec/grc/variable_ldpc_encoder_H.block.yml
new file mode 100644
index 000000000..3fba6c7db
--- /dev/null
+++ b/gr-fec/grc/variable_ldpc_encoder_H.block.yml
@@ -0,0 +1,42 @@
+id: variable_ldpc_encoder_H_def
+label: LDPC Encoder Definition (via Parity Check)
+
+parameters:
+- id: value
+ label: Ignore Me
+ dtype: raw
+ default: '"ok"'
+ hide: all
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: H
+ label: Parity Check Matrix
+ dtype: raw
+value: ${ value }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "\n% if int(ndim)==0 #:\nself.${id} = ${id} = fec.ldpc_par_mtrx_encoder_make_H(${H})\n\
+ % elif int(ndim)==1 #:\nself.${id} = ${id} = map((lambda a: fec.ldpc_par_mtrx_encoder_make_H(${H})),\
+ \ range(0,${dim1})) \n% else:\nself.${id} = ${id} = map((lambda b: map((lambda\
+ \ a: fec.ldpc_par_mtrx_encoder_make_H(${H})), range(0,${dim2}))), range(0,${dim1}))\
+ \ \n% endif"
+
+documentation: |-
+ This block creates a LDPC Encoder Definition variable.
+
+ This encoder performs a reduced complexity algorithm described by Richardson and Urbanke in Appendix A of their book: Modern Coding Theory. Compared to the block "LDPC Encoder Definition (via Generator)," this encoder requires orders of magnitude fewer operations to create each codeword. This is accomplished by completing a significant amount of the complex matrix manipulation (including inverse, multiplication, and Gaussian elimination operations) during preprocessing. The disadvantage of this encoder is that it requires a specially formatted matrix. However, GNU Radio includes python scripts to format a standard parity check matrix appropriately for this encoder, as well as a small library of encoding-ready matrices for use.
+
+file_format: 1
diff --git a/gr-fec/grc/variable_ldpc_encoder_H.xml b/gr-fec/grc/variable_ldpc_encoder_H.xml
deleted file mode 100644
index 555891b09..000000000
--- a/gr-fec/grc/variable_ldpc_encoder_H.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-# FEC LDPC ENCODER DEFINITION (PARITY CHECK)
-###################################################
- -->
-<block>
- <name>LDPC Encoder Definition (via Parity Check)</name>
- <key>variable_ldpc_encoder_H_def</key>
- <import>from gnuradio import fec</import>
- <var_make>
-#if int($ndim())==0 #
-self.$(id) = $(id) = fec.ldpc_par_mtrx_encoder_make_H($H)
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map((lambda a: fec.ldpc_par_mtrx_encoder_make_H($H)), range(0,$dim1)) #slurp
-#else
-self.$(id) = $(id) = map((lambda b: map((lambda a: fec.ldpc_par_mtrx_encoder_make_H($H)), range(0,$dim2))), range(0,$dim1)) #slurp
-#end if</var_make>
- <make></make>
-
- <param>
- <name>Ignore Me</name>
- <key>value</key>
- <value>"ok"</value>
- <type>raw</type>
- <hide>all</hide>
- </param>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value></value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Parity Check Matrix</name>
- <key>H</key>
- <value></value>
- <type>raw</type>
- </param>
- <doc>
-This block creates a LDPC Encoder Definition variable.
-
-This encoder performs a reduced complexity algorithm described by Richardson and Urbanke in Appendix A of their book: Modern Coding Theory. Compared to the block "LDPC Encoder Definition (via Generator)," this encoder requires orders of magnitude fewer operations to create each codeword. This is accomplished by completing a significant amount of the complex matrix manipulation (including inverse, multiplication, and Gaussian elimination operations) during preprocessing. The disadvantage of this encoder is that it requires a specially formatted matrix. However, GNU Radio includes python scripts to format a standard parity check matrix appropriately for this encoder, as well as a small library of encoding-ready matrices for use.
- </doc>
-</block>
diff --git a/gr-fec/grc/variable_polar_code_configurator.block.yml b/gr-fec/grc/variable_polar_code_configurator.block.yml
new file mode 100644
index 000000000..2c07822c2
--- /dev/null
+++ b/gr-fec/grc/variable_polar_code_configurator.block.yml
@@ -0,0 +1,42 @@
+id: variable_polar_code_configurator
+label: POLAR code Configurator
+
+parameters:
+- id: channel
+ label: Channel
+ dtype: string
+ default: polar.CHANNEL_TYPE_BEC
+ options: [polar.CHANNEL_TYPE_BEC, polar.CHANNEL_TYPE_AWGN]
+ option_labels: [BEC, AWGN]
+- id: block_size
+ label: Block size (N)
+ dtype: int
+ default: '32'
+- id: num_info_bits
+ label: Info Bits (K)
+ dtype: int
+ default: '16'
+- id: design_snr
+ label: design SNR
+ dtype: float
+ default: '0.0'
+- id: mu
+ label: mu
+ dtype: int
+ default: '16'
+value: ${ polar.load_frozen_bits_info(True, channel, block_size, num_info_bits, design_snr,
+ mu) }
+
+templates:
+ imports: from gnuradio.fec import polar
+ var_make: self.${id} = ${id} = polar.load_frozen_bits_info(False, ${channel},
+ ${block_size}, ${num_info_bits}, ${design_snr}, ${mu})
+
+documentation: "This block serves as an interface to the underlying Python functions\
+ \ for channel construction.\n \n Current channel types are: BEC/AWGN\n Block\
+ \ size must be a power of 2!\n Info Bits must be 0 smaller K smaller N\n Design\
+ \ SNR does affect the target transmission SNR and thus performance.\n The parameter\
+ \ mu is only relevant for AWGN channels. It is passed on to the corresponding\
+ \ Channel construction algorithm."
+
+file_format: 1
diff --git a/gr-fec/grc/variable_polar_code_configurator.xml b/gr-fec/grc/variable_polar_code_configurator.xml
deleted file mode 100644
index ee145b16f..000000000
--- a/gr-fec/grc/variable_polar_code_configurator.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>POLAR code Configurator</name>
- <key>variable_polar_code_configurator</key>
- <import>from gnuradio.fec import polar</import>
- <var_make>self.$(id) = $(id) = polar.load_frozen_bits_info(False, $channel, $block_size, $num_info_bits, $design_snr, $mu)</var_make>
- <var_value>polar.load_frozen_bits_info(True, $channel, $block_size, $num_info_bits, $design_snr, $mu)</var_value>
- <make></make>
-
- <param>
- <name>Channel</name>
- <key>channel</key>
- <value>polar.CHANNEL_TYPE_BEC</value>
- <type>string</type>
- <option>
- <name>BEC</name>
- <key>polar.CHANNEL_TYPE_BEC</key>
- </option>
- <option>
- <name>AWGN</name>
- <key>polar.CHANNEL_TYPE_AWGN</key>
- </option>
- </param>
-
- <param>
- <name>Block size (N)</name>
- <key>block_size</key>
- <value>32</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Info Bits (K)</name>
- <key>num_info_bits</key>
- <value>16</value>
- <type>int</type>
- </param>
-
- <param>
- <name>design SNR</name>
- <key>design_snr</key>
- <value>0.0</value>
- <type>float</type>
- </param>
-
- <param>
- <name>mu</name>
- <key>mu</key>
- <value>16</value>
- <type>int</type>
- </param>
- <doc>This block serves as an interface to the underlying Python functions for channel construction.
-
- Current channel types are: BEC/AWGN
- Block size must be a power of 2!
- Info Bits must be 0 smaller K smaller N
- Design SNR does affect the target transmission SNR and thus performance.
- The parameter mu is only relevant for AWGN channels. It is passed on to the corresponding Channel construction algorithm.</doc>
-</block>
diff --git a/gr-fec/grc/variable_polar_decoder_sc.block.yml b/gr-fec/grc/variable_polar_decoder_sc.block.yml
new file mode 100644
index 000000000..00120a65d
--- /dev/null
+++ b/gr-fec/grc/variable_polar_decoder_sc.block.yml
@@ -0,0 +1,45 @@
+id: variable_polar_decoder_sc_def
+label: POLAR Decoder SC Definition
+
+parameters:
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ default: '0'
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '4'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: block_size
+ label: Block size (N)
+ dtype: int
+- id: num_info_bits
+ label: '#Info Bits (K)'
+ dtype: int
+- id: frozen_bit_positions
+ label: Frozen Bit Positions
+ dtype: int_vector
+- id: frozen_bit_values
+ label: Frozen Bit Values
+ dtype: int_vector
+value: ${ fec.polar_decoder_sc.make(block_size, num_info_bits, frozen_bit_positions,
+ frozen_bit_values) }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "% if int(ndim)==0 #:\nself.${id} = ${id} = fec.polar_decoder_sc.make(${block_size},\
+ \ ${num_info_bits}, ${frozen_bit_positions}, ${frozen_bit_values}) \n% elif\
+ \ int(ndim)==1 #:\nself.${id} = ${id} = map((lambda a: fec.polar_decoder_sc.make(${block_size},\
+ \ ${num_info_bits}, ${frozen_bit_positions}, ${frozen_bit_values})), range(0,\
+ \ ${dim1}) ) \n% else:\nself.${id} = ${id} = map((lambda b: map((lambda a:\
+ \ fec.polar_decoder_sc.make(${block_size}, ${num_info_bits}, ${frozen_bit_positions},\
+ \ ${frozen_bit_values})), range(0, ${dim2}))), range(0, ${dim1})) \n% endif"
+
+file_format: 1
diff --git a/gr-fec/grc/variable_polar_decoder_sc.xml b/gr-fec/grc/variable_polar_decoder_sc.xml
deleted file mode 100644
index 4976afb4b..000000000
--- a/gr-fec/grc/variable_polar_decoder_sc.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>POLAR Decoder SC Definition</name>
- <key>variable_polar_decoder_sc_def</key>
- <import>from gnuradio import fec</import>
- <var_make>#if int($ndim())==0 #
-self.$(id) = $(id) = fec.polar_decoder_sc.make($block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values) #slurp
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map((lambda a: fec.polar_decoder_sc.make($block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values)), range(0, $dim1) ) #slurp
-#else
-self.$(id) = $(id) = map((lambda b: map((lambda a: fec.polar_decoder_sc.make($block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values)), range(0, $dim2))), range(0, $dim1)) #slurp
-#end if</var_make>
- <var_value>fec.polar_decoder_sc.make($block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values)</var_value>
- <make></make>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value>0</value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>4</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Block size (N)</name>
- <key>block_size</key>
- <type>int</type>
- </param>
-
- <param>
- <name>#Info Bits (K)</name>
- <key>num_info_bits</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Frozen Bit Positions</name>
- <key>frozen_bit_positions</key>
- <type>int_vector</type>
- </param>
-
- <param>
- <name>Frozen Bit Values</name>
- <key>frozen_bit_values</key>
- <type>int_vector</type>
- </param>
-</block>
diff --git a/gr-fec/grc/variable_polar_decoder_sc_list.block.yml b/gr-fec/grc/variable_polar_decoder_sc_list.block.yml
new file mode 100644
index 000000000..7c9de3240
--- /dev/null
+++ b/gr-fec/grc/variable_polar_decoder_sc_list.block.yml
@@ -0,0 +1,49 @@
+id: variable_polar_decoder_sc_list_def
+label: POLAR Decoder SC List Definition
+
+parameters:
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ default: '0'
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '4'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: max_list_size
+ label: Maximum List Size (L)
+ dtype: int
+- id: block_size
+ label: Block size (N)
+ dtype: int
+- id: num_info_bits
+ label: '#Info Bits (K)'
+ dtype: int
+- id: frozen_bit_positions
+ label: Frozen Bit Positions
+ dtype: int_vector
+- id: frozen_bit_values
+ label: Frozen Bit Values
+ dtype: int_vector
+value: ${ fec.polar_decoder_sc_list.make(max_list_size, block_size, num_info_bits,
+ frozen_bit_positions, frozen_bit_values) }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "% if int(ndim)==0 #:\nself.${id} = ${id} = fec.polar_decoder_sc_list.make(${max_list_size},\
+ \ ${block_size}, ${num_info_bits}, ${frozen_bit_positions}, ${frozen_bit_values})\
+ \ \n% elif int(ndim)==1 #:\nself.${id} = ${id} = map((lambda a: fec.polar_decoder_sc_list.make(${max_list_size},\
+ \ ${block_size}, ${num_info_bits}, ${frozen_bit_positions}, ${frozen_bit_values})),\
+ \ range(0, ${dim1})) \n% else:\nself.${id} = ${id} = map((lambda b: map((lambda\
+ \ a: fec.polar_decoder_sc_list.make(${max_list_size}, ${block_size}, ${num_info_bits},\
+ \ ${frozen_bit_positions}, ${frozen_bit_values})), range(0, ${dim2}))), range(0,\
+ \ ${dim1})) \n% endif"
+
+file_format: 1
diff --git a/gr-fec/grc/variable_polar_decoder_sc_list.xml b/gr-fec/grc/variable_polar_decoder_sc_list.xml
deleted file mode 100644
index 2128110ad..000000000
--- a/gr-fec/grc/variable_polar_decoder_sc_list.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>POLAR Decoder SC List Definition</name>
- <key>variable_polar_decoder_sc_list_def</key>
- <import>from gnuradio import fec</import>
- <var_make>#if int($ndim())==0 #
-self.$(id) = $(id) = fec.polar_decoder_sc_list.make($max_list_size, $block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values) #slurp
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map((lambda a: fec.polar_decoder_sc_list.make($max_list_size, $block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values)), range(0, $dim1)) #slurp
-#else
-self.$(id) = $(id) = map((lambda b: map((lambda a: fec.polar_decoder_sc_list.make($max_list_size, $block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values)), range(0, $dim2))), range(0, $dim1)) #slurp
-#end if</var_make>
- <var_value>fec.polar_decoder_sc_list.make($max_list_size, $block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values)</var_value>
- <make></make>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value>0</value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>4</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Maximum List Size (L)</name>
- <key>max_list_size</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Block size (N)</name>
- <key>block_size</key>
- <type>int</type>
- </param>
-
- <param>
- <name>#Info Bits (K)</name>
- <key>num_info_bits</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Frozen Bit Positions</name>
- <key>frozen_bit_positions</key>
- <type>int_vector</type>
- </param>
-
- <param>
- <name>Frozen Bit Values</name>
- <key>frozen_bit_values</key>
- <type>int_vector</type>
- </param>
-</block>
diff --git a/gr-fec/grc/variable_polar_decoder_sc_systematic.block.yml b/gr-fec/grc/variable_polar_decoder_sc_systematic.block.yml
new file mode 100644
index 000000000..b730b2006
--- /dev/null
+++ b/gr-fec/grc/variable_polar_decoder_sc_systematic.block.yml
@@ -0,0 +1,42 @@
+id: variable_polar_decoder_sc_systematic_def
+label: systematic POLAR Decoder SC Definition
+
+parameters:
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ default: '0'
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '4'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: block_size
+ label: Block size (N)
+ dtype: int
+- id: num_info_bits
+ label: '#Info Bits (K)'
+ dtype: int
+- id: frozen_bit_positions
+ label: Frozen Bit Positions
+ dtype: int_vector
+value: ${ fec.polar_decoder_sc_systematic.make(block_size, num_info_bits, frozen_bit_positions)
+ }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "% if int(ndim)==0 #:\nself.${id} = ${id} = fec.polar_decoder_sc_systematic.make(${block_size},\
+ \ ${num_info_bits}, ${frozen_bit_positions}) \n% elif int(ndim)==1 #:\nself.${id}\
+ \ = ${id} = map((lambda a: fec.polar_decoder_sc_systematic.make(${block_size},\
+ \ ${num_info_bits}, ${frozen_bit_positions})), range(0, ${dim1}) ) \n% else:\n\
+ self.${id} = ${id} = map((lambda b: map((lambda a: fec.polar_decoder_sc_systematic.make(${block_size},\
+ \ ${num_info_bits}, ${frozen_bit_positions})), range(0, ${dim2}))), range(0,\
+ \ ${dim1})) \n% endif"
+
+file_format: 1
diff --git a/gr-fec/grc/variable_polar_decoder_sc_systematic.xml b/gr-fec/grc/variable_polar_decoder_sc_systematic.xml
deleted file mode 100644
index cefc7e237..000000000
--- a/gr-fec/grc/variable_polar_decoder_sc_systematic.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>systematic POLAR Decoder SC Definition</name>
- <key>variable_polar_decoder_sc_systematic_def</key>
- <import>from gnuradio import fec</import>
- <var_make>#if int($ndim())==0 #
-self.$(id) = $(id) = fec.polar_decoder_sc_systematic.make($block_size, $num_info_bits, $frozen_bit_positions) #slurp
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map((lambda a: fec.polar_decoder_sc_systematic.make($block_size, $num_info_bits, $frozen_bit_positions)), range(0, $dim1) ) #slurp
-#else
-self.$(id) = $(id) = map((lambda b: map((lambda a: fec.polar_decoder_sc_systematic.make($block_size, $num_info_bits, $frozen_bit_positions)), range(0, $dim2))), range(0, $dim1)) #slurp
-#end if</var_make>
- <var_value>fec.polar_decoder_sc_systematic.make($block_size, $num_info_bits, $frozen_bit_positions)</var_value>
- <make></make>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value>0</value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>4</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Block size (N)</name>
- <key>block_size</key>
- <type>int</type>
- </param>
-
- <param>
- <name>#Info Bits (K)</name>
- <key>num_info_bits</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Frozen Bit Positions</name>
- <key>frozen_bit_positions</key>
- <type>int_vector</type>
- </param>
-</block>
diff --git a/gr-fec/grc/variable_polar_encoder.block.yml b/gr-fec/grc/variable_polar_encoder.block.yml
new file mode 100644
index 000000000..7979a71f4
--- /dev/null
+++ b/gr-fec/grc/variable_polar_encoder.block.yml
@@ -0,0 +1,52 @@
+id: variable_polar_encoder_def
+label: POLAR Encoder Definition
+
+parameters:
+- id: is_packed
+ label: Packed Bits
+ dtype: enum
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['No', 'Yes']
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ default: '0'
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '4'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: block_size
+ label: Block size (N)
+ dtype: int
+- id: num_info_bits
+ label: '#Info Bits (K)'
+ dtype: int
+- id: frozen_bit_positions
+ label: Frozen Bit Positions
+ dtype: int_vector
+- id: frozen_bit_values
+ label: Frozen Bit Values
+ dtype: int_vector
+value: ${ fec.polar_encoder.make(block_size, num_info_bits, frozen_bit_positions,
+ frozen_bit_values, is_packed) }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "% if int(ndim)==0 #:\nself.${id} = ${id} = fec.polar_encoder.make(${block_size},\
+ \ ${num_info_bits}, ${frozen_bit_positions}, ${frozen_bit_values}, ${is_packed})\
+ \ \n% elif int(ndim)==1 #:\nself.${id} = ${id} = map((lambda a: fec.polar_encoder.make(${block_size},\
+ \ ${num_info_bits}, ${frozen_bit_positions}, ${frozen_bit_values}, ${is_packed})),\
+ \ range(0, ${dim1})) \n% else:\nself.${id} = ${id} = map((lambda b: map((lambda\
+ \ a: fec.polar_encoder.make(${block_size}, ${num_info_bits}, ${frozen_bit_positions},\
+ \ ${frozen_bit_values}, ${is_packed})), range(0, ${dim2}))), range(0, ${dim1}))\
+ \ \n% endif"
+
+file_format: 1
diff --git a/gr-fec/grc/variable_polar_encoder.xml b/gr-fec/grc/variable_polar_encoder.xml
deleted file mode 100644
index 4147cf1ed..000000000
--- a/gr-fec/grc/variable_polar_encoder.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>POLAR Encoder Definition</name>
- <key>variable_polar_encoder_def</key>
- <import>from gnuradio import fec</import>
- <var_make>#if int($ndim())==0 #
-self.$(id) = $(id) = fec.polar_encoder.make($block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values, $is_packed) #slurp
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map((lambda a: fec.polar_encoder.make($block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values, $is_packed)), range(0, $dim1)) #slurp
-#else
-self.$(id) = $(id) = map((lambda b: map((lambda a: fec.polar_encoder.make($block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values, $is_packed)), range(0, $dim2))), range(0, $dim1)) #slurp
-#end if</var_make>
- <var_value>fec.polar_encoder.make($block_size, $num_info_bits, $frozen_bit_positions, $frozen_bit_values, $is_packed)</var_value>
- <make></make>
-
- <param>
- <name>Packed Bits</name>
- <key>is_packed</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- </param>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value>0</value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>4</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Block size (N)</name>
- <key>block_size</key>
- <type>int</type>
- </param>
-
- <param>
- <name>#Info Bits (K)</name>
- <key>num_info_bits</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Frozen Bit Positions</name>
- <key>frozen_bit_positions</key>
- <type>int_vector</type>
- </param>
-
- <param>
- <name>Frozen Bit Values</name>
- <key>frozen_bit_values</key>
- <type>int_vector</type>
- </param>
-</block>
diff --git a/gr-fec/grc/variable_polar_encoder_systematic.block.yml b/gr-fec/grc/variable_polar_encoder_systematic.block.yml
new file mode 100644
index 000000000..0f4c5f23a
--- /dev/null
+++ b/gr-fec/grc/variable_polar_encoder_systematic.block.yml
@@ -0,0 +1,42 @@
+id: variable_polar_encoder_systematic_def
+label: systematic POLAR Encoder Definition
+
+parameters:
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ default: '0'
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '4'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: block_size
+ label: Block size (N)
+ dtype: int
+- id: num_info_bits
+ label: '#Info Bits (K)'
+ dtype: int
+- id: frozen_bit_positions
+ label: Frozen Bit Positions
+ dtype: int_vector
+value: ${ fec.polar_encoder_systematic.make(block_size, num_info_bits, frozen_bit_positions)
+ }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "% if int(ndim)==0 #:\nself.${id} = ${id} = fec.polar_encoder_systematic.make(${block_size},\
+ \ ${num_info_bits}, ${frozen_bit_positions}) \n% elif int(ndim)==1 #:\nself.${id}\
+ \ = ${id} = map((lambda a: fec.polar_encoder_systematic.make(${block_size},\
+ \ ${num_info_bits}, ${frozen_bit_positions})), range(0, ${dim1})) \n% else:\n\
+ self.${id} = ${id} = map((lambda b: map((lambda a: fec.polar_encoder_systematic.make(${block_size},\
+ \ ${num_info_bits}, ${frozen_bit_positions})), range(0, ${dim2}))), range(0,\
+ \ ${dim1})) \n% endif"
+
+file_format: 1
diff --git a/gr-fec/grc/variable_polar_encoder_systematic.xml b/gr-fec/grc/variable_polar_encoder_systematic.xml
deleted file mode 100644
index 0d9bcd96a..000000000
--- a/gr-fec/grc/variable_polar_encoder_systematic.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>systematic POLAR Encoder Definition</name>
- <key>variable_polar_encoder_systematic_def</key>
- <import>from gnuradio import fec</import>
- <var_make>#if int($ndim())==0 #
-self.$(id) = $(id) = fec.polar_encoder_systematic.make($block_size, $num_info_bits, $frozen_bit_positions) #slurp
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map((lambda a: fec.polar_encoder_systematic.make($block_size, $num_info_bits, $frozen_bit_positions)), range(0, $dim1)) #slurp
-#else
-self.$(id) = $(id) = map((lambda b: map((lambda a: fec.polar_encoder_systematic.make($block_size, $num_info_bits, $frozen_bit_positions)), range(0, $dim2))), range(0, $dim1)) #slurp
-#end if</var_make>
- <var_value>fec.polar_encoder_systematic.make($block_size, $num_info_bits, $frozen_bit_positions)</var_value>
- <make></make>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value>0</value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>4</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Block size (N)</name>
- <key>block_size</key>
- <type>int</type>
- </param>
-
- <param>
- <name>#Info Bits (K)</name>
- <key>num_info_bits</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Frozen Bit Positions</name>
- <key>frozen_bit_positions</key>
- <type>int_vector</type>
- </param>
-</block>
diff --git a/gr-fec/grc/variable_repetition_decoder_def_list.block.yml b/gr-fec/grc/variable_repetition_decoder_def_list.block.yml
new file mode 100644
index 000000000..50590038e
--- /dev/null
+++ b/gr-fec/grc/variable_repetition_decoder_def_list.block.yml
@@ -0,0 +1,49 @@
+id: variable_repetition_decoder_def
+label: Repetition Decoder Definition
+
+parameters:
+- id: value
+ label: Ignore Me
+ dtype: raw
+ default: '"ok"'
+ hide: all
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: framebits
+ label: Frame Bits
+ dtype: int
+ default: '2048'
+- id: rep
+ label: Repetitions
+ dtype: int
+ default: '3'
+- id: prob
+ label: a prior prob
+ dtype: float
+ default: '0.5'
+value: ${ fec.repetition_decoder.make(framebits, rep, prob) }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "\n% if int(ndim)==0 #:\nself.${id} = ${id} = fec.repetition_decoder.make(${framebits},\
+ \ ${rep}, ${prob})\n% elif int(ndim)==1 #:\nself.${id} = ${id} = map( (lambda\
+ \ a: fec.repetition_decoder.make(${framebits}, ${rep}, ${prob})), range(0,${dim1})\
+ \ ) \n% else:\nself.${id} = ${id} = map( (lambda b: map( ( lambda a: fec.repetition_decoder.make(${framebits},\
+ \ ${rep}, ${prob})), range(0,${dim2}) ) ), range(0,${dim1})) \n% endif\n \
+ \ "
+
+documentation: ""
+
+file_format: 1
diff --git a/gr-fec/grc/variable_repetition_decoder_def_list.xml b/gr-fec/grc/variable_repetition_decoder_def_list.xml
deleted file mode 100644
index cbeef445f..000000000
--- a/gr-fec/grc/variable_repetition_decoder_def_list.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-# FEC REPETITION DECODER
-###################################################
- -->
-<block>
- <name>Repetition Decoder Definition</name>
- <key>variable_repetition_decoder_def</key>
- <import>from gnuradio import fec</import>
- <var_make>
-#if int($ndim())==0 #
-self.$(id) = $(id) = fec.repetition_decoder.make($framebits, $rep, $prob)
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map( (lambda a: fec.repetition_decoder.make($framebits, $rep, $prob)), range(0,$dim1) ) #slurp
-#else
-self.$(id) = $(id) = map( (lambda b: map( ( lambda a: fec.repetition_decoder.make($framebits, $rep, $prob)), range(0,$dim2) ) ), range(0,$dim1)) #slurp
-#end if
- </var_make>
- <var_value>fec.repetition_decoder.make($framebits, $rep, $prob)</var_value>
- <make></make>
-
- <param>
- <name>Ignore Me</name>
- <key>value</key>
- <value>"ok"</value>
- <type>raw</type>
- <hide>all</hide>
- </param>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value></value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Frame Bits</name>
- <key>framebits</key>
- <value>2048</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Repetitions</name>
- <key>rep</key>
- <value>3</value>
- <type>int</type>
- </param>
-
- <param>
- <name>a prior prob</name>
- <key>prob</key>
- <value>0.5</value>
- <type>float</type>
- </param>
-
- <doc>
- </doc>
-</block>
diff --git a/gr-fec/grc/variable_repetition_encoder_def_list.block.yml b/gr-fec/grc/variable_repetition_encoder_def_list.block.yml
new file mode 100644
index 000000000..3e86966e7
--- /dev/null
+++ b/gr-fec/grc/variable_repetition_encoder_def_list.block.yml
@@ -0,0 +1,39 @@
+id: variable_repetition_encoder_def
+label: Repetition Encoder Definition
+
+parameters:
+- id: ndim
+ label: Parallelism
+ dtype: enum
+ options: ['0', '1', '2']
+- id: dim1
+ label: Dimension 1
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 1) else 'all') }
+- id: dim2
+ label: Dimension 2
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if (int(ndim) >= 2) else 'all') }
+- id: framebits
+ label: Frame Bits
+ dtype: int
+ default: '2048'
+- id: rep
+ label: Repetitions
+ dtype: int
+ default: '3'
+value: ${ fec.repetition_encoder_make(framebits, rep) }
+
+templates:
+ imports: from gnuradio import fec
+ var_make: "\n% if int(ndim)==0 #:\nself.${id} = ${id} = fec.repetition_encoder_make(${framebits},\
+ \ ${rep})\n% elif int(ndim)==1 #:\nself.${id} = ${id} = map((lambda a: fec.repetition_encoder_make(${framebits},\
+ \ ${rep})), range(0,${dim1})) \n% else:\nself.${id} = ${id} = map((lambda\
+ \ b: map((lambda a: fec.repetition_encoder_make(${framebits}, ${rep})), range(0,${dim2}))),\
+ \ range(0,${dim1})) \n% endif\n "
+
+documentation: ""
+
+file_format: 1
diff --git a/gr-fec/grc/variable_repetition_encoder_def_list.xml b/gr-fec/grc/variable_repetition_encoder_def_list.xml
deleted file mode 100644
index e8554189c..000000000
--- a/gr-fec/grc/variable_repetition_encoder_def_list.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-# FEC REPETITION ENCODER
-###################################################
- -->
-<block>
- <name>Repetition Encoder Definition</name>
- <key>variable_repetition_encoder_def</key>
- <import>from gnuradio import fec</import>
- <var_make>
-#if int($ndim())==0 #
-self.$(id) = $(id) = fec.repetition_encoder_make($framebits, $rep)
-#else if int($ndim())==1 #
-self.$(id) = $(id) = map((lambda a: fec.repetition_encoder_make($framebits, $rep)), range(0,$dim1)) #slurp
-#else
-self.$(id) = $(id) = map((lambda b: map((lambda a: fec.repetition_encoder_make($framebits, $rep)), range(0,$dim2))), range(0,$dim1)) #slurp
-#end if
- </var_make>
- <var_value>fec.repetition_encoder_make($framebits, $rep)</var_value>
- <make></make>
-
- <param>
- <name>Parallelism</name>
- <key>ndim</key>
- <value></value>
- <type>enum</type>
- <option>
- <name>0</name>
- <key>0</key>
- </option>
- <option>
- <name>1</name>
- <key>1</key>
- </option>
- <option>
- <name>2</name>
- <key>2</key>
- </option>
- </param>
-
- <param>
- <name>Dimension 1</name>
- <key>dim1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 1) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Dimension 2</name>
- <key>dim2</key>
- <value>1</value>
- <type>int</type>
- <hide>#if (int($ndim()) >= 2) then 'none' else 'all' #</hide>
- </param>
-
- <param>
- <name>Frame Bits</name>
- <key>framebits</key>
- <value>2048</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Repetitions</name>
- <key>rep</key>
- <value>3</value>
- <type>int</type>
- </param>
-
- <doc>
- </doc>
-</block>
diff --git a/gr-fec/include/gnuradio/fec/polar_common.h b/gr-fec/include/gnuradio/fec/polar_common.h
index 79272cb30..c36995b59 100644
--- a/gr-fec/include/gnuradio/fec/polar_common.h
+++ b/gr-fec/include/gnuradio/fec/polar_common.h
@@ -24,6 +24,8 @@
#ifndef INCLUDED_FEC_POLAR_COMMON_H
#define INCLUDED_FEC_POLAR_COMMON_H
+#include <vector>
+
#include <gnuradio/fec/api.h>
#include <vector>
diff --git a/gr-fec/python/fec/CMakeLists.txt b/gr-fec/python/fec/CMakeLists.txt
index 9d170b042..013b3521a 100644
--- a/gr-fec/python/fec/CMakeLists.txt
+++ b/gr-fec/python/fec/CMakeLists.txt
@@ -67,7 +67,7 @@ endif(NOT GSL_FOUND)
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gr-fec/python/fec/LDPC/Generate_LDPC_matrix.py b/gr-fec/python/fec/LDPC/Generate_LDPC_matrix.py
index a3862a6fd..8c5b17bc4 100644
--- a/gr-fec/python/fec/LDPC/Generate_LDPC_matrix.py
+++ b/gr-fec/python/fec/LDPC/Generate_LDPC_matrix.py
@@ -20,7 +20,12 @@
# Boston, MA 02110-1301, USA.
#
-from Generate_LDPC_matrix_functions import *
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
+from .Generate_LDPC_matrix_functions import *
# This is an example of how to generate a parity check matrix for
# use with the LDPC Richardson Urbanke encoder. A significant amount
@@ -62,18 +67,18 @@ newH = get_full_rank_H_matrix(parity_check_matrix.H)
# can take a while...
[bestH,g] = get_best_matrix(newH,100)
-# Print out some of the resulting properties.
+# Print(out some of the resulting properties.)
n = bestH.shape[1]
k = n - bestH.shape[0]
-print "Parity check matrix properties:"
-print "\tSize :", bestH.shape
-print "\tRank :", linalg.matrix_rank(bestH)
-print "\tRate : %.3f" % ((k*1.0)/n)
-print "\tn :", n, " (codeword length)"
-print "\tk :", k, " (info word length)"
-print "\tgap : %i" % g
+print("Parity check matrix properties:")
+print("\tSize :", bestH.shape)
+print("\tRank :", linalg.matrix_rank(bestH))
+print("\tRate : %.3f" % ((k*1.0) / n))
+print("\tn :", n, " (codeword length)")
+print("\tk :", k, " (info word length)")
+print("\tgap : %i" % g)
# Save the matrix to an alist file for future use:
alist_filename = "n_%04i_k_%04i_gap_%02i.alist" % (n,k,g)
write_alist_file(alist_filename,bestH)
-print '\nMatrix saved to alist file:', alist_filename, "\n"
+print('\nMatrix saved to alist file:', alist_filename, "\n")
diff --git a/gr-fec/python/fec/LDPC/Generate_LDPC_matrix_functions.py b/gr-fec/python/fec/LDPC/Generate_LDPC_matrix_functions.py
index 589595bbd..6cf0dee09 100644
--- a/gr-fec/python/fec/LDPC/Generate_LDPC_matrix_functions.py
+++ b/gr-fec/python/fec/LDPC/Generate_LDPC_matrix_functions.py
@@ -20,6 +20,10 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
import string, sys
from numpy import *
from numpy.random import shuffle, randint
@@ -46,9 +50,9 @@ def read_alist_file(filename):
indices = string.split(data[lineNumber])
for index in indices:
H[int(index)-1,lineNumber-4] = 1
- # The subsequent lines in the file list the indices for where
- # the 1s are in the rows, but this is redundant
- # information.
+ # The subsequent lines in the file list the indices for where
+ # the 1s are in the rows, but this is redundant
+ # information.
return H
@@ -68,7 +72,7 @@ def write_alist_file(filename, H, verbose=0):
numRows = H.shape[0]
numCols = H.shape[1]
- tempstring = `numCols` + ' ' + `numRows` + '\n'
+ tempstring = repr(numCols) + ' ' + repr(numRows) + '\n'
myfile.write(tempstring)
tempstring1 = ''
@@ -79,12 +83,12 @@ def write_alist_file(filename, H, verbose=0):
rowWeight = nonzeros.shape[1]
if rowWeight > maxRowWeight:
maxRowWeight = rowWeight
- tempstring1 = tempstring1 + `rowWeight` + ' '
+ tempstring1 = tempstring1 + repr(rowWeight) + ' '
for tempArray in nonzeros:
for index in tempArray:
- tempstring2 = tempstring2 + `index+1` + ' '
- tempstring2 = tempstring2 + '\n'
- tempstring1 = tempstring1 + '\n'
+ tempstring2 = tempstring2 + repr(index+1) + ' '
+ tempstring2 = tempstring2 + '\n'
+ tempstring1 = tempstring1 + '\n'
tempstring3 = ''
tempstring4 = ''
@@ -94,14 +98,14 @@ def write_alist_file(filename, H, verbose=0):
colWeight = nonzeros.shape[1]
if colWeight > maxColWeight:
maxColWeight = colWeight
- tempstring3 = tempstring3 + `colWeight` + ' '
+ tempstring3 = tempstring3 + repr(colWeight) + ' '
for tempArray in nonzeros:
for index in tempArray:
- tempstring4 = tempstring4 + `index+1` + ' '
- tempstring4 = tempstring4 + '\n'
- tempstring3 = tempstring3 + '\n'
+ tempstring4 = tempstring4 + repr(index+1) + ' '
+ tempstring4 = tempstring4 + '\n'
+ tempstring3 = tempstring3 + '\n'
- tempstring = `maxColWeight` + ' ' + `maxRowWeight` + '\n'
+ tempstring = repr(maxColWeight) + ' ' + repr(maxRowWeight) + '\n'
# write out max column and row weights
myfile.write(tempstring)
# write out all of the column weights
@@ -116,11 +120,11 @@ def write_alist_file(filename, H, verbose=0):
myfile.close()
-class LDPC_matrix:
+class LDPC_matrix(object):
""" Class for a LDPC parity check matrix """
def __init__(self, alist_filename = None,
- n_p_q = None,
- H_matrix = None):
+ n_p_q = None,
+ H_matrix = None):
if (alist_filename != None):
self.H = self.read_alist_file(alist_filename)
elif (n_p_q != None):
@@ -128,9 +132,9 @@ class LDPC_matrix:
elif (H_matrix != None):
self.H = H_matrix
else:
- print 'Error: provide either an alist filename,',
- print 'parameters for constructing regular LDPC parity',
- print 'check matrix, or a numpy array.'
+ print('Error: provide either an alist filename, ', end='')
+ print('parameters for constructing regular LDPC parity, ', end='')
+ print('check matrix, or a numpy array.')
self.rank = linalg.matrix_rank(self.H)
self.numRows = self.H.shape[0]
@@ -159,31 +163,31 @@ class LDPC_matrix:
# For this algorithm, n/p must be an integer, because the
# number of rows in each submatrix must be a whole number.
- ratioTest = (n*1.0)/q
+ ratioTest = (n*1.0) / q
if ratioTest%1 != 0:
- print '\nError in regular_LDPC_code_contructor: The'
- print 'ratio of inputs n/q must be a whole number.\n'
+ print('\nError in regular_LDPC_code_contructor: The ', end='')
+ print('ratio of inputs n/q must be a whole number.\n')
return
# First submatrix first:
- m = (n*p)/q # number of rows in H matrix
- submatrix1 = zeros((m/p,n))
- for row in arange(m/p):
+ m = (n*p) / q # number of rows in H matrix
+ submatrix1 = zeros((m / p,n))
+ for row in arange(m / p):
range1 = row*q
range2 = (row+1)*q
submatrix1[row,range1:range2] = 1
- H = submatrix1
+ H = submatrix1
# Create the other submatrices and vertically stack them on.
submatrixNum = 2
newColumnOrder = arange(n)
while submatrixNum <= p:
- submatrix = zeros((m/p,n))
+ submatrix = zeros((m / p,n))
shuffle(newColumnOrder)
for columnNum in arange(n):
submatrix[:,columnNum] = \
- submatrix1[:,newColumnOrder[columnNum]]
+ submatrix1[:,newColumnOrder[columnNum]]
H = vstack((H,submatrix))
submatrixNum = submatrixNum + 1
@@ -197,14 +201,14 @@ class LDPC_matrix:
for rowNum in arange(rows):
nonzeros = array(H[rowNum,:].nonzero())
if nonzeros.shape[1] != q:
- print 'Row', rowNum, 'has incorrect weight!'
+ print('Row', rowNum, 'has incorrect weight!')
return
# Check the column weights
for columnNum in arange(cols):
nonzeros = array(H[:,columnNum].nonzero())
if nonzeros.shape[1] != p:
- print 'Row', columnNum, 'has incorrect weight!'
+ print('Row', columnNum, 'has incorrect weight!')
return
return H
@@ -221,10 +225,10 @@ def greedy_upper_triangulation(H, verbose=0):
# Per email from Dr. Urbanke, author of this textbook, this
# algorithm requires H to be full rank
if linalg.matrix_rank(H_t) != H_t.shape[0]:
- print 'Rank of H:', linalg.matrix_rank(tempArray)
- print 'H has', H_t.shape[0], 'rows'
- print 'Error: H must be full rank.'
- return
+ print('Rank of H:', linalg.matrix_rank(tempArray))
+ print('H has', H_t.shape[0], 'rows')
+ print('Error: H must be full rank.')
+ return
size = H_t.shape
n = size[1]
@@ -253,7 +257,7 @@ def greedy_upper_triangulation(H, verbose=0):
# equal to the min positive residual degree, then pick a
# random column c.
indices = (minResidualDegrees == minimumResidualDegree)\
- .nonzero()[1]
+ .nonzero()[1]
indices = indices + t
if indices.shape[0] == 1:
columnC = indices[0]
@@ -282,7 +286,7 @@ def greedy_upper_triangulation(H, verbose=0):
else:
# This is the 'choose' case.
rowsThatContainNonZeros = H_residual[:,columnC-t]\
- .nonzero()[0]
+ .nonzero()[0]
# Swap column c with column t. (Book says t+1 but we
# index from 0, not 1.)
@@ -315,8 +319,8 @@ def greedy_upper_triangulation(H, verbose=0):
while sub_index < (m - rowInH_t):
Htemp[m-sub_index-1,:] = H_t[m-sub_index,:]
sub_index = sub_index+1
- H_t = Htemp.copy()
- Htemp = H_t.copy()
+ H_t = Htemp.copy()
+ Htemp = H_t.copy()
# Save temp H as new H_t.
H_t = Htemp.copy()
@@ -327,7 +331,7 @@ def greedy_upper_triangulation(H, verbose=0):
if g == 0:
if verbose:
- print 'Error: gap is 0.'
+ print('Error: gap is 0.')
return
# We need to ensure phi is nonsingular.
@@ -348,22 +352,22 @@ def greedy_upper_triangulation(H, verbose=0):
except linalg.linalg.LinAlgError:
# Phi is singular
if verbose > 1:
- print 'Initial phi is singular'
+ print('Initial phi is singular')
else:
# Phi is nonsingular, so we need to use this version of H.
if verbose > 1:
- print 'Initial phi is nonsingular'
+ print('Initial phi is nonsingular')
return [H_t, g, t]
else:
if verbose:
- print 'Initial phi is all zeros:\n', phi
+ print('Initial phi is all zeros:\n', phi)
# If the C and D submatrices are all zeros, there is no point in
# shuffling them around in an attempt to find a good phi.
if not (C.any() or D.any()):
if verbose:
- print 'C and D are all zeros. There is no hope in',
- print 'finding a nonsingular phi matrix. '
+ print('C and D are all zeros. There is no hope in',)
+ print('finding a nonsingular phi matrix. ')
return
# We can't look at every row/column permutation possibility
@@ -378,8 +382,8 @@ def greedy_upper_triangulation(H, verbose=0):
while iterationCount < maxIterations:
if verbose > 1:
- print 'iterationCount:', iterationCount
- tempH = H_t.copy()
+ print('iterationCount:', iterationCount)
+ tempH = H_t.copy()
shuffle(columnsToShuffle)
shuffle(rowsToShuffle)
@@ -387,7 +391,7 @@ def greedy_upper_triangulation(H, verbose=0):
for newDestinationColumnNumber in arange(t,n):
oldColumnNumber = columnsToShuffle[index]
tempH[:,newDestinationColumnNumber] = \
- H_t[:,oldColumnNumber]
+ H_t[:,oldColumnNumber]
index +=1
tempH2 = tempH.copy()
@@ -414,23 +418,23 @@ def greedy_upper_triangulation(H, verbose=0):
except linalg.linalg.LinAlgError:
# Phi is singular
if verbose > 1:
- print 'Phi is still singular'
+ print('Phi is still singular')
else:
# Phi is nonsingular, so we're done.
if verbose:
- print 'Found a nonsingular phi on',
- print 'iterationCount = ', iterationCount
+ print('Found a nonsingular phi on',)
+ print('iterationCount = ', iterationCount)
return [H_t, g, t]
else:
if verbose > 1:
- print 'phi is all zeros'
+ print('phi is all zeros')
iterationCount +=1
# If we've reached this point, then we haven't found a
# version of H that has a nonsingular phi.
if verbose:
- print '--- Error: nonsingular phi matrix not found.'
+ print('--- Error: nonsingular phi matrix not found.')
def inv_mod2(squareMatrix, verbose=0):
"""
@@ -468,16 +472,16 @@ def inv_mod2(squareMatrix, verbose=0):
tempTest[rowNum,colNum] = 0
else:
if verbose > 1:
- print 'In inv_mod2. Rounding error on this',
- print 'value? Mod 2 has already been done.',
- print 'value:', value
+ print('In inv_mod2. Rounding error on this',)
+ print('value? Mod 2 has already been done.',)
+ print('value:', value)
test = tempTest.copy()
if (test - eye(t,t) % 2).any():
if verbose:
- print 'Error in inv_mod2: did not find inverse.'
- # TODO is this the most appropriate error to raise?
+ print('Error in inv_mod2: did not find inverse.')
+ # TODO is this the most appropriate error to raise?
raise linalg.linalg.LinAlgError
else:
return C
@@ -520,7 +524,7 @@ def get_full_rank_H_matrix(H, verbose=False):
tempArray = H.copy()
if linalg.matrix_rank(tempArray) == tempArray.shape[0]:
if verbose:
- print 'Returning H; it is already full rank.'
+ print('Returning H; it is already full rank.')
return tempArray
numRows = tempArray.shape[0]
@@ -538,8 +542,8 @@ def get_full_rank_H_matrix(H, verbose=False):
while i < limit:
if verbose:
- print 'In get_full_rank_H_matrix; i:', i
- # Flag indicating that the row contains a non-zero entry
+ print('In get_full_rank_H_matrix; i:', i)
+ # Flag indicating that the row contains a non-zero entry
found = False
for j in arange(i, numColumns):
if tempArray[i, j] == 1:
@@ -588,8 +592,8 @@ def get_full_rank_H_matrix(H, verbose=False):
newH[:,index] = tempHarray[:,columnOrder[0,index]]
if verbose:
- print 'original H.shape:', H.shape
- print 'newH.shape:', newH.shape
+ print('original H.shape:', H.shape)
+ print('newH.shape:', newH.shape)
return newH
@@ -604,13 +608,13 @@ def get_best_matrix(H, numIterations=100, verbose=False):
index = 1
while index <= numIterations:
if verbose:
- print '--- In get_best_matrix, iteration:', index
- index += 1
+ print('--- In get_best_matrix, iteration:', index)
+ index += 1
try:
ret = greedy_upper_triangulation(H, verbose)
- except ValueError, e:
+ except ValueError as e:
if verbose > 1:
- print 'greedy_upper_triangulation error: ', e
+ print('greedy_upper_triangulation error: ', e)
else:
if ret:
[betterH, gap, t] = ret
@@ -632,8 +636,8 @@ def get_best_matrix(H, numIterations=100, verbose=False):
return [bestH, bestGap]
else:
if verbose:
- print 'Error: Could not find appropriate H form',
- print 'for encoding.'
+ print('Error: Could not find appropriate H form',)
+ print('for encoding.')
return
def getSystematicGmatrix(GenMatrix):
@@ -643,7 +647,7 @@ def getSystematicGmatrix(GenMatrix):
matrix and P is the parity submatrix. If the GenMatrix matrix
provided is not full rank, then dependent rows will be deleted.
- This function does not convert parity check (H) matrices to the
+ This function does not convert parity check (H) matrices to the
generator matrix format. Use the function getSystematicGmatrixFromH
for that purpose.
"""
@@ -682,7 +686,7 @@ def getSystematicGmatrix(GenMatrix):
tempArray = move_row_to_bottom(i,tempArray)
# decrease limit since we just found a row of 0s
limit -= 1
- # the rows below i are the dependent rows, which we discard
+ # the rows below i are the dependent rows, which we discard
G = tempArray[0:i,:]
return G
@@ -696,7 +700,7 @@ def getSystematicGmatrixFromH(H, verbose=False):
will be deleted first.
"""
if verbose:
- print 'received H with size: ', H.shape
+ print('received H with size: ', H.shape)
# First, put the H matrix into the form H = [I|m] where:
# I is (n-k) x (n-k) identity matrix
@@ -716,5 +720,5 @@ def getSystematicGmatrixFromH(H, verbose=False):
k = m.shape[1]
G = concatenate((identity(k),m.T),axis=1)
if verbose:
- print 'returning G with size: ', G.shape
- return G \ No newline at end of file
+ print('returning G with size: ', G.shape)
+ return G
diff --git a/gr-fec/python/fec/LDPC/__init__.py b/gr-fec/python/fec/LDPC/__init__.py
index 173171a24..7ee9196d1 100644
--- a/gr-fec/python/fec/LDPC/__init__.py
+++ b/gr-fec/python/fec/LDPC/__init__.py
@@ -1,3 +1,5 @@
+from __future__ import absolute_import
+from __future__ import unicode_literals
#
# Copyright 2015 Free Software Foundation, Inc.
#
@@ -19,4 +21,4 @@
# Boston, MA 02110-1301, USA.
#
-from Generate_LDPC_matrix_functions import *
+from .Generate_LDPC_matrix_functions import *
diff --git a/gr-fec/python/fec/__init__.py b/gr-fec/python/fec/__init__.py
index 6c82232d4..e5458686d 100644
--- a/gr-fec/python/fec/__init__.py
+++ b/gr-fec/python/fec/__init__.py
@@ -23,25 +23,28 @@
Blocks for forward error correction.
'''
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
try:
- from fec_swig import *
+ from .fec_swig import *
except ImportError:
import os
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
- from fec_swig import *
+ from .fec_swig import *
-from bitflip import *
-from extended_encoder import extended_encoder
-from extended_decoder import extended_decoder
-from threaded_encoder import threaded_encoder
-from threaded_decoder import threaded_decoder
-from capillary_threaded_decoder import capillary_threaded_decoder
-from capillary_threaded_encoder import capillary_threaded_encoder
-from extended_async_encoder import extended_async_encoder
-from extended_tagged_encoder import extended_tagged_encoder
-from extended_tagged_decoder import extended_tagged_decoder
+from .bitflip import *
+from .extended_encoder import extended_encoder
+from .extended_decoder import extended_decoder
+from .threaded_encoder import threaded_encoder
+from .threaded_decoder import threaded_decoder
+from .capillary_threaded_decoder import capillary_threaded_decoder
+from .capillary_threaded_encoder import capillary_threaded_encoder
+from .extended_async_encoder import extended_async_encoder
+from .extended_tagged_encoder import extended_tagged_encoder
+from .extended_tagged_decoder import extended_tagged_decoder
-from fec_test import fec_test
-from bercurve_generator import bercurve_generator
+from .fec_test import fec_test
+from .bercurve_generator import bercurve_generator
diff --git a/gr-fec/python/fec/_qa_helper.py b/gr-fec/python/fec/_qa_helper.py
index 872245344..85a19ed7c 100755..100644
--- a/gr-fec/python/fec/_qa_helper.py
+++ b/gr-fec/python/fec/_qa_helper.py
@@ -20,12 +20,19 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import blocks
-from gnuradio import gr
-import sys, numpy
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
+
+import numpy
+
+from gnuradio import gr, blocks
+# Must use absolute import here because this file is not installed as part
+# of the module
+from gnuradio.fec import extended_encoder
+from gnuradio.fec import extended_decoder
-from extended_encoder import extended_encoder
-from extended_decoder import extended_decoder
class map_bb(gr.sync_block):
def __init__(self, bitmap):
@@ -37,7 +44,7 @@ class map_bb(gr.sync_block):
self.bitmap = bitmap
def work(self, input_items, output_items):
- output_items[0][:] = map(lambda x: self.bitmap[x], input_items[0])
+ output_items[0][:] = [self.bitmap[x] for x in input_items[0]]
return len(output_items[0])
@@ -85,6 +92,6 @@ if __name__ == '__main__':
errs += 1
if errs == 0:
- print "Decoded properly"
+ print("Decoded properly")
else:
- print "Problem Decoding"
+ print("Problem Decoding")
diff --git a/gr-fec/python/fec/bercurve_generator.py b/gr-fec/python/fec/bercurve_generator.py
index 3221a683c..29a02c135 100644
--- a/gr-fec/python/fec/bercurve_generator.py
+++ b/gr-fec/python/fec/bercurve_generator.py
@@ -20,10 +20,12 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import absolute_import
+from __future__ import unicode_literals
from gnuradio import gr, blocks
import numpy
-from fec_test import fec_test
+from .fec_test import fec_test
class bercurve_generator(gr.hier_block2):
@@ -40,7 +42,7 @@ class bercurve_generator(gr.hier_block2):
self.decoder_list = decoder_list
self.puncpat = puncpat
- self.random_gen_b_0 = blocks.vector_source_b(map(int, numpy.random.randint(0, 256, 100000)), True)
+ self.random_gen_b_0 = blocks.vector_source_b(list(map(int, numpy.random.randint(0, 256, 100000))), True)
self.deinterleave = blocks.deinterleave(gr.sizeof_char*1)
self.connect(self.random_gen_b_0, self.deinterleave)
self.ber_generators = []
diff --git a/gr-fec/python/fec/bitflip.py b/gr-fec/python/fec/bitflip.py
index 235dc19a0..332a288e7 100644
--- a/gr-fec/python/fec/bitflip.py
+++ b/gr-fec/python/fec/bitflip.py
@@ -20,6 +20,11 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+from __future__ import unicode_literals
+
+
+
def bitreverse(mint):
res = 0;
while mint != 0:
@@ -51,7 +56,7 @@ def read_bitlist(bitlist):
def read_big_bitlist(bitlist):
ret = []
- for j in range(0, len(bitlist)/64):
+ for j in range(0, len(bitlist) / 64):
res = 0;
for i in range(0, 64):
if int(bitlist[j*64+i]) == 1:
@@ -72,9 +77,9 @@ def generate_symmetries(symlist):
for i in range(len(symlist[0])):
retlist.append(symlist[0][i:] + symlist[0][0:i]);
invlist = symlist[0];
- for i in range(1, len(symlist[0])/2):
- invlist[i] = symlist[0][i + len(symlist[0])/2];
- invlist[i + len(symlist[0])/2] = symlist[0][i];
+ for i in range(1, len(symlist[0]) / 2):
+ invlist[i] = symlist[0][i + len(symlist[0]) / 2];
+ invlist[i + len(symlist[0]) / 2] = symlist[0][i];
for i in range(len(symlist[0])):
retlist.append(symlist[0][i:] + symlist[0][0:i]);
return retlist;
diff --git a/gr-fec/python/fec/capillary_threaded_decoder.py b/gr-fec/python/fec/capillary_threaded_decoder.py
index 9a00cde19..821e3cf92 100644
--- a/gr-fec/python/fec/capillary_threaded_decoder.py
+++ b/gr-fec/python/fec/capillary_threaded_decoder.py
@@ -20,10 +20,15 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, blocks
-import fec_swig as fec
+from __future__ import division
+from __future__ import unicode_literals
+
import math
+from gnuradio import gr, blocks
+from . import fec_swig as fec
+
+
class capillary_threaded_decoder(gr.hier_block2):
def __init__(self, decoder_list_0, input_size, output_size):
gr.hier_block2.__init__(
@@ -64,7 +69,7 @@ class capillary_threaded_decoder(gr.hier_block2):
branchcount += 2
codercount = 0
- for i in range(len(decoder_list_0)/2):
+ for i in range(len(decoder_list_0) // 2):
self.connect((self.deinterleaves_0[rootcount], 0), (self.generic_decoders_0[codercount], 0))
self.connect((self.deinterleaves_0[rootcount], 1), (self.generic_decoders_0[codercount + 1], 0))
rootcount += 1
@@ -80,7 +85,7 @@ class capillary_threaded_decoder(gr.hier_block2):
branchcount += 2
codercount = 0
- for i in range(len(decoder_list_0)/2):
+ for i in range(len(decoder_list_0) // 2):
self.connect((self.generic_decoders_0[codercount], 0), (self.interleaves_0[rootcount], 0))
self.connect((self.generic_decoders_0[codercount + 1], 0), (self.interleaves_0[rootcount], 1))
rootcount += 1
diff --git a/gr-fec/python/fec/capillary_threaded_encoder.py b/gr-fec/python/fec/capillary_threaded_encoder.py
index 21d4af62c..899d10c3b 100644
--- a/gr-fec/python/fec/capillary_threaded_encoder.py
+++ b/gr-fec/python/fec/capillary_threaded_encoder.py
@@ -20,10 +20,15 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, blocks
-import fec_swig as fec
+from __future__ import division
+from __future__ import unicode_literals
+
import math
+from gnuradio import gr, blocks
+from . import fec_swig as fec
+
+
class capillary_threaded_encoder(gr.hier_block2):
def __init__(self, encoder_list_0, input_size=gr.sizeof_char, output_size=gr.sizeof_char):
gr.hier_block2.__init__(self, "Capillary Threaded Encoder",
@@ -43,7 +48,7 @@ class capillary_threaded_encoder(gr.hier_block2):
self.deinterleaves_0.append(blocks.deinterleave(input_size,
fec.get_encoder_input_size(encoder_list_0[0])))
- self.generic_encoders_0 = [];
+ self.generic_encoders_0 = [];
for i in range(len(encoder_list_0)):
self.generic_encoders_0.append(fec.encoder(encoder_list_0[i],
input_size, output_size))
@@ -64,7 +69,7 @@ class capillary_threaded_encoder(gr.hier_block2):
branchcount += 2;
codercount = 0;
- for i in range(len(encoder_list_0)/2):
+ for i in range(len(encoder_list_0) // 2):
self.connect((self.deinterleaves_0[rootcount], 0), (self.generic_encoders_0[codercount], 0))
self.connect((self.deinterleaves_0[rootcount], 1), (self.generic_encoders_0[codercount + 1], 0))
rootcount += 1;
@@ -82,13 +87,13 @@ class capillary_threaded_encoder(gr.hier_block2):
codercount = 0;
- for i in range(len(encoder_list_0)/2):
+ for i in range(len(encoder_list_0) // 2):
self.connect((self.generic_encoders_0[codercount], 0), (self.interleaves_0[rootcount], 0))
self.connect((self.generic_encoders_0[codercount + 1], 0), (self.interleaves_0[rootcount], 1))
rootcount += 1;
codercount += 2;
- if((len(self.encoder_list_0)) > 1):
+ if((len(self.encoder_list_0)) > 1):
self.connect((self, 0), (self.deinterleaves_0[0], 0))
self.connect((self.interleaves_0[0], 0), (self, 0))
else:
diff --git a/gr-fec/python/fec/extended_async_encoder.py b/gr-fec/python/fec/extended_async_encoder.py
index fffe64aeb..cebd5c652 100644
--- a/gr-fec/python/fec/extended_async_encoder.py
+++ b/gr-fec/python/fec/extended_async_encoder.py
@@ -20,11 +20,18 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr
-import fec_swig as fec
-from bitflip import read_bitlist
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
import weakref
+from gnuradio import gr
+
+from . import fec_swig as fec
+from .bitflip import read_bitlist
+
+
class extended_async_encoder(gr.hier_block2):
def __init__(self, encoder_obj_list, puncpat=None):
gr.hier_block2.__init__(self, "extended_async_encoder",
diff --git a/gr-fec/python/fec/extended_decoder.py b/gr-fec/python/fec/extended_decoder.py
index 7e6cf452f..3c7ebefb4 100644
--- a/gr-fec/python/fec/extended_decoder.py
+++ b/gr-fec/python/fec/extended_decoder.py
@@ -20,24 +20,25 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, blocks
-import fec_swig as fec
-from bitflip import *
-import sys
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
-if sys.modules.has_key("gnuradio.digital"):
- digital = sys.modules["gnuradio.digital"]
-else:
- from gnuradio import digital
+from gnuradio import gr, blocks, digital
+
+from . import fec_swig as fec
+
+from .bitflip import *
+from .threaded_decoder import threaded_decoder
+from .capillary_threaded_decoder import capillary_threaded_decoder
-from threaded_decoder import threaded_decoder
-from capillary_threaded_decoder import capillary_threaded_decoder
class extended_decoder(gr.hier_block2):
#solution to log_(1-2*t)(1-2*.0335) = 1/taps where t is thresh (syndrome density)
#for i in numpy.arange(.1, .499, .01):
- #print str(log((1-(2 * .035)), (1-(2 * i)))) + ':' + str(i);
+ #print(str(log((1-(2 * .035)), (1-(2 * i)))) + ':' + str(i);)
garbletable = {
0.310786835319:0.1,
0.279118162802:0.11,
@@ -127,13 +128,13 @@ class extended_decoder(gr.hier_block2):
cat.append(i);
synd_garble = .49
- idx_list = self.garbletable.keys()
+ idx_list = list(self.garbletable.keys())
idx_list.sort()
for i in idx_list:
- if 1.0/self.ann.count('1') >= i:
+ if 1.0 / self.ann.count('1') >= i:
synd_garble = self.garbletable[i]
- print 'using syndrom garble threshold ' + str(synd_garble) + 'for conv_bit_corr_bb'
- print 'ceiling: .0335 data garble rate'
+ print('using syndrom garble threshold ' + str(synd_garble) + 'for conv_bit_corr_bb')
+ print('ceiling: .0335 data garble rate')
self.blocks.append(fec.conv_bit_corr_bb(cat, len(puncpat) - puncpat.count('0'),
len(ann), integration_period, flush, synd_garble))
diff --git a/gr-fec/python/fec/extended_encoder.py b/gr-fec/python/fec/extended_encoder.py
index 1c6da0ecb..992c2bdad 100644
--- a/gr-fec/python/fec/extended_encoder.py
+++ b/gr-fec/python/fec/extended_encoder.py
@@ -20,12 +20,16 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
from gnuradio import gr, blocks
-import fec_swig as fec
-from threaded_encoder import threaded_encoder
-from capillary_threaded_encoder import capillary_threaded_encoder
-from bitflip import read_bitlist
+from . import fec_swig as fec
+from .threaded_encoder import threaded_encoder
+from .capillary_threaded_encoder import capillary_threaded_encoder
+from .bitflip import read_bitlist
+
class extended_encoder(gr.hier_block2):
def __init__(self, encoder_obj_list, threading, puncpat=None):
diff --git a/gr-fec/python/fec/extended_tagged_decoder.py b/gr-fec/python/fec/extended_tagged_decoder.py
index 971390771..c119bf993 100644
--- a/gr-fec/python/fec/extended_tagged_decoder.py
+++ b/gr-fec/python/fec/extended_tagged_decoder.py
@@ -20,21 +20,23 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, blocks
-import fec_swig as fec
-from bitflip import *
-import sys
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
+from gnuradio import gr, blocks, digital
+
+from . import fec_swig as fec
+
+from .bitflip import *
-if sys.modules.has_key("gnuradio.digital"):
- digital = sys.modules["gnuradio.digital"]
-else:
- from gnuradio import digital
class extended_tagged_decoder(gr.hier_block2):
#solution to log_(1-2*t)(1-2*.0335) = 1/taps where t is thresh (syndrome density)
#for i in numpy.arange(.1, .499, .01):
- #print str(log((1-(2 * .035)), (1-(2 * i)))) + ':' + str(i);
+ #print(str(log((1-(2 * .035)), (1-(2 * i)))) + ':' + str(i);)
garbletable = {
0.310786835319:0.1,
0.279118162802:0.11,
@@ -136,13 +138,13 @@ class extended_tagged_decoder(gr.hier_block2):
cat.append(i);
synd_garble = .49
- idx_list = self.garbletable.keys()
+ idx_list = list(self.garbletable.keys())
idx_list.sort()
for i in idx_list:
- if 1.0/self.ann.count('1') >= i:
+ if 1.0 / self.ann.count('1') >= i:
synd_garble = self.garbletable[i]
- print 'using syndrom garble threshold ' + str(synd_garble) + 'for conv_bit_corr_bb'
- print 'ceiling: .0335 data garble rate'
+ print('using syndrom garble threshold ' + str(synd_garble) + 'for conv_bit_corr_bb')
+ print('ceiling: .0335 data garble rate')
self.blocks.append(fec.conv_bit_corr_bb(cat, len(puncpat) - puncpat.count('0'),
len(ann), integration_period, flush, synd_garble))
diff --git a/gr-fec/python/fec/extended_tagged_encoder.py b/gr-fec/python/fec/extended_tagged_encoder.py
index d3cf1d80d..9f4a684c4 100644
--- a/gr-fec/python/fec/extended_tagged_encoder.py
+++ b/gr-fec/python/fec/extended_tagged_encoder.py
@@ -20,10 +20,16 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
+
from gnuradio import gr, blocks
-import fec_swig as fec
-from bitflip import read_bitlist
+from . import fec_swig as fec
+
+from .bitflip import read_bitlist
+
class extended_tagged_encoder(gr.hier_block2):
def __init__(self, encoder_obj_list, puncpat=None, lentagname=None, mtu=1500):
diff --git a/gr-fec/python/fec/fec_test.py b/gr-fec/python/fec/fec_test.py
index 6466a0bcb..dfb5b1b28 100644
--- a/gr-fec/python/fec/fec_test.py
+++ b/gr-fec/python/fec/fec_test.py
@@ -20,18 +20,21 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio.fec.bitflip import read_bitlist
from gnuradio import gr, blocks, analog
import math
import sys
-if sys.modules.has_key("gnuradio.digital"):
+if "gnuradio.digital" in sys.modules:
digital = sys.modules["gnuradio.digital"]
else:
from gnuradio import digital
-from extended_encoder import extended_encoder
-from extended_decoder import extended_decoder
+from .extended_encoder import extended_encoder
+from .extended_decoder import extended_decoder
class fec_test(gr.hier_block2):
@@ -64,7 +67,7 @@ class fec_test(gr.hier_block2):
ann=None, puncpat=puncpat,
integration_period=10000, rotator=None)
- noise = math.sqrt((10.0**(-esno/10.0))/2.0)
+ noise = math.sqrt((10.0**(old_div(-esno / 10.0)),2.0))
#self.fastnoise = analog.fastnoise_source_f(analog.GR_GAUSSIAN, noise, seed, 8192)
self.fastnoise = analog.noise_source_f(analog.GR_GAUSSIAN, noise, seed)
self.addnoise = blocks.add_ff(1)
diff --git a/gr-fec/python/fec/polar/CMakeLists.txt b/gr-fec/python/fec/polar/CMakeLists.txt
index 1efed062f..2c126746e 100644
--- a/gr-fec/python/fec/polar/CMakeLists.txt
+++ b/gr-fec/python/fec/polar/CMakeLists.txt
@@ -27,6 +27,9 @@ GR_PYTHON_INSTALL(
channel_construction_awgn.py
channel_construction_bec.py
helper_functions.py
+ encoder.py
+ decoder.py
+ common.py
DESTINATION ${GR_PYTHON_DIR}/gnuradio/fec/polar
)
diff --git a/gr-fec/python/fec/polar/__init__.py b/gr-fec/python/fec/polar/__init__.py
index ce1b1459f..e06020b88 100644
--- a/gr-fec/python/fec/polar/__init__.py
+++ b/gr-fec/python/fec/polar/__init__.py
@@ -21,9 +21,12 @@
# turn this folder into a Python module
-import channel_construction as cc
-from channel_construction_bec import bhattacharyya_bounds
-from helper_functions import is_power_of_two
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import unicode_literals
+from . import channel_construction as cc
+from .channel_construction_bec import bhattacharyya_bounds
+from .helper_functions import is_power_of_two
CHANNEL_TYPE_AWGN = 'AWGN'
diff --git a/gr-fec/python/fec/polar/channel_construction.py b/gr-fec/python/fec/polar/channel_construction.py
index b7a3dee3b..d3b33fe3a 100644
--- a/gr-fec/python/fec/polar/channel_construction.py
+++ b/gr-fec/python/fec/polar/channel_construction.py
@@ -23,12 +23,14 @@
foundational paper for polar codes.
'''
+from __future__ import print_function
+from __future__ import absolute_import
-from channel_construction_bec import calculate_bec_channel_capacities
-from channel_construction_bec import design_snr_to_bec_eta
-from channel_construction_bec import bhattacharyya_bounds
-from channel_construction_awgn import tal_vardy_tpm_algorithm
-from helper_functions import *
+from .channel_construction_bec import calculate_bec_channel_capacities
+from .channel_construction_bec import design_snr_to_bec_eta
+from .channel_construction_bec import bhattacharyya_bounds
+from .channel_construction_awgn import tal_vardy_tpm_algorithm
+from .helper_functions import *
Z_PARAM_FIRST_HEADER_LINE = "Bhattacharyya parameters (Z-parameters) for a polar code"
@@ -117,7 +119,7 @@ def load_z_parameters(block_size, design_snr, mu):
def main():
np.set_printoptions(precision=3, linewidth=150)
- print 'channel construction Bhattacharyya bounds by Arikan'
+ print('channel construction Bhattacharyya bounds by Arikan')
n = 10
m = 2 ** n
k = m // 2
diff --git a/gr-fec/python/fec/polar/channel_construction_awgn.py b/gr-fec/python/fec/polar/channel_construction_awgn.py
index 7d820b288..c75f3d1c4 100755..100644
--- a/gr-fec/python/fec/polar/channel_construction_awgn.py
+++ b/gr-fec/python/fec/polar/channel_construction_awgn.py
@@ -18,6 +18,11 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
'''
Based on 2 papers:
[1] Ido Tal, Alexander Vardy: 'How To Construct Polar Codes', 2013
@@ -27,11 +32,10 @@ for an in-depth description of a widely used algorithm for channel construction.
for an overview of different approaches
'''
-
from scipy.optimize import fsolve
from scipy.special import erfc
-from helper_functions import *
-from channel_construction_bec import bhattacharyya_bounds
+from .helper_functions import *
+from .channel_construction_bec import bhattacharyya_bounds
def solver_equation(val, s):
@@ -190,7 +194,7 @@ def upper_convolve(tpm, mu):
idx = -1
for i in range(mu):
idx += 1
- q[0, idx] = (tpm[0, i] ** 2 + tpm[1, i] ** 2) / 2
+ q[0, idx] = (tpm[0 / i] ** 2 + tpm[1, i] ** 2, 2)
q[1, idx] = tpm[0, i] * tpm[1, i]
for j in range(i + 1, mu):
idx += 1
@@ -211,8 +215,8 @@ def lower_convolve(tpm, mu):
idx = -1
for i in range(0, mu):
idx += 1
- q[0, idx] = (tpm[0, i] ** 2) / 2
- q[1, idx] = (tpm[1, i] ** 2) / 2
+ q[0, idx] = (tpm[0 / i] ** 2, 2)
+ q[1, idx] = (tpm[1 / i] ** 2, 2)
if q[0, idx] < q[1, idx]:
q[0, idx], q[1, idx] = swap_values(q[0, idx], q[1, idx])
idx += 1
@@ -249,7 +253,7 @@ def normalize_q(q, tpm):
def main():
- print 'channel construction AWGN main'
+ print('channel construction AWGN main')
n = 8
m = 2 ** n
design_snr = 0.0
diff --git a/gr-fec/python/fec/polar/channel_construction_bec.py b/gr-fec/python/fec/polar/channel_construction_bec.py
index acad72003..d0ca4f84e 100644
--- a/gr-fec/python/fec/polar/channel_construction_bec.py
+++ b/gr-fec/python/fec/polar/channel_construction_bec.py
@@ -18,8 +18,13 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
import numpy as np
-import helper_functions as hf
+from . import helper_functions as hf
def bec_channel(eta):
@@ -220,7 +225,7 @@ def plot_capacity_histogram(design_snr, save_file=None):
def main():
- print 'channel construction main'
+ print('channel construction main')
n = 11
block_size = int(2 ** n)
design_snr = -1.59
diff --git a/gr-fec/python/fec/polar/common.py b/gr-fec/python/fec/polar/common.py
index fa5987b6d..8604f05ba 100644
--- a/gr-fec/python/fec/polar/common.py
+++ b/gr-fec/python/fec/polar/common.py
@@ -18,16 +18,20 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
import numpy as np
-from helper_functions import *
+from .helper_functions import *
'''
PolarCommon holds value checks and common initializer code for both Encoder and Decoder.
'''
-class PolarCommon:
+class PolarCommon(object):
def __init__(self, n, k, frozen_bit_position, frozenbits=None):
if not is_power_of_two(n):
raise ValueError("n={0} is not a power of 2!".format(n))
@@ -81,4 +85,4 @@ class PolarCommon:
return self._encode_efficient(vec)
def info_print(self):
- print "POLAR code ({0}, {1})".format(self.N, self.K)
+ print("POLAR code ({0}, {1})".format(self.N, self.K))
diff --git a/gr-fec/python/fec/polar/decoder.py b/gr-fec/python/fec/polar/decoder.py
index 8748d284f..5acd04aa7 100644
--- a/gr-fec/python/fec/polar/decoder.py
+++ b/gr-fec/python/fec/polar/decoder.py
@@ -18,11 +18,16 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
import numpy as np
-from common import PolarCommon
+from .common import PolarCommon
# for dev
-from encoder import PolarEncoder
+from .encoder import PolarEncoder
from matplotlib import pyplot as plt
@@ -239,31 +244,31 @@ def test_reverse_enc_dec():
encoder = PolarEncoder(n, k, frozenbitposition, frozenbits)
decoder = PolarDecoder(n, k, frozenbitposition, frozenbits)
encoded = encoder.encode(bits)
- print 'encoded:', encoded
+ print('encoded:', encoded)
rx = decoder.decode(encoded)
- print 'bits:', bits
- print 'rx :', rx
- print (bits == rx).all()
+ print('bits:', bits)
+ print('rx :', rx)
+ print((bits == rx).all())
def compare_decoder_impls():
- print '\nthis is decoder test'
+ print('\nthis is decoder test')
n = 8
k = 4
frozenbits = np.zeros(n - k)
# frozenbitposition16 = np.array((0, 1, 2, 3, 4, 5, 8, 9), dtype=int)
frozenbitposition = np.array((0, 1, 2, 4), dtype=int)
bits = np.random.randint(2, size=k)
- print 'bits:', bits
+ print('bits:', bits)
encoder = PolarEncoder(n, k, frozenbitposition, frozenbits)
decoder = PolarDecoder(n, k, frozenbitposition, frozenbits)
encoded = encoder.encode(bits)
- print 'encoded:', encoded
+ print('encoded:', encoded)
rx_st = decoder._lr_sc_decoder(encoded)
rx_eff = decoder._lr_sc_decoder_efficient(encoded)
- print 'standard :', rx_st
- print 'efficient:', rx_eff
- print (rx_st == rx_eff).all()
+ print('standard :', rx_st)
+ print('efficient:', rx_eff)
+ print((rx_st == rx_eff).all())
def main():
@@ -279,14 +284,14 @@ def main():
# decoder = PolarDecoder(n, k, frozenbitposition, frozenbits)
#
# bits = np.ones(k, dtype=int)
- # print "bits: ", bits
+ # print("bits: ", bits)
# evec = encoder.encode(bits)
- # print "froz: ", encoder._insert_frozen_bits(bits)
- # print "evec: ", evec
+ # print("froz: ", encoder._insert_frozen_bits(bits))
+ # print("evec: ", evec)
#
# evec[1] = 0
# deced = decoder._lr_sc_decoder(evec)
- # print 'SC decoded:', deced
+ # print('SC decoded:', deced)
#
# test_reverse_enc_dec()
# compare_decoder_impls()
diff --git a/gr-fec/python/fec/polar/encoder.py b/gr-fec/python/fec/polar/encoder.py
index cc8fda2d1..c5c7c05d5 100644
--- a/gr-fec/python/fec/polar/encoder.py
+++ b/gr-fec/python/fec/polar/encoder.py
@@ -18,9 +18,13 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
import numpy as np
-from common import PolarCommon
-import helper_functions as hf
+from .common import PolarCommon
+from . import helper_functions as hf
class PolarEncoder(PolarCommon):
@@ -99,8 +103,8 @@ def test_pseudo_rate_1_encoder(encoder, ntests, k):
u_hat = encoder._encode_efficient(fenc)
if not (u_hat == u).all():
print('rate-1 encoder/decoder failed')
- print u
- print u_hat
+ print(u)
+ print(u_hat)
return False
return True
@@ -114,11 +118,11 @@ def test_encoder_impls():
# frozenbitposition8 = np.array((0, 1, 2, 4), dtype=int) # keep it!
frozenbitposition = np.array((0, 1, 2, 3, 4, 5, 8, 9), dtype=int)
encoder = PolarEncoder(n, k, frozenbitposition) #, frozenbits)
- print 'result:', compare_results(encoder, ntests, k)
+ print('result:', compare_results(encoder, ntests, k))
print('Test rate-1 encoder/decoder chain results')
r1_test = test_pseudo_rate_1_encoder(encoder, ntests, k)
- print 'Test rate-1 encoder/decoder:', r1_test
+ print('Test rate-1 encoder/decoder:', r1_test)
test_systematic_encoder(encoder, ntests, k)
diff --git a/gr-fec/python/fec/polar/helper_functions.py b/gr-fec/python/fec/polar/helper_functions.py
index a4ecb1f0f..147023a59 100644
--- a/gr-fec/python/fec/polar/helper_functions.py
+++ b/gr-fec/python/fec/polar/helper_functions.py
@@ -18,6 +18,10 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
import numpy as np
import time, sys
import copy
@@ -33,7 +37,7 @@ def bsc_channel(p):
p denotes an erroneous transition
'''
if not (p >= 0.0 and p <= 1.0):
- print "given p is out of range!"
+ print("given p is out of range!")
return np.array([], dtype=float)
# 0 -> 0, 0 -> 1, 1 -> 0, 1 -> 1
@@ -99,7 +103,7 @@ def get_Fn(n):
def get_Gn(n):
# this matrix is called generator matrix
if not is_power_of_two(n):
- print "invalid input"
+ print("invalid input")
return None
if n == 1:
return np.array([1, ])
@@ -177,7 +181,7 @@ def bhattacharyya_parameter(w):
def main():
- print 'helper functions'
+ print('helper functions')
for i in range(9):
print(i, 'is power of 2: ', is_power_of_two(i))
diff --git a/gr-fec/python/fec/polar/testbed.py b/gr-fec/python/fec/polar/testbed.py
index 3f8e814e4..08ef0de55 100755..100644
--- a/gr-fec/python/fec/polar/testbed.py
+++ b/gr-fec/python/fec/polar/testbed.py
@@ -18,11 +18,16 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
-from encoder import PolarEncoder
-from decoder import PolarDecoder
-import channel_construction as cc
-from helper_functions import *
+
+from .encoder import PolarEncoder
+from .decoder import PolarDecoder
+from . import channel_construction as cc
+from .helper_functions import *
import matplotlib.pyplot as plt
@@ -58,13 +63,13 @@ def is_equal(first, second):
if not (first == second).all():
result = first == second
for i in range(len(result)):
- print '{0:4}: {1:2} == {2:1} = {3}'.format(i, first[i], second[i], result[i])
+ print('{0:4}: {1:2} == {2:1} = {3}'.format(i, first[i], second[i], result[i]))
return False
return True
def exact_value(la, lb):
- return np.log((np.exp(la + lb) + 1) / (np.exp(la) + np.exp(lb)))
+ return np.log((np.exp(la + lb) + 1) / (np.exp(la + np.exp(lb))))
def approx_value(la, lb):
@@ -112,7 +117,7 @@ def test_1024_rate_1_code():
recv = decoder.decode(rx)
channel_counter += (bits == recv)
- print channel_counter
+ print(channel_counter)
print(np.min(channel_counter), np.max(channel_counter))
np.save('channel_counter_' + str(ntests) + '.npy', channel_counter)
@@ -330,7 +335,7 @@ def main():
# frozenbits = np.zeros(n - k)
# frozenbitposition8 = np.array((0, 1, 2, 4), dtype=int)
# frozenbitposition = np.array((0, 1, 2, 3, 4, 5, 8, 9), dtype=int)
- # print frozenbitposition
+ # print(frozenbitposition)
# test_enc_dec_chain()
# test_1024_rate_1_code()
diff --git a/gr-fec/python/fec/qa_ber_bf.py b/gr-fec/python/fec/qa_ber_bf.py
index 5d1734de0..0d720988c 100644
--- a/gr-fec/python/fec/qa_ber_bf.py
+++ b/gr-fec/python/fec/qa_ber_bf.py
@@ -20,11 +20,15 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gr_unittest, blocks
-import fec_swig as fec
+from __future__ import print_function
+
+
import numpy
import copy
+from gnuradio import gr, gr_unittest, blocks
+from gnuradio import fec
+
class test_ber_bf(gr_unittest.TestCase):
def setUp(self):
@@ -132,8 +136,8 @@ class test_ber_bf(gr_unittest.TestCase):
data = dst.data()
expected_result = [-2.0, ]
- print data
- print expected_result
+ print(data)
+ print(expected_result)
self.assertFloatTuplesAlmostEqual(expected_result, data, 5)
diff --git a/gr-fec/python/fec/qa_depuncture.py b/gr-fec/python/fec/qa_depuncture.py
index 5566e83a2..9ec57bfc4 100644
--- a/gr-fec/python/fec/qa_depuncture.py
+++ b/gr-fec/python/fec/qa_depuncture.py
@@ -20,11 +20,14 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gr_unittest
-import fec_swig as fec
-import blocks_swig as blocks
+from __future__ import division
+
from collections import deque
+from gnuradio import gr, gr_unittest, blocks
+from gnuradio import fec
+
+
class test_depuncture (gr_unittest.TestCase):
def depuncture_setup(self):
@@ -37,7 +40,7 @@ class test_depuncture (gr_unittest.TestCase):
k = 0
self.expected = []
- for n in range(len(self.src_data)/(self.puncsize - self.puncholes)):
+ for n in range(len(self.src_data) // (self.puncsize - self.puncholes)):
for i in range(self.puncsize):
if _puncpat[i] == 1:
self.expected.append(self.src_data[k]);
@@ -46,7 +49,7 @@ class test_depuncture (gr_unittest.TestCase):
self.expected.append(self.sym)
def setUp(self):
- self.src_data = 2000*range(64)
+ self.src_data = 2000*list(range(64))
self.tb = gr.top_block ()
def tearDown(self):
@@ -64,15 +67,15 @@ class test_depuncture (gr_unittest.TestCase):
self.depuncture_setup()
src = blocks.vector_source_b(self.src_data)
- op = fec.depuncture_bb(self.puncsize, self.puncpat,
+ op = fec.depuncture_bb(self.puncsize, self.puncpat,
self.delay, self.sym)
- dst = blocks.vector_sink_b()
+ dst = blocks.vector_sink_b()
- self.tb.connect(src, op, dst)
- self.tb.run()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
- dst_data = list(dst.data())
- for i in xrange(len(dst_data)):
+ dst_data = list(dst.data())
+ for i in range(len(dst_data)):
dst_data[i] = int(dst_data[i])
self.assertEqual(self.expected, dst_data)
@@ -89,15 +92,15 @@ class test_depuncture (gr_unittest.TestCase):
self.depuncture_setup()
src = blocks.vector_source_b(self.src_data)
- op = fec.depuncture_bb(self.puncsize, self.puncpat,
+ op = fec.depuncture_bb(self.puncsize, self.puncpat,
self.delay, self.sym)
- dst = blocks.vector_sink_b()
+ dst = blocks.vector_sink_b()
- self.tb.connect(src, op, dst)
- self.tb.run()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
- dst_data = list(dst.data())
- for i in xrange(len(dst_data)):
+ dst_data = list(dst.data())
+ for i in range(len(dst_data)):
dst_data[i] = int(dst_data[i])
self.assertEqual(self.expected, dst_data)
@@ -115,15 +118,15 @@ class test_depuncture (gr_unittest.TestCase):
self.depuncture_setup()
src = blocks.vector_source_b(self.src_data)
- op = fec.depuncture_bb(self.puncsize, self.puncpat,
+ op = fec.depuncture_bb(self.puncsize, self.puncpat,
self.delay, self.sym)
- dst = blocks.vector_sink_b()
+ dst = blocks.vector_sink_b()
- self.tb.connect(src, op, dst)
- self.tb.run()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
- dst_data = list(dst.data())
- for i in xrange(len(dst_data)):
+ dst_data = list(dst.data())
+ for i in range(len(dst_data)):
dst_data[i] = int(dst_data[i])
self.assertEqual(self.expected, dst_data)
@@ -141,23 +144,23 @@ class test_depuncture (gr_unittest.TestCase):
self.sym = 0
src = blocks.vector_source_b(self.src_data)
- op0 = fec.depuncture_bb(self.puncsize, self.puncpat0,
+ op0 = fec.depuncture_bb(self.puncsize, self.puncpat0,
self.delay, self.sym)
- op1 = fec.depuncture_bb(self.puncsize, self.puncpat1,
+ op1 = fec.depuncture_bb(self.puncsize, self.puncpat1,
self.delay, self.sym)
- dst0 = blocks.vector_sink_b()
- dst1 = blocks.vector_sink_b()
+ dst0 = blocks.vector_sink_b()
+ dst1 = blocks.vector_sink_b()
- self.tb.connect(src, op0, dst0)
- self.tb.connect(src, op1, dst1)
- self.tb.run()
+ self.tb.connect(src, op0, dst0)
+ self.tb.connect(src, op1, dst1)
+ self.tb.run()
- dst_data0 = list(dst0.data())
- for i in xrange(len(dst_data0)):
+ dst_data0 = list(dst0.data())
+ for i in range(len(dst_data0)):
dst_data0[i] = int(dst_data0[i])
- dst_data1 = list(dst1.data())
- for i in xrange(len(dst_data1)):
+ dst_data1 = list(dst1.data())
+ for i in range(len(dst_data1)):
dst_data1[i] = int(dst_data1[i])
self.assertEqual(dst_data1, dst_data0)
@@ -175,15 +178,15 @@ class test_depuncture (gr_unittest.TestCase):
self.depuncture_setup()
src = blocks.vector_source_b(self.src_data)
- op = fec.depuncture_bb(self.puncsize, self.puncpat,
+ op = fec.depuncture_bb(self.puncsize, self.puncpat,
self.delay)
- dst = blocks.vector_sink_b()
+ dst = blocks.vector_sink_b()
- self.tb.connect(src, op, dst)
- self.tb.run()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
- dst_data = list(dst.data())
- for i in xrange(len(dst_data)):
+ dst_data = list(dst.data())
+ for i in range(len(dst_data)):
dst_data[i] = int(dst_data[i])
self.assertEqual(self.expected, dst_data)
diff --git a/gr-fec/python/fec/qa_ecc_ccsds_27.py b/gr-fec/python/fec/qa_ecc_ccsds_27.py
index 895e68334..6656c9d3a 100755..100644
--- a/gr-fec/python/fec/qa_ecc_ccsds_27.py
+++ b/gr-fec/python/fec/qa_ecc_ccsds_27.py
@@ -20,9 +20,10 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gr_unittest
-import fec_swig as fec
-import blocks_swig as blocks
+
+from gnuradio import gr, gr_unittest, blocks
+from gnuradio import fec
+
class test_ccsds_27 (gr_unittest.TestCase):
@@ -34,17 +35,17 @@ class test_ccsds_27 (gr_unittest.TestCase):
def xtest_ccsds_27 (self):
src_data = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
- expected = (0, 0, 0, 0, 1, 2, 3, 4, 5, 6)
+ expected = (0, 0, 0, 0, 1, 2, 3, 4, 5, 6)
src = blocks.vector_source_b(src_data)
- enc = fec.encode_ccsds_27_bb()
- b2f = blocks.char_to_float()
- add = blocks.add_const_ff(-0.5)
- mul = blocks.multiply_const_ff(2.0)
- dec = fec.decode_ccsds_27_fb()
- dst = blocks.vector_sink_b()
- self.tb.connect(src, enc, b2f, add, mul, dec, dst)
- self.tb.run()
- dst_data = dst.data()
+ enc = fec.encode_ccsds_27_bb()
+ b2f = blocks.char_to_float()
+ add = blocks.add_const_ff(-0.5)
+ mul = blocks.multiply_const_ff(2.0)
+ dec = fec.decode_ccsds_27_fb()
+ dst = blocks.vector_sink_b()
+ self.tb.connect(src, enc, b2f, add, mul, dec, dst)
+ self.tb.run()
+ dst_data = dst.data()
self.assertEqual(expected, dst_data)
diff --git a/gr-fec/python/fec/qa_fecapi_cc.py b/gr-fec/python/fec/qa_fecapi_cc.py
index bbd500161..053f671a0 100644
--- a/gr-fec/python/fec/qa_fecapi_cc.py
+++ b/gr-fec/python/fec/qa_fecapi_cc.py
@@ -20,12 +20,14 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import absolute_import
+
+
from gnuradio import gr, gr_unittest
-import fec_swig as fec
+from gnuradio import fec
+
from _qa_helper import _qa_helper
-from extended_encoder import extended_encoder
-from extended_decoder import extended_decoder
class test_fecapi_cc(gr_unittest.TestCase):
@@ -91,8 +93,8 @@ class test_fecapi_cc(gr_unittest.TestCase):
k = 7
rate = 2
polys = [109,79]
- enc = map((lambda a: fec.cc_encoder_make(frame_size*8, k, rate, polys)), range(0,1))
- dec = map((lambda a: fec.cc_decoder.make(frame_size*8, k, rate, polys)), range(0,1))
+ enc = list(map((lambda a: fec.cc_encoder_make(frame_size*8, k, rate, polys)), list(range(0,1))))
+ dec = list(map((lambda a: fec.cc_decoder.make(frame_size*8, k, rate, polys)), list(range(0,1))))
threading = None
self.test = _qa_helper(5*frame_size, enc, dec, threading)
self.tb.connect(self.test)
@@ -108,8 +110,8 @@ class test_fecapi_cc(gr_unittest.TestCase):
k = 7
rate = 2
polys = [109,79]
- enc = map((lambda a: fec.cc_encoder_make(frame_size*8, k, rate, polys)), range(0,1))
- dec = map((lambda a: fec.cc_decoder.make(frame_size*8, k, rate, polys)), range(0,1))
+ enc = list(map((lambda a: fec.cc_encoder_make(frame_size*8, k, rate, polys)), list(range(0,1))))
+ dec = list(map((lambda a: fec.cc_decoder.make(frame_size*8, k, rate, polys)), list(range(0,1))))
threading = 'ordinary'
self.test = _qa_helper(5*frame_size, enc, dec, threading)
self.tb.connect(self.test)
@@ -125,8 +127,8 @@ class test_fecapi_cc(gr_unittest.TestCase):
k = 7
rate = 2
polys = [109,79]
- enc = map((lambda a: fec.cc_encoder_make(frame_size*8, k, rate, polys)), range(0,1))
- dec = map((lambda a: fec.cc_decoder.make(frame_size*8, k, rate, polys)), range(0,1))
+ enc = list(map((lambda a: fec.cc_encoder_make(frame_size*8, k, rate, polys)), list(range(0,1))))
+ dec = list(map((lambda a: fec.cc_decoder.make(frame_size*8, k, rate, polys)), list(range(0,1))))
threading = 'capillary'
self.test = _qa_helper(5*frame_size, enc, dec, threading)
self.tb.connect(self.test)
@@ -143,8 +145,8 @@ class test_fecapi_cc(gr_unittest.TestCase):
rate = 2
polys = [109,79]
mode = fec.CC_TERMINATED
- enc = map((lambda a: fec.cc_encoder_make(frame_size*8, k, rate, polys, mode=mode)), range(0,4))
- dec = map((lambda a: fec.cc_decoder.make(frame_size*8, k, rate, polys, mode=mode)), range(0,4))
+ enc = list(map((lambda a: fec.cc_encoder_make(frame_size*8, k, rate, polys, mode=mode)), list(range(0,4))))
+ dec = list(map((lambda a: fec.cc_decoder.make(frame_size*8, k, rate, polys, mode=mode)), list(range(0,4))))
threading = 'capillary'
self.test = _qa_helper(4*frame_size, enc, dec, threading)
self.tb.connect(self.test)
@@ -161,8 +163,8 @@ class test_fecapi_cc(gr_unittest.TestCase):
rate = 2
polys = [109,79]
mode = fec.CC_TRUNCATED
- enc = map((lambda a: fec.cc_encoder_make(frame_size*8, k, rate, polys, mode=mode)), range(0,4))
- dec = map((lambda a: fec.cc_decoder.make(frame_size*8, k, rate, polys, mode=mode)), range(0,4))
+ enc = list(map((lambda a: fec.cc_encoder_make(frame_size*8, k, rate, polys, mode=mode)), list(range(0,4))))
+ dec = list(map((lambda a: fec.cc_decoder.make(frame_size*8, k, rate, polys, mode=mode)), list(range(0,4))))
threading = 'capillary'
self.test = _qa_helper(4*frame_size, enc, dec, threading)
self.tb.connect(self.test)
@@ -179,8 +181,8 @@ class test_fecapi_cc(gr_unittest.TestCase):
rate = 2
polys = [109,79]
mode = fec.CC_TAILBITING
- enc = map((lambda a: fec.cc_encoder_make(frame_size*8, k, rate, polys, mode=mode)), range(0,4))
- dec = map((lambda a: fec.cc_decoder.make(frame_size*8, k, rate, polys, mode=mode)), range(0,4))
+ enc = list(map((lambda a: fec.cc_encoder_make(frame_size*8, k, rate, polys, mode=mode)), list(range(0,4))))
+ dec = list(map((lambda a: fec.cc_decoder.make(frame_size*8, k, rate, polys, mode=mode)), list(range(0,4))))
threading = 'capillary'
self.test = _qa_helper(4*frame_size, enc, dec, threading)
self.tb.connect(self.test)
diff --git a/gr-fec/python/fec/qa_fecapi_dummy.py b/gr-fec/python/fec/qa_fecapi_dummy.py
index 9471c71d7..368014d89 100644
--- a/gr-fec/python/fec/qa_fecapi_dummy.py
+++ b/gr-fec/python/fec/qa_fecapi_dummy.py
@@ -20,13 +20,17 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import absolute_import
+
+import numpy as np
+
from gnuradio import gr, gr_unittest, blocks
-import fec_swig as fec
+from gnuradio import fec
+from fec import extended_encoder
+from fec import extended_decoder
+
from _qa_helper import _qa_helper
-import numpy as np
-from extended_encoder import extended_encoder
-from extended_decoder import extended_decoder
class test_fecapi_dummy(gr_unittest.TestCase):
@@ -80,8 +84,8 @@ class test_fecapi_dummy(gr_unittest.TestCase):
def test_parallelism1_00(self):
frame_size = 30
- enc = map((lambda a: fec.dummy_encoder_make(frame_size*8)), range(0,1))
- dec = map((lambda a: fec.dummy_decoder.make(frame_size*8)), range(0,1))
+ enc = list(map((lambda a: fec.dummy_encoder_make(frame_size*8)), list(range(0,1))))
+ dec = list(map((lambda a: fec.dummy_decoder.make(frame_size*8)), list(range(0,1))))
threading = None
self.test = _qa_helper(10*frame_size, enc, dec, threading)
self.tb.connect(self.test)
@@ -94,8 +98,8 @@ class test_fecapi_dummy(gr_unittest.TestCase):
def test_parallelism1_01(self):
frame_size = 30
- enc = map((lambda a: fec.dummy_encoder_make(frame_size*8)), range(0,1))
- dec = map((lambda a: fec.dummy_decoder.make(frame_size*8)), range(0,1))
+ enc = list(map((lambda a: fec.dummy_encoder_make(frame_size*8)), list(range(0,1))))
+ dec = list(map((lambda a: fec.dummy_decoder.make(frame_size*8)), list(range(0,1))))
threading = 'ordinary'
self.test = _qa_helper(10*frame_size, enc, dec, threading)
self.tb.connect(self.test)
@@ -108,8 +112,8 @@ class test_fecapi_dummy(gr_unittest.TestCase):
def test_parallelism1_02(self):
frame_size = 300
- enc = map((lambda a: fec.dummy_encoder_make(frame_size*8)), range(0,1))
- dec = map((lambda a: fec.dummy_decoder.make(frame_size*8)), range(0,1))
+ enc = list(map((lambda a: fec.dummy_encoder_make(frame_size*8)), list(range(0,1))))
+ dec = list(map((lambda a: fec.dummy_decoder.make(frame_size*8)), list(range(0,1))))
threading = 'capillary'
self.test = _qa_helper(10*frame_size, enc, dec, threading)
self.tb.connect(self.test)
@@ -123,8 +127,8 @@ class test_fecapi_dummy(gr_unittest.TestCase):
def test_parallelism1_03(self):
frame_size = 30
dims = 10
- enc = map((lambda a: fec.dummy_encoder_make(frame_size*8)), range(0,dims))
- dec = map((lambda a: fec.dummy_decoder.make(frame_size*8)), range(0,dims))
+ enc = list(map((lambda a: fec.dummy_encoder_make(frame_size*8)), list(range(0,dims))))
+ dec = list(map((lambda a: fec.dummy_decoder.make(frame_size*8)), list(range(0,dims))))
threading = 'ordinary'
self.test = _qa_helper(dims*frame_size, enc, dec, threading)
self.tb.connect(self.test)
@@ -138,8 +142,8 @@ class test_fecapi_dummy(gr_unittest.TestCase):
def test_parallelism1_04(self):
frame_size = 30
dims = 16
- enc = map((lambda a: fec.dummy_encoder_make(frame_size*8)), range(0,dims))
- dec = map((lambda a: fec.dummy_decoder.make(frame_size*8)), range(0,dims))
+ enc = list(map((lambda a: fec.dummy_encoder_make(frame_size*8)), list(range(0,dims))))
+ dec = list(map((lambda a: fec.dummy_decoder.make(frame_size*8)), list(range(0,dims))))
threading = 'capillary'
self.test = _qa_helper(dims*frame_size, enc, dec, threading)
self.tb.connect(self.test)
@@ -153,7 +157,7 @@ class test_fecapi_dummy(gr_unittest.TestCase):
def test_parallelism1_05(self):
frame_size = 30
dims = 5
- enc = map((lambda a: fec.dummy_encoder_make(frame_size*8)), range(0,dims))
+ enc = list(map((lambda a: fec.dummy_encoder_make(frame_size*8)), list(range(0,dims))))
#dec = map((lambda a: fec.dummy_decoder.make(frame_size*8)), range(0,dims))
threading = 'capillary'
@@ -163,7 +167,7 @@ class test_fecapi_dummy(gr_unittest.TestCase):
frame_size = 30
dims = 5
#enc = map((lambda a: fec.dummy_encoder_make(frame_size*8)), range(0,dims))
- dec = map((lambda a: fec.dummy_decoder.make(frame_size*8)), range(0,dims))
+ dec = list(map((lambda a: fec.dummy_decoder.make(frame_size*8)), list(range(0,dims))))
threading = 'capillary'
self.assertRaises(AttributeError, lambda: extended_decoder(dec, threading=threading, puncpat="11"))
@@ -172,7 +176,7 @@ class test_fecapi_dummy(gr_unittest.TestCase):
frame_size = 30
dims1 = 16
dims2 = 16
- enc = map((lambda b: map((lambda a: fec.dummy_encoder_make(frame_size*8)), range(0,dims1))), range(0,dims2))
+ enc = list(map((lambda b: list(map((lambda a: fec.dummy_encoder_make(frame_size*8)), list(range(0,dims1))))), list(range(0,dims2))))
#dec = map((lambda b: map((lambda a: fec.dummy_decoder_make(frame_size*8)), range(0,dims1))), range(0,dims2))
threading = 'capillary'
@@ -182,7 +186,7 @@ class test_fecapi_dummy(gr_unittest.TestCase):
frame_size = 30
dims1 = 16
dims2 = 16
- dec = map((lambda b: map((lambda a: fec.dummy_decoder_make(frame_size*8)), range(0,dims1))), range(0,dims2))
+ dec = list(map((lambda b: list(map((lambda a: fec.dummy_decoder_make(frame_size*8)), list(range(0,dims1))))), list(range(0,dims2))))
threading = 'capillary'
self.assertRaises(AttributeError, lambda: extended_decoder(dec, threading=threading, puncpat="11"))
@@ -193,6 +197,7 @@ class test_fecapi_dummy(gr_unittest.TestCase):
frame_size = 32
data = np.random.randint(0, 2, n_frames * frame_size)
+ data.dtype = np.uint8
packed_data = np.packbits(data)
tb = gr.top_block()
diff --git a/gr-fec/python/fec/qa_fecapi_ldpc.py b/gr-fec/python/fec/qa_fecapi_ldpc.py
index b45ce0ee1..758a26469 100644
--- a/gr-fec/python/fec/qa_fecapi_ldpc.py
+++ b/gr-fec/python/fec/qa_fecapi_ldpc.py
@@ -20,15 +20,19 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gr_unittest
-import fec_swig as fec
-from _qa_helper import _qa_helper
+from __future__ import absolute_import
-from extended_encoder import extended_encoder
-from extended_decoder import extended_decoder
import os
+from gnuradio import gr, gr_unittest
+from gnuradio import fec
+from fec import extended_encoder
+from fec import extended_decoder
+
+from _qa_helper import _qa_helper
+
+
# Get location of the alist files. If run in 'ctest' or 'make test',
# the shell script sets srcdir. Otherwise, we assume we're running
# from the current directory and know where to go.
@@ -131,8 +135,8 @@ class test_fecapi_ldpc(gr_unittest.TestCase):
gap = 4
LDPC_matrix_object = fec.ldpc_H_matrix(filename, gap)
k = LDPC_matrix_object.k()
- enc = map((lambda a: fec.ldpc_par_mtrx_encoder.make_H(LDPC_matrix_object)), range(0,1))
- dec = map((lambda a: fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object.get_base_sptr())), range(0,1))
+ enc = list(map((lambda a: fec.ldpc_par_mtrx_encoder.make_H(LDPC_matrix_object)), list(range(0,1))))
+ dec = list(map((lambda a: fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object.get_base_sptr())), list(range(0,1))))
threading = None
self.test = _qa_helper(10*k, enc, dec, threading)
self.tb.connect(self.test)
@@ -148,8 +152,8 @@ class test_fecapi_ldpc(gr_unittest.TestCase):
gap = 4
LDPC_matrix_object = fec.ldpc_H_matrix(filename, gap)
k = LDPC_matrix_object.k()
- enc = map((lambda a: fec.ldpc_par_mtrx_encoder.make_H(LDPC_matrix_object)), range(0,1))
- dec = map((lambda a: fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object.get_base_sptr())), range(0,1))
+ enc = list(map((lambda a: fec.ldpc_par_mtrx_encoder.make_H(LDPC_matrix_object)), list(range(0,1))))
+ dec = list(map((lambda a: fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object.get_base_sptr())), list(range(0,1))))
threading = 'ordinary'
self.test = _qa_helper(10*k, enc, dec, threading)
self.tb.connect(self.test)
@@ -165,8 +169,8 @@ class test_fecapi_ldpc(gr_unittest.TestCase):
gap = 4
LDPC_matrix_object = fec.ldpc_H_matrix(filename, gap)
k = LDPC_matrix_object.k()
- enc = map((lambda a: fec.ldpc_par_mtrx_encoder.make_H(LDPC_matrix_object)), range(0,1))
- dec = map((lambda a: fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object.get_base_sptr())), range(0,1))
+ enc = list(map((lambda a: fec.ldpc_par_mtrx_encoder.make_H(LDPC_matrix_object)), list(range(0,1))))
+ dec = list(map((lambda a: fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object.get_base_sptr())), list(range(0,1))))
threading = 'capillary'
self.test = _qa_helper(10*k, enc, dec, threading)
self.tb.connect(self.test)
@@ -255,7 +259,7 @@ class test_fecapi_ldpc(gr_unittest.TestCase):
dims = 5
LDPC_matrix_object = fec.ldpc_H_matrix(filename, gap)
k = LDPC_matrix_object.k()
- dec = map((lambda a: fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object.get_base_sptr())), range(0,dims))
+ dec = list(map((lambda a: fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object.get_base_sptr())), list(range(0,dims))))
threading = 'capillary'
self.assertRaises(AttributeError, lambda: extended_decoder(dec, threading=threading, puncpat="11"))
@@ -267,8 +271,8 @@ class test_fecapi_ldpc(gr_unittest.TestCase):
k = LDPC_matrix_object.k()
dims1 = 16
dims2 = 16
- enc = map((lambda b: map((lambda a: fec.ldpc_par_mtrx_encoder.make_H(LDPC_matrix_object)),
- range(0,dims1))), range(0,dims2))
+ enc = list(map((lambda b: list(map((lambda a: fec.ldpc_par_mtrx_encoder.make_H(LDPC_matrix_object)),
+ list(range(0,dims1))))), list(range(0,dims2))))
threading = 'capillary'
self.assertRaises(AttributeError, lambda: extended_encoder(enc, threading=threading, puncpat="11"))
@@ -281,8 +285,8 @@ class test_fecapi_ldpc(gr_unittest.TestCase):
k = LDPC_matrix_object.k()
dims1 = 16
dims2 = 16
- enc = map((lambda b: map((lambda a: fec.ldpc_par_mtrx_encoder.make_H(LDPC_matrix_object)),
- range(0,dims1))), range(0,dims2))
+ enc = list(map((lambda b: list(map((lambda a: fec.ldpc_par_mtrx_encoder.make_H(LDPC_matrix_object)),
+ list(range(0,dims1))))), list(range(0,dims2))))
threading = 'capillary'
self.assertRaises(AttributeError, lambda: extended_encoder(enc, threading=threading, puncpat="11"))
@@ -295,8 +299,8 @@ class test_fecapi_ldpc(gr_unittest.TestCase):
k = LDPC_matrix_object.k()
dims1 = 16
dims2 = 16
- dec = map((lambda b: map((lambda a: fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object.get_base_sptr())),
- range(0,dims1))), range(0,dims2))
+ dec = list(map((lambda b: list(map((lambda a: fec.ldpc_bit_flip_decoder.make(LDPC_matrix_object.get_base_sptr())),
+ list(range(0,dims1))))), list(range(0,dims2))))
threading = 'capillary'
self.assertRaises(AttributeError, lambda: extended_decoder(dec, threading=threading, puncpat="11"))
diff --git a/gr-fec/python/fec/qa_fecapi_repetition.py b/gr-fec/python/fec/qa_fecapi_repetition.py
index 7998d61bd..650aab701 100644
--- a/gr-fec/python/fec/qa_fecapi_repetition.py
+++ b/gr-fec/python/fec/qa_fecapi_repetition.py
@@ -20,12 +20,15 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import absolute_import
+
+
+
from gnuradio import gr, gr_unittest
-import fec_swig as fec
+from gnuradio import fec
+
from _qa_helper import _qa_helper
-from extended_encoder import extended_encoder
-from extended_decoder import extended_decoder
class test_fecapi_repetition(gr_unittest.TestCase):
@@ -83,8 +86,8 @@ class test_fecapi_repetition(gr_unittest.TestCase):
def test_parallelism1_00(self):
frame_size = 30
rep = 3
- enc = map((lambda a: fec.repetition_encoder_make(frame_size*8, rep)), range(0,1))
- dec = map((lambda a: fec.repetition_decoder.make(frame_size*8, rep)), range(0,1))
+ enc = list(map((lambda a: fec.repetition_encoder_make(frame_size*8, rep)), list(range(0,1))))
+ dec = list(map((lambda a: fec.repetition_decoder.make(frame_size*8, rep)), list(range(0,1))))
threading = None
self.test = _qa_helper(10*frame_size, enc, dec, threading)
self.tb.connect(self.test)
@@ -98,8 +101,8 @@ class test_fecapi_repetition(gr_unittest.TestCase):
def test_parallelism1_01(self):
frame_size = 30
rep = 3
- enc = map((lambda a: fec.repetition_encoder_make(frame_size*8, rep)), range(0,1))
- dec = map((lambda a: fec.repetition_decoder.make(frame_size*8, rep)), range(0,1))
+ enc = list(map((lambda a: fec.repetition_encoder_make(frame_size*8, rep)), list(range(0,1))))
+ dec = list(map((lambda a: fec.repetition_decoder.make(frame_size*8, rep)), list(range(0,1))))
threading = 'ordinary'
self.test = _qa_helper(10*frame_size, enc, dec, threading)
self.tb.connect(self.test)
@@ -113,8 +116,8 @@ class test_fecapi_repetition(gr_unittest.TestCase):
def test_parallelism1_02(self):
frame_size = 300
rep = 3
- enc = map((lambda a: fec.repetition_encoder_make(frame_size*8, rep)), range(0,1))
- dec = map((lambda a: fec.repetition_decoder.make(frame_size*8, rep)), range(0,1))
+ enc = list(map((lambda a: fec.repetition_encoder_make(frame_size*8, rep)), list(range(0,1))))
+ dec = list(map((lambda a: fec.repetition_decoder.make(frame_size*8, rep)), list(range(0,1))))
threading = 'capillary'
self.test = _qa_helper(10*frame_size, enc, dec, threading)
self.tb.connect(self.test)
@@ -129,8 +132,8 @@ class test_fecapi_repetition(gr_unittest.TestCase):
frame_size = 30
rep = 3
dims = 10
- enc = map((lambda a: fec.repetition_encoder_make(frame_size*8, rep)), range(0,dims))
- dec = map((lambda a: fec.repetition_decoder.make(frame_size*8, rep)), range(0,dims))
+ enc = list(map((lambda a: fec.repetition_encoder_make(frame_size*8, rep)), list(range(0,dims))))
+ dec = list(map((lambda a: fec.repetition_decoder.make(frame_size*8, rep)), list(range(0,dims))))
threading = 'ordinary'
self.test = _qa_helper(dims*frame_size, enc, dec, threading)
self.tb.connect(self.test)
@@ -145,8 +148,8 @@ class test_fecapi_repetition(gr_unittest.TestCase):
frame_size = 30
rep = 3
dims = 16
- enc = map((lambda a: fec.repetition_encoder_make(frame_size*8, rep)), range(0,dims))
- dec = map((lambda a: fec.repetition_decoder.make(frame_size*8, rep)), range(0,dims))
+ enc = list(map((lambda a: fec.repetition_encoder_make(frame_size*8, rep)), list(range(0,dims))))
+ dec = list(map((lambda a: fec.repetition_decoder.make(frame_size*8, rep)), list(range(0,dims))))
threading = 'capillary'
self.test = _qa_helper(dims*frame_size, enc, dec, threading)
self.tb.connect(self.test)
diff --git a/gr-fec/python/fec/qa_polar_decoder_sc.py b/gr-fec/python/fec/qa_polar_decoder_sc.py
index 6dd1e8e48..c8d956328 100644
--- a/gr-fec/python/fec/qa_polar_decoder_sc.py
+++ b/gr-fec/python/fec/qa_polar_decoder_sc.py
@@ -20,13 +20,18 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gr_unittest, blocks
-import fec_swig as fec
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+
import numpy as np
-from extended_decoder import extended_decoder
-from polar.encoder import PolarEncoder
-import polar.channel_construction as cc
+
+from gnuradio import gr, gr_unittest, blocks
+from gnuradio import fec
+from fec import extended_decoder
+from fec.polar.encoder import PolarEncoder
+from fec.polar import channel_construction as cc
# import os
# print('PID:', os.getpid())
diff --git a/gr-fec/python/fec/qa_polar_decoder_sc_list.py b/gr-fec/python/fec/qa_polar_decoder_sc_list.py
index 36819b396..13a8e9bc3 100644
--- a/gr-fec/python/fec/qa_polar_decoder_sc_list.py
+++ b/gr-fec/python/fec/qa_polar_decoder_sc_list.py
@@ -20,13 +20,17 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gr_unittest, blocks
-import fec_swig as fec
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import division
+
+
import numpy as np
-from extended_decoder import extended_decoder
-from polar.encoder import PolarEncoder
-import polar.channel_construction as cc
+from gnuradio import gr, gr_unittest, blocks, fec
+from gnuradio.fec import extended_decoder
+from gnuradio.fec.polar.encoder import PolarEncoder
+from gnuradio.fec.polar import channel_construction as cc
# import os
# print('PID:', os.getpid())
@@ -56,7 +60,7 @@ class test_polar_decoder_sc_list(gr_unittest.TestCase):
self.assertFalse(polar_decoder.set_frame_size(10))
def test_002_one_vector(self):
- print "test_002_one_vector"
+ print("test_002_one_vector")
expo = 6
block_size = 2 ** expo
num_info_bits = 2 ** (expo - 1)
@@ -89,7 +93,7 @@ class test_polar_decoder_sc_list(gr_unittest.TestCase):
self.assertTupleEqual(tuple(res), tuple(bits))
def test_003_stream(self):
- print "test_003_stream"
+ print("test_003_stream")
nframes = 5
expo = 8
block_size = 2 ** expo
diff --git a/gr-fec/python/fec/qa_polar_decoder_sc_systematic.py b/gr-fec/python/fec/qa_polar_decoder_sc_systematic.py
index fb2381e06..525ebbc76 100644
--- a/gr-fec/python/fec/qa_polar_decoder_sc_systematic.py
+++ b/gr-fec/python/fec/qa_polar_decoder_sc_systematic.py
@@ -20,13 +20,16 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gr_unittest, blocks
-import fec_swig as fec
+from __future__ import absolute_import
+from __future__ import division
import numpy as np
-from extended_decoder import extended_decoder
-from polar.encoder import PolarEncoder
-import polar.channel_construction as cc
+
+from gnuradio import gr, gr_unittest, blocks, fec
+
+from gnuradio.fec.extended_decoder import extended_decoder
+from gnuradio.fec.polar.encoder import PolarEncoder
+from gnuradio.fec.polar import channel_construction as cc
# import os
# print('PID:', os.getpid())
@@ -113,5 +116,3 @@ class test_polar_decoder_sc_systematic(gr_unittest.TestCase):
if __name__ == '__main__':
gr_unittest.run(test_polar_decoder_sc_systematic)
-
-
diff --git a/gr-fec/python/fec/qa_polar_encoder.py b/gr-fec/python/fec/qa_polar_encoder.py
index d7362b6dc..ba003d907 100644
--- a/gr-fec/python/fec/qa_polar_encoder.py
+++ b/gr-fec/python/fec/qa_polar_encoder.py
@@ -20,13 +20,16 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gr_unittest, blocks
-import fec_swig as fec
+from __future__ import absolute_import
+from __future__ import division
+
+
import numpy as np
-from extended_encoder import extended_encoder
-from polar.encoder import PolarEncoder
-import polar.channel_construction as cc
+from gnuradio import gr, gr_unittest, blocks, fec
+from gnuradio.fec.extended_encoder import extended_encoder
+from gnuradio.fec.polar.encoder import PolarEncoder
+from gnuradio.fec.polar import channel_construction as cc
# import os
# print('PID:', os.getpid())
diff --git a/gr-fec/python/fec/qa_polar_encoder_systematic.py b/gr-fec/python/fec/qa_polar_encoder_systematic.py
index 015a31b3c..18b918dda 100644
--- a/gr-fec/python/fec/qa_polar_encoder_systematic.py
+++ b/gr-fec/python/fec/qa_polar_encoder_systematic.py
@@ -20,13 +20,15 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gr_unittest, blocks
-import fec_swig as fec
+from __future__ import absolute_import
+from __future__ import division
+
import numpy as np
-from extended_encoder import extended_encoder
-from polar.encoder import PolarEncoder
-import polar.channel_construction as cc
+from gnuradio import gr, gr_unittest, blocks, fec
+from gnuradio.fec.extended_encoder import extended_encoder
+from gnuradio.fec.polar.encoder import PolarEncoder
+from gnuradio.fec.polar import channel_construction as cc
# import os
# print('PID:', os.getpid())
@@ -103,5 +105,3 @@ class test_polar_encoder_systematic(gr_unittest.TestCase):
if __name__ == '__main__':
gr_unittest.run(test_polar_encoder_systematic)
-
-
diff --git a/gr-fec/python/fec/qa_puncture.py b/gr-fec/python/fec/qa_puncture.py
index fdd15c9a0..f4e0ba855 100644
--- a/gr-fec/python/fec/qa_puncture.py
+++ b/gr-fec/python/fec/qa_puncture.py
@@ -20,11 +20,13 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, gr_unittest
-import fec_swig as fec
-import blocks_swig as blocks
+from __future__ import division
+
from collections import deque
+from gnuradio import gr, gr_unittest, blocks, fec
+
+
class test_puncture (gr_unittest.TestCase):
def puncture_setup(self):
@@ -36,13 +38,13 @@ class test_puncture (gr_unittest.TestCase):
_puncpat = list(d)
self.expected = []
- for n in range(len(self.src_data)/self.puncsize):
+ for n in range(len(self.src_data) // self.puncsize):
for i in range(self.puncsize):
if _puncpat[i] == 1:
self.expected.append(self.src_data[n*self.puncsize+i]);
def setUp(self):
- self.src_data = 10000*range(64)
+ self.src_data = 10000*list(range(64))
self.tb = gr.top_block()
def tearDown(self):
@@ -58,14 +60,14 @@ class test_puncture (gr_unittest.TestCase):
self.puncture_setup()
src = blocks.vector_source_b(self.src_data)
- op = fec.puncture_bb(self.puncsize, self.puncpat, self.delay)
- dst = blocks.vector_sink_b()
+ op = fec.puncture_bb(self.puncsize, self.puncpat, self.delay)
+ dst = blocks.vector_sink_b()
- self.tb.connect(src, op, dst)
- self.tb.run()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
- dst_data = list(dst.data())
- for i in xrange(len(dst_data)):
+ dst_data = list(dst.data())
+ for i in range(len(dst_data)):
dst_data[i] = int(dst_data[i])
self.assertEqual(self.expected, dst_data)
@@ -78,19 +80,19 @@ class test_puncture (gr_unittest.TestCase):
self.puncpat = 0xEE
self.delay = 1
- self.src_data = range(16)
+ self.src_data = list(range(16))
self.puncture_setup()
src = blocks.vector_source_b(self.src_data)
- op = fec.puncture_bb(self.puncsize, self.puncpat, self.delay)
- dst = blocks.vector_sink_b()
+ op = fec.puncture_bb(self.puncsize, self.puncpat, self.delay)
+ dst = blocks.vector_sink_b()
- self.tb.connect(src, op, dst)
- self.tb.run()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
- dst_data = list(dst.data())
- for i in xrange(len(dst_data)):
+ dst_data = list(dst.data())
+ for i in range(len(dst_data)):
dst_data[i] = int(dst_data[i])
self.assertEqual(self.expected, dst_data)
@@ -107,14 +109,14 @@ class test_puncture (gr_unittest.TestCase):
self.puncture_setup()
src = blocks.vector_source_b(self.src_data)
- op = fec.puncture_bb(self.puncsize, self.puncpat, self.delay)
- dst = blocks.vector_sink_b()
+ op = fec.puncture_bb(self.puncsize, self.puncpat, self.delay)
+ dst = blocks.vector_sink_b()
- self.tb.connect(src, op, dst)
- self.tb.run()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
- dst_data = list(dst.data())
- for i in xrange(len(dst_data)):
+ dst_data = list(dst.data())
+ for i in range(len(dst_data)):
dst_data[i] = int(dst_data[i])
self.assertEqual(self.expected, dst_data)
@@ -131,21 +133,21 @@ class test_puncture (gr_unittest.TestCase):
self.delay = 1
src = blocks.vector_source_b(self.src_data)
- op0 = fec.puncture_bb(self.puncsize, self.puncpat0, self.delay)
- op1 = fec.puncture_bb(self.puncsize, self.puncpat1, self.delay)
- dst0 = blocks.vector_sink_b()
- dst1 = blocks.vector_sink_b()
+ op0 = fec.puncture_bb(self.puncsize, self.puncpat0, self.delay)
+ op1 = fec.puncture_bb(self.puncsize, self.puncpat1, self.delay)
+ dst0 = blocks.vector_sink_b()
+ dst1 = blocks.vector_sink_b()
- self.tb.connect(src, op0, dst0)
- self.tb.connect(src, op1, dst1)
- self.tb.run()
+ self.tb.connect(src, op0, dst0)
+ self.tb.connect(src, op1, dst1)
+ self.tb.run()
- dst_data0 = list(dst0.data())
- for i in xrange(len(dst_data0)):
+ dst_data0 = list(dst0.data())
+ for i in range(len(dst_data0)):
dst_data0[i] = int(dst_data0[i])
- dst_data1 = list(dst1.data())
- for i in xrange(len(dst_data1)):
+ dst_data1 = list(dst1.data())
+ for i in range(len(dst_data1)):
dst_data1[i] = int(dst_data1[i])
self.assertEqual(dst_data1, dst_data0)
@@ -162,13 +164,13 @@ class test_puncture (gr_unittest.TestCase):
self.puncture_setup()
src = blocks.vector_source_f(self.src_data)
- op = fec.puncture_ff(self.puncsize, self.puncpat, self.delay)
- dst = blocks.vector_sink_f()
+ op = fec.puncture_ff(self.puncsize, self.puncpat, self.delay)
+ dst = blocks.vector_sink_f()
- self.tb.connect(src, op, dst)
- self.tb.run()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
- dst_data = list(dst.data())
+ dst_data = list(dst.data())
self.assertEqual(self.expected, dst_data)
@@ -179,18 +181,18 @@ class test_puncture (gr_unittest.TestCase):
self.puncpat = 0xEE
self.delay = 1
- self.src_data = range(16)
+ self.src_data = list(range(16))
self.puncture_setup()
src = blocks.vector_source_f(self.src_data)
- op = fec.puncture_ff(self.puncsize, self.puncpat, self.delay)
- dst = blocks.vector_sink_f()
+ op = fec.puncture_ff(self.puncsize, self.puncpat, self.delay)
+ dst = blocks.vector_sink_f()
- self.tb.connect(src, op, dst)
- self.tb.run()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
- dst_data = list(dst.data())
+ dst_data = list(dst.data())
self.assertEqual(self.expected, dst_data)
@@ -205,13 +207,13 @@ class test_puncture (gr_unittest.TestCase):
self.puncture_setup()
src = blocks.vector_source_f(self.src_data)
- op = fec.puncture_ff(self.puncsize, self.puncpat, self.delay)
- dst = blocks.vector_sink_f()
+ op = fec.puncture_ff(self.puncsize, self.puncpat, self.delay)
+ dst = blocks.vector_sink_f()
- self.tb.connect(src, op, dst)
- self.tb.run()
+ self.tb.connect(src, op, dst)
+ self.tb.run()
- dst_data = list(dst.data())
+ dst_data = list(dst.data())
self.assertEqual(self.expected, dst_data)
def test_f_003(self):
@@ -226,17 +228,17 @@ class test_puncture (gr_unittest.TestCase):
self.delay = 1
src = blocks.vector_source_f(self.src_data)
- op0 = fec.puncture_ff(self.puncsize, self.puncpat0, self.delay)
- op1 = fec.puncture_ff(self.puncsize, self.puncpat1, self.delay)
- dst0 = blocks.vector_sink_f()
- dst1 = blocks.vector_sink_f()
+ op0 = fec.puncture_ff(self.puncsize, self.puncpat0, self.delay)
+ op1 = fec.puncture_ff(self.puncsize, self.puncpat1, self.delay)
+ dst0 = blocks.vector_sink_f()
+ dst1 = blocks.vector_sink_f()
- self.tb.connect(src, op0, dst0)
- self.tb.connect(src, op1, dst1)
- self.tb.run()
+ self.tb.connect(src, op0, dst0)
+ self.tb.connect(src, op1, dst1)
+ self.tb.run()
- dst_data0 = list(dst0.data())
- dst_data1 = list(dst1.data())
+ dst_data0 = list(dst0.data())
+ dst_data1 = list(dst1.data())
self.assertEqual(dst_data1, dst_data0)
diff --git a/gr-fec/python/fec/threaded_decoder.py b/gr-fec/python/fec/threaded_decoder.py
index 115ad7b5d..adf4abfe2 100644
--- a/gr-fec/python/fec/threaded_decoder.py
+++ b/gr-fec/python/fec/threaded_decoder.py
@@ -20,8 +20,10 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from gnuradio import gr, blocks
-import fec_swig as fec
+from . import fec_swig as fec
+
class threaded_decoder(gr.hier_block2):
def __init__(self, decoder_list_0, input_size, output_size):
diff --git a/gr-fec/python/fec/threaded_encoder.py b/gr-fec/python/fec/threaded_encoder.py
index 391baa544..254b4d39d 100644
--- a/gr-fec/python/fec/threaded_encoder.py
+++ b/gr-fec/python/fec/threaded_encoder.py
@@ -20,8 +20,11 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import unicode_literals
from gnuradio import gr, blocks
-import fec_swig as fec
+
+from . import fec_swig as fec
+
class threaded_encoder(gr.hier_block2):
def __init__(self, encoder_list_0, input_size, output_size):
diff --git a/gr-fft/grc/CMakeLists.txt b/gr-fft/grc/CMakeLists.txt
index 8eeb431c3..d0432c428 100644
--- a/gr-fft/grc/CMakeLists.txt
+++ b/gr-fft/grc/CMakeLists.txt
@@ -18,10 +18,10 @@
# Boston, MA 02110-1301, USA.
install(FILES
- fft_block_tree.xml
- fft_fft_vxx.xml
- fft_goertzel_fc.xml
- fft_logpwrfft_x.xml
- fft_ctrlport_probe_psd.xml
+ fft.tree.yml
+ fft_fft_vxx.block.yml
+ fft_goertzel_fc.block.yml
+ fft_logpwrfft_x.block.yml
+ fft_ctrlport_probe_psd.block.yml
DESTINATION ${GRC_BLOCKS_DIR}
)
diff --git a/gr-fft/grc/fft.tree.yml b/gr-fft/grc/fft.tree.yml
new file mode 100644
index 000000000..c198bc457
--- /dev/null
+++ b/gr-fft/grc/fft.tree.yml
@@ -0,0 +1,7 @@
+'[Core]':
+- Fourier Analysis:
+ - fft_vxx
+ - goertzel_fc
+ - logpwrfft_x
+- Control Port:
+ - fft_ctrlport_probe_psd
diff --git a/gr-fft/grc/fft_block_tree.xml b/gr-fft/grc/fft_block_tree.xml
deleted file mode 100644
index e844d837b..000000000
--- a/gr-fft/grc/fft_block_tree.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2012 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##Block Tree for GR FFT blocks.
-###################################################
- -->
-<cat>
- <name>[Core]</name> <!-- Blank for Root Name -->
- <cat>
- <name>Fourier Analysis</name>
- <block>fft_vxx</block>
- <block>goertzel_fc</block>
- <block>logpwrfft_x</block>
- </cat>
- <cat>
- <name>Control Port</name>
- <block>fft_ctrlport_probe_psd</block>
- </cat>
-</cat>
diff --git a/gr-fft/grc/fft_ctrlport_probe_psd.block.yml b/gr-fft/grc/fft_ctrlport_probe_psd.block.yml
new file mode 100644
index 000000000..3349f4263
--- /dev/null
+++ b/gr-fft/grc/fft_ctrlport_probe_psd.block.yml
@@ -0,0 +1,31 @@
+id: fft_ctrlport_probe_psd
+label: Ctrlport Probe PSD
+
+parameters:
+- id: name
+ label: Name
+ dtype: string
+ default: psd
+- id: desc
+ label: Description
+ dtype: string
+ default: PSD Plot
+- id: len
+ label: Length
+ dtype: int
+ default: '1024'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import fft
+ make: fft.ctrlport_probe_psd(${name}, ${desc}, ${len})
+ callbacks:
+ - set_length(${len})
+
+documentation: |-
+ Place this in a graph to export PSD values to a GRCP port probe.
+
+file_format: 1
diff --git a/gr-fft/grc/fft_ctrlport_probe_psd.xml b/gr-fft/grc/fft_ctrlport_probe_psd.xml
deleted file mode 100644
index f50144ba9..000000000
--- a/gr-fft/grc/fft_ctrlport_probe_psd.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2012 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<block>
- <name>Ctrlport Probe PSD</name>
- <key>fft_ctrlport_probe_psd</key>
- <import>from gnuradio import fft</import>
- <make>fft.ctrlport_probe_psd($name, $desc, $len)</make>
- <callback>set_length($len)</callback>
-
- <param>
- <name>Name</name>
- <key>name</key>
- <value>psd</value>
- <type>string</type>
- </param>
-
- <param>
- <name>Description</name>
- <key>desc</key>
- <value>PSD Plot</value>
- <type>string</type>
- </param>
-
- <param>
- <name>Length</name>
- <key>len</key>
- <value>1024</value>
- <type>int</type>
- </param>
-
-
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
-
- <doc>
- Place this in a graph to export PSD values to a GRCP port probe.
- </doc>
-
-</block>
-
diff --git a/gr-fft/grc/fft_fft_vxx.block.yml b/gr-fft/grc/fft_fft_vxx.block.yml
new file mode 100644
index 000000000..33143f688
--- /dev/null
+++ b/gr-fft/grc/fft_fft_vxx.block.yml
@@ -0,0 +1,60 @@
+id: fft_vxx
+label: FFT
+
+parameters:
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [complex, float]
+ option_attributes:
+ hide_shift: ['', all]
+ hide: part
+- id: fft_size
+ label: FFT Size
+ dtype: int
+ default: '1024'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: forward
+ label: Forward/Reverse
+ dtype: enum
+ options: ['True', 'False']
+ option_labels: [Forward, Reverse]
+- id: window
+ label: Window
+ dtype: real_vector
+ default: window.blackmanharris(1024)
+- id: shift
+ label: Shift
+ dtype: enum
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: ${ type.hide_shift }
+- id: nthreads
+ label: Num. Threads
+ dtype: int
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ fft_size }
+
+outputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ fft_size }
+
+templates:
+ imports: |-
+ from gnuradio import fft
+ from gnuradio.fft import window
+ make: |-
+ % if type == "complex":
+ fft.fft_vcc(${fft_size}, ${forward}, ${window}, ${shift}, ${nthreads})
+ % else:
+ fft.fft_vfc(${fft_size}, ${forward}, ${window}, ${nthreads})
+ % endif
+ callbacks:
+ - set_nthreads(${nthreads})
+
+file_format: 1
diff --git a/gr-fft/grc/fft_fft_vxx.xml b/gr-fft/grc/fft_fft_vxx.xml
deleted file mode 100644
index 028721fe2..000000000
--- a/gr-fft/grc/fft_fft_vxx.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##FFT
-###################################################
- -->
-<block>
- <name>FFT</name>
- <key>fft_vxx</key>
- <import>from gnuradio import fft</import>
- <import>from gnuradio.fft import window</import>
- <make>#if $type() == "complex"
-fft.fft_vcc($fft_size, $forward, $window, $shift, $nthreads)
-#else
-fft.fft_vfc($fft_size, $forward, $window, $nthreads)
-#end if</make>
- <callback>set_nthreads($nthreads)</callback>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>hide_shift:</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>hide_shift:all</opt>
- </option>
- </param>
- <param>
- <name>FFT Size</name>
- <key>fft_size</key>
- <value>1024</value>
- <type>int</type>
- </param>
- <param>
- <name>Forward/Reverse</name>
- <key>forward</key>
- <type>enum</type>
- <option>
- <name>Forward</name>
- <key>True</key>
- </option>
- <option>
- <name>Reverse</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Window</name>
- <key>window</key>
- <value>window.blackmanharris(1024)</value>
- <type>real_vector</type>
- </param>
- <param>
- <name>Shift</name>
- <key>shift</key>
- <type>enum</type>
- <hide>$type.hide_shift</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Num. Threads</name>
- <key>nthreads</key>
- <value>1</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$fft_size</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- <vlen>$fft_size</vlen>
- </source>
-</block>
diff --git a/gr-fft/grc/fft_goertzel_fc.block.yml b/gr-fft/grc/fft_goertzel_fc.block.yml
new file mode 100644
index 000000000..6ea74e7f5
--- /dev/null
+++ b/gr-fft/grc/fft_goertzel_fc.block.yml
@@ -0,0 +1,30 @@
+id: goertzel_fc
+label: Goertzel
+
+parameters:
+- id: rate
+ label: Rate
+ dtype: int
+- id: len
+ label: Length
+ dtype: int
+- id: freq
+ label: Frequency
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import fft
+ make: fft.goertzel_fc(${rate}, ${len}, ${freq})
+ callbacks:
+ - set_freq(${freq})
+ - set_rate(${rate})
+
+file_format: 1
diff --git a/gr-fft/grc/fft_goertzel_fc.xml b/gr-fft/grc/fft_goertzel_fc.xml
deleted file mode 100644
index 371284358..000000000
--- a/gr-fft/grc/fft_goertzel_fc.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Goertzel
-###################################################
- -->
-<block>
- <name>Goertzel</name>
- <key>goertzel_fc</key>
- <import>from gnuradio import fft</import>
- <make>fft.goertzel_fc($rate, $len, $freq)</make>
- <callback>set_freq($freq)</callback>
- <callback>set_rate($rate)</callback>
- <param>
- <name>Rate</name>
- <key>rate</key>
- <type>int</type>
- </param>
- <param>
- <name>Length</name>
- <key>len</key>
- <type>int</type>
- </param>
- <param>
- <name>Frequency</name>
- <key>freq</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-fft/grc/fft_logpwrfft_x.block.yml b/gr-fft/grc/fft_logpwrfft_x.block.yml
new file mode 100644
index 000000000..1046fe81a
--- /dev/null
+++ b/gr-fft/grc/fft_logpwrfft_x.block.yml
@@ -0,0 +1,59 @@
+id: logpwrfft_x
+label: Log Power FFT
+
+parameters:
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [complex, float]
+ option_attributes:
+ fcn: [c, f]
+ hide: part
+- id: sample_rate
+ label: Sample Rate
+ dtype: real
+ default: samp_rate
+- id: fft_size
+ label: FFT Size
+ dtype: int
+ default: '1024'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: ref_scale
+ label: Reference Scale
+ dtype: real
+ default: '2'
+- id: frame_rate
+ label: Frame Rate
+ dtype: real
+ default: '30'
+- id: average
+ label: Average
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+- id: avg_alpha
+ label: Average Alpha
+ dtype: real
+ default: '1.0'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: float
+ vlen: ${ fft_size }
+
+templates:
+ imports: from gnuradio.fft import logpwrfft
+ make: "logpwrfft.logpwrfft_${type.fcn}(\n\tsample_rate=${sample_rate},\n\tfft_size=${fft_size},\n\
+ \tref_scale=${ref_scale},\n\tframe_rate=${frame_rate},\n\tavg_alpha=${avg_alpha},\n\
+ \taverage=${average},\n)"
+ callbacks:
+ - set_sample_rate(${sample_rate})
+ - set_avg_alpha(${avg_alpha})
+ - set_average(${average})
+
+file_format: 1
diff --git a/gr-fft/grc/fft_logpwrfft_x.xml b/gr-fft/grc/fft_logpwrfft_x.xml
deleted file mode 100644
index ee45b577d..000000000
--- a/gr-fft/grc/fft_logpwrfft_x.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Log Power FFT
-###################################################
- -->
-<block>
- <name>Log Power FFT</name>
- <key>logpwrfft_x</key>
- <import>from gnuradio.fft import logpwrfft</import>
- <make>logpwrfft.logpwrfft_$(type.fcn)(
- sample_rate=$sample_rate,
- fft_size=$fft_size,
- ref_scale=$ref_scale,
- frame_rate=$frame_rate,
- avg_alpha=$avg_alpha,
- average=$average,
-)</make>
- <callback>set_sample_rate($sample_rate)</callback>
- <callback>set_avg_alpha($avg_alpha)</callback>
- <callback>set_average($average)</callback>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:c</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:f</opt>
- </option>
- </param>
- <param>
- <name>Sample Rate</name>
- <key>sample_rate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>FFT Size</name>
- <key>fft_size</key>
- <value>1024</value>
- <type>int</type>
- </param>
- <param>
- <name>Reference Scale</name>
- <key>ref_scale</key>
- <value>2</value>
- <type>real</type>
- </param>
- <param>
- <name>Frame Rate</name>
- <key>frame_rate</key>
- <value>30</value>
- <type>real</type>
- </param>
- <param>
- <name>Average</name>
- <key>average</key>
- <value>False</value>
- <type>bool</type>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Average Alpha</name>
- <key>avg_alpha</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- <vlen>$fft_size</vlen>
- </source>
-</block>
diff --git a/gr-fft/python/fft/CMakeLists.txt b/gr-fft/python/fft/CMakeLists.txt
index 016c76d27..f08aebc11 100644
--- a/gr-fft/python/fft/CMakeLists.txt
+++ b/gr-fft/python/fft/CMakeLists.txt
@@ -40,6 +40,6 @@ if(ENABLE_TESTING)
file(GLOB py_qa_test_files "qa_*.py")
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gr-fft/python/fft/__init__.py b/gr-fft/python/fft/__init__.py
index 1864353ed..2e110f537 100644
--- a/gr-fft/python/fft/__init__.py
+++ b/gr-fft/python/fft/__init__.py
@@ -22,11 +22,15 @@
'''
Fourier-transform blocks and related functions.
'''
+
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
import os
try:
- from fft_swig import *
+ from .fft_swig import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
- from fft_swig import *
+ from .fft_swig import *
diff --git a/gr-fft/python/fft/logpwrfft.py b/gr-fft/python/fft/logpwrfft.py
index 1ed9d6cac..3c568b67e 100644
--- a/gr-fft/python/fft/logpwrfft.py
+++ b/gr-fft/python/fft/logpwrfft.py
@@ -1,3 +1,5 @@
+from __future__ import division
+from __future__ import unicode_literals
#
# Copyright 2008 Free Software Foundation, Inc.
#
@@ -23,8 +25,8 @@ from gnuradio import gr
from gnuradio import blocks
import sys, math
-import fft_swig as fft
-from fft_swig import window
+from . import fft_swig as fft
+from .fft_swig import window
try:
from gnuradio import filter
@@ -63,14 +65,14 @@ class _logpwrfft_base(gr.hier_block2):
if win is None: win = window.blackmanharris
fft_window = win(fft_size)
fft = self._fft_block[0](fft_size, True, fft_window)
- window_power = sum(map(lambda x: x*x, fft_window))
+ window_power = sum([x*x for x in fft_window])
c2magsq = blocks.complex_to_mag_squared(fft_size)
self._avg = filter.single_pole_iir_filter_ff(1.0, fft_size)
self._log = blocks.nlog10_ff(10, fft_size,
-20*math.log10(fft_size) # Adjust for number of bins
- -10*math.log10(float(window_power)/fft_size) # Adjust for windowing loss
- -20*math.log10(float(ref_scale)/2)) # Adjust for reference scale
+ -10*math.log10(float(window_power) / fft_size) # Adjust for windowing loss
+ -20*math.log10(float(ref_scale) / 2)) # Adjust for reference scale
self.connect(self, self._sd, fft, c2magsq, self._avg, self._log, self)
self._average = average
@@ -173,4 +175,3 @@ class logpwrfft_c(_logpwrfft_base):
_name = "logpwrfft_c"
_item_size = gr.sizeof_gr_complex
_fft_block = (fft.fft_vcc, )
-
diff --git a/gr-fft/python/fft/qa_fft.py b/gr-fft/python/fft/qa_fft.py
index db3ca7778..b1c44f280 100755..100644
--- a/gr-fft/python/fft/qa_fft.py
+++ b/gr-fft/python/fft/qa_fft.py
@@ -19,6 +19,8 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, fft, blocks
# Note: Octave code to verify these results:
diff --git a/gr-fft/python/fft/qa_goertzel.py b/gr-fft/python/fft/qa_goertzel.py
index c2c5c565e..ebd272cb2 100755..100644
--- a/gr-fft/python/fft/qa_goertzel.py
+++ b/gr-fft/python/fft/qa_goertzel.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from math import pi, cos
from gnuradio import gr, gr_unittest, fft, blocks
@@ -36,30 +38,30 @@ class test_goertzel(gr_unittest.TestCase):
return [cos(2*pi*x*freq/rate) for x in range(rate)]
def transform(self, src_data, rate, freq):
- src = blocks.vector_source_f(src_data, False)
+ src = blocks.vector_source_f(src_data, False)
dft = fft.goertzel_fc(rate, rate, freq)
- dst = blocks.vector_sink_c()
- self.tb.connect(src, dft, dst)
- self.tb.run()
- return dst.data()
+ dst = blocks.vector_sink_c()
+ self.tb.connect(src, dft, dst)
+ self.tb.run()
+ return dst.data()
def test_001(self): # Measure single tone magnitude
- rate = 8000
- freq = 100
- bin = freq
- src_data = self.make_tone_data(rate, freq)
- expected_result = 0.5
- actual_result = abs(self.transform(src_data, rate, bin)[0])
- self.assertAlmostEqual(expected_result, actual_result, places=4)
+ rate = 8000
+ freq = 100
+ bin = freq
+ src_data = self.make_tone_data(rate, freq)
+ expected_result = 0.5
+ actual_result = abs(self.transform(src_data, rate, bin)[0])
+ self.assertAlmostEqual(expected_result, actual_result, places=4)
def test_002(self): # Measure off frequency magnitude
- rate = 8000
- freq = 100
- bin = freq/2
- src_data = self.make_tone_data(rate, freq)
- expected_result = 0.0
- actual_result = abs(self.transform(src_data, rate, bin)[0])
- self.assertAlmostEqual(expected_result, actual_result, places=4)
+ rate = 8000
+ freq = 100
+ bin = freq / 2
+ src_data = self.make_tone_data(rate, freq)
+ expected_result = 0.0
+ actual_result = abs(self.transform(src_data, rate, bin)[0])
+ self.assertAlmostEqual(expected_result, actual_result, places=4)
if __name__ == '__main__':
gr_unittest.run(test_goertzel, "test_goertzel.xml")
diff --git a/gr-filter/examples/benchmark_filters.py b/gr-filter/examples/benchmark_filters.py
index 4da6b9f5a..0c7aebcf6 100755..100644
--- a/gr-filter/examples/benchmark_filters.py
+++ b/gr-filter/examples/benchmark_filters.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
import time
import random
from argparse import ArgumentParser
@@ -48,8 +50,8 @@ def benchmark(name, creator, dec, ntaps, total_test_size, block_size):
tb.run()
stop = time.time()
delta = stop - start
- print "%16s: taps: %4d input: %4g, time: %6.3f taps/sec: %10.4g" % (
- name, ntaps, total_test_size, delta, ntaps*total_test_size/delta)
+ print("%16s: taps: %4d input: %4g, time: %6.3f taps/sec: %10.4g" % (
+ name, ntaps, total_test_size, delta, ntaps*total_test_size/delta))
def main():
parser = ArgumentParser()
diff --git a/gr-filter/examples/channelize.py b/gr-filter/examples/channelize.py
index e70817e87..51f0bad20 100755..100644
--- a/gr-filter/examples/channelize.py
+++ b/gr-filter/examples/channelize.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
from gnuradio import filter
@@ -60,10 +63,10 @@ class pfb_top_block(gr.top_block):
window=filter.firdes.WIN_BLACKMAN_hARRIS)
# Calculate the number of taps per channel for our own information
- tpc = scipy.ceil(float(len(self._taps)) / float(self._M))
- print "Number of taps: ", len(self._taps)
- print "Number of channels: ", self._M
- print "Taps per channel: ", tpc
+ tpc = scipy.ceil(float(len(self._taps)) / float(self._M))
+ print("Number of taps: ", len(self._taps))
+ print("Number of channels: ", self._M)
+ print("Taps per channel: ", tpc)
# Create a set of signals at different frequencies
# freqs lists the frequencies of the signals that get stored
@@ -71,8 +74,8 @@ class pfb_top_block(gr.top_block):
self.signals = list()
self.add = blocks.add_cc()
freqs = [-70, -50, -30, -10, 10, 20, 40, 60, 80]
- for i in xrange(len(freqs)):
- f = freqs[i] + (M/2-M+i+1)*self._fs
+ for i in range(len(freqs)):
+ f = freqs[i] + (M / 2-M+i+1)*self._fs
self.signals.append(analog.sig_source_c(self._ifs, analog.GR_SIN_WAVE, f, 1))
self.connect(self.signals[i], (self.add,i))
@@ -93,7 +96,7 @@ class pfb_top_block(gr.top_block):
# Create a vector sink for each of M output channels of the filter and connect it
self.snks = list()
- for i in xrange(self._M):
+ for i in range(self._M):
self.snks.append(blocks.vector_sink_c())
self.connect((self.pfb, i), self.snks[i])
@@ -105,7 +108,7 @@ def main():
tb.run()
tend = time.time()
- print "Run time: %f" % (tend - tstart)
+ print("Run time: %f" % (tend - tstart))
if 1:
fig_in = pylab.figure(1, figsize=(16,9), facecolor="w")
@@ -123,11 +126,11 @@ def main():
d = tb.snk_i.data()[Ns:Ne]
spin_f = fig_in.add_subplot(2, 1, 1)
- X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen / 4, Fs=fs,
window = lambda d: d*winfunc(fftlen),
scale_by_freq=True)
X_in = 10.0*scipy.log10(abs(X))
- f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
+ f_in = scipy.arange(-fs / 2.0, fs / 2.0, fs / float(X_in.size))
pin_f = spin_f.plot(f_in, X_in, "b")
spin_f.set_xlim([min(f_in), max(f_in)+1])
spin_f.set_ylim([-200.0, 50.0])
@@ -137,7 +140,7 @@ def main():
spin_f.set_ylabel("Power (dBW)")
- Ts = 1.0/fs
+ Ts = 1.0 / fs
Tmax = len(d)*Ts
t_in = scipy.arange(0, Tmax, Ts)
@@ -157,20 +160,20 @@ def main():
# Plot each of the channels outputs. Frequencies on Figure 2 and
# time signals on Figure 3
fs_o = tb._fs
- Ts_o = 1.0/fs_o
+ Ts_o = 1.0 / fs_o
Tmax_o = len(d)*Ts_o
- for i in xrange(len(tb.snks)):
+ for i in range(len(tb.snks)):
# remove issues with the transients at the beginning
# also remove some corruption at the end of the stream
# this is a bug, probably due to the corner cases
d = tb.snks[i].data()[Ns:Ne]
sp1_f = fig1.add_subplot(Nrows, Ncols, 1+i)
- X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o,
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen / 4, Fs=fs_o,
window = lambda d: d*winfunc(fftlen),
scale_by_freq=True)
X_o = 10.0*scipy.log10(abs(X))
- f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size))
+ f_o = scipy.arange(-fs_o / 2.0, fs_o / 2.0, fs_o / float(X_o.size))
p2_f = sp1_f.plot(f_o, X_o, "b")
sp1_f.set_xlim([min(f_o), max(f_o)+1])
sp1_f.set_ylim([-200.0, 50.0])
diff --git a/gr-filter/examples/chirp_channelize.py b/gr-filter/examples/chirp_channelize.py
index aedd5c489..471416b6a 100755..100644
--- a/gr-filter/examples/chirp_channelize.py
+++ b/gr-filter/examples/chirp_channelize.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
from gnuradio import filter
@@ -59,17 +62,17 @@ class pfb_top_block(gr.top_block):
window=filter.firdes.WIN_BLACKMAN_hARRIS)
# Calculate the number of taps per channel for our own information
- tpc = scipy.ceil(float(len(self._taps)) / float(self._M))
- print "Number of taps: ", len(self._taps)
- print "Number of channels: ", self._M
- print "Taps per channel: ", tpc
+ tpc = scipy.ceil(float(len(self._taps)) / float(self._M))
+ print("Number of taps: ", len(self._taps))
+ print("Number of channels: ", self._M)
+ print("Taps per channel: ", tpc)
repeated = True
if(repeated):
self.vco_input = analog.sig_source_f(self._fs, analog.GR_SIN_WAVE, 0.25, 110)
else:
amp = 100
- data = scipy.arange(0, amp, amp/float(self._N))
+ data = scipy.arange(0, amp, amp / float(self._N))
self.vco_input = blocks.vector_source_f(data, False)
# Build a VCO controlled by either the sinusoid or single chirp tone
@@ -92,7 +95,7 @@ class pfb_top_block(gr.top_block):
# Create a vector sink for each of M output channels of the filter and connect it
self.snks = list()
- for i in xrange(self._M):
+ for i in range(self._M):
self.snks.append(blocks.vector_sink_c())
self.connect((self.pfb, i), self.snks[i])
@@ -104,7 +107,7 @@ def main():
tb.run()
tend = time.time()
- print "Run time: %f" % (tend - tstart)
+ print("Run time: %f" % (tend - tstart))
if 1:
fig_in = pylab.figure(1, figsize=(16,9), facecolor="w")
@@ -123,11 +126,11 @@ def main():
d = tb.snk_i.data()[Ns:Ne]
spin_f = fig_in.add_subplot(2, 1, 1)
- X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen / 4, Fs=fs,
window = lambda d: d*winfunc(fftlen),
scale_by_freq=True)
X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
- f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
+ f_in = scipy.arange(-fs / 2.0, fs / 2.0, fs / float(X_in.size))
pin_f = spin_f.plot(f_in, X_in, "b")
spin_f.set_xlim([min(f_in), max(f_in)+1])
spin_f.set_ylim([-200.0, 50.0])
@@ -137,7 +140,7 @@ def main():
spin_f.set_ylabel("Power (dBW)")
- Ts = 1.0/fs
+ Ts = 1.0 / fs
Tmax = len(d)*Ts
t_in = scipy.arange(0, Tmax, Ts)
@@ -157,16 +160,16 @@ def main():
# Plot each of the channels outputs. Frequencies on Figure 2 and
# time signals on Figure 3
fs_o = tb._fs / tb._M
- Ts_o = 1.0/fs_o
+ Ts_o = 1.0 / fs_o
Tmax_o = len(d)*Ts_o
- for i in xrange(len(tb.snks)):
+ for i in range(len(tb.snks)):
# remove issues with the transients at the beginning
# also remove some corruption at the end of the stream
# this is a bug, probably due to the corner cases
d = tb.snks[i].data()[Ns:Ne]
sp1_f = fig1.add_subplot(Nrows, Ncols, 1+i)
- X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o,
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen / 4, Fs=fs_o,
window = lambda d: d*winfunc(fftlen),
scale_by_freq=True)
X_o = 10.0*scipy.log10(abs(X))
diff --git a/gr-filter/examples/decimate.py b/gr-filter/examples/decimate.py
index 675073a43..fb37d8047 100755..100644
--- a/gr-filter/examples/decimate.py
+++ b/gr-filter/examples/decimate.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
from gnuradio import filter
@@ -60,10 +63,10 @@ class pfb_top_block(gr.top_block):
window=filter.firdes.WIN_BLACKMAN_hARRIS)
# Calculate the number of taps per channel for our own information
- tpc = scipy.ceil(float(len(self._taps)) / float(self._decim))
- print "Number of taps: ", len(self._taps)
- print "Number of filters: ", self._decim
- print "Taps per channel: ", tpc
+ tpc = scipy.ceil(float(len(self._taps)) / float(self._decim))
+ print("Number of taps: ", len(self._taps))
+ print("Number of filters: ", self._decim)
+ print("Taps per channel: ", tpc)
# Build the input signal source
# We create a list of freqs, and a sine wave is generated and added to the source
@@ -71,7 +74,7 @@ class pfb_top_block(gr.top_block):
self.signals = list()
self.add = blocks.add_cc()
freqs = [10, 20, 2040]
- for i in xrange(len(freqs)):
+ for i in range(len(freqs)):
self.signals.append(analog.sig_source_c(self._fs, analog.GR_SIN_WAVE, freqs[i], 1))
self.connect(self.signals[i], (self.add,i))
@@ -100,7 +103,7 @@ def main():
tstart = time.time()
tb.run()
tend = time.time()
- print "Run time: %f" % (tend - tstart)
+ print("Run time: %f" % (tend - tstart))
if 1:
fig1 = pylab.figure(1, figsize=(16,9))
@@ -118,11 +121,11 @@ def main():
d = tb.snk_i.data()[Ns:Ns+Ne]
sp1_f = fig1.add_subplot(2, 1, 1)
- X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen / 4, Fs=fs,
window = lambda d: d*winfunc(fftlen),
scale_by_freq=True)
X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
- f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
+ f_in = scipy.arange(-fs / 2.0, fs / 2.0, fs / float(X_in.size))
p1_f = sp1_f.plot(f_in, X_in, "b")
sp1_f.set_xlim([min(f_in), max(f_in)+1])
sp1_f.set_ylim([-200.0, 50.0])
@@ -131,7 +134,7 @@ def main():
sp1_f.set_xlabel("Frequency (Hz)")
sp1_f.set_ylabel("Power (dBW)")
- Ts = 1.0/fs
+ Ts = 1.0 / fs
Tmax = len(d)*Ts
t_in = scipy.arange(0, Tmax, Ts)
@@ -150,11 +153,11 @@ def main():
sp2_f = fig2.add_subplot(2, 1, 1)
d = tb.snk.data()[Ns:Ns+Ne]
- X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs_o,
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen / 4, Fs=fs_o,
window = lambda d: d*winfunc(fftlen),
scale_by_freq=True)
X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
- f_o = scipy.arange(-fs_o/2.0, fs_o/2.0, fs_o/float(X_o.size))
+ f_o = scipy.arange(-fs_o / 2.0, fs_o / 2.0, fs_o / float(X_o.size))
p2_f = sp2_f.plot(f_o, X_o, "b")
sp2_f.set_xlim([min(f_o), max(f_o)+1])
sp2_f.set_ylim([-200.0, 50.0])
@@ -164,7 +167,7 @@ def main():
sp2_f.set_ylabel("Power (dBW)")
- Ts_o = 1.0/fs_o
+ Ts_o = 1.0 / fs_o
Tmax_o = len(d)*Ts_o
x_o = scipy.array(d)
diff --git a/gr-filter/examples/fft_filter_ccc.py b/gr-filter/examples/fft_filter_ccc.py
index 92bcc7e31..6cadddee1 100755..100644
--- a/gr-filter/examples/fft_filter_ccc.py
+++ b/gr-filter/examples/fft_filter_ccc.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr, filter
from gnuradio import analog
from gnuradio import blocks
@@ -31,13 +34,13 @@ import sys
try:
import scipy
except ImportError:
- print "Error: could not import scipy (http://www.scipy.org/)"
+ print("Error: could not import scipy (http://www.scipy.org/)")
sys.exit(1)
try:
import pylab
except ImportError:
- print "Error: could not import pylab (http://matplotlib.sourceforge.net/)"
+ print("Error: could not import pylab (http://matplotlib.sourceforge.net/)")
sys.exit(1)
class example_fft_filter_ccc(gr.top_block):
@@ -54,7 +57,7 @@ class example_fft_filter_ccc(gr.top_block):
taps = filter.firdes.complex_band_pass_2(1, self._fs,
self._bw0, self._bw1,
self._tw, self._at)
- print "Num. Taps: ", len(taps)
+ print("Num. Taps: ", len(taps))
self.src = analog.noise_source_c(analog.GR_GAUSSIAN, 1)
self.head = blocks.head(gr.sizeof_gr_complex, self._nsamps)
@@ -101,9 +104,9 @@ def main():
nfft = 1024
f1 = pylab.figure(1, figsize=(12,10))
s1 = f1.add_subplot(1,1,1)
- s1.psd(data_src, NFFT=nfft, noverlap=nfft/4,
+ s1.psd(data_src, NFFT=nfft, noverlap=nfft / 4,
Fs=args.samplerate)
- s1.psd(data_snk, NFFT=nfft, noverlap=nfft/4,
+ s1.psd(data_snk, NFFT=nfft, noverlap=nfft / 4,
Fs=args.samplerate)
f2 = pylab.figure(2, figsize=(12,10))
diff --git a/gr-filter/examples/fir_filter_ccc.py b/gr-filter/examples/fir_filter_ccc.py
index 357e3d711..fe5e7e025 100755..100644
--- a/gr-filter/examples/fir_filter_ccc.py
+++ b/gr-filter/examples/fir_filter_ccc.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr, filter
from gnuradio import analog
from gnuradio import blocks
@@ -31,13 +34,13 @@ import sys
try:
import scipy
except ImportError:
- print "Error: could not import scipy (http://www.scipy.org/)"
+ print("Error: could not import scipy (http://www.scipy.org/)")
sys.exit(1)
try:
import pylab
except ImportError:
- print "Error: could not import pylab (http://matplotlib.sourceforge.net/)"
+ print("Error: could not import pylab (http://matplotlib.sourceforge.net/)")
sys.exit(1)
class example_fir_filter_ccc(gr.top_block):
@@ -51,7 +54,7 @@ class example_fir_filter_ccc(gr.top_block):
self._at = atten
self._decim = D
taps = filter.firdes.low_pass_2(1, self._fs, self._bw, self._tw, self._at)
- print "Num. Taps: ", len(taps)
+ print("Num. Taps: ", len(taps))
self.src = analog.noise_source_c(analog.GR_GAUSSIAN, 1)
self.head = blocks.head(gr.sizeof_gr_complex, self._nsamps)
@@ -95,9 +98,9 @@ def main():
nfft = 1024
f1 = pylab.figure(1, figsize=(12,10))
s1 = f1.add_subplot(1,1,1)
- s1.psd(data_src, NFFT=nfft, noverlap=nfft/4,
+ s1.psd(data_src, NFFT=nfft, noverlap=nfft / 4,
Fs=args.samplerate)
- s1.psd(data_snk, NFFT=nfft, noverlap=nfft/4,
+ s1.psd(data_snk, NFFT=nfft, noverlap=nfft / 4,
Fs=args.samplerate)
f2 = pylab.figure(2, figsize=(12,10))
diff --git a/gr-filter/examples/fir_filter_fff.py b/gr-filter/examples/fir_filter_fff.py
index 2019215f1..c4c9ea2c8 100755..100644
--- a/gr-filter/examples/fir_filter_fff.py
+++ b/gr-filter/examples/fir_filter_fff.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr, filter
from gnuradio import analog
from gnuradio import blocks
@@ -31,13 +34,13 @@ import sys
try:
import scipy
except ImportError:
- print "Error: could not import scipy (http://www.scipy.org/)"
+ print("Error: could not import scipy (http://www.scipy.org/)")
sys.exit(1)
try:
import pylab
except ImportError:
- print "Error: could not import pylab (http://matplotlib.sourceforge.net/)"
+ print("Error: could not import pylab (http://matplotlib.sourceforge.net/)")
sys.exit(1)
class example_fir_filter_fff(gr.top_block):
@@ -51,7 +54,7 @@ class example_fir_filter_fff(gr.top_block):
self._at = atten
self._decim = D
taps = filter.firdes.low_pass_2(1, self._fs, self._bw, self._tw, self._at)
- print "Num. Taps: ", len(taps)
+ print("Num. Taps: ", len(taps))
self.src = analog.noise_source_f(analog.GR_GAUSSIAN, 1)
self.head = blocks.head(gr.sizeof_float, self._nsamps)
@@ -95,9 +98,9 @@ def main():
nfft = 1024
f1 = pylab.figure(1, figsize=(12,10))
s1 = f1.add_subplot(1,1,1)
- s1.psd(data_src, NFFT=nfft, noverlap=nfft/4,
+ s1.psd(data_src, NFFT=nfft, noverlap=nfft / 4,
Fs=args.samplerate)
- s1.psd(data_snk, NFFT=nfft, noverlap=nfft/4,
+ s1.psd(data_snk, NFFT=nfft, noverlap=nfft / 4,
Fs=args.samplerate)
f2 = pylab.figure(2, figsize=(12,10))
diff --git a/gr-filter/examples/gr_filtdes_api.py b/gr-filter/examples/gr_filtdes_api.py
index 9e9cb1df4..162b33e7b 100755..100644
--- a/gr-filter/examples/gr_filtdes_api.py
+++ b/gr-filter/examples/gr_filtdes_api.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio.filter import filter_design
import sys
@@ -31,7 +33,7 @@ returns b,a for IIR filter design
filtobj = filter_design.launch(sys.argv)
# Displaying all filter parameters
-print "Filter Count:", filtobj.get_filtercount()
-print "Filter type:", filtobj.get_restype()
-print "Filter params", filtobj.get_params()
-print "Filter Coefficients", filtobj.get_taps()
+print("Filter Count:", filtobj.get_filtercount())
+print("Filter type:", filtobj.get_restype())
+print("Filter params", filtobj.get_params())
+print("Filter Coefficients", filtobj.get_taps())
diff --git a/gr-filter/examples/gr_filtdes_callback.py b/gr-filter/examples/gr_filtdes_callback.py
index 9496253d7..d99edffc4 100755..100644
--- a/gr-filter/examples/gr_filtdes_callback.py
+++ b/gr-filter/examples/gr_filtdes_callback.py
@@ -20,13 +20,15 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio.filter import filter_design
import sys
try:
from PyQt4 import Qt, QtCore, QtGui
except ImportError:
- print "Please install PyQt4 to run this script (http://www.riverbankcomputing.co.uk/software/pyqt/download)"
- raise SystemExit, 1
+ print("Please install PyQt4 to run this script (http://www.riverbankcomputing.co.uk/software/pyqt/download)")
+ raise SystemExit(1)
'''
Callback example
@@ -36,10 +38,10 @@ launch function returns gr_filter_design mainwindow
object when callback is not None
'''
def print_params(filtobj):
- print "Filter Count:", filtobj.get_filtercount()
- print "Filter type:", filtobj.get_restype()
- print "Filter params", filtobj.get_params()
- print "Filter Coefficients", filtobj.get_taps()
+ print("Filter Count:", filtobj.get_filtercount())
+ print("Filter type:", filtobj.get_restype())
+ print("Filter params", filtobj.get_params())
+ print("Filter Coefficients", filtobj.get_taps())
app = Qt.QApplication(sys.argv)
#launch function returns gr_filter_design mainwindow object
diff --git a/gr-filter/examples/gr_filtdes_live_upd.py b/gr-filter/examples/gr_filtdes_live_upd.py
index 9f974dd81..ca925eb9b 100755..100644
--- a/gr-filter/examples/gr_filtdes_live_upd.py
+++ b/gr-filter/examples/gr_filtdes_live_upd.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio.filter import filter_design
from gnuradio import gr, filter
from gnuradio import blocks
@@ -89,8 +91,8 @@ class my_top_block(gr.top_block):
pyWin.show()
def update_filter(self, filtobj):
- print "Filter type:", filtobj.get_restype()
- print "Filter params", filtobj.get_params()
+ print("Filter type:", filtobj.get_restype())
+ print("Filter params", filtobj.get_params())
self.filt.set_taps(filtobj.get_taps())
if __name__ == "__main__":
diff --git a/gr-filter/examples/gr_filtdes_restrict.py b/gr-filter/examples/gr_filtdes_restrict.py
index 1613cc648..c18d4c1f0 100755..100644
--- a/gr-filter/examples/gr_filtdes_restrict.py
+++ b/gr-filter/examples/gr_filtdes_restrict.py
@@ -20,13 +20,15 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio.filter import filter_design
import sys
try:
from PyQt4 import Qt, QtCore, QtGui
except ImportError:
- print "Please install PyQt4 to run this script (http://www.riverbankcomputing.co.uk/software/pyqt/download)"
- raise SystemExit, 1
+ print("Please install PyQt4 to run this script (http://www.riverbankcomputing.co.uk/software/pyqt/download)")
+ raise SystemExit(1)
'''
@@ -35,10 +37,10 @@ Function called when "design" button is pressed
or pole-zero plot is changed
'''
def print_params(filtobj):
- print "Filter Count:", filtobj.get_filtercount()
- print "Filter type:", filtobj.get_restype()
- print "Filter params", filtobj.get_params()
- print "Filter Coefficients", filtobj.get_taps()
+ print("Filter Count:", filtobj.get_filtercount())
+ print("Filter type:", filtobj.get_restype())
+ print("Filter params", filtobj.get_params())
+ print("Filter Coefficients", filtobj.get_taps())
app = Qt.QApplication(sys.argv)
main_win = filter_design.launch(sys.argv, callback = print_params, restype = "iir")
diff --git a/gr-filter/examples/interpolate.py b/gr-filter/examples/interpolate.py
index 40bab7b1f..1f1357211 100755..100644
--- a/gr-filter/examples/interpolate.py
+++ b/gr-filter/examples/interpolate.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
from gnuradio import filter
@@ -79,10 +82,10 @@ class pfb_top_block(gr.top_block):
window=filter.firdes.WIN_BLACKMAN_hARRIS)
# Calculate the number of taps per channel for our own information
- tpc = scipy.ceil(float(len(self._taps)) / float(self._interp))
- print "Number of taps: ", len(self._taps)
- print "Number of filters: ", self._interp
- print "Taps per channel: ", tpc
+ tpc = scipy.ceil(float(len(self._taps)) / float(self._interp))
+ print("Number of taps: ", len(self._taps))
+ print("Number of filters: ", self._interp)
+ print("Taps per channel: ", tpc)
# Create a couple of signals at different frequencies
self.signal1 = analog.sig_source_c(self._fs, analog.GR_SIN_WAVE, freq1, 0.5)
@@ -121,7 +124,7 @@ def main():
tstart = time.time()
tb.run()
tend = time.time()
- print "Run time: %f" % (tend - tstart)
+ print("Run time: %f" % (tend - tstart))
if 1:
@@ -141,11 +144,11 @@ def main():
d = tb.snk_i.data()[Ns:Ns+Ne]
sp1_f = fig1.add_subplot(2, 1, 1)
- X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen / 4, Fs=fs,
window = lambda d: d*winfunc(fftlen),
scale_by_freq=True)
X_in = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
- f_in = scipy.arange(-fs/2.0, fs/2.0, fs/float(X_in.size))
+ f_in = scipy.arange(-fs / 2.0, fs / 2.0, fs / float(X_in.size))
p1_f = sp1_f.plot(f_in, X_in, "b")
sp1_f.set_xlim([min(f_in), max(f_in)+1])
sp1_f.set_ylim([-200.0, 50.0])
@@ -155,7 +158,7 @@ def main():
sp1_f.set_xlabel("Frequency (Hz)")
sp1_f.set_ylabel("Power (dBW)")
- Ts = 1.0/fs
+ Ts = 1.0 / fs
Tmax = len(d)*Ts
t_in = scipy.arange(0, Tmax, Ts)
@@ -175,11 +178,11 @@ def main():
sp2_f = fig2.add_subplot(2, 1, 1)
d = tb.snk1.data()[Ns:Ns+(tb._interp*Ne)]
- X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen / 4, Fs=fs,
window = lambda d: d*winfunc(fftlen),
scale_by_freq=True)
X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
- f_o = scipy.arange(-fs_int/2.0, fs_int/2.0, fs_int/float(X_o.size))
+ f_o = scipy.arange(-fs_int / 2.0, fs_int / 2.0, fs_int / float(X_o.size))
p2_f = sp2_f.plot(f_o, X_o, "b")
sp2_f.set_xlim([min(f_o), max(f_o)+1])
sp2_f.set_ylim([-200.0, 50.0])
@@ -188,7 +191,7 @@ def main():
sp2_f.set_xlabel("Frequency (Hz)")
sp2_f.set_ylabel("Power (dBW)")
- Ts_int = 1.0/fs_int
+ Ts_int = 1.0 / fs_int
Tmax = len(d)*Ts_int
t_o = scipy.arange(0, Tmax, Ts_int)
@@ -208,11 +211,11 @@ def main():
sp3_f = fig3.add_subplot(2, 1, 1)
d = tb.snk2.data()[Ns:Ns+(tb._interp*Ne)]
- X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen/4, Fs=fs,
+ X,freq = mlab.psd(d, NFFT=fftlen, noverlap=fftlen / 4, Fs=fs,
window = lambda d: d*winfunc(fftlen),
scale_by_freq=True)
X_o = 10.0*scipy.log10(abs(fftpack.fftshift(X)))
- f_o = scipy.arange(-fs_aint/2.0, fs_aint/2.0, fs_aint/float(X_o.size))
+ f_o = scipy.arange(-fs_aint / 2.0, fs_aint / 2.0, fs_aint / float(X_o.size))
p3_f = sp3_f.plot(f_o, X_o, "b")
sp3_f.set_xlim([min(f_o), max(f_o)+1])
sp3_f.set_ylim([-200.0, 50.0])
@@ -221,7 +224,7 @@ def main():
sp3_f.set_xlabel("Frequency (Hz)")
sp3_f.set_ylabel("Power (dBW)")
- Ts_aint = 1.0/fs_aint
+ Ts_aint = 1.0 / fs_aint
Tmax = len(d)*Ts_aint
t_o = scipy.arange(0, Tmax, Ts_aint)
diff --git a/gr-filter/examples/reconstruction.py b/gr-filter/examples/reconstruction.py
index 0a83b5a4e..c9c1cd392 100755..100644
--- a/gr-filter/examples/reconstruction.py
+++ b/gr-filter/examples/reconstruction.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr, digital
from gnuradio import filter
from gnuradio import blocks
@@ -28,20 +31,20 @@ import sys
try:
from gnuradio import channels
except ImportError:
- print "Error: Program requires gr-channels."
+ print("Error: Program requires gr-channels.")
sys.exit(1)
try:
import scipy
from scipy import fftpack
except ImportError:
- print "Error: Program requires scipy (see: www.scipy.org)."
+ print("Error: Program requires scipy (see: www.scipy.org).")
sys.exit(1)
try:
import pylab
except ImportError:
- print "Error: Program requires matplotlib (see: matplotlib.sourceforge.net)."
+ print("Error: Program requires matplotlib (see: matplotlib.sourceforge.net).")
sys.exit(1)
fftlen = 8192
@@ -49,7 +52,7 @@ fftlen = 8192
def main():
N = 10000
fs = 2000.0
- Ts = 1.0/fs
+ Ts = 1.0 / fs
t = scipy.arange(0, N*Ts, Ts)
# When playing with the number of channels, be careful about the filter
@@ -62,7 +65,7 @@ def main():
proto_taps = filter.firdes.low_pass_2(1, nchans*fs,
bw, tb, 80,
filter.firdes.WIN_BLACKMAN_hARRIS)
- print "Filter length: ", len(proto_taps)
+ print("Filter length: ", len(proto_taps))
# Create a modulated signal
@@ -95,7 +98,7 @@ def main():
tb.connect(rrc, src_snk)
vsnk = []
- for i in xrange(nchans):
+ for i in range(nchans):
tb.connect((channelizer,i), (synthesizer, i))
vsnk.append(blocks.vector_sink_c())
@@ -131,10 +134,10 @@ def main():
# Plot channels
nrows = int(scipy.sqrt(nchans))
- ncols = int(scipy.ceil(float(nchans)/float(nrows)))
+ ncols = int(scipy.ceil(float(nchans) / float(nrows)))
f2 = pylab.figure(2, figsize=(16,12), facecolor='w')
- for n in xrange(nchans):
+ for n in range(nchans):
s = f2.add_subplot(nrows, ncols, n+1)
s.psd(vsnk[n].data(), NFFT=fftlen, Fs=fs_in)
s.set_title("Channel {0}".format(n))
diff --git a/gr-filter/examples/resampler.py b/gr-filter/examples/resampler.py
index e329f062d..29b25629c 100755..100644
--- a/gr-filter/examples/resampler.py
+++ b/gr-filter/examples/resampler.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import filter
from gnuradio import blocks
@@ -48,7 +51,7 @@ class mytb(gr.top_block):
gr.top_block.__init__(self)
rerate = float(fs_out) / float(fs_in)
- print "Resampling from %f to %f by %f " %(fs_in, fs_out, rerate)
+ print("Resampling from %f to %f by %f " %(fs_in, fs_out, rerate))
# Creating our own taps
taps = filter.firdes.low_pass_2(32, 32, 0.25, 0.1, 80)
@@ -91,31 +94,31 @@ def main():
fig1 = pylab.figure(1, figsize=(10,10), facecolor="w")
sp1 = fig1.add_subplot(2,1,1)
sp1.psd(tb.snk_in.data(), NFFT=nfftsize,
- noverlap=nfftsize/4, Fs = fs_in)
- sp1.set_title(("Input Signal at f_s=%.2f kHz" % (fs_in/1000.0)))
- sp1.set_xlim([-fs_in/2, fs_in/2])
+ noverlap=nfftsize / 4, Fs = fs_in)
+ sp1.set_title(("Input Signal at f_s=%.2f kHz" % (fs_in / 1000.0)))
+ sp1.set_xlim([-fs_in / 2, fs_in / 2])
sp2 = fig1.add_subplot(2,1,2)
sp2.psd(tb.snk_0.data(), NFFT=nfftsize,
- noverlap=nfftsize/4, Fs = fs_out,
+ noverlap=nfftsize / 4, Fs = fs_out,
label="With our filter")
sp2.psd(tb.snk_1.data(), NFFT=nfftsize,
- noverlap=nfftsize/4, Fs = fs_out,
+ noverlap=nfftsize / 4, Fs = fs_out,
label="With auto-generated filter")
- sp2.set_title(("Output Signals at f_s=%.2f kHz" % (fs_out/1000.0)))
- sp2.set_xlim([-fs_out/2, fs_out/2])
+ sp2.set_title(("Output Signals at f_s=%.2f kHz" % (fs_out / 1000.0)))
+ sp2.set_xlim([-fs_out / 2, fs_out / 2])
sp2.legend()
# Plot signals in time
- Ts_in = 1.0/fs_in
- Ts_out = 1.0/fs_out
+ Ts_in = 1.0 / fs_in
+ Ts_out = 1.0 / fs_out
t_in = scipy.arange(0, len(tb.snk_in.data())*Ts_in, Ts_in)
t_out = scipy.arange(0, len(tb.snk_0.data())*Ts_out, Ts_out)
fig2 = pylab.figure(2, figsize=(10,10), facecolor="w")
sp21 = fig2.add_subplot(2,1,1)
sp21.plot(t_in, tb.snk_in.data())
- sp21.set_title(("Input Signal at f_s=%.2f kHz" % (fs_in/1000.0)))
+ sp21.set_title(("Input Signal at f_s=%.2f kHz" % (fs_in / 1000.0)))
sp21.set_xlim([t_in[100], t_in[200]])
sp22 = fig2.add_subplot(2,1,2)
@@ -123,8 +126,8 @@ def main():
label="With our filter")
sp22.plot(t_out, tb.snk_1.data(),
label="With auto-generated filter")
- sp22.set_title(("Output Signals at f_s=%.2f kHz" % (fs_out/1000.0)))
- r = float(fs_out)/float(fs_in)
+ sp22.set_title(("Output Signals at f_s=%.2f kHz" % (fs_out / 1000.0)))
+ r = float(fs_out) / float(fs_in)
sp22.set_xlim([t_out[r * 100], t_out[r * 200]])
sp22.legend()
diff --git a/gr-filter/examples/synth_filter.py b/gr-filter/examples/synth_filter.py
index 5382127b3..b971c4a64 100755..100644
--- a/gr-filter/examples/synth_filter.py
+++ b/gr-filter/examples/synth_filter.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import filter
from gnuradio import blocks
@@ -57,8 +60,8 @@ def main():
taps = filter.firdes.low_pass_2(len(freqs), fs,
fs/float(nchans)/2, 100, 100)
- print "Num. Taps = %d (taps per filter = %d)" % (len(taps),
- len(taps)/nchans)
+ print("Num. Taps = %d (taps per filter = %d)" % (len(taps),
+ len(taps) / nchans))
filtbank = filter.pfb_synthesizer_ccf(nchans, taps)
head = blocks.head(gr.sizeof_gr_complex, N)
@@ -83,7 +86,7 @@ def main():
winfunc = scipy.blackman
s2.psd(snk.data()[10000:], NFFT=fftlen,
Fs = nchans*fs,
- noverlap=fftlen/4,
+ noverlap=fftlen / 4,
window = lambda d: d*winfunc(fftlen))
pylab.show()
diff --git a/gr-filter/examples/synth_to_chan.py b/gr-filter/examples/synth_to_chan.py
index 88fb080a6..f1f1da4ec 100755..100644
--- a/gr-filter/examples/synth_to_chan.py
+++ b/gr-filter/examples/synth_to_chan.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
from gnuradio import filter
@@ -59,11 +62,11 @@ def main():
fmtx.append(fm)
syntaps = filter.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100)
- print "Synthesis Num. Taps = %d (taps per filter = %d)" % (len(syntaps),
- len(syntaps)/nchans)
+ print("Synthesis Num. Taps = %d (taps per filter = %d)" % (len(syntaps),
+ len(syntaps) / nchans))
chtaps = filter.firdes.low_pass_2(len(freqs), fs, fs/float(nchans)/2, 100, 100)
- print "Channelizer Num. Taps = %d (taps per filter = %d)" % (len(chtaps),
- len(chtaps)/nchans)
+ print("Channelizer Num. Taps = %d (taps per filter = %d)" % (len(chtaps),
+ len(chtaps) / nchans))
filtbank = filter.pfb_synthesizer_ccf(nchans, syntaps)
channelizer = filter.pfb.channelizer_ccf(nchans, chtaps)
@@ -84,7 +87,7 @@ def main():
for i,si in enumerate(sigs):
tb.connect(si, fmtx[i], (filtbank, i))
- for i in xrange(nchans):
+ for i in range(nchans):
snk.append(blocks.vector_sink_c())
tb.connect((channelizer, i), snk[i])
@@ -107,7 +110,7 @@ def main():
s2 = f2.add_subplot(1,1,1)
s2.psd(data, NFFT=fftlen,
Fs = nchans*fs,
- noverlap=fftlen/4,
+ noverlap=fftlen / 4,
window = lambda d: d*winfunc(fftlen))
s2.set_title(("Output PSD from Channel %d" % channel))
@@ -115,7 +118,7 @@ def main():
s3 = f3.add_subplot(1,1,1)
s3.psd(snk_synth.data()[1000:], NFFT=fftlen,
Fs = nchans*fs,
- noverlap=fftlen/4,
+ noverlap=fftlen / 4,
window = lambda d: d*winfunc(fftlen))
s3.set_title("Output of Synthesis Filter")
diff --git a/gr-filter/grc/CMakeLists.txt b/gr-filter/grc/CMakeLists.txt
index d3039eb20..95c286a13 100644
--- a/gr-filter/grc/CMakeLists.txt
+++ b/gr-filter/grc/CMakeLists.txt
@@ -18,37 +18,37 @@
# Boston, MA 02110-1301, USA.
install(FILES
- filter_block_tree.xml
- filter_dc_blocker_xx.xml
- filter_fft_filter_xxx.xml
- filter_fir_filter_xxx.xml
- filter_filter_delay_fc.xml
- filter_filterbank_vcvcf.xml
- filter_mmse_interpolator_xx.xml
- filter_mmse_resampler_xx.xml
- filter_freq_xlating_fft_filter_ccc.xml
- filter_freq_xlating_fir_filter_xxx.xml
- filter_hilbert_fc.xml
- filter_iir_filter_xxx.xml
- filter_interp_fir_filter_xxx.xml
- filter_pfb_arb_resampler.xml
- filter_pfb_channelizer.xml
- filter_pfb_channelizer_hier.xml
- filter_pfb_decimator.xml
- filter_pfb_interpolator.xml
- filter_pfb_synthesizer.xml
- filter_rational_resampler_xxx.xml
- filter_rational_resampler_base_xxx.xml
- filter_single_pole_iir_filter_xx.xml
- filter_low_pass_filter.xml
- filter_high_pass_filter.xml
- filter_band_pass_filter.xml
- filter_band_reject_filter.xml
- filter_root_raised_cosine_filter.xml
- variable_low_pass_filter_taps.xml
- variable_high_pass_filter_taps.xml
- variable_band_pass_filter_taps.xml
- variable_band_reject_filter_taps.xml
- variable_rrc_filter_taps.xml
+ filter.tree.yml
+ filter_dc_blocker_xx.block.yml
+ filter_fft_filter_xxx.block.yml
+ filter_fir_filter_xxx.block.yml
+ filter_filter_delay_fc.block.yml
+ filter_filterbank_vcvcf.block.yml
+ filter_mmse_interpolator_xx.block.yml
+ filter_mmse_resampler_xx.block.yml
+ filter_freq_xlating_fft_filter_ccc.block.yml
+ filter_freq_xlating_fir_filter_xxx.block.yml
+ filter_hilbert_fc.block.yml
+ filter_iir_filter_xxx.block.yml
+ filter_interp_fir_filter_xxx.block.yml
+ filter_pfb_arb_resampler.block.yml
+ filter_pfb_channelizer.block.yml
+ filter_pfb_channelizer_hier.block.yml
+ filter_pfb_decimator.block.yml
+ filter_pfb_interpolator.block.yml
+ filter_pfb_synthesizer.block.yml
+ filter_rational_resampler_xxx.block.yml
+ filter_rational_resampler_base_xxx.block.yml
+ filter_single_pole_iir_filter_xx.block.yml
+ filter_low_pass_filter.block.yml
+ filter_high_pass_filter.block.yml
+ filter_band_pass_filter.block.yml
+ filter_band_reject_filter.block.yml
+ filter_root_raised_cosine_filter.block.yml
+ variable_low_pass_filter_taps.block.yml
+ variable_high_pass_filter_taps.block.yml
+ variable_band_pass_filter_taps.block.yml
+ variable_band_reject_filter_taps.block.yml
+ variable_rrc_filter_taps.block.yml
DESTINATION ${GRC_BLOCKS_DIR}
)
diff --git a/gr-filter/grc/filter.tree.yml b/gr-filter/grc/filter.tree.yml
new file mode 100644
index 000000000..dcb84503c
--- /dev/null
+++ b/gr-filter/grc/filter.tree.yml
@@ -0,0 +1,35 @@
+'[Core]':
+- Filters:
+ - variable_low_pass_filter_taps
+ - variable_high_pass_filter_taps
+ - variable_band_pass_filter_taps
+ - variable_band_reject_filter_taps
+ - variable_rrc_filter_taps
+ - low_pass_filter
+ - high_pass_filter
+ - band_pass_filter
+ - band_reject_filter
+ - root_raised_cosine_filter
+ - dc_blocker_xx
+ - fft_filter_xxx
+ - fir_filter_xxx
+ - filterbank_vcvcf
+ - filter_delay_fc
+ - hilbert_fc
+ - iir_filter_xxx
+ - interp_fir_filter_xxx
+ - single_pole_iir_filter_xx
+- Resamplers:
+ - mmse_resampler_xx
+ - mmse_interpolator_xx
+ - pfb_arb_resampler_xxx
+ - rational_resampler_xxx
+ - rational_resampler_base_xxx
+- Channelizers:
+ - freq_xlating_fft_filter_ccc
+ - freq_xlating_fir_filter_xxx
+ - pfb_channelizer_ccf
+ - pfb_channelizer_hier_ccf
+ - pfb_decimator_ccf
+ - pfb_interpolator_ccf
+ - pfb_synthesizer_ccf
diff --git a/gr-filter/grc/filter_band_pass_filter.block.yml b/gr-filter/grc/filter_band_pass_filter.block.yml
new file mode 100644
index 000000000..3d193cb12
--- /dev/null
+++ b/gr-filter/grc/filter_band_pass_filter.block.yml
@@ -0,0 +1,85 @@
+id: band_pass_filter
+label: Band Pass Filter
+
+parameters:
+- id: type
+ label: FIR Type
+ dtype: enum
+ options: [fir_filter_ccf, interp_fir_filter_ccf, fir_filter_fff, interp_fir_filter_fff,
+ fir_filter_ccc, interp_fir_filter_ccc, fir_filter_fcc, interp_fir_filter_fcc]
+ option_labels: [Complex->Complex (Real Taps) (Decim), Complex->Complex (Real Taps)
+ (Interp), Float->Float (Real Taps) (Decim), Float->Float (Real Taps) (Interp),
+ Complex->Complex (Complex Taps) (Decim), Complex->Complex (Complex Taps) (Interp),
+ Float->Complex (Complex Taps) (Decim), Float->Complex (Complex Taps) (Interp)]
+ option_attributes:
+ fcn: [band_pass, band_pass, band_pass, band_pass, complex_band_pass, complex_band_pass,
+ complex_band_pass, complex_band_pass]
+ input: [complex, complex, float, float, complex, complex, float, float]
+ output: [complex, complex, float, float, complex, complex, complex, complex]
+ hide: part
+- id: decim
+ label: Decimation
+ dtype: int
+ default: '1'
+ hide: ${ ('all' if str(type).startswith('interp') else 'none') }
+- id: interp
+ label: Interpolation
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if str(type).startswith('interp') else 'all') }
+- id: gain
+ label: Gain
+ dtype: real
+ default: '1'
+- id: samp_rate
+ label: Sample Rate
+ dtype: real
+ default: samp_rate
+- id: low_cutoff_freq
+ label: Low Cutoff Freq
+ dtype: real
+- id: high_cutoff_freq
+ label: High Cutoff Freq
+ dtype: real
+- id: width
+ label: Transition Width
+ dtype: real
+- id: win
+ label: Window
+ dtype: int
+ default: firdes.WIN_HAMMING
+ options: [firdes.WIN_HAMMING, firdes.WIN_HANN, firdes.WIN_BLACKMAN, firdes.WIN_RECTANGULAR,
+ firdes.WIN_KAISER]
+ option_labels: [Hamming, Hann, Blackman, Rectangular, Kaiser]
+- id: beta
+ label: Beta
+ dtype: real
+ default: '6.76'
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+
+templates:
+ imports: |-
+ from gnuradio import filter
+ from gnuradio.filter import firdes
+ make: "filter.$(type)(% if str(type).startswith('interp') then interp else decim#,\
+ \ firdes.type.fcn(:\n\t${gain}, ${samp_rate}, ${low_cutoff_freq}, ${high_cutoff_freq},\
+ \ ${width}, ${win}, ${beta}))"
+ callbacks:
+ - set_taps(firdes.${type.fcn}(${gain}, ${samp_rate}, ${low_cutoff_freq}, ${high_cutoff_freq},
+ ${width}, ${win}, ${beta}))
+
+documentation: |-
+ This filter is a convenience wrapper for an fir filter and a firdes taps generating function.
+
+ Sample rate, cutoff frequency, and transition width are in Hertz.
+
+ The beta paramater only applies to the Kaiser window.
+
+file_format: 1
diff --git a/gr-filter/grc/filter_band_pass_filter.xml b/gr-filter/grc/filter_band_pass_filter.xml
deleted file mode 100644
index c4c185248..000000000
--- a/gr-filter/grc/filter_band_pass_filter.xml
+++ /dev/null
@@ -1,166 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Band Pass Filter: Custom wrapper
-###################################################
- -->
-<block>
- <name>Band Pass Filter</name>
- <key>band_pass_filter</key>
- <import>from gnuradio import filter</import>
- <import>from gnuradio.filter import firdes</import>
- <make>filter.$(type)(#if str($type).startswith('interp') then $interp else $decim#, firdes.$(type.fcn)(
- $gain, $samp_rate, $low_cutoff_freq, $high_cutoff_freq, $width, $win, $beta))</make>
- <callback>set_taps(firdes.$(type.fcn)($gain, $samp_rate, $low_cutoff_freq, $high_cutoff_freq, $width, $win, $beta))</callback>
- <param>
- <name>FIR Type</name>
- <key>type</key>
- <type>enum</type>
- <!-- Real Band Pass Taps -->
- <option>
- <name>Complex->Complex (Real Taps) (Decim)</name>
- <key>fir_filter_ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>fcn:band_pass</opt>
- </option>
- <option>
- <name>Complex->Complex (Real Taps) (Interp)</name>
- <key>interp_fir_filter_ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>fcn:band_pass</opt>
- </option>
- <option>
- <name>Float->Float (Real Taps) (Decim)</name>
- <key>fir_filter_fff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- <opt>fcn:band_pass</opt>
- </option>
- <option>
- <name>Float->Float (Real Taps) (Interp)</name>
- <key>interp_fir_filter_fff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- <opt>fcn:band_pass</opt>
- </option>
- <!-- Complex Band Pass Taps -->
- <option>
- <name>Complex->Complex (Complex Taps) (Decim)</name>
- <key>fir_filter_ccc</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>fcn:complex_band_pass</opt>
- </option>
- <option>
- <name>Complex->Complex (Complex Taps) (Interp)</name>
- <key>interp_fir_filter_ccc</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>fcn:complex_band_pass</opt>
- </option>
- <option>
- <name>Float->Complex (Complex Taps) (Decim)</name>
- <key>fir_filter_fcc</key>
- <opt>input:float</opt>
- <opt>output:complex</opt>
- <opt>fcn:complex_band_pass</opt>
- </option>
- <option>
- <name>Float->Complex (Complex Taps) (Interp)</name>
- <key>interp_fir_filter_fcc</key>
- <opt>input:float</opt>
- <opt>output:complex</opt>
- <opt>fcn:complex_band_pass</opt>
- </option>
- </param>
- <param>
- <name>Decimation</name>
- <key>decim</key>
- <value>1</value>
- <type>int</type>
- <hide>#if str($type).startswith('interp') then 'all' else 'none'#</hide>
- </param>
- <param>
- <name>Interpolation</name>
- <key>interp</key>
- <value>1</value>
- <type>int</type>
- <hide>#if str($type).startswith('interp') then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1</value>
- <type>real</type>
- </param>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>Low Cutoff Freq</name>
- <key>low_cutoff_freq</key>
- <type>real</type>
- </param>
- <param>
- <name>High Cutoff Freq</name>
- <key>high_cutoff_freq</key>
- <type>real</type>
- </param>
- <param>
- <name>Transition Width</name>
- <key>width</key>
- <type>real</type>
- </param>
- <param>
- <name>Window</name>
- <key>win</key>
- <value>firdes.WIN_HAMMING</value>
- <type>int</type>
- <option>
- <name>Hamming</name>
- <key>firdes.WIN_HAMMING</key>
- </option>
- <option>
- <name>Hann</name>
- <key>firdes.WIN_HANN</key>
- </option>
- <option>
- <name>Blackman</name>
- <key>firdes.WIN_BLACKMAN</key>
- </option>
- <option>
- <name>Rectangular</name>
- <key>firdes.WIN_RECTANGULAR</key>
- </option>
- <option>
- <name>Kaiser</name>
- <key>firdes.WIN_KAISER</key>
- </option>
- </param>
- <param>
- <name>Beta</name>
- <key>beta</key>
- <value>6.76</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
- <doc>
-This filter is a convenience wrapper for an fir filter and a firdes taps generating function.
-
-Sample rate, cutoff frequency, and transition width are in Hertz.
-
-The beta paramater only applies to the Kaiser window.
- </doc>
-</block>
diff --git a/gr-filter/grc/filter_band_reject_filter.block.yml b/gr-filter/grc/filter_band_reject_filter.block.yml
new file mode 100644
index 000000000..a030bf4e4
--- /dev/null
+++ b/gr-filter/grc/filter_band_reject_filter.block.yml
@@ -0,0 +1,80 @@
+id: band_reject_filter
+label: Band Reject Filter
+
+parameters:
+- id: type
+ label: FIR Type
+ dtype: enum
+ options: [fir_filter_ccf, interp_fir_filter_ccf, fir_filter_fff, interp_fir_filter_fff]
+ option_labels: [Complex->Complex (Decimating), Complex->Complex (Interpolating),
+ Float->Float (Decimating), Float->Float (Interpolating)]
+ option_attributes:
+ input: [complex, complex, float, float]
+ output: [complex, complex, float, float]
+ hide: part
+- id: decim
+ label: Decimation
+ dtype: int
+ default: '1'
+ hide: ${ ('all' if str(type).startswith('interp') else 'none') }
+- id: interp
+ label: Interpolation
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if str(type).startswith('interp') else 'all') }
+- id: gain
+ label: Gain
+ dtype: real
+ default: '1'
+- id: samp_rate
+ label: Sample Rate
+ dtype: real
+ default: samp_rate
+- id: low_cutoff_freq
+ label: Low Cutoff Freq
+ dtype: real
+- id: high_cutoff_freq
+ label: High Cutoff Freq
+ dtype: real
+- id: width
+ label: Transition Width
+ dtype: real
+- id: win
+ label: Window
+ dtype: int
+ default: firdes.WIN_HAMMING
+ options: [firdes.WIN_HAMMING, firdes.WIN_HANN, firdes.WIN_BLACKMAN, firdes.WIN_RECTANGULAR,
+ firdes.WIN_KAISER]
+ option_labels: [Hamming, Hann, Blackman, Rectangular, Kaiser]
+- id: beta
+ label: Beta
+ dtype: real
+ default: '6.76'
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+
+templates:
+ imports: |-
+ from gnuradio import filter
+ from gnuradio.filter import firdes
+ make: "filter.$(type)(% if str(type).startswith('interp') then interp else decim#,\
+ \ firdes.band_reject(:\n\t${gain}, ${samp_rate}, ${low_cutoff_freq}, ${high_cutoff_freq},\
+ \ ${width}, ${win}, ${beta}))"
+ callbacks:
+ - set_taps(firdes.band_reject(${gain}, ${samp_rate}, ${low_cutoff_freq}, ${high_cutoff_freq},
+ ${width}, ${win}, ${beta}))
+
+documentation: |-
+ This filter is a convenience wrapper for an fir filter and a firdes taps generating function.
+
+ Sample rate, cutoff frequency, and transition width are in Hertz.
+
+ The beta paramater only applies to the Kaiser window.
+
+file_format: 1
diff --git a/gr-filter/grc/filter_band_reject_filter.xml b/gr-filter/grc/filter_band_reject_filter.xml
deleted file mode 100644
index a50678962..000000000
--- a/gr-filter/grc/filter_band_reject_filter.xml
+++ /dev/null
@@ -1,132 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Band Reject Filter: Custom wrapper
-###################################################
- -->
-<block>
- <name>Band Reject Filter</name>
- <key>band_reject_filter</key>
- <import>from gnuradio import filter</import>
- <import>from gnuradio.filter import firdes</import>
- <make>filter.$(type)(#if str($type).startswith('interp') then $interp else $decim#, firdes.band_reject(
- $gain, $samp_rate, $low_cutoff_freq, $high_cutoff_freq, $width, $win, $beta))</make>
- <callback>set_taps(firdes.band_reject($gain, $samp_rate, $low_cutoff_freq, $high_cutoff_freq, $width, $win, $beta))</callback>
- <param>
- <name>FIR Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex->Complex (Decimating)</name>
- <key>fir_filter_ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- </option>
- <option>
- <name>Complex->Complex (Interpolating)</name>
- <key>interp_fir_filter_ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- </option>
- <option>
- <name>Float->Float (Decimating)</name>
- <key>fir_filter_fff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- </option>
- <option>
- <name>Float->Float (Interpolating)</name>
- <key>interp_fir_filter_fff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- </option>
- </param>
- <param>
- <name>Decimation</name>
- <key>decim</key>
- <value>1</value>
- <type>int</type>
- <hide>#if str($type).startswith('interp') then 'all' else 'none'#</hide>
- </param>
- <param>
- <name>Interpolation</name>
- <key>interp</key>
- <value>1</value>
- <type>int</type>
- <hide>#if str($type).startswith('interp') then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1</value>
- <type>real</type>
- </param>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>Low Cutoff Freq</name>
- <key>low_cutoff_freq</key>
- <type>real</type>
- </param>
- <param>
- <name>High Cutoff Freq</name>
- <key>high_cutoff_freq</key>
- <type>real</type>
- </param>
- <param>
- <name>Transition Width</name>
- <key>width</key>
- <type>real</type>
- </param>
- <param>
- <name>Window</name>
- <key>win</key>
- <value>firdes.WIN_HAMMING</value>
- <type>int</type>
- <option>
- <name>Hamming</name>
- <key>firdes.WIN_HAMMING</key>
- </option>
- <option>
- <name>Hann</name>
- <key>firdes.WIN_HANN</key>
- </option>
- <option>
- <name>Blackman</name>
- <key>firdes.WIN_BLACKMAN</key>
- </option>
- <option>
- <name>Rectangular</name>
- <key>firdes.WIN_RECTANGULAR</key>
- </option>
- <option>
- <name>Kaiser</name>
- <key>firdes.WIN_KAISER</key>
- </option>
- </param>
- <param>
- <name>Beta</name>
- <key>beta</key>
- <value>6.76</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
- <doc>
-This filter is a convenience wrapper for an fir filter and a firdes taps generating function.
-
-Sample rate, cutoff frequency, and transition width are in Hertz.
-
-The beta paramater only applies to the Kaiser window.
- </doc>
-</block>
diff --git a/gr-filter/grc/filter_block_tree.xml b/gr-filter/grc/filter_block_tree.xml
deleted file mode 100644
index b296e1cc7..000000000
--- a/gr-filter/grc/filter_block_tree.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2012,2015 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##Block Tree for GR Filter blocks.
-###################################################
- -->
-<cat>
- <name>[Core]</name>
- <cat>
- <name>Filters</name>
- <!-- FIR filter tap generators -->
- <block>variable_low_pass_filter_taps</block>
- <block>variable_high_pass_filter_taps</block>
- <block>variable_band_pass_filter_taps</block>
- <block>variable_band_reject_filter_taps</block>
- <block>variable_rrc_filter_taps</block>
- <!-- FIR convenience filters -->
- <block>low_pass_filter</block>
- <block>high_pass_filter</block>
- <block>band_pass_filter</block>
- <block>band_reject_filter</block>
- <block>root_raised_cosine_filter</block>
- <!-- Regular Filter Blocks -->
- <block>dc_blocker_xx</block>
- <block>fft_filter_xxx</block>
- <block>fir_filter_xxx</block>
- <block>filterbank_vcvcf</block>
- <block>filter_delay_fc</block>
- <block>hilbert_fc</block>
- <block>iir_filter_xxx</block>
- <block>interp_fir_filter_xxx</block>
- <block>single_pole_iir_filter_xx</block>
- </cat>
- <cat>
- <name>Resamplers</name>
- <block>mmse_resampler_xx</block>
- <block>mmse_interpolator_xx</block>
- <block>pfb_arb_resampler_xxx</block>
- <block>rational_resampler_xxx</block>
- <block>rational_resampler_base_xxx</block>
- </cat>
- <cat>
- <name>Channelizers</name>
- <block>freq_xlating_fft_filter_ccc</block>
- <block>freq_xlating_fir_filter_xxx</block>
- <block>pfb_channelizer_ccf</block>
- <block>pfb_channelizer_hier_ccf</block>
- <block>pfb_decimator_ccf</block>
- <block>pfb_interpolator_ccf</block>
- <block>pfb_synthesizer_ccf</block>
- </cat>
-</cat>
diff --git a/gr-filter/grc/filter_dc_blocker_xx.block.yml b/gr-filter/grc/filter_dc_blocker_xx.block.yml
new file mode 100644
index 000000000..2187624ff
--- /dev/null
+++ b/gr-filter/grc/filter_dc_blocker_xx.block.yml
@@ -0,0 +1,35 @@
+id: dc_blocker_xx
+label: DC Blocker
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [cc, ff]
+ option_labels: [Complex->Complex, Float->Float]
+ option_attributes:
+ input: [complex, float]
+ output: [complex, float]
+ hide: part
+- id: length
+ label: Length
+ dtype: int
+ default: '32'
+- id: long_form
+ label: Long Form
+ dtype: bool
+ default: 'True'
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+
+templates:
+ imports: from gnuradio import filter
+ make: filter.dc_blocker_${type}(${length}, ${long_form})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_dc_blocker_xx.xml b/gr-filter/grc/filter_dc_blocker_xx.xml
deleted file mode 100644
index 9bce5e980..000000000
--- a/gr-filter/grc/filter_dc_blocker_xx.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## DC Blocker
-###################################################
- -->
-<block>
- <name>DC Blocker</name>
- <key>dc_blocker_xx</key>
- <import>from gnuradio import filter</import>
- <make>filter.dc_blocker_$(type)($length, $long_form)</make>
- <!-- <callback>set_length($length)</callback> -->
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex->Complex</name>
- <key>cc</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- </option>
- <option>
- <name>Float->Float</name>
- <key>ff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- </option>
- </param>
- <param>
- <name>Length</name>
- <key>length</key>
- <value>32</value>
- <type>int</type>
- </param>
- <param>
- <name>Long Form</name>
- <key>long_form</key>
- <value>True</value>
- <type>bool</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
-</block>
diff --git a/gr-filter/grc/filter_fft_filter_xxx.block.yml b/gr-filter/grc/filter_fft_filter_xxx.block.yml
new file mode 100644
index 000000000..bc53a02cd
--- /dev/null
+++ b/gr-filter/grc/filter_fft_filter_xxx.block.yml
@@ -0,0 +1,52 @@
+id: fft_filter_xxx
+label: FFT Filter
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [ccc, ccf, fff]
+ option_labels: [Complex->Complex (Complex Taps), Complex->Complex (Real Taps),
+ Float->Float (Real Taps)]
+ option_attributes:
+ input: [complex, complex, float]
+ output: [complex, complex, float]
+ taps: [complex_vector, float_vector, float_vector]
+ hide: part
+- id: decim
+ label: Decimation
+ dtype: int
+ default: '1'
+- id: taps
+ label: Taps
+ dtype: ${ type.taps }
+- id: samp_delay
+ label: Sample Delay
+ dtype: int
+ default: '0'
+ hide: part
+- id: nthreads
+ label: Num. Threads
+ dtype: int
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+
+templates:
+ imports: |-
+ from gnuradio import filter
+ from gnuradio.filter import firdes
+ make: |
+ filter.fft_filter_${type}(${decim}, ${taps}, ${nthreads})
+ self.${id}.declare_sample_delay(${samp_delay})
+ callbacks:
+ - set_taps(${taps})
+ - set_nthreads(${nthreads})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_fft_filter_xxx.xml b/gr-filter/grc/filter_fft_filter_xxx.xml
deleted file mode 100644
index f843af202..000000000
--- a/gr-filter/grc/filter_fft_filter_xxx.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##FFT Filter
-###################################################
- -->
-<block>
- <name>FFT Filter</name>
- <key>fft_filter_xxx</key>
- <import>from gnuradio import filter</import>
- <import>from gnuradio.filter import firdes</import>
- <make>filter.fft_filter_$(type)($decim, $taps, $nthreads)
-self.$(id).declare_sample_delay($samp_delay)
-</make>
- <callback>set_taps($taps)</callback>
- <callback>set_nthreads($nthreads)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex->Complex (Complex Taps)</name>
- <key>ccc</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- <option>
- <name>Complex->Complex (Real Taps)</name>
- <key>ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:float_vector</opt>
- </option>
- <option>
- <name>Float->Float (Real Taps)</name>
- <key>fff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- <opt>taps:float_vector</opt>
- </option>
- </param>
- <param>
- <name>Decimation</name>
- <key>decim</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Taps</name>
- <key>taps</key>
- <type>$type.taps</type>
- </param>
- <param>
- <name>Sample Delay</name>
- <key>samp_delay</key>
- <value>0</value>
- <type>int</type>
- <hide>part</hide>
- </param>
- <param>
- <name>Num. Threads</name>
- <key>nthreads</key>
- <value>1</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
-</block>
diff --git a/gr-filter/grc/filter_filter_delay_fc.block.yml b/gr-filter/grc/filter_filter_delay_fc.block.yml
new file mode 100644
index 000000000..5c220ccca
--- /dev/null
+++ b/gr-filter/grc/filter_filter_delay_fc.block.yml
@@ -0,0 +1,26 @@
+id: filter_delay_fc
+label: Filter Delay
+
+parameters:
+- id: taps
+ label: Taps
+ dtype: real_vector
+
+inputs:
+- domain: stream
+ dtype: float
+- domain: stream
+ dtype: float
+ optional: true
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: |-
+ from gnuradio import filter
+ from gnuradio.filter import firdes
+ make: filter.filter_delay_fc(${taps})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_filter_delay_fc.xml b/gr-filter/grc/filter_filter_delay_fc.xml
deleted file mode 100644
index 7b77c2caf..000000000
--- a/gr-filter/grc/filter_filter_delay_fc.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Filter Delay
-###################################################
- -->
-<block>
- <name>Filter Delay</name>
- <key>filter_delay_fc</key>
- <import>from gnuradio import filter</import>
- <import>from gnuradio.filter import firdes</import>
- <make>filter.filter_delay_fc($taps)</make>
- <param>
- <name>Taps</name>
- <key>taps</key>
- <type>real_vector</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <sink>
- <name>in</name>
- <type>float</type>
- <optional>1</optional>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-filter/grc/filter_filterbank_vcvcf.block.yml b/gr-filter/grc/filter_filterbank_vcvcf.block.yml
new file mode 100644
index 000000000..7ced5e27c
--- /dev/null
+++ b/gr-filter/grc/filter_filterbank_vcvcf.block.yml
@@ -0,0 +1,26 @@
+id: filterbank_vcvcf
+label: Generic Filterbank
+
+parameters:
+- id: taps
+ label: Taps(list of lists)
+ dtype: raw
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ len(taps) }
+
+outputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ len(taps) }
+
+templates:
+ imports: from gnuradio import filter
+ make: filter.filterbank_vcvcf(${taps})
+ callbacks:
+ - set_taps(${taps})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_filterbank_vcvcf.xml b/gr-filter/grc/filter_filterbank_vcvcf.xml
deleted file mode 100644
index c8175358d..000000000
--- a/gr-filter/grc/filter_filterbank_vcvcf.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Generic Filterbank
-###################################################
- -->
-<block>
- <name>Generic Filterbank</name>
- <key>filterbank_vcvcf</key>
- <import>from gnuradio import filter</import>
- <make>filter.filterbank_vcvcf($taps)</make>
- <callback>set_taps($taps)</callback>
- <param>
- <name>Taps(list of lists)</name>
- <key>taps</key>
- <value></value>
- <type>raw</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- <vlen>len($taps)</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- <vlen>len($taps)</vlen>
- </source>
-</block>
diff --git a/gr-filter/grc/filter_fir_filter_xxx.block.yml b/gr-filter/grc/filter_fir_filter_xxx.block.yml
new file mode 100644
index 000000000..4d2f16b60
--- /dev/null
+++ b/gr-filter/grc/filter_fir_filter_xxx.block.yml
@@ -0,0 +1,49 @@
+id: fir_filter_xxx
+label: Decimating FIR Filter
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [ccc, ccf, fcc, fff, fsf, scc]
+ option_labels: [Complex->Complex (Complex Taps), Complex->Complex (Real Taps),
+ Float->Complex (Complex Taps), Float->Float (Real Taps), Float->Short (Real
+ Taps), Short->Complex (Complex Taps)]
+ option_attributes:
+ input: [complex, complex, float, float, float, short]
+ output: [complex, complex, complex, float, short, complex]
+ taps: [complex_vector, real_vector, complex_vector, real_vector, real_vector,
+ complex_vector]
+ hide: part
+- id: decim
+ label: Decimation
+ dtype: int
+ default: '1'
+- id: taps
+ label: Taps
+ dtype: ${ type.taps }
+- id: samp_delay
+ label: Sample Delay
+ dtype: int
+ default: '0'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+
+templates:
+ imports: |-
+ from gnuradio import filter
+ from gnuradio.filter import firdes
+ make: |
+ filter.fir_filter_${type}(${decim}, ${taps})
+ self.${id}.declare_sample_delay(${samp_delay})
+ callbacks:
+ - set_taps(${taps})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_fir_filter_xxx.xml b/gr-filter/grc/filter_fir_filter_xxx.xml
deleted file mode 100644
index edfd4b30c..000000000
--- a/gr-filter/grc/filter_fir_filter_xxx.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Decimating FIR Filter
-###################################################
- -->
-<block>
- <name>Decimating FIR Filter</name>
- <key>fir_filter_xxx</key>
- <import>from gnuradio import filter</import>
- <import>from gnuradio.filter import firdes</import>
- <make>filter.fir_filter_$(type)($decim, $taps)
-self.$(id).declare_sample_delay($samp_delay)
-</make>
- <callback>set_taps($taps)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex->Complex (Complex Taps)</name>
- <key>ccc</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- <option>
- <name>Complex->Complex (Real Taps)</name>
- <key>ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Float->Complex (Complex Taps)</name>
- <key>fcc</key>
- <opt>input:float</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- <option>
- <name>Float->Float (Real Taps)</name>
- <key>fff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Float->Short (Real Taps)</name>
- <key>fsf</key>
- <opt>input:float</opt>
- <opt>output:short</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Short->Complex (Complex Taps)</name>
- <key>scc</key>
- <opt>input:short</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- </param>
- <param>
- <name>Decimation</name>
- <key>decim</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Taps</name>
- <key>taps</key>
- <type>$type.taps</type>
- </param>
- <param>
- <name>Sample Delay</name>
- <key>samp_delay</key>
- <value>0</value>
- <type>int</type>
- <hide>part</hide>
- </param>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
-</block>
diff --git a/gr-filter/grc/filter_freq_xlating_fft_filter_ccc.block.yml b/gr-filter/grc/filter_freq_xlating_fft_filter_ccc.block.yml
new file mode 100644
index 000000000..734f1aa90
--- /dev/null
+++ b/gr-filter/grc/filter_freq_xlating_fft_filter_ccc.block.yml
@@ -0,0 +1,51 @@
+id: freq_xlating_fft_filter_ccc
+label: Frequency Xlating FFT Filter
+
+parameters:
+- id: decim
+ label: Decimation
+ dtype: int
+ default: '1'
+- id: taps
+ label: Taps
+ dtype: complex_vector
+- id: center_freq
+ label: Center Frequency
+ dtype: real
+ default: '0'
+- id: samp_rate
+ label: Sample Rate
+ dtype: real
+ default: samp_rate
+- id: samp_delay
+ label: Sample Delay
+ dtype: int
+ default: '0'
+ hide: part
+- id: nthreads
+ label: Num. Threads
+ dtype: int
+ default: '1'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: |-
+ from gnuradio import filter
+ from gnuradio.filter import firdes
+ make: |-
+ filter.freq_xlating_fft_filter_ccc(${decim}, ${taps}, ${center_freq}, ${samp_rate})
+ self.${id}.set_nthreads(${nthreads})
+ self.${id}.declare_sample_delay(${samp_delay})
+ callbacks:
+ - set_taps(${taps})
+ - set_center_freq(${center_freq})
+ - set_nthreads(${nthreads})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_freq_xlating_fft_filter_ccc.xml b/gr-filter/grc/filter_freq_xlating_fft_filter_ccc.xml
deleted file mode 100644
index ec27a4ff4..000000000
--- a/gr-filter/grc/filter_freq_xlating_fft_filter_ccc.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Frequency Xlating FFT Filter
-###################################################
- -->
-<block>
- <name>Frequency Xlating FFT Filter</name>
- <key>freq_xlating_fft_filter_ccc</key>
- <import>from gnuradio import filter</import>
- <import>from gnuradio.filter import firdes</import>
- <make>filter.freq_xlating_fft_filter_ccc($decim, $taps, $center_freq, $samp_rate)
-self.$(id).set_nthreads($nthreads)
-self.$(id).declare_sample_delay($samp_delay)</make>
- <callback>set_taps($taps)</callback>
- <callback>set_center_freq($center_freq)</callback>
- <callback>set_nthreads($nthreads)</callback>
- <param>
- <name>Decimation</name>
- <key>decim</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Taps</name>
- <key>taps</key>
- <type>complex_vector</type>
- </param>
- <param>
- <name>Center Frequency</name>
- <key>center_freq</key>
- <value>0</value>
- <type>real</type>
- </param>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>Sample Delay</name>
- <key>samp_delay</key>
- <value>0</value>
- <type>int</type>
- <hide>part</hide>
- </param>
- <param>
- <name>Num. Threads</name>
- <key>nthreads</key>
- <value>1</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-filter/grc/filter_freq_xlating_fir_filter_xxx.block.yml b/gr-filter/grc/filter_freq_xlating_fir_filter_xxx.block.yml
new file mode 100644
index 000000000..aece398e2
--- /dev/null
+++ b/gr-filter/grc/filter_freq_xlating_fir_filter_xxx.block.yml
@@ -0,0 +1,55 @@
+id: freq_xlating_fir_filter_xxx
+label: Frequency Xlating FIR Filter
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [ccc, ccf, fcc, fcf, scc, scf]
+ option_labels: [Complex->Complex (Complex Taps), Complex->Complex (Real Taps),
+ Float->Complex (Complex Taps), Float->Complex (Real Taps), Short->Complex
+ (Complex Taps), Short->Complex (Real Taps)]
+ option_attributes:
+ input: [complex, complex, float, float, short, short]
+ output: [complex, complex, complex, complex, complex, complex]
+ taps: [complex_vector, real_vector, complex_vector, real_vector, complex_vector,
+ real_vector]
+ hide: part
+- id: decim
+ label: Decimation
+ dtype: int
+ default: '1'
+- id: taps
+ label: Taps
+ dtype: ${ type.taps }
+- id: center_freq
+ label: Center Frequency
+ dtype: real
+ default: '0'
+- id: samp_rate
+ label: Sample Rate
+ dtype: real
+ default: samp_rate
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+- domain: message
+ id: freq
+ optional: true
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+
+templates:
+ imports: |-
+ from gnuradio import filter
+ from gnuradio.filter import firdes
+ make: filter.freq_xlating_fir_filter_${type}(${decim}, ${taps}, ${center_freq},
+ ${samp_rate})
+ callbacks:
+ - set_taps(${taps})
+ - set_center_freq(${center_freq})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_freq_xlating_fir_filter_xxx.xml b/gr-filter/grc/filter_freq_xlating_fir_filter_xxx.xml
deleted file mode 100644
index 8c8e100e6..000000000
--- a/gr-filter/grc/filter_freq_xlating_fir_filter_xxx.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Frequency Xlating Filter
-###################################################
- -->
-<block>
- <name>Frequency Xlating FIR Filter</name>
- <key>freq_xlating_fir_filter_xxx</key>
- <import>from gnuradio import filter</import>
- <import>from gnuradio.filter import firdes</import>
- <make>filter.freq_xlating_fir_filter_$(type)($decim, $taps, $center_freq, $samp_rate)</make>
- <callback>set_taps($taps)</callback>
- <callback>set_center_freq($center_freq)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex->Complex (Complex Taps)</name>
- <key>ccc</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- <option>
- <name>Complex->Complex (Real Taps)</name>
- <key>ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Float->Complex (Complex Taps)</name>
- <key>fcc</key>
- <opt>input:float</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- <option>
- <name>Float->Complex (Real Taps)</name>
- <key>fcf</key>
- <opt>input:float</opt>
- <opt>output:complex</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Short->Complex (Complex Taps)</name>
- <key>scc</key>
- <opt>input:short</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- <option>
- <name>Short->Complex (Real Taps)</name>
- <key>scf</key>
- <opt>input:short</opt>
- <opt>output:complex</opt>
- <opt>taps:real_vector</opt>
- </option>
- </param>
- <param>
- <name>Decimation</name>
- <key>decim</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Taps</name>
- <key>taps</key>
- <type>$type.taps</type>
- </param>
- <param>
- <name>Center Frequency</name>
- <key>center_freq</key>
- <value>0</value>
- <type>real</type>
- </param>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
-
- <sink>
- <name>freq</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
-
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
-</block>
diff --git a/gr-filter/grc/filter_high_pass_filter.block.yml b/gr-filter/grc/filter_high_pass_filter.block.yml
new file mode 100644
index 000000000..26947d182
--- /dev/null
+++ b/gr-filter/grc/filter_high_pass_filter.block.yml
@@ -0,0 +1,77 @@
+id: high_pass_filter
+label: High Pass Filter
+
+parameters:
+- id: type
+ label: FIR Type
+ dtype: enum
+ options: [fir_filter_ccf, interp_fir_filter_ccf, fir_filter_fff, interp_fir_filter_fff]
+ option_labels: [Complex->Complex (Decimating), Complex->Complex (Interpolating),
+ Float->Float (Decimating), Float->Float (Interpolating)]
+ option_attributes:
+ input: [complex, complex, float, float]
+ output: [complex, complex, float, float]
+ hide: part
+- id: decim
+ label: Decimation
+ dtype: int
+ default: '1'
+ hide: ${ ('all' if str(type).startswith('interp') else 'none') }
+- id: interp
+ label: Interpolation
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if str(type).startswith('interp') else 'all') }
+- id: gain
+ label: Gain
+ dtype: real
+ default: '1'
+- id: samp_rate
+ label: Sample Rate
+ dtype: real
+ default: samp_rate
+- id: cutoff_freq
+ label: Cutoff Freq
+ dtype: real
+- id: width
+ label: Transition Width
+ dtype: real
+- id: win
+ label: Window
+ dtype: int
+ default: firdes.WIN_HAMMING
+ options: [firdes.WIN_HAMMING, firdes.WIN_HANN, firdes.WIN_BLACKMAN, firdes.WIN_RECTANGULAR,
+ firdes.WIN_KAISER]
+ option_labels: [Hamming, Hann, Blackman, Rectangular, Kaiser]
+- id: beta
+ label: Beta
+ dtype: real
+ default: '6.76'
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+
+templates:
+ imports: |-
+ from gnuradio import filter
+ from gnuradio.filter import firdes
+ make: "filter.$(type)(% if str(type).startswith('interp') then interp else decim#,\
+ \ firdes.high_pass(:\n\t${gain}, ${samp_rate}, ${cutoff_freq}, ${width}, ${win},\
+ \ ${beta}))"
+ callbacks:
+ - set_taps(firdes.high_pass(${gain}, ${samp_rate}, ${cutoff_freq}, ${width}, ${win},
+ ${beta}))
+
+documentation: |-
+ This filter is a convenience wrapper for an fir filter and a firdes taps generating function.
+
+ Sample rate, cutoff frequency, and transition width are in Hertz.
+
+ The beta paramater only applies to the Kaiser window.
+
+file_format: 1
diff --git a/gr-filter/grc/filter_high_pass_filter.xml b/gr-filter/grc/filter_high_pass_filter.xml
deleted file mode 100644
index 6b041145d..000000000
--- a/gr-filter/grc/filter_high_pass_filter.xml
+++ /dev/null
@@ -1,127 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##High Pass Filter: Custom wrapper
-###################################################
- -->
-<block>
- <name>High Pass Filter</name>
- <key>high_pass_filter</key>
- <import>from gnuradio import filter</import>
- <import>from gnuradio.filter import firdes</import>
- <make>filter.$(type)(#if str($type).startswith('interp') then $interp else $decim#, firdes.high_pass(
- $gain, $samp_rate, $cutoff_freq, $width, $win, $beta))</make>
- <callback>set_taps(firdes.high_pass($gain, $samp_rate, $cutoff_freq, $width, $win, $beta))</callback>
- <param>
- <name>FIR Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex->Complex (Decimating)</name>
- <key>fir_filter_ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- </option>
- <option>
- <name>Complex->Complex (Interpolating)</name>
- <key>interp_fir_filter_ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- </option>
- <option>
- <name>Float->Float (Decimating)</name>
- <key>fir_filter_fff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- </option>
- <option>
- <name>Float->Float (Interpolating)</name>
- <key>interp_fir_filter_fff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- </option>
- </param>
- <param>
- <name>Decimation</name>
- <key>decim</key>
- <value>1</value>
- <type>int</type>
- <hide>#if str($type).startswith('interp') then 'all' else 'none'#</hide>
- </param>
- <param>
- <name>Interpolation</name>
- <key>interp</key>
- <value>1</value>
- <type>int</type>
- <hide>#if str($type).startswith('interp') then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1</value>
- <type>real</type>
- </param>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>Cutoff Freq</name>
- <key>cutoff_freq</key>
- <type>real</type>
- </param>
- <param>
- <name>Transition Width</name>
- <key>width</key>
- <type>real</type>
- </param>
- <param>
- <name>Window</name>
- <key>win</key>
- <value>firdes.WIN_HAMMING</value>
- <type>int</type>
- <option>
- <name>Hamming</name>
- <key>firdes.WIN_HAMMING</key>
- </option>
- <option>
- <name>Hann</name>
- <key>firdes.WIN_HANN</key>
- </option>
- <option>
- <name>Blackman</name>
- <key>firdes.WIN_BLACKMAN</key>
- </option>
- <option>
- <name>Rectangular</name>
- <key>firdes.WIN_RECTANGULAR</key>
- </option>
- <option>
- <name>Kaiser</name>
- <key>firdes.WIN_KAISER</key>
- </option>
- </param>
- <param>
- <name>Beta</name>
- <key>beta</key>
- <value>6.76</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
- <doc>
-This filter is a convenience wrapper for an fir filter and a firdes taps generating function.
-
-Sample rate, cutoff frequency, and transition width are in Hertz.
-
-The beta paramater only applies to the Kaiser window.
- </doc>
-</block>
diff --git a/gr-filter/grc/filter_hilbert_fc.block.yml b/gr-filter/grc/filter_hilbert_fc.block.yml
new file mode 100644
index 000000000..0d835c388
--- /dev/null
+++ b/gr-filter/grc/filter_hilbert_fc.block.yml
@@ -0,0 +1,35 @@
+id: hilbert_fc
+label: Hilbert
+
+parameters:
+- id: num_taps
+ label: Num Taps
+ dtype: int
+ default: '65'
+- id: win
+ label: Window
+ dtype: int
+ default: firdes.WIN_HAMMING
+ options: [firdes.WIN_HAMMING, firdes.WIN_HANN, firdes.WIN_BLACKMAN, firdes.WIN_BLACKMAN_hARRIS,
+ firdes.WIN_RECTANGULAR, firdes.WIN_KAISER]
+ option_labels: [Hamming, Hann, Blackman, Blackman-harris, Rectangular, Kaiser]
+ hide: part
+- id: beta
+ label: Beta
+ dtype: real
+ default: '6.76'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: from gnuradio import filter
+ make: filter.hilbert_fc(${num_taps}, ${win}, ${beta})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_hilbert_fc.xml b/gr-filter/grc/filter_hilbert_fc.xml
deleted file mode 100644
index ddb7c334c..000000000
--- a/gr-filter/grc/filter_hilbert_fc.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Hilbert
-###################################################
- -->
-<block>
- <name>Hilbert</name>
- <key>hilbert_fc</key>
- <import>from gnuradio import filter</import>
- <make>filter.hilbert_fc($num_taps, $win, $beta)</make>
- <param>
- <name>Num Taps</name>
- <key>num_taps</key>
- <value>65</value>
- <type>int</type>
- </param>
- <param>
- <name>Window</name>
- <key>win</key>
- <value>firdes.WIN_HAMMING</value>
- <type>int</type>
- <hide>part</hide>
- <option>
- <name>Hamming</name>
- <key>firdes.WIN_HAMMING</key>
- </option>
- <option>
- <name>Hann</name>
- <key>firdes.WIN_HANN</key>
- </option>
- <option>
- <name>Blackman</name>
- <key>firdes.WIN_BLACKMAN</key>
- </option>
- <option>
- <name>Blackman-harris</name>
- <key>firdes.WIN_BLACKMAN_hARRIS</key>
- </option>
- <option>
- <name>Rectangular</name>
- <key>firdes.WIN_RECTANGULAR</key>
- </option>
- <option>
- <name>Kaiser</name>
- <key>firdes.WIN_KAISER</key>
- </option>
- </param>
- <param>
- <name>Beta</name>
- <key>beta</key>
- <value>6.76</value>
- <type>real</type>
- <hide>part</hide>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-filter/grc/filter_iir_filter_xxx.block.yml b/gr-filter/grc/filter_iir_filter_xxx.block.yml
new file mode 100644
index 000000000..4dfef2b0d
--- /dev/null
+++ b/gr-filter/grc/filter_iir_filter_xxx.block.yml
@@ -0,0 +1,44 @@
+id: iir_filter_xxx
+label: IIR Filter
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [ffd, ccf, ccd, ccc, ccz]
+ option_labels: [Float->Float (Double Taps), Complex->Complex (Float Taps), Complex->Complex
+ (Double Taps), Complex->Complex (Complex Taps), Complex->Complex (Complex
+ Double Taps)]
+ option_attributes:
+ input: [float, complex, complex, complex, complex]
+ output: [float, complex, complex, complex, complex]
+ taps: [real_vector, real_vector, real_vector, complex_vector, complex_vector]
+ hide: part
+- id: fftaps
+ label: Feed-forward Taps
+ dtype: ${ type.taps }
+- id: fbtaps
+ label: Feedback Taps
+ dtype: ${ type.taps }
+- id: oldstyle
+ label: Old Style of Taps
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+
+templates:
+ imports: from gnuradio import filter
+ make: filter.iir_filter_${type}(${fftaps}, ${fbtaps}, ${oldstyle})
+ callbacks:
+ - set_taps(${fftaps}, ${fbtaps})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_iir_filter_xxx.xml b/gr-filter/grc/filter_iir_filter_xxx.xml
deleted file mode 100644
index cd41d47ca..000000000
--- a/gr-filter/grc/filter_iir_filter_xxx.xml
+++ /dev/null
@@ -1,93 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##IIR Filter
-###################################################
- -->
-<block>
- <name>IIR Filter</name>
- <key>iir_filter_xxx</key>
- <import>from gnuradio import filter</import>
- <make>filter.iir_filter_$(type)($fftaps, $fbtaps, $oldstyle)</make>
- <callback>set_taps($fftaps, $fbtaps)</callback>
-
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Float->Float (Double Taps)</name>
- <key>ffd</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Complex->Complex (Float Taps)</name>
- <key>ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Complex->Complex (Double Taps)</name>
- <key>ccd</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Complex->Complex (Complex Taps)</name>
- <key>ccc</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- <option>
- <name>Complex->Complex (Complex Double Taps)</name>
- <key>ccz</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- </param>
-
- <param>
- <name>Feed-forward Taps</name>
- <key>fftaps</key>
- <type>$type.taps</type>
- </param>
-
- <param>
- <name>Feedback Taps</name>
- <key>fbtaps</key>
- <type>$type.taps</type>
- </param>
-
- <param>
- <name>Old Style of Taps</name>
- <key>oldstyle</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>True</name>
- <key>True</key>
- </option>
- <option>
- <name>False</name>
- <key>False</key>
- </option>
- </param>
-
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
-
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
-
-</block>
diff --git a/gr-filter/grc/filter_interp_fir_filter_xxx.block.yml b/gr-filter/grc/filter_interp_fir_filter_xxx.block.yml
new file mode 100644
index 000000000..b5edfa153
--- /dev/null
+++ b/gr-filter/grc/filter_interp_fir_filter_xxx.block.yml
@@ -0,0 +1,49 @@
+id: interp_fir_filter_xxx
+label: Interpolating FIR Filter
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [ccc, ccf, fcc, fff, fsf, scc]
+ option_labels: [Complex->Complex (Complex Taps), Complex->Complex (Real Taps),
+ Float->Complex (Complex Taps), Float->Float (Real Taps), Float->Short (Real
+ Taps), Short->Complex (Complex Taps)]
+ option_attributes:
+ input: [complex, complex, float, float, float, short]
+ output: [complex, complex, complex, float, short, complex]
+ taps: [complex_vector, real_vector, complex_vector, real_vector, real_vector,
+ complex_vector]
+ hide: part
+- id: interp
+ label: Interpolation
+ dtype: int
+ default: '1'
+- id: taps
+ label: Taps
+ dtype: ${ type.taps }
+- id: samp_delay
+ label: Sample Delay
+ dtype: int
+ default: '0'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+
+templates:
+ imports: |-
+ from gnuradio import filter
+ from gnuradio.filter import firdes
+ make: |
+ filter.interp_fir_filter_${type}(${interp}, ${taps})
+ self.${id}.declare_sample_delay(${samp_delay})
+ callbacks:
+ - set_taps(${taps})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_interp_fir_filter_xxx.xml b/gr-filter/grc/filter_interp_fir_filter_xxx.xml
deleted file mode 100644
index 0b82330f8..000000000
--- a/gr-filter/grc/filter_interp_fir_filter_xxx.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Interpolating FIR Filter
-###################################################
- -->
-<block>
- <name>Interpolating FIR Filter</name>
- <key>interp_fir_filter_xxx</key>
- <import>from gnuradio import filter</import>
- <import>from gnuradio.filter import firdes</import>
- <make>filter.interp_fir_filter_$(type)($interp, $taps)
-self.$(id).declare_sample_delay($samp_delay)
-</make>
- <callback>set_taps($taps)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex->Complex (Complex Taps)</name>
- <key>ccc</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- <option>
- <name>Complex->Complex (Real Taps)</name>
- <key>ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Float->Complex (Complex Taps)</name>
- <key>fcc</key>
- <opt>input:float</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- <option>
- <name>Float->Float (Real Taps)</name>
- <key>fff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Float->Short (Real Taps)</name>
- <key>fsf</key>
- <opt>input:float</opt>
- <opt>output:short</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Short->Complex (Complex Taps)</name>
- <key>scc</key>
- <opt>input:short</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- </param>
- <param>
- <name>Interpolation</name>
- <key>interp</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Taps</name>
- <key>taps</key>
- <type>$type.taps</type>
- </param>
- <param>
- <name>Sample Delay</name>
- <key>samp_delay</key>
- <value>0</value>
- <type>int</type>
- <hide>part</hide>
- </param>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
-</block>
diff --git a/gr-filter/grc/filter_low_pass_filter.block.yml b/gr-filter/grc/filter_low_pass_filter.block.yml
new file mode 100644
index 000000000..f2007b5f9
--- /dev/null
+++ b/gr-filter/grc/filter_low_pass_filter.block.yml
@@ -0,0 +1,77 @@
+id: low_pass_filter
+label: Low Pass Filter
+
+parameters:
+- id: type
+ label: FIR Type
+ dtype: enum
+ options: [fir_filter_ccf, interp_fir_filter_ccf, fir_filter_fff, interp_fir_filter_fff]
+ option_labels: [Complex->Complex (Decimating), Complex->Complex (Interpolating),
+ Float->Float (Decimating), Float->Float (Interpolating)]
+ option_attributes:
+ input: [complex, complex, float, float]
+ output: [complex, complex, float, float]
+ hide: part
+- id: decim
+ label: Decimation
+ dtype: int
+ default: '1'
+ hide: ${ ('all' if str(type).startswith('interp') else 'none') }
+- id: interp
+ label: Interpolation
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if str(type).startswith('interp') else 'all') }
+- id: gain
+ label: Gain
+ dtype: real
+ default: '1'
+- id: samp_rate
+ label: Sample Rate
+ dtype: real
+ default: samp_rate
+- id: cutoff_freq
+ label: Cutoff Freq
+ dtype: real
+- id: width
+ label: Transition Width
+ dtype: real
+- id: win
+ label: Window
+ dtype: int
+ default: firdes.WIN_HAMMING
+ options: [firdes.WIN_HAMMING, firdes.WIN_HANN, firdes.WIN_BLACKMAN, firdes.WIN_RECTANGULAR,
+ firdes.WIN_KAISER]
+ option_labels: [Hamming, Hann, Blackman, Rectangular, Kaiser]
+- id: beta
+ label: Beta
+ dtype: real
+ default: '6.76'
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+
+templates:
+ imports: |-
+ from gnuradio import filter
+ from gnuradio.filter import firdes
+ make: "filter.$(type)(% if str(type).startswith('interp') then interp else decim#,\
+ \ firdes.low_pass(:\n\t${gain}, ${samp_rate}, ${cutoff_freq}, ${width}, ${win},\
+ \ ${beta}))"
+ callbacks:
+ - set_taps(firdes.low_pass(${gain}, ${samp_rate}, ${cutoff_freq}, ${width}, ${win},
+ ${beta}))
+
+documentation: |-
+ This filter is a convenience wrapper for an fir filter and a firdes taps generating function.
+
+ Sample rate, cutoff frequency, and transition width are in Hertz.
+
+ The beta paramater only applies to the Kaiser window.
+
+file_format: 1
diff --git a/gr-filter/grc/filter_low_pass_filter.xml b/gr-filter/grc/filter_low_pass_filter.xml
deleted file mode 100644
index 66d15bb59..000000000
--- a/gr-filter/grc/filter_low_pass_filter.xml
+++ /dev/null
@@ -1,127 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Low Pass Filter: Custom wrapper
-###################################################
- -->
-<block>
- <name>Low Pass Filter</name>
- <key>low_pass_filter</key>
- <import>from gnuradio import filter</import>
- <import>from gnuradio.filter import firdes</import>
- <make>filter.$(type)(#if str($type).startswith('interp') then $interp else $decim#, firdes.low_pass(
- $gain, $samp_rate, $cutoff_freq, $width, $win, $beta))</make>
- <callback>set_taps(firdes.low_pass($gain, $samp_rate, $cutoff_freq, $width, $win, $beta))</callback>
- <param>
- <name>FIR Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex->Complex (Decimating)</name>
- <key>fir_filter_ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- </option>
- <option>
- <name>Complex->Complex (Interpolating)</name>
- <key>interp_fir_filter_ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- </option>
- <option>
- <name>Float->Float (Decimating)</name>
- <key>fir_filter_fff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- </option>
- <option>
- <name>Float->Float (Interpolating)</name>
- <key>interp_fir_filter_fff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- </option>
- </param>
- <param>
- <name>Decimation</name>
- <key>decim</key>
- <value>1</value>
- <type>int</type>
- <hide>#if str($type).startswith('interp') then 'all' else 'none'#</hide>
- </param>
- <param>
- <name>Interpolation</name>
- <key>interp</key>
- <value>1</value>
- <type>int</type>
- <hide>#if str($type).startswith('interp') then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1</value>
- <type>real</type>
- </param>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>Cutoff Freq</name>
- <key>cutoff_freq</key>
- <type>real</type>
- </param>
- <param>
- <name>Transition Width</name>
- <key>width</key>
- <type>real</type>
- </param>
- <param>
- <name>Window</name>
- <key>win</key>
- <value>firdes.WIN_HAMMING</value>
- <type>int</type>
- <option>
- <name>Hamming</name>
- <key>firdes.WIN_HAMMING</key>
- </option>
- <option>
- <name>Hann</name>
- <key>firdes.WIN_HANN</key>
- </option>
- <option>
- <name>Blackman</name>
- <key>firdes.WIN_BLACKMAN</key>
- </option>
- <option>
- <name>Rectangular</name>
- <key>firdes.WIN_RECTANGULAR</key>
- </option>
- <option>
- <name>Kaiser</name>
- <key>firdes.WIN_KAISER</key>
- </option>
- </param>
- <param>
- <name>Beta</name>
- <key>beta</key>
- <value>6.76</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
- <doc>
-This filter is a convenience wrapper for an fir filter and a firdes taps generating function.
-
-Sample rate, cutoff frequency, and transition width are in Hertz.
-
-The beta paramater only applies to the Kaiser window.
- </doc>
-</block>
diff --git a/gr-filter/grc/filter_low_pass_xlating_filter.block.yml b/gr-filter/grc/filter_low_pass_xlating_filter.block.yml
new file mode 100644
index 000000000..22cb100d0
--- /dev/null
+++ b/gr-filter/grc/filter_low_pass_xlating_filter.block.yml
@@ -0,0 +1,79 @@
+id: xlating_low_pass_filter
+label: Xlating Low Pass Filter
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [ccc, ccf, fcc, fcf, scc, scf]
+ option_labels: [Complex->Complex (Complex Taps), Complex->Complex (Real Taps),
+ Float->Complex (Complex Taps), Float->Complex (Real Taps), Short->Complex
+ (Complex Taps), Short->Complex (Real Taps)]
+ option_attributes:
+ input: [complex, complex, float, float, short, short]
+ output: [complex, complex, complex, complex, complex, complex]
+ taps: [complex_vector, real_vector, complex_vector, real_vector, complex_vector,
+ real_vector]
+ hide: part
+- id: decim
+ label: Decimation
+ dtype: int
+ default: '1'
+- id: gain
+ label: Gain
+ dtype: real
+ default: '1'
+- id: samp_rate
+ label: Sample Rate
+ dtype: real
+ default: samp_rate
+- id: center_freq
+ label: Center Frequency
+ dtype: real
+ default: '0'
+- id: cutoff_freq
+ label: Cutoff Freq
+ dtype: real
+- id: width
+ label: Transition Width
+ dtype: real
+- id: win
+ label: Window
+ dtype: int
+ default: firdes.WIN_HAMMING
+ options: [firdes.WIN_HAMMING, firdes.WIN_HANN, firdes.WIN_BLACKMAN, firdes.WIN_RECTANGULAR,
+ firdes.WIN_KAISER]
+ option_labels: [Hamming, Hann, Blackman, Rectangular, Kaiser]
+- id: beta
+ label: Beta
+ dtype: real
+ default: '6.76'
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+
+templates:
+ imports: |-
+ from gnuradio import filter
+ from gnuradio.filter import firdes
+ make: |-
+ filter.freq_xlating_fir_filter_${type}(${decim}, firdes.low_pass(
+ ${gain}, 2*${samp_rate}, ${cutoff_freq}, ${width}, ${win}, ${beta}), ${center_freq}, ${samp_rate})
+ callbacks:
+ - set_taps(firdes.low_pass(${gain}, 2*${samp_rate}, ${cutoff_freq}, ${width},
+ ${win}, ${beta}))
+ - set_center_freq(${center_freq})
+
+documentation: |-
+ This filter is a convenience wrapper for an xlating fir filter and a firdes taps generating function.
+
+ Sample rate, cutoff frequency, and transition width are in Hertz.
+
+ The beta paramater only applies to the Kaiser window.
+
+file_format: 1
diff --git a/gr-filter/grc/filter_low_pass_xlating_filter.xml b/gr-filter/grc/filter_low_pass_xlating_filter.xml
deleted file mode 100644
index 65d5e5bff..000000000
--- a/gr-filter/grc/filter_low_pass_xlating_filter.xml
+++ /dev/null
@@ -1,144 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Xlating Low Pass Filter: Custom wrapper
-###################################################
- -->
-<block>
- <name>Xlating Low Pass Filter</name>
- <key>xlating_low_pass_filter</key>
- <import>from gnuradio import filter</import>
- <import>from gnuradio.filter import firdes</import>
- <make>filter.freq_xlating_fir_filter_$(type)($decim, firdes.low_pass(
- $gain, 2*$samp_rate, $cutoff_freq, $width, $win, $beta), $center_freq, $samp_rate)</make>
- <callback>set_taps(firdes.low_pass($gain, 2*$samp_rate, $cutoff_freq, $width, $win, $beta))</callback>
- <callback>set_center_freq($center_freq)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex->Complex (Complex Taps)</name>
- <key>ccc</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- <option>
- <name>Complex->Complex (Real Taps)</name>
- <key>ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Float->Complex (Complex Taps)</name>
- <key>fcc</key>
- <opt>input:float</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- <option>
- <name>Float->Complex (Real Taps)</name>
- <key>fcf</key>
- <opt>input:float</opt>
- <opt>output:complex</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Short->Complex (Complex Taps)</name>
- <key>scc</key>
- <opt>input:short</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- <option>
- <name>Short->Complex (Real Taps)</name>
- <key>scf</key>
- <opt>input:short</opt>
- <opt>output:complex</opt>
- <opt>taps:real_vector</opt>
- </option>
- </param>
- <param>
- <name>Decimation</name>
- <key>decim</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1</value>
- <type>real</type>
- </param>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>Center Frequency</name>
- <key>center_freq</key>
- <value>0</value>
- <type>real</type>
- </param>
- <param>
- <name>Cutoff Freq</name>
- <key>cutoff_freq</key>
- <type>real</type>
- </param>
- <param>
- <name>Transition Width</name>
- <key>width</key>
- <type>real</type>
- </param>
- <param>
- <name>Window</name>
- <key>win</key>
- <value>firdes.WIN_HAMMING</value>
- <type>int</type>
- <option>
- <name>Hamming</name>
- <key>firdes.WIN_HAMMING</key>
- </option>
- <option>
- <name>Hann</name>
- <key>firdes.WIN_HANN</key>
- </option>
- <option>
- <name>Blackman</name>
- <key>firdes.WIN_BLACKMAN</key>
- </option>
- <option>
- <name>Rectangular</name>
- <key>firdes.WIN_RECTANGULAR</key>
- </option>
- <option>
- <name>Kaiser</name>
- <key>firdes.WIN_KAISER</key>
- </option>
- </param>
- <param>
- <name>Beta</name>
- <key>beta</key>
- <value>6.76</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
- <doc>
-This filter is a convenience wrapper for an xlating fir filter and a firdes taps generating function.
-
-Sample rate, cutoff frequency, and transition width are in Hertz.
-
-The beta paramater only applies to the Kaiser window.
- </doc>
-</block>
diff --git a/gr-filter/grc/filter_mmse_interpolator_xx.block.yml b/gr-filter/grc/filter_mmse_interpolator_xx.block.yml
new file mode 100644
index 000000000..2eb0a3aa4
--- /dev/null
+++ b/gr-filter/grc/filter_mmse_interpolator_xx.block.yml
@@ -0,0 +1,33 @@
+id: mmse_interpolator_xx
+label: Fractional Interpolator
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float]
+ option_attributes:
+ fcn: [cc, ff]
+ hide: part
+- id: phase_shift
+ label: Phase Shift
+ dtype: real
+- id: interp_ratio
+ label: Interpolation Ratio
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import filter
+ make: filter.mmse_interpolator_${type.fcn}(${phase_shift}, ${interp_ratio})
+ callbacks:
+ - set_interp_ratio(${interp_ratio})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_mmse_interpolator_xx.xml b/gr-filter/grc/filter_mmse_interpolator_xx.xml
deleted file mode 100644
index 6677cf6f0..000000000
--- a/gr-filter/grc/filter_mmse_interpolator_xx.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Fractional MMSE Interpolator
-###################################################
- -->
-<block>
- <name>Fractional Interpolator</name>
- <key>mmse_interpolator_xx</key>
- <import>from gnuradio import filter</import>
- <make>filter.mmse_interpolator_$(type.fcn)($phase_shift, $interp_ratio)</make>
- <callback>set_interp_ratio($interp_ratio)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- </param>
- <param>
- <name>Phase Shift</name>
- <key>phase_shift</key>
- <type>real</type>
- </param>
- <param>
- <name>Interpolation Ratio</name>
- <key>interp_ratio</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-filter/grc/filter_mmse_resampler_xx.block.yml b/gr-filter/grc/filter_mmse_resampler_xx.block.yml
new file mode 100644
index 000000000..d2ea3bdfe
--- /dev/null
+++ b/gr-filter/grc/filter_mmse_resampler_xx.block.yml
@@ -0,0 +1,40 @@
+id: mmse_resampler_xx
+label: Fractional Resampler
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float]
+ option_attributes:
+ fcn: [cc, ff]
+ hide: part
+- id: phase_shift
+ label: Phase Shift
+ dtype: real
+- id: resamp_ratio
+ label: Resampling Ratio
+ dtype: real
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+- label: rate
+ domain: stream
+ dtype: float
+ optional: true
+- domain: message
+ id: msg_in
+ optional: true
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import filter
+ make: filter.mmse_resampler_${type.fcn}(${phase_shift}, ${resamp_ratio})
+ callbacks:
+ - set_resamp_ratio(${resamp_ratio})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_mmse_resampler_xx.xml b/gr-filter/grc/filter_mmse_resampler_xx.xml
deleted file mode 100644
index 5d5f9c178..000000000
--- a/gr-filter/grc/filter_mmse_resampler_xx.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Fractional MMSE Resampler
-###################################################
- -->
-<block>
- <name>Fractional Resampler</name>
- <key>mmse_resampler_xx</key>
- <import>from gnuradio import filter</import>
- <make>filter.mmse_resampler_$(type.fcn)($phase_shift, $resamp_ratio)</make>
- <callback>set_resamp_ratio($resamp_ratio)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- </param>
- <param>
- <name>Phase Shift</name>
- <key>phase_shift</key>
- <type>real</type>
- </param>
- <param>
- <name>Resampling Ratio</name>
- <key>resamp_ratio</key>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- </sink>
- <sink>
- <name>rate</name>
- <type>float</type>
- <optional>1</optional>
- </sink>
- <sink>
- <name>msg_in</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- </source>
-</block>
diff --git a/gr-filter/grc/filter_pfb_arb_resampler.block.yml b/gr-filter/grc/filter_pfb_arb_resampler.block.yml
new file mode 100644
index 000000000..f724aa099
--- /dev/null
+++ b/gr-filter/grc/filter_pfb_arb_resampler.block.yml
@@ -0,0 +1,55 @@
+id: pfb_arb_resampler_xxx
+label: Polyphase Arbitrary Resampler
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [ccf, fff, ccc]
+ option_labels: [Complex->Complex (Real Taps), Float->Float (Real Taps), Complex->Complex
+ (Complex Taps)]
+ option_attributes:
+ input: [complex, float, complex]
+ output: [complex, float, complex]
+ taps: [real_vector, real_vector, complex_vector]
+ hide: part
+- id: rrate
+ label: Resampling Rate
+ dtype: real
+- id: taps
+ label: Taps
+ dtype: ${ type.taps }
+- id: nfilts
+ label: Number of Filters
+ dtype: int
+ default: '32'
+- id: atten
+ label: Stop-band Attenuation
+ dtype: real
+ default: '100'
+- id: samp_delay
+ label: Sample Delay
+ dtype: int
+ default: '0'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+
+templates:
+ imports: |-
+ from gnuradio.filter import pfb
+ from gnuradio.filter import firdes
+ make: "pfb.arb_resampler_${type}(\n\t ${rrate},\n% if taps:\n taps=${taps},\n\
+ % else:\n taps=None,\n% endif\n\t flt_size=${nfilts})\nself.${id}.declare_sample_delay(${samp_delay})\n\
+ \t"
+ callbacks:
+ - set_taps(${taps})
+ - set_rate(${rrate})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_pfb_arb_resampler.xml b/gr-filter/grc/filter_pfb_arb_resampler.xml
deleted file mode 100644
index b528adc00..000000000
--- a/gr-filter/grc/filter_pfb_arb_resampler.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Polyphase Arbitrary Resampler
-###################################################
- -->
-<block>
- <name>Polyphase Arbitrary Resampler</name>
- <key>pfb_arb_resampler_xxx</key>
- <import>from gnuradio.filter import pfb</import>
- <import>from gnuradio.filter import firdes</import>
- <make>pfb.arb_resampler_$(type)(
- $rrate,
-#if $taps()
- taps=$taps,
-#else
- taps=None,
-#end if
- flt_size=$nfilts)
-self.$(id).declare_sample_delay($samp_delay)
- </make>
- <callback>set_taps($taps)</callback>
- <callback>set_rate($rrate)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex->Complex (Real Taps)</name>
- <key>ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Float->Float (Real Taps)</name>
- <key>fff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Complex->Complex (Complex Taps)</name>
- <key>ccc</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- </param>
- <param>
- <name>Resampling Rate</name>
- <key>rrate</key>
- <type>real</type>
- </param>
- <param>
- <name>Taps</name>
- <key>taps</key>
- <type>$type.taps</type>
- </param>
- <param>
- <name>Number of Filters</name>
- <key>nfilts</key>
- <value>32</value>
- <type>int</type>
- </param>
- <param>
- <name>Stop-band Attenuation</name>
- <key>atten</key>
- <value>100</value>
- <type>real</type>
- </param>
- <param>
- <name>Sample Delay</name>
- <key>samp_delay</key>
- <value>0</value>
- <type>int</type>
- <hide>part</hide>
- </param>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
-</block>
diff --git a/gr-filter/grc/filter_pfb_channelizer.block.yml b/gr-filter/grc/filter_pfb_channelizer.block.yml
new file mode 100644
index 000000000..225a17451
--- /dev/null
+++ b/gr-filter/grc/filter_pfb_channelizer.block.yml
@@ -0,0 +1,56 @@
+id: pfb_channelizer_ccf
+label: Polyphase Channelizer
+
+parameters:
+- id: nchans
+ label: Channels
+ dtype: int
+ default: '1'
+ hide: part
+- id: taps
+ label: Taps
+ dtype: real_vector
+- id: osr
+ label: Over Sample Ratio
+ dtype: real
+ default: '1.0'
+- id: atten
+ label: Attenuation
+ dtype: real
+ default: '100'
+- id: samp_delay
+ label: Sample Delay
+ dtype: int
+ default: '0'
+ hide: part
+- id: ch_map
+ label: Channel Map
+ dtype: int_vector
+ default: '[]'
+- id: bus_conns
+ label: Bus Connections
+ dtype: raw
+ default: '[[0,],]'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+ multiplicity: ${ nchans }
+
+templates:
+ imports: |-
+ from gnuradio.filter import pfb
+ from gnuradio.filter import firdes
+ make: "pfb.channelizer_ccf(\n\t ${nchans},\n\t ${taps},\n\t ${osr},\n\t ${atten})\n\
+ self.${id}.set_channel_map(${ch_map})\nself.${id}.declare_sample_delay(${samp_delay})\n\
+ \t"
+ callbacks:
+ - set_taps(${taps})
+ - set_channel_map(${ch_map})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_pfb_channelizer.xml b/gr-filter/grc/filter_pfb_channelizer.xml
deleted file mode 100644
index 446acf059..000000000
--- a/gr-filter/grc/filter_pfb_channelizer.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Polyphase Channelizer
-###################################################
- -->
-<block>
- <name>Polyphase Channelizer</name>
- <key>pfb_channelizer_ccf</key>
- <import>from gnuradio.filter import pfb</import>
- <import>from gnuradio.filter import firdes</import>
- <make>pfb.channelizer_ccf(
- $nchans,
- $taps,
- $osr,
- $atten)
-self.$(id).set_channel_map($ch_map)
-self.$(id).declare_sample_delay($samp_delay)
- </make>
- <callback>set_taps($taps)</callback>
- <callback>set_channel_map($ch_map)</callback>
-
- <param>
- <name>Channels</name>
- <key>nchans</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Taps</name>
- <key>taps</key>
- <value></value>
- <type>real_vector</type>
- </param>
- <param>
- <name>Over Sample Ratio</name>
- <key>osr</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Attenuation</name>
- <key>atten</key>
- <value>100</value>
- <type>real</type>
- </param>
- <param>
- <name>Sample Delay</name>
- <key>samp_delay</key>
- <value>0</value>
- <type>int</type>
- <hide>part</hide>
- </param>
- <param>
- <name>Channel Map</name>
- <key>ch_map</key>
- <value>[]</value>
- <type>int_vector</type>
- </param>
- <param>
- <name>Bus Connections</name>
- <key>bus_conns</key>
- <value>[[0,],]</value>
- <type>raw</type>
- <hide>part</hide>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- <nports>$nchans</nports>
- </source>
- <bus_structure_source>$bus_conns</bus_structure_source>
-</block>
diff --git a/gr-filter/grc/filter_pfb_channelizer_hier.block.yml b/gr-filter/grc/filter_pfb_channelizer_hier.block.yml
new file mode 100644
index 000000000..764f88f65
--- /dev/null
+++ b/gr-filter/grc/filter_pfb_channelizer_hier.block.yml
@@ -0,0 +1,55 @@
+id: pfb_channelizer_hier_ccf
+label: Hierarchical Polyphase Channelizer
+
+parameters:
+- id: nchans
+ label: Number of Channels
+ dtype: int
+ default: '3'
+ hide: part
+- id: n_filterbanks
+ label: Number of Filterbanks
+ dtype: int
+ default: '4'
+- id: taps
+ label: Taps
+ dtype: raw
+ default: None
+- id: outchans
+ label: Output Channels
+ dtype: raw
+ default: None
+- id: atten
+ label: Attenuation
+ dtype: real
+ default: '100'
+- id: bw
+ label: Fraction of Channel to Keep
+ dtype: real
+ default: '1.0'
+- id: tb
+ label: Transition Band (as a fraction of channel width)
+ dtype: real
+ default: '0.2'
+- id: ripple
+ label: Passband Ripple in dB
+ dtype: real
+ default: '0.1'
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+ multiplicity: ${ nchans }
+
+templates:
+ imports: from gnuradio.filter import pfb
+ make: "pfb.channelizer_hier_ccf(\n\t${nchans},\n\t${n_filterbanks},\n\t${taps},\n\
+ \t${outchans},\n ${atten},\n ${bw},\n ${tb},\n ${ripple}\n )\n\t"
+ callbacks:
+ - set_taps(${taps})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_pfb_channelizer_hier.xml b/gr-filter/grc/filter_pfb_channelizer_hier.xml
deleted file mode 100644
index 356187d90..000000000
--- a/gr-filter/grc/filter_pfb_channelizer_hier.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Hierarchical Polyphase Channelizer
-###################################################
- -->
-<block>
- <name>Hierarchical Polyphase Channelizer</name>
- <key>pfb_channelizer_hier_ccf</key>
- <import>from gnuradio.filter import pfb</import>
- <make>pfb.channelizer_hier_ccf(
- $nchans,
- $n_filterbanks,
- $taps,
- $outchans,
- $atten,
- $bw,
- $tb,
- $ripple
- )
- </make>
- <callback>set_taps($taps)</callback>
- <param>
- <name>Number of Channels</name>
- <key>nchans</key>
- <value>3</value>
- <type>int</type>
- </param>
- <param>
- <name>Number of Filterbanks</name>
- <key>n_filterbanks</key>
- <value>4</value>
- <type>int</type>
- </param>
- <param>
- <name>Taps</name>
- <key>taps</key>
- <value>None</value>
- <type>raw</type>
- </param>
- <param>
- <name>Output Channels</name>
- <key>outchans</key>
- <value>None</value>
- <type>raw</type>
- </param>
- <param>
- <name>Attenuation</name>
- <key>atten</key>
- <value>100</value>
- <type>real</type>
- </param>
- <param>
- <name>Fraction of Channel to Keep</name>
- <key>bw</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Transition Band (as a fraction of channel width)</name>
- <key>tb</key>
- <value>0.2</value>
- <type>real</type>
- </param>
- <param>
- <name>Passband Ripple in dB</name>
- <key>ripple</key>
- <value>0.1</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- <nports>$nchans</nports>
- </source>
-</block>
diff --git a/gr-filter/grc/filter_pfb_decimator.block.yml b/gr-filter/grc/filter_pfb_decimator.block.yml
new file mode 100644
index 000000000..2d3653ee0
--- /dev/null
+++ b/gr-filter/grc/filter_pfb_decimator.block.yml
@@ -0,0 +1,56 @@
+id: pfb_decimator_ccf
+label: Polyphase Decimator
+
+parameters:
+- id: decim
+ label: Decimation
+ dtype: int
+- id: taps
+ label: Taps
+ dtype: real_vector
+- id: channel
+ label: Output Channel
+ dtype: int
+ default: '0'
+- id: atten
+ label: Stop-band Attenuation
+ dtype: real
+ default: '100'
+- id: fft_rot
+ label: Use FFT Rotator
+ dtype: raw
+ default: 'True'
+ options: ['True', 'False']
+ hide: part
+- id: fft_filts
+ label: Use FFT Filters
+ dtype: raw
+ default: 'True'
+ options: ['True', 'False']
+ hide: part
+- id: samp_delay
+ label: Sample Delay
+ dtype: int
+ default: '0'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: |-
+ from gnuradio.filter import pfb
+ from gnuradio.filter import firdes
+ make: "pfb.decimator_ccf(\n\t ${decim},\n\t ${taps},\n\t ${channel},\n\t ${atten},\n\
+ \ ${fft_rot},\n ${fft_filts})\nself.${id}.declare_sample_delay(${samp_delay})\n\
+ \t"
+ callbacks:
+ - set_taps(${taps})
+ - set_channel(int(${channel}))
+
+file_format: 1
diff --git a/gr-filter/grc/filter_pfb_decimator.xml b/gr-filter/grc/filter_pfb_decimator.xml
deleted file mode 100644
index 2ad9e050c..000000000
--- a/gr-filter/grc/filter_pfb_decimator.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Polyphase Decimator
-###################################################
- -->
-<block>
- <name>Polyphase Decimator</name>
- <key>pfb_decimator_ccf</key>
- <import>from gnuradio.filter import pfb</import>
- <import>from gnuradio.filter import firdes</import>
- <make>pfb.decimator_ccf(
- $decim,
- $taps,
- $channel,
- $atten,
- $fft_rot,
- $fft_filts)
-self.$(id).declare_sample_delay($samp_delay)
- </make>
- <callback>set_taps($taps)</callback>
- <callback>set_channel(int($channel))</callback>
- <param>
- <name>Decimation</name>
- <key>decim</key>
- <type>int</type>
- </param>
- <param>
- <name>Taps</name>
- <key>taps</key>
- <value></value>
- <type>real_vector</type>
- </param>
- <param>
- <name>Output Channel</name>
- <key>channel</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Stop-band Attenuation</name>
- <key>atten</key>
- <value>100</value>
- <type>real</type>
- </param>
- <param>
- <name>Use FFT Rotator</name>
- <key>fft_rot</key>
- <value>True</value>
- <type>raw</type>
- <hide>part</hide>
- <option>
- <name>True</name>
- <key>True</key>
- </option>
- <option>
- <name>False</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Use FFT Filters</name>
- <key>fft_filts</key>
- <value>True</value>
- <type>raw</type>
- <hide>part</hide>
- <option>
- <name>True</name>
- <key>True</key>
- </option>
- <option>
- <name>False</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Sample Delay</name>
- <key>samp_delay</key>
- <value>0</value>
- <type>int</type>
- <hide>part</hide>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-filter/grc/filter_pfb_interpolator.block.yml b/gr-filter/grc/filter_pfb_interpolator.block.yml
new file mode 100644
index 000000000..9da3c07a1
--- /dev/null
+++ b/gr-filter/grc/filter_pfb_interpolator.block.yml
@@ -0,0 +1,38 @@
+id: pfb_interpolator_ccf
+label: Polyphase Interpolator
+
+parameters:
+- id: interp
+ label: Interpolation
+ dtype: int
+- id: taps
+ label: Taps
+ dtype: real_vector
+- id: atten
+ label: Attenuation
+ dtype: real
+ default: '100'
+- id: samp_delay
+ label: Sample Delay
+ dtype: int
+ default: '0'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: complex
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: |-
+ from gnuradio.filter import pfb
+ from gnuradio.filter import firdes
+ make: "pfb.interpolator_ccf(\n\t ${interp},\n\t ${taps},\n\t ${atten})\nself.${id}.declare_sample_delay(${samp_delay})\n\
+ \t"
+ callbacks:
+ - set_taps(${taps})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_pfb_interpolator.xml b/gr-filter/grc/filter_pfb_interpolator.xml
deleted file mode 100644
index 0ad5909c1..000000000
--- a/gr-filter/grc/filter_pfb_interpolator.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Polyphase Interpolator
-###################################################
- -->
-<block>
- <name>Polyphase Interpolator</name>
- <key>pfb_interpolator_ccf</key>
- <import>from gnuradio.filter import pfb</import>
- <import>from gnuradio.filter import firdes</import>
- <make>pfb.interpolator_ccf(
- $interp,
- $taps,
- $atten)
-self.$(id).declare_sample_delay($samp_delay)
- </make>
- <callback>set_taps($taps)</callback>
- <param>
- <name>Interpolation</name>
- <key>interp</key>
- <type>int</type>
- </param>
- <param>
- <name>Taps</name>
- <key>taps</key>
- <value></value>
- <type>real_vector</type>
- </param>
- <param>
- <name>Attenuation</name>
- <key>atten</key>
- <value>100</value>
- <type>real</type>
- </param>
- <param>
- <name>Sample Delay</name>
- <key>samp_delay</key>
- <value>0</value>
- <type>int</type>
- <hide>part</hide>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
-</block>
diff --git a/gr-filter/grc/filter_pfb_synthesizer.block.yml b/gr-filter/grc/filter_pfb_synthesizer.block.yml
new file mode 100644
index 000000000..00da00e4e
--- /dev/null
+++ b/gr-filter/grc/filter_pfb_synthesizer.block.yml
@@ -0,0 +1,55 @@
+id: pfb_synthesizer_ccf
+label: Polyphase Synthesizer
+
+parameters:
+- id: numchans
+ label: Channels
+ dtype: int
+ default: '2'
+- id: connections
+ label: Connections
+ dtype: int
+ default: '2'
+ hide: part
+- id: taps
+ label: Taps
+ dtype: real_vector
+- id: twox
+ label: 2x Sample Rate
+ dtype: bool
+ default: 'False'
+- id: samp_delay
+ label: Sample Delay
+ dtype: int
+ default: '0'
+ hide: part
+- id: ch_map
+ label: Channel Map
+ dtype: int_vector
+ default: '[]'
+- id: bus_conns
+ label: Bus Connections
+ dtype: raw
+ default: '[[0,],]'
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: complex
+ multiplicity: ${ connections }
+
+outputs:
+- domain: stream
+ dtype: complex
+
+templates:
+ imports: |-
+ from gnuradio import filter
+ from gnuradio.filter import firdes
+ make: "filter.pfb_synthesizer_ccf(\n\t ${numchans}, ${taps}, ${twox})\nself.${id}.set_channel_map(${ch_map})\n\
+ self.${id}.declare_sample_delay(${samp_delay})\n\t"
+ callbacks:
+ - set_taps(${taps})
+ - set_channel_map(${ch_map})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_pfb_synthesizer.xml b/gr-filter/grc/filter_pfb_synthesizer.xml
deleted file mode 100644
index 8cbe19528..000000000
--- a/gr-filter/grc/filter_pfb_synthesizer.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Polyphase Synthesis Filterbank
-###################################################
- -->
-<block>
- <name>Polyphase Synthesizer</name>
- <key>pfb_synthesizer_ccf</key>
- <import>from gnuradio import filter</import>
- <import>from gnuradio.filter import firdes</import>
- <make>filter.pfb_synthesizer_ccf(
- $numchans, $taps, $twox)
-self.$(id).set_channel_map($ch_map)
-self.$(id).declare_sample_delay($samp_delay)
- </make>
- <callback>set_taps($taps)</callback>
- <callback>set_channel_map($ch_map)</callback>
-
- <param>
- <name>Channels</name>
- <key>numchans</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Connections</name>
- <key>connections</key>
- <value>2</value>
- <type>int</type>
- </param>
- <param>
- <name>Taps</name>
- <key>taps</key>
- <type>real_vector</type>
- </param>
- <param>
- <name>2x Sample Rate</name>
- <key>twox</key>
- <value>False</value>
- <type>bool</type>
- </param>
- <param>
- <name>Sample Delay</name>
- <key>samp_delay</key>
- <value>0</value>
- <type>int</type>
- <hide>part</hide>
- </param>
- <param>
- <name>Channel Map</name>
- <key>ch_map</key>
- <value>[]</value>
- <type>int_vector</type>
- </param>
- <param>
- <name>Bus Connections</name>
- <key>bus_conns</key>
- <value>[[0,],]</value>
- <type>raw</type>
- <hide>part</hide>
- </param>
- <sink>
- <name>in</name>
- <type>complex</type>
- <nports>$connections</nports>
- </sink>
- <source>
- <name>out</name>
- <type>complex</type>
- </source>
- <bus_structure_sink>$bus_conns</bus_structure_sink>
-</block>
diff --git a/gr-filter/grc/filter_rational_resampler_base_xxx.block.yml b/gr-filter/grc/filter_rational_resampler_base_xxx.block.yml
new file mode 100644
index 000000000..e8fc797d9
--- /dev/null
+++ b/gr-filter/grc/filter_rational_resampler_base_xxx.block.yml
@@ -0,0 +1,46 @@
+id: rational_resampler_base_xxx
+label: Rational Resampler Base
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [ccc, ccf, fcc, fff, fsf, scc]
+ option_labels: [Complex->Complex (Complex Taps), Complex->Complex (Real Taps),
+ Float->Complex (Complex Taps), Float->Float (Real Taps), Float->Short (Real
+ Taps), Short->Complex (Complex Taps)]
+ option_attributes:
+ input: [complex, complex, float, float, float, short]
+ output: [complex, complex, complex, float, short, complex]
+ taps: [complex_vector, real_vector, complex_vector, real_vector, real_vector,
+ complex_vector]
+ hide: part
+- id: interp
+ label: Interpolation
+ dtype: int
+ default: '1'
+- id: decim
+ label: Decimation
+ dtype: int
+ default: '1'
+- id: taps
+ label: Taps
+ dtype: ${ type.taps }
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+
+templates:
+ imports: |-
+ from gnuradio import filter
+ from gnuradio.filter import firdes
+ make: filter.rational_resampler_base_${type}(${interp}, ${decim}, ${taps})
+ callbacks:
+ - set_taps(${taps})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_rational_resampler_base_xxx.xml b/gr-filter/grc/filter_rational_resampler_base_xxx.xml
deleted file mode 100644
index 399bfc74c..000000000
--- a/gr-filter/grc/filter_rational_resampler_base_xxx.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Rational Resampler Base
-###################################################
- -->
-<block>
- <name>Rational Resampler Base</name>
- <key>rational_resampler_base_xxx</key>
- <import>from gnuradio import filter</import>
- <import>from gnuradio.filter import firdes</import>
- <make>filter.rational_resampler_base_$(type)($interp, $decim, $taps)</make>
- <callback>set_taps($taps)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex->Complex (Complex Taps)</name>
- <key>ccc</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- <option>
- <name>Complex->Complex (Real Taps)</name>
- <key>ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Float->Complex (Complex Taps)</name>
- <key>fcc</key>
- <opt>input:float</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- <option>
- <name>Float->Float (Real Taps)</name>
- <key>fff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Float->Short (Real Taps)</name>
- <key>fsf</key>
- <opt>input:float</opt>
- <opt>output:short</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Short->Complex (Complex Taps)</name>
- <key>scc</key>
- <opt>input:short</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- </param>
- <param>
- <name>Interpolation</name>
- <key>interp</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Decimation</name>
- <key>decim</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Taps</name>
- <key>taps</key>
- <type>$type.taps</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
-</block>
diff --git a/gr-filter/grc/filter_rational_resampler_xxx.block.yml b/gr-filter/grc/filter_rational_resampler_xxx.block.yml
new file mode 100644
index 000000000..e67e7cbf6
--- /dev/null
+++ b/gr-filter/grc/filter_rational_resampler_xxx.block.yml
@@ -0,0 +1,62 @@
+id: rational_resampler_xxx
+label: Rational Resampler
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [ccc, ccf, fcc, fff]
+ option_labels: [Complex->Complex (Complex Taps), Complex->Complex (Real Taps),
+ Float->Complex (Complex Taps), Float->Float (Real Taps)]
+ option_attributes:
+ input: [complex, complex, float, float]
+ output: [complex, complex, complex, float]
+ taps: [complex_vector, real_vector, complex_vector, real_vector]
+ hide: part
+- id: interp
+ label: Interpolation
+ dtype: int
+ default: '1'
+- id: decim
+ label: Decimation
+ dtype: int
+ default: '1'
+- id: taps
+ label: Taps
+ dtype: ${ type.taps }
+- id: fbw
+ label: Fractional BW
+ dtype: real
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+
+templates:
+ imports: |-
+ from gnuradio import filter
+ from gnuradio.filter import firdes
+ make: |-
+ filter.rational_resampler_${type}(
+ interpolation=${interp},
+ decimation=${decim},
+ % if taps:
+ taps=${taps},
+ % else:
+ taps=None,
+ % endif
+ % if fbw != 0:
+ fractional_bw=${fbw},
+ % else:
+ fractional_bw=None,
+ % endif
+ )
+ callbacks:
+ - set_taps(${taps})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_rational_resampler_xxx.xml b/gr-filter/grc/filter_rational_resampler_xxx.xml
deleted file mode 100644
index 7e275818d..000000000
--- a/gr-filter/grc/filter_rational_resampler_xxx.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Rational Resampler Base
-###################################################
- -->
-<block>
- <name>Rational Resampler</name>
- <key>rational_resampler_xxx</key>
- <import>from gnuradio import filter</import>
- <import>from gnuradio.filter import firdes</import>
- <make>filter.rational_resampler_$(type)(
- interpolation=$interp,
- decimation=$decim,
-#if $taps()
- taps=$taps,
-#else
- taps=None,
-#end if
-#if $fbw() != 0
- fractional_bw=$fbw,
-#else
- fractional_bw=None,
-#end if
-)</make>
- <callback>set_taps($taps)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex->Complex (Complex Taps)</name>
- <key>ccc</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- <option>
- <name>Complex->Complex (Real Taps)</name>
- <key>ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- <opt>taps:real_vector</opt>
- </option>
- <option>
- <name>Float->Complex (Complex Taps)</name>
- <key>fcc</key>
- <opt>input:float</opt>
- <opt>output:complex</opt>
- <opt>taps:complex_vector</opt>
- </option>
- <option>
- <name>Float->Float (Real Taps)</name>
- <key>fff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- <opt>taps:real_vector</opt>
- </option>
- </param>
- <param>
- <name>Interpolation</name>
- <key>interp</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Decimation</name>
- <key>decim</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Taps</name>
- <key>taps</key>
- <value></value>
- <type>$type.taps</type>
- </param>
- <param>
- <name>Fractional BW</name>
- <key>fbw</key>
- <value>0</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
-</block>
diff --git a/gr-filter/grc/filter_root_raised_cosine_filter.block.yml b/gr-filter/grc/filter_root_raised_cosine_filter.block.yml
new file mode 100644
index 000000000..7a435f161
--- /dev/null
+++ b/gr-filter/grc/filter_root_raised_cosine_filter.block.yml
@@ -0,0 +1,70 @@
+id: root_raised_cosine_filter
+label: Root Raised Cosine Filter
+
+parameters:
+- id: type
+ label: FIR Type
+ dtype: enum
+ options: [fir_filter_ccf, interp_fir_filter_ccf, fir_filter_fff, interp_fir_filter_fff]
+ option_labels: [Complex->Complex (Decimating), Complex->Complex (Interpolating),
+ Float->Float (Decimating), Float->Float (Interpolating)]
+ option_attributes:
+ input: [complex, complex, float, float]
+ output: [complex, complex, float, float]
+ hide: part
+- id: decim
+ label: Decimation
+ dtype: int
+ default: '1'
+ hide: ${ ('all' if str(type).startswith('interp') else 'none') }
+- id: interp
+ label: Interpolation
+ dtype: int
+ default: '1'
+ hide: ${ ('none' if str(type).startswith('interp') else 'all') }
+- id: gain
+ label: Gain
+ dtype: real
+ default: '1'
+- id: samp_rate
+ label: Sample Rate
+ dtype: real
+ default: samp_rate
+- id: sym_rate
+ label: Symbol Rate
+ dtype: real
+ default: '1.0'
+- id: alpha
+ label: Alpha
+ dtype: real
+ default: '0.35'
+- id: ntaps
+ label: Num Taps
+ dtype: int
+ default: 11*samp_rate
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+
+templates:
+ imports: |-
+ from gnuradio import filter
+ from gnuradio.filter import firdes
+ make: "filter.$(type)(% if str(type).startswith('interp') then interp else decim#,\
+ \ firdes.root_raised_cosine(:\n\t${gain}, ${samp_rate}, ${sym_rate}, ${alpha},\
+ \ ${ntaps}))"
+ callbacks:
+ - set_taps(firdes.root_raised_cosine(${gain}, ${samp_rate}, ${sym_rate}, ${alpha},
+ ${ntaps}))
+
+documentation: |-
+ This filter is a convenience wrapper for an fir filter and a firdes taps generating function.
+
+ Sample rate in Hertz.
+
+file_format: 1
diff --git a/gr-filter/grc/filter_root_raised_cosine_filter.xml b/gr-filter/grc/filter_root_raised_cosine_filter.xml
deleted file mode 100644
index fde88828d..000000000
--- a/gr-filter/grc/filter_root_raised_cosine_filter.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Root Raised Cosine Filter: Custom wrapper
-###################################################
- -->
-<block>
- <name>Root Raised Cosine Filter</name>
- <key>root_raised_cosine_filter</key>
- <import>from gnuradio import filter</import>
- <import>from gnuradio.filter import firdes</import>
- <make>filter.$(type)(#if str($type).startswith('interp') then $interp else $decim#, firdes.root_raised_cosine(
- $gain, $samp_rate, $sym_rate, $alpha, $ntaps))</make>
- <callback>set_taps(firdes.root_raised_cosine($gain, $samp_rate, $sym_rate, $alpha, $ntaps))</callback>
- <param>
- <name>FIR Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex->Complex (Decimating)</name>
- <key>fir_filter_ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- </option>
- <option>
- <name>Complex->Complex (Interpolating)</name>
- <key>interp_fir_filter_ccf</key>
- <opt>input:complex</opt>
- <opt>output:complex</opt>
- </option>
- <option>
- <name>Float->Float (Decimating)</name>
- <key>fir_filter_fff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- </option>
- <option>
- <name>Float->Float (Interpolating)</name>
- <key>interp_fir_filter_fff</key>
- <opt>input:float</opt>
- <opt>output:float</opt>
- </option>
- </param>
- <param>
- <name>Decimation</name>
- <key>decim</key>
- <value>1</value>
- <type>int</type>
- <hide>#if str($type).startswith('interp') then 'all' else 'none'#</hide>
- </param>
- <param>
- <name>Interpolation</name>
- <key>interp</key>
- <value>1</value>
- <type>int</type>
- <hide>#if str($type).startswith('interp') then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1</value>
- <type>real</type>
- </param>
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- <param>
- <name>Symbol Rate</name>
- <key>sym_rate</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Alpha</name>
- <key>alpha</key>
- <value>0.35</value>
- <type>real</type>
- </param>
- <param>
- <name>Num Taps</name>
- <key>ntaps</key>
- <value>11*samp_rate</value>
- <type>int</type>
- </param>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
- <doc>
-This filter is a convenience wrapper for an fir filter and a firdes taps generating function.
-
-Sample rate in Hertz.
- </doc>
-</block>
diff --git a/gr-filter/grc/filter_single_pole_iir_filter_xx.block.yml b/gr-filter/grc/filter_single_pole_iir_filter_xx.block.yml
new file mode 100644
index 000000000..09561d710
--- /dev/null
+++ b/gr-filter/grc/filter_single_pole_iir_filter_xx.block.yml
@@ -0,0 +1,38 @@
+id: single_pole_iir_filter_xx
+label: Single Pole IIR Filter
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float]
+ option_attributes:
+ fcn: [cc, ff]
+ hide: part
+- id: alpha
+ label: Alpha
+ dtype: real
+ default: '1.0'
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import filter
+ make: filter.single_pole_iir_filter_${type.fcn}(${alpha}, ${vlen})
+ callbacks:
+ - set_taps(${alpha})
+
+file_format: 1
diff --git a/gr-filter/grc/filter_single_pole_iir_filter_xx.xml b/gr-filter/grc/filter_single_pole_iir_filter_xx.xml
deleted file mode 100644
index 3eaf52625..000000000
--- a/gr-filter/grc/filter_single_pole_iir_filter_xx.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Single Pole IIR Filter
-###################################################
- -->
-<block>
- <name>Single Pole IIR Filter</name>
- <key>single_pole_iir_filter_xx</key>
- <import>from gnuradio import filter</import>
- <make>filter.single_pole_iir_filter_$(type.fcn)($alpha, $vlen)</make>
- <callback>set_taps($alpha)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:cc</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:ff</opt>
- </option>
- </param>
- <param>
- <name>Alpha</name>
- <key>alpha</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-</block>
diff --git a/gr-filter/grc/variable_band_pass_filter_taps.block.yml b/gr-filter/grc/variable_band_pass_filter_taps.block.yml
new file mode 100644
index 000000000..4d82445a8
--- /dev/null
+++ b/gr-filter/grc/variable_band_pass_filter_taps.block.yml
@@ -0,0 +1,53 @@
+id: variable_band_pass_filter_taps
+label: Band-pass Filter Taps
+
+parameters:
+- id: type
+ label: Tap Type
+ dtype: enum
+ options: [taps_real, taps_complex]
+ option_labels: [Real, Complex]
+ option_attributes:
+ fcn: [band_pass, complex_band_pass]
+- id: gain
+ label: Gain
+ dtype: float
+ default: '1.0'
+- id: samp_rate
+ label: Sample Rate (Hz)
+ dtype: float
+ default: samp_rate
+- id: low_cutoff_freq
+ label: Low Cutoff Freq (Hz)
+ dtype: float
+- id: high_cutoff_freq
+ label: High Cutoff Freq (Hz)
+ dtype: float
+- id: width
+ label: Transition Width (Hz)
+ dtype: float
+- id: win
+ label: Window
+ dtype: int
+ default: firdes.WIN_HAMMING
+ options: [firdes.WIN_HAMMING, firdes.WIN_HANN, firdes.WIN_BLACKMAN, firdes.WIN_RECTANGULAR,
+ firdes.WIN_KAISER]
+ option_labels: [Hamming, Hann, Blackman, Rectangular, Kaiser]
+- id: beta
+ label: Beta
+ dtype: float
+ default: '6.76'
+value: ${ firdes.type.fcn(gain, samp_rate, low_cutoff_freq, high_cutoff_freq, width,
+ win, beta) }
+
+templates:
+ imports: from gnuradio.filter import firdes
+ var_make: "\nself.${id} = ${id} = firdes.${type.fcn}(${gain}, ${samp_rate}, ${low_cutoff_freq},\
+ \ ${high_cutoff_freq}, ${width}, ${win}, ${beta})\n "
+
+documentation: |-
+ This is a convenience wrapper for calling firdes.band_pass() or firdes.complex_band_pass()
+
+ The beta paramater only applies to the Kaiser window.
+
+file_format: 1
diff --git a/gr-filter/grc/variable_band_pass_filter_taps.xml b/gr-filter/grc/variable_band_pass_filter_taps.xml
deleted file mode 100644
index 6cdfcc037..000000000
--- a/gr-filter/grc/variable_band_pass_filter_taps.xml
+++ /dev/null
@@ -1,97 +0,0 @@
-<?xml version="1.0"?>
-<!--
-#######################################################
-# Convenience wrapper for calling firdes.band_pass(...)
-# or firdes.complex_bandpass(...)
-#######################################################
- -->
-<block>
- <name>Band-pass Filter Taps</name>
- <key>variable_band_pass_filter_taps</key>
- <import>from gnuradio.filter import firdes</import>
- <var_make>
-self.$(id) = $(id) = firdes.$(type.fcn)($gain, $samp_rate, $low_cutoff_freq, $high_cutoff_freq, $width, $win, $beta)
- </var_make>
- <var_value>firdes.$(type.fcn)($gain, $samp_rate, $low_cutoff_freq, $high_cutoff_freq, $width, $win, $beta)</var_value>
- <make></make>
-
- <param>
- <name>Tap Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Real</name>
- <key>taps_real</key>
- <opt>fcn:band_pass</opt>
- </option>
- <option>
- <name>Complex</name>
- <key>taps_complex</key>
- <opt>fcn:complex_band_pass</opt>
- </option>
- </param>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1.0</value>
- <type>float</type>
- </param>
- <param>
- <name>Sample Rate (Hz)</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>float</type>
- </param>
- <param>
- <name>Low Cutoff Freq (Hz)</name>
- <key>low_cutoff_freq</key>
- <type>float</type>
- </param>
- <param>
- <name>High Cutoff Freq (Hz)</name>
- <key>high_cutoff_freq</key>
- <type>float</type>
- </param>
- <param>
- <name>Transition Width (Hz)</name>
- <key>width</key>
- <type>float</type>
- </param>
- <param>
- <name>Window</name>
- <key>win</key>
- <value>firdes.WIN_HAMMING</value>
- <type>int</type>
- <option>
- <name>Hamming</name>
- <key>firdes.WIN_HAMMING</key>
- </option>
- <option>
- <name>Hann</name>
- <key>firdes.WIN_HANN</key>
- </option>
- <option>
- <name>Blackman</name>
- <key>firdes.WIN_BLACKMAN</key>
- </option>
- <option>
- <name>Rectangular</name>
- <key>firdes.WIN_RECTANGULAR</key>
- </option>
- <option>
- <name>Kaiser</name>
- <key>firdes.WIN_KAISER</key>
- </option>
- </param>
- <param>
- <name>Beta</name>
- <key>beta</key>
- <value>6.76</value>
- <type>float</type>
- </param>
- <doc>
- This is a convenience wrapper for calling firdes.band_pass() or firdes.complex_band_pass()
-
- The beta paramater only applies to the Kaiser window.
- </doc>
-</block>
diff --git a/gr-filter/grc/variable_band_reject_filter_taps.block.yml b/gr-filter/grc/variable_band_reject_filter_taps.block.yml
new file mode 100644
index 000000000..fbb382506
--- /dev/null
+++ b/gr-filter/grc/variable_band_reject_filter_taps.block.yml
@@ -0,0 +1,46 @@
+id: variable_band_reject_filter_taps
+label: Band-reject Filter Taps
+
+parameters:
+- id: gain
+ label: Gain
+ dtype: float
+ default: '1.0'
+- id: samp_rate
+ label: Sample Rate (Hz)
+ dtype: float
+ default: samp_rate
+- id: low_cutoff_freq
+ label: Low Cutoff Freq (Hz)
+ dtype: float
+- id: high_cutoff_freq
+ label: High Cutoff Freq (Hz)
+ dtype: float
+- id: width
+ label: Transition Width (Hz)
+ dtype: float
+- id: win
+ label: Window
+ dtype: int
+ default: firdes.WIN_HAMMING
+ options: [firdes.WIN_HAMMING, firdes.WIN_HANN, firdes.WIN_BLACKMAN, firdes.WIN_RECTANGULAR,
+ firdes.WIN_KAISER]
+ option_labels: [Hamming, Hann, Blackman, Rectangular, Kaiser]
+- id: beta
+ label: Beta
+ dtype: float
+ default: '6.76'
+value: ${ firdes.band_reject(gain, samp_rate, low_cutoff_freq, high_cutoff_freq, width,
+ win, beta) }
+
+templates:
+ imports: from gnuradio.filter import firdes
+ var_make: "\nself.${id} = ${id} = firdes.band_reject(${gain}, ${samp_rate}, ${low_cutoff_freq},\
+ \ ${high_cutoff_freq}, ${width}, ${win}, ${beta})\n "
+
+documentation: |-
+ This is a convenience wrapper for calling firdes.band_reject().
+
+ The beta paramater only applies to the Kaiser window.
+
+file_format: 1
diff --git a/gr-filter/grc/variable_band_reject_filter_taps.xml b/gr-filter/grc/variable_band_reject_filter_taps.xml
deleted file mode 100644
index fbf25886d..000000000
--- a/gr-filter/grc/variable_band_reject_filter_taps.xml
+++ /dev/null
@@ -1,81 +0,0 @@
-<?xml version="1.0"?>
-<!--
-#########################################################
-# Convenience wrapper for calling firdes.band_reject(...)
-#########################################################
- -->
-<block>
- <name>Band-reject Filter Taps</name>
- <key>variable_band_reject_filter_taps</key>
- <import>from gnuradio.filter import firdes</import>
- <var_make>
-self.$(id) = $(id) = firdes.band_reject($gain, $samp_rate, $low_cutoff_freq, $high_cutoff_freq, $width, $win, $beta)
- </var_make>
- <var_value>firdes.band_reject($gain, $samp_rate, $low_cutoff_freq, $high_cutoff_freq, $width, $win, $beta)</var_value>
- <make></make>
-
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1.0</value>
- <type>float</type>
- </param>
- <param>
- <name>Sample Rate (Hz)</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>float</type>
- </param>
- <param>
- <name>Low Cutoff Freq (Hz)</name>
- <key>low_cutoff_freq</key>
- <type>float</type>
- </param>
- <param>
- <name>High Cutoff Freq (Hz)</name>
- <key>high_cutoff_freq</key>
- <type>float</type>
- </param>
- <param>
- <name>Transition Width (Hz)</name>
- <key>width</key>
- <type>float</type>
- </param>
- <param>
- <name>Window</name>
- <key>win</key>
- <value>firdes.WIN_HAMMING</value>
- <type>int</type>
- <option>
- <name>Hamming</name>
- <key>firdes.WIN_HAMMING</key>
- </option>
- <option>
- <name>Hann</name>
- <key>firdes.WIN_HANN</key>
- </option>
- <option>
- <name>Blackman</name>
- <key>firdes.WIN_BLACKMAN</key>
- </option>
- <option>
- <name>Rectangular</name>
- <key>firdes.WIN_RECTANGULAR</key>
- </option>
- <option>
- <name>Kaiser</name>
- <key>firdes.WIN_KAISER</key>
- </option>
- </param>
- <param>
- <name>Beta</name>
- <key>beta</key>
- <value>6.76</value>
- <type>float</type>
- </param>
- <doc>
- This is a convenience wrapper for calling firdes.band_reject().
-
- The beta paramater only applies to the Kaiser window.
- </doc>
-</block>
diff --git a/gr-filter/grc/variable_high_pass_filter_taps.block.yml b/gr-filter/grc/variable_high_pass_filter_taps.block.yml
new file mode 100644
index 000000000..e7aa9ee0d
--- /dev/null
+++ b/gr-filter/grc/variable_high_pass_filter_taps.block.yml
@@ -0,0 +1,42 @@
+id: variable_high_pass_filter_taps
+label: High-pass Filter Taps
+
+parameters:
+- id: gain
+ label: Gain
+ dtype: float
+ default: '1.0'
+- id: samp_rate
+ label: Sample Rate (Hz)
+ dtype: float
+ default: samp_rate
+- id: cutoff_freq
+ label: Cutoff Freq (Hz)
+ dtype: float
+- id: width
+ label: Transition Width (Hz)
+ dtype: float
+- id: win
+ label: Window
+ dtype: int
+ default: firdes.WIN_HAMMING
+ options: [firdes.WIN_HAMMING, firdes.WIN_HANN, firdes.WIN_BLACKMAN, firdes.WIN_RECTANGULAR,
+ firdes.WIN_KAISER]
+ option_labels: [Hamming, Hann, Blackman, Rectangular, Kaiser]
+- id: beta
+ label: Beta
+ dtype: float
+ default: '6.76'
+value: ${ firdes.high_pass(gain, samp_rate, cutoff_freq, width, win, beta) }
+
+templates:
+ imports: from gnuradio.filter import firdes
+ var_make: "\nself.${id} = ${id} = firdes.high_pass(${gain}, ${samp_rate}, ${cutoff_freq},\
+ \ ${width}, ${win}, ${beta})\n "
+
+documentation: |-
+ This variable is a convenience wrapper around a call to firdes.high_pass(...).
+
+ The beta paramater only applies to the Kaiser window.
+
+file_format: 1
diff --git a/gr-filter/grc/variable_high_pass_filter_taps.xml b/gr-filter/grc/variable_high_pass_filter_taps.xml
deleted file mode 100644
index 08768d808..000000000
--- a/gr-filter/grc/variable_high_pass_filter_taps.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0"?>
-<!--
-######################################################
-## Convenience wrapper around call to fides.high_pass()
-######################################################
- -->
-<block>
- <name>High-pass Filter Taps</name>
- <key>variable_high_pass_filter_taps</key>
- <import>from gnuradio.filter import firdes</import>
- <var_make>
-self.$(id) = $(id) = firdes.high_pass($gain, $samp_rate, $cutoff_freq, $width, $win, $beta)
- </var_make>
- <var_value>firdes.high_pass($gain, $samp_rate, $cutoff_freq, $width, $win, $beta)</var_value>
- <make></make>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1.0</value>
- <type>float</type>
- </param>
- <param>
- <name>Sample Rate (Hz)</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>float</type>
- </param>
- <param>
- <name>Cutoff Freq (Hz)</name>
- <key>cutoff_freq</key>
- <type>float</type>
- </param>
- <param>
- <name>Transition Width (Hz)</name>
- <key>width</key>
- <type>float</type>
- </param>
- <param>
- <name>Window</name>
- <key>win</key>
- <value>firdes.WIN_HAMMING</value>
- <type>int</type>
- <option>
- <name>Hamming</name>
- <key>firdes.WIN_HAMMING</key>
- </option>
- <option>
- <name>Hann</name>
- <key>firdes.WIN_HANN</key>
- </option>
- <option>
- <name>Blackman</name>
- <key>firdes.WIN_BLACKMAN</key>
- </option>
- <option>
- <name>Rectangular</name>
- <key>firdes.WIN_RECTANGULAR</key>
- </option>
- <option>
- <name>Kaiser</name>
- <key>firdes.WIN_KAISER</key>
- </option>
- </param>
- <param>
- <name>Beta</name>
- <key>beta</key>
- <value>6.76</value>
- <type>float</type>
- </param>
- <doc>
- This variable is a convenience wrapper around a call to firdes.high_pass(...).
-
- The beta paramater only applies to the Kaiser window.
- </doc>
-</block>
diff --git a/gr-filter/grc/variable_low_pass_filter_taps.block.yml b/gr-filter/grc/variable_low_pass_filter_taps.block.yml
new file mode 100644
index 000000000..2a28e2be1
--- /dev/null
+++ b/gr-filter/grc/variable_low_pass_filter_taps.block.yml
@@ -0,0 +1,42 @@
+id: variable_low_pass_filter_taps
+label: Low-pass Filter Taps
+
+parameters:
+- id: gain
+ label: Gain
+ dtype: float
+ default: '1.0'
+- id: samp_rate
+ label: Sample Rate (Hz)
+ dtype: float
+ default: samp_rate
+- id: cutoff_freq
+ label: Cutoff Freq (Hz)
+ dtype: float
+- id: width
+ label: Transition Width (Hz)
+ dtype: float
+- id: win
+ label: Window
+ dtype: int
+ default: firdes.WIN_HAMMING
+ options: [firdes.WIN_HAMMING, firdes.WIN_HANN, firdes.WIN_BLACKMAN, firdes.WIN_RECTANGULAR,
+ firdes.WIN_KAISER]
+ option_labels: [Hamming, Hann, Blackman, Rectangular, Kaiser]
+- id: beta
+ label: Beta
+ dtype: float
+ default: '6.76'
+value: ${ firdes.low_pass(gain, samp_rate, cutoff_freq, width, win, beta) }
+
+templates:
+ imports: from gnuradio.filter import firdes
+ var_make: "\nself.${id} = ${id} = firdes.low_pass(${gain}, ${samp_rate}, ${cutoff_freq},\
+ \ ${width}, ${win}, ${beta})\n "
+
+documentation: |-
+ This variable is a convenience wrapper around a call to firdes.low_pass(...).
+
+ The beta paramater only applies to the Kaiser window.
+
+file_format: 1
diff --git a/gr-filter/grc/variable_low_pass_filter_taps.xml b/gr-filter/grc/variable_low_pass_filter_taps.xml
deleted file mode 100644
index e3367b1ec..000000000
--- a/gr-filter/grc/variable_low_pass_filter_taps.xml
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0"?>
-<!--
-######################################################
-## Convenience wrapper around call to fides.low_pass()
-######################################################
- -->
-<block>
- <name>Low-pass Filter Taps</name>
- <key>variable_low_pass_filter_taps</key>
- <import>from gnuradio.filter import firdes</import>
- <var_make>
-self.$(id) = $(id) = firdes.low_pass($gain, $samp_rate, $cutoff_freq, $width, $win, $beta)
- </var_make>
- <var_value>firdes.low_pass($gain, $samp_rate, $cutoff_freq, $width, $win, $beta)</var_value>
- <make></make>
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1.0</value>
- <type>float</type>
- </param>
- <param>
- <name>Sample Rate (Hz)</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>float</type>
- </param>
- <param>
- <name>Cutoff Freq (Hz)</name>
- <key>cutoff_freq</key>
- <type>float</type>
- </param>
- <param>
- <name>Transition Width (Hz)</name>
- <key>width</key>
- <type>float</type>
- </param>
- <param>
- <name>Window</name>
- <key>win</key>
- <value>firdes.WIN_HAMMING</value>
- <type>int</type>
- <option>
- <name>Hamming</name>
- <key>firdes.WIN_HAMMING</key>
- </option>
- <option>
- <name>Hann</name>
- <key>firdes.WIN_HANN</key>
- </option>
- <option>
- <name>Blackman</name>
- <key>firdes.WIN_BLACKMAN</key>
- </option>
- <option>
- <name>Rectangular</name>
- <key>firdes.WIN_RECTANGULAR</key>
- </option>
- <option>
- <name>Kaiser</name>
- <key>firdes.WIN_KAISER</key>
- </option>
- </param>
- <param>
- <name>Beta</name>
- <key>beta</key>
- <value>6.76</value>
- <type>float</type>
- </param>
- <doc>
- This variable is a convenience wrapper around a call to firdes.low_pass(...).
-
- The beta paramater only applies to the Kaiser window.
- </doc>
-</block>
diff --git a/gr-filter/grc/variable_rrc_filter_taps.block.yml b/gr-filter/grc/variable_rrc_filter_taps.block.yml
new file mode 100644
index 000000000..6fcf0c56c
--- /dev/null
+++ b/gr-filter/grc/variable_rrc_filter_taps.block.yml
@@ -0,0 +1,34 @@
+id: variable_rrc_filter_taps
+label: RRC Filter Taps
+
+parameters:
+- id: gain
+ label: Gain
+ dtype: float
+ default: '1.0'
+- id: samp_rate
+ label: Sample Rate (Hz)
+ dtype: float
+ default: samp_rate
+- id: sym_rate
+ label: Symbol Rate (Hz)
+ dtype: float
+- id: alpha
+ label: Excess BW
+ dtype: float
+ default: '0.35'
+- id: ntaps
+ label: Num Taps
+ dtype: int
+ default: 11*sps
+value: ${ firdes.root_raised_cosine(gain, samp_rate, sym_rate, alpha, ntaps) }
+
+templates:
+ imports: from gnuradio.filter import firdes
+ var_make: "\nself.${id} = ${id} = firdes.root_raised_cosine(${gain}, ${samp_rate},\
+ \ ${sym_rate}, ${alpha}, ${ntaps})\n "
+
+documentation: |-
+ This is a convenience wrapper for calling firdes.root_raised_cosine(...).
+
+file_format: 1
diff --git a/gr-filter/grc/variable_rrc_filter_taps.xml b/gr-filter/grc/variable_rrc_filter_taps.xml
deleted file mode 100644
index 2824ba75b..000000000
--- a/gr-filter/grc/variable_rrc_filter_taps.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0"?>
-<!--
-########################################################################
-## Convenience wrapper for calling firdes.root_raised_cosine_filter(...)
-########################################################################
- -->
-<block>
- <name>RRC Filter Taps</name>
- <key>variable_rrc_filter_taps</key>
- <import>from gnuradio.filter import firdes</import>
- <var_make>
-self.$(id) = $(id) = firdes.root_raised_cosine($gain, $samp_rate, $sym_rate, $alpha, $ntaps)
- </var_make>
- <var_value>firdes.root_raised_cosine($gain, $samp_rate, $sym_rate, $alpha, $ntaps)</var_value>
- <make></make>
-
- <param>
- <name>Gain</name>
- <key>gain</key>
- <value>1.0</value>
- <type>float</type>
- </param>
- <param>
- <name>Sample Rate (Hz)</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>float</type>
- </param>
- <param>
- <name>Symbol Rate (Hz)</name>
- <key>sym_rate</key>
- <value></value>
- <type>float</type>
- </param>
- <param>
- <name>Excess BW</name>
- <key>alpha</key>
- <value>0.35</value>
- <type>float</type>
- </param>
- <param>
- <name>Num Taps</name>
- <key>ntaps</key>
- <value>11*sps</value>
- <type>int</type>
- </param>
- <doc>
- This is a convenience wrapper for calling firdes.root_raised_cosine(...).
- </doc>
-</block>
diff --git a/gr-filter/lib/iir_filter_ffd_impl.cc b/gr-filter/lib/iir_filter_ffd_impl.cc
index f70e3a25a..c389b7c84 100644
--- a/gr-filter/lib/iir_filter_ffd_impl.cc
+++ b/gr-filter/lib/iir_filter_ffd_impl.cc
@@ -32,21 +32,21 @@ namespace gr {
iir_filter_ffd::sptr
iir_filter_ffd::make(const std::vector<double> &fftaps,
- const std::vector<double> &fbtaps,
- bool oldstyle)
+ const std::vector<double> &fbtaps,
+ bool oldstyle)
{
return gnuradio::get_initial_sptr
- (new iir_filter_ffd_impl(fftaps, fbtaps, oldstyle));
+ (new iir_filter_ffd_impl(fftaps, fbtaps, oldstyle));
}
iir_filter_ffd_impl::iir_filter_ffd_impl(const std::vector<double> &fftaps,
- const std::vector<double> &fbtaps,
- bool oldstyle)
+ const std::vector<double> &fbtaps,
+ bool oldstyle)
: sync_block("iir_filter_ffd",
- io_signature::make(1, 1, sizeof (float)),
- io_signature::make(1, 1, sizeof (float))),
- d_updated(false)
+ io_signature::make(1, 1, sizeof (float)),
+ io_signature::make(1, 1, sizeof (float))),
+ d_updated(false)
{
d_iir = new kernel::iir_filter<float,float,double,double>(fftaps, fbtaps, oldstyle);
}
@@ -58,7 +58,7 @@ namespace gr {
void
iir_filter_ffd_impl::set_taps(const std::vector<double> &fftaps,
- const std::vector<double> &fbtaps)
+ const std::vector<double> &fbtaps)
{
d_new_fftaps = fftaps;
d_new_fbtaps = fbtaps;
@@ -67,20 +67,20 @@ namespace gr {
int
iir_filter_ffd_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
{
const float *in = (const float*)input_items[0];
float *out = (float*)output_items[0];
if(d_updated) {
- d_iir->set_taps(d_new_fftaps, d_new_fbtaps);
- d_updated = false;
+ d_iir->set_taps(d_new_fftaps, d_new_fbtaps);
+ d_updated = false;
}
d_iir->filter_n(out, in, noutput_items);
return noutput_items;
- };
+ }
} /* namespace filter */
} /* namespace gr */
diff --git a/gr-filter/lib/single_pole_iir_filter_ff_impl.cc b/gr-filter/lib/single_pole_iir_filter_ff_impl.cc
index d948afbc1..cbbcad4d7 100644
--- a/gr-filter/lib/single_pole_iir_filter_ff_impl.cc
+++ b/gr-filter/lib/single_pole_iir_filter_ff_impl.cc
@@ -34,15 +34,15 @@ namespace gr {
single_pole_iir_filter_ff::make(double alpha, unsigned int vlen)
{
return gnuradio::get_initial_sptr
- (new single_pole_iir_filter_ff_impl(alpha, vlen));
+ (new single_pole_iir_filter_ff_impl(alpha, vlen));
}
single_pole_iir_filter_ff_impl::single_pole_iir_filter_ff_impl
- (double alpha, unsigned int vlen)
- : sync_block("single_pole_iir_filter_ff",
- io_signature::make(1, 1, sizeof(float)*vlen),
- io_signature::make(1, 1, sizeof(float)*vlen)),
- d_vlen(vlen), d_iir(vlen)
+ (double alpha, unsigned int vlen)
+ : sync_block("single_pole_iir_filter_ff",
+ io_signature::make(1, 1, sizeof(float)*vlen),
+ io_signature::make(1, 1, sizeof(float)*vlen)),
+ d_vlen(vlen), d_iir(vlen)
{
set_taps(alpha);
}
@@ -55,33 +55,33 @@ namespace gr {
single_pole_iir_filter_ff_impl::set_taps(double alpha)
{
for(unsigned int i = 0; i < d_vlen; i++) {
- d_iir[i].set_taps(alpha);
+ d_iir[i].set_taps(alpha);
}
}
int
single_pole_iir_filter_ff_impl::work(int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
{
const float *in = (const float*)input_items[0];
float *out = (float*)output_items[0];
unsigned int vlen = d_vlen;
if(d_vlen == 1) {
- for(int i = 0; i < noutput_items; i++) {
- out[i] = d_iir[0].filter (in[i]);
- }
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = d_iir[0].filter (in[i]);
+ }
}
else {
- for(int i = 0; i < noutput_items; i++) {
- for(unsigned int j = 0; j < vlen; j++) {
- *out++ = d_iir[j].filter(*in++);
- }
- }
+ for(int i = 0; i < noutput_items; i++) {
+ for(unsigned int j = 0; j < vlen; j++) {
+ *out++ = d_iir[j].filter(*in++);
+ }
+ }
}
return noutput_items;
- };
+ }
} /* namespace filter */
} /* namespace gr */
diff --git a/gr-filter/python/filter/CMakeLists.txt b/gr-filter/python/filter/CMakeLists.txt
index bc4892412..f692456d0 100644
--- a/gr-filter/python/filter/CMakeLists.txt
+++ b/gr-filter/python/filter/CMakeLists.txt
@@ -46,6 +46,6 @@ if(ENABLE_TESTING)
file(GLOB py_qa_test_files "qa_*.py")
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gr-filter/python/filter/__init__.py b/gr-filter/python/filter/__init__.py
index cbbc80f95..4051a9677 100644
--- a/gr-filter/python/filter/__init__.py
+++ b/gr-filter/python/filter/__init__.py
@@ -22,19 +22,23 @@
'''
Filter blocks and related functions.
'''
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
import os
try:
- from filter_swig import *
+ from .filter_swig import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
- from filter_swig import *
-from filterbank import *
-from freq_xlating_fft_filter import *
-from rational_resampler import *
-import pfb
-import optfir
+ from .filter_swig import *
+
+from .filterbank import *
+from .freq_xlating_fft_filter import *
+from .rational_resampler import *
+from . import pfb
+from . import optfir
# Pull this into the filter module
from gnuradio.fft import window
diff --git a/gr-filter/python/filter/design/api_object.py b/gr-filter/python/filter/design/api_object.py
index 013ea56ed..0b58bf9a5 100644
--- a/gr-filter/python/filter/design/api_object.py
+++ b/gr-filter/python/filter/design/api_object.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
@@ -18,7 +19,7 @@
# Boston, MA 02110-1301, USA.
#
-class ApiObject():
+class ApiObject(object):
'''
Filter count variable if the filter design tool has to
return multiple filter parameters in future
diff --git a/gr-filter/python/filter/design/filter_design.py b/gr-filter/python/filter/design/filter_design.py
index f94b6b834..9c2c16370 100644
--- a/gr-filter/python/filter/design/filter_design.py
+++ b/gr-filter/python/filter/design/filter_design.py
@@ -18,65 +18,72 @@
# Boston, MA 02110-1301, USA.
#
-import sys, os, re, csv, copy
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
+import sys
+import re
+import csv
import warnings
from optparse import OptionParser
+
from gnuradio import filter
try:
import scipy
from scipy import fftpack, poly1d, signal
except ImportError:
- print "Please install SciPy to run this script (http://www.scipy.org/)"
- raise SystemExit, 1
+ print("Please install SciPy to run this script (http://www.scipy.org/)")
+ raise SystemExit(1)
try:
from PyQt4 import Qt, QtCore, QtGui
except ImportError:
- print "Please install PyQt4 to run this script (http://www.riverbankcomputing.co.uk/software/pyqt/download)"
- raise SystemExit, 1
+ print("Please install PyQt4 to run this script (http://www.riverbankcomputing.co.uk/software/pyqt/download)")
+ raise SystemExit(1)
try:
import PyQt4.Qwt5 as Qwt
except ImportError:
- print "Please install PyQwt5 to run this script (http://pyqwt.sourceforge.net/)"
- raise SystemExit, 1
+ print("Please install PyQwt5 to run this script (http://pyqwt.sourceforge.net/)")
+ raise SystemExit(1)
try:
from gnuradio.filter.pyqt_filter_stacked import Ui_MainWindow
except ImportError:
- print "Could not import from pyqt_filter_stacked. Please build with \"pyuic4 pyqt_filter_stacked.ui -o pyqt_filter_stacked.py\""
- raise SystemExit, 1
+ print("Could not import from pyqt_filter_stacked. Please build with \"pyuic4 pyqt_filter_stacked.ui -o pyqt_filter_stacked.py\"")
+ raise SystemExit(1)
try:
from gnuradio.filter.banditems import *
except ImportError:
- print "Could not import from banditems. Please check whether banditems.py is in the library path"
- raise SystemExit, 1
+ print("Could not import from banditems. Please check whether banditems.py is in the library path")
+ raise SystemExit(1)
try:
from gnuradio.filter.polezero_plot import *
except ImportError:
- print "Could not import from polezero_plot. Please check whether polezero_plot.py is in the library path"
- raise SystemExit, 1
+ print("Could not import from polezero_plot. Please check whether polezero_plot.py is in the library path")
+ raise SystemExit(1)
try:
from gnuradio.filter.idealbanditems import *
except ImportError:
- print "Could not import from idealbanditems. Please check whether idealbanditems.py is in the library path"
- raise SystemExit, 1
+ print("Could not import from idealbanditems. Please check whether idealbanditems.py is in the library path")
+ raise SystemExit(1)
try:
from gnuradio.filter.api_object import *
except ImportError:
- print "Could not import from api_object. Please check whether api_object.py is in the library path"
- raise SystemExit, 1
+ print("Could not import from api_object. Please check whether api_object.py is in the library path")
+ raise SystemExit(1)
try:
from gnuradio.filter.fir_design import *
except ImportError:
- print "Could not import from fir_design. Please check whether fir_design.py is in the library path"
- raise SystemExit, 1
+ print("Could not import from fir_design. Please check whether fir_design.py is in the library path")
+ raise SystemExit(1)
try:
_fromUtf8 = QtCore.QString.fromUtf8
@@ -140,72 +147,72 @@ class gr_plot_filter(QtGui.QMainWindow):
self.nfft_edit_changed)
self.connect(self.gui.actionQuick_Access,
- Qt.SIGNAL("activated()"),
- self.action_quick_access)
+ Qt.SIGNAL("activated()"),
+ self.action_quick_access)
self.connect(self.gui.actionSpec_Widget,
- Qt.SIGNAL("activated()"),
- self.action_spec_widget)
+ Qt.SIGNAL("activated()"),
+ self.action_spec_widget)
self.connect(self.gui.actionResponse_Widget,
- Qt.SIGNAL("activated()"),
- self.action_response_widget)
+ Qt.SIGNAL("activated()"),
+ self.action_response_widget)
self.connect(self.gui.actionDesign_Widget,
- Qt.SIGNAL("activated()"),
- self.action_design_widget)
+ Qt.SIGNAL("activated()"),
+ self.action_design_widget)
self.connect(self.gui.actionMagnitude_Response,
- Qt.SIGNAL("activated()"),
- self.set_actmagresponse)
+ Qt.SIGNAL("activated()"),
+ self.set_actmagresponse)
self.connect(self.gui.actionGrid_2,
- Qt.SIGNAL("activated()"),
- self.set_actgrid)
+ Qt.SIGNAL("activated()"),
+ self.set_actgrid)
self.connect(self.gui.actionPhase_Respone,
- Qt.SIGNAL("activated()"),
- self.set_actphase)
+ Qt.SIGNAL("activated()"),
+ self.set_actphase)
self.connect(self.gui.actionGroup_Delay,
- Qt.SIGNAL("activated()"),
- self.set_actgdelay)
+ Qt.SIGNAL("activated()"),
+ self.set_actgdelay)
self.connect(self.gui.actionFilter_Coefficients,
- Qt.SIGNAL("activated()"),
- self.set_actfcoeff)
+ Qt.SIGNAL("activated()"),
+ self.set_actfcoeff)
self.connect(self.gui.actionBand_Diagram,
- Qt.SIGNAL("activated()"),
- self.set_actband)
+ Qt.SIGNAL("activated()"),
+ self.set_actband)
self.connect(self.gui.actionIdeal_Band,
- Qt.SIGNAL("activated()"),
- self.set_drawideal)
+ Qt.SIGNAL("activated()"),
+ self.set_drawideal)
self.connect(self.gui.actionPole_Zero_Plot_2,
- Qt.SIGNAL("activated()"),
- self.set_actpzplot)
+ Qt.SIGNAL("activated()"),
+ self.set_actpzplot)
self.connect(self.gui.actionGridview,
- Qt.SIGNAL("activated()"),
- self.set_switchview)
+ Qt.SIGNAL("activated()"),
+ self.set_switchview)
self.connect(self.gui.actionPlot_select,
- Qt.SIGNAL("activated()"),
- self.set_plotselect)
+ Qt.SIGNAL("activated()"),
+ self.set_plotselect)
self.connect(self.gui.actionPhase_Delay,
- Qt.SIGNAL("activated()"),
- self.set_actpdelay)
+ Qt.SIGNAL("activated()"),
+ self.set_actpdelay)
self.connect(self.gui.actionImpulse_Response,
- Qt.SIGNAL("activated()"),
- self.set_actimpres)
+ Qt.SIGNAL("activated()"),
+ self.set_actimpres)
self.connect(self.gui.actionStep_Response,
- Qt.SIGNAL("activated()"),
- self.set_actstepres)
+ Qt.SIGNAL("activated()"),
+ self.set_actstepres)
self.connect(self.gui.mfmagPush,
Qt.SIGNAL("released()"),
@@ -272,48 +279,48 @@ class gr_plot_filter(QtGui.QMainWindow):
self.set_mtimpulse)
self.connect(self.gui.checkKeepcur,
- Qt.SIGNAL("stateChanged(int)"),
- self.set_bufferplots)
+ Qt.SIGNAL("stateChanged(int)"),
+ self.set_bufferplots)
self.connect(self.gui.checkGrid,
- Qt.SIGNAL("stateChanged(int)"),
- self.set_grid)
+ Qt.SIGNAL("stateChanged(int)"),
+ self.set_grid)
self.connect(self.gui.checkMagres,
- Qt.SIGNAL("stateChanged(int)"),
- self.set_magresponse)
+ Qt.SIGNAL("stateChanged(int)"),
+ self.set_magresponse)
self.connect(self.gui.checkGdelay,
- Qt.SIGNAL("stateChanged(int)"),
- self.set_gdelay)
+ Qt.SIGNAL("stateChanged(int)"),
+ self.set_gdelay)
self.connect(self.gui.checkPhase,
- Qt.SIGNAL("stateChanged(int)"),
- self.set_phase)
+ Qt.SIGNAL("stateChanged(int)"),
+ self.set_phase)
self.connect(self.gui.checkFcoeff,
- Qt.SIGNAL("stateChanged(int)"),
- self.set_fcoeff)
+ Qt.SIGNAL("stateChanged(int)"),
+ self.set_fcoeff)
self.connect(self.gui.checkBand,
- Qt.SIGNAL("stateChanged(int)"),
- self.set_band)
+ Qt.SIGNAL("stateChanged(int)"),
+ self.set_band)
self.connect(self.gui.checkPzplot,
- Qt.SIGNAL("stateChanged(int)"),
- self.set_pzplot)
+ Qt.SIGNAL("stateChanged(int)"),
+ self.set_pzplot)
self.connect(self.gui.checkPdelay,
- Qt.SIGNAL("stateChanged(int)"),
- self.set_pdelay)
+ Qt.SIGNAL("stateChanged(int)"),
+ self.set_pdelay)
self.connect(self.gui.checkImpulse,
- Qt.SIGNAL("stateChanged(int)"),
- self.set_impres)
+ Qt.SIGNAL("stateChanged(int)"),
+ self.set_impres)
self.connect(self.gui.checkStep,
- Qt.SIGNAL("stateChanged(int)"),
- self.set_stepres)
+ Qt.SIGNAL("stateChanged(int)"),
+ self.set_stepres)
self.gridenable = False
self.mfoverlay = False
@@ -387,28 +394,28 @@ class gr_plot_filter(QtGui.QMainWindow):
impxtitle = Qwt.QwtText("n (Samples)")
impxtitle.setFont(Qt.QFont("Helvetica", 11, Qt.QFont.Bold))
self.gui.impresPlot.setAxisTitle(self.gui.freqPlot.xBottom,
- impxtitle)
+ impxtitle)
self.gui.impresPlot.setAxisTitle(self.gui.freqPlot.yLeft,
- impytitle)
+ impytitle)
self.gui.stepresPlot.setAxisTitle(self.gui.freqPlot.xBottom,
- impxtitle)
+ impxtitle)
self.gui.stepresPlot.setAxisTitle(self.gui.freqPlot.yLeft,
- impytitle)
+ impytitle)
mtytitle = Qwt.QwtText("Amplitude")
mtytitle.setFont(Qt.QFont("Helvetica", 9, Qt.QFont.Bold))
mtxtitle = Qwt.QwtText("n (Samples/taps)")
mtxtitle.setFont(Qt.QFont("Helvetica", 9, Qt.QFont.Bold))
self.gui.mtimePlot.setAxisTitle(self.gui.freqPlot.xBottom,
- mtxtitle)
+ mtxtitle)
self.gui.mtimePlot.setAxisTitle(self.gui.freqPlot.yLeft,
- mtytitle)
+ mtytitle)
phytitle = Qwt.QwtText("Phase Delay")
phytitle.setFont(Qt.QFont("Helvetica", 11, Qt.QFont.Bold))
self.gui.pdelayPlot.setAxisTitle(self.gui.groupPlot.xBottom,
- fxtitle)
+ fxtitle)
self.gui.pdelayPlot.setAxisTitle(self.gui.groupPlot.yLeft,
- phytitle)
+ phytitle)
# Set up plot curves
self.rcurve = Qwt.QwtPlotCurve("Real")
@@ -480,16 +487,16 @@ class gr_plot_filter(QtGui.QMainWindow):
self.gui.timePlot.canvas())
self.mtimeZoomer = Qwt.QwtPlotZoomer(self.gui.mtimePlot.xBottom,
- self.gui.mtimePlot.yLeft,
- Qwt.QwtPicker.PointSelection,
- Qwt.QwtPicker.AlwaysOn,
- self.gui.mtimePlot.canvas())
+ self.gui.mtimePlot.yLeft,
+ Qwt.QwtPicker.PointSelection,
+ Qwt.QwtPicker.AlwaysOn,
+ self.gui.mtimePlot.canvas())
self.mtimeZoomer2 = Qwt.QwtPlotZoomer(self.gui.mtimePlot.xBottom,
- self.gui.mtimePlot.yRight,
- Qwt.QwtPicker.PointSelection,
- Qwt.QwtPicker.AlwaysOff,
- self.gui.mtimePlot.canvas())
+ self.gui.mtimePlot.yRight,
+ Qwt.QwtPicker.PointSelection,
+ Qwt.QwtPicker.AlwaysOff,
+ self.gui.mtimePlot.canvas())
self.freqZoomer = Qwt.QwtPlotZoomer(self.gui.freqPlot.xBottom,
self.gui.freqPlot.yLeft,
@@ -523,25 +530,25 @@ class gr_plot_filter(QtGui.QMainWindow):
self.gui.groupPlot.canvas())
self.impresZoomer = Qwt.QwtPlotZoomer(self.gui.groupPlot.xBottom,
- self.gui.groupPlot.yLeft,
- Qwt.QwtPicker.PointSelection,
- Qwt.QwtPicker.AlwaysOn,
- self.gui.impresPlot.canvas())
+ self.gui.groupPlot.yLeft,
+ Qwt.QwtPicker.PointSelection,
+ Qwt.QwtPicker.AlwaysOn,
+ self.gui.impresPlot.canvas())
self.stepresZoomer = Qwt.QwtPlotZoomer(self.gui.groupPlot.xBottom,
- self.gui.groupPlot.yLeft,
- Qwt.QwtPicker.PointSelection,
- Qwt.QwtPicker.AlwaysOn,
- self.gui.stepresPlot.canvas())
+ self.gui.groupPlot.yLeft,
+ Qwt.QwtPicker.PointSelection,
+ Qwt.QwtPicker.AlwaysOn,
+ self.gui.stepresPlot.canvas())
self.pdelayZoomer = Qwt.QwtPlotZoomer(self.gui.groupPlot.xBottom,
- self.gui.groupPlot.yLeft,
- Qwt.QwtPicker.PointSelection,
- Qwt.QwtPicker.AlwaysOn,
- self.gui.pdelayPlot.canvas())
+ self.gui.groupPlot.yLeft,
+ Qwt.QwtPicker.PointSelection,
+ Qwt.QwtPicker.AlwaysOn,
+ self.gui.pdelayPlot.canvas())
- #Assigning items
+ #Assigning items
self.lpfitems = lpfItems
self.hpfitems = hpfItems
self.bpfitems = bpfItems
@@ -580,7 +587,7 @@ class gr_plot_filter(QtGui.QMainWindow):
self.lpfstartproxy.setWidget(self.lpfpassEdit)
self.lpfstartproxy.setPos(400,30)
- self.lpfstopEdit=QtGui.QLineEdit()
+ self.lpfstopEdit=QtGui.QLineEdit()
self.lpfstopEdit.setMaximumSize(QtCore.QSize(75,20))
self.lpfstopEdit.setText(Qt.QString("Not set"))
self.lpfstopproxy=QtGui.QGraphicsProxyWidget()
@@ -642,39 +649,39 @@ class gr_plot_filter(QtGui.QMainWindow):
self.freqcurve.setPen(Qt.QPen(blueBrush, 1))
self.rcurve.setPen(Qt.QPen(Qt.Qt.white, 0, Qt.Qt.NoPen))
self.rcurve.setSymbol(Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse,
- Qt.QBrush(Qt.Qt.gray),
- Qt.QPen(Qt.Qt.blue),
- Qt.QSize(8, 8)))
+ Qt.QBrush(Qt.Qt.gray),
+ Qt.QPen(Qt.Qt.blue),
+ Qt.QSize(8, 8)))
self.icurve.setPen(Qt.QPen(Qt.Qt.white, 0, Qt.Qt.NoPen))
self.icurve.setSymbol(Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse,
- Qt.QBrush(Qt.Qt.gray),
- Qt.QPen(Qt.Qt.red),
- Qt.QSize(8, 8)))
+ Qt.QBrush(Qt.Qt.gray),
+ Qt.QPen(Qt.Qt.red),
+ Qt.QSize(8, 8)))
self.imprescurve.setPen(Qt.QPen(Qt.Qt.white, 0, Qt.Qt.NoPen))
self.imprescurve.setSymbol(Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse,
- Qt.QBrush(Qt.Qt.gray),
- Qt.QPen(Qt.Qt.blue),
- Qt.QSize(8, 8)))
+ Qt.QBrush(Qt.Qt.gray),
+ Qt.QPen(Qt.Qt.blue),
+ Qt.QSize(8, 8)))
self.imprescurve_i.setPen(Qt.QPen(Qt.Qt.white, 0, Qt.Qt.NoPen))
self.imprescurve_i.setSymbol(Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse,
- Qt.QBrush(Qt.Qt.gray),
- Qt.QPen(Qt.Qt.red),
- Qt.QSize(8, 8)))
+ Qt.QBrush(Qt.Qt.gray),
+ Qt.QPen(Qt.Qt.red),
+ Qt.QSize(8, 8)))
self.steprescurve.setPen(Qt.QPen(Qt.Qt.white, 0, Qt.Qt.NoPen))
self.steprescurve.setSymbol(Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse,
- Qt.QBrush(Qt.Qt.gray),
- Qt.QPen(Qt.Qt.blue),
- Qt.QSize(8, 8)))
+ Qt.QBrush(Qt.Qt.gray),
+ Qt.QPen(Qt.Qt.blue),
+ Qt.QSize(8, 8)))
self.steprescurve_i.setPen(Qt.QPen(Qt.Qt.white, 0, Qt.Qt.NoPen))
self.steprescurve_i.setSymbol(Qwt.QwtSymbol(Qwt.QwtSymbol.Ellipse,
- Qt.QBrush(Qt.Qt.gray),
- Qt.QPen(Qt.Qt.red),
- Qt.QSize(8, 8)))
+ Qt.QBrush(Qt.Qt.gray),
+ Qt.QPen(Qt.Qt.red),
+ Qt.QSize(8, 8)))
self.phasecurve.setPen(Qt.QPen(blueBrush, 1))
self.groupcurve.setPen(Qt.QPen(blueBrush, 1))
@@ -802,7 +809,7 @@ class gr_plot_filter(QtGui.QMainWindow):
# filters this window type can handle
currenttype = self.gui.filterTypeComboBox.currentText()
items = self.gui.filterTypeComboBox.count()
- for i in xrange(items):
+ for i in range(items):
self.gui.filterTypeComboBox.removeItem(0)
self.gui.filterTypeComboBox.addItems(self.optFilters)
@@ -835,9 +842,9 @@ class gr_plot_filter(QtGui.QMainWindow):
# filters this window type can handle
currenttype = self.gui.filterTypeComboBox.currentText()
items = self.gui.filterTypeComboBox.count()
- for i in xrange(items):
+ for i in range(items):
self.gui.filterTypeComboBox.removeItem(0)
- self.gui.filterTypeComboBox.addItems(self.firFilters)
+ self.gui.filterTypeComboBox.addItems(self.firFilters)
# If the last filter type was valid for this window type,
# go back to it; otherwise, reset
@@ -872,7 +879,7 @@ class gr_plot_filter(QtGui.QMainWindow):
self.design_iir()
if len(w):
reply = QtGui.QMessageBox.information(self, "BadCoefficients",
- str(w[-1].message),"&Ok")
+ str(w[-1].message),"&Ok")
# Do FIR design
def design_fir(self, ftype, fs, gain, winstr):
@@ -908,15 +915,15 @@ class gr_plot_filter(QtGui.QMainWindow):
self.gui.nTapsEdit.setText(Qt.QString("%1").arg(self.taps.size))
else:
self.draw_plots(taps,params)
- zeros=self.get_zeros()
- poles=self.get_poles()
- self.gui.pzPlot.insertZeros(zeros)
- self.gui.pzPlot.insertPoles(poles)
- self.gui.mpzPlot.insertZeros(zeros)
- self.gui.mpzPlot.insertPoles(poles)
- self.update_fcoeff()
- self.set_drawideal()
- #return taps if callback is enabled
+ zeros=self.get_zeros()
+ poles=self.get_poles()
+ self.gui.pzPlot.insertZeros(zeros)
+ self.gui.pzPlot.insertPoles(poles)
+ self.gui.mpzPlot.insertZeros(zeros)
+ self.gui.mpzPlot.insertPoles(poles)
+ self.update_fcoeff()
+ self.set_drawideal()
+ #return taps if callback is enabled
if self.callback:
retobj = ApiObject()
retobj.update_all("fir", self.params, self.taps, 1)
@@ -935,22 +942,22 @@ class gr_plot_filter(QtGui.QMainWindow):
self.cpicker.set_iir(True)
self.cpicker2.set_iir(True)
- iirft = {"Elliptic" : 'ellip',
+ iirft = {"Elliptic" : 'ellip',
"Butterworth" : 'butter',
"Chebyshev-1" : 'cheby1',
"Chebyshev-2" : 'cheby2',
"Bessel" : 'bessel' }
- sanalog = {"Analog (rad/second)" : 1,
- "Digital (normalized 0-1)" : 0 }
+ sanalog = {"Analog (rad/second)" : 1,
+ "Digital (normalized 0-1)" : 0 }
paramtype = { 1 : "analog",
0 : "digital" }
iirabbr = {
- "Low Pass" : "lpf",
- "High Pass" : "hpf",
- "Band Pass" : "bpf",
- "Band Stop" : "bnf" }
+ "Low Pass" : "lpf",
+ "High Pass" : "hpf",
+ "Band Pass" : "bpf",
+ "Band Stop" : "bnf" }
iirboxes = {"Low Pass" : [self.gui.iirendofLpfPassBandEdit.text().toDouble(),
self.gui.iirstartofLpfStopBandEdit.text().toDouble(),
@@ -1004,33 +1011,33 @@ class gr_plot_filter(QtGui.QMainWindow):
try:
(self.b,self.a) = signal.iirfilter(order, besselparams, btype=iirbtype.replace(' ','').lower(),
analog=sanalog[atype], ftype=iirft[iirftype], output='ba')
- except StandardError, e:
- reply = QtGui.QMessageBox.information(self, "IIR design error",
- e.args[0], "&Ok")
- (self.z,self.p,self.k) = signal.tf2zpk(self.b,self.a)
- iirparams = { "filttype": iirft[iirftype],"bandtype": iirabbr[iirbtype], "filtord": order, "paramtype":paramtype[sanalog[atype]],
- "critfreq": besselparams}
+ except Exception as e:
+ reply = QtGui.QMessageBox.information(self, "IIR design error",
+ e.args[0], "&Ok")
+ (self.z,self.p,self.k) = signal.tf2zpk(self.b,self.a)
+ iirparams = { "filttype": iirft[iirftype],"bandtype": iirabbr[iirbtype], "filtord": order, "paramtype":paramtype[sanalog[atype]],
+ "critfreq": besselparams}
else:
try:
(self.b,self.a) = signal.iirdesign(params[0], params[1], params[2],
- params[3], analog=sanalog[atype], ftype=iirft[iirftype], output='ba')
- except StandardError, e:
- reply = QtGui.QMessageBox.information(self, "IIR design error",
- e.args[0], "&Ok")
- (self.z,self.p,self.k) = signal.tf2zpk(self.b,self.a)
- #Create params
+ params[3], analog=sanalog[atype], ftype=iirft[iirftype], output='ba')
+ except Exception as e:
+ reply = QtGui.QMessageBox.information(self, "IIR design error",
+ e.args[0], "&Ok")
+ (self.z,self.p,self.k) = signal.tf2zpk(self.b,self.a)
+ #Create params
iirparams = { "filttype": iirft[iirftype], "bandtype": iirabbr[iirbtype],"paramtype":paramtype[sanalog[atype]],
"pbedge": params[0], "sbedge": params[1],"gpass": params[2],
"gstop": params[3]}
- self.gui.pzPlot.insertZeros(self.z)
- self.gui.pzPlot.insertPoles(self.p)
- self.gui.mpzPlot.insertZeros(self.z)
- self.gui.mpzPlot.insertPoles(self.p)
- self.iir_plot_all(self.z,self.p,self.k)
- self.update_fcoeff()
- self.gui.nTapsEdit.setText("-")
- self.params = iirparams
- #return api_object if callback is enabled
+ self.gui.pzPlot.insertZeros(self.z)
+ self.gui.pzPlot.insertPoles(self.p)
+ self.gui.mpzPlot.insertZeros(self.z)
+ self.gui.mpzPlot.insertPoles(self.p)
+ self.iir_plot_all(self.z,self.p,self.k)
+ self.update_fcoeff()
+ self.gui.nTapsEdit.setText("-")
+ self.params = iirparams
+ #return api_object if callback is enabled
if self.callback:
retobj = ApiObject()
retobj.update_all("iir", self.params, (self.b, self.a), 1)
@@ -1041,20 +1048,20 @@ class gr_plot_filter(QtGui.QMainWindow):
self.b,self.a = signal.zpk2tf(z,p,k)
w,h = signal.freqz(self.b,self.a)
self.fftdB = 20 * scipy.log10 (abs(h))
- self.freq = w/max(w)
+ self.freq = w / max(w)
self.fftDeg = scipy.unwrap(scipy.arctan2(scipy.imag(h),scipy.real(h)))
self.groupDelay = -scipy.diff(self.fftDeg)
- self.phaseDelay = -self.fftDeg[1:]/self.freq[1:]
+ self.phaseDelay = -self.fftDeg[1:] / self.freq[1:]
if self.gridview:
- self.set_mfmagresponse()
- self.set_mtimpulse()
+ self.set_mfmagresponse()
+ self.set_mtimpulse()
else:
- self.update_freq_curves()
- self.update_phase_curves()
- self.update_group_curves()
- self.update_pdelay_curves()
- self.update_step_curves()
- self.update_imp_curves()
+ self.update_freq_curves()
+ self.update_phase_curves()
+ self.update_group_curves()
+ self.update_pdelay_curves()
+ self.update_step_curves()
+ self.update_imp_curves()
def nfft_edit_changed(self, nfft):
@@ -1074,9 +1081,9 @@ class gr_plot_filter(QtGui.QMainWindow):
# self.update_group_curves()
def get_fft(self, fs, taps, Npts):
- Ts = 1.0/fs
+ Ts = 1.0 / fs
fftpts = fftpack.fft(taps, Npts)
- self.freq = scipy.arange(0, fs, 1.0/(Npts*Ts))
+ self.freq = scipy.arange(0, fs, 1.0 / (Npts*Ts))
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
self.fftdB = 20.0*scipy.log10(abs(fftpts))
@@ -1086,7 +1093,7 @@ class gr_plot_filter(QtGui.QMainWindow):
self.fftDeg = scipy.unwrap(scipy.angle(fftpts))
self.groupDelay = -scipy.diff(self.fftDeg)
- self.phaseDelay = -self.fftDeg[1:]/self.freq[1:]
+ self.phaseDelay = -self.fftDeg[1:] / self.freq[1:]
def update_time_curves(self):
ntaps = len(self.taps)
@@ -1119,7 +1126,7 @@ class gr_plot_filter(QtGui.QMainWindow):
self.gui.mtimePlot.enableAxis(Qwt.QwtPlot.yRight,False)
self.gui.mtimePlot.setAxisScale(self.gui.mtimePlot.yLeft,
ymin, ymax)
- # Set the zoomer base to unzoom to the new axis
+ # Set the zoomer base to unzoom to the new axis
self.timeZoomer.setZoomBase()
self.mtimeZoomer.setZoomBase()
@@ -1148,9 +1155,9 @@ class gr_plot_filter(QtGui.QMainWindow):
# Reset the x-axis to the new time scale
self.gui.stepresPlot.setAxisScale(self.gui.stepresPlot.xBottom,
- 0, ntaps)
+ 0, ntaps)
self.gui.stepresPlot.setAxisScale(self.gui.stepresPlot.yLeft,
- symin, symax)
+ symin, symax)
if self.mtoverlay:
self.gui.mtimePlot.setAxisScale(self.steprescurve.yAxis(),
symin, symax)
@@ -1191,9 +1198,9 @@ class gr_plot_filter(QtGui.QMainWindow):
# Reset the x-axis to the new time scale
self.gui.impresPlot.setAxisScale(self.gui.impresPlot.xBottom,
- 0, ntaps)
+ 0, ntaps)
self.gui.impresPlot.setAxisScale(self.gui.impresPlot.yLeft,
- iymin, iymax)
+ iymin, iymax)
if self.mtoverlay:
self.gui.mtimePlot.setAxisScale(self.imprescurve.yAxis(),
@@ -1228,16 +1235,16 @@ class gr_plot_filter(QtGui.QMainWindow):
ymax = self.fftdB.max()
if(ymax < 0):
ymax = 0.8 * self.fftdB.max()
- ymin = 1.1 * self.fftdB.min()
+ ymin = 1.1 * self.fftdB.min()
else:
- xmax = self.freq[npts/2]
- ymax = 1.5 * max(self.fftdB[0:npts/2])
- ymin = 1.1 * min(self.fftdB[0:npts/2])
- xmin = self.freq[0]
- self.gui.freqPlot.setAxisScale(self.gui.freqPlot.xBottom,
- xmin, xmax)
- self.gui.freqPlot.setAxisScale(self.gui.freqPlot.yLeft,
- ymin, ymax)
+ xmax = self.freq[npts / 2]
+ ymax = 1.5 * max(self.fftdB[0:npts / 2])
+ ymin = 1.1 * min(self.fftdB[0:npts / 2])
+ xmin = self.freq[0]
+ self.gui.freqPlot.setAxisScale(self.gui.freqPlot.xBottom,
+ xmin, xmax)
+ self.gui.freqPlot.setAxisScale(self.gui.freqPlot.yLeft,
+ ymin, ymax)
if self.mfoverlay:
self.gui.mfreqPlot.setAxisScale(self.gui.mfreqPlot.xBottom,
@@ -1253,11 +1260,11 @@ class gr_plot_filter(QtGui.QMainWindow):
xmin, xmax)
self.gui.mfreqPlot.setAxisScale(self.gui.mfreqPlot.yLeft,
ymin, ymax)
- #Set Axis title
+ #Set Axis title
self.gui.mfreqPlot.setAxisTitle(self.freqcurve.yAxis(),
- fytitle)
+ fytitle)
self.gui.mfreqPlot.setAxisTitle(self.freqcurve.xAxis(),
- fxtitle)
+ fxtitle)
# Set the zoomer base to unzoom to the new axis
self.freqZoomer.setZoomBase()
self.mfreqZoomer.setZoomBase()
@@ -1279,16 +1286,16 @@ class gr_plot_filter(QtGui.QMainWindow):
ymax = self.fftDeg.max()
if(ymax < 0):
ymax = 0.8 * self.fftDeg.max()
- ymin = 1.1 * self.fftDeg.min()
+ ymin = 1.1 * self.fftDeg.min()
else:
- ymax = 1.5 * max(self.fftDeg[0:npts/2])
- ymin = 1.1 * min(self.fftDeg[0:npts/2])
- xmax = self.freq[npts/2]
- xmin = self.freq[0]
- self.gui.phasePlot.setAxisScale(self.gui.phasePlot.xBottom,
- xmin, xmax)
- self.gui.phasePlot.setAxisScale(self.gui.phasePlot.yLeft,
- ymin, ymax)
+ ymax = 1.5 * max(self.fftDeg[0:npts / 2])
+ ymin = 1.1 * min(self.fftDeg[0:npts / 2])
+ xmax = self.freq[npts / 2]
+ xmin = self.freq[0]
+ self.gui.phasePlot.setAxisScale(self.gui.phasePlot.xBottom,
+ xmin, xmax)
+ self.gui.phasePlot.setAxisScale(self.gui.phasePlot.yLeft,
+ ymin, ymax)
if self.mfoverlay:
self.gui.mfreqPlot.setAxisScale(self.gui.mfreqPlot.xBottom,
@@ -1307,7 +1314,7 @@ class gr_plot_filter(QtGui.QMainWindow):
#Set Axis title
self.gui.mfreqPlot.setAxisTitle(self.phasecurve.yAxis(),
- pytitle)
+ pytitle)
# Set the zoomer base to unzoom to the new axis
self.phaseZoomer.setZoomBase()
@@ -1330,16 +1337,16 @@ class gr_plot_filter(QtGui.QMainWindow):
ymax = self.groupDelay.max()
if(ymax < 0):
ymax = 0.8 * self.groupDelay.max()
- ymin = 1.1 * self.groupDelay.min()
+ ymin = 1.1 * self.groupDelay.min()
else:
- ymax = 1.5 * max(self.groupDelay[0:npts/2])
- ymin = 1.1 * min(self.groupDelay[0:npts/2])
- xmax = self.freq[npts/2]
- xmin = self.freq[0]
- self.gui.groupPlot.setAxisScale(self.gui.groupPlot.xBottom,
- xmin, xmax)
- self.gui.groupPlot.setAxisScale(self.gui.groupPlot.yLeft,
- ymin, ymax)
+ ymax = 1.5 * max(self.groupDelay[0:npts / 2])
+ ymin = 1.1 * min(self.groupDelay[0:npts / 2])
+ xmax = self.freq[npts / 2]
+ xmin = self.freq[0]
+ self.gui.groupPlot.setAxisScale(self.gui.groupPlot.xBottom,
+ xmin, xmax)
+ self.gui.groupPlot.setAxisScale(self.gui.groupPlot.yLeft,
+ ymin, ymax)
if self.mfoverlay:
self.gui.mfreqPlot.setAxisScale(self.gui.mfreqPlot.xBottom,
@@ -1358,7 +1365,7 @@ class gr_plot_filter(QtGui.QMainWindow):
#Set Axis title
self.gui.mfreqPlot.setAxisTitle(self.groupcurve.yAxis(),
- gytitle)
+ gytitle)
# Set the zoomer base to unzoom to the new axis
self.groupZoomer.setZoomBase()
self.mfreqZoomer.setZoomBase()
@@ -1379,16 +1386,16 @@ class gr_plot_filter(QtGui.QMainWindow):
ymax = self.phaseDelay.max()
if(ymax < 0):
ymax = 0.8 * self.phaseDelay.max()
- ymin = 1.1 * self.phaseDelay.min()
+ ymin = 1.1 * self.phaseDelay.min()
else:
ymax = 1.3 * max(self.phaseDelay[0:npts])
ymin = 0.8 * min(self.phaseDelay[0:npts])
- xmax = self.freq[npts/2]
- xmin = self.freq[0]
- self.gui.pdelayPlot.setAxisScale(self.gui.pdelayPlot.xBottom,
- xmin, xmax)
- self.gui.pdelayPlot.setAxisScale(self.gui.pdelayPlot.yLeft,
- ymin, ymax)
+ xmax = self.freq[npts / 2]
+ xmin = self.freq[0]
+ self.gui.pdelayPlot.setAxisScale(self.gui.pdelayPlot.xBottom,
+ xmin, xmax)
+ self.gui.pdelayPlot.setAxisScale(self.gui.pdelayPlot.yLeft,
+ ymin, ymax)
if self.mfoverlay:
self.gui.mfreqPlot.setAxisScale(self.gui.mfreqPlot.xBottom,
@@ -1404,9 +1411,9 @@ class gr_plot_filter(QtGui.QMainWindow):
xmin, xmax)
self.gui.mfreqPlot.setAxisScale(self.gui.mfreqPlot.yLeft,
ymin, ymax)
- #Set Axis title
+ #Set Axis title
self.gui.mfreqPlot.setAxisTitle(self.pdelaycurve.yAxis(),
- phytitle)
+ phytitle)
# Set the zoomer base to unzoom to the new axis
self.pdelayZoomer.setZoomBase()
@@ -1448,8 +1455,8 @@ class gr_plot_filter(QtGui.QMainWindow):
#Detach and delete all plots if unchecked
for c in self.bufferplots:
c.detach()
- self.replot_all()
- self.bufferplots = []
+ self.replot_all()
+ self.bufferplots = []
else:
self.bufferplots = []
#Iterate through tabgroup children and copy curves
@@ -1472,7 +1479,7 @@ class gr_plot_filter(QtGui.QMainWindow):
dup.setSymbol(dsym)
dup.setRenderHint(Qwt.QwtPlotItem.RenderAntialiased)
dup.setData([c.x(i) for i in range(c.dataSize())],
- [c.y(i) for i in range(c.dataSize())])
+ [c.y(i) for i in range(c.dataSize())])
self.bufferplots.append(dup)
self.bufferplots[-1].attach(item)
@@ -1565,7 +1572,7 @@ class gr_plot_filter(QtGui.QMainWindow):
self.icurve.attach(self.gui.mtimePlot)
self.update_freq_curves()
self.update_time_curves()
- self.set_drawideal()
+ self.set_drawideal()
def set_plotselect(self):
if (self.gui.actionPlot_select.isChecked() == 0 ):
@@ -1605,8 +1612,8 @@ class gr_plot_filter(QtGui.QMainWindow):
self.detach_allgrid()
self.freqcurve.attach(self.gui.mfreqPlot)
self.detach_firstattached(self.gui.mfreqPlot)
- self.update_freq_curves()
- self.idbanditems.detach_allidealcurves(self.gui.mfreqPlot)
+ self.update_freq_curves()
+ self.idbanditems.detach_allidealcurves(self.gui.mfreqPlot)
else:
self.gui.mfreqPlot.detachItems(Qwt.QwtPlotItem.Rtti_PlotItem, False)
self.set_actgrid()
@@ -1623,7 +1630,7 @@ class gr_plot_filter(QtGui.QMainWindow):
self.phasecurve.attach(self.gui.mfreqPlot)
self.detach_firstattached(self.gui.mfreqPlot)
self.update_phase_curves()
- self.idbanditems.detach_allidealcurves(self.gui.mfreqPlot)
+ self.idbanditems.detach_allidealcurves(self.gui.mfreqPlot)
else:
self.gui.mfreqPlot.detachItems(Qwt.QwtPlotItem.Rtti_PlotItem, False)
self.set_actgrid()
@@ -1639,7 +1646,7 @@ class gr_plot_filter(QtGui.QMainWindow):
self.groupcurve.attach(self.gui.mfreqPlot)
self.detach_firstattached(self.gui.mfreqPlot)
self.update_group_curves()
- self.idbanditems.detach_allidealcurves(self.gui.mfreqPlot)
+ self.idbanditems.detach_allidealcurves(self.gui.mfreqPlot)
else:
self.gui.mfreqPlot.detachItems(Qwt.QwtPlotItem.Rtti_PlotItem, False)
self.set_actgrid()
@@ -1655,7 +1662,7 @@ class gr_plot_filter(QtGui.QMainWindow):
self.pdelaycurve.attach(self.gui.mfreqPlot)
self.detach_firstattached(self.gui.mfreqPlot)
self.update_pdelay_curves()
- self.idbanditems.detach_allidealcurves(self.gui.mfreqPlot)
+ self.idbanditems.detach_allidealcurves(self.gui.mfreqPlot)
else:
self.gui.mfreqPlot.detachItems(Qwt.QwtPlotItem.Rtti_PlotItem, False)
self.set_actgrid()
@@ -1688,7 +1695,7 @@ class gr_plot_filter(QtGui.QMainWindow):
items[1].setYAxis(Qwt.QwtPlot.yRight)
if plot is self.gui.mfreqPlot:
items[1].setPen(QtGui.QPen(QtCore.Qt.red, 1, QtCore.Qt.SolidLine))
- self.set_actgrid()
+ self.set_actgrid()
def update_fft(self, taps, params):
@@ -1894,7 +1901,7 @@ class gr_plot_filter(QtGui.QMainWindow):
self.scene.addItem(item)
def remove_bandview(self):
- for item in self.scene.items():
+ for item in list(self.scene.items()):
self.scene.removeItem(item)
def set_fatten(self,atten):
@@ -1918,9 +1925,10 @@ class gr_plot_filter(QtGui.QMainWindow):
if ftype == "Complex Band Pass":
boxatten,r = self.gui.bpfStopBandAttenEdit.text().toDouble()
self.gui.bpfStopBandAttenEdit.setText(Qt.QString(str(atten+boxatten)))
-#self.design()
+ #self.design()
- def set_curvetaps(self,(zr,pl)):
+ def set_curvetaps(self, zeros_poles):
+ zr, pl = zeros_poles
if self.iir:
self.z=zr
self.p=pl
@@ -1934,7 +1942,7 @@ class gr_plot_filter(QtGui.QMainWindow):
self.callback(retobj)
else:
hz = poly1d(zr,r=1)
- #print hz.c
+ #print(hz.c)
self.taps=hz.c*self.taps[0]
self.draw_plots(self.taps,self.params)
self.update_fcoeff()
@@ -1949,7 +1957,8 @@ class gr_plot_filter(QtGui.QMainWindow):
retobj.update_all("fir", self.params, self.taps, 1)
self.callback(retobj)
- def set_mcurvetaps(self,(zr,pl)):
+ def set_mcurvetaps(self, zeros_poles):
+ zr, pl = zeros_poles
if self.iir:
self.z=zr
self.p=pl
@@ -1963,7 +1972,7 @@ class gr_plot_filter(QtGui.QMainWindow):
self.callback(retobj)
else:
hz = poly1d(zr,r=1)
- #print hz.c
+ #print(hz.c)
self.taps=hz.c*self.taps[0]
if self.gridview:
self.update_fft(self.taps, self.params)
@@ -1971,8 +1980,8 @@ class gr_plot_filter(QtGui.QMainWindow):
self.set_mttaps()
else:
self.draw_plots(self.taps,self.params)
- self.update_fcoeff()
- #update the pzplot in other view
+ self.update_fcoeff()
+ #update the pzplot in other view
zeros=self.get_zeros()
poles=self.get_poles()
self.gui.pzPlot.insertZeros(zeros)
@@ -1983,17 +1992,19 @@ class gr_plot_filter(QtGui.QMainWindow):
retobj.update_all("fir", self.params, self.taps, 1)
self.callback(retobj)
- def set_statusbar(self,(x,y)):
+ def set_statusbar(self, point):
+ x, y = point
if x == None:
- self.gui.pzstatusBar.showMessage("")
+ self.gui.pzstatusBar.showMessage("")
else:
- self.gui.pzstatusBar.showMessage("X: "+str(x)+" Y: "+str(y))
+ self.gui.pzstatusBar.showMessage("X: "+str(x)+" Y: "+str(y))
- def set_mstatusbar(self,(x,y)):
+ def set_mstatusbar(self, point):
+ x, y = point
if x == None:
- self.gui.mpzstatusBar.showMessage("")
+ self.gui.mpzstatusBar.showMessage("")
else:
- self.gui.mpzstatusBar.showMessage("X: "+str(x)+" Y: "+str(y))
+ self.gui.mpzstatusBar.showMessage("X: "+str(x)+" Y: "+str(y))
def get_zeros(self):
hz = poly1d(self.taps,r=0)
@@ -2053,7 +2064,7 @@ class gr_plot_filter(QtGui.QMainWindow):
else:
csvhandle.writerow(["restype","fir"])
- for k in self.params.keys():
+ for k in list(self.params.keys()):
csvhandle.writerow([k, self.params[k]])
if self.iir:
csvhandle.writerow(["b",] + self.b.tolist())
@@ -2103,7 +2114,9 @@ class gr_plot_filter(QtGui.QMainWindow):
params[row[0]] = float(row[1])
except ValueError:
params[row[0]] = row[1]
+
handle.close()
+
if restype == "fir":
self.iir = False
self.gui.fselectComboBox.setCurrentIndex(0)
@@ -2195,7 +2208,7 @@ class gr_plot_filter(QtGui.QMainWindow):
self.params = params
#Set GUI for IIR type
- iirft = { "ellip" : 0,
+ iirft = { "ellip" : 0,
"butter" : 1,
"cheby1" : 2,
"cheby2" : 3,
@@ -2204,40 +2217,40 @@ class gr_plot_filter(QtGui.QMainWindow):
paramtype = { "analog" : 1,
"digital" : 0 }
bandpos = {
- "lpf" : 0,
- "bpf" : 1,
- "bnf" : 2,
- "hpf" : 3}
+ "lpf" : 0,
+ "bpf" : 1,
+ "bnf" : 2,
+ "hpf" : 3}
iirboxes = {"lpf" : [self.gui.iirendofLpfPassBandEdit,
- self.gui.iirstartofLpfStopBandEdit,
- self.gui.iirLpfPassBandAttenEdit,
- self.gui.iirLpfStopBandRippleEdit],
+ self.gui.iirstartofLpfStopBandEdit,
+ self.gui.iirLpfPassBandAttenEdit,
+ self.gui.iirLpfStopBandRippleEdit],
"hpf" : [self.gui.iirstartofHpfPassBandEdit,
- self.gui.iirendofHpfStopBandEdit,
- self.gui.iirHpfPassBandAttenEdit,
- self.gui.iirHpfStopBandRippleEdit],
+ self.gui.iirendofHpfStopBandEdit,
+ self.gui.iirHpfPassBandAttenEdit,
+ self.gui.iirHpfStopBandRippleEdit],
"bpf" : [self.gui.iirstartofBpfPassBandEdit,
- self.gui.iirendofBpfPassBandEdit,
- self.gui.iirendofBpfStopBandEdit1,
- self.gui.iirstartofBpfStopBandEdit2,
- self.gui.iirBpfPassBandAttenEdit,
- self.gui.iirBpfStopBandRippleEdit],
+ self.gui.iirendofBpfPassBandEdit,
+ self.gui.iirendofBpfStopBandEdit1,
+ self.gui.iirstartofBpfStopBandEdit2,
+ self.gui.iirBpfPassBandAttenEdit,
+ self.gui.iirBpfStopBandRippleEdit],
"bnf" : [self.gui.iirendofBsfPassBandEdit1,
- self.gui.iirstartofBsfPassBandEdit2,
- self.gui.iirstartofBsfStopBandEdit,
- self.gui.iirendofBsfStopBandEdit,
- self.gui.iirBsfPassBandAttenEdit,
- self.gui.iirBsfStopBandRippleEdit] }
+ self.gui.iirstartofBsfPassBandEdit2,
+ self.gui.iirstartofBsfStopBandEdit,
+ self.gui.iirendofBsfStopBandEdit,
+ self.gui.iirBsfPassBandAttenEdit,
+ self.gui.iirBsfStopBandRippleEdit] }
self.gui.fselectComboBox.setCurrentIndex(1)
self.gui.iirfilterTypeComboBox.setCurrentIndex(iirft[params["filttype"]])
self.gui.iirfilterBandComboBox.setCurrentIndex(bandpos[params["bandtype"]])
if params["filttype"] == "bessel":
- critfreq = map(float, params["critfreq"][1:-1].split(','))
+ critfreq = list(map(float, params["critfreq"][1:-1].split(',')))
self.gui.besselordEdit.setText(Qt.QString("%1").arg(params["filtord"]))
self.gui.iirbesselcritEdit1.setText(Qt.QString("%1").arg(critfreq[0]))
self.gui.iirbesselcritEdit2.setText(Qt.QString("%1").arg(critfreq[1]))
@@ -2246,8 +2259,8 @@ class gr_plot_filter(QtGui.QMainWindow):
if len(iirboxes[params["bandtype"]]) == 4:
sdata = [params["pbedge"], params["sbedge"], params["gpass"], params["gstop"]]
else:
- pbedge = map(float, params["pbedge"][1:-1].split(','))
- sbedge = map(float, params["sbedge"][1:-1].split(','))
+ pbedge = list(map(float, params["pbedge"][1:-1].split(',')))
+ sbedge = list(map(float, params["sbedge"][1:-1].split(',')))
sdata = [pbedge[0], pbedge[1], sbedge[0],
sbedge[1], params["gpass"], params["gstop"]]
@@ -2260,13 +2273,13 @@ class gr_plot_filter(QtGui.QMainWindow):
self.taps = scipy.array(taps)
if self.params:
self.get_fft(self.params["fs"], self.taps, self.nfftpts)
- self.update_time_curves()
- self.update_freq_curves()
- self.update_phase_curves()
- self.update_group_curves()
- self.update_pdelay_curves()
- self.update_step_curves()
- self.update_imp_curves()
+ self.update_time_curves()
+ self.update_freq_curves()
+ self.update_phase_curves()
+ self.update_group_curves()
+ self.update_pdelay_curves()
+ self.update_step_curves()
+ self.update_imp_curves()
self.gui.nTapsEdit.setText(Qt.QString("%1").arg(self.taps.size))
@@ -2309,4 +2322,3 @@ def main(args):
if __name__ == '__main__':
main(sys.argv)
-
diff --git a/gr-filter/python/filter/design/fir_design.py b/gr-filter/python/filter/design/fir_design.py
index e27b06578..254595525 100644
--- a/gr-filter/python/filter/design/fir_design.py
+++ b/gr-filter/python/filter/design/fir_design.py
@@ -1,3 +1,5 @@
+from __future__ import division
+from __future__ import unicode_literals
# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
@@ -38,7 +40,7 @@ def design_win_lpf(fs, gain, wintype, mainwin):
try:
taps = filter.firdes.low_pass_2(gain, fs, pb, tb,
atten, wintype)
- except RuntimeError, e:
+ except RuntimeError as e:
reply = QtGui.QMessageBox.information(mainwin, "Runtime Error",
e.args[0], "&Ok")
return ([], [], ret)
@@ -65,7 +67,7 @@ def design_win_bpf(fs, gain, wintype, mainwin):
try:
taps = filter.firdes.band_pass_2(gain, fs, pb1, pb2, tb,
atten, wintype)
- except RuntimeError, e:
+ except RuntimeError as e:
reply = QtGui.QMessageBox.information(mainwin, "Runtime Error",
e.args[0], "&Ok")
return ([], [], ret)
@@ -92,7 +94,7 @@ def design_win_cbpf(fs, gain, wintype, mainwin):
try:
taps = filter.firdes.complex_band_pass_2(gain, fs, pb1, pb2, tb,
atten, wintype)
- except RuntimeError, e:
+ except RuntimeError as e:
reply = QtGui.QMessageBox.information(mainwin, "Runtime Error",
e.args[0], "&Ok")
return ([], [], ret)
@@ -119,7 +121,7 @@ def design_win_bnf(fs, gain, wintype, mainwin):
try:
taps = filter.firdes.band_reject_2(gain, fs, pb1, pb2, tb,
atten, wintype)
- except RuntimeError, e:
+ except RuntimeError as e:
reply = QtGui.QMessageBox.information(mainwin, "Runtime Error",
e.args[0], "&Ok")
return ([], [], ret)
@@ -145,7 +147,7 @@ def design_win_hpf(fs, gain, wintype, mainwin):
try:
taps = filter.firdes.high_pass_2(gain, fs, pb, tb,
atten, wintype)
- except RuntimeError, e:
+ except RuntimeError as e:
reply = QtGui.QMessageBox.information(mainwin, "Runtime Error",
e.args[0], "&Ok")
else:
@@ -195,7 +197,7 @@ def design_win_rrc(fs, gain, wintype, mainwin):
try:
taps = filter.firdes.root_raised_cosine(gain, fs, sr,
alpha, ntaps)
- except RuntimeError, e:
+ except RuntimeError as e:
reply = QtGui.QMessageBox.information(mainwin, "Runtime Error",
e.args[0], "&Ok")
else:
@@ -220,7 +222,7 @@ def design_win_gaus(fs, gain, wintype, mainwin):
try:
taps = filter.firdes.gaussian(gain, spb, bt, ntaps)
- except RuntimeError, e:
+ except RuntimeError as e:
reply = QtGui.QMessageBox.information(mainwin, "Runtime Error",
e.args[0], "&Ok")
else:
@@ -247,7 +249,7 @@ def design_opt_lpf(fs, gain, mainwin):
try:
taps = filter.optfir.low_pass(gain, fs, pb, sb,
ripple, atten)
- except RuntimeError, e:
+ except RuntimeError as e:
reply = QtGui.QMessageBox.information(mainwin, "Filter did not converge",
e.args[0], "&Ok")
return ([],[],False)
@@ -278,7 +280,7 @@ def design_opt_bpf(fs, gain, mainwin):
try:
taps = filter.optfir.band_pass(gain, fs, sb1, pb1, pb2, sb2,
ripple, atten)
- except RuntimeError, e:
+ except RuntimeError as e:
reply = QtGui.QMessageBox.information(mainwin, "Filter did not converge",
e.args[0], "&Ok")
return ([],[],False)
@@ -311,7 +313,7 @@ def design_opt_cbpf(fs, gain, mainwin):
try:
taps = filter.optfir.complex_band_pass(gain, fs, sb1, pb1, pb2, sb2,
ripple, atten)
- except RuntimeError, e:
+ except RuntimeError as e:
reply = QtGui.QMessageBox.information(mainwin, "Filter did not converge",
e.args[0], "&Ok")
return ([],[],False)
@@ -343,7 +345,7 @@ def design_opt_bnf(fs, gain, mainwin):
try:
taps = filter.optfir.band_reject(gain, fs, pb1, sb1, sb2, pb2,
ripple, atten)
- except RuntimeError, e:
+ except RuntimeError as e:
reply = QtGui.QMessageBox.information(mainwin, "Filter did not converge",
e.args[0], "&Ok")
return ([],[],False)
@@ -369,10 +371,10 @@ def design_opt_hb(fs, gain, mainwin):
if(ret):
try:
- bands = [0,.25 - (trwidth/fs), .25 + (trwidth/fs), 0.5]
+ bands = [0,.25 - (trwidth / fs), .25 + (trwidth / fs), 0.5]
taps = scipy.signal.remez(int(filtord)+1, bands, [1,0], [1,1])
taps[abs(taps) <= 1e-6] = 0.
- except RuntimeError, e:
+ except RuntimeError as e:
reply = QtGui.QMessageBox.information(mainwin, "Filter Design Error",
e.args[0], "&Ok")
return ([],[],False)
@@ -398,7 +400,7 @@ def design_opt_hpf(fs, gain, mainwin):
try:
taps = filter.optfir.high_pass(gain, fs, sb, pb,
atten, ripple)
- except RuntimeError, e:
+ except RuntimeError as e:
reply = QtGui.QMessageBox.information(mainwin, "Filter did not converge",
e.args[0], "&Ok")
return ([],[],False)
diff --git a/gr-filter/python/filter/filterbank.py b/gr-filter/python/filter/filterbank.py
index 4e1456cfb..9d8d49e71 100644
--- a/gr-filter/python/filter/filterbank.py
+++ b/gr-filter/python/filter/filterbank.py
@@ -19,11 +19,13 @@
# Boston, MA 02110-1301, USA.
#
-import sys
+from __future__ import print_function
+from __future__ import unicode_literals
+
from gnuradio import gr
from gnuradio import fft
from gnuradio import blocks
-from filter_swig import fft_filter_ccc
+from .filter_swig import fft_filter_ccc
def _generate_synthesis_taps(mpoints):
return [] # FIXME
@@ -32,7 +34,7 @@ def _generate_synthesis_taps(mpoints):
def _split_taps(taps, mpoints):
assert (len(taps) % mpoints) == 0
result = [list() for x in range(mpoints)]
- for i in xrange(len(taps)):
+ for i in range(len(taps)):
(result[i % mpoints]).append(taps[i])
return [tuple(x) for x in result]
@@ -119,7 +121,7 @@ class synthesis_filterbank(gr.hier_block2):
self.connect((self.v2ss, i), f)
self.connect(f, (self.ss2s, i))
- self.connect(self.ss2s, self)
+ self.connect(self.ss2s, self)
class analysis_filterbank(gr.hier_block2):
"""
@@ -154,7 +156,7 @@ class analysis_filterbank(gr.hier_block2):
# split in mpoints separate set of taps
sub_taps = _split_taps(taps, mpoints)
- # print >> sys.stderr, "mpoints =", mpoints, "len(sub_taps) =", len(sub_taps)
+ # print(>> sys.stderr, "mpoints =", mpoints, "len(sub_taps) =", len(sub_taps))
self.s2ss = blocks.stream_to_streams(item_size, mpoints)
# filters here
diff --git a/gr-filter/python/filter/freq_xlating_fft_filter.py b/gr-filter/python/filter/freq_xlating_fft_filter.py
index f6ebe0517..097a4c449 100644
--- a/gr-filter/python/filter/freq_xlating_fft_filter.py
+++ b/gr-filter/python/filter/freq_xlating_fft_filter.py
@@ -19,13 +19,15 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+from __future__ import unicode_literals
import math
import cmath
from gnuradio import gr
from gnuradio.blocks import rotator_cc
-from filter_swig import fft_filter_ccc
+from .filter_swig import fft_filter_ccc
__all__ = [ 'freq_xlating_fft_filter_ccc' ]
diff --git a/gr-filter/python/filter/gui/bandgraphicsview.py b/gr-filter/python/filter/gui/bandgraphicsview.py
index 9e609fe2a..3a9cab2de 100644
--- a/gr-filter/python/filter/gui/bandgraphicsview.py
+++ b/gr-filter/python/filter/gui/bandgraphicsview.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
diff --git a/gr-filter/python/filter/gui/banditems.py b/gr-filter/python/filter/gui/banditems.py
index 5071fe7b0..fe87bccc4 100644
--- a/gr-filter/python/filter/gui/banditems.py
+++ b/gr-filter/python/filter/gui/banditems.py
@@ -18,11 +18,14 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
+
try:
from PyQt4 import Qt, QtCore, QtGui
except ImportError:
- print "Please install PyQt4 to run this script (http://www.riverbankcomputing.co.uk/software/pyqt/download)"
- raise SystemExit, 1
+ print("Please install PyQt4 to run this script (http://www.riverbankcomputing.co.uk/software/pyqt/download)")
+ raise SystemExit(1)
#Movable solid line for filter ideal-band diagram
#Enable split to cut the line into two (for bpf)
diff --git a/gr-filter/python/filter/gui/icons_rc.py b/gr-filter/python/filter/gui/icons_rc.py
index 0b20ecb61..e4a455874 100644
--- a/gr-filter/python/filter/gui/icons_rc.py
+++ b/gr-filter/python/filter/gui/icons_rc.py
@@ -7,6 +7,7 @@
#
# WARNING! All changes made in this file will be lost!
+from __future__ import unicode_literals
from PyQt4 import QtCore
qt_resource_data = "\
diff --git a/gr-filter/python/filter/gui/idealbanditems.py b/gr-filter/python/filter/gui/idealbanditems.py
index ce556577e..67d222325 100644
--- a/gr-filter/python/filter/gui/idealbanditems.py
+++ b/gr-filter/python/filter/gui/idealbanditems.py
@@ -18,11 +18,15 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
from PyQt4 import QtGui, QtCore, Qt
import PyQt4.Qwt5 as Qwt
import scipy
-class IdealBandItems():
+class IdealBandItems(object):
def __init__(self):
self.idealbandhcurves= [ Qwt.QwtPlotCurve() for i in range(4) ]
self.idealbandvcurves= [ Qwt.QwtPlotCurve() for i in range(4) ]
@@ -47,27 +51,27 @@ class IdealBandItems():
x=[self.params["pbend"]]*2
y=[20.0*scipy.log10(self.params["gain"]),
- plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
+ plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
self.idealbandvcurves[0].setData(x, y)
- x=[self.params["sbstart"], self.params["fs"]/2.0]
+ x=[self.params["sbstart"], self.params["fs"] / 2.0]
y=[-self.params["atten"]]*2
self.idealbandhcurves[1].setData(x, y)
x=[self.params["sbstart"]]*2
y=[-self.params["atten"],
- plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
+ plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
self.idealbandvcurves[1].setData(x, y)
elif ftype == "High Pass":
self.detach_unwantedcurves(plot)
- x=[self.params["pbstart"],self.params["fs"]/2.0]
+ x=[self.params["pbstart"],self.params["fs"] / 2.0]
y=[20.0*scipy.log10(self.params["gain"])]*2
self.idealbandhcurves[0].setData(x, y)
x=[self.params["pbstart"]]*2
y=[20.0*scipy.log10(self.params["gain"]),
- plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
+ plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
self.idealbandvcurves[0].setData(x, y)
x=[0,self.params["sbend"]]
@@ -76,7 +80,7 @@ class IdealBandItems():
x=[self.params["sbend"]]*2
y=[-self.params["atten"],
- plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
+ plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
self.idealbandvcurves[1].setData(x, y)
elif ftype == "Band Notch":
@@ -86,12 +90,12 @@ class IdealBandItems():
x=[self.params["sbstart"]]*2
y=[-self.params["atten"],
- plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
+ plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
self.idealbandvcurves[0].setData(x, y)
x=[self.params["sbend"]]*2
y=[-self.params["atten"],
- plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
+ plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
self.idealbandvcurves[1].setData(x, y)
x=[0,self.params["sbstart"]-self.params["tb"]]
@@ -100,16 +104,16 @@ class IdealBandItems():
x=[self.params["sbstart"]-self.params["tb"]]*2
y=[20.0*scipy.log10(self.params["gain"]),
- plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
+ plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
self.idealbandvcurves[2].setData(x, y)
- x=[self.params["sbend"]+self.params["tb"],self.params["fs"]/2.0]
+ x=[self.params["sbend"]+self.params["tb"],self.params["fs"] / 2.0]
y=[20.0*scipy.log10(self.params["gain"])]*2
self.idealbandhcurves[2].setData(x, y)
x=[self.params["sbend"]+self.params["tb"]]*2
y=[20.0*scipy.log10(self.params["gain"]),
- plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
+ plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
self.idealbandvcurves[3].setData(x, y)
elif ftype == "Band Pass":
@@ -119,12 +123,12 @@ class IdealBandItems():
x=[self.params["pbstart"]]*2
y=[20.0*scipy.log10(self.params["gain"]),
- plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
+ plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
self.idealbandvcurves[0].setData(x, y)
x=[self.params["pbend"]]*2
y=[20.0*scipy.log10(self.params["gain"]),
- plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
+ plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
self.idealbandvcurves[1].setData(x, y)
x=[0,self.params["pbstart"]-self.params["tb"]]
@@ -133,16 +137,16 @@ class IdealBandItems():
x=[self.params["pbstart"]-self.params["tb"]]*2
y=[-self.params["atten"],
- plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
+ plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
self.idealbandvcurves[2].setData(x, y)
- x=[self.params["pbend"]+self.params["tb"],self.params["fs"]/2.0]
+ x=[self.params["pbend"]+self.params["tb"],self.params["fs"] / 2.0]
y=[-self.params["atten"]]*2
self.idealbandhcurves[2].setData(x, y)
x=[self.params["pbend"]+self.params["tb"]]*2
y=[-self.params["atten"],
- plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
+ plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
self.idealbandvcurves[3].setData(x, y)
elif ftype == "Complex Band Pass":
@@ -152,12 +156,12 @@ class IdealBandItems():
x=[self.params["pbstart"]]*2
y=[20.0*scipy.log10(self.params["gain"]),
- plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
+ plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
self.idealbandvcurves[0].setData(x, y)
x=[self.params["pbend"]]*2
y=[20.0*scipy.log10(self.params["gain"]),
- plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
+ plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
self.idealbandvcurves[1].setData(x, y)
x=[0,self.params["pbstart"]-self.params["tb"]]
@@ -166,35 +170,38 @@ class IdealBandItems():
x=[self.params["pbstart"]-self.params["tb"]]*2
y=[-self.params["atten"],
- plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
+ plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
self.idealbandvcurves[2].setData(x, y)
- x=[self.params["pbend"]+self.params["tb"],self.params["fs"]/2.0]
+ x=[self.params["pbend"]+self.params["tb"],self.params["fs"] / 2.0]
y=[-self.params["atten"]]*2
self.idealbandhcurves[2].setData(x, y)
x=[self.params["pbend"]+self.params["tb"]]*2
y=[-self.params["atten"],
- plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
+ plot.axisScaleDiv(Qwt.QwtPlot.yLeft).lowerBound()]
self.idealbandvcurves[3].setData(x, y)
else:
self.detach_allidealcurves(plot)
except KeyError:
- print "All parameters not set for ideal band diagram"
+ print("All parameters not set for ideal band diagram")
self.detach_allidealcurves(plot)
def detach_allidealcurves(self, plot):
for c in self.idealbandhcurves:
c.detach()
+
for c in self.idealbandvcurves:
c.detach()
+
plot.replot()
def detach_unwantedcurves(self, plot):
for i in range(2,4):
self.idealbandvcurves[i].detach()
self.idealbandhcurves[i].detach()
+
plot.replot()
def attach_allidealcurves(self, plot):
diff --git a/gr-filter/python/filter/gui/polezero_plot.py b/gr-filter/python/filter/gui/polezero_plot.py
index f9c88947c..aa0f2c984 100644
--- a/gr-filter/python/filter/gui/polezero_plot.py
+++ b/gr-filter/python/filter/gui/polezero_plot.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
diff --git a/gr-filter/python/filter/gui/pyqt_filter_stacked.py b/gr-filter/python/filter/gui/pyqt_filter_stacked.py
index 98836180e..813e5ef2c 100644
--- a/gr-filter/python/filter/gui/pyqt_filter_stacked.py
+++ b/gr-filter/python/filter/gui/pyqt_filter_stacked.py
@@ -7,6 +7,7 @@
#
# WARNING! All changes made in this file will be lost!
+from __future__ import unicode_literals
from PyQt4 import QtCore, QtGui
try:
diff --git a/gr-filter/python/filter/optfir.py b/gr-filter/python/filter/optfir.py
index 998a65238..6d120638b 100644
--- a/gr-filter/python/filter/optfir.py
+++ b/gr-filter/python/filter/optfir.py
@@ -27,8 +27,13 @@ For a great intro to how all this stuff works, see section 6.6 of
and Barrie W. Jervis, Adison-Wesley, 1993. ISBN 0-201-54413-X.
'''
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
+
import math, cmath
-import filter_swig as filter
+from . import filter_swig as filter
# ----------------------------------------------------------------
@@ -102,11 +107,11 @@ def complex_band_pass (gain, Fs, freq_sb1, freq_pb1, freq_pb2, freq_sb2,
nextra_taps: Extra taps to use in the filter (default=2)
"""
center_freq = (freq_pb2 + freq_pb1) / 2.0
- lp_pb = (freq_pb2 - center_freq)/1.0
+ lp_pb = (freq_pb2 - center_freq) / 1.0
lp_sb = freq_sb2 - center_freq
lptaps = low_pass(gain, Fs, lp_pb, lp_sb, passband_ripple_db,
stopband_atten_db, nextra_taps)
- spinner = [cmath.exp(2j*cmath.pi*center_freq/Fs*i) for i in xrange(len(lptaps))]
+ spinner = [cmath.exp(2j*cmath.pi*center_freq/Fs*i) for i in range(len(lptaps))]
taps = [s*t for s,t in zip(spinner, lptaps)]
return taps
@@ -176,11 +181,11 @@ def high_pass (gain, Fs, freq1, freq2, passband_ripple_db, stopband_atten_db,
def stopband_atten_to_dev (atten_db):
"""Convert a stopband attenuation in dB to an absolute value"""
- return 10**(-atten_db/20)
+ return 10**(-atten_db / 20)
def passband_ripple_to_dev (ripple_db):
"""Convert passband ripple spec expressed in dB to an absolute value"""
- return (10**(ripple_db/20)-1)/(10**(ripple_db/20)+1)
+ return (10**(old_div(ripple_db / 20)-1),(10**(ripple_db / 20)+1))
# ----------------------------------------------------------------
@@ -237,10 +242,10 @@ def remezord (fcuts, mags, devs, fsamp = 2):
nbands = nm
if nm != nd:
- raise ValueError, "Length of mags and devs must be equal"
+ raise ValueError("Length of mags and devs must be equal")
if nf != 2 * (nbands - 1):
- raise ValueError, "Length of f must be 2 * len (mags) - 2"
+ raise ValueError("Length of f must be 2 * len (mags) - 2")
for i in range (len (mags)):
if mags[i] != 0: # if not stopband, get relative deviation
@@ -355,4 +360,3 @@ def bporder (freq1, freq2, delta_p, delta_s):
ginf = -14.6 * math.log10 (delta_p / delta_s) - 16.9
n = cinf / df + ginf * df + 1
return n
-
diff --git a/gr-filter/python/filter/pfb.py b/gr-filter/python/filter/pfb.py
index 9f23d1061..ea28dea45 100644
--- a/gr-filter/python/filter/pfb.py
+++ b/gr-filter/python/filter/pfb.py
@@ -20,15 +20,17 @@
# Boston, MA 02110-1301, USA.
#
-import optfir, math
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
-from gnuradio import gr, fft
-import filter_swig as filter
+import math
+
+from gnuradio import gr, fft, blocks
+
+from . import optfir
+from . import filter_swig as filter
-try:
- from gnuradio import blocks
-except ImportError:
- import blocks_swig as blocks
class channelizer_ccf(gr.hier_block2):
'''
@@ -71,7 +73,7 @@ class channelizer_ccf(gr.hier_block2):
self._oversample_rate)
self.connect(self, self.s2ss)
- for i in xrange(self._nchans):
+ for i in range(self._nchans):
self.connect((self.s2ss,i), (self.pfb,i))
self.connect((self.pfb,i), (self,i))
@@ -147,9 +149,9 @@ class decimator_ccf(gr.hier_block2):
'''
def __init__(self, decim, taps=None, channel=0, atten=100,
use_fft_rotators=True, use_fft_filters=True):
- gr.hier_block2.__init__(self, "pfb_decimator_ccf",
- gr.io_signature(1, 1, gr.sizeof_gr_complex),
- gr.io_signature(1, 1, gr.sizeof_gr_complex))
+ gr.hier_block2.__init__(self, "pfb_decimator_ccf",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex),
+ gr.io_signature(1, 1, gr.sizeof_gr_complex))
self._decim = decim
self._channel = channel
@@ -181,7 +183,7 @@ class decimator_ccf(gr.hier_block2):
self.connect(self, self.s2ss)
- for i in xrange(self._decim):
+ for i in range(self._decim):
self.connect((self.s2ss,i), (self.pfb,i))
self.connect(self.pfb, self)
@@ -227,7 +229,7 @@ class arb_resampler_ccf(gr.hier_block2):
if(self._rate < 1):
halfband = 0.5*self._rate
bw = percent*halfband
- tb = (percent/2.0)*halfband
+ tb = (percent / 2.0)*halfband
ripple = 0.1
# As we drop the bw factor, the optfir filter has a harder time converging;
@@ -237,7 +239,7 @@ class arb_resampler_ccf(gr.hier_block2):
else:
halfband = 0.5
bw = percent*halfband
- tb = (percent/2.0)*halfband
+ tb = (percent / 2.0)*halfband
ripple = 0.1
made = False
@@ -255,7 +257,7 @@ class arb_resampler_ccf(gr.hier_block2):
raise RuntimeError("optfir could not generate an appropriate filter.")
self.pfb = filter.pfb_arb_resampler_ccf(self._rate, self._taps, self._size)
- #print "PFB has %d taps\n" % (len(self._taps),)
+ #print("PFB has %d taps\n" % (len(self._taps),))
self.connect(self, self.pfb)
self.connect(self.pfb, self)
@@ -301,7 +303,7 @@ class arb_resampler_fff(gr.hier_block2):
if(self._rate < 1):
halfband = 0.5*self._rate
bw = percent*halfband
- tb = (percent/2.0)*halfband
+ tb = (percent / 2.0)*halfband
ripple = 0.1
# As we drop the bw factor, the optfir filter has a harder time converging;
@@ -311,7 +313,7 @@ class arb_resampler_fff(gr.hier_block2):
else:
halfband = 0.5
bw = percent*halfband
- tb = (percent/2.0)*halfband
+ tb = (percent / 2.0)*halfband
ripple = 0.1
made = False
@@ -420,7 +422,7 @@ class channelizer_hier_ccf(gr.hier_block2):
if n_filterbanks > n_chans:
n_filterbanks = n_chans
if outchans is None:
- outchans = range(n_chans)
+ outchans = list(range(n_chans))
gr.hier_block2.__init__(
self, "pfb_channelizer_hier_ccf",
gr.io_signature(1, 1, gr.sizeof_gr_complex),
@@ -436,7 +438,7 @@ class channelizer_hier_ccf(gr.hier_block2):
self.s2v = blocks.stream_to_vector(gr.sizeof_gr_complex, n_chans)
# Create a mapping to separate out each filterbank (a group of channels to be processed together)
# And a list of sets of taps for each filterbank.
- low_cpp = int(n_chans/n_filterbanks)
+ low_cpp = int(n_chans / n_filterbanks)
extra = n_chans - low_cpp*n_filterbanks
cpps = [low_cpp+1]*extra + [low_cpp]*(n_filterbanks-extra)
splitter_mapping = []
@@ -460,7 +462,7 @@ class channelizer_hier_ccf(gr.hier_block2):
# Add the final FFT to the channelizer.
self.fft = fft.fft_vcc(n_chans, forward=True, window=[1.0]*n_chans)
# Select the desired channels
- if outchans != range(n_chans):
+ if outchans != list(range(n_chans)):
selector_mapping = [[(0, i) for i in outchans]]
self.selector = blocks.vector_map(gr.sizeof_gr_complex, [n_chans], selector_mapping)
# Convert stream of vectors to a normal stream.
@@ -469,7 +471,7 @@ class channelizer_hier_ccf(gr.hier_block2):
for i in range(0, n_filterbanks):
self.connect((self.splitter, i), self.fbs[i], (self.combiner, i))
self.connect(self.combiner, self.fft)
- if outchans != range(n_chans):
+ if outchans != list(range(n_chans)):
self.connect(self.fft, self.selector, self.v2ss)
else:
self.connect(self.fft, self.v2ss)
diff --git a/gr-filter/python/filter/qa_dc_blocker.py b/gr-filter/python/filter/qa_dc_blocker.py
index 66a69760d..d02af5783 100755..100644
--- a/gr-filter/python/filter/qa_dc_blocker.py
+++ b/gr-filter/python/filter/qa_dc_blocker.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, filter, blocks
class test_dc_blocker(gr_unittest.TestCase):
diff --git a/gr-filter/python/filter/qa_fft_filter.py b/gr-filter/python/filter/qa_fft_filter.py
index 172b94544..6de8ecb21 100755..100644
--- a/gr-filter/python/filter/qa_fft_filter.py
+++ b/gr-filter/python/filter/qa_fft_filter.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, filter, blocks
import sys
@@ -88,10 +89,10 @@ def print_complex(x):
class test_fft_filter(gr_unittest.TestCase):
def setUp(self):
- pass
+ pass
def tearDown(self):
- pass
+ pass
def assert_fft_ok2(self, expected_result, result_data):
expected_result = expected_result[:len(result_data)]
@@ -104,7 +105,7 @@ class test_fft_filter(gr_unittest.TestCase):
abs_eps, rel_eps)
def test_ccc_001(self):
- tb = gr.top_block()
+ tb = gr.top_block()
src_data = (0,1,2,3,4,5,6,7)
taps = (1,)
expected_result = tuple([complex(x) for x in (0,1,2,3,4,5,6,7)])
@@ -121,7 +122,7 @@ class test_fft_filter(gr_unittest.TestCase):
def test_ccc_002(self):
# Test nthreads
- tb = gr.top_block()
+ tb = gr.top_block()
src_data = (0,1,2,3,4,5,6,7)
taps = (2,)
nthreads = 2
@@ -137,7 +138,7 @@ class test_fft_filter(gr_unittest.TestCase):
self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5)
def test_ccc_003(self):
- tb = gr.top_block()
+ tb = gr.top_block()
src_data = (0,1,2,3,4,5,6,7)
taps = (2,)
expected_result = tuple([2 * complex(x) for x in (0,1,2,3,4,5,6,7)])
@@ -154,7 +155,7 @@ class test_fft_filter(gr_unittest.TestCase):
def test_ccc_004(self):
random.seed(0)
- for i in xrange(25):
+ for i in range(25):
# sys.stderr.write("\n>>> Loop = %d\n" % (i,))
src_len = 4*1024
src_data = make_random_complex_tuple(src_len)
@@ -165,16 +166,16 @@ class test_fft_filter(gr_unittest.TestCase):
src = blocks.vector_source_c(src_data)
op = filter.fft_filter_ccc(1, taps)
dst = blocks.vector_sink_c()
- tb = gr.top_block()
+ tb = gr.top_block()
tb.connect(src, op, dst)
tb.run()
result_data = dst.data()
- del tb
+ del tb
self.assert_fft_ok2(expected_result, result_data)
def test_ccc_005(self):
random.seed(0)
- for i in xrange(25):
+ for i in range(25):
# sys.stderr.write("\n>>> Loop = %d\n" % (i,))
dec = i + 1
src_len = 4*1024
@@ -187,10 +188,10 @@ class test_fft_filter(gr_unittest.TestCase):
op = filter.fft_filter_ccc(dec, taps)
dst = blocks.vector_sink_c()
tb = gr.top_block()
- tb.connect(src, op, dst)
+ tb.connect(src, op, dst)
tb.run()
del tb
- result_data = dst.data()
+ result_data = dst.data()
self.assert_fft_ok2(expected_result, result_data)
@@ -198,7 +199,7 @@ class test_fft_filter(gr_unittest.TestCase):
# Test decimating with nthreads=2
random.seed(0)
nthreads = 2
- for i in xrange(25):
+ for i in range(25):
# sys.stderr.write("\n>>> Loop = %d\n" % (i,))
dec = i + 1
src_len = 4*1024
@@ -211,10 +212,10 @@ class test_fft_filter(gr_unittest.TestCase):
op = filter.fft_filter_ccc(dec, taps, nthreads)
dst = blocks.vector_sink_c()
tb = gr.top_block()
- tb.connect(src, op, dst)
+ tb.connect(src, op, dst)
tb.run()
del tb
- result_data = dst.data()
+ result_data = dst.data()
self.assert_fft_ok2(expected_result, result_data)
@@ -223,7 +224,7 @@ class test_fft_filter(gr_unittest.TestCase):
# ----------------------------------------------------------------
def test_ccf_001(self):
- tb = gr.top_block()
+ tb = gr.top_block()
src_data = (0,1,2,3,4,5,6,7)
taps = (1,)
expected_result = tuple([complex(x) for x in (0,1,2,3,4,5,6,7)])
@@ -240,7 +241,7 @@ class test_fft_filter(gr_unittest.TestCase):
def test_ccf_002(self):
# Test nthreads
- tb = gr.top_block()
+ tb = gr.top_block()
src_data = (0,1,2,3,4,5,6,7)
taps = (2,)
nthreads = 2
@@ -256,7 +257,7 @@ class test_fft_filter(gr_unittest.TestCase):
self.assertComplexTuplesAlmostEqual (expected_result, result_data, 5)
def test_ccf_003(self):
- tb = gr.top_block()
+ tb = gr.top_block()
src_data = (0,1,2,3,4,5,6,7)
taps = (2,)
expected_result = tuple([2 * complex(x) for x in (0,1,2,3,4,5,6,7)])
@@ -273,7 +274,7 @@ class test_fft_filter(gr_unittest.TestCase):
def test_ccf_004(self):
random.seed(0)
- for i in xrange(25):
+ for i in range(25):
# sys.stderr.write("\n>>> Loop = %d\n" % (i,))
src_len = 4*1024
src_data = make_random_complex_tuple(src_len)
@@ -284,16 +285,16 @@ class test_fft_filter(gr_unittest.TestCase):
src = blocks.vector_source_c(src_data)
op = filter.fft_filter_ccf(1, taps)
dst = blocks.vector_sink_c()
- tb = gr.top_block()
+ tb = gr.top_block()
tb.connect(src, op, dst)
tb.run()
result_data = dst.data()
- del tb
+ del tb
self.assert_fft_ok2(expected_result, result_data)
def test_ccf_005(self):
random.seed(0)
- for i in xrange(25):
+ for i in range(25):
# sys.stderr.write("\n>>> Loop = %d\n" % (i,))
dec = i + 1
src_len = 4*1024
@@ -306,10 +307,10 @@ class test_fft_filter(gr_unittest.TestCase):
op = filter.fft_filter_ccf(dec, taps)
dst = blocks.vector_sink_c()
tb = gr.top_block()
- tb.connect(src, op, dst)
+ tb.connect(src, op, dst)
tb.run()
del tb
- result_data = dst.data()
+ result_data = dst.data()
self.assert_fft_ok2(expected_result, result_data)
@@ -317,7 +318,7 @@ class test_fft_filter(gr_unittest.TestCase):
# Test decimating with nthreads=2
random.seed(0)
nthreads = 2
- for i in xrange(25):
+ for i in range(25):
# sys.stderr.write("\n>>> Loop = %d\n" % (i,))
dec = i + 1
src_len = 4*1024
@@ -330,10 +331,10 @@ class test_fft_filter(gr_unittest.TestCase):
op = filter.fft_filter_ccc(dec, taps, nthreads)
dst = blocks.vector_sink_c()
tb = gr.top_block()
- tb.connect(src, op, dst)
+ tb.connect(src, op, dst)
tb.run()
del tb
- result_data = dst.data()
+ result_data = dst.data()
self.assert_fft_ok2(expected_result, result_data)
@@ -389,7 +390,7 @@ class test_fft_filter(gr_unittest.TestCase):
def xtest_fff_004(self):
random.seed(0)
- for i in xrange(25):
+ for i in range(25):
sys.stderr.write("\n>>> Loop = %d\n" % (i,))
src_len = 4096
src_data = make_random_float_tuple(src_len)
@@ -400,7 +401,7 @@ class test_fft_filter(gr_unittest.TestCase):
src = blocks.vector_source_f(src_data)
op = filter.fft_filter_fff(1, taps)
dst = blocks.vector_sink_f()
- tb = gr.top_block()
+ tb = gr.top_block()
tb.connect(src, op, dst)
tb.run()
result_data = dst.data()
@@ -411,15 +412,15 @@ class test_fft_filter(gr_unittest.TestCase):
except:
expected = open('expected', 'w')
for x in expected_result:
- expected.write(`x` + '\n')
+ expected.write(repr(x) + '\n')
actual = open('actual', 'w')
for x in result_data:
- actual.write(`x` + '\n')
+ actual.write(repr(x) + '\n')
raise
def xtest_fff_005(self):
random.seed(0)
- for i in xrange(25):
+ for i in range(25):
sys.stderr.write("\n>>> Loop = %d\n" % (i,))
src_len = 4*1024
src_data = make_random_float_tuple(src_len)
@@ -430,7 +431,7 @@ class test_fft_filter(gr_unittest.TestCase):
src = blocks.vector_source_f(src_data)
op = filter.fft_filter_fff(1, taps)
dst = blocks.vector_sink_f()
- tb = gr.top_block()
+ tb = gr.top_block()
tb.connect(src, op, dst)
tb.run()
result_data = dst.data()
@@ -439,7 +440,7 @@ class test_fft_filter(gr_unittest.TestCase):
def xtest_fff_006(self):
random.seed(0)
- for i in xrange(25):
+ for i in range(25):
sys.stderr.write("\n>>> Loop = %d\n" % (i,))
dec = i + 1
src_len = 4*1024
@@ -451,7 +452,7 @@ class test_fft_filter(gr_unittest.TestCase):
src = blocks.vector_source_f(src_data)
op = filter.fft_filter_fff(dec, taps)
dst = blocks.vector_sink_f()
- tb = gr.top_block()
+ tb = gr.top_block()
tb.connect(src, op, dst)
tb.run()
result_data = dst.data()
@@ -462,7 +463,7 @@ class test_fft_filter(gr_unittest.TestCase):
# test decimation with nthreads
random.seed(0)
nthreads = 2
- for i in xrange(25):
+ for i in range(25):
sys.stderr.write("\n>>> Loop = %d\n" % (i,))
dec = i + 1
src_len = 4*1024
@@ -474,7 +475,7 @@ class test_fft_filter(gr_unittest.TestCase):
src = blocks.vector_source_f(src_data)
op = filter.fft_filter_fff(dec, taps, nthreads)
dst = blocks.vector_sink_f()
- tb = gr.top_block()
+ tb = gr.top_block()
tb.connect(src, op, dst)
tb.run()
result_data = dst.data()
@@ -483,7 +484,7 @@ class test_fft_filter(gr_unittest.TestCase):
def test_fff_get0(self):
random.seed(0)
- for i in xrange(25):
+ for i in range(25):
ntaps = int(random.uniform(2, 100))
taps = make_random_float_tuple(ntaps)
@@ -495,7 +496,7 @@ class test_fft_filter(gr_unittest.TestCase):
def test_ccc_get0(self):
random.seed(0)
- for i in xrange(25):
+ for i in range(25):
ntaps = int(random.uniform(2, 100))
taps = make_random_complex_tuple(ntaps)
@@ -508,4 +509,3 @@ class test_fft_filter(gr_unittest.TestCase):
if __name__ == '__main__':
gr_unittest.run(test_fft_filter, "test_fft_filter.xml")
-
diff --git a/gr-filter/python/filter/qa_filter_delay_fc.py b/gr-filter/python/filter/qa_filter_delay_fc.py
index 79acace23..61567089e 100755..100644
--- a/gr-filter/python/filter/qa_filter_delay_fc.py
+++ b/gr-filter/python/filter/qa_filter_delay_fc.py
@@ -20,18 +20,20 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, filter, blocks
import math
def sin_source_f(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: math.sin(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [math.sin(2.*math.pi*freq*x) for x in t]
return y
def cos_source_f(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: math.cos(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [math.cos(2.*math.pi*freq*x) for x in t]
return y
def fir_filter(x, taps, delay):
@@ -78,7 +80,7 @@ class test_filter_delay_fc(gr_unittest.TestCase):
taps = filter.firdes.hilbert(ntaps, filter.firdes.WIN_HAMMING)
hd = filter.filter_delay_fc(taps)
- expected_result = fir_filter(data, taps, (ntaps-1)/2)
+ expected_result = fir_filter(data, taps, (ntaps-1) // 2)
tb.connect(src1, hd)
tb.connect(hd, dst2)
@@ -106,7 +108,7 @@ class test_filter_delay_fc(gr_unittest.TestCase):
taps = filter.firdes.hilbert(ntaps, filter.firdes.WIN_HAMMING)
hd = filter.filter_delay_fc(taps)
- expected_result = fir_filter2(data, data, taps, (ntaps-1)/2)
+ expected_result = fir_filter2(data, data, taps, (ntaps-1) // 2)
tb.connect(src1, (hd,0))
tb.connect(src1, (hd,1))
@@ -135,7 +137,7 @@ class test_filter_delay_fc(gr_unittest.TestCase):
taps = filter.firdes.hilbert(ntaps, filter.firdes.WIN_HAMMING)
hd = filter.filter_delay_fc(taps)
- expected_result = fir_filter2(data1, data2, taps, (ntaps-1)/2)
+ expected_result = fir_filter2(data1, data2, taps, (ntaps-1) // 2)
dst2 = blocks.vector_sink_c()
diff --git a/gr-filter/python/filter/qa_filterbank.py b/gr-filter/python/filter/qa_filterbank.py
index 3423b1052..9a99c6832 100644
--- a/gr-filter/python/filter/qa_filterbank.py
+++ b/gr-filter/python/filter/qa_filterbank.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
import time
import random
import math
diff --git a/gr-filter/python/filter/qa_fir_filter.py b/gr-filter/python/filter/qa_fir_filter.py
index 172d64a8d..cfd5a7e2b 100755..100644
--- a/gr-filter/python/filter/qa_fir_filter.py
+++ b/gr-filter/python/filter/qa_fir_filter.py
@@ -19,6 +19,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
+
from gnuradio import gr, gr_unittest, filter, blocks
def fir_filter(x, taps, decim=1):
diff --git a/gr-filter/python/filter/qa_firdes.py b/gr-filter/python/filter/qa_firdes.py
index b32e5b2f9..21521c463 100755..100644
--- a/gr-filter/python/filter/qa_firdes.py
+++ b/gr-filter/python/filter/qa_firdes.py
@@ -20,16 +20,17 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, filter
import sys
class test_firdes(gr_unittest.TestCase):
def setUp(self):
- pass
+ pass
def tearDown(self):
- pass
+ pass
def test_low_pass(self):
known_taps = (0.0024871660862118006, -4.403502608370943e-18,
@@ -187,4 +188,3 @@ class test_firdes(gr_unittest.TestCase):
if __name__ == '__main__':
gr_unittest.run(test_firdes, "test_firdes.xml")
-
diff --git a/gr-filter/python/filter/qa_fractional_interpolator.py b/gr-filter/python/filter/qa_fractional_interpolator.py
index 3ae6074e9..52af92f40 100755..100644
--- a/gr-filter/python/filter/qa_fractional_interpolator.py
+++ b/gr-filter/python/filter/qa_fractional_interpolator.py
@@ -20,19 +20,21 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, filter, blocks
import math
def sig_source_f(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: math.sin(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [math.sin(2.*math.pi*freq*x) for x in t]
return y
def sig_source_c(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: math.cos(2.*math.pi*freq*x) + \
- 1j*math.sin(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [math.cos(2.*math.pi*freq*x) + \
+ 1j*math.sin(2.*math.pi*freq*x) for x in t]
return y
class test_mmse_resampler(gr_unittest.TestCase):
@@ -59,10 +61,10 @@ class test_mmse_resampler(gr_unittest.TestCase):
Ntest = 5000
L = len(snk.data())
- t = map(lambda x: float(x)/(fs/rrate), xrange(L))
+ t = [float(x) / (fs / rrate) for x in range(L)]
phase = 0.1884
- expected_data = map(lambda x: math.sin(2.*math.pi*freq*x+phase), t)
+ expected_data = [math.sin(2.*math.pi*freq*x+phase) for x in t]
dst_data = snk.data()
@@ -85,11 +87,11 @@ class test_mmse_resampler(gr_unittest.TestCase):
Ntest = 5000
L = len(snk.data())
- t = map(lambda x: float(x)/(fs/rrate), xrange(L))
+ t = [float(x) / (fs / rrate) for x in range(L)]
phase = 0.1884
- expected_data = map(lambda x: math.cos(2.*math.pi*freq*x+phase) + \
- 1j*math.sin(2.*math.pi*freq*x+phase), t)
+ expected_data = [math.cos(2.*math.pi*freq*x+phase) + \
+ 1j*math.sin(2.*math.pi*freq*x+phase) for x in t]
dst_data = snk.data()
diff --git a/gr-filter/python/filter/qa_fractional_resampler.py b/gr-filter/python/filter/qa_fractional_resampler.py
index e4da496d4..d49bca1e1 100644
--- a/gr-filter/python/filter/qa_fractional_resampler.py
+++ b/gr-filter/python/filter/qa_fractional_resampler.py
@@ -20,19 +20,21 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import math
from gnuradio import gr, gr_unittest, filter, blocks
def sig_source_f(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: math.sin(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [math.sin(2.*math.pi*freq*x) for x in t]
return y
def sig_source_c(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: math.cos(2.*math.pi*freq*x) + \
- 1j*math.sin(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [math.cos(2.*math.pi*freq*x) + \
+ 1j*math.sin(2.*math.pi*freq*x) for x in t]
return y
def const_source_f(amp, N):
@@ -63,10 +65,10 @@ class test_mmse_resampler(gr_unittest.TestCase):
Ntest = 5000
L = len(snk.data())
- t = map(lambda x: float(x)/(fs/rrate), xrange(L))
+ t = [float(x) / (fs / rrate) for x in range(L)]
phase = 0.1884
- expected_data = map(lambda x: math.sin(2.*math.pi*freq*x+phase), t)
+ expected_data = [math.sin(2.*math.pi*freq*x+phase) for x in t]
dst_data = snk.data()
@@ -88,11 +90,11 @@ class test_mmse_resampler(gr_unittest.TestCase):
Ntest = 5000
L = len(snk.data())
- t = map(lambda x: float(x)/(fs/rrate), xrange(L))
+ t = [float(x) / (fs / rrate) for x in range(L)]
phase = 0.1884
- expected_data = map(lambda x: math.cos(2.*math.pi*freq*x+phase) + \
- 1j*math.sin(2.*math.pi*freq*x+phase), t)
+ expected_data = [math.cos(2.*math.pi*freq*x+phase) + \
+ 1j*math.sin(2.*math.pi*freq*x+phase) for x in t]
dst_data = snk.data()
@@ -117,10 +119,10 @@ class test_mmse_resampler(gr_unittest.TestCase):
Ntest = 5000
L = len(snk.data())
- t = map(lambda x: float(x)/(fs/rrate), xrange(L))
+ t = [float(x) / (fs / rrate) for x in range(L)]
phase = 0.1884
- expected_data = map(lambda x: math.sin(2.*math.pi*freq*x+phase), t)
+ expected_data = [math.sin(2.*math.pi*freq*x+phase) for x in t]
dst_data = snk.data()
@@ -145,11 +147,11 @@ class test_mmse_resampler(gr_unittest.TestCase):
Ntest = 5000
L = len(snk.data())
- t = map(lambda x: float(x)/(fs/rrate), xrange(L))
+ t = [float(x) / (fs / rrate) for x in range(L)]
phase = 0.1884
- expected_data = map(lambda x: math.cos(2.*math.pi*freq*x+phase) + \
- 1j*math.sin(2.*math.pi*freq*x+phase), t)
+ expected_data = [math.cos(2.*math.pi*freq*x+phase) + \
+ 1j*math.sin(2.*math.pi*freq*x+phase) for x in t]
dst_data = snk.data()
diff --git a/gr-filter/python/filter/qa_freq_xlating_fft_filter.py b/gr-filter/python/filter/qa_freq_xlating_fft_filter.py
index d5c7d41dd..0a7bc8817 100755..100644
--- a/gr-filter/python/filter/qa_freq_xlating_fft_filter.py
+++ b/gr-filter/python/filter/qa_freq_xlating_fft_filter.py
@@ -19,6 +19,8 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, filter, blocks
import cmath, math
@@ -34,14 +36,14 @@ def fir_filter(x, taps, decim=1):
return y
def sig_source_s(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: int(100*math.sin(2.*math.pi*freq*x)), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [int(100*math.sin(2.*math.pi*freq*x)) for x in t]
return y
def sig_source_c(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: math.cos(2.*math.pi*freq*x) + \
- 1j*math.sin(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [math.cos(2.*math.pi*freq*x) + \
+ 1j*math.sin(2.*math.pi*freq*x) for x in t]
return y
def mix(lo, data):
@@ -60,17 +62,17 @@ class test_freq_xlating_filter(gr_unittest.TestCase):
self.fs = fs = 1
self.fc = fc = 0.3
self.bw = bw = 0.1
- self.taps = filter.firdes.low_pass(1, fs, bw, bw/4)
- times = xrange(1024)
- self.src_data = map(lambda t: cmath.exp(-2j*cmath.pi*fc/fs*(t/100.0)), times)
+ self.taps = filter.firdes.low_pass(1, fs, bw, bw / 4)
+ times = list(range(1024))
+ self.src_data = [cmath.exp(-2j*cmath.pi*fc/fs*(t / 100.0)) for t in times]
def generate_ccc_source(self):
self.fs = fs = 1
self.fc = fc = 0.3
self.bw = bw = 0.1
- self.taps = filter.firdes.complex_band_pass(1, fs, -bw/2, bw/2, bw/4)
- times = xrange(1024)
- self.src_data = map(lambda t: cmath.exp(-2j*cmath.pi*fc/fs*(t/100.0)), times)
+ self.taps = filter.firdes.complex_band_pass(1, fs, -bw / 2, bw / 2, bw / 4)
+ times = list(range(1024))
+ self.src_data = [cmath.exp(-2j*cmath.pi*fc/fs*(t / 100.0)) for t in times]
def assert_fft_ok(self, expected_result, result_data):
expected_result = expected_result[:len(result_data)]
diff --git a/gr-filter/python/filter/qa_freq_xlating_fir_filter.py b/gr-filter/python/filter/qa_freq_xlating_fir_filter.py
index ca5245db6..f40197b96 100755..100644
--- a/gr-filter/python/filter/qa_freq_xlating_fir_filter.py
+++ b/gr-filter/python/filter/qa_freq_xlating_fir_filter.py
@@ -19,6 +19,8 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, filter, blocks
import cmath, math
@@ -34,14 +36,14 @@ def fir_filter(x, taps, decim=1):
return y
def sig_source_s(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: int(100*math.sin(2.*math.pi*freq*x)), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [int(100*math.sin(2.*math.pi*freq*x)) for x in t]
return y
def sig_source_c(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: math.cos(2.*math.pi*freq*x) + \
- 1j*math.sin(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [math.cos(2.*math.pi*freq*x) + \
+ 1j*math.sin(2.*math.pi*freq*x) for x in t]
return y
def mix(lo, data):
@@ -60,49 +62,49 @@ class test_freq_xlating_filter(gr_unittest.TestCase):
self.fs = fs = 1
self.fc = fc = 0.3
self.bw = bw = 0.1
- self.taps = filter.firdes.low_pass(1, fs, bw, bw/4)
- times = xrange(100)
- self.src_data = map(lambda t: cmath.exp(-2j*cmath.pi*fc/fs*(t/100.0)), times)
+ self.taps = filter.firdes.low_pass(1, fs, bw, bw / 4)
+ times = list(range(100))
+ self.src_data = [cmath.exp(-2j*cmath.pi*fc/fs*(t / 100.0)) for t in times]
def generate_ccc_source(self):
self.fs = fs = 1
self.fc = fc = 0.3
self.bw = bw = 0.1
- self.taps = filter.firdes.complex_band_pass(1, fs, -bw/2, bw/2, bw/4)
- times = xrange(100)
- self.src_data = map(lambda t: cmath.exp(-2j*cmath.pi*fc/fs*(t/100.0)), times)
+ self.taps = filter.firdes.complex_band_pass(1, fs, -bw / 2, bw / 2, bw / 4)
+ times = list(range(100))
+ self.src_data = [cmath.exp(-2j*cmath.pi*fc/fs*(t / 100.0)) for t in times]
def generate_fcf_source(self):
self.fs = fs = 1
self.fc = fc = 0.3
self.bw = bw = 0.1
- self.taps = filter.firdes.low_pass(1, fs, bw, bw/4)
- times = xrange(100)
- self.src_data = map(lambda t: math.sin(2*cmath.pi*fc/fs*(t/100.0)), times)
+ self.taps = filter.firdes.low_pass(1, fs, bw, bw / 4)
+ times = list(range(100))
+ self.src_data = [math.sin(2*cmath.pi*fc/fs*(t / 100.0)) for t in times]
def generate_fcc_source(self):
self.fs = fs = 1
self.fc = fc = 0.3
self.bw = bw = 0.1
- self.taps = filter.firdes.complex_band_pass(1, fs, -bw/2, bw/2, bw/4)
- times = xrange(100)
- self.src_data = map(lambda t: math.sin(2*cmath.pi*fc/fs*(t/100.0)), times)
+ self.taps = filter.firdes.complex_band_pass(1, fs, -bw / 2, bw / 2, bw / 4)
+ times = list(range(100))
+ self.src_data = [math.sin(2*cmath.pi*fc/fs*(t / 100.0)) for t in times]
def generate_scf_source(self):
self.fs = fs = 1
self.fc = fc = 0.3
self.bw = bw = 0.12
- self.taps = filter.firdes.low_pass(1, fs, bw, bw/4)
- times = xrange(100)
- self.src_data = map(lambda t: int(100*math.sin(2*cmath.pi*fc/fs*(t/100.0))), times)
+ self.taps = filter.firdes.low_pass(1, fs, bw, bw / 4)
+ times = list(range(100))
+ self.src_data = [int(100*math.sin(2*cmath.pi*fc/fs*(t / 100.0))) for t in times]
def generate_scc_source(self):
self.fs = fs = 1
self.fc = fc = 0.3
self.bw = bw = 0.12
- self.taps = filter.firdes.complex_band_pass(1, fs, -bw/2, bw/2, bw/4)
- times = xrange(100)
- self.src_data = map(lambda t: int(100*math.sin(2*cmath.pi*fc/fs*(t/100.0))), times)
+ self.taps = filter.firdes.complex_band_pass(1, fs, -bw / 2, bw / 2, bw / 4)
+ times = list(range(100))
+ self.src_data = [int(100*math.sin(2*cmath.pi*fc/fs*(t / 100.0))) for t in times]
def test_fir_filter_ccf_001(self):
diff --git a/gr-filter/python/filter/qa_hilbert.py b/gr-filter/python/filter/qa_hilbert.py
index e8550a593..c1f048ba1 100755..100644
--- a/gr-filter/python/filter/qa_hilbert.py
+++ b/gr-filter/python/filter/qa_hilbert.py
@@ -20,18 +20,20 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, filter, blocks
import math
def sig_source_f(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: math.sin(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [math.sin(2.*math.pi*freq*x) for x in t]
return y
def fir_filter(x, taps):
y = []
x2 = (len(taps)-1)*[0,] + x
- delay = (len(taps)-1)/2
+ delay = (len(taps)-1) // 2
for i in range(len(x)):
yi = 0
for j in range(len(taps)):
diff --git a/gr-filter/python/filter/qa_iir_filter.py b/gr-filter/python/filter/qa_iir_filter.py
index 0a89dc4d8..fa8a6af29 100755..100644
--- a/gr-filter/python/filter/qa_iir_filter.py
+++ b/gr-filter/python/filter/qa_iir_filter.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, filter, blocks
class test_iir_filter(gr_unittest.TestCase):
diff --git a/gr-filter/python/filter/qa_interp_fir_filter.py b/gr-filter/python/filter/qa_interp_fir_filter.py
index 536ab1bb8..66580c974 100755..100644
--- a/gr-filter/python/filter/qa_interp_fir_filter.py
+++ b/gr-filter/python/filter/qa_interp_fir_filter.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, filter, blocks
import math
diff --git a/gr-filter/python/filter/qa_pfb_arb_resampler.py b/gr-filter/python/filter/qa_pfb_arb_resampler.py
index 0bac3e5c1..01124f58c 100755..100644
--- a/gr-filter/python/filter/qa_pfb_arb_resampler.py
+++ b/gr-filter/python/filter/qa_pfb_arb_resampler.py
@@ -20,18 +20,20 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, filter, blocks
import math
def sig_source_c(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: math.cos(2.*math.pi*freq*x) + \
- 1j*math.sin(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [math.cos(2.*math.pi*freq*x) + \
+ 1j*math.sin(2.*math.pi*freq*x) for x in t]
return y
def sig_source_f(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: math.sin(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [math.sin(2.*math.pi*freq*x) for x in t]
return y
class test_pfb_arb_resampler(gr_unittest.TestCase):
@@ -48,7 +50,7 @@ class test_pfb_arb_resampler(gr_unittest.TestCase):
rrate = 2.3421 # resampling rate
nfilts = 32
- taps = filter.firdes.low_pass_2(nfilts, nfilts*fs, fs/2, fs/10,
+ taps = filter.firdes.low_pass_2(nfilts, nfilts*fs, fs / 2, fs / 10,
attenuation_dB=80,
window=filter.firdes.WIN_BLACKMAN_hARRIS)
@@ -69,10 +71,10 @@ class test_pfb_arb_resampler(gr_unittest.TestCase):
phase = pfb.phase_offset(freq, fs)
# Create a timeline offset by the filter's group delay
- t = map(lambda x: float(x)/(fs*rrate), xrange(-delay, L-delay))
+ t = [float(x) / (fs*rrate) for x in range(-delay, L-delay)]
# Data of the sinusoid at frequency freq with the delay and phase offset.
- expected_data = map(lambda x: math.sin(2.*math.pi*freq*x+phase), t)
+ expected_data = [math.sin(2.*math.pi*freq*x+phase) for x in t]
dst_data = snk.data()
@@ -84,7 +86,7 @@ class test_pfb_arb_resampler(gr_unittest.TestCase):
rrate = 2.4321 # resampling rate
nfilts = 32
- taps = filter.firdes.low_pass_2(nfilts, nfilts*fs, fs/2, fs/10,
+ taps = filter.firdes.low_pass_2(nfilts, nfilts*fs, fs / 2, fs / 10,
attenuation_dB=80,
window=filter.firdes.WIN_BLACKMAN_hARRIS)
@@ -105,11 +107,11 @@ class test_pfb_arb_resampler(gr_unittest.TestCase):
phase = pfb.phase_offset(freq, fs)
# Create a timeline offset by the filter's group delay
- t = map(lambda x: float(x)/(fs*rrate), xrange(-delay, L-delay))
+ t = [float(x) / (fs*rrate) for x in range(-delay, L-delay)]
# Data of the sinusoid at frequency freq with the delay and phase offset.
- expected_data = map(lambda x: math.cos(2.*math.pi*freq*x+phase) + \
- 1j*math.sin(2.*math.pi*freq*x+phase), t)
+ expected_data = [math.cos(2.*math.pi*freq*x+phase) + \
+ 1j*math.sin(2.*math.pi*freq*x+phase) for x in t]
dst_data = snk.data()
@@ -121,7 +123,7 @@ class test_pfb_arb_resampler(gr_unittest.TestCase):
rrate = 0.75 # resampling rate
nfilts = 32
- taps = filter.firdes.low_pass_2(nfilts, nfilts*fs, fs/4, fs/10,
+ taps = filter.firdes.low_pass_2(nfilts, nfilts*fs, fs / 4, fs / 10,
attenuation_dB=80,
window=filter.firdes.WIN_BLACKMAN_hARRIS)
@@ -142,11 +144,11 @@ class test_pfb_arb_resampler(gr_unittest.TestCase):
phase = pfb.phase_offset(freq, fs)
# Create a timeline offset by the filter's group delay
- t = map(lambda x: float(x)/(fs*rrate), xrange(-delay, L-delay))
+ t = [float(x) / (fs*rrate) for x in range(-delay, L-delay)]
# Data of the sinusoid at frequency freq with the delay and phase offset.
- expected_data = map(lambda x: math.cos(2.*math.pi*freq*x+phase) + \
- 1j*math.sin(2.*math.pi*freq*x+phase), t)
+ expected_data = [math.cos(2.*math.pi*freq*x+phase) + \
+ 1j*math.sin(2.*math.pi*freq*x+phase) for x in t]
dst_data = snk.data()
@@ -158,7 +160,7 @@ class test_pfb_arb_resampler(gr_unittest.TestCase):
rrate = 3.4321 # resampling rate
nfilts = 32
- taps = filter.firdes.complex_band_pass_2(nfilts, nfilts*fs, 50, 400, fs/10,
+ taps = filter.firdes.complex_band_pass_2(nfilts, nfilts*fs, 50, 400, fs / 10,
attenuation_dB=80,
window=filter.firdes.WIN_BLACKMAN_hARRIS)
@@ -179,11 +181,11 @@ class test_pfb_arb_resampler(gr_unittest.TestCase):
phase = pfb.phase_offset(freq, fs)
# Create a timeline offset by the filter's group delay
- t = map(lambda x: float(x)/(fs*rrate), xrange(-delay, L-delay))
+ t = [float(x) / (fs*rrate) for x in range(-delay, L-delay)]
# Data of the sinusoid at frequency freq with the delay and phase offset.
- expected_data = map(lambda x: math.cos(2.*math.pi*freq*x+phase) + \
- 1j*math.sin(2.*math.pi*freq*x+phase), t)
+ expected_data = [math.cos(2.*math.pi*freq*x+phase) + \
+ 1j*math.sin(2.*math.pi*freq*x+phase) for x in t]
dst_data = snk.data()
@@ -195,7 +197,7 @@ class test_pfb_arb_resampler(gr_unittest.TestCase):
rrate = 0.715 # resampling rate
nfilts = 32
- taps = filter.firdes.complex_band_pass_2(nfilts, nfilts*fs, 50, 400, fs/10,
+ taps = filter.firdes.complex_band_pass_2(nfilts, nfilts*fs, 50, 400, fs / 10,
attenuation_dB=80,
window=filter.firdes.WIN_BLACKMAN_hARRIS)
@@ -216,11 +218,11 @@ class test_pfb_arb_resampler(gr_unittest.TestCase):
phase = pfb.phase_offset(freq, fs)
# Create a timeline offset by the filter's group delay
- t = map(lambda x: float(x)/(fs*rrate), xrange(-delay, L-delay))
+ t = [float(x) / (fs*rrate) for x in range(-delay, L-delay)]
# Data of the sinusoid at frequency freq with the delay and phase offset.
- expected_data = map(lambda x: math.cos(2.*math.pi*freq*x+phase) + \
- 1j*math.sin(2.*math.pi*freq*x+phase), t)
+ expected_data = [math.cos(2.*math.pi*freq*x+phase) + \
+ 1j*math.sin(2.*math.pi*freq*x+phase) for x in t]
dst_data = snk.data()
diff --git a/gr-filter/python/filter/qa_pfb_channelizer.py b/gr-filter/python/filter/qa_pfb_channelizer.py
index e370f510e..902c36029 100755..100644
--- a/gr-filter/python/filter/qa_pfb_channelizer.py
+++ b/gr-filter/python/filter/qa_pfb_channelizer.py
@@ -20,13 +20,15 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, filter, blocks, analog
import math, cmath
def sig_source_c(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: math.cos(2.*math.pi*freq*x) + \
- 1j*math.sin(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [math.cos(2.*math.pi*freq*x) + \
+ 1j*math.sin(2.*math.pi*freq*x) for x in t]
return y
@@ -45,7 +47,7 @@ class test_pfb_channelizer(gr_unittest.TestCase):
self.ifs = self.M*self.fs
self.taps = filter.firdes.low_pass_2(
- 1, self.ifs, self.fs/2, self.fs/10,
+ 1, self.ifs, self.fs / 2, self.fs / 10,
attenuation_dB=80,
window=filter.firdes.WIN_BLACKMAN_hARRIS)
@@ -67,7 +69,7 @@ class test_pfb_channelizer(gr_unittest.TestCase):
"""Test roundig error handling for oversample rate (ok)."""
channels, oversample = 36, 25.
filter.pfb.channelizer_ccf(channels, taps=self.taps,
- oversample_rate=channels/oversample)
+ oversample_rate=channels / oversample)
def test_0003(self):
"""Test roundig error handling for oversample rate, (bad)."""
@@ -83,7 +85,7 @@ class test_pfb_channelizer(gr_unittest.TestCase):
tb = gr.top_block()
signals = []
add = blocks.add_cc()
- for i in xrange(len(self.freqs)):
+ for i in range(len(self.freqs)):
f = self.freqs[i] + i*self.fs
signals.append(analog.sig_source_c(self.ifs, analog.GR_SIN_WAVE, f, 1))
tb.connect(signals[i], (add,i))
@@ -97,7 +99,7 @@ class test_pfb_channelizer(gr_unittest.TestCase):
def check_channelizer(self, channelizer_block):
signals = list()
add = blocks.add_cc()
- for i in xrange(len(self.freqs)):
+ for i in range(len(self.freqs)):
f = self.freqs[i] + i*self.fs
data = sig_source_c(self.ifs, f, 1, self.N)
signals.append(blocks.vector_source_c(data))
@@ -109,7 +111,7 @@ class test_pfb_channelizer(gr_unittest.TestCase):
self.tb.connect(add, channelizer_block)
snks = list()
- for i in xrange(self.M):
+ for i in range(self.M):
snks.append(blocks.vector_sink_c())
#self.tb.connect((s2ss,i), (channelizer_block,i))
self.tb.connect((channelizer_block, i), snks[i])
@@ -128,8 +130,8 @@ class test_pfb_channelizer(gr_unittest.TestCase):
Ntest = 50
expected = expected[-Ntest:]
received = received[-Ntest:]
- expected = [x/expected[0] for x in expected]
- received = [x/received[0] for x in received]
+ expected = [x / expected[0] for x in expected]
+ received = [x / received[0] for x in received]
self.assertComplexTuplesAlmostEqual(expected, received, 3)
@@ -142,7 +144,7 @@ class test_pfb_channelizer(gr_unittest.TestCase):
if diff < -math.pi:
diff += 2*math.pi
freqs.append(diff)
- freq = float(sum(freqs))/len(freqs)
+ freq = float(sum(freqs)) / len(freqs)
freq /= 2*math.pi
return freq
@@ -154,12 +156,12 @@ class test_pfb_channelizer(gr_unittest.TestCase):
delay = int(delay)
# Create a time scale that's delayed to match the filter delay
- t = map(lambda x: float(x)/self.fs, xrange(delay, L+delay))
+ t = [float(x) / self.fs for x in range(delay, L+delay)]
# Create known data as complex sinusoids at the different baseband freqs
# the different channel numbering is due to channelizer output order.
- expected_data = [map(lambda x: math.cos(2.*math.pi*f*x) +
- 1j*math.sin(2.*math.pi*f*x), t) for f in self.freqs]
+ expected_data = [[math.cos(2.*math.pi*f*x) +
+ 1j*math.sin(2.*math.pi*f*x) for x in t] for f in self.freqs]
return expected_data
diff --git a/gr-filter/python/filter/qa_pfb_decimator.py b/gr-filter/python/filter/qa_pfb_decimator.py
index 4366e85ee..5d11533cd 100755..100644
--- a/gr-filter/python/filter/qa_pfb_decimator.py
+++ b/gr-filter/python/filter/qa_pfb_decimator.py
@@ -20,13 +20,15 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, filter, blocks
import math
def sig_source_c(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: math.cos(2.*math.pi*freq*x) + \
- 1j*math.sin(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [math.cos(2.*math.pi*freq*x) + \
+ 1j*math.sin(2.*math.pi*freq*x) for x in t]
return y
def run_test(tb, channel, fft_rotate, fft_filter):
@@ -35,16 +37,16 @@ def run_test(tb, channel, fft_rotate, fft_filter):
fs = 5000.0 # baseband sampling rate
ifs = M*fs # input samp rate to decimator
- taps = filter.firdes.low_pass_2(1, ifs, fs/2, fs/10,
+ taps = filter.firdes.low_pass_2(1, ifs, fs / 2, fs / 10,
attenuation_dB=80,
window=filter.firdes.WIN_BLACKMAN_hARRIS)
signals = list()
add = blocks.add_cc()
freqs = [-230., 121., 110., -513., 203.]
- Mch = ((len(freqs)-1)/2 + channel) % len(freqs)
- for i in xrange(len(freqs)):
- f = freqs[i] + (M/2-M+i+1)*fs
+ Mch = ((len(freqs)-1) // 2 + channel) % len(freqs)
+ for i in range(len(freqs)):
+ f = freqs[i] + (M // 2-M+i+1)*fs
data = sig_source_c(ifs, f, 1, N)
signals.append(blocks.vector_source_c(data))
tb.connect(signals[i], (add,i))
@@ -54,7 +56,7 @@ def run_test(tb, channel, fft_rotate, fft_filter):
snk = blocks.vector_sink_c()
tb.connect(add, s2ss)
- for i in xrange(M):
+ for i in range(M):
tb.connect((s2ss,i), (pfb,i))
tb.connect(pfb, snk)
tb.run()
@@ -75,12 +77,12 @@ def run_test(tb, channel, fft_rotate, fft_filter):
delay = int(delay)
# Create a time scale that's delayed to match the filter delay
- t = map(lambda x: float(x)/fs, xrange(delay, L+delay))
+ t = [float(x) / fs for x in range(delay, L+delay)]
# Create known data as complex sinusoids for the baseband freq
# of the extracted channel is due to decimator output order.
- expected_data = map(lambda x: math.cos(2.*math.pi*freqs[Mch]*x+phase) + \
- 1j*math.sin(2.*math.pi*freqs[Mch]*x+phase), t)
+ expected_data = [math.cos(2.*math.pi*freqs[Mch]*x+phase) + \
+ 1j*math.sin(2.*math.pi*freqs[Mch]*x+phase) for x in t]
dst_data = snk.data()
return (dst_data, expected_data)
diff --git a/gr-filter/python/filter/qa_pfb_interpolator.py b/gr-filter/python/filter/qa_pfb_interpolator.py
index b7ed4feef..c6aeb8e4c 100755..100644
--- a/gr-filter/python/filter/qa_pfb_interpolator.py
+++ b/gr-filter/python/filter/qa_pfb_interpolator.py
@@ -20,14 +20,16 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, filter, blocks
import math
def sig_source_c(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: math.cos(2.*math.pi*freq*x) + \
- 1j*math.sin(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [math.cos(2.*math.pi*freq*x) + \
+ 1j*math.sin(2.*math.pi*freq*x) for x in t]
return y
class test_pfb_interpolator(gr_unittest.TestCase):
@@ -44,7 +46,7 @@ class test_pfb_interpolator(gr_unittest.TestCase):
fs = 1000 # baseband sampling rate
ofs = M*fs # output samp rate of interpolator
- taps = filter.firdes.low_pass_2(M, ofs, fs/4, fs/10,
+ taps = filter.firdes.low_pass_2(M, ofs, fs / 4, fs / 10,
attenuation_dB=80,
window=filter.firdes.WIN_BLACKMAN_hARRIS)
@@ -66,12 +68,12 @@ class test_pfb_interpolator(gr_unittest.TestCase):
phase = 4.8870112969978994
# Create a time scale
- t = map(lambda x: float(x)/ofs, xrange(0, L))
+ t = [float(x) / ofs for x in range(0, L)]
# Create known data as complex sinusoids for the baseband freq
# of the extracted channel is due to decimator output order.
- expected_data = map(lambda x: math.cos(2.*math.pi*freq*x+phase) + \
- 1j*math.sin(2.*math.pi*freq*x+phase), t)
+ expected_data = [math.cos(2.*math.pi*freq*x+phase) + \
+ 1j*math.sin(2.*math.pi*freq*x+phase) for x in t]
dst_data = snk.data()
diff --git a/gr-filter/python/filter/qa_pfb_synthesizer.py b/gr-filter/python/filter/qa_pfb_synthesizer.py
index 0b3f8b27a..42f891a54 100755..100644
--- a/gr-filter/python/filter/qa_pfb_synthesizer.py
+++ b/gr-filter/python/filter/qa_pfb_synthesizer.py
@@ -20,14 +20,16 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, filter, blocks
import math
def sig_source_c(samp_rate, freq, amp, N):
- t = map(lambda x: float(x)/samp_rate, xrange(N))
- y = map(lambda x: math.cos(2.*math.pi*freq*x) + \
- 1j*math.sin(2.*math.pi*freq*x), t)
+ t = [float(x) / samp_rate for x in range(N)]
+ y = [math.cos(2.*math.pi*freq*x) + \
+ 1j*math.sin(2.*math.pi*freq*x) for x in t]
return y
class test_pfb_synthesizer(gr_unittest.TestCase):
@@ -44,20 +46,20 @@ class test_pfb_synthesizer(gr_unittest.TestCase):
fs = 1000 # baseband sampling rate
ofs = M*fs # input samp rate to decimator
- taps = filter.firdes.low_pass_2(M, ofs, fs/2, fs/10,
+ taps = filter.firdes.low_pass_2(M, ofs, fs / 2, fs / 10,
attenuation_dB=80,
window=filter.firdes.WIN_BLACKMAN_hARRIS)
signals = list()
freqs = [0, 100, 200, -200, -100]
- for i in xrange(len(freqs)):
+ for i in range(len(freqs)):
data = sig_source_c(fs, freqs[i], 1, N)
signals.append(blocks.vector_source_c(data))
pfb = filter.pfb_synthesizer_ccf(M, taps)
snk = blocks.vector_sink_c()
- for i in xrange(M):
+ for i in range(M):
self.tb.connect(signals[i], (pfb,i))
self.tb.connect(pfb, snk)
@@ -73,13 +75,13 @@ class test_pfb_synthesizer(gr_unittest.TestCase):
Ntest = 1000
L = len(snk.data())
- t = map(lambda x: float(x)/ofs, xrange(L))
+ t = [float(x) / ofs for x in range(L)]
# Create known data as sum of complex sinusoids at freqs
# of the output channels.
freqs = [-2200, -1100, 0, 1100, 2200]
expected_data = len(t)*[0,]
- for i in xrange(len(t)):
+ for i in range(len(t)):
expected_data[i] = math.cos(2.*math.pi*freqs[0]*t[i] + p3) + \
1j*math.sin(2.*math.pi*freqs[0]*t[i] + p3) + \
math.cos(2.*math.pi*freqs[1]*t[i] + p4) + \
diff --git a/gr-filter/python/filter/qa_pm_remez.py b/gr-filter/python/filter/qa_pm_remez.py
index af85f9eed..dd1b514f7 100755..100644
--- a/gr-filter/python/filter/qa_pm_remez.py
+++ b/gr-filter/python/filter/qa_pm_remez.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
from gnuradio import gr, gr_unittest, filter
import sys, math
@@ -28,11 +30,11 @@ import sys, math
def stopband_atten_to_dev (atten_db):
"""Convert a stopband attenuation in dB to an absolute value"""
- return 10**(-atten_db/20)
+ return 10**(-atten_db / 20)
def passband_ripple_to_dev (ripple_db):
"""Convert passband ripple spec expressed in dB to an absolute value"""
- return (10**(ripple_db/20)-1)/(10**(ripple_db/20)+1)
+ return (10**(ripple_db / 20)-1) / (10**(ripple_db / 20)+1)
# ----------------------------------------------------------------
@@ -55,10 +57,10 @@ def remezord (fcuts, mags, devs, fsamp = 2):
nbands = nm
if nm != nd:
- raise ValueError, "Length of mags and devs must be equal"
+ raise ValueError("Length of mags and devs must be equal")
if nf != 2 * (nbands - 1):
- raise ValueError, "Length of f must be 2 * len (mags) - 2"
+ raise ValueError("Length of f must be 2 * len (mags) - 2")
for i in range (len (mags)):
if mags[i] != 0: # if not stopband, get relative deviation
@@ -140,10 +142,10 @@ def lporder (freq1, freq2, delta_p, delta_s):
class test_pm_remez(gr_unittest.TestCase):
def setUp(self):
- pass
+ pass
def tearDown(self):
- pass
+ pass
def test_low_pass(self):
gain = 1
@@ -184,4 +186,3 @@ class test_pm_remez(gr_unittest.TestCase):
if __name__ == '__main__':
gr_unittest.run(test_pm_remez, "test_pm_remez.xml")
-
diff --git a/gr-filter/python/filter/qa_rational_resampler.py b/gr-filter/python/filter/qa_rational_resampler.py
index a03673d76..c413bb10e 100755..100644
--- a/gr-filter/python/filter/qa_rational_resampler.py
+++ b/gr-filter/python/filter/qa_rational_resampler.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+
from gnuradio import gr, gr_unittest, filter, blocks
import math
import random
@@ -28,7 +31,7 @@ import sys
def random_floats(n):
r = []
- for x in xrange(n):
+ for x in range(n):
# r.append(float(random.randint(-32768, 32768)))
r.append(float(random.random()))
return tuple(r)
@@ -72,10 +75,10 @@ def reference_interp_dec_filter(src_data, interp, decim, taps):
class test_rational_resampler (gr_unittest.TestCase):
def setUp(self):
- random.seed(0)
+ random.seed(0)
def tearDown(self):
- pass
+ pass
def test_000_1_to_1(self):
@@ -84,7 +87,7 @@ class test_rational_resampler (gr_unittest.TestCase):
xr = (1186, -112, 339, -460, -167, 582)
expected_result = tuple([float(x) for x in xr])
- tb = gr.top_block()
+ tb = gr.top_block()
src = blocks.vector_source_f(src_data)
op = filter.rational_resampler_base_fff(1, 1, taps)
dst = blocks.vector_sink_f()
@@ -107,7 +110,7 @@ class test_rational_resampler (gr_unittest.TestCase):
1700.0,17000.0,170000.0, 0.0)
expected_result = tuple([float(x) for x in xr])
- tb = gr.top_block()
+ tb = gr.top_block()
src = blocks.vector_source_f(src_data)
op = filter.rational_resampler_base_fff(interpolation, 1, taps)
dst = blocks.vector_sink_f()
@@ -124,7 +127,7 @@ class test_rational_resampler (gr_unittest.TestCase):
expected_result = reference_interp_filter(src_data, interpolation, taps)
- tb = gr.top_block()
+ tb = gr.top_block()
src = blocks.vector_source_f(src_data)
op = filter.rational_resampler_base_fff(interpolation, 1, taps)
dst = blocks.vector_sink_f()
@@ -144,7 +147,7 @@ class test_rational_resampler (gr_unittest.TestCase):
expected_result = reference_dec_filter(src_data, decimation, taps)
- tb = gr.top_block()
+ tb = gr.top_block()
src = blocks.vector_source_f(src_data)
op = filter.rational_resampler_base_fff(1, decimation, taps)
dst = blocks.vector_sink_f()
@@ -155,8 +158,8 @@ class test_rational_resampler (gr_unittest.TestCase):
N = 10
offset = 10#len(taps)-1
- print expected_result[100+offset:100+offset+N]
- print result_data[100:100+N]
+ print(expected_result[100+offset:100+offset+N])
+ print(result_data[100:100+N])
#self.assertEqual(expected_result[offset:offset+N], result_data[0:N])
# FIXME disabled. Triggers hang on SuSE 10.0
@@ -167,9 +170,9 @@ class test_rational_resampler (gr_unittest.TestCase):
random.seed(0) # we want reproducibility
- for ntaps in xrange(1, MAX_TAPS + 1):
- for decim in xrange(1, MAX_DECIM+1):
- for ilen in xrange(ntaps + decim, ntaps + OUTPUT_LEN*decim):
+ for ntaps in range(1, MAX_TAPS + 1):
+ for decim in range(1, MAX_DECIM+1):
+ for ilen in range(ntaps + decim, ntaps + OUTPUT_LEN*decim):
src_data = random_floats(ilen)
taps = random_floats(ntaps)
expected_result = reference_dec_filter(src_data, decim, taps)
@@ -201,9 +204,9 @@ class test_rational_resampler (gr_unittest.TestCase):
random.seed(0) # we want reproducibility
- for ntaps in xrange(1, MAX_TAPS + 1):
- for interp in xrange(1, MAX_INTERP+1):
- for ilen in xrange(ntaps, ntaps + INPUT_LEN):
+ for ntaps in range(1, MAX_TAPS + 1):
+ for interp in range(1, MAX_INTERP+1):
+ for ilen in range(ntaps, ntaps + INPUT_LEN):
src_data = random_floats(ilen)
taps = random_floats(ntaps)
expected_result = reference_interp_filter(src_data, interp, taps)
@@ -236,7 +239,7 @@ class test_rational_resampler (gr_unittest.TestCase):
expected_result = reference_interp_dec_filter(src_data, interp, decimation, taps)
- tb = gr.top_block()
+ tb = gr.top_block()
src = blocks.vector_source_f(src_data)
op = filter.rational_resampler_base_fff(interp, decimation, taps)
dst = blocks.vector_sink_f()
@@ -246,11 +249,10 @@ class test_rational_resampler (gr_unittest.TestCase):
result_data = dst.data()
N = 1000
- offset = len(taps)/2
+ offset = len(taps) // 2
self.assertFloatTuplesAlmostEqual(expected_result[offset:offset+N], result_data[0:N], 5)
if __name__ == '__main__':
# FIXME: Disabled, see ticket:210
gr_unittest.run(test_rational_resampler, "test_rational_resampler.xml")
-
diff --git a/gr-filter/python/filter/qa_single_pole_iir.py b/gr-filter/python/filter/qa_single_pole_iir.py
index 5ca9bcdb4..a1f7cddb4 100755..100644
--- a/gr-filter/python/filter/qa_single_pole_iir.py
+++ b/gr-filter/python/filter/qa_single_pole_iir.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, filter, blocks
class test_single_pole_iir_filter(gr_unittest.TestCase):
diff --git a/gr-filter/python/filter/rational_resampler.py b/gr-filter/python/filter/rational_resampler.py
index 961ffc688..fb07e26c0 100644
--- a/gr-filter/python/filter/rational_resampler.py
+++ b/gr-filter/python/filter/rational_resampler.py
@@ -19,11 +19,16 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
from gnuradio import gr, gru
-import filter_swig as filter
+from . import filter_swig as filter
_plot = None
+
def design_filter(interpolation, decimation, fractional_bw):
"""
Given the interpolation rate, decimation rate and a fractional bandwidth,
@@ -38,17 +43,17 @@ def design_filter(interpolation, decimation, fractional_bw):
"""
if fractional_bw >= 0.5 or fractional_bw <= 0:
- raise ValueError, "Invalid fractional_bandwidth, must be in (0, 0.5)"
+ raise ValueError("Invalid fractional_bandwidth, must be in (0, 0.5)")
beta = 7.0
halfband = 0.5
- rate = float(interpolation)/float(decimation)
+ rate = float(interpolation) / float(decimation)
if(rate >= 1.0):
trans_width = halfband - fractional_bw
- mid_transition_band = halfband - trans_width/2.0
+ mid_transition_band = halfband - trans_width / 2.0
else:
trans_width = rate*(halfband - fractional_bw)
- mid_transition_band = rate*halfband - trans_width/2.0
+ mid_transition_band = rate*halfband - trans_width / 2.0
taps = filter.firdes.low_pass(interpolation, # gain
interpolation, # Fs
@@ -82,10 +87,10 @@ class _rational_resampler_base(gr.hier_block2):
"""
if not isinstance(interpolation, int) or interpolation < 1:
- raise ValueError, "interpolation must be an integer >= 1"
+ raise ValueError("interpolation must be an integer >= 1")
if not isinstance(decimation, int) or decimation < 1:
- raise ValueError, "decimation must be an integer >= 1"
+ raise ValueError("decimation must be an integer >= 1")
if taps is None and fractional_bw is None:
fractional_bw = 0.4
@@ -108,11 +113,11 @@ class _rational_resampler_base(gr.hier_block2):
taps = design_filter(interpolation, decimation, fractional_bw)
self.resampler = resampler_base(interpolation, decimation, taps)
- gr.hier_block2.__init__(self, "rational_resampler",
- gr.io_signature(1, 1, self.resampler.input_signature().sizeof_stream_item(0)),
- gr.io_signature(1, 1, self.resampler.output_signature().sizeof_stream_item(0)))
+ gr.hier_block2.__init__(self, "rational_resampler",
+ gr.io_signature(1, 1, self.resampler.input_signature().sizeof_stream_item(0)),
+ gr.io_signature(1, 1, self.resampler.output_signature().sizeof_stream_item(0)))
- self.connect(self, self.resampler, self)
+ self.connect(self, self.resampler, self)
def taps(self):
return self.resampler.taps()
@@ -124,7 +129,7 @@ class rational_resampler_fff(_rational_resampler_base):
float input, float output and float taps.
"""
_rational_resampler_base.__init__(self, filter.rational_resampler_base_fff,
- interpolation, decimation, taps, fractional_bw)
+ interpolation, decimation, taps, fractional_bw)
class rational_resampler_ccf(_rational_resampler_base):
def __init__(self, interpolation, decimation, taps=None, fractional_bw=None):
diff --git a/gr-qtgui/apps/gr_constellation_plot b/gr-qtgui/apps/gr_constellation_plot
index ff5db1a9a..8ca7104a6 100755
--- a/gr-qtgui/apps/gr_constellation_plot
+++ b/gr-qtgui/apps/gr_constellation_plot
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+
from gnuradio import gr
from gnuradio import blocks
from gnuradio.eng_arg import eng_float, intx
@@ -31,13 +33,13 @@ try:
from PyQt4 import QtGui, QtCore
import sip
except ImportError:
- print "Error: Program requires PyQt4 and gr-qtgui."
+ print("Error: Program requires PyQt4 and gr-qtgui.")
sys.exit(1)
try:
import scipy
except ImportError:
- print "Error: Scipy required (www.scipy.org)."
+ print("Error: Scipy required (www.scipy.org).")
sys.exit(1)
try:
@@ -166,7 +168,7 @@ def main():
tb = my_top_block(filelist, args.start, nsamples, max_nsamples);
main_box = plot_constellation_form(tb, 'GNU Radio Constellation Plot', 10000.0)
- for n in xrange(tb._nsigs):
+ for n in range(tb._nsigs):
main_box._style_edit[n].setCurrentIndex(0)
main_box.show()
diff --git a/gr-qtgui/apps/plot_base.py b/gr-qtgui/apps/plot_base.py
index 7a039e213..ce409000b 100644
--- a/gr-qtgui/apps/plot_base.py
+++ b/gr-qtgui/apps/plot_base.py
@@ -20,6 +20,10 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
from gnuradio import gr, blocks
import os, sys
@@ -30,13 +34,13 @@ try:
from PyQt4 import QtGui, QtCore
import sip
except ImportError:
- print "Error: Program requires PyQt4 and gr-qtgui."
+ print("Error: Program requires PyQt4 and gr-qtgui.")
sys.exit(1)
try:
import scipy
except ImportError:
- print "Error: Scipy required (www.scipy.org)."
+ print("Error: Scipy required (www.scipy.org).")
sys.exit(1)
try:
@@ -64,8 +68,8 @@ def read_samples(filename, start, in_size, min_size, dtype, dtype_size):
if(min_size > 0):
if(len(data) < in_size):
- print "Warning: read in {0} samples but asked for {1} samples.".format(
- len(data), in_size)
+ print("Warning: read in {0} samples but asked for {1} samples.".format(
+ len(data), in_size))
else:
# If we have to, append 0's to create min_size samples of data
if(len(data) < min_size):
@@ -108,8 +112,8 @@ def read_samples_c(filename, start, in_size, min_size=0):
if(min_size > 0):
if(len(data) < in_size):
- print "Warning: read in {0} samples but asked for {1} samples.".format(
- len(data), in_size)
+ print("Warning: read in {0} samples but asked for {1} samples.".format(
+ len(data), in_size))
else:
# If we have to, append 0's to create min_size samples of data
if(len(data) < min_size):
@@ -119,9 +123,9 @@ def read_samples_c(filename, start, in_size, min_size=0):
class source_ints_to_float(gr.hier_block2):
def __init__(self, data):
- gr.hier_block2.__init__(self, "ints_to_floats",
- gr.io_signature(0, 0, 0),
- gr.io_signature(1, 1, gr.sizeof_float))
+ gr.hier_block2.__init__(self, "ints_to_floats",
+ gr.io_signature(0, 0, 0),
+ gr.io_signature(1, 1, gr.sizeof_float))
self.src = blocks.vector_source_i(data)
self.cvt = blocks.int_to_float()
self.connect(self.src, self.cvt, self)
@@ -131,9 +135,9 @@ class source_ints_to_float(gr.hier_block2):
class source_shorts_to_float(gr.hier_block2):
def __init__(self, data):
- gr.hier_block2.__init__(self, "shorts_to_floats",
- gr.io_signature(0, 0, 0),
- gr.io_signature(1, 1, gr.sizeof_float))
+ gr.hier_block2.__init__(self, "shorts_to_floats",
+ gr.io_signature(0, 0, 0),
+ gr.io_signature(1, 1, gr.sizeof_float))
self.src = blocks.vector_source_s(data)
self.cvt = blocks.short_to_float()
self.connect(self.src, self.cvt, self)
@@ -143,9 +147,9 @@ class source_shorts_to_float(gr.hier_block2):
class source_chars_to_float(gr.hier_block2):
def __init__(self, data):
- gr.hier_block2.__init__(self, "chars_to_floats",
- gr.io_signature(0, 0, 0),
- gr.io_signature(1, 1, gr.sizeof_float))
+ gr.hier_block2.__init__(self, "chars_to_floats",
+ gr.io_signature(0, 0, 0),
+ gr.io_signature(1, 1, gr.sizeof_float))
self.src = blocks.vector_source_b(data)
self.cvt = blocks.char_to_float()
self.connect(self.src, self.cvt, self)
diff --git a/gr-qtgui/apps/plot_constellation_form.py b/gr-qtgui/apps/plot_constellation_form.py
index 01c6ed186..81cb76e23 100644
--- a/gr-qtgui/apps/plot_constellation_form.py
+++ b/gr-qtgui/apps/plot_constellation_form.py
@@ -20,6 +20,10 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
import sys
from gnuradio import filter
@@ -27,7 +31,7 @@ try:
from PyQt4 import QtGui, QtCore
import sip
except ImportError:
- print "Error: Program requires PyQt4."
+ print("Error: Program requires PyQt4.")
sys.exit(1)
try:
@@ -48,8 +52,8 @@ class plot_constellation_form(plot_form):
# Set the bar to go from 0.001 to max
self.ybar.setMinimum(1)
self.ybar.setMaximum(self._pos_scale*self.top_block._y_max)
- self.ybar.setSingleStep(self._pos_scale*(max(self.top_block._y_range/10, 0.010)))
- self.ybar.setPageStep(self._pos_scale*(max(self.top_block._y_range/2, 0.010)))
+ self.ybar.setSingleStep(self._pos_scale*(max(self.top_block._y_range / 10, 0.010)))
+ self.ybar.setPageStep(self._pos_scale*(max(self.top_block._y_range / 2, 0.010)))
self.auto_scale = QtGui.QCheckBox("Auto Scale", self)
if(self.top_block._auto_scale):
diff --git a/gr-qtgui/apps/plot_form.py b/gr-qtgui/apps/plot_form.py
index 931565bd3..af262b97c 100644
--- a/gr-qtgui/apps/plot_form.py
+++ b/gr-qtgui/apps/plot_form.py
@@ -20,11 +20,15 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
try:
from PyQt4 import QtGui, QtCore
import sip
except ImportError:
- print "Error: Program requires PyQt4."
+ print("Error: Program requires PyQt4.")
sys.exit(1)
import numpy
@@ -129,8 +133,8 @@ class plot_form(QtGui.QWidget):
self.ybar = QtGui.QSlider(QtCore.Qt.Vertical, self)
self.ybar.setMinimum(self._pos_scale*_ymin)
self.ybar.setMaximum(self._pos_scale*_ymax)
- self.ybar.setSingleStep(self._pos_scale*(_yrng/10))
- self.ybar.setPageStep(self._pos_scale*(_yrng/2))
+ self.ybar.setSingleStep(self._pos_scale*(_yrng / 10))
+ self.ybar.setPageStep(self._pos_scale*(_yrng / 2))
self.ybar.setValue(self._pos_scale*_ymax)
self.connect(self.ybar, QtCore.SIGNAL("valueChanged(int)"),
self.update_yaxis_slider)
@@ -171,7 +175,7 @@ class plot_form(QtGui.QWidget):
self._style_edit = []
self._marker_edit = []
self._alpha_edit = []
- for n in xrange(self.top_block._nsigs):
+ for n in range(self.top_block._nsigs):
self._line_pages.append(QtGui.QDialog())
self._line_forms.append(QtGui.QFormLayout(self._line_pages[-1]))
@@ -341,7 +345,7 @@ class plot_form(QtGui.QWidget):
def update_yaxis_slider(self, value):
if(not self.top_block._auto_scale):
- value = value/self._pos_scale
+ value = value / self._pos_scale
self.top_block._y_value = value
self._y_min = value - self.top_block._y_range
self._y_max = value
diff --git a/gr-qtgui/apps/plot_psd_base.py b/gr-qtgui/apps/plot_psd_base.py
index c3c03ec97..896371aff 100644
--- a/gr-qtgui/apps/plot_psd_base.py
+++ b/gr-qtgui/apps/plot_psd_base.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
+
from gnuradio import gr, blocks
from gnuradio.eng_arg import eng_float, intx
from argparse import ArgumentParser
@@ -30,13 +33,13 @@ try:
from PyQt4 import QtGui, QtCore
import sip
except ImportError:
- print "Error: Program requires PyQt4 and gr-qtgui."
+ print("Error: Program requires PyQt4 and gr-qtgui.")
sys.exit(1)
try:
import scipy
except ImportError:
- print "Error: Scipy required (www.scipy.org)."
+ print("Error: Scipy required (www.scipy.org).")
sys.exit(1)
try:
@@ -76,8 +79,8 @@ class plot_base(gr.top_block):
n = 0
self.srcs = list()
- self._data_min = sys.maxint
- self._data_max = -sys.maxint - 1
+ self._data_min = sys.maxsize
+ self._data_max = -sys.maxsize - 1
for f in self._filelist:
data,_min,_max = self.read_samples(f, self._start,
self._nsamps, self._psd_size)
@@ -127,8 +130,8 @@ class plot_base(gr.top_block):
self._start = newstart
- self._data_min = sys.maxint
- self._data_max = -sys.maxint - 1
+ self._data_min = sys.maxsize
+ self._data_max = -sys.maxsize - 1
for s,f in zip(self.srcs, self._filelist):
data,_min,_max = self.read_samples(f, self._start, newnsamps, self._psd_size)
if(_min < self._data_min):
diff --git a/gr-qtgui/apps/plot_psd_form.py b/gr-qtgui/apps/plot_psd_form.py
index 2d1fcd10b..93166f4fa 100644
--- a/gr-qtgui/apps/plot_psd_form.py
+++ b/gr-qtgui/apps/plot_psd_form.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
+
import sys
from gnuradio import filter
@@ -27,7 +30,7 @@ try:
from PyQt4 import QtGui, QtCore
import sip
except ImportError:
- print "Error: Program requires PyQt4."
+ print("Error: Program requires PyQt4.")
sys.exit(1)
try:
diff --git a/gr-qtgui/apps/plot_spectrogram_base.py b/gr-qtgui/apps/plot_spectrogram_base.py
index f56810071..3527f3fa7 100644
--- a/gr-qtgui/apps/plot_spectrogram_base.py
+++ b/gr-qtgui/apps/plot_spectrogram_base.py
@@ -20,6 +20,10 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
from gnuradio import gr, blocks
from gnuradio.eng_arg import eng_float, intx
from argparse import ArgumentParser
@@ -30,13 +34,13 @@ try:
from PyQt4 import QtGui, QtCore
import sip
except ImportError:
- print "Error: Program requires PyQt4 and gr-qtgui."
+ print("Error: Program requires PyQt4 and gr-qtgui.")
sys.exit(1)
try:
import scipy
except ImportError:
- print "Error: Scipy required (www.scipy.org)."
+ print("Error: Scipy required (www.scipy.org).")
sys.exit(1)
try:
@@ -76,8 +80,8 @@ class plot_base(gr.top_block):
n = 0
self.srcs = list()
- self._data_min = sys.maxint
- self._data_max = -sys.maxint - 1
+ self._data_min = sys.maxsize
+ self._data_max = -sys.maxsize - 1
for f in self._filelist:
data,_min,_max = self.read_samples(f, self._start,
self._nsamps, self._psd_size)
@@ -100,7 +104,7 @@ class plot_base(gr.top_block):
self.connect(s, (self.gui_snk, i+1))
self.gui_snk.set_update_time(0);
- self.gui_snk.set_time_per_fft(self._psd_size/self._samp_rate)
+ self.gui_snk.set_time_per_fft(self._psd_size / self._samp_rate)
self.gui_snk.enable_menu(False)
self.gui_snk.set_fft_average(self._avg)
@@ -127,13 +131,13 @@ class plot_base(gr.top_block):
self.stop()
self.wait()
self.gui_snk.clear_data()
- self.gui_snk.set_time_per_fft(self._psd_size/self._samp_rate)
+ self.gui_snk.set_time_per_fft(self._psd_size / self._samp_rate)
self._start = newstart
self._nsamps = newnsamps
- self._data_min = sys.maxint
- self._data_max = -sys.maxint - 1
+ self._data_min = sys.maxsize
+ self._data_max = -sys.maxsize - 1
for s,f in zip(self.srcs, self._filelist):
data,_min,_max = self.read_samples(f, self._start, newnsamps, self._psd_size)
if(_min < self._data_min):
diff --git a/gr-qtgui/apps/plot_spectrogram_form.py b/gr-qtgui/apps/plot_spectrogram_form.py
index 17cb0335b..6d1b17de6 100644
--- a/gr-qtgui/apps/plot_spectrogram_form.py
+++ b/gr-qtgui/apps/plot_spectrogram_form.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
+
import sys
from gnuradio import filter
@@ -27,7 +30,7 @@ try:
from PyQt4 import QtGui, QtCore
import sip
except ImportError:
- print "Error: Program requires PyQt4."
+ print("Error: Program requires PyQt4.")
sys.exit(1)
try:
@@ -113,7 +116,7 @@ class plot_spectrogram_form(plot_form):
self._style_edit = []
self._marker_edit = []
self._alpha_edit = []
- for n in xrange(self.top_block._nsigs):
+ for n in range(self.top_block._nsigs):
self._line_pages.append(QtGui.QDialog())
self._line_forms.append(QtGui.QFormLayout(self._line_pages[-1]))
diff --git a/gr-qtgui/apps/plot_time_base.py b/gr-qtgui/apps/plot_time_base.py
index cfbe5dc6c..7078e332c 100644
--- a/gr-qtgui/apps/plot_time_base.py
+++ b/gr-qtgui/apps/plot_time_base.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
+
from gnuradio import gr, blocks
from gnuradio.eng_arg import eng_float, intx
from argparse import ArgumentParser
@@ -30,13 +33,13 @@ try:
from PyQt4 import QtGui, QtCore
import sip
except ImportError:
- print "Error: Program requires PyQt4 and gr-qtgui."
+ print("Error: Program requires PyQt4 and gr-qtgui.")
sys.exit(1)
try:
import scipy
except ImportError:
- print "Error: Scipy required (www.scipy.org)."
+ print("Error: Scipy required (www.scipy.org).")
sys.exit(1)
try:
@@ -75,8 +78,8 @@ class plot_base(gr.top_block):
n = 0
self.srcs = list()
- self._data_min = sys.maxint
- self._data_max = -sys.maxint - 1
+ self._data_min = sys.maxsize
+ self._data_max = -sys.maxsize - 1
for f in self._filelist:
data,_min,_max = self.read_samples(f, self._start, self._nsamps)
if(_min < self._data_min):
@@ -131,8 +134,8 @@ class plot_base(gr.top_block):
self._start = newstart
- self._data_min = sys.maxint
- self._data_max = -sys.maxint - 1
+ self._data_min = sys.maxsize
+ self._data_max = -sys.maxsize - 1
for s,f in zip(self.srcs, self._filelist):
data,_min,_max = self.read_samples(f, self._start, newnsamps)
if(_min < self._data_min):
diff --git a/gr-qtgui/apps/plot_time_form.py b/gr-qtgui/apps/plot_time_form.py
index 0ab94e6cf..0a16aa624 100644
--- a/gr-qtgui/apps/plot_time_form.py
+++ b/gr-qtgui/apps/plot_time_form.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
+
import sys
from gnuradio import filter
@@ -27,7 +30,7 @@ try:
from PyQt4 import QtGui, QtCore
import sip
except ImportError:
- print "Error: Program requires PyQt4."
+ print("Error: Program requires PyQt4.")
sys.exit(1)
try:
@@ -70,7 +73,7 @@ class plot_time_form(plot_form):
index = self._qwtmarkers['Circle']+1
else:
index = self._qwtmarkers['None']+1
- for n in xrange(self.top_block._nsigs):
+ for n in range(self.top_block._nsigs):
self._marker_edit[n].setCurrentIndex(index)
def update_samp_rate(self):
diff --git a/gr-qtgui/apps/plot_time_raster_base.py b/gr-qtgui/apps/plot_time_raster_base.py
index e84b84c29..4eb6ec461 100644
--- a/gr-qtgui/apps/plot_time_raster_base.py
+++ b/gr-qtgui/apps/plot_time_raster_base.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
+
from gnuradio import gr, blocks
from gnuradio.eng_arg import eng_float, intx
from argparse import ArgumentParser
@@ -30,13 +33,13 @@ try:
from PyQt4 import QtGui, QtCore
import sip
except ImportError:
- print "Error: Program requires PyQt4 and gr-qtgui."
+ print("Error: Program requires PyQt4 and gr-qtgui.")
sys.exit(1)
try:
import scipy
except ImportError:
- print "Error: Scipy required (www.scipy.org)."
+ print("Error: Scipy required (www.scipy.org).")
sys.exit(1)
try:
@@ -75,8 +78,8 @@ class plot_base(gr.top_block):
n = 0
self.srcs = list()
- self._data_min = sys.maxint
- self._data_max = -sys.maxint - 1
+ self._data_min = sys.maxsize
+ self._data_max = -sys.maxsize - 1
for f in self._filelist:
data,_min,_max = self.read_samples(f, self._start, self._nsamps)
if(_min < self._data_min):
@@ -129,8 +132,8 @@ class plot_base(gr.top_block):
self._start = newstart
- self._data_min = sys.maxint
- self._data_max = -sys.maxint - 1
+ self._data_min = sys.maxsize
+ self._data_max = -sys.maxsize - 1
for s,f in zip(self.srcs, self._filelist):
data,_min,_max = self.read_samples(f, self._start, newnsamps)
if(_min < self._data_min):
diff --git a/gr-qtgui/apps/plot_time_raster_form.py b/gr-qtgui/apps/plot_time_raster_form.py
index 32fbba076..fd27d9574 100644
--- a/gr-qtgui/apps/plot_time_raster_form.py
+++ b/gr-qtgui/apps/plot_time_raster_form.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
+
import sys, math
from gnuradio import filter
@@ -27,7 +30,7 @@ try:
from PyQt4 import QtGui, QtCore
import sip
except ImportError:
- print "Error: Program requires PyQt4."
+ print("Error: Program requires PyQt4.")
sys.exit(1)
try:
@@ -81,7 +84,7 @@ class plot_time_raster_form(plot_form):
self._style_edit = []
self._marker_edit = []
self._alpha_edit = []
- for n in xrange(self.top_block._nsigs):
+ for n in range(self.top_block._nsigs):
self._line_pages.append(QtGui.QDialog())
self._line_forms.append(QtGui.QFormLayout(self._line_pages[-1]))
@@ -153,5 +156,3 @@ class plot_time_raster_form(plot_form):
nsamps = int(math.ceil(self.top_block._ncols*(n+1)))
self.top_block.reset(self._start, nsamps)
-
-
diff --git a/gr-qtgui/apps/uhd_display.py b/gr-qtgui/apps/uhd_display.py
index 0e0c8a177..58494f3af 100755..100644
--- a/gr-qtgui/apps/uhd_display.py
+++ b/gr-qtgui/apps/uhd_display.py
@@ -20,6 +20,9 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import filter
from gnuradio import blocks
@@ -34,14 +37,14 @@ try:
from PyQt4 import QtGui, QtCore
import sip
except ImportError:
- print "Error: Program requires PyQt4 and gr-qtgui."
+ print("Error: Program requires PyQt4 and gr-qtgui.")
sys.exit(1)
try:
from usrp_display_qtgui import Ui_MainWindow
except ImportError:
- print "Error: could not find usrp_display_qtgui.py:"
- print "\t\"pyuic4 usrp_display_qtgui.ui -o usrp_display_qtgui.py\""
+ print("Error: could not find usrp_display_qtgui.py:")
+ print("\t\"pyuic4 usrp_display_qtgui.ui -o usrp_display_qtgui.py\"")
sys.exit(1)
@@ -182,13 +185,13 @@ class my_top_block(gr.top_block):
if options.gain is None:
# if no gain was specified, use the mid-point in dB
g = self.u.get_gain_range()
- options.gain = float(g.start()+g.stop())/2
+ options.gain = float(g.start()+g.stop()) / 2
self.set_gain(options.gain)
if options.freq is None:
# if no freq was specified, use the mid-point
r = self.u.get_freq_range()
- options.freq = float(r.start()+r.stop())/2
+ options.freq = float(r.start()+r.stop()) / 2
self.set_frequency(options.freq)
self._fftsize = options.fft_size
@@ -212,9 +215,9 @@ class my_top_block(gr.top_block):
self.connect(self.u, self.amp, self.snk)
if self.show_debug_info:
- print "Bandwidth: ", self.u.get_samp_rate()
- print "Center Freq: ", self.u.get_center_freq()
- print "Freq Range: ", self.u.get_freq_range()
+ print("Bandwidth: ", self.u.get_samp_rate())
+ print("Center Freq: ", self.u.get_center_freq())
+ print("Freq Range: ", self.u.get_freq_range())
# Get the reference pointer to the SpectrumDisplayForm QWidget
# Wrap the pointer as a PyQt SIP object
diff --git a/gr-qtgui/apps/usrp_display_qtgui.py b/gr-qtgui/apps/usrp_display_qtgui.py
index 4c9de3a53..68c5d6cfb 100644
--- a/gr-qtgui/apps/usrp_display_qtgui.py
+++ b/gr-qtgui/apps/usrp_display_qtgui.py
@@ -7,6 +7,7 @@
#
# WARNING! All changes made in this file will be lost!
+from __future__ import unicode_literals
from PyQt4 import QtCore, QtGui
class Ui_MainWindow(object):
diff --git a/gr-qtgui/examples/pyqt_const_c.py b/gr-qtgui/examples/pyqt_const_c.py
index 0bb6c20d5..e789e013b 100755..100644
--- a/gr-qtgui/examples/pyqt_const_c.py
+++ b/gr-qtgui/examples/pyqt_const_c.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import gr, filter
from gnuradio import blocks
import sys
@@ -109,14 +111,14 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq1Edit.text())
self.signal1.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp1EditText(self):
try:
newamp = float(self.amp1Edit.text())
self.signal1.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
def freq2EditText(self):
@@ -124,14 +126,14 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq2Edit.text())
self.signal2.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp2EditText(self):
try:
newamp = float(self.amp2Edit.text())
self.signal2.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
class my_top_block(gr.top_block):
diff --git a/gr-qtgui/examples/pyqt_example_c.py b/gr-qtgui/examples/pyqt_example_c.py
index 89ca7b282..5854d968c 100755..100644
--- a/gr-qtgui/examples/pyqt_example_c.py
+++ b/gr-qtgui/examples/pyqt_example_c.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import gr, filter
from gnuradio import blocks
import sys
@@ -110,14 +112,14 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq1Edit.text())
self.signal1.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp1EditText(self):
try:
newamp = float(self.amp1Edit.text())
self.signal1.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
def freq2EditText(self):
@@ -125,14 +127,14 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq2Edit.text())
self.signal2.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp2EditText(self):
try:
newamp = float(self.amp2Edit.text())
self.signal2.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
class my_top_block(gr.top_block):
diff --git a/gr-qtgui/examples/pyqt_example_f.py b/gr-qtgui/examples/pyqt_example_f.py
index 77a7478aa..e2f41b57c 100755..100644
--- a/gr-qtgui/examples/pyqt_example_f.py
+++ b/gr-qtgui/examples/pyqt_example_f.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import gr, filter
from gnuradio import blocks
import sys
@@ -104,14 +106,14 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq1Edit.text())
self.signal1.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp1EditText(self):
try:
newamp = float(self.amp1Edit.text())
self.signal1.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
def freq2EditText(self):
@@ -119,14 +121,14 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq2Edit.text())
self.signal2.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp2EditText(self):
try:
newamp = float(self.amp2Edit.text())
self.signal2.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
class my_top_block(gr.top_block):
diff --git a/gr-qtgui/examples/pyqt_freq_c.py b/gr-qtgui/examples/pyqt_freq_c.py
index 954a078df..9140bbb88 100755..100644
--- a/gr-qtgui/examples/pyqt_freq_c.py
+++ b/gr-qtgui/examples/pyqt_freq_c.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import gr, filter
from gnuradio import blocks
import sys
@@ -110,14 +112,14 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq1Edit.text())
self.signal1.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp1EditText(self):
try:
newamp = float(self.amp1Edit.text())
self.signal1.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
def freq2EditText(self):
@@ -125,14 +127,14 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq2Edit.text())
self.signal2.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp2EditText(self):
try:
newamp = float(self.amp2Edit.text())
self.signal2.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
class my_top_block(gr.top_block):
diff --git a/gr-qtgui/examples/pyqt_freq_f.py b/gr-qtgui/examples/pyqt_freq_f.py
index d7d389b73..06a6d95b0 100755..100644
--- a/gr-qtgui/examples/pyqt_freq_f.py
+++ b/gr-qtgui/examples/pyqt_freq_f.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import gr, filter
from gnuradio import blocks
import sys
@@ -105,14 +107,14 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq1Edit.text())
self.signal1.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp1EditText(self):
try:
newamp = float(self.amp1Edit.text())
self.signal1.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
def freq2EditText(self):
@@ -120,14 +122,14 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq2Edit.text())
self.signal2.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp2EditText(self):
try:
newamp = float(self.amp2Edit.text())
self.signal2.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
class my_top_block(gr.top_block):
diff --git a/gr-qtgui/examples/pyqt_histogram_f.py b/gr-qtgui/examples/pyqt_histogram_f.py
index 81f7b9d40..cf2f59b9a 100755..100644
--- a/gr-qtgui/examples/pyqt_histogram_f.py
+++ b/gr-qtgui/examples/pyqt_histogram_f.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
import sys
@@ -118,21 +120,21 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq1Edit.text())
self.signal1.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp1EditText(self):
try:
newamp = float(self.amp1Edit.text())
self.signal1.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
def amp2EditText(self):
try:
newamp = float(self.amp2Edit.text())
self.signal2.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
def set_nsamps(self):
res = self.hist_npts.text().toInt()
diff --git a/gr-qtgui/examples/pyqt_time_c.py b/gr-qtgui/examples/pyqt_time_c.py
index b595c8ff8..8196b62dc 100755..100644
--- a/gr-qtgui/examples/pyqt_time_c.py
+++ b/gr-qtgui/examples/pyqt_time_c.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
import sys
@@ -110,14 +112,14 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq1Edit.text())
self.signal1.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp1EditText(self):
try:
newamp = float(self.amp1Edit.text())
self.signal1.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
def freq2EditText(self):
@@ -125,14 +127,14 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq2Edit.text())
self.signal2.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp2EditText(self):
try:
newamp = float(self.amp2Edit.text())
self.signal2.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
class my_top_block(gr.top_block):
diff --git a/gr-qtgui/examples/pyqt_time_f.py b/gr-qtgui/examples/pyqt_time_f.py
index 3689ebff5..9fc9dd5e4 100755..100644
--- a/gr-qtgui/examples/pyqt_time_f.py
+++ b/gr-qtgui/examples/pyqt_time_f.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
import sys
@@ -104,14 +106,14 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq1Edit.text())
self.signal1.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp1EditText(self):
try:
newamp = float(self.amp1Edit.text())
self.signal1.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
def freq2EditText(self):
@@ -119,14 +121,14 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq2Edit.text())
self.signal2.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp2EditText(self):
try:
newamp = float(self.amp2Edit.text())
self.signal2.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
class my_top_block(gr.top_block):
diff --git a/gr-qtgui/examples/pyqt_time_raster_b.py b/gr-qtgui/examples/pyqt_time_raster_b.py
index 7a9440028..278cb90ed 100755..100644
--- a/gr-qtgui/examples/pyqt_time_raster_b.py
+++ b/gr-qtgui/examples/pyqt_time_raster_b.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
from gnuradio import blocks
@@ -30,7 +32,7 @@ try:
from PyQt5 import QtWidgets, Qt
import sip
except ImportError:
- print "Error: Program requires PyQt5 and gr-qtgui."
+ print("Error: Program requires PyQt5 and gr-qtgui.")
sys.exit(1)
class dialog_box(QtWidgets.QWidget):
diff --git a/gr-qtgui/examples/pyqt_time_raster_f.py b/gr-qtgui/examples/pyqt_time_raster_f.py
index 0f9de94bc..249ec0701 100755..100644
--- a/gr-qtgui/examples/pyqt_time_raster_f.py
+++ b/gr-qtgui/examples/pyqt_time_raster_f.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import blocks
import sys
@@ -29,7 +31,7 @@ try:
from PyQt5 import QtWidgets, Qt
import sip
except ImportError:
- print "Error: Program requires PyQt5 and gr-qtgui."
+ print("Error: Program requires PyQt5 and gr-qtgui.")
sys.exit(1)
class dialog_box(QtWidgets.QWidget):
diff --git a/gr-qtgui/examples/pyqt_waterfall_c.py b/gr-qtgui/examples/pyqt_waterfall_c.py
index 3f7119f97..2c183a99a 100755..100644
--- a/gr-qtgui/examples/pyqt_waterfall_c.py
+++ b/gr-qtgui/examples/pyqt_waterfall_c.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import gr, filter
from gnuradio import blocks
import sys
@@ -110,14 +112,14 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq1Edit.text())
self.signal1.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp1EditText(self):
try:
newamp = float(self.amp1Edit.text())
self.signal1.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
def freq2EditText(self):
@@ -125,14 +127,14 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq2Edit.text())
self.signal2.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp2EditText(self):
try:
newamp = float(self.amp2Edit.text())
self.signal2.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
class my_top_block(gr.top_block):
diff --git a/gr-qtgui/examples/pyqt_waterfall_f.py b/gr-qtgui/examples/pyqt_waterfall_f.py
index 71c72afad..660e7595f 100755..100644
--- a/gr-qtgui/examples/pyqt_waterfall_f.py
+++ b/gr-qtgui/examples/pyqt_waterfall_f.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
from gnuradio import gr, filter
from gnuradio import blocks
import sys
@@ -104,14 +106,14 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq1Edit.text())
self.signal1.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp1EditText(self):
try:
newamp = float(self.amp1Edit.text())
self.signal1.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
def freq2EditText(self):
@@ -119,14 +121,14 @@ class control_box(QtWidgets.QWidget):
newfreq = float(self.freq2Edit.text())
self.signal2.set_frequency(newfreq)
except ValueError:
- print "Bad frequency value entered"
+ print("Bad frequency value entered")
def amp2EditText(self):
try:
newamp = float(self.amp2Edit.text())
self.signal2.set_amplitude(newamp)
except ValueError:
- print "Bad amplitude value entered"
+ print("Bad amplitude value entered")
class my_top_block(gr.top_block):
diff --git a/gr-qtgui/grc/CMakeLists.txt b/gr-qtgui/grc/CMakeLists.txt
index 74e695863..f9ccf116c 100644
--- a/gr-qtgui/grc/CMakeLists.txt
+++ b/gr-qtgui/grc/CMakeLists.txt
@@ -18,30 +18,30 @@
# Boston, MA 02110-1301, USA.
########################################################################
-file(GLOB xml_files "*.xml")
+file(GLOB yml_files "*.yml")
-macro(REPLACE_IN_FILE _xml_block match replace)
- set(xml_block_src "${CMAKE_CURRENT_SOURCE_DIR}/${_xml_block}")
- set(xml_block "${CMAKE_CURRENT_BINARY_DIR}/${_xml_block}")
+macro(REPLACE_IN_FILE _yml_block match replace)
+ set(yml_block_src "${CMAKE_CURRENT_SOURCE_DIR}/${_yml_block}")
+ set(yml_block "${CMAKE_CURRENT_BINARY_DIR}/${_yml_block}")
- list(REMOVE_ITEM xml_files "${xml_block_src}")
- file(READ "${xml_block_src}" xml_block_src_text)
+ list(REMOVE_ITEM yml_files "${yml_block_src}")
+ file(READ "${yml_block_src}" yml_block_src_text)
string(REPLACE "${match}" "${replace}"
- xml_block_text "${xml_block_src_text}")
- file(WRITE "${xml_block}" "${xml_block_text}")
+ yml_block_text "${yml_block_src_text}")
+ file(WRITE "${yml_block}" "${yml_block_text}")
- list(APPEND generated_xml_files "${xml_block}")
+ list(APPEND generated_yml_files "${yml_block}")
endmacro()
if(DESIRED_QT_VERSION EQUAL 4)
- foreach(xml_block_src ${xml_files})
- get_filename_component(xml_block "${xml_block_src}" NAME)
- REPLACE_IN_FILE("${xml_block}" "PyQt5" "PyQt4")
+ foreach(yml_block_src ${yml_files})
+ get_filename_component(yml_block "${yml_block_src}" NAME)
+ REPLACE_IN_FILE("${yml_block}" "PyQt5" "PyQt4")
endforeach()
endif()
install(
- FILES ${xml_files} ${generated_xml_files}
+ FILES ${yml_files} ${generated_yml_files}
DESTINATION "${GRC_BLOCKS_DIR}"
)
diff --git a/gr-qtgui/grc/qtgui.tree.yml b/gr-qtgui/grc/qtgui.tree.yml
new file mode 100644
index 000000000..e479adf6a
--- /dev/null
+++ b/gr-qtgui/grc/qtgui.tree.yml
@@ -0,0 +1,23 @@
+'[Core]':
+- Instrumentation:
+ - QT:
+ - qtgui_freq_sink_x
+ - qtgui_time_sink_x
+ - qtgui_const_sink_x
+ - qtgui_waterfall_sink_x
+ - qtgui_time_raster_sink_x
+ - qtgui_bercurve_sink
+ - qtgui_histogram_sink_x
+ - qtgui_number_sink
+ - qtgui_vector_sink_f
+ - qtgui_sink_x
+- GUI Widgets:
+ - QT:
+ - qtgui_tab_widget
+ - variable_qtgui_range
+ - variable_qtgui_chooser
+ - variable_qtgui_check_box
+ - variable_qtgui_push_button
+ - variable_qtgui_entry
+ - variable_qtgui_label
+ - qtgui_edit_box_msg
diff --git a/gr-qtgui/grc/qtgui_ber_sink_b.block.yml b/gr-qtgui/grc/qtgui_ber_sink_b.block.yml
new file mode 100644
index 000000000..ddf28cf1e
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_ber_sink_b.block.yml
@@ -0,0 +1,366 @@
+id: qtgui_bercurve_sink
+label: QT GUI Bercurve Sink
+
+parameters:
+- id: esno
+ label: esno
+ dtype: raw
+ default: numpy.arange(0.0, 4.0, .5)
+ hide: part
+- id: berminerrors
+ label: Min. BER Errs.
+ dtype: int
+ default: '100'
+- id: berlimit
+ label: BER Limit
+ dtype: real
+ default: '-7.0'
+- id: num_curves
+ label: Num Curves
+ dtype: int
+ default: '1'
+ hide: part
+- id: curvenames
+ label: Curve Names
+ dtype: raw
+ default: '[]'
+ hide: part
+- id: ymin
+ label: Y min
+ dtype: real
+ default: '-10'
+ hide: part
+- id: ymax
+ label: Y max
+ dtype: real
+ default: '0'
+ hide: part
+- id: update_time
+ label: Update Period
+ dtype: real
+ default: '0.10'
+ hide: part
+- id: gui_hint
+ label: GUI Hint
+ dtype: gui_hint
+ hide: part
+- id: label1
+ label: Line 1 Label
+ category: Config
+ dtype: string
+ hide: ${ ('part' if int(num_curves) >= 1 else 'all') }
+- id: width1
+ label: Line 1 Width
+ category: Config
+ dtype: int
+ default: '1'
+ hide: ${ ('part' if int(num_curves) >= 1 else 'all') }
+- id: color1
+ label: Line 1 Color
+ category: Config
+ dtype: enum
+ options: ['"blue"', '"red"', '"green"', '"black"', '"cyan"', '"magenta"', '"yellow"',
+ '"dark red"', '"dark green"', '"Dark Blue"']
+ option_labels: [Blue, Red, Green, Black, Cyan, Magenta, Yellow, Dark Red, Dark
+ Green, Dark Blue]
+ hide: ${ ('part' if int(num_curves) >= 1 else 'all') }
+- id: style1
+ label: Line 1 Style
+ category: Config
+ dtype: enum
+ options: ['1', '2', '3', '4', '5', '0']
+ option_labels: [Solid, Dash, Dots, Dash-Dot, Dash-Dot-Dot, None]
+ hide: ${ ('part' if int(num_curves) >= 1 else 'all') }
+- id: marker1
+ label: Line 1 Marker
+ category: Config
+ dtype: enum
+ options: ['0', '1', '2', '3', '4', '6', '7', '8', '9', '-1']
+ option_labels: [Circle, Rectangle, Diamond, Triangle, Down Triangle, Left Triangle,
+ Right Triangle, Cross, X-Cross, None]
+ hide: ${ ('part' if int(num_curves) >= 1 else 'all') }
+- id: alpha1
+ label: Line 1 Alpha
+ category: Config
+ dtype: float
+ default: '1.0'
+ hide: ${ ('part' if int(num_curves) >= 1 else 'all') }
+- id: label2
+ label: Line 2 Label
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 2 else 'all') }
+- id: width2
+ label: Line 2 Width
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 2 else 'all') }
+- id: color2
+ label: Line 2 Color
+ dtype: ''
+ default: '"red"'
+ hide: ${ ('part' if int(num_curves) >= 2 else 'all') }
+- id: style2
+ label: Line 2 Style
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 2 else 'all') }
+- id: marker2
+ label: Line 2 Marker
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 2 else 'all') }
+- id: alpha2
+ label: Line 2 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 2 else 'all') }
+- id: label3
+ label: Line 3 Label
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 3 else 'all') }
+- id: width3
+ label: Line 3 Width
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 3 else 'all') }
+- id: color3
+ label: Line 3 Color
+ dtype: ''
+ default: '"green"'
+ hide: ${ ('part' if int(num_curves) >= 3 else 'all') }
+- id: style3
+ label: Line 3 Style
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 3 else 'all') }
+- id: marker3
+ label: Line 3 Marker
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 3 else 'all') }
+- id: alpha3
+ label: Line 3 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 3 else 'all') }
+- id: label4
+ label: Line 4 Label
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 4 else 'all') }
+- id: width4
+ label: Line 4 Width
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 4 else 'all') }
+- id: color4
+ label: Line 4 Color
+ dtype: ''
+ default: '"black"'
+ hide: ${ ('part' if int(num_curves) >= 4 else 'all') }
+- id: style4
+ label: Line 4 Style
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 4 else 'all') }
+- id: marker4
+ label: Line 4 Marker
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 4 else 'all') }
+- id: alpha4
+ label: Line 4 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 4 else 'all') }
+- id: label5
+ label: Line 5 Label
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 5 else 'all') }
+- id: width5
+ label: Line 5 Width
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 5 else 'all') }
+- id: color5
+ label: Line 5 Color
+ dtype: ''
+ default: '"cyan"'
+ hide: ${ ('part' if int(num_curves) >= 5 else 'all') }
+- id: style5
+ label: Line 5 Style
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 5 else 'all') }
+- id: marker5
+ label: Line 5 Marker
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 5 else 'all') }
+- id: alpha5
+ label: Line 5 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 5 else 'all') }
+- id: label6
+ label: Line 6 Label
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 6 else 'all') }
+- id: width6
+ label: Line 6 Width
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 6 else 'all') }
+- id: color6
+ label: Line 6 Color
+ dtype: ''
+ default: '"magenta"'
+ hide: ${ ('part' if int(num_curves) >= 6 else 'all') }
+- id: style6
+ label: Line 6 Style
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 6 else 'all') }
+- id: marker6
+ label: Line 6 Marker
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 6 else 'all') }
+- id: alpha6
+ label: Line 6 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 6 else 'all') }
+- id: label7
+ label: Line 7 Label
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 7 else 'all') }
+- id: width7
+ label: Line 7 Width
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 7 else 'all') }
+- id: color7
+ label: Line 7 Color
+ dtype: ''
+ default: '"yellow"'
+ hide: ${ ('part' if int(num_curves) >= 7 else 'all') }
+- id: style7
+ label: Line 7 Style
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 7 else 'all') }
+- id: marker7
+ label: Line 7 Marker
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 7 else 'all') }
+- id: alpha7
+ label: Line 7 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 7 else 'all') }
+- id: label8
+ label: Line 8 Label
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 8 else 'all') }
+- id: width8
+ label: Line 8 Width
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 8 else 'all') }
+- id: color8
+ label: Line 8 Color
+ dtype: ''
+ default: '"dark red"'
+ hide: ${ ('part' if int(num_curves) >= 8 else 'all') }
+- id: style8
+ label: Line 8 Style
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 8 else 'all') }
+- id: marker8
+ label: Line 8 Marker
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 8 else 'all') }
+- id: alpha8
+ label: Line 8 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 8 else 'all') }
+- id: label9
+ label: Line 9 Label
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 9 else 'all') }
+- id: width9
+ label: Line 9 Width
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 9 else 'all') }
+- id: color9
+ label: Line 9 Color
+ dtype: ''
+ default: '"dark green"'
+ hide: ${ ('part' if int(num_curves) >= 9 else 'all') }
+- id: style9
+ label: Line 9 Style
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 9 else 'all') }
+- id: marker9
+ label: Line 9 Marker
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 9 else 'all') }
+- id: alpha9
+ label: Line 9 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 9 else 'all') }
+- id: label10
+ label: Line 10 Label
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 10 else 'all') }
+- id: width10
+ label: Line 10 Width
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 10 else 'all') }
+- id: color10
+ label: Line 10 Color
+ dtype: ''
+ default: '"dark blue"'
+ hide: ${ ('part' if int(num_curves) >= 10 else 'all') }
+- id: style10
+ label: Line 10 Style
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 10 else 'all') }
+- id: marker10
+ label: Line 10 Marker
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 10 else 'all') }
+- id: alpha10
+ label: Line 10 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(num_curves) >= 10 else 'all') }
+
+inputs:
+- domain: stream
+ dtype: byte
+ multiplicity: ${ len(esno)*2*num_curves }
+
+templates:
+ imports: |-
+ from PyQt5import Qt
+ from gnuradio import qtgui
+ import sip
+ import numpy
+ make: |-
+ <%
+ win = 'self._%s_win'%id
+ %>\
+ qtgui.ber_sink_b(
+ ${esno}, #range of esnos
+ ${num_curves}, #number of curves
+ ${berminerrors}, #ensure at least
+ ${berlimit}, #cutoff
+ ${curvenames} #indiv. curve names
+ )
+ self.${id}.set_update_time(${update_time})
+ self.${id}.set_y_axis(${ymin}, ${ymax})
+ self.${id}.set_x_axis(${esno}[0], ${esno}[-1])
+
+ labels = [${label1}, ${label2}, ${label3}, ${label4}, ${label5},
+ ${label6}, ${label7}, ${label8}, ${label9}, ${label10}]
+ widths = [${width1}, ${width2}, ${width3}, ${width4}, ${width5},
+ ${width6}, ${width7}, ${width8}, ${width9}, ${width10}]
+ colors = [${color1}, ${color2}, ${color3}, ${color4}, ${color5},
+ ${color6}, ${color7}, ${color8}, ${color9}, ${color10}]
+ alphas = [${alpha1}, ${alpha2}, ${alpha3}, ${alpha4}, ${alpha5},
+ ${alpha6}, ${alpha7}, ${alpha8}, ${alpha9}, ${alpha10}]
+
+ for i in range(${num_curves}):
+ if len(labels[i]) == 0:
+ self.${id}.set_line_label(i, "Data {0}".format(i))
+ else:
+ self.${id}.set_line_label(i, labels[i])
+ self.${id}.set_line_width(i, widths[i])
+ self.${id}.set_line_color(i, colors[i])
+ self.${id}.set_line_style(i, styles[i])
+ self.${id}.set_line_marker(i, markers[i])
+ self.${id}.set_line_alpha(i, alphas[i])
+
+ ${win} = sip.wrapinstance(self.${id}.pyqwidget(), Qt.QWidget)
+ ${gui_hint() % win}
+
+documentation: |-
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/gr-qtgui/grc/qtgui_ber_sink_b.xml b/gr-qtgui/grc/qtgui_ber_sink_b.xml
deleted file mode 100644
index 05a36dfbc..000000000
--- a/gr-qtgui/grc/qtgui_ber_sink_b.xml
+++ /dev/null
@@ -1,684 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##QT GUI Sink
-###################################################
- -->
-<block>
- <name>QT GUI Bercurve Sink</name>
- <key>qtgui_bercurve_sink</key>
- <import>from PyQt5import Qt</import>
- <import>from gnuradio import qtgui</import>
- <import>import sip</import>
- <import>import numpy</import>
- <make>#set $win = 'self._%s_win'%$id
- qtgui.ber_sink_b(
- $esno, \#range of esnos
- $num_curves, \#number of curves
- $berminerrors, \#ensure at least
- $berlimit, \#cutoff
- $curvenames, \#indiv. curve names
- )
-self.$(id).set_update_time($update_time)
-self.$(id).set_y_axis($ymin, $ymax)
-self.$(id).set_x_axis($(esno)[0], $(esno)[-1])
-
-labels = [$label1, $label2, $label3, $label4, $label5,
- $label6, $label7, $label8, $label9, $label10]
-widths = [$width1, $width2, $width3, $width4, $width5,
- $width6, $width7, $width8, $width9, $width10]
-colors = [$color1, $color2, $color3, $color4, $color5,
- $color6, $color7, $color8, $color9, $color10]
-styles = [$style1, $style2, $style3, $style4, $style5,
- $style6, $style7, $style8, $style9, $style10]
-markers = [$marker1, $marker2, $marker3, $marker4, $marker5,
- $marker6, $marker7, $marker8, $marker9, $marker10]
-alphas = [$alpha1, $alpha2, $alpha3, $alpha4, $alpha5,
- $alpha6, $alpha7, $alpha8, $alpha9, $alpha10]
-for i in xrange($num_curves):
- if len(labels[i]) == 0:
- self.$(id).set_line_label(i, "Data {0}".format(i))
- else:
- self.$(id).set_line_label(i, labels[i])
- self.$(id).set_line_width(i, widths[i])
- self.$(id).set_line_color(i, colors[i])
- self.$(id).set_line_style(i, styles[i])
- self.$(id).set_line_marker(i, markers[i])
- self.$(id).set_line_alpha(i, alphas[i])
-
-self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
-$(gui_hint()($win))</make>
-
- <param>
- <name>esno</name>
- <key>esno</key>
- <value>numpy.arange(0.0, 4.0, .5)</value>
- <type>raw</type>
- </param>
-
- <param>
- <name>Min. BER Errs.</name>
- <key>berminerrors</key>
- <value>100</value>
- <type>int</type>
- </param>
-
- <param>
- <name>BER Limit</name>
- <key>berlimit</key>
- <value>-7.0</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Num Curves</name>
- <key>num_curves</key>
- <value>1</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Curve Names</name>
- <key>curvenames</key>
- <value>[]</value>
- <type>raw</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Y min</name>
- <key>ymin</key>
- <value>-10</value>
- <type>real</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Y max</name>
- <key>ymax</key>
- <value>0</value>
- <type>real</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Update Period</name>
- <key>update_time</key>
- <value>0.10</value>
- <type>real</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Line 1 Label</name>
- <key>label1</key>
- <type>string</type>
- <hide>#if int($num_curves()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Width</name>
- <key>width1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if int($num_curves()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Color</name>
- <key>color1</key>
- <type>enum</type>
- <hide>#if int($num_curves()) >= 1 then 'part' else 'all'#</hide>
- <option>
- <name>Blue</name>
- <key>"blue"</key>
- </option>
- <option>
- <name>Red</name>
- <key>"red"</key>
- </option>
- <option>
- <name>Green</name>
- <key>"green"</key>
- </option>
- <option>
- <name>Black</name>
- <key>"black"</key>
- </option>
- <option>
- <name>Cyan</name>
- <key>"cyan"</key>
- </option>
- <option>
- <name>Magenta</name>
- <key>"magenta"</key>
- </option>
- <option>
- <name>Yellow</name>
- <key>"yellow"</key>
- </option>
- <option>
- <name>Dark Red</name>
- <key>"dark red"</key>
- </option>
- <option>
- <name>Dark Green</name>
- <key>"dark green"</key>
- </option>
- <option>
- <name>Dark Blue</name>
- <key>"Dark Blue"</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Style</name>
- <key>style1</key>
- <type>enum</type>
- <hide>#if int($num_curves()) >= 1 then 'part' else 'all'#</hide>
- <option>
- <name>Solid</name>
- <key>1</key>
- </option>
- <option>
- <name>Dash</name>
- <key>2</key>
- </option>
- <option>
- <name>Dots</name>
- <key>3</key>
- </option>
- <option>
- <name>Dash-Dot</name>
- <key>4</key>
- </option>
- <option>
- <name>Dash-Dot-Dot</name>
- <key>5</key>
- </option>
- <option>
- <name>None</name>
- <key>0</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Marker</name>
- <key>marker1</key>
- <type>enum</type>
- <hide>#if int($num_curves()) >= 1 then 'part' else 'all'#</hide>
- <option>
- <name>Circle</name>
- <key>0</key>
- </option>
- <option>
- <name>Rectangle</name>
- <key>1</key>
- </option>
- <option>
- <name>Diamond</name>
- <key>2</key>
- </option>
- <option>
- <name>Triangle</name>
- <key>3</key>
- </option>
- <option>
- <name>Down Triangle</name>
- <key>4</key>
- </option>
- <option>
- <name>Left Triangle</name>
- <key>6</key>
- </option>
- <option>
- <name>Right Triangle</name>
- <key>7</key>
- </option>
- <option>
- <name>Cross</name>
- <key>8</key>
- </option>
- <option>
- <name>X-Cross</name>
- <key>9</key>
- </option>
- <option>
- <name>None</name>
- <key>-1</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Alpha</name>
- <key>alpha1</key>
- <value>1.0</value>
- <type>float</type>
- <hide>#if int($num_curves()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 2 Label</name>
- <key>label2</key>
- <hide>#if int($num_curves()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 2 Width</name>
- <key>width2</key>
- <hide>#if int($num_curves()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 2 Color</name>
- <key>color2</key>
- <value>"red"</value>
- <hide>#if int($num_curves()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 2 Style</name>
- <key>style2</key>
- <hide>#if int($num_curves()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 2 Marker</name>
- <key>marker2</key>
- <hide>#if int($num_curves()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 2 Alpha</name>
- <key>alpha2</key>
- <hide>#if int($num_curves()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 3 Label</name>
- <key>label3</key>
- <hide>#if int($num_curves()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 3 Width</name>
- <key>width3</key>
- <hide>#if int($num_curves()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 3 Color</name>
- <key>color3</key>
- <value>"green"</value>
- <hide>#if int($num_curves()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 3 Style</name>
- <key>style3</key>
- <hide>#if int($num_curves()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 3 Marker</name>
- <key>marker3</key>
- <hide>#if int($num_curves()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 3 Alpha</name>
- <key>alpha3</key>
- <hide>#if int($num_curves()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 4 Label</name>
- <key>label4</key>
- <hide>#if int($num_curves()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 4 Width</name>
- <key>width4</key>
- <hide>#if int($num_curves()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 4 Color</name>
- <key>color4</key>
- <value>"black"</value>
- <hide>#if int($num_curves()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 4 Style</name>
- <key>style4</key>
- <hide>#if int($num_curves()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 4 Marker</name>
- <key>marker4</key>
- <hide>#if int($num_curves()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 4 Alpha</name>
- <key>alpha4</key>
- <hide>#if int($num_curves()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 5 Label</name>
- <key>label5</key>
- <hide>#if int($num_curves()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 5 Width</name>
- <key>width5</key>
- <hide>#if int($num_curves()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 5 Color</name>
- <key>color5</key>
- <value>"cyan"</value>
- <hide>#if int($num_curves()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 5 Style</name>
- <key>style5</key>
- <hide>#if int($num_curves()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 5 Marker</name>
- <key>marker5</key>
- <hide>#if int($num_curves()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 5 Alpha</name>
- <key>alpha5</key>
- <hide>#if int($num_curves()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 6 Label</name>
- <key>label6</key>
- <hide>#if int($num_curves()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 6 Width</name>
- <key>width6</key>
- <hide>#if int($num_curves()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 6 Color</name>
- <key>color6</key>
- <value>"magenta"</value>
- <hide>#if int($num_curves()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 6 Style</name>
- <key>style6</key>
- <hide>#if int($num_curves()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 6 Marker</name>
- <key>marker6</key>
- <hide>#if int($num_curves()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 6 Alpha</name>
- <key>alpha6</key>
- <hide>#if int($num_curves()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 7 Label</name>
- <key>label7</key>
- <hide>#if int($num_curves()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 7 Width</name>
- <key>width7</key>
- <hide>#if int($num_curves()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 7 Color</name>
- <key>color7</key>
- <value>"yellow"</value>
- <hide>#if int($num_curves()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 7 Style</name>
- <key>style7</key>
- <hide>#if int($num_curves()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 7 Marker</name>
- <key>marker7</key>
- <hide>#if int($num_curves()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 7 Alpha</name>
- <key>alpha7</key>
- <hide>#if int($num_curves()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 8 Label</name>
- <key>label8</key>
- <hide>#if int($num_curves()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 8 Width</name>
- <key>width8</key>
- <hide>#if int($num_curves()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 8 Color</name>
- <key>color8</key>
- <value>"dark red"</value>
- <hide>#if int($num_curves()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 8 Style</name>
- <key>style8</key>
- <hide>#if int($num_curves()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 8 Marker</name>
- <key>marker8</key>
- <hide>#if int($num_curves()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 8 Alpha</name>
- <key>alpha8</key>
- <hide>#if int($num_curves()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 9 Label</name>
- <key>label9</key>
- <hide>#if int($num_curves()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 9 Width</name>
- <key>width9</key>
- <hide>#if int($num_curves()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 9 Color</name>
- <key>color9</key>
- <value>"dark green"</value>
- <hide>#if int($num_curves()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 9 Style</name>
- <key>style9</key>
- <hide>#if int($num_curves()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 9 Marker</name>
- <key>marker9</key>
- <hide>#if int($num_curves()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 9 Alpha</name>
- <key>alpha9</key>
- <hide>#if int($num_curves()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 10 Label</name>
- <key>label10</key>
- <hide>#if int($num_curves()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 10 Width</name>
- <key>width10</key>
- <hide>#if int($num_curves()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 10 Color</name>
- <key>color10</key>
- <value>"dark blue"</value>
- <hide>#if int($num_curves()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 10 Style</name>
- <key>style10</key>
- <hide>#if int($num_curves()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 10 Marker</name>
- <key>marker10</key>
- <hide>#if int($num_curves()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 10 Alpha</name>
- <key>alpha10</key>
- <hide>#if int($num_curves()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
-
- <sink>
- <name>out</name>
- <type>byte</type>
- <nports>len($esno)*2*$num_curves</nports>
- </sink>
-
- <bus_structure_sink>map(lambda b: map(lambda a: b * len($esno) * 2 + a, range(len($esno)*2)), range($num_curves))</bus_structure_sink>
-
- <doc>
- The GUI hint can be used to position the widget within the application. \
- The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
- Both the tab specification and the grid position are optional.
- </doc>
-</block>
diff --git a/gr-qtgui/grc/qtgui_block_tree.xml b/gr-qtgui/grc/qtgui_block_tree.xml
deleted file mode 100644
index 33fb12a7b..000000000
--- a/gr-qtgui/grc/qtgui_block_tree.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2012-2013 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##Block Tree for GR QTGUI blocks.
-###################################################
- -->
-<cat>
- <name>[Core]</name>
- <cat>
- <name>Instrumentation</name>
- <cat>
- <name>QT</name>
- <block>qtgui_freq_sink_x</block>
- <block>qtgui_time_sink_x</block>
- <block>qtgui_const_sink_x</block>
- <block>qtgui_waterfall_sink_x</block>
- <block>qtgui_time_raster_sink_x</block>
- <block>qtgui_bercurve_sink</block>
- <block>qtgui_histogram_sink_x</block>
- <block>qtgui_number_sink</block>
- <block>qtgui_vector_sink_f</block>
- <block>qtgui_sink_x</block>
- </cat>
- </cat>
- <cat>
- <name>GUI Widgets</name>
- <cat>
- <name>QT</name>
- <block>qtgui_tab_widget</block>
- <block>variable_qtgui_range</block>
- <block>variable_qtgui_chooser</block>
- <block>variable_qtgui_check_box</block>
- <block>variable_qtgui_push_button</block>
- <block>variable_qtgui_entry</block>
- <block>variable_qtgui_label</block>
- <block>qtgui_edit_box_msg</block>
- </cat>
- </cat>
-</cat>
diff --git a/gr-qtgui/grc/qtgui_check_box.block.yml b/gr-qtgui/grc/qtgui_check_box.block.yml
new file mode 100644
index 000000000..dc67237e4
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_check_box.block.yml
@@ -0,0 +1,66 @@
+id: variable_qtgui_check_box
+label: QT GUI Check Box
+
+parameters:
+- id: label
+ label: Label
+ dtype: string
+ hide: ${ ('none' if label else 'part') }
+- id: type
+ label: Type
+ dtype: enum
+ default: int
+ options: [real, int, string, bool, raw]
+ option_labels: [Float, Integer, String, Boolean, Any]
+ option_attributes:
+ conv: [float, int, str, bool, eval]
+ hide: part
+- id: value
+ label: Default Value
+ dtype: ${ type }
+ default: 'True'
+- id: 'true'
+ label: 'True'
+ dtype: ${ type }
+ default: 'True'
+- id: 'false'
+ label: 'False'
+ dtype: ${ type }
+ default: 'False'
+- id: gui_hint
+ label: GUI Hint
+ dtype: gui_hint
+ hide: part
+value: ${ value }
+
+asserts:
+- ${value in (true, false)}
+
+templates:
+ imports: from PyQt5 import Qt
+ var_make: self.${id} = ${id} = ${value}
+ callbacks:
+ - self.set_${id}(${value})
+ - self._${id}_callback(${id})
+ make: |-
+ <%
+ win = '_%s_check_box'%id
+ if not label:
+ label = id
+ %>
+ ${win} = Qt.QCheckBox(${label})
+ self._${id}_choices = {True: ${true}, False: ${false}}
+ self._${id}_choices_inv = dict((v,k) for k,v in self._${id}_choices.iteritems())
+ self._${id}_callback = lambda i: Qt.QMetaObject.invokeMethod(${win}, "setChecked", Qt.Q_ARG("bool", self._${id}_choices_inv[i]))
+ self._${id}_callback(self.${id})
+ ${win}.stateChanged.connect(lambda i: self.set_${id}(self._${id}_choices[bool(i)]))
+ ${gui_hint() % win}
+
+documentation: |-
+ This block creates a variable check box. Leave the label blank to use the variable id as the label.
+
+ A check box selects between two values of similar type. Te values do not necessarily need to be of boolean type.
+
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/gr-qtgui/grc/qtgui_check_box.xml b/gr-qtgui/grc/qtgui_check_box.xml
deleted file mode 100644
index ccee59dd9..000000000
--- a/gr-qtgui/grc/qtgui_check_box.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Variable Check Box:
-## a gui check box form
-###################################################
- -->
-<block>
- <name>QT GUI Check Box</name>
- <key>variable_qtgui_check_box</key>
- <import>from PyQt5 import Qt</import>
- <var_make>self.$(id) = $(id) = $value</var_make>
- <make>#set $win = '_%s_check_box'%$id
-#if not $label()
- #set $label = '"%s"'%$id
-#end if
-$win = Qt.QCheckBox($label)
-self._$(id)_choices = {True: $true, False: $false}
-self._$(id)_choices_inv = dict((v,k) for k,v in self._$(id)_choices.iteritems())
-self._$(id)_callback = lambda i: Qt.QMetaObject.invokeMethod($(win), "setChecked", Qt.Q_ARG("bool", self._$(id)_choices_inv[i]))
-self._$(id)_callback(self.$id)
-$(win).stateChanged.connect(lambda i: self.set_$(id)(self._$(id)_choices[bool(i)]))
-$(gui_hint()($win))</make>
- <callback>self.set_$(id)($value)</callback>
- <callback>self._$(id)_callback($id)</callback>
- <param>
- <name>Label</name>
- <key>label</key>
- <value></value>
- <type>string</type>
- <hide>#if $label() then 'none' else 'part'#</hide>
- </param>
- <param>
- <name>Type</name>
- <key>type</key>
- <value>int</value>
- <type>enum</type>
- <hide>part</hide>
- <option><name>Float</name><key>real</key><opt>conv:float</opt></option>
- <option><name>Integer</name><key>int</key><opt>conv:int</opt></option>
- <option><name>String</name><key>string</key><opt>conv:str</opt></option>
- <option><name>Boolean</name><key>bool</key><opt>conv:bool</opt></option>
- <option><name>Any</name><key>raw</key><opt>conv:eval</opt></option>
- </param>
- <param>
- <name>Default Value</name>
- <key>value</key>
- <value>True</value>
- <type>$type</type>
- </param>
- <param>
- <name>True</name>
- <key>true</key>
- <value>True</value>
- <type>$type</type>
- </param>
- <param>
- <name>False</name>
- <key>false</key>
- <value>False</value>
- <type>$type</type>
- </param>
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- </param>
- <check>$value in ($true, $false)</check>
- <doc>
-This block creates a variable check box. \
-Leave the label blank to use the variable id as the label.
-
-A check box selects between two values of similar type. \
-Te values do not necessarily need to be of boolean type.
-
-The GUI hint can be used to position the widget within the application. \
-The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
-Both the tab specification and the grid position are optional.
- </doc>
-</block>
diff --git a/gr-qtgui/grc/qtgui_chooser.block.yml b/gr-qtgui/grc/qtgui_chooser.block.yml
new file mode 100644
index 000000000..a342beccc
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_chooser.block.yml
@@ -0,0 +1,191 @@
+id: variable_qtgui_chooser
+label: QT GUI Chooser
+flags: has_python
+
+parameters:
+- id: label
+ label: Label
+ dtype: string
+ hide: ${ ('none' if label else 'part') }
+- id: type
+ label: Type
+ dtype: enum
+ default: int
+ options: [real, int, string, raw]
+ option_labels: [Float, Integer, String, Any]
+ hide: part
+- id: num_opts
+ label: Num Options
+ dtype: enum
+ default: '3'
+ options: ['0', '1', '2', '3', '4', '5']
+ option_labels: [List, '1', '2', '3', '4', '5']
+- id: value
+ label: Default Value
+ dtype: ${ type }
+ default: '0'
+- id: options
+ label: Options
+ dtype: raw
+ default: '[0, 1, 2]'
+ hide: ${ ('all' if int(num_opts) else 'none') }
+- id: labels
+ label: Labels
+ dtype: raw
+ default: '[]'
+ hide: ${ ('all' if int(num_opts) else 'none') }
+- id: option0
+ label: Option 0
+ dtype: ${ type }
+ default: '0'
+ hide: ${ ('none' if int(num_opts) > 0 else 'all') }
+- id: label0
+ label: Label 0
+ dtype: string
+ hide: ${ (int(num_opts) > 0) and (label0 and 'none' or 'part') or 'all' }
+- id: option1
+ label: Option 1
+ dtype: ${ type }
+ default: '1'
+ hide: ${ ('none' if int(num_opts) > 1 else 'all') }
+- id: label1
+ label: Label 1
+ dtype: string
+ hide: ${ (int(num_opts) > 1) and (label1 and 'none' or 'part') or 'all' }
+- id: option2
+ label: Option 2
+ dtype: ${ type }
+ default: '2'
+ hide: ${ ('none' if int(num_opts) > 2 else 'all') }
+- id: label2
+ label: Label 2
+ dtype: string
+ hide: ${ (int(num_opts) > 2) and (label2 and 'none' or 'part') or 'all' }
+- id: option3
+ label: Option 3
+ dtype: ${ type }
+ default: '3'
+ hide: ${ ('none' if int(num_opts) > 3 else 'all') }
+- id: label3
+ label: Label 3
+ dtype: string
+ hide: ${ (int(num_opts) > 3) and (label3 and 'none' or 'part') or 'all' }
+- id: option4
+ label: Option 4
+ dtype: ${ type }
+ default: '4'
+ hide: ${ ('none' if int(num_opts) > 4 else 'all') }
+- id: label4
+ label: Label 4
+ dtype: string
+ hide: ${ (int(num_opts) > 4) and (label4 and 'none' or 'part') or 'all' }
+- id: widget
+ label: Widget
+ dtype: enum
+ default: combo_box
+ options: [combo_box, radio_buttons]
+ option_labels: [Combo Box, Radio Buttons]
+ hide: part
+- id: orient
+ label: Orientation
+ dtype: enum
+ default: Qt.QVBoxLayout
+ options: [Qt.QHBoxLayout, Qt.QVBoxLayout]
+ option_labels: [Horizontal, Vertical]
+ hide: ${ ('part' if widget == 'radio_buttons' else 'all') }
+- id: gui_hint
+ label: GUI Hint
+ dtype: gui_hint
+ hide: part
+value: ${ value }
+
+templates:
+ imports: |-
+ from PyQt5 import Qt
+ from PyQt5.QtCore import QObject, pyqtSlot
+ var_make: self.${id} = ${id} = ${value}
+ callbacks:
+ - self.set_${id}(${value})
+ - self._${id}_callback(${id})
+ make: |-
+ <%
+ all_options = [ option0, option1, option2, option3, option4 ][:int(num_opts)]
+ all_labels = [ label0, label1, label2, label3, label4 ][:int(num_opts)]
+ if not label:
+ label = id
+ %>\
+ # Create the options list
+ % if int(num_opts):
+ self._${id}_options = (\
+ % for ch in all_options:
+ ${ch}, \
+ % endfor
+ )
+ % else:
+ self._${id]_options = ${options}
+ % endif
+ # Create the labels list
+ % if int(num_opts):
+ self._${id}_labels = (\
+ % for i, lbl in all_labels:
+ % if lbl:
+ ${lbl}, \
+ % else:
+ str(self._${id}_options[${i}], \
+ % endif
+ % endfor
+ )
+ % elif labels:
+ self._${id]_labels = ${labels}
+ % else:
+ self._${id}_map(str, self._${id}_options)
+ % endif
+ # Create the combo box
+ % if widget == 'combo_box':
+ <%
+ win = 'self._%s_tool_bar'%id
+ %>\
+ ${win} = Qt.QToolBar(self)
+ ${win}.addWidget(Qt.QLabel(${label} + ": "))
+ self._${id}_combo_box = Qt.QComboBox()
+ ${win}.addWidget(self._${id}_combo_box)
+ for label in self._${id}_labels: self._${id}_combo_box.addItem(label)
+ self._${id}_callback = lambda i: Qt.QMetaObject.invokeMethod(self._${id}_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._${id}_options.index(i)))
+ self._${id}_callback(self.${id})
+ self._${id}_combo_box.currentIndexChanged.connect(
+ lambda i: self.set_${id}(self._${id}_options[i]))
+ % endif
+ # Create the radio buttons
+ % if widget == 'radio_buttons':
+ <%
+ win = 'self._%s_group_box'%id
+ %>\
+ ${win} = QtQGroupBox(${label})
+ self._${id}_box = ${orient}()
+ class variable_chooser_button_group(Qt.QButtonGroup):
+ def __init__(self, parent=None):
+ Qt.QButtonGroup.__init__(self, parent)
+ @pyqtSlot(int)
+ def updateButtonChecked(self, button_id):
+ self.button(button_id).setChecked(True)
+ self._${id}_button_group = variable_chooser_button_group()
+ ${win}.setLayout(self._${id}_box)
+ for i, label in enumerate(self._${id}_labels):
+ radio_button = Qt.QRadioButton(label)
+ self._${id}_box.addWidget(radio_button)
+ self._${id}_button_group.addButton(radio_button, i)
+ self._${id}_callback = lambda i: Qt.QMetaObject.invokeMethod(self._${id}_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._${id}_options.index(i)))
+ self._${id}_callback(self.${id})
+ self._${id}_button_group.buttonClicked[int].connect(
+ lambda i: self.set_${id}(self._${id}_options[i]))
+ % endif
+ ${gui_hint() % win}
+
+documentation: |-
+ This block creates a variable with enumerated options. The gui widget is implemented as a combo box or radio button group. Leave the label blank to use the variable id as the label.
+
+ Choose the number of options available to your chooser. When the label is left blank, the option will be used as the label. Set the number of options to "list" to enter a single list of options and labels. When the labels is an empty list, the options will be used as the label.
+
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/gr-qtgui/grc/qtgui_chooser.xml b/gr-qtgui/grc/qtgui_chooser.xml
deleted file mode 100644
index f79bb8ccb..000000000
--- a/gr-qtgui/grc/qtgui_chooser.xml
+++ /dev/null
@@ -1,257 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Variable Chooser:
-## A chooser, radio buttons
-###################################################
- -->
-<block>
- <name>QT GUI Chooser</name>
- <key>variable_qtgui_chooser</key>
- <import>from PyQt5 import Qt</import>
- <import>from PyQt5.QtCore import QObject, pyqtSlot</import>
- <var_make>self.$(id) = $(id) = $value</var_make>
- <make>#slurp
-#set $all_options = [$option0, $option1, $option2, $option3, $option4][:int($num_opts())]
-#set $all_labels = [$label0, $label1, $label2, $label3, $label4][:int($num_opts())]
-#if not $label()
- #set $label = '"%s"'%$id
-#end if
-########################################################################
-## Create the options list
-########################################################################
-#if int($num_opts())
-self._$(id)_options = (#slurp
- #for $ch in $all_options
-$ch, #slurp
- #end for
-)
-#else
-self._$(id)_options = $options
-#end if
-########################################################################
-## Create the labels list
-########################################################################
-#if int($num_opts())
-self._$(id)_labels = (#slurp
- #for i, $lbl in enumerate($all_labels)
- #if $lbl()
-$lbl, #slurp
- #else
-str(self._$(id)_options[$i]), #slurp
- #end if
- #end for
-)
-#elif $labels()
-self._$(id)_labels = $labels
-#else
-self._$(id)_labels = map(str, self._$(id)_options)
-#end if
-########################################################################
-## Create the combo box
-########################################################################
-#if $widget() == 'combo_box'
-#set $win = 'self._%s_tool_bar'%$id
-$win = Qt.QToolBar(self)
-$(win).addWidget(Qt.QLabel($label+": "))
-self._$(id)_combo_box = Qt.QComboBox()
-$(win).addWidget(self._$(id)_combo_box)
-for label in self._$(id)_labels: self._$(id)_combo_box.addItem(label)
-self._$(id)_callback = lambda i: Qt.QMetaObject.invokeMethod(self._$(id)_combo_box, "setCurrentIndex", Qt.Q_ARG("int", self._$(id)_options.index(i)))
-self._$(id)_callback(self.$id)
-self._$(id)_combo_box.currentIndexChanged.connect(
- lambda i: self.set_$(id)(self._$(id)_options[i]))
-#end if
-########################################################################
-## Create the radio buttons
-########################################################################
-#if $widget() == 'radio_buttons'
-#set $win = 'self._%s_group_box'%$id
-$win = Qt.QGroupBox($label)
-self._$(id)_box = $(orient)()
-class variable_chooser_button_group(Qt.QButtonGroup):
- def __init__(self, parent=None):
- Qt.QButtonGroup.__init__(self, parent)
- @pyqtSlot(int)
- def updateButtonChecked(self, button_id):
- self.button(button_id).setChecked(True)
-self._$(id)_button_group = variable_chooser_button_group()
-$(win).setLayout(self._$(id)_box)
-for i, label in enumerate(self._$(id)_labels):
- radio_button = Qt.QRadioButton(label)
- self._$(id)_box.addWidget(radio_button)
- self._$(id)_button_group.addButton(radio_button, i)
-self._$(id)_callback = lambda i: Qt.QMetaObject.invokeMethod(self._$(id)_button_group, "updateButtonChecked", Qt.Q_ARG("int", self._$(id)_options.index(i)))
-self._$(id)_callback(self.$id)
-self._$(id)_button_group.buttonClicked[int].connect(
- lambda i: self.set_$(id)(self._$(id)_options[i]))
-#end if
-$(gui_hint()($win))</make>
- <callback>self.set_$(id)($value)</callback>
- <callback>self._$(id)_callback($id)</callback>
- <param>
- <name>Label</name>
- <key>label</key>
- <value></value>
- <type>string</type>
- <hide>#if $label() then 'none' else 'part'#</hide>
- </param>
- <param>
- <name>Type</name>
- <key>type</key>
- <value>int</value>
- <type>enum</type>
- <hide>part</hide>
- <option><name>Float</name><key>real</key></option>
- <option><name>Integer</name><key>int</key></option>
- <option><name>String</name><key>string</key></option>
- <option><name>Any</name><key>raw</key></option>
- </param>
- <param>
- <name>Num Options</name>
- <key>num_opts</key>
- <value>3</value>
- <type>enum</type>
- <option><name>List</name><key>0</key></option>
- <option><name>1</name><key>1</key></option>
- <option><name>2</name><key>2</key></option>
- <option><name>3</name><key>3</key></option>
- <option><name>4</name><key>4</key></option>
- <option><name>5</name><key>5</key></option>
- </param>
- <param>
- <name>Default Value</name>
- <key>value</key>
- <value>0</value>
- <type>$type</type>
- </param>
- <param>
- <name>Options</name>
- <key>options</key>
- <value>[0, 1, 2]</value>
- <type>raw</type>
- <hide>#if int($num_opts()) then 'all' else 'none'#</hide>
- </param>
- <param>
- <name>Labels</name>
- <key>labels</key>
- <value>[]</value>
- <type>raw</type>
- <hide>#if int($num_opts()) then 'all' else 'none'#</hide>
- </param>
- <param>
- <name>Option 0</name>
- <key>option0</key>
- <value>0</value>
- <type>$type</type>
- <hide>#if int($num_opts()) > 0 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 0</name>
- <key>label0</key>
- <value></value>
- <type>string</type>
- <hide>$((int($num_opts()) > 0) and ($label0() and 'none' or 'part') or 'all')</hide>
- </param>
- <param>
- <name>Option 1</name>
- <key>option1</key>
- <value>1</value>
- <type>$type</type>
- <hide>#if int($num_opts()) > 1 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 1</name>
- <key>label1</key>
- <value></value>
- <type>string</type>
- <hide>$((int($num_opts()) > 1) and ($label1() and 'none' or 'part') or 'all')</hide>
- </param>
- <param>
- <name>Option 2</name>
- <key>option2</key>
- <value>2</value>
- <type>$type</type>
- <hide>#if int($num_opts()) > 2 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 2</name>
- <key>label2</key>
- <value></value>
- <type>string</type>
- <hide>$((int($num_opts()) > 2) and ($label2() and 'none' or 'part') or 'all')</hide>
- </param>
- <param>
- <name>Option 3</name>
- <key>option3</key>
- <value>3</value>
- <type>$type</type>
- <hide>#if int($num_opts()) > 3 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 3</name>
- <key>label3</key>
- <value></value>
- <type>string</type>
- <hide>$((int($num_opts()) > 3) and ($label3() and 'none' or 'part') or 'all')</hide>
- </param>
- <param>
- <name>Option 4</name>
- <key>option4</key>
- <value>4</value>
- <type>$type</type>
- <hide>#if int($num_opts()) > 4 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 4</name>
- <key>label4</key>
- <value></value>
- <type>string</type>
- <hide>$((int($num_opts()) > 4) and ($label4() and 'none' or 'part') or 'all')</hide>
- </param>
- <param>
- <name>Widget</name>
- <key>widget</key>
- <value>combo_box</value>
- <type>enum</type>
- <hide>part</hide>
- <option><name>Combo Box</name><key>combo_box</key></option>
- <option><name>Radio Buttons</name><key>radio_buttons</key></option>
- </param>
- <param>
- <name>Orientation</name>
- <key>orient</key>
- <value>Qt.QVBoxLayout</value>
- <type>enum</type>
- <hide>#if $widget() == 'radio_buttons' then 'part' else 'all'#</hide>
- <option>
- <name>Horizontal</name>
- <key>Qt.QHBoxLayout</key>
- </option>
- <option>
- <name>Vertical</name>
- <key>Qt.QVBoxLayout</key>
- </option>
- </param>
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- </param>
- <doc>
-This block creates a variable with enumerated options. \
-The gui widget is implemented as a combo box or radio button group. \
-Leave the label blank to use the variable id as the label.
-
-Choose the number of options available to your chooser. \
-When the label is left blank, the option will be used as the label. \
-Set the number of options to "list" to enter a single list of options and labels. \
-When the labels is an empty list, the options will be used as the label.
-
-The GUI hint can be used to position the widget within the application. \
-The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
-Both the tab specification and the grid position are optional.
- </doc>
-</block>
diff --git a/gr-qtgui/grc/qtgui_const_sink_x.block.yml b/gr-qtgui/grc/qtgui_const_sink_x.block.yml
new file mode 100644
index 000000000..1019393d6
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_const_sink_x.block.yml
@@ -0,0 +1,457 @@
+id: qtgui_const_sink_x
+label: QT GUI Constellation Sink
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ default: complex
+ options: [complex, msg_complex]
+ option_labels: [Complex, Complex Message]
+ option_attributes:
+ fcn: [const_sink_c, const_sink_c]
+ t: [complex, message]
+ hide: part
+- id: name
+ label: Name
+ dtype: string
+ default: '""'
+ hide: ${ ('none' if len(name) > 0 else 'part') }
+- id: size
+ label: Number of Points
+ dtype: int
+ default: '1024'
+ hide: ${ ('all' if type.startswith('msg') else 'none') }
+- id: grid
+ label: Grid
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: autoscale
+ label: Autoscale
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: ymin
+ label: Y min
+ dtype: real
+ default: '-2'
+ hide: part
+- id: ymax
+ label: Y max
+ dtype: real
+ default: '2'
+ hide: part
+- id: xmin
+ label: X min
+ dtype: real
+ default: '-2'
+ hide: part
+- id: xmax
+ label: X max
+ dtype: real
+ default: '2'
+ hide: part
+- id: nconnections
+ label: Number of Inputs
+ dtype: int
+ default: '1'
+ hide: ${ ('all' if type.startswith('msg') else 'part') }
+- id: update_time
+ label: Update Period
+ dtype: real
+ default: '0.10'
+ hide: part
+- id: gui_hint
+ label: GUI Hint
+ dtype: gui_hint
+ hide: part
+- id: tr_mode
+ label: Trigger Mode
+ category: Trigger
+ dtype: enum
+ default: qtgui.TRIG_MODE_FREE
+ options: [qtgui.TRIG_MODE_FREE, qtgui.TRIG_MODE_AUTO, qtgui.TRIG_MODE_NORM, qtgui.TRIG_MODE_TAG]
+ option_labels: [Free, Auto, Normal, Tag]
+ hide: part
+- id: tr_slope
+ label: Trigger Slope
+ category: Trigger
+ dtype: enum
+ default: qtgui.TRIG_MODE_POS
+ options: [qtgui.TRIG_SLOPE_POS, qtgui.TRIG_SLOPE_NEG]
+ option_labels: [Positive, Negative]
+ hide: part
+- id: tr_level
+ label: Trigger Level
+ category: Trigger
+ dtype: float
+ default: '0.0'
+ hide: part
+- id: tr_chan
+ label: Trigger Channel
+ category: Trigger
+ dtype: int
+ default: '0'
+ hide: part
+- id: tr_tag
+ label: Trigger Tag Key
+ category: Trigger
+ dtype: string
+ default: '""'
+ hide: part
+- id: legend
+ label: Legend
+ category: Config
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: axislabels
+ label: Axis Labels
+ category: Config
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: label1
+ label: Line 1 Label
+ category: Config
+ dtype: string
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: width1
+ label: Line 1 Width
+ category: Config
+ dtype: int
+ default: '1'
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: color1
+ label: Line 1 Color
+ category: Config
+ dtype: enum
+ options: ['"blue"', '"red"', '"green"', '"black"', '"cyan"', '"magenta"', '"yellow"',
+ '"dark red"', '"dark green"', '"Dark Blue"']
+ option_labels: [Blue, Red, Green, Black, Cyan, Magenta, Yellow, Dark Red, Dark
+ Green, Dark Blue]
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: style1
+ label: Line 1 Style
+ category: Config
+ dtype: enum
+ options: ['0', '1', '2', '3', '4', '5']
+ option_labels: [None, Solid, Dash, Dots, Dash-Dot, Dash-Dot-Dot]
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: marker1
+ label: Line 1 Marker
+ category: Config
+ dtype: enum
+ options: ['0', '1', '2', '3', '4', '6', '7', '8', '9', '-1']
+ option_labels: [Circle, Rectangle, Diamond, Triangle, Down Triangle, Left Triangle,
+ Right Triangle, Cross, X-Cross, None]
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: alpha1
+ label: Line 1 Alpha
+ category: Config
+ dtype: float
+ default: '1.0'
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: label2
+ label: Line 2 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: width2
+ label: Line 2 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: color2
+ label: Line 2 Color
+ dtype: ''
+ default: '"red"'
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: style2
+ label: Line 2 Style
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: marker2
+ label: Line 2 Marker
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: alpha2
+ label: Line 2 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: label3
+ label: Line 3 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: width3
+ label: Line 3 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: color3
+ label: Line 3 Color
+ dtype: ''
+ default: '"red"'
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: style3
+ label: Line 3 Style
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: marker3
+ label: Line 3 Marker
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: alpha3
+ label: Line 3 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: label4
+ label: Line 4 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: width4
+ label: Line 4 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: color4
+ label: Line 4 Color
+ dtype: ''
+ default: '"red"'
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: style4
+ label: Line 4 Style
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: marker4
+ label: Line 4 Marker
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: alpha4
+ label: Line 4 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: label5
+ label: Line 5 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: width5
+ label: Line 5 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: color5
+ label: Line 5 Color
+ dtype: ''
+ default: '"red"'
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: style5
+ label: Line 5 Style
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: marker5
+ label: Line 5 Marker
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: alpha5
+ label: Line 5 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: label6
+ label: Line 6 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: width6
+ label: Line 6 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: color6
+ label: Line 6 Color
+ dtype: ''
+ default: '"red"'
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: style6
+ label: Line 6 Style
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: marker6
+ label: Line 6 Marker
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: alpha6
+ label: Line 6 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: label7
+ label: Line 7 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: width7
+ label: Line 7 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: color7
+ label: Line 7 Color
+ dtype: ''
+ default: '"red"'
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: style7
+ label: Line 7 Style
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: marker7
+ label: Line 7 Marker
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: alpha7
+ label: Line 7 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: label8
+ label: Line 8 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: width8
+ label: Line 8 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: color8
+ label: Line 8 Color
+ dtype: ''
+ default: '"red"'
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: style8
+ label: Line 8 Style
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: marker8
+ label: Line 8 Marker
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: alpha8
+ label: Line 8 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: label9
+ label: Line 9 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: width9
+ label: Line 9 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: color9
+ label: Line 9 Color
+ dtype: ''
+ default: '"red"'
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: style9
+ label: Line 9 Style
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: marker9
+ label: Line 9 Marker
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: alpha9
+ label: Line 9 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: label10
+ label: Line 10 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: width10
+ label: Line 10 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: color10
+ label: Line 10 Color
+ dtype: ''
+ default: '"red"'
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: style10
+ label: Line 10 Style
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: marker10
+ label: Line 10 Marker
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: alpha10
+ label: Line 10 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+
+inputs:
+- domain: stream
+ dtype: ${ type.t }
+ multiplicity: ${ (0 if type.startswith('msg') else nconnections) }
+ optional: true
+
+templates:
+ imports: |-
+ from PyQt5 import Qt
+ from gnuradio import qtgui
+ import sip
+ callbacks:
+ - set_resize(${width}, ${height})
+ - set_update_time(${update_time})
+ - set_title(${which}, ${title})
+ - set_color(${which}, ${color})
+ - self.${id}.set_trigger_mode(${tr_mode}, ${tr_slope}, ${tr_level}, ${tr_chan},
+ ${tr_tag})
+ make: |-
+ <%
+ win = 'self._%s_win'%id
+ %>\
+ qtgui.${type.fcn}(
+ ${size}, #size
+ ${name}, #name
+ ${0 if type.startswith('msg') else nconnections} #number of inputs
+ )
+ self.${id}.set_update_time(${update_time})
+ self.${id}.set_y_axis(${ymin}, ${ymax})
+ self.${id}.set_x_axis(${xmin}, ${xmax})
+ self.${id}.set_trigger_mode(${tr_mode}, ${tr_slope}, ${tr_level}, ${tr_chan}, ${tr_tag})
+ self.${id}.enable_autoscale(${autoscale})
+ self.${id}.enable_grid(${grid})
+ self.${id}.enable_axis_labels(${axislabels})
+
+ if not ${legend}:
+ self.${id}.disable_legend()
+
+ labels = [${label1}, ${label2}, ${label3}, ${label4}, ${label5},
+ ${label6}, ${label7}, ${label8}, ${label9}, ${label10}]
+ widths = [${width1}, ${width2}, ${width3}, ${width4}, ${width5},
+ ${width6}, ${width7}, ${width8}, ${width9}, ${width10}]
+ colors = [${color1}, ${color2}, ${color3}, ${color4}, ${color5},
+ ${color6}, ${color7}, ${color8}, ${color9}, ${color10}]
+ styles = [${style1}, ${style2}, ${style3}, ${style4}, ${style5},
+ ${style6}, ${style7}, ${style8}, ${style9}, ${style10}]
+ markers = [${marker1}, ${marker2}, ${marker3}, ${marker4}, ${marker5},
+ ${marker6}, ${marker7}, ${marker8}, ${marker9}, ${marker10}]
+ alphas = [${alpha1}, ${alpha2}, ${alpha3}, ${alpha4}, ${alpha5},
+ ${alpha6}, ${alpha7}, ${alpha8}, ${alpha9}, ${alpha10}]
+
+ for i in range(${1 if type.startswith('msg') else nconnections}):
+ if len(labels[i]) == 0:
+ self.${id}.set_line_label(i, "Data {0}".format(i))
+ else:
+ self.${id}.set_line_label(i, labels[i])
+ self.${id}.set_line_width(i, widths[i])
+ self.${id}.set_line_color(i, colors[i])
+ self.${id}.set_line_style(i, styles[i])
+ self.${id}.set_line_marker(i, markers[i])
+ self.${id}.set_line_alpha(i, alphas[i])
+
+ self._${id}_win = sip.wrapinstance(self.${id}.pyqwidget(), Qt.QWidget)
+ ${gui_hint() % win}
+
+documentation: |-
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/gr-qtgui/grc/qtgui_const_sink_x.xml b/gr-qtgui/grc/qtgui_const_sink_x.xml
deleted file mode 100644
index 10f82cce8..000000000
--- a/gr-qtgui/grc/qtgui_const_sink_x.xml
+++ /dev/null
@@ -1,859 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##QT GUI Sink
-###################################################
- -->
-<block>
- <name>QT GUI Constellation Sink</name>
- <key>qtgui_const_sink_x</key>
- <import>from PyQt5 import Qt</import>
- <import>from gnuradio import qtgui</import>
- <import>import sip</import>
- <make>#set $win = 'self._%s_win'%$id
-qtgui.$(type.fcn)(
- $size, \#size
- $name, \#name
- #if $type.t == 'message' then 0 else $nconnections# \#number of inputs
-)
-self.$(id).set_update_time($update_time)
-self.$(id).set_y_axis($ymin, $ymax)
-self.$(id).set_x_axis($xmin, $xmax)
-self.$(id).set_trigger_mode($tr_mode, $tr_slope, $tr_level, $tr_chan, $tr_tag)
-self.$(id).enable_autoscale($autoscale)
-self.$(id).enable_grid($grid)
-self.$(id).enable_axis_labels($axislabels)
-
-if not $legend:
- self.$(id).disable_legend()
-
-labels = [$label1, $label2, $label3, $label4, $label5,
- $label6, $label7, $label8, $label9, $label10]
-widths = [$width1, $width2, $width3, $width4, $width5,
- $width6, $width7, $width8, $width9, $width10]
-colors = [$color1, $color2, $color3, $color4, $color5,
- $color6, $color7, $color8, $color9, $color10]
-styles = [$style1, $style2, $style3, $style4, $style5,
- $style6, $style7, $style8, $style9, $style10]
-markers = [$marker1, $marker2, $marker3, $marker4, $marker5,
- $marker6, $marker7, $marker8, $marker9, $marker10]
-alphas = [$alpha1, $alpha2, $alpha3, $alpha4, $alpha5,
- $alpha6, $alpha7, $alpha8, $alpha9, $alpha10]
-for i in xrange(#if $type.t == 'message' then 1 else $nconnections#):
- if len(labels[i]) == 0:
- self.$(id).set_line_label(i, "Data {0}".format(i))
- else:
- self.$(id).set_line_label(i, labels[i])
- self.$(id).set_line_width(i, widths[i])
- self.$(id).set_line_color(i, colors[i])
- self.$(id).set_line_style(i, styles[i])
- self.$(id).set_line_marker(i, markers[i])
- self.$(id).set_line_alpha(i, alphas[i])
-
-self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
-$(gui_hint()($win))</make>
- <callback>set_resize($width, $height)</callback>
- <callback>set_update_time($update_time)</callback>
- <callback>set_title($which, $title)</callback>
- <callback>set_color($which, $color)</callback>
- <callback>self.$(id).set_trigger_mode($tr_mode, $tr_slope, $tr_level, $tr_chan, $tr_tag)</callback>
-
- <param_tab_order>
- <tab>General</tab>
- <tab>Trigger</tab>
- <tab>Config</tab>
- </param_tab_order>
-
- <param>
- <name>Type</name>
- <key>type</key>
- <value>complex</value>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:const_sink_c</opt>
- <opt>t:complex</opt>
- </option>
- <option>
- <name>Complex Message</name>
- <key>msg_complex</key>
- <opt>fcn:const_sink_c</opt>
- <opt>t:message</opt>
- </option>
- </param>
-
- <param>
- <name>Name</name>
- <key>name</key>
- <value>""</value>
- <type>string</type>
- <hide>#if len($name()) > 0 then 'none' else 'part'#</hide>
- </param>
-
- <param>
- <name>Number of Points</name>
- <key>size</key>
- <value>1024</value>
- <type>int</type>
- <hide>#if $type.t == 'message' then 'all' else 'none'#</hide>
- </param>
-
- <param>
- <name>Grid</name>
- <key>grid</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Autoscale</name>
- <key>autoscale</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Y min</name>
- <key>ymin</key>
- <value>-2</value>
- <type>real</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Y max</name>
- <key>ymax</key>
- <value>2</value>
- <type>real</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>X min</name>
- <key>xmin</key>
- <value>-2</value>
- <type>real</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>X max</name>
- <key>xmax</key>
- <value>2</value>
- <type>real</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Number of Inputs</name>
- <key>nconnections</key>
- <value>1</value>
- <type>int</type>
- <hide>#if $type.t == 'message' then 'all' else 'part'#</hide>
- </param>
-
- <param>
- <name>Update Period</name>
- <key>update_time</key>
- <value>0.10</value>
- <type>real</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- </param>
-
-
- <param>
- <name>Trigger Mode</name>
- <key>tr_mode</key>
- <value>qtgui.TRIG_MODE_FREE</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Free</name>
- <key>qtgui.TRIG_MODE_FREE</key>
- </option>
- <option>
- <name>Auto</name>
- <key>qtgui.TRIG_MODE_AUTO</key>
- </option>
- <option>
- <name>Normal</name>
- <key>qtgui.TRIG_MODE_NORM</key>
- </option>
- <option>
- <name>Tag</name>
- <key>qtgui.TRIG_MODE_TAG</key>
- </option>
- <tab>Trigger</tab>
- </param>
-
- <param>
- <name>Trigger Slope</name>
- <key>tr_slope</key>
- <value>qtgui.TRIG_MODE_POS</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Positive</name>
- <key>qtgui.TRIG_SLOPE_POS</key>
- </option>
- <option>
- <name>Negative</name>
- <key>qtgui.TRIG_SLOPE_NEG</key>
- </option>
- <tab>Trigger</tab>
- </param>
-
- <param>
- <name>Trigger Level</name>
- <key>tr_level</key>
- <value>0.0</value>
- <type>float</type>
- <hide>part</hide>
- <tab>Trigger</tab>
- </param>
-
- <param>
- <name>Trigger Channel</name>
- <key>tr_chan</key>
- <value>0</value>
- <type>int</type>
- <hide>part</hide>
- <tab>Trigger</tab>
- </param>
-
- <param>
- <name>Trigger Tag Key</name>
- <key>tr_tag</key>
- <value>""</value>
- <type>string</type>
- <hide>part</hide>
- <tab>Trigger</tab>
- </param>
-
-
-
- <!-- Begin Config Tab items -->
- <param>
- <name>Legend</name>
- <key>legend</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Axis Labels</name>
- <key>axislabels</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Label</name>
- <key>label1</key>
- <type>string</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Width</name>
- <key>width1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Color</name>
- <key>color1</key>
- <type>enum</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <option>
- <name>Blue</name>
- <key>"blue"</key>
- </option>
- <option>
- <name>Red</name>
- <key>"red"</key>
- </option>
- <option>
- <name>Green</name>
- <key>"green"</key>
- </option>
- <option>
- <name>Black</name>
- <key>"black"</key>
- </option>
- <option>
- <name>Cyan</name>
- <key>"cyan"</key>
- </option>
- <option>
- <name>Magenta</name>
- <key>"magenta"</key>
- </option>
- <option>
- <name>Yellow</name>
- <key>"yellow"</key>
- </option>
- <option>
- <name>Dark Red</name>
- <key>"dark red"</key>
- </option>
- <option>
- <name>Dark Green</name>
- <key>"dark green"</key>
- </option>
- <option>
- <name>Dark Blue</name>
- <key>"Dark Blue"</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Style</name>
- <key>style1</key>
- <type>enum</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <option>
- <name>None</name>
- <key>0</key>
- </option>
- <option>
- <name>Solid</name>
- <key>1</key>
- </option>
- <option>
- <name>Dash</name>
- <key>2</key>
- </option>
- <option>
- <name>Dots</name>
- <key>3</key>
- </option>
- <option>
- <name>Dash-Dot</name>
- <key>4</key>
- </option>
- <option>
- <name>Dash-Dot-Dot</name>
- <key>5</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Marker</name>
- <key>marker1</key>
- <type>enum</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <option>
- <name>Circle</name>
- <key>0</key>
- </option>
- <option>
- <name>Rectangle</name>
- <key>1</key>
- </option>
- <option>
- <name>Diamond</name>
- <key>2</key>
- </option>
- <option>
- <name>Triangle</name>
- <key>3</key>
- </option>
- <option>
- <name>Down Triangle</name>
- <key>4</key>
- </option>
- <option>
- <name>Left Triangle</name>
- <key>6</key>
- </option>
- <option>
- <name>Right Triangle</name>
- <key>7</key>
- </option>
- <option>
- <name>Cross</name>
- <key>8</key>
- </option>
- <option>
- <name>X-Cross</name>
- <key>9</key>
- </option>
- <option>
- <name>None</name>
- <key>-1</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Alpha</name>
- <key>alpha1</key>
- <value>1.0</value>
- <type>float</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 2 Label</name>
- <key>label2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 2 Width</name>
- <key>width2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 2 Color</name>
- <key>color2</key>
- <value>"red"</value>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 2 Style</name>
- <key>style2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 2 Marker</name>
- <key>marker2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 2 Alpha</name>
- <key>alpha2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 3 Label</name>
- <key>label3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 3 Width</name>
- <key>width3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 3 Color</name>
- <key>color3</key>
- <value>"red"</value>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 3 Style</name>
- <key>style3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 3 Marker</name>
- <key>marker3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 3 Alpha</name>
- <key>alpha3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 4 Label</name>
- <key>label4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 4 Width</name>
- <key>width4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 4 Color</name>
- <key>color4</key>
- <value>"red"</value>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 4 Style</name>
- <key>style4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 4 Marker</name>
- <key>marker4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 4 Alpha</name>
- <key>alpha4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 5 Label</name>
- <key>label5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 5 Width</name>
- <key>width5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 5 Color</name>
- <key>color5</key>
- <value>"red"</value>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 5 Style</name>
- <key>style5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 5 Marker</name>
- <key>marker5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 5 Alpha</name>
- <key>alpha5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 6 Label</name>
- <key>label6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 6 Width</name>
- <key>width6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 6 Color</name>
- <key>color6</key>
- <value>"red"</value>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 6 Style</name>
- <key>style6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 6 Marker</name>
- <key>marker6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 6 Alpha</name>
- <key>alpha6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 7 Label</name>
- <key>label7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 7 Width</name>
- <key>width7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 7 Color</name>
- <key>color7</key>
- <value>"red"</value>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 7 Style</name>
- <key>style7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 7 Marker</name>
- <key>marker7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 7 Alpha</name>
- <key>alpha7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 8 Label</name>
- <key>label8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 8 Width</name>
- <key>width8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 8 Color</name>
- <key>color8</key>
- <value>"red"</value>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 8 Style</name>
- <key>style8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 8 Marker</name>
- <key>marker8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 8 Alpha</name>
- <key>alpha8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 9 Label</name>
- <key>label9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 9 Width</name>
- <key>width9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 9 Color</name>
- <key>color9</key>
- <value>"red"</value>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 9 Style</name>
- <key>style9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 9 Marker</name>
- <key>marker9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 9 Alpha</name>
- <key>alpha9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 10 Label</name>
- <key>label10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 10 Width</name>
- <key>width10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 10 Color</name>
- <key>color10</key>
- <value>"red"</value>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 10 Style</name>
- <key>style10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 10 Marker</name>
- <key>marker10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 10 Alpha</name>
- <key>alpha10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
-
- <sink>
- <name>in</name>
- <type>$type.t</type>
- <nports>#if $type.t == 'message' then 0 else $nconnections#</nports>
- <optional>1</optional>
- </sink>
-
- <doc>
-The GUI hint can be used to position the widget within the application. \
-The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
-Both the tab specification and the grid position are optional.
- </doc>
-</block>
diff --git a/gr-qtgui/grc/qtgui_edit_box_msg.block.yml b/gr-qtgui/grc/qtgui_edit_box_msg.block.yml
new file mode 100644
index 000000000..ac867bfce
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_edit_box_msg.block.yml
@@ -0,0 +1,69 @@
+id: qtgui_edit_box_msg
+label: QT GUI Message Edit Box
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ default: string
+ options: [string, int, float, double, complex, int_vec, flt_vec, dbl_vec, cpx_vec]
+ option_labels: [String, Int, Float, Double, Complex, Int (Vec), Float (Vec), Double
+ (Vec), Complex (Vec)]
+ option_attributes:
+ t: [qtgui.STRING, qtgui.INT, qtgui.FLOAT, qtgui.DOUBLE, qtgui.COMPLEX, qtgui.INT_VEC,
+ qtgui.FLOAT_VEC, qtgui.DOUBLE_VEC, qtgui.COMPLEX_VEC]
+- id: value
+ label: Value
+ dtype: string
+- id: label
+ label: Label
+ dtype: string
+- id: is_pair
+ label: Pair Mode
+ dtype: enum
+ default: 'True'
+ options: ['False', 'True']
+- id: is_static
+ label: Static Mode
+ dtype: enum
+ default: 'True'
+ options: ['False', 'True']
+- id: key
+ label: Key
+ dtype: string
+ hide: ${ ('none' if is_pair == 'True' else 'all') }
+- id: gui_hint
+ label: GUI Hint
+ dtype: gui_hint
+ hide: part
+
+asserts:
+- ${(is_pair and is_static and len(key) > 0) or not (is_pair and is_static)}
+
+inputs:
+- domain: message
+ id: val
+ optional: true
+
+outputs:
+- domain: message
+ id: msg
+ optional: true
+
+templates:
+ imports: |-
+ from PyQt5 import Qt
+ from gnuradio import qtgui
+ import sip
+ make:
+ <%
+ win = 'self._%s_win'%id
+ %>\
+ qtgui.edit_box_msg(${type.t)}, ${value}, ${label}, ${is_pair}, ${is_static}, ${key})
+ ${win} = sip.wrapinstance(self.${id}.pyqwidget(), Qt.QWidget)
+ ${gui_hint() % win}
+
+documentation: |-
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/gr-qtgui/grc/qtgui_edit_box_msg.xml b/gr-qtgui/grc/qtgui_edit_box_msg.xml
deleted file mode 100644
index d77a4b3e1..000000000
--- a/gr-qtgui/grc/qtgui_edit_box_msg.xml
+++ /dev/null
@@ -1,152 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##QT GUI Edit Box that sends messages
-###################################################
- -->
-<block>
- <name>QT GUI Message Edit Box</name>
- <key>qtgui_edit_box_msg</key>
- <import>from PyQt5 import Qt</import>
- <import>from gnuradio import qtgui</import>
- <import>import sip</import>
- <make>#set $win = 'self._%s_win'%$id
-qtgui.edit_box_msg($(type.t), $value, $label, $is_pair, $is_static, $key)
-self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
-$(gui_hint()($win))</make>
-
- <param>
- <name>Type</name>
- <key>type</key>
- <value>string</value>
- <type>enum</type>
- <option>
- <name>String</name>
- <key>string</key>
- <opt>t:qtgui.STRING</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>t:qtgui.INT</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>t:qtgui.FLOAT</opt>
- </option>
- <option>
- <name>Double</name>
- <key>double</key>
- <opt>t:qtgui.DOUBLE</opt>
- </option>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>t:qtgui.COMPLEX</opt>
- </option>
- <option>
- <name>Int (Vec)</name>
- <key>int_vec</key>
- <opt>t:qtgui.INT_VEC</opt>
- </option>
- <option>
- <name>Float (Vec)</name>
- <key>flt_vec</key>
- <opt>t:qtgui.FLOAT_VEC</opt>
- </option>
- <option>
- <name>Double (Vec)</name>
- <key>dbl_vec</key>
- <opt>t:qtgui.DOUBLE_VEC</opt>
- </option>
- <option>
- <name>Complex (Vec)</name>
- <key>cpx_vec</key>
- <opt>t:qtgui.COMPLEX_VEC</opt>
- </option>
- </param>
-
- <param>
- <name>Value</name>
- <key>value</key>
- <value></value>
- <type>string</type>
- </param>
-
- <param>
- <name>Label</name>
- <key>label</key>
- <value></value>
- <type>string</type>
- </param>
-
- <param>
- <name>Pair Mode</name>
- <key>is_pair</key>
- <value>True</value>
- <type>enum</type>
- <option>
- <name>False</name>
- <key>False</key>
- </option>
- <option>
- <name>True</name>
- <key>True</key>
- </option>
- </param>
-
- <param>
- <name>Static Mode</name>
- <key>is_static</key>
- <value>True</value>
- <type>enum</type>
- <option>
- <name>False</name>
- <key>False</key>
- </option>
- <option>
- <name>True</name>
- <key>True</key>
- </option>
- </param>
-
- <param>
- <name>Key</name>
- <key>key</key>
- <value></value>
- <type>string</type>
- <hide>#if $is_pair() == 'True' then 'none' else 'all'#</hide>
- </param>
-
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- </param>
-
- <!-- If both is_pair and is_static are True, we require a default key.
- If either or both are false, we don't care about a default key.
- -->
- <check>($is_pair and $is_static and len($key) &gt; 0) or not ($is_pair and $is_static)</check>
-
- <sink>
- <name>val</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
-
- <source>
- <name>msg</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-
- <doc>
-The GUI hint can be used to position the widget within the application. \
-The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
-Both the tab specification and the grid position are optional.
- </doc>
-</block>
diff --git a/gr-qtgui/grc/qtgui_entry.block.yml b/gr-qtgui/grc/qtgui_entry.block.yml
new file mode 100644
index 000000000..8a430b287
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_entry.block.yml
@@ -0,0 +1,57 @@
+id: variable_qtgui_entry
+label: QT GUI Entry
+
+parameters:
+- id: label
+ label: Label
+ dtype: string
+ hide: ${ ('none' if label else 'part') }
+- id: type
+ label: Type
+ dtype: enum
+ default: int
+ options: [real, int, string, bool, raw]
+ option_labels: [Float, Integer, String, Boolean, Any]
+ option_attributes:
+ conv: [eng_notation.str_to_num, int, str, bool, eval]
+ str: [eng_notation.num_to_str, str, str, str, repr]
+ hide: part
+- id: value
+ label: Default Value
+ dtype: ${ type }
+ default: '0'
+- id: gui_hint
+ label: GUI Hint
+ dtype: gui_hint
+ hide: part
+value: ${ value }
+
+templates:
+ imports: |-
+ from PyQt5 import Qt
+ from gnuradio import eng_notation
+ var_make: self.${id} = ${id} = ${value}
+ callbacks:
+ - self.set_${id}(${value})
+ - Qt.QMetaObject.invokeMethod(self._${id}_line_edit, "setText", Qt.Q_ARG("QString",
+ ${type.str}(${id})))
+ make: |-
+ <%
+ win = 'self._%s_tool_bar'%id
+ if not label:
+ label = '"%s"'%id
+ %>
+ ${win} = Qt.QToolBar(self)
+ ${win}.addWidget(Qt.QLabel(${label}+": "))
+ self._${id}_line_edit = Qt.QLineEdit(str(self.${id}))
+ self._${id}_tool_bar.addWidget(self._${id}_line_edit)
+ self._${id}_line_edit.returnPressed.connect(
+ lambda: self.set_${id}(${type.conv}(str(self._${id}_line_edit.text().toAscii()))))
+ ${gui_hint() % win}
+
+documentation: |-
+ This block creates a variable with a text entry box. Leave the label blank to use the variable id as the label.
+
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/gr-qtgui/grc/qtgui_entry.xml b/gr-qtgui/grc/qtgui_entry.xml
deleted file mode 100644
index fc0f4089d..000000000
--- a/gr-qtgui/grc/qtgui_entry.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Variable Text Entry:
-## a gui text box form
-###################################################
- -->
-<block>
- <name>QT GUI Entry</name>
- <key>variable_qtgui_entry</key>
- <import>from PyQt5 import Qt</import>
- <import>from gnuradio import eng_notation</import>
- <var_make>self.$(id) = $(id) = $value</var_make>
- <make>#set $win = 'self._%s_tool_bar'%$id
-$win = Qt.QToolBar(self)
-#if not $label()
- #set $label = '"%s"'%$id
-#end if
-$(win).addWidget(Qt.QLabel($label+": "))
-self._$(id)_line_edit = Qt.QLineEdit(str(self.$id))
-self._$(id)_tool_bar.addWidget(self._$(id)_line_edit)
-self._$(id)_line_edit.returnPressed.connect(
- lambda: self.set_$(id)($(type.conv)(str(self._$(id)_line_edit.text().toAscii()))))
-$(gui_hint()($win))</make>
- <callback>self.set_$(id)($value)</callback>
- <callback>Qt.QMetaObject.invokeMethod(self._$(id)_line_edit, "setText", Qt.Q_ARG("QString", $(type.str)($id)))</callback>
- <param>
- <name>Label</name>
- <key>label</key>
- <value></value>
- <type>string</type>
- <hide>#if $label() then 'none' else 'part'#</hide>
- </param>
- <param>
- <name>Type</name>
- <key>type</key>
- <value>int</value>
- <type>enum</type>
- <hide>part</hide>
- <option><name>Float</name><key>real</key><opt>conv:eng_notation.str_to_num</opt><opt>str:eng_notation.num_to_str</opt></option>
- <option><name>Integer</name><key>int</key><opt>conv:int</opt><opt>str:str</opt></option>
- <option><name>String</name><key>string</key><opt>conv:str</opt><opt>str:str</opt></option>
- <option><name>Boolean</name><key>bool</key><opt>conv:bool</opt><opt>str:str</opt></option>
- <option><name>Any</name><key>raw</key><opt>conv:eval</opt><opt>str:repr</opt></option>
- </param>
- <param>
- <name>Default Value</name>
- <key>value</key>
- <value>0</value>
- <type>$type</type>
- </param>
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- </param>
- <doc>
-This block creates a variable with a text entry box. \
-Leave the label blank to use the variable id as the label.
-
-The GUI hint can be used to position the widget within the application. \
-The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
-Both the tab specification and the grid position are optional.
- </doc>
-</block>
diff --git a/gr-qtgui/grc/qtgui_freq_sink_x.block.yml b/gr-qtgui/grc/qtgui_freq_sink_x.block.yml
new file mode 100644
index 000000000..d935f04c4
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_freq_sink_x.block.yml
@@ -0,0 +1,447 @@
+id: qtgui_freq_sink_x
+label: QT GUI Frequency Sink
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ default: complex
+ options: [complex, float, msg_complex, msg_float]
+ option_labels: [Complex, Float, Complex Message, Float Message]
+ option_attributes:
+ fcn: [freq_sink_c, freq_sink_f, freq_sink_c, freq_sink_f]
+ t: [complex, float, message, message]
+ hide: part
+- id: name
+ label: Name
+ dtype: string
+ default: '""'
+ hide: ${ ('none' if len(name) > 0 else 'part') }
+- id: fftsize
+ label: FFT Size
+ dtype: int
+ default: '1024'
+ hide: ${ ('all' if (type == 'msg_complex' or type == 'msg_float') else 'none') }
+- id: freqhalf
+ label: Spectrum Width
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: [Full, Half]
+ hide: ${ ('part' if type == "float" or type == "msg_float" else 'all') }
+- id: wintype
+ label: Window Type
+ dtype: enum
+ default: firdes.WIN_BLACKMAN_hARRIS
+ options: [firdes.WIN_BLACKMAN_hARRIS, firdes.WIN_HAMMING, firdes.WIN_HANN, firdes.WIN_BLACKMAN,
+ firdes.WIN_RECTANGULAR, firdes.WIN_KAISER, firdes.WIN_FLATTOP]
+ option_labels: [Blackman-harris, Hamming, Hann, Blackman, Rectangular, Kaiser,
+ Flat-top]
+ hide: part
+- id: fc
+ label: Center Frequency (Hz)
+ dtype: real
+ default: '0'
+- id: bw
+ label: Bandwidth (Hz)
+ dtype: real
+ default: samp_rate
+- id: grid
+ label: Grid
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: autoscale
+ label: Autoscale
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: average
+ label: Average
+ dtype: enum
+ default: 'False'
+ options: ['1.0', '0.2', '0.1', '0.05']
+ option_labels: [None, Low, Medium, High]
+ hide: part
+- id: ymin
+ label: Y min
+ dtype: real
+ default: '-140'
+ hide: part
+- id: ymax
+ label: Y max
+ dtype: real
+ default: '10'
+ hide: part
+- id: label
+ label: Y label
+ dtype: string
+ default: Relative Gain
+ hide: part
+- id: units
+ label: Y units
+ dtype: string
+ default: dB
+ hide: part
+- id: nconnections
+ label: Number of Inputs
+ dtype: int
+ default: '1'
+ hide: ${ ('all' if (type == 'msg_complex' or type == 'msg_float') else 'part') }
+- id: update_time
+ label: Update Period
+ dtype: real
+ default: '0.10'
+ hide: part
+- id: gui_hint
+ label: GUI Hint
+ dtype: gui_hint
+ hide: part
+- id: showports
+ label: Show Msg Ports
+ dtype: enum
+ default: 'True'
+ options: ['False', 'True']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: tr_mode
+ label: Trigger Mode
+ category: Trigger
+ dtype: enum
+ default: qtgui.TRIG_MODE_FREE
+ options: [qtgui.TRIG_MODE_FREE, qtgui.TRIG_MODE_AUTO, qtgui.TRIG_MODE_NORM, qtgui.TRIG_MODE_TAG]
+ option_labels: [Free, Auto, Normal, Tag]
+ hide: part
+- id: tr_level
+ label: Trigger Level
+ category: Trigger
+ dtype: float
+ default: '0.0'
+ hide: part
+- id: tr_chan
+ label: Trigger Channel
+ category: Trigger
+ dtype: int
+ default: '0'
+ hide: part
+- id: tr_tag
+ label: Trigger Tag Key
+ category: Trigger
+ dtype: string
+ default: '""'
+ hide: part
+- id: ctrlpanel
+ label: Control Panel
+ category: Config
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: legend
+ label: Legend
+ category: Config
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: axislabels
+ label: Axis Labels
+ category: Config
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: label1
+ label: Line 1 Label
+ category: Config
+ dtype: string
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: width1
+ label: Line 1 Width
+ category: Config
+ dtype: int
+ default: '1'
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: color1
+ label: Line 1 Color
+ category: Config
+ dtype: enum
+ options: ['"blue"', '"red"', '"green"', '"black"', '"cyan"', '"magenta"', '"yellow"',
+ '"dark red"', '"dark green"', '"dark blue"']
+ option_labels: [Blue, Red, Green, Black, Cyan, Magenta, Yellow, Dark Red, Dark
+ Green, Dark Blue]
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: alpha1
+ label: Line 1 Alpha
+ category: Config
+ dtype: float
+ default: '1.0'
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: label2
+ label: Line 2 Label
+ dtype: ''
+ default: "''"
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: width2
+ label: Line 2 Width
+ dtype: ''
+ default: '1'
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: color2
+ label: Line 2 Color
+ dtype: ''
+ default: '"red"'
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: alpha2
+ label: Line 2 Alpha
+ dtype: ''
+ default: '1.0'
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: label3
+ label: Line 3 Label
+ dtype: ''
+ default: "''"
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: width3
+ label: Line 3 Width
+ dtype: ''
+ default: '1'
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: color3
+ label: Line 3 Color
+ dtype: ''
+ default: '"green"'
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: alpha3
+ label: Line 3 Alpha
+ dtype: ''
+ default: '1.0'
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: label4
+ label: Line 4 Label
+ dtype: ''
+ default: "''"
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: width4
+ label: Line 4 Width
+ dtype: ''
+ default: '1'
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: color4
+ label: Line 4 Color
+ dtype: ''
+ default: '"black"'
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: alpha4
+ label: Line 4 Alpha
+ dtype: ''
+ default: '1.0'
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: label5
+ label: Line 5 Label
+ dtype: ''
+ default: "''"
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: width5
+ label: Line 5 Width
+ dtype: ''
+ default: '1'
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: color5
+ label: Line 5 Color
+ dtype: ''
+ default: '"cyan"'
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: alpha5
+ label: Line 5 Alpha
+ dtype: ''
+ default: '1.0'
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: label6
+ label: Line 6 Label
+ dtype: ''
+ default: "''"
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: width6
+ label: Line 6 Width
+ dtype: ''
+ default: '1'
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: color6
+ label: Line 6 Color
+ dtype: ''
+ default: '"magenta"'
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: alpha6
+ label: Line 6 Alpha
+ dtype: ''
+ default: '1.0'
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: label7
+ label: Line 7 Label
+ dtype: ''
+ default: "''"
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: width7
+ label: Line 7 Width
+ dtype: ''
+ default: '1'
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: color7
+ label: Line 7 Color
+ dtype: ''
+ default: '"yellow"'
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: alpha7
+ label: Line 7 Alpha
+ dtype: ''
+ default: '1.0'
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: label8
+ label: Line 8 Label
+ dtype: ''
+ default: "''"
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: width8
+ label: Line 8 Width
+ dtype: ''
+ default: '1'
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: color8
+ label: Line 8 Color
+ dtype: ''
+ default: '"dark red"'
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: alpha8
+ label: Line 8 Alpha
+ dtype: ''
+ default: '1.0'
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: label9
+ label: Line 9 Label
+ dtype: ''
+ default: "''"
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: width9
+ label: Line 9 Width
+ dtype: ''
+ default: '1'
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: color9
+ label: Line 9 Color
+ dtype: ''
+ default: '"dark green"'
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: alpha9
+ label: Line 9 Alpha
+ dtype: ''
+ default: '1.0'
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: label10
+ label: Line 10 Label
+ dtype: ''
+ default: "''"
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: width10
+ label: Line 10 Width
+ dtype: ''
+ default: '1'
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: color10
+ label: Line 10 Color
+ dtype: ''
+ default: '"dark blue"'
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: alpha10
+ label: Line 10 Alpha
+ dtype: ''
+ default: '1.0'
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+
+inputs:
+- domain: stream
+ dtype: ${ type.t }
+ multiplicity: ${ (0 if (type == 'msg_complex' or type == 'msg_float') else nconnections) }
+ optional: true
+- domain: message
+ id: freq
+ optional: true
+ hide: ${ showports }
+
+outputs:
+- domain: message
+ id: freq
+ optional: true
+ hide: ${ showports }
+
+templates:
+ imports: |-
+ from PyQt5 import Qt
+ from gnuradio import qtgui
+ from gnuradio.filter import firdes
+ import sip
+ callbacks:
+ - set_frequency_range(${fc}, ${bw})
+ - set_update_time(${update_time})
+ - set_y_axis(${ymin}, ${ymax})
+ - self.${id}.set_trigger_mode(${tr_mode}, ${tr_level}, ${tr_chan}, ${tr_tag})
+ make: |-
+ <%
+ win = 'self._%s_win'%id
+ %>\
+ qtgui.${type.fcn}(
+ ${fftsize}, #size
+ ${wintype}, #wintype
+ ${fc}, #fc
+ ${bw}, #bw
+ ${name}, #name
+ ${ 0 if (type == 'msg_complex' or type == 'msg_float') else nconnections }
+ )
+ self.${id}.set_update_time(${update_time})
+ self.${id}.set_y_axis(${ymin}, ${ymax})
+ self.${id}.set_y_label(${label}, ${units})
+ self.${id}.set_trigger_mode(${tr_mode}, ${tr_level}, ${tr_chan}, ${tr_tag})
+ self.${id}.enable_autoscale(${autoscale})
+ self.${id}.enable_grid(${grid})
+ self.${id}.set_fft_average(${average})
+ self.${id}.enable_axis_labels(${axislabels})
+ self.${id}.enable_control_panel(${ctrlpanel})
+
+ if not ${legend}:
+ self.${id}.disable_legend()
+
+ if ${type} == "float" or ${type} == "msg_float":
+ self.${id}.set_plot_pos_half(not ${freqhalf})
+
+ labels = [${label1}, ${label2}, ${label3}, ${label4}, ${label5},
+ ${label6}, ${label7}, ${label8}, ${label9}, ${label10}]
+ widths = [${width1}, ${width2}, ${width3}, ${width4}, ${width5},
+ ${width6}, ${width7}, ${width8}, ${width9}, ${width10}]
+ colors = [${color1}, ${color2}, ${color3}, ${color4}, ${color5},
+ ${color6}, ${color7}, ${color8}, ${color9}, ${color10}]
+ alphas = [${alpha1}, ${alpha2}, ${alpha3}, ${alpha4}, ${alpha5},
+ ${alpha6}, ${alpha7}, ${alpha8}, ${alpha9}, ${alpha10}]
+
+ for i in range(${1 if (type == 'msg_complex' or type == 'msg_float') else nconnections}):
+ if len(labels[i]) == 0:
+ self.${id}.set_line_label(i, "Data {0}".format(i))
+ else:
+ self.${id}.set_line_label(i, labels[i])
+ self.${id}.set_line_width(i, widths[i])
+ self.${id}.set_line_color(i, colors[i])
+ self.${id}.set_line_alpha(i, alphas[i])
+
+ ${win} = sip.wrapinstance(self.${id}.pyqwidget(), Qt.QWidget)
+ ${ gui_hint()(win)}
+
+documentation: |-
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/gr-qtgui/grc/qtgui_freq_sink_x.xml b/gr-qtgui/grc/qtgui_freq_sink_x.xml
deleted file mode 100644
index ed39db778..000000000
--- a/gr-qtgui/grc/qtgui_freq_sink_x.xml
+++ /dev/null
@@ -1,791 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##QT GUI Sink
-###################################################
- -->
-<block>
- <name>QT GUI Frequency Sink</name>
- <key>qtgui_freq_sink_x</key>
- <import>from PyQt5 import Qt</import>
- <import>from gnuradio import qtgui</import>
- <import>from gnuradio.filter import firdes</import>
- <import>import sip</import>
- <make>#set $win = 'self._%s_win'%$id
-qtgui.$(type.fcn)(
- $fftsize, \#size
- $wintype, \#wintype
- $fc, \#fc
- $bw, \#bw
- $name, \#name
- #if $type.t == 'message' then 0 else $nconnections# \#number of inputs
-)
-self.$(id).set_update_time($update_time)
-self.$(id).set_y_axis($ymin, $ymax)
-self.$(id).set_y_label($label, $units)
-self.$(id).set_trigger_mode($tr_mode, $tr_level, $tr_chan, $tr_tag)
-self.$(id).enable_autoscale($autoscale)
-self.$(id).enable_grid($grid)
-self.$(id).set_fft_average($average)
-self.$(id).enable_axis_labels($axislabels)
-self.$(id).enable_control_panel($ctrlpanel)
-
-if not $legend:
- self.$(id).disable_legend()
-
-if "$type" == "float" or "$type" == "msg_float":
- self.$(id).set_plot_pos_half(not $freqhalf)
-
-labels = [$label1, $label2, $label3, $label4, $label5,
- $label6, $label7, $label8, $label9, $label10]
-widths = [$width1, $width2, $width3, $width4, $width5,
- $width6, $width7, $width8, $width9, $width10]
-colors = [$color1, $color2, $color3, $color4, $color5,
- $color6, $color7, $color8, $color9, $color10]
-alphas = [$alpha1, $alpha2, $alpha3, $alpha4, $alpha5,
- $alpha6, $alpha7, $alpha8, $alpha9, $alpha10]
-for i in xrange(#if $type.t == 'message' then 1 else $nconnections#):
- if len(labels[i]) == 0:
- self.$(id).set_line_label(i, "Data {0}".format(i))
- else:
- self.$(id).set_line_label(i, labels[i])
- self.$(id).set_line_width(i, widths[i])
- self.$(id).set_line_color(i, colors[i])
- self.$(id).set_line_alpha(i, alphas[i])
-
-self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
-$(gui_hint()($win))</make>
- <callback>set_frequency_range($fc, $bw)</callback>
- <callback>set_update_time($update_time)</callback>
- <callback>set_title($which, $title)</callback>
- <callback>set_color($which, $color)</callback>
- <callback>set_y_axis($ymin, $ymax)</callback>
- <callback>self.$(id).set_trigger_mode($tr_mode, $tr_level, $tr_chan, $tr_tag)</callback>
-
- <param_tab_order>
- <tab>General</tab>
- <tab>Trigger</tab>
- <tab>Config</tab>
- </param_tab_order>
-
- <param>
- <name>Type</name>
- <key>type</key>
- <value>complex</value>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:freq_sink_c</opt>
- <opt>t:complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:freq_sink_f</opt>
- <opt>t:float</opt>
- </option>
- <option>
- <name>Complex Message</name>
- <key>msg_complex</key>
- <opt>fcn:freq_sink_c</opt>
- <opt>t:message</opt>
- </option>
- <option>
- <name>Float Message</name>
- <key>msg_float</key>
- <opt>fcn:freq_sink_f</opt>
- <opt>t:message</opt>
- </option>
- </param>
-
- <param>
- <name>Name</name>
- <key>name</key>
- <value>""</value>
- <type>string</type>
- <hide>#if len($name()) > 0 then 'none' else 'part'#</hide>
- </param>
-
- <param>
- <name>FFT Size</name>
- <key>fftsize</key>
- <value>1024</value>
- <type>int</type>
- <hide>#if $type.t == 'message' then 'all' else 'none'#</hide>
- </param>
-
- <param>
- <name>Spectrum Width</name>
- <key>freqhalf</key>
- <value>True</value>
- <type>enum</type>
- <hide>#if $type() == "float" or $type() == "msg_float" then 'part' else 'all'#</hide>
- <option>
- <name>Full</name>
- <key>True</key>
- </option>
- <option>
- <name>Half</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Window Type</name>
- <key>wintype</key>
- <value>firdes.WIN_BLACKMAN_hARRIS</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Blackman-harris</name>
- <key>firdes.WIN_BLACKMAN_hARRIS</key>
- </option>
- <option>
- <name>Hamming</name>
- <key>firdes.WIN_HAMMING</key>
- </option>
- <option>
- <name>Hann</name>
- <key>firdes.WIN_HANN</key>
- </option>
- <option>
- <name>Blackman</name>
- <key>firdes.WIN_BLACKMAN</key>
- </option>
- <option>
- <name>Rectangular</name>
- <key>firdes.WIN_RECTANGULAR</key>
- </option>
- <option>
- <name>Kaiser</name>
- <key>firdes.WIN_KAISER</key>
- </option>
- <option>
- <name>Flat-top</name>
- <key>firdes.WIN_FLATTOP</key>
- </option>
- </param>
-
- <param>
- <name>Center Frequency (Hz)</name>
- <key>fc</key>
- <value>0</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Bandwidth (Hz)</name>
- <key>bw</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Grid</name>
- <key>grid</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Autoscale</name>
- <key>autoscale</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Average</name>
- <key>average</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>None</name>
- <key>1.0</key>
- </option>
- <option>
- <name>Low</name>
- <key>0.2</key>
- </option>
- <option>
- <name>Medium</name>
- <key>0.1</key>
- </option>
- <option>
- <name>High</name>
- <key>0.05</key>
- </option>
- </param>
-
- <param>
- <name>Y min</name>
- <key>ymin</key>
- <value>-140</value>
- <type>real</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Y max</name>
- <key>ymax</key>
- <value>10</value>
- <type>real</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Y label</name>
- <key>label</key>
- <value>Relative Gain</value>
- <type>string</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Y units</name>
- <key>units</key>
- <value>dB</value>
- <type>string</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Number of Inputs</name>
- <key>nconnections</key>
- <value>1</value>
- <type>int</type>
- <hide>#if $type.t == 'message' then 'all' else 'part'#</hide>
- </param>
-
- <param>
- <name>Update Period</name>
- <key>update_time</key>
- <value>0.10</value>
- <type>real</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Show Msg Ports</name>
- <key>showports</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>False</key>
- </option>
- <option>
- <name>No</name>
- <key>True</key>
- </option>
- </param>
-
-
- <!-- Begin Trigger Tab items -->
- <param>
- <name>Trigger Mode</name>
- <key>tr_mode</key>
- <value>qtgui.TRIG_MODE_FREE</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Free</name>
- <key>qtgui.TRIG_MODE_FREE</key>
- </option>
- <option>
- <name>Auto</name>
- <key>qtgui.TRIG_MODE_AUTO</key>
- </option>
- <option>
- <name>Normal</name>
- <key>qtgui.TRIG_MODE_NORM</key>
- </option>
- <option>
- <name>Tag</name>
- <key>qtgui.TRIG_MODE_TAG</key>
- </option>
- <tab>Trigger</tab>
- </param>
-
- <param>
- <name>Trigger Level</name>
- <key>tr_level</key>
- <value>0.0</value>
- <type>float</type>
- <hide>part</hide>
- <tab>Trigger</tab>
- </param>
-
- <param>
- <name>Trigger Channel</name>
- <key>tr_chan</key>
- <value>0</value>
- <type>int</type>
- <hide>part</hide>
- <tab>Trigger</tab>
- </param>
-
- <param>
- <name>Trigger Tag Key</name>
- <key>tr_tag</key>
- <value>""</value>
- <type>string</type>
- <hide>part</hide>
- <tab>Trigger</tab>
- </param>
-
-
-
- <!-- Begin Config Tab items -->
- <param>
- <name>Control Panel</name>
- <key>ctrlpanel</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Legend</name>
- <key>legend</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Axis Labels</name>
- <key>axislabels</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Label</name>
- <key>label1</key>
- <type>string</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Width</name>
- <key>width1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Color</name>
- <key>color1</key>
- <type>enum</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <option>
- <name>Blue</name>
- <key>"blue"</key>
- </option>
- <option>
- <name>Red</name>
- <key>"red"</key>
- </option>
- <option>
- <name>Green</name>
- <key>"green"</key>
- </option>
- <option>
- <name>Black</name>
- <key>"black"</key>
- </option>
- <option>
- <name>Cyan</name>
- <key>"cyan"</key>
- </option>
- <option>
- <name>Magenta</name>
- <key>"magenta"</key>
- </option>
- <option>
- <name>Yellow</name>
- <key>"yellow"</key>
- </option>
- <option>
- <name>Dark Red</name>
- <key>"dark red"</key>
- </option>
- <option>
- <name>Dark Green</name>
- <key>"dark green"</key>
- </option>
- <option>
- <name>Dark Blue</name>
- <key>"dark blue"</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Alpha</name>
- <key>alpha1</key>
- <value>1.0</value>
- <type>float</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 2 Label</name>
- <key>label2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 2 Width</name>
- <key>width2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 2 Color</name>
- <key>color2</key>
- <value>"red"</value>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 2 Alpha</name>
- <key>alpha2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 3 Label</name>
- <key>label3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 3 Width</name>
- <key>width3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 3 Color</name>
- <key>color3</key>
- <value>"green"</value>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 3 Alpha</name>
- <key>alpha3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 4 Label</name>
- <key>label4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 4 Width</name>
- <key>width4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 4 Color</name>
- <key>color4</key>
- <value>"black"</value>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 4 Alpha</name>
- <key>alpha4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 5 Label</name>
- <key>label5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 5 Width</name>
- <key>width5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 5 Color</name>
- <key>color5</key>
- <value>"cyan"</value>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 5 Alpha</name>
- <key>alpha5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 6 Label</name>
- <key>label6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 6 Width</name>
- <key>width6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 6 Color</name>
- <key>color6</key>
- <value>"magenta"</value>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 6 Alpha</name>
- <key>alpha6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 7 Label</name>
- <key>label7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 7 Width</name>
- <key>width7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 7 Color</name>
- <key>color7</key>
- <value>"yellow"</value>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 7 Alpha</name>
- <key>alpha7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 8 Label</name>
- <key>label8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 8 Width</name>
- <key>width8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 8 Color</name>
- <key>color8</key>
- <value>"dark red"</value>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 8 Alpha</name>
- <key>alpha8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 9 Label</name>
- <key>label9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 9 Width</name>
- <key>width9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 9 Color</name>
- <key>color9</key>
- <value>"dark green"</value>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 9 Alpha</name>
- <key>alpha9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 10 Label</name>
- <key>label10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 10 Width</name>
- <key>width10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 10 Color</name>
- <key>color10</key>
- <value>"dark blue"</value>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 10 Alpha</name>
- <key>alpha10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
-
- <sink>
- <name>in</name>
- <type>$type.t</type>
- <nports>#if $type.t == 'message' then 0 else $nconnections#</nports>
- <optional>1</optional>
- </sink>
-
- <sink>
- <name>freq</name>
- <type>message</type>
- <optional>1</optional>
- <hide>$showports</hide>
- </sink>
-
- <source>
- <name>freq</name>
- <type>message</type>
- <optional>1</optional>
- <hide>$showports</hide>
- </source>
-
- <doc>
-The GUI hint can be used to position the widget within the application. \
-The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
-Both the tab specification and the grid position are optional.
- </doc>
-</block>
diff --git a/gr-qtgui/grc/qtgui_histogram_sink_x.block.yml b/gr-qtgui/grc/qtgui_histogram_sink_x.block.yml
new file mode 100644
index 000000000..f71c2edb9
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_histogram_sink_x.block.yml
@@ -0,0 +1,419 @@
+id: qtgui_histogram_sink_x
+label: QT GUI Histogram Sink
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ default: float
+ options: [float, msg_float]
+ option_labels: [Float, Float Message]
+ option_attributes:
+ fcn: [histogram_sink_f, histogram_sink_f]
+ t: [float, message]
+ hide: part
+- id: name
+ label: Name
+ dtype: string
+ default: '""'
+ hide: ${ ('none' if len(name) > 0 else 'part') }
+- id: size
+ label: Number of Points
+ dtype: int
+ default: '1024'
+ hide: ${ ('all' if type.startwith('msg') else 'none') }
+- id: bins
+ label: Number of Bins
+ dtype: int
+ default: '100'
+- id: grid
+ label: Grid
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: autoscale
+ label: Autoscale
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: accum
+ label: Accumulate
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: xmin
+ label: Min x-axis
+ dtype: real
+ default: '-1'
+- id: xmax
+ label: Max x-axis
+ dtype: real
+ default: '1'
+- id: nconnections
+ label: Number of Inputs
+ dtype: int
+ default: '1'
+ hide: ${ ('all' if type.startwith('msg') else 'part') }
+- id: update_time
+ label: Update Period
+ dtype: float
+ default: '0.10'
+ hide: part
+- id: gui_hint
+ label: GUI Hint
+ dtype: gui_hint
+ hide: part
+- id: legend
+ label: Legend
+ category: Config
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: axislabels
+ label: Axis Labels
+ category: Config
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: label1
+ label: Line 1 Label
+ category: Config
+ dtype: string
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: width1
+ label: Line 1 Width
+ category: Config
+ dtype: int
+ default: '1'
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: color1
+ label: Line 1 Color
+ category: Config
+ dtype: enum
+ options: ['"blue"', '"red"', '"green"', '"black"', '"cyan"', '"magenta"', '"yellow"',
+ '"dark red"', '"dark green"', '"dark blue"']
+ option_labels: [Blue, Red, Green, Black, Cyan, Magenta, Yellow, Dark Red, Dark
+ Green, Dark Blue]
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: style1
+ label: Line 1 Style
+ category: Config
+ dtype: enum
+ options: ['1', '2', '3', '4', '5', '0']
+ option_labels: [Solid, Dash, Dots, Dash-Dot, Dash-Dot-Dot, None]
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: marker1
+ label: Line 1 Marker
+ category: Config
+ dtype: enum
+ options: ['-1', '0', '1', '2', '3', '4', '6', '7', '8', '9']
+ option_labels: [None, Circle, Rectangle, Diamond, Triangle, Down Triangle, Left
+ Triangle, Right Triangle, Cross, X-Cross]
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: alpha1
+ label: Line 1 Alpha
+ category: Config
+ dtype: float
+ default: '1.0'
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: label2
+ label: Line 2 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: width2
+ label: Line 2 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: color2
+ label: Line 2 Color
+ dtype: ''
+ default: '"red"'
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: style2
+ label: Line 2 Style
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: marker2
+ label: Line 2 Marker
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: alpha2
+ label: Line 2 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: label3
+ label: Line 3 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: width3
+ label: Line 3 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: color3
+ label: Line 3 Color
+ dtype: ''
+ default: '"green"'
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: style3
+ label: Line 3 Style
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: marker3
+ label: Line 3 Marker
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: alpha3
+ label: Line 3 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: label4
+ label: Line 4 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: width4
+ label: Line 4 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: color4
+ label: Line 4 Color
+ dtype: ''
+ default: '"black"'
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: style4
+ label: Line 4 Style
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: marker4
+ label: Line 4 Marker
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: alpha4
+ label: Line 4 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: label5
+ label: Line 5 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: width5
+ label: Line 5 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: color5
+ label: Line 5 Color
+ dtype: ''
+ default: '"cyan"'
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: style5
+ label: Line 5 Style
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: marker5
+ label: Line 5 Marker
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: alpha5
+ label: Line 5 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: label6
+ label: Line 6 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: width6
+ label: Line 6 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: color6
+ label: Line 6 Color
+ dtype: ''
+ default: '"magenta"'
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: style6
+ label: Line 6 Style
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: marker6
+ label: Line 6 Marker
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: alpha6
+ label: Line 6 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: label7
+ label: Line 7 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: width7
+ label: Line 7 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: color7
+ label: Line 7 Color
+ dtype: ''
+ default: '"yellow"'
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: style7
+ label: Line 7 Style
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: marker7
+ label: Line 7 Marker
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: alpha7
+ label: Line 7 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: label8
+ label: Line 8 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: width8
+ label: Line 8 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: color8
+ label: Line 8 Color
+ dtype: ''
+ default: '"dark red"'
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: style8
+ label: Line 8 Style
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: marker8
+ label: Line 8 Marker
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: alpha8
+ label: Line 8 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: label9
+ label: Line 9 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: width9
+ label: Line 9 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: color9
+ label: Line 9 Color
+ dtype: ''
+ default: '"dark green"'
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: style9
+ label: Line 9 Style
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: marker9
+ label: Line 9 Marker
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: alpha9
+ label: Line 9 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: label10
+ label: Line 10 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: width10
+ label: Line 10 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: color10
+ label: Line 10 Color
+ dtype: ''
+ default: '"dark blue"'
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: style10
+ label: Line 10 Style
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: marker10
+ label: Line 10 Marker
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: alpha10
+ label: Line 10 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+
+inputs:
+- domain: stream
+ dtype: ${ type.t }
+ multiplicity: ${ (0 if type.startswith('msg') else nconnections) }
+ optional: true
+
+templates:
+ imports: |-
+ from PyQt5 import Qt
+ from gnuradio import qtgui
+ import sip
+ callbacks:
+ - set_update_time(${update_time})
+ - set_title(${which}, ${title})
+ - set_color(${which}, ${color})
+ - set_bins(${bins})
+ - set_bins(${bins})
+ - set_x_axis(${xmin}, ${xmax})
+ make: |-
+ <%
+ win = 'self._%s_win'%id
+ %>\
+ qtgui.histogram_sink_f(
+ $size,
+ $bins,
+ $xmin,
+ $xmax,
+ $name,
+ ${ 0 if type.startswith('msg') else nconnections}
+ )
+
+ self.${id}.set_update_time(${update_time})
+ self.${id}.enable_autoscale(${autoscale})
+ self.${id}.enable_accumulate(${accum})
+ self.${id}.enable_grid(${grid})
+ self.${id}.enable_axis_labels(${axislabels})
+
+ if not ${legend}:
+ self.${id}.disable_legend()
+
+ labels = [${label1}, ${label2}, ${label3}, ${label4}, ${label5},
+ ${label6}, ${label7}, ${label8}, ${label9}, ${label10}]
+ widths = [${width1}, ${width2}, ${width3}, ${width4}, ${width5},
+ ${width6}, ${width7}, ${width8}, ${width9}, ${width10}]
+ colors = [${color1}, ${color2}, ${color3}, ${color4}, ${color5},
+ ${color6}, ${color7}, ${color8}, ${color9}, ${color10}]
+ alphas = [${alpha1}, ${alpha2}, ${alpha3}, ${alpha4}, ${alpha5},
+ ${alpha6}, ${alpha7}, ${alpha8}, ${alpha9}, ${alpha10}]
+
+ for i in range(${1 if type.startswith('msg') else nconnections}):
+ if len(labels[i]) == 0:
+ self.${id}.set_line_label(i, "Data {0}".format(i))
+ else:
+ self.${id}.set_line_label(i, labels[i])
+ self.${id}.set_line_width(i, widths[i])
+ self.${id}.set_line_color(i, colors[i])
+ self.${id}.set_line_style(i, styles[i])
+ self.${id}.set_line_marker(i, markers[i])
+ self.${id}.set_line_alpha(i, alphas[i])
+
+ ${win} = sip.wrapinstance(self.${id}.pyqwidget(), Qt.QWidget)
+ ${gui_hint() % win}
+
+documentation: |-
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/gr-qtgui/grc/qtgui_histogram_sink_x.xml b/gr-qtgui/grc/qtgui_histogram_sink_x.xml
deleted file mode 100644
index 9e3dcb104..000000000
--- a/gr-qtgui/grc/qtgui_histogram_sink_x.xml
+++ /dev/null
@@ -1,794 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##QT GUI Histogram Sink
-###################################################
- -->
-<block>
- <name>QT GUI Histogram Sink</name>
- <key>qtgui_histogram_sink_x</key>
- <import>from PyQt5 import Qt</import>
- <import>from gnuradio import qtgui</import>
- <import>import sip</import>
- <make>#set $win = 'self._%s_win'%$id
-qtgui.histogram_sink_f(
- $size,
- $bins,
- $xmin,
- $xmax,
- $name,
- #if $type.t == 'message' then 0 else $nconnections#
-)
-
-self.$(id).set_update_time($update_time)
-self.$(id).enable_autoscale($autoscale)
-self.$(id).enable_accumulate($accum)
-self.$(id).enable_grid($grid)
-self.$(id).enable_axis_labels($axislabels)
-
-if not $legend:
- self.$(id).disable_legend()
-
-labels = [$label1, $label2, $label3, $label4, $label5,
- $label6, $label7, $label8, $label9, $label10]
-widths = [$width1, $width2, $width3, $width4, $width5,
- $width6, $width7, $width8, $width9, $width10]
-colors = [$color1, $color2, $color3, $color4, $color5,
- $color6, $color7, $color8, $color9, $color10]
-styles = [$style1, $style2, $style3, $style4, $style5,
- $style6, $style7, $style8, $style9, $style10]
-markers = [$marker1, $marker2, $marker3, $marker4, $marker5,
- $marker6, $marker7, $marker8, $marker9, $marker10]
-alphas = [$alpha1, $alpha2, $alpha3, $alpha4, $alpha5,
- $alpha6, $alpha7, $alpha8, $alpha9, $alpha10]
-for i in xrange(#if $type.t == 'message' then 1 else $nconnections#):
- if len(labels[i]) == 0:
- self.$(id).set_line_label(i, "Data {0}".format(i))
- else:
- self.$(id).set_line_label(i, labels[i])
- self.$(id).set_line_width(i, widths[i])
- self.$(id).set_line_color(i, colors[i])
- self.$(id).set_line_style(i, styles[i])
- self.$(id).set_line_marker(i, markers[i])
- self.$(id).set_line_alpha(i, alphas[i])
-
-self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
-$(gui_hint()($win))
- </make>
- <callback>set_update_time($update_time)</callback>
- <callback>set_title($which, $title)</callback>
- <callback>set_color($which, $color)</callback>
- <callback>set_bins($bins)</callback>
- <callback>set_bins($bins)</callback>
- <callback>set_x_axis($xmin, $xmax)</callback>
-
- <param_tab_order>
- <tab>General</tab>
- <tab>Config</tab>
- </param_tab_order>
-
- <param>
- <name>Type</name>
- <key>type</key>
- <value>float</value>
- <type>enum</type>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:histogram_sink_f</opt>
- <opt>t:float</opt>
- </option>
- <option>
- <name>Float Message</name>
- <key>msg_float</key>
- <opt>fcn:histogram_sink_f</opt>
- <opt>t:message</opt>
- </option>
- </param>
-
- <param>
- <name>Name</name>
- <key>name</key>
- <value>""</value>
- <type>string</type>
- <hide>#if len($name()) > 0 then 'none' else 'part'#</hide>
- </param>
-
- <param>
- <name>Number of Points</name>
- <key>size</key>
- <value>1024</value>
- <type>int</type>
- <hide>#if $type.t == 'message' then 'all' else 'none'#</hide>
- </param>
-
- <param>
- <name>Number of Bins</name>
- <key>bins</key>
- <value>100</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Grid</name>
- <key>grid</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Autoscale</name>
- <key>autoscale</key>
- <value>True</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Accumulate</name>
- <key>accum</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Min x-axis</name>
- <key>xmin</key>
- <value>-1</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Max x-axis</name>
- <key>xmax</key>
- <value>1</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Number of Inputs</name>
- <key>nconnections</key>
- <value>1</value>
- <type>int</type>
- <hide>#if $type.t == 'message' then 'all' else 'part'#</hide>
- </param>
-
- <param>
- <name>Update Period</name>
- <key>update_time</key>
- <value>0.10</value>
- <type>float</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- </param>
-
- <!-- Begin Config Tab items -->
- <param>
- <name>Legend</name>
- <key>legend</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Axis Labels</name>
- <key>axislabels</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Label</name>
- <key>label1</key>
- <type>string</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Width</name>
- <key>width1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Color</name>
- <key>color1</key>
- <type>enum</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <option>
- <name>Blue</name>
- <key>"blue"</key>
- </option>
- <option>
- <name>Red</name>
- <key>"red"</key>
- </option>
- <option>
- <name>Green</name>
- <key>"green"</key>
- </option>
- <option>
- <name>Black</name>
- <key>"black"</key>
- </option>
- <option>
- <name>Cyan</name>
- <key>"cyan"</key>
- </option>
- <option>
- <name>Magenta</name>
- <key>"magenta"</key>
- </option>
- <option>
- <name>Yellow</name>
- <key>"yellow"</key>
- </option>
- <option>
- <name>Dark Red</name>
- <key>"dark red"</key>
- </option>
- <option>
- <name>Dark Green</name>
- <key>"dark green"</key>
- </option>
- <option>
- <name>Dark Blue</name>
- <key>"dark blue"</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Style</name>
- <key>style1</key>
- <type>enum</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <option>
- <name>Solid</name>
- <key>1</key>
- </option>
- <option>
- <name>Dash</name>
- <key>2</key>
- </option>
- <option>
- <name>Dots</name>
- <key>3</key>
- </option>
- <option>
- <name>Dash-Dot</name>
- <key>4</key>
- </option>
- <option>
- <name>Dash-Dot-Dot</name>
- <key>5</key>
- </option>
- <option>
- <name>None</name>
- <key>0</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Marker</name>
- <key>marker1</key>
- <type>enum</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <option>
- <name>None</name>
- <key>-1</key>
- </option>
- <option>
- <name>Circle</name>
- <key>0</key>
- </option>
- <option>
- <name>Rectangle</name>
- <key>1</key>
- </option>
- <option>
- <name>Diamond</name>
- <key>2</key>
- </option>
- <option>
- <name>Triangle</name>
- <key>3</key>
- </option>
- <option>
- <name>Down Triangle</name>
- <key>4</key>
- </option>
- <option>
- <name>Left Triangle</name>
- <key>6</key>
- </option>
- <option>
- <name>Right Triangle</name>
- <key>7</key>
- </option>
- <option>
- <name>Cross</name>
- <key>8</key>
- </option>
- <option>
- <name>X-Cross</name>
- <key>9</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Alpha</name>
- <key>alpha1</key>
- <value>1.0</value>
- <type>float</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 2 Label</name>
- <key>label2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 2 Width</name>
- <key>width2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 2 Color</name>
- <key>color2</key>
- <value>"red"</value>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 2 Style</name>
- <key>style2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 2 Marker</name>
- <key>marker2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 2 Alpha</name>
- <key>alpha2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 3 Label</name>
- <key>label3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 3 Width</name>
- <key>width3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 3 Color</name>
- <key>color3</key>
- <value>"green"</value>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 3 Style</name>
- <key>style3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 3 Marker</name>
- <key>marker3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 3 Alpha</name>
- <key>alpha3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 4 Label</name>
- <key>label4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 4 Width</name>
- <key>width4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 4 Color</name>
- <key>color4</key>
- <value>"black"</value>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 4 Style</name>
- <key>style4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 4 Marker</name>
- <key>marker4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 4 Alpha</name>
- <key>alpha4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 5 Label</name>
- <key>label5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 5 Width</name>
- <key>width5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 5 Color</name>
- <key>color5</key>
- <value>"cyan"</value>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 5 Style</name>
- <key>style5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 5 Marker</name>
- <key>marker5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 5 Alpha</name>
- <key>alpha5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 6 Label</name>
- <key>label6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 6 Width</name>
- <key>width6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 6 Color</name>
- <key>color6</key>
- <value>"magenta"</value>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 6 Style</name>
- <key>style6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 6 Marker</name>
- <key>marker6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 6 Alpha</name>
- <key>alpha6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 7 Label</name>
- <key>label7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 7 Width</name>
- <key>width7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 7 Color</name>
- <key>color7</key>
- <value>"yellow"</value>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 7 Style</name>
- <key>style7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 7 Marker</name>
- <key>marker7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 7 Alpha</name>
- <key>alpha7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 8 Label</name>
- <key>label8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 8 Width</name>
- <key>width8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 8 Color</name>
- <key>color8</key>
- <value>"dark red"</value>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 8 Style</name>
- <key>style8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 8 Marker</name>
- <key>marker8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 8 Alpha</name>
- <key>alpha8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 9 Label</name>
- <key>label9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 9 Width</name>
- <key>width9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 9 Color</name>
- <key>color9</key>
- <value>"dark green"</value>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 9 Style</name>
- <key>style9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 9 Marker</name>
- <key>marker9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 9 Alpha</name>
- <key>alpha9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 10 Label</name>
- <key>label10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 10 Width</name>
- <key>width10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 10 Color</name>
- <key>color10</key>
- <value>"dark blue"</value>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 10 Style</name>
- <key>style10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 10 Marker</name>
- <key>marker10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 10 Alpha</name>
- <key>alpha10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
-
- <sink>
- <name>in</name>
- <type>$type.t</type>
- <nports>#if $type.t == 'message' then 0 else $nconnections#</nports>
- <optional>1</optional>
- </sink>
-
- <doc>
-The GUI hint can be used to position the widget within the application. \
-The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
-Both the tab specification and the grid position are optional.
- </doc>
-</block>
diff --git a/gr-qtgui/grc/qtgui_label.block.yml b/gr-qtgui/grc/qtgui_label.block.yml
new file mode 100644
index 000000000..e86aa2072
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_label.block.yml
@@ -0,0 +1,66 @@
+id: variable_qtgui_label
+label: QT GUI Label
+
+parameters:
+- id: label
+ label: Label
+ dtype: string
+ hide: ${ ('none' if label else 'part') }
+- id: type
+ label: Type
+ dtype: enum
+ default: int
+ options: [real, int, string, bool, raw]
+ option_labels: [Float, Integer, String, Boolean, Any]
+ option_attributes:
+ conv: [eng_notation.str_to_num, int, str, bool, eval]
+ str: [eng_notation.num_to_str, str, str, str, repr]
+ hide: part
+- id: value
+ label: Default Value
+ dtype: ${ type }
+ default: '0'
+- id: formatter
+ label: Formatter
+ dtype: raw
+ default: None
+ hide: part
+- id: gui_hint
+ label: GUI Hint
+ dtype: gui_hint
+ hide: part
+value: ${ value }
+
+templates:
+ imports: |-
+ from PyQt5 import Qt
+ from gnuradio import eng_notation
+ var_make: self.${id} = ${id} = ${value}
+ callbacks:
+ - self.set_${id}(self._${id}_formatter(${value}))
+ - Qt.QMetaObject.invokeMethod(self._${id}_label, "setText", Qt.Q_ARG("QString",
+ ${id}))
+ make: |-
+ <%
+ win = 'self._%s_win'%id
+ if not label:
+ label = 'self._%s_tool_bar'%id
+ %>\
+ ${win} = Qt.QToolBar(self)
+
+ if ${formatter}:
+ self._${id}_formatter = ${formatter}
+ else:
+ self._${id}_formatter = lambda x: ${type.str}(x)
+
+ ${win}.addWidget(Qt.QLabel(${label}+": "))
+ self._${id}_label = Qt.QLabel(str(self._${id}_formatter(self.${id})))
+ self._${id}_tool_bar.addWidget(self._${id}_label)
+ ${gui_hint() % win}
+
+documentation: |-
+ This block creates a variable with a label widget for text. Leave the label blank to use the variable id as the label.
+
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/gr-qtgui/grc/qtgui_label.xml b/gr-qtgui/grc/qtgui_label.xml
deleted file mode 100644
index 946cee36a..000000000
--- a/gr-qtgui/grc/qtgui_label.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Variable Label Text:
-## a gui static text form
-###################################################
- -->
-
-<block>
- <name>QT GUI Label</name>
- <key>variable_qtgui_label</key>
- <import>from PyQt5 import Qt</import>
- <import>from gnuradio import eng_notation</import>
- <var_make>self.$(id) = $(id) = $value</var_make>
- <make>#set $win = 'self._%s_tool_bar'%$id
-$win = Qt.QToolBar(self)
-#if not $label()
- #set $label = '"%s"'%$id
-#end if
-
-if $(formatter):
- self._$(id)_formatter = $formatter
-else:
- self._$(id)_formatter = lambda x: $(type.str)(x)
-
-$(win).addWidget(Qt.QLabel($label+": "))
-self._$(id)_label = Qt.QLabel(str(self._$(id)_formatter(self.$id)))
-self._$(id)_tool_bar.addWidget(self._$(id)_label)
-$(gui_hint()($win))
- </make>
-
- <callback>self.set_$(id)(self._$(id)_formatter($value))</callback>
- <callback>Qt.QMetaObject.invokeMethod(self._$(id)_label, "setText", Qt.Q_ARG("QString", $id))</callback>
-
- <param>
- <name>Label</name>
- <key>label</key>
- <value></value>
- <type>string</type>
- <hide>#if $label() then 'none' else 'part'#</hide>
- </param>
-
- <param>
- <name>Type</name>
- <key>type</key>
- <value>int</value>
- <type>enum</type>
- <hide>part</hide>
- <option><name>Float</name><key>real</key><opt>conv:eng_notation.str_to_num</opt><opt>str:eng_notation.num_to_str</opt></option>
- <option><name>Integer</name><key>int</key><opt>conv:int</opt><opt>str:str</opt></option>
- <option><name>String</name><key>string</key><opt>conv:str</opt><opt>str:str</opt></option>
- <option><name>Boolean</name><key>bool</key><opt>conv:bool</opt><opt>str:str</opt></option>
- <option><name>Any</name><key>raw</key><opt>conv:eval</opt><opt>str:repr</opt></option>
- </param>
-
- <param>
- <name>Default Value</name>
- <key>value</key>
- <value>0</value>
- <type>$type</type>
- </param>
-
- <param>
- <name>Formatter</name>
- <key>formatter</key>
- <value>None</value>
- <type>raw</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- </param>
-
- <doc>
-This block creates a variable with a label widget for text. \
-Leave the label blank to use the variable id as the label.
-
-The GUI hint can be used to position the widget within the application. \
-The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
-Both the tab specification and the grid position are optional.
- </doc>
-</block>
diff --git a/gr-qtgui/grc/qtgui_number_sink.block.yml b/gr-qtgui/grc/qtgui_number_sink.block.yml
new file mode 100644
index 000000000..05adc13d3
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_number_sink.block.yml
@@ -0,0 +1,283 @@
+id: qtgui_number_sink
+label: QT GUI Number Sink
+
+parameters:
+- id: name
+ label: Name
+ dtype: string
+ default: '""'
+ hide: ${ ('none' if len(name) > 0 else 'part') }
+- id: type
+ label: Input Type
+ category: General
+ dtype: enum
+ options: [float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_float, gr.sizeof_int, gr.sizeof_short, gr.sizeof_char]
+ hide: part
+- id: autoscale
+ label: Autoscale
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: avg
+ label: Average
+ category: General
+ dtype: float
+ default: '0'
+- id: graph_type
+ label: Graph Type
+ category: General
+ dtype: enum
+ options: [qtgui.NUM_GRAPH_HORIZ, qtgui.NUM_GRAPH_VERT, qtgui.NUM_GRAPH_NONE]
+ option_labels: [Horizontal, Vertical, None]
+- id: nconnections
+ label: Number of Inputs
+ category: General
+ dtype: int
+ default: '1'
+ hide: part
+- id: min
+ label: Min
+ dtype: float
+ default: '-1'
+ hide: part
+- id: max
+ label: Max
+ dtype: float
+ default: '1'
+ hide: part
+- id: update_time
+ label: Update Period
+ category: General
+ dtype: float
+ default: '0.10'
+ hide: part
+- id: gui_hint
+ label: GUI Hint
+ category: General
+ dtype: gui_hint
+ hide: part
+- id: label1
+ label: Line 1 Label
+ category: Config
+ dtype: string
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: unit1
+ label: Line 1 Unit
+ category: Config
+ dtype: string
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: color1
+ label: Line 1 Color
+ category: Config
+ dtype: enum
+ options: ['("black", "black")', '("blue", "red")', '("black", "white")', '("white",
+ "black")', '("black", "red")']
+ option_labels: [Black, Blue-Red, White Hot, Black Hot, Black-Red]
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: factor1
+ label: Line 1 Factor
+ category: Config
+ dtype: float
+ default: '1'
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: label2
+ label: Line 2 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: unit2
+ label: Line 2 Unit
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: color2
+ label: Line 2 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: factor2
+ label: Line 2 Factor
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: label3
+ label: Line 3 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: unit3
+ label: Line 3 Unit
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: color3
+ label: Line 3 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: factor3
+ label: Line 3 Factor
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: label4
+ label: Line 4 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: unit4
+ label: Line 4 Unit
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: color4
+ label: Line 4 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: factor4
+ label: Line 4 Factor
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: label5
+ label: Line 5 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: unit5
+ label: Line 5 Unit
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: color5
+ label: Line 5 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: factor5
+ label: Line 5 Factor
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: label6
+ label: Line 6 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: unit6
+ label: Line 6 Unit
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: color6
+ label: Line 6 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: factor6
+ label: Line 6 Factor
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: label7
+ label: Line 7 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: unit7
+ label: Line 7 Unit
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: color7
+ label: Line 7 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: factor7
+ label: Line 7 Factor
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: label8
+ label: Line 8 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: unit8
+ label: Line 8 Unit
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: color8
+ label: Line 8 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: factor8
+ label: Line 8 Factor
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: label9
+ label: Line 9 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: unit9
+ label: Line 9 Unit
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: color9
+ label: Line 9 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: factor9
+ label: Line 9 Factor
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: label10
+ label: Line 10 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: unit10
+ label: Line 10 Unit
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: color10
+ label: Line 10 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: factor10
+ label: Line 10 Factor
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ multiplicity: ${ nconnections }
+
+templates:
+ imports: |-
+ from PyQt5 import Qt
+ from gnuradio import qtgui
+ import sip
+ callbacks:
+ - set_update_time(${update_time})
+ make: |-
+ <%
+ win = 'self._%s_win'%id
+ %>\
+ qtgui.number_sink(
+ ${type.size},
+ ${avg},
+ ${graph_type},
+ ${nconnections}
+ )
+ self.${id}.set_update_time(${update_time})
+ self.${id}.set_title(${name})
+
+ labels = [${label1}, ${label2}, ${label3}, ${label4}, ${label5},
+ ${label6}, ${label7}, ${label8}, ${label9}, ${label10}]
+ units = [${unit1}, ${unit2}, ${unit3}, ${unit4}, ${unit5},
+ ${unit6}, ${unit7}, ${unit8}, ${unit9}, ${unit10}]
+ colors = [${color1}, ${color2}, ${color3}, ${color4}, ${color5},
+ ${color6}, ${color7}, ${color8}, ${color9}, ${color10}]
+ factor = [${factor1}, ${factor2}, ${factor3}, ${factor4}, ${factor5},
+ ${factor6}, ${factor7}, ${factor8}, ${factor9}, ${factor10}]
+
+ for i in range(${nconnections}):
+ self.${id}.set_min(i, ${min})
+ self.${id}.set_max(i, ${max})
+ self.${id}.set_color(i, colors[i][0], colors[i][1])
+ if len(labels[i]) == 0:
+ self.${id}.set_label(i, "Data {0}".format(i))
+ else:
+ self.${id}.set_label(i, labels[i])
+ self.${id}.set_unit(i, units[i])
+ self.${id}.set_factor(i, factor[i])
+
+ self.${id}.enable_autoscale(${autoscale})
+ ${win} = sip.wrapinstance(self.${id}.pyqwidget(), Qt.QWidget)
+ ${gui_hint() % win}
+
+documentation: |-
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/gr-qtgui/grc/qtgui_number_sink.xml b/gr-qtgui/grc/qtgui_number_sink.xml
deleted file mode 100644
index 06837493c..000000000
--- a/gr-qtgui/grc/qtgui_number_sink.xml
+++ /dev/null
@@ -1,496 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##QT GUI Number Sink
-###################################################
- -->
-<block>
- <name>QT GUI Number Sink</name>
- <key>qtgui_number_sink</key>
- <import>from PyQt5 import Qt</import>
- <import>from gnuradio import qtgui</import>
- <import>import sip</import>
- <make>#set $win = 'self._%s_win'%$id
-qtgui.number_sink(
- $type.size,
- $avg,
- $graph_type,
- $nconnections
-)
-self.$(id).set_update_time($update_time)
-self.$(id).set_title($name)
-
-labels = [$label1, $label2, $label3, $label4, $label5,
- $label6, $label7, $label8, $label9, $label10]
-units = [$unit1, $unit2, $unit3, $unit4, $unit5,
- $unit6, $unit7, $unit8, $unit9, $unit10]
-colors = [$color1, $color2, $color3, $color4, $color5,
- $color6, $color7, $color8, $color9, $color10]
-factor = [$factor1, $factor2, $factor3, $factor4, $factor5,
- $factor6, $factor7, $factor8, $factor9, $factor10]
-for i in xrange($nconnections):
- self.$(id).set_min(i, $min)
- self.$(id).set_max(i, $max)
- self.$(id).set_color(i, colors[i][0], colors[i][1])
- if len(labels[i]) == 0:
- self.$(id).set_label(i, "Data {0}".format(i))
- else:
- self.$(id).set_label(i, labels[i])
- self.$(id).set_unit(i, units[i])
- self.$(id).set_factor(i, factor[i])
-
-self.$(id).enable_autoscale($autoscale)
-self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
-$(gui_hint()($win))</make>
- <callback>set_update_time($update_time)</callback>
-
- <param_tab_order>
- <tab>General</tab>
- <tab>Config</tab>
- </param_tab_order>
-
- <param>
- <name>Name</name>
- <key>name</key>
- <value>""</value>
- <type>string</type>
- <hide>#if len($name()) > 0 then 'none' else 'part'#</hide>
- </param>
-
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- <tab>General</tab>
- </param>
-
- <param>
- <name>Autoscale</name>
- <key>autoscale</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Average</name>
- <key>avg</key>
- <value>0</value>
- <type>float</type>
- <tab>General</tab>
- </param>
-
- <param>
- <name>Graph Type</name>
- <key>graph_type</key>
- <type>enum</type>
- <option>
- <name>Horizontal</name>
- <key>qtgui.NUM_GRAPH_HORIZ</key>
- </option>
- <option>
- <name>Vertical</name>
- <key>qtgui.NUM_GRAPH_VERT</key>
- </option>
- <option>
- <name>None</name>
- <key>qtgui.NUM_GRAPH_NONE</key>
- </option>
- <tab>General</tab>
- </param>
-
- <param>
- <name>Number of Inputs</name>
- <key>nconnections</key>
- <value>1</value>
- <type>int</type>
- <hide>part</hide>
- <tab>General</tab>
- </param>
-
- <param>
- <name>Min</name>
- <key>min</key>
- <value>-1</value>
- <type>float</type>
- <hide>part</hide>
- </param>
- <param>
- <name>Max</name>
- <key>max</key>
- <value>1</value>
- <type>float</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Update Period</name>
- <key>update_time</key>
- <value>0.10</value>
- <type>float</type>
- <hide>part</hide>
- <tab>General</tab>
- </param>
-
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- <tab>General</tab>
- </param>
-
- <param>
- <name>Line 1 Label</name>
- <key>label1</key>
- <type>string</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Unit</name>
- <key>unit1</key>
- <type>string</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Color</name>
- <key>color1</key>
- <type>enum</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <option>
- <name>Black</name>
- <key>("black", "black")</key>
- </option>
- <option>
- <name>Blue-Red</name>
- <key>("blue", "red")</key>
- </option>
- <option>
- <name>White Hot</name>
- <key>("black", "white")</key>
- </option>
- <option>
- <name>Black Hot</name>
- <key>("white", "black")</key>
- </option>
- <option>
- <name>Black-Red</name>
- <key>("black", "red")</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Factor</name>
- <key>factor1</key>
- <value>1</value>
- <type>float</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 2 Label</name>
- <key>label2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>unit1</base_key>
- <name>Line 2 Unit</name>
- <key>unit2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 2 Color</name>
- <key>color2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>factor1</base_key>
- <name>Line 2 Factor</name>
- <key>factor2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 3 Label</name>
- <key>label3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>unit1</base_key>
- <name>Line 3 Unit</name>
- <key>unit3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 3 Color</name>
- <key>color3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>factor1</base_key>
- <name>Line 3 Factor</name>
- <key>factor3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 4 Label</name>
- <key>label4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>unit1</base_key>
- <name>Line 4 Unit</name>
- <key>unit4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 4 Color</name>
- <key>color4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>factor1</base_key>
- <name>Line 4 Factor</name>
- <key>factor4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 5 Label</name>
- <key>label5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>unit1</base_key>
- <name>Line 5 Unit</name>
- <key>unit5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 5 Color</name>
- <key>color5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>factor1</base_key>
- <name>Line 5 Factor</name>
- <key>factor5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 6 Label</name>
- <key>label6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>unit1</base_key>
- <name>Line 6 Unit</name>
- <key>unit6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 6 Color</name>
- <key>color6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>factor1</base_key>
- <name>Line 6 Factor</name>
- <key>factor6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 7 Label</name>
- <key>label7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>unit1</base_key>
- <name>Line 7 Unit</name>
- <key>unit7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 7 Color</name>
- <key>color7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>factor1</base_key>
- <name>Line 7 Factor</name>
- <key>factor7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 8 Label</name>
- <key>label8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>unit1</base_key>
- <name>Line 8 Unit</name>
- <key>unit8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 8 Color</name>
- <key>color8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>factor1</base_key>
- <name>Line 8 Factor</name>
- <key>factor8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 9 Label</name>
- <key>label9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>unit1</base_key>
- <name>Line 9 Unit</name>
- <key>unit9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 9 Color</name>
- <key>color9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>factor1</base_key>
- <name>Line 9 Factor</name>
- <key>factor9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 10 Label</name>
- <key>label10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>unit1</base_key>
- <name>Line 10 Unit</name>
- <key>unit10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 10 Color</name>
- <key>color10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>factor1</base_key>
- <name>Line 10 Factor</name>
- <key>factor10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
-
- <sink>
- <name>in</name>
- <type>$type</type>
- <nports>$nconnections</nports>
- </sink>
- <doc>
- The GUI hint can be used to position the widget within the application. \
- The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
- Both the tab specification and the grid position are optional.
- </doc>
-</block>
diff --git a/gr-qtgui/grc/qtgui_push_button.block.yml b/gr-qtgui/grc/qtgui_push_button.block.yml
new file mode 100644
index 000000000..20e459340
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_push_button.block.yml
@@ -0,0 +1,60 @@
+id: variable_qtgui_push_button
+label: QT GUI Push Button
+
+parameters:
+- id: label
+ label: Label
+ dtype: string
+ hide: ${ ('none' if label else 'part') }
+- id: type
+ label: Type
+ dtype: enum
+ default: int
+ options: [real, int, string, bool, raw]
+ option_labels: [Float, Integer, String, Boolean, Any]
+ option_attributes:
+ conv: [float, int, str, bool, eval]
+ hide: part
+- id: value
+ label: Default Value
+ dtype: ${ type }
+ default: '0'
+- id: pressed
+ label: Pressed
+ dtype: ${ type }
+ default: '1'
+- id: released
+ label: Released
+ dtype: ${ type }
+ default: '0'
+- id: gui_hint
+ label: GUI Hint
+ dtype: gui_hint
+ hide: part
+value: ${ value }
+
+templates:
+ imports: from PyQt5 import Qt
+ var_make: self.${id} = ${id} = ${value}
+ callbacks:
+ - self.set_${id}(${value})
+ make: |-
+ <%
+ win = '_%s_push_button'%id
+ if not label:
+ label = '"%s"'%id
+ %>\
+ ${win} = Qt.QPushButton(${label})
+ self._${id}_choices = {'Pressed': ${pressed}, 'Released': ${released}}
+ ${win}.pressed.connect(lambda: self.set_${id}(self._${id}_choices['Pressed']))
+ ${win}.released.connect(lambda: self.set_${id}(self._${id}_choices['Released']))
+ ${gui_hint() % win}
+
+documentation: |-
+ This block creates a variable push button. Leave the label blank to use the variable id as the label.
+
+ A push button selects between two values of similar type. The variable will take on one value or the other depending on whether the button is pressed or released.
+
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/gr-qtgui/grc/qtgui_push_button.xml b/gr-qtgui/grc/qtgui_push_button.xml
deleted file mode 100644
index 49c2e9d6f..000000000
--- a/gr-qtgui/grc/qtgui_push_button.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Variable Push Button:
-## a gui push button form
-###################################################
- -->
-<block>
- <name>QT GUI Push Button</name>
- <key>variable_qtgui_push_button</key>
- <import>from PyQt5 import Qt</import>
- <var_make>self.$(id) = $(id) = $value</var_make>
- <make>#set $win = '_%s_push_button'%$id
-#if not $label()
- #set $label = '"%s"'%$id
-#end if
-$win = Qt.QPushButton($label)
-self._$(id)_choices = {'Pressed': $pressed, 'Released': $released}
-$(win).pressed.connect(lambda: self.set_$(id)(self._$(id)_choices['Pressed']))
-$(win).released.connect(lambda: self.set_$(id)(self._$(id)_choices['Released']))
-$(gui_hint()($win))</make>
- <callback>self.set_$(id)($value)</callback>
- <param>
- <name>Label</name>
- <key>label</key>
- <value></value>
- <type>string</type>
- <hide>#if $label() then 'none' else 'part'#</hide>
- </param>
- <param>
- <name>Type</name>
- <key>type</key>
- <value>int</value>
- <type>enum</type>
- <hide>part</hide>
- <option><name>Float</name><key>real</key><opt>conv:float</opt></option>
- <option><name>Integer</name><key>int</key><opt>conv:int</opt></option>
- <option><name>String</name><key>string</key><opt>conv:str</opt></option>
- <option><name>Boolean</name><key>bool</key><opt>conv:bool</opt></option>
- <option><name>Any</name><key>raw</key><opt>conv:eval</opt></option>
- </param>
- <param>
- <name>Default Value</name>
- <key>value</key>
- <value>0</value>
- <type>$type</type>
- </param>
- <param>
- <name>Pressed</name>
- <key>pressed</key>
- <value>1</value>
- <type>$type</type>
- </param>
- <param>
- <name>Released</name>
- <key>released</key>
- <value>0</value>
- <type>$type</type>
- </param>
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- </param>
- <doc>
-This block creates a variable push button. \
-Leave the label blank to use the variable id as the label.
-
-A push button selects between two values of similar type. \
-The variable will take on one value or the other depending \
-on whether the button is pressed or released.
-
-The GUI hint can be used to position the widget within the application. \
-The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
-Both the tab specification and the grid position are optional.
- </doc>
-</block>
diff --git a/gr-qtgui/grc/qtgui_range.block.yml b/gr-qtgui/grc/qtgui_range.block.yml
new file mode 100644
index 000000000..a4aaa5925
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_range.block.yml
@@ -0,0 +1,86 @@
+id: variable_qtgui_range
+label: QT GUI Range
+
+parameters:
+- id: label
+ label: Label
+ dtype: string
+ hide: ${ ('none' if label else 'part') }
+- id: rangeType
+ label: Type
+ dtype: enum
+ default: '"float"'
+ options: [float, int]
+ option_attributes:
+ type: [float, int]
+ hide: part
+- id: value
+ label: Default Value
+ dtype: ${ rangeType.type }
+ default: '50'
+- id: start
+ label: Start
+ dtype: ${ rangeType.type }
+ default: '0'
+- id: stop
+ label: Stop
+ dtype: ${ rangeType.type }
+ default: '100'
+- id: step
+ label: Step
+ dtype: ${ rangeType.type }
+ default: '1'
+- id: widget
+ label: Widget
+ dtype: enum
+ default: counter_slider
+ options: [counter_slider, counter, slider, dial]
+ option_labels: [Counter + Slider, Counter, Slider, Knob]
+ hide: part
+- id: orient
+ label: Orientation
+ dtype: enum
+ default: Qt.Horizontal
+ options: [Qt.Horizontal, Qt.Vertical]
+ option_labels: [Horizontal, Vertical]
+ option_attributes:
+ minfcn: [setMinimumWidth, setMinimumHeight]
+ scalepos: [BottomScale, LeftScale]
+ hide: ${ ('part' if widget == "slider" else 'all') }
+- id: min_len
+ label: Minimum Length
+ dtype: int
+ default: '200'
+ hide: part
+- id: gui_hint
+ label: GUI Hint
+ dtype: gui_hint
+ hide: part
+value: ${ value }
+
+asserts:
+- ${start <= value <= stop}
+- ${start <= stop}
+
+templates:
+ imports: from gnuradio.qtgui import Range, RangeWidget
+ var_make: self.${id} = ${id} = ${value}
+ callbacks:
+ - self.set_${id}(${value})
+ make: |-
+ <%
+ win = 'self._%s_win'%id
+ range = 'self._%s_range'%id
+ if not label:
+ label = '"%s"'%id
+ %>\
+ ${range} = Range(${start}, ${stop}, ${step}, ${value}, ${min_len})
+ ${win} = RangeWidget(${range}, self.set_${id}, ${label}, "${widget}", ${rangeType})
+ ${gui_hint() % win}
+
+documentation: |-
+ This block creates a variable with a slider. Leave the label blank to use the variable id as the label. The value must be a real number. The value must be between the start and the stop.
+
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/gr-qtgui/grc/qtgui_range.xml b/gr-qtgui/grc/qtgui_range.xml
deleted file mode 100644
index 71b614cc5..000000000
--- a/gr-qtgui/grc/qtgui_range.xml
+++ /dev/null
@@ -1,131 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Variable Range:
-## ranged widgets like a slider or a knob
-###################################################
- -->
-<block>
- <name>QT GUI Range</name>
- <key>variable_qtgui_range</key>
- <import>from gnuradio.qtgui import Range, RangeWidget</import>
- <var_make>self.$(id) = $(id) = $value</var_make>
- <make>#set $win = 'self._%s_win'%$id
- #set $range = 'self._%s_range'%$id
-#if not $label()
- #set $label = '"%s"'%$id
-#end if
-$(range) = Range($start, $stop, $step, $value, $min_len)
-$(win) = RangeWidget($range, self.set_$(id), $label, "$widget", $rangeType)
-$(gui_hint()($win))</make>
- <callback>self.set_$(id)($value)</callback>
-
- <param>
- <name>Label</name>
- <key>label</key>
- <value></value>
- <type>string</type>
- <hide>#if $label() then 'none' else 'part'#</hide>
- </param>
-
- <param>
- <name>Type</name>
- <key>rangeType</key>
- <value>"float"</value>
- <type>enum</type>
- <hide>part</hide>
- <option><name>Float</name><key>float</key><opt>type:float</opt></option>
- <option><name>Int</name><key>int</key><opt>type:int</opt></option>
- </param>
-
- <param>
- <name>Default Value</name>
- <key>value</key>
- <value>50</value>
- <type>$rangeType.type</type>
- </param>
-
- <param>
- <name>Start</name>
- <key>start</key>
- <value>0</value>
- <type>$rangeType.type</type>
- </param>
-
- <param>
- <name>Stop</name>
- <key>stop</key>
- <value>100</value>
- <type>$rangeType.type</type>
- </param>
-
- <param>
- <name>Step</name>
- <key>step</key>
- <value>1</value>
- <type>$rangeType.type</type>
- </param>
-
- <param>
- <name>Widget</name>
- <key>widget</key>
- <value>counter_slider</value>
- <type>enum</type>
- <hide>part</hide>
- <option><name>Counter + Slider</name><key>counter_slider</key></option>
- <option><name>Counter</name><key>counter</key></option>
- <option><name>Slider</name><key>slider</key></option>
- <option><name>Knob</name><key>dial</key></option>
- </param>
-
- <param>
- <name>Orientation</name>
- <key>orient</key>
- <value>Qt.Horizontal</value>
- <type>enum</type>
- <hide>#if $widget() == "slider" then 'part' else 'all'#</hide>
- <option>
- <name>Horizontal</name>
- <key>Qt.Horizontal</key>
- <opt>scalepos:BottomScale</opt>
- <opt>minfcn:setMinimumWidth</opt>
- </option>
- <option>
- <name>Vertical</name>
- <key>Qt.Vertical</key>
- <opt>scalepos:LeftScale</opt>
- <opt>minfcn:setMinimumHeight</opt>
- </option>
- </param>
-
- <param>
- <name>Minimum Length</name>
- <key>min_len</key>
- <value>200</value>
- <type>int</type>
- <hide>part</hide>
- </param>
- <!-- from min_len <hide>#if $widget().split('_')[0] in ("slider", "counter") then 'part' else 'all'#</hide>-->
-
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- </param>
-
- <check>$start &lt;= $value &lt;= $stop</check>
- <check>$start &lt; $stop</check>
-
- <doc>
- This block creates a variable with a slider. \
- Leave the label blank to use the variable id as the label. \
- The value must be a real number. \
- The value must be between the start and the stop.
-
- The GUI hint can be used to position the widget within the application. \
- The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
- Both the tab specification and the grid position are optional.
- </doc>
-</block>
diff --git a/gr-qtgui/grc/qtgui_sink_x.block.yml b/gr-qtgui/grc/qtgui_sink_x.block.yml
new file mode 100644
index 000000000..30194a7a5
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_sink_x.block.yml
@@ -0,0 +1,148 @@
+id: qtgui_sink_x
+label: QT GUI Sink
+flags: has_python
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ default: complex
+ options: [complex, float]
+ option_attributes:
+ fcn: [sink_c, sink_f]
+ hide: part
+- id: name
+ label: Name
+ dtype: string
+ default: '""'
+- id: fftsize
+ label: FFT Size
+ dtype: int
+ default: '1024'
+- id: wintype
+ label: Window Type
+ dtype: int
+ default: firdes.WIN_BLACKMAN_hARRIS
+ options: [firdes.WIN_BLACKMAN_hARRIS, firdes.WIN_HAMMING, firdes.WIN_HANN, firdes.WIN_BLACKMAN,
+ firdes.WIN_RECTANGULAR, firdes.WIN_KAISER]
+ option_labels: [Blackman-harris, Hamming, Hann, Blackman, Rectangular, Kaiser]
+ hide: part
+- id: fc
+ label: Center Frequency (Hz)
+ dtype: real
+ default: '0'
+- id: bw
+ label: Bandwidth (Hz)
+ dtype: real
+ default: samp_rate
+- id: rate
+ label: Update Rate
+ dtype: real
+ default: '10'
+- id: showrf
+ label: Show RF Freq
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: plotfreq
+ label: Plot Frequency
+ dtype: bool
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: part
+- id: plotwaterfall
+ label: Plot Waterfall
+ dtype: bool
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: part
+- id: plottime
+ label: Plot Time
+ dtype: bool
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: part
+- id: plotconst
+ label: Plot Const
+ dtype: bool
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: part
+- id: gui_hint
+ label: GUI Hint
+ dtype: gui_hint
+ hide: part
+- id: freqchangevar
+ label: Clicked freq variable
+ dtype: raw
+ default: None
+ hide: part
+- id: showports
+ label: Show Msg Ports
+ dtype: enum
+ default: 'True'
+ options: ['False', 'True']
+ option_labels: ['Yes', 'No']
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ multiplicity: ${ num_inputs }
+- domain: message
+ id: freq
+ optional: true
+ hide: ${ showports }
+
+outputs:
+- domain: message
+ id: freq
+ optional: true
+ hide: ${ showports }
+
+templates:
+ imports: |-
+ from PyQt5 import Qt
+ from gnuradio import qtgui
+ from gnuradio.filter import firdes
+ import sip
+ callbacks:
+ - set_frequency_range(${fc}, ${bw})
+ make: |-
+ <%
+ win = 'self._%s_win'%id
+ %>\
+ qtgui.${type.fcn}(
+ ${fftsize}, #fftsize
+ ${wintype}, #wintype
+ ${fc}, #fc
+ ${bw}, #bw
+ ${name}, #name
+ ${plotfreq}, #plotfreq
+ ${plotwaterfall}, #plotwaterfall
+ ${plottime}, #plottime
+ ${plotconst} #plotconst
+ )
+ self.${id}.set_update_time(1.0/${rate})
+ ${win} = sip.wrapinstance(self.${id}.pyqwidget(), Qt.QWidget)
+
+ self.${id}.enable_rf_freq($showrf)
+
+ % if freqchangevar is not None:
+ def ${id}_callback(p, num):
+ if num == 1 or num == 2:
+ self.set_${freqchangevar}(p.x())
+
+ Qt.QObject.connect(self._${id}_win, Qt.SIGNAL("plotPointSelected(QPointF, int)"), ${id}_callback)
+ % endif
+
+documentation: |-
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/gr-qtgui/grc/qtgui_sink_x.xml b/gr-qtgui/grc/qtgui_sink_x.xml
deleted file mode 100644
index a9bc469cd..000000000
--- a/gr-qtgui/grc/qtgui_sink_x.xml
+++ /dev/null
@@ -1,232 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##QT GUI Sink
-###################################################
- -->
-<block>
- <name>QT GUI Sink</name>
- <key>qtgui_sink_x</key>
- <import>from PyQt5 import Qt</import>
- <import>from gnuradio import qtgui</import>
- <import>from gnuradio.filter import firdes</import>
- <import>import sip</import>
- <make>#set $win = 'self._%s_win'%$id
-qtgui.$(type.fcn)(
- $fftsize, \#fftsize
- $wintype, \#wintype
- $fc, \#fc
- $bw, \#bw
- $name, \#name
- $plotfreq, \#plotfreq
- $plotwaterfall, \#plotwaterfall
- $plottime, \#plottime
- $plotconst, \#plotconst
-)
-self.$(id).set_update_time(1.0/$rate)
-self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
-$(gui_hint()($win))
-
-self.$(id).enable_rf_freq($showrf)
-
-#if $freqchangevar() is not None
-def $(id)_callback(p, num):
- if num == 1 or num == 2: self.set_$(freqchangevar)(p.x())
-
-Qt.QObject.connect(self._$(id)_win, Qt.SIGNAL("plotPointSelected(QPointF, int)"), $(id)_callback )
-#end if
-
- </make>
- <callback>set_frequency_range($fc, $bw)</callback>
-
- <param>
- <name>Type</name>
- <key>type</key>
- <value>complex</value>
- <type>enum</type>
- <option><name>Complex</name><key>complex</key><opt>fcn:sink_c</opt></option>
- <option><name>Float</name><key>float</key><opt>fcn:sink_f</opt></option>
- </param>
-
- <param>
- <name>Name</name>
- <key>name</key>
- <value>""</value>
- <type>string</type>
- <hide>#if len($name()) > 0 then 'none' else 'part'#</hide>
- </param>
-
- <param>
- <name>FFT Size</name>
- <key>fftsize</key>
- <value>1024</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Window Type</name>
- <key>wintype</key>
- <value>firdes.WIN_BLACKMAN_hARRIS</value>
- <type>int</type>
- <hide>part</hide>
- <option>
- <name>Blackman-harris</name>
- <key>firdes.WIN_BLACKMAN_hARRIS</key>
- </option>
- <option>
- <name>Hamming</name>
- <key>firdes.WIN_HAMMING</key>
- </option>
- <option>
- <name>Hann</name>
- <key>firdes.WIN_HANN</key>
- </option>
- <option>
- <name>Blackman</name>
- <key>firdes.WIN_BLACKMAN</key>
- </option>
- <option>
- <name>Rectangular</name>
- <key>firdes.WIN_RECTANGULAR</key>
- </option>
- <option>
- <name>Kaiser</name>
- <key>firdes.WIN_KAISER</key>
- </option>
- </param>
-
- <param>
- <name>Center Frequency (Hz)</name>
- <key>fc</key>
- <value>0</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Bandwidth (Hz)</name>
- <key>bw</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Update Rate</name>
- <key>rate</key>
- <value>10</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Show RF Freq</name>
- <key>showrf</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Plot Frequency</name>
- <key>plotfreq</key>
- <value>True</value>
- <type>bool</type>
- <hide>part</hide>
- <option><name>On</name><key>True</key></option>
- <option><name>Off</name><key>False</key></option>
- </param>
-
- <param>
- <name>Plot Waterfall</name>
- <key>plotwaterfall</key>
- <value>True</value>
- <type>bool</type>
- <hide>part</hide>
- <option><name>On</name><key>True</key></option>
- <option><name>Off</name><key>False</key></option>
- </param>
-
- <param>
- <name>Plot Time</name>
- <key>plottime</key>
- <value>True</value>
- <type>bool</type>
- <hide>part</hide>
- <option><name>On</name><key>True</key></option>
- <option><name>Off</name><key>False</key></option>
- </param>
-
- <param>
- <name>Plot Const</name>
- <key>plotconst</key>
- <value>True</value>
- <type>bool</type>
- <hide>part</hide>
- <option><name>On</name><key>True</key></option>
- <option><name>Off</name><key>False</key></option>
- </param>
-
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Clicked freq variable</name>
- <key>freqchangevar</key>
- <value>None</value>
- <type>raw</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Show Msg Ports</name>
- <key>showports</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>False</key>
- </option>
- <option>
- <name>No</name>
- <key>True</key>
- </option>
- </param>
-
- <sink>
- <name>in</name>
- <type>$type</type>
- <nports>$num_inputs</nports>
- </sink>
-
- <sink>
- <name>freq</name>
- <type>message</type>
- <optional>1</optional>
- <hide>$showports</hide>
- </sink>
-
- <source>
- <name>freq</name>
- <type>message</type>
- <optional>1</optional>
- <hide>$showports</hide>
- </source>
-
- <doc>
-The GUI hint can be used to position the widget within the application. \
-The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
-Both the tab specification and the grid position are optional.
- </doc>
-</block>
diff --git a/gr-qtgui/grc/qtgui_tab_widget.block.yml b/gr-qtgui/grc/qtgui_tab_widget.block.yml
new file mode 100644
index 000000000..12a902eac
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_tab_widget.block.yml
@@ -0,0 +1,141 @@
+id: qtgui_tab_widget
+label: QT GUI Tab Widget
+
+parameters:
+- id: num_tabs
+ label: Num Tabs
+ dtype: enum
+ default: '1'
+ options: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13',
+ '14', '15', '16', '17', '18', '19', '20']
+- id: label0
+ label: Label 0
+ dtype: string
+ default: Tab 0
+ hide: ${ ('none' if int(num_tabs) > 0 else 'all') }
+- id: label1
+ label: Label 1
+ dtype: string
+ default: Tab 1
+ hide: ${ ('none' if int(num_tabs) > 1 else 'all') }
+- id: label2
+ label: Label 2
+ dtype: string
+ default: Tab 2
+ hide: ${ ('none' if int(num_tabs) > 2 else 'all') }
+- id: label3
+ label: Label 3
+ dtype: string
+ default: Tab 3
+ hide: ${ ('none' if int(num_tabs) > 3 else 'all') }
+- id: label4
+ label: Label 4
+ dtype: string
+ default: Tab 4
+ hide: ${ ('none' if int(num_tabs) > 4 else 'all') }
+- id: label5
+ label: Label 5
+ dtype: string
+ default: Tab 5
+ hide: ${ ('none' if int(num_tabs) > 5 else 'all') }
+- id: label6
+ label: Label 6
+ dtype: string
+ default: Tab 6
+ hide: ${ ('none' if int(num_tabs) > 6 else 'all') }
+- id: label7
+ label: Label 7
+ dtype: string
+ default: Tab 7
+ hide: ${ ('none' if int(num_tabs) > 7 else 'all') }
+- id: label8
+ label: Label 8
+ dtype: string
+ default: Tab 8
+ hide: ${ ('none' if int(num_tabs) > 8 else 'all') }
+- id: label9
+ label: Label 9
+ dtype: string
+ default: Tab 9
+ hide: ${ ('none' if int(num_tabs) > 9 else 'all') }
+- id: label10
+ label: Label 10
+ dtype: string
+ default: Tab 10
+ hide: ${ ('none' if int(num_tabs) > 10 else 'all') }
+- id: label11
+ label: Label 11
+ dtype: string
+ default: Tab 11
+ hide: ${ ('none' if int(num_tabs) > 11 else 'all') }
+- id: label12
+ label: Label 12
+ dtype: string
+ default: Tab 12
+ hide: ${ ('none' if int(num_tabs) > 12 else 'all') }
+- id: label13
+ label: Label 13
+ dtype: string
+ default: Tab 13
+ hide: ${ ('none' if int(num_tabs) > 13 else 'all') }
+- id: label14
+ label: Label 14
+ dtype: string
+ default: Tab 14
+ hide: ${ ('none' if int(num_tabs) > 14 else 'all') }
+- id: label15
+ label: Label 15
+ dtype: string
+ default: Tab 15
+ hide: ${ ('none' if int(num_tabs) > 15 else 'all') }
+- id: label16
+ label: Label 16
+ dtype: string
+ default: Tab 16
+ hide: ${ ('none' if int(num_tabs) > 16 else 'all') }
+- id: label17
+ label: Label 17
+ dtype: string
+ default: Tab 17
+ hide: ${ ('none' if int(num_tabs) > 17 else 'all') }
+- id: label18
+ label: Label 18
+ dtype: string
+ default: Tab 18
+ hide: ${ ('none' if int(num_tabs) > 18 else 'all') }
+- id: label19
+ label: Label 19
+ dtype: string
+ default: Tab 19
+ hide: ${ ('none' if int(num_tabs) > 19 else 'all') }
+- id: gui_hint
+ label: GUI Hint
+ dtype: gui_hint
+ hide: part
+
+templates:
+ imports: from PyQt5 import Qt
+ make: |-
+ <%
+ win = 'self._%s_win'%id
+ all_labels = [label0, label1, label2, label3, label4,
+ label5, label6, label7, label8, label9,
+ label10, label11, label12, label13, label14,
+ label15, label16, label17, label18, label19][:int(num_tabs())]
+ %>\
+ Qt.QTabWidget()
+ % for i, label in enumrate(all_labels):
+ self.${id}_widget_${i} = Qt.QWidget()
+ self.${id}_layout_${i} = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.${id}_widget_${i})
+ self.${id}_grid_layout_${i} = Qt.QGridLayout()
+ self.${id}_layout_${i}.addLayout(self.${id}_grid_layout_${i})
+ ${win}.addTab(self.${id}_widget_${i}, ${label})
+ % endfor
+ ${gui_hint() % win}
+
+documentation: |-
+ This block creates a tabbed widget to organize other widgets. The ID of this block can be used as the tab_id in the GUI hints of other widgets.
+
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/gr-qtgui/grc/qtgui_tab_widget.xml b/gr-qtgui/grc/qtgui_tab_widget.xml
deleted file mode 100644
index 805542cc8..000000000
--- a/gr-qtgui/grc/qtgui_tab_widget.xml
+++ /dev/null
@@ -1,206 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##WX GUI Notebook
-###################################################
- -->
-<block>
- <name>QT GUI Tab Widget</name>
- <key>qtgui_tab_widget</key>
- <import>from PyQt5 import Qt</import>
- <make>#set $win = 'self.%s'%$id
-Qt.QTabWidget()
-#set $all_labels = [$label0, $label1, $label2, $label3, $label4,
- $label5, $label6, $label7, $label8, $label9,
- $label10, $label11, $label12, $label13, $label14,
- $label15, $label16, $label17, $label18, $label19][:int($num_tabs())]
-#for i, label in enumerate($all_labels)
-self.$(id)_widget_$(i) = Qt.QWidget()
-self.$(id)_layout_$(i) = Qt.QBoxLayout(Qt.QBoxLayout.TopToBottom, self.$(id)_widget_$(i))
-self.$(id)_grid_layout_$(i) = Qt.QGridLayout()
-self.$(id)_layout_$(i).addLayout(self.$(id)_grid_layout_$(i))
-$(win).addTab(self.$(id)_widget_$(i), $label)
-#end for
-$(gui_hint()($win))</make>
- <param>
- <name>Num Tabs</name>
- <key>num_tabs</key>
- <value>1</value>
- <type>enum</type>
- <option><name>1</name><key>1</key></option>
- <option><name>2</name><key>2</key></option>
- <option><name>3</name><key>3</key></option>
- <option><name>4</name><key>4</key></option>
- <option><name>5</name><key>5</key></option>
- <option><name>6</name><key>6</key></option>
- <option><name>7</name><key>7</key></option>
- <option><name>8</name><key>8</key></option>
- <option><name>9</name><key>9</key></option>
- <option><name>10</name><key>10</key></option>
- <option><name>11</name><key>11</key></option>
- <option><name>12</name><key>12</key></option>
- <option><name>13</name><key>13</key></option>
- <option><name>14</name><key>14</key></option>
- <option><name>15</name><key>15</key></option>
- <option><name>16</name><key>16</key></option>
- <option><name>17</name><key>17</key></option>
- <option><name>18</name><key>18</key></option>
- <option><name>19</name><key>19</key></option>
- <option><name>20</name><key>20</key></option>
- </param>
- <param>
- <name>Label 0</name>
- <key>label0</key>
- <value>Tab 0</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 0 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 1</name>
- <key>label1</key>
- <value>Tab 1</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 1 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 2</name>
- <key>label2</key>
- <value>Tab 2</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 2 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 3</name>
- <key>label3</key>
- <value>Tab 3</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 3 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 4</name>
- <key>label4</key>
- <value>Tab 4</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 4 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 5</name>
- <key>label5</key>
- <value>Tab 5</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 5 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 6</name>
- <key>label6</key>
- <value>Tab 6</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 6 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 7</name>
- <key>label7</key>
- <value>Tab 7</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 7 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 8</name>
- <key>label8</key>
- <value>Tab 8</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 8 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 9</name>
- <key>label9</key>
- <value>Tab 9</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 9 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 10</name>
- <key>label10</key>
- <value>Tab 10</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 10 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 11</name>
- <key>label11</key>
- <value>Tab 11</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 11 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 12</name>
- <key>label12</key>
- <value>Tab 12</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 12 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 13</name>
- <key>label13</key>
- <value>Tab 13</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 13 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 14</name>
- <key>label14</key>
- <value>Tab 14</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 14 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 15</name>
- <key>label15</key>
- <value>Tab 15</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 15 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 16</name>
- <key>label16</key>
- <value>Tab 16</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 16 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 17</name>
- <key>label17</key>
- <value>Tab 17</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 17 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 18</name>
- <key>label18</key>
- <value>Tab 18</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 18 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Label 19</name>
- <key>label19</key>
- <value>Tab 19</value>
- <type>string</type>
- <hide>#if int($num_tabs()) > 19 then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- </param>
- <doc>
-This block creates a tabbed widget to organize other widgets. \
-The ID of this block can be used as the tab_id in the GUI hints of other widgets.
-
-The GUI hint can be used to position the widget within the application. \
-The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
-Both the tab specification and the grid position are optional.
- </doc>
-</block>
diff --git a/gr-qtgui/grc/qtgui_time_raster_x.block.yml b/gr-qtgui/grc/qtgui_time_raster_x.block.yml
new file mode 100644
index 000000000..6ffaf1934
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_time_raster_x.block.yml
@@ -0,0 +1,266 @@
+id: qtgui_time_raster_sink_x
+label: QT GUI Time Raster Sink
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ default: complex
+ options: [byte, float, msg_byte, msg_float]
+ option_labels: [Byte, Float, Byte Message, Float Message]
+ option_attributes:
+ fcn: [time_raster_sink_b, time_raster_sink_f, time_raster_sink_b, time_raster_sink_f]
+ t: [byte, float, message, message]
+ hide: part
+- id: name
+ label: Name
+ dtype: string
+ default: '""'
+ hide: ${ ('none' if len(name) > 0 else 'part') }
+- id: samp_rate
+ label: Sample Rate
+ dtype: real
+ default: samp_rate
+- id: nrows
+ label: Num. Rows
+ dtype: int
+ hide: ${ ('all' if type.startswith('msg') else 'none') }
+- id: ncols
+ label: Num. Cols
+ dtype: int
+- id: grid
+ label: Grid
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: zmin
+ label: Int. min
+ dtype: real
+ default: '-1'
+ hide: part
+- id: zmax
+ label: Int. max
+ dtype: real
+ default: '1'
+ hide: part
+- id: mult
+ label: Multiplier
+ dtype: real_vector
+ default: '[]'
+ hide: part
+- id: offset
+ label: Offset
+ dtype: real_vector
+ default: '[]'
+ hide: part
+- id: nconnections
+ label: Number of Inputs
+ dtype: int
+ default: '1'
+ hide: ${ ('all' if type.startswith('msg') else 'part') }
+- id: update_time
+ label: Update Period
+ dtype: real
+ default: '0.10'
+ hide: part
+- id: gui_hint
+ label: GUI Hint
+ dtype: gui_hint
+ hide: part
+- id: axislabels
+ label: Axis Labels
+ category: Config
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: label1
+ label: Line 1 Label
+ category: Config
+ dtype: string
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: color1
+ label: Line 1 Color
+ category: Config
+ dtype: enum
+ options: ['0', '1', '2', '3', '5', '6']
+ option_labels: [Multi Color, White Hot, Black Hot, Incandescent, Sunset, Cool]
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: alpha1
+ label: Line 1 Alpha
+ category: Config
+ dtype: float
+ default: '1.0'
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: label2
+ label: Line 2 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: color2
+ label: Line 2 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: alpha2
+ label: Line 2 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: label3
+ label: Line 3 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: color3
+ label: Line 3 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: alpha3
+ label: Line 3 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: label4
+ label: Line 4 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: color4
+ label: Line 4 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: alpha4
+ label: Line 4 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: label5
+ label: Line 5 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: color5
+ label: Line 5 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: alpha5
+ label: Line 5 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: label6
+ label: Line 6 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: color6
+ label: Line 6 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: alpha6
+ label: Line 6 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: label7
+ label: Line 7 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: color7
+ label: Line 7 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: alpha7
+ label: Line 7 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: label8
+ label: Line 8 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: color8
+ label: Line 8 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: alpha8
+ label: Line 8 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: label9
+ label: Line 9 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: color9
+ label: Line 9 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: alpha9
+ label: Line 9 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: label10
+ label: Line 10 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: color10
+ label: Line 10 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: alpha10
+ label: Line 10 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+
+inputs:
+- domain: stream
+ dtype: ${ type.t }
+ multiplicity: ${ (0 if type.startswith('msg') else nconnections) }
+ optional: true
+
+templates:
+ imports: |-
+ from PyQt5 import Qt
+ from gnuradio import qtgui
+ import sip
+ callbacks:
+ - set_num_rows(${nrows})
+ - set_num_cols(${ncols})
+ - set_multiplier(${mult})
+ - set_offset(${offset})
+ - set_update_time(${update_time})
+ - set_title(${which}, ${title})
+ - set_color(${which}, ${color})
+ make: |-
+ <%
+ win = 'self._%s_win'%id
+ %>\
+ qtgui.${type.fcn}(
+ ${samp_rate},
+ ${nrows},
+ ${ncols},
+ ${mult},
+ ${offset},
+ ${name},
+ ${0 if type.startswith('msg') else nconnections}
+ )
+
+ self.${id}.set_update_time(${update_time})
+ self.${id}.set_intensity_range(${zmin}, ${zmax})
+ self.${id}.enable_grid(${grid})
+ self.${id}.enable_axis_labels(${axislabels})
+
+ labels = [${label1}, ${label2}, ${label3}, ${label4}, ${label5},
+ ${label6}, ${label7}, ${label8}, ${label9}, ${label10}]
+ colors = [${color1}, ${color2}, ${color3}, ${color4}, ${color5},
+ ${color6}, ${color7}, ${color8}, ${color9}, ${color10}]
+ alphas = [${alpha1}, ${alpha2}, ${alpha3}, ${alpha4}, ${alpha5},
+ ${alpha6}, ${alpha7}, ${alpha8}, ${alpha9}, ${alpha10}]
+
+ for i in range(${1 if type.startswith('msg') else nconnections}):
+ if len(labels[i]) == 0:
+ self.${id}.set_line_label(i, "Data {0}".format(i))
+ else:
+ self.${id}.set_line_label(i, labels[i])
+ self.${id}.set_color_map(i, colors[i])
+ self.${id}.set_line_alpha(i, alphas[i])
+
+ ${win} = sip.wrapinstance(self.${id}.pyqwidget(), Qt.QWidget)
+ ${gui_hint() % win}
+
+documentation: |-
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/gr-qtgui/grc/qtgui_time_raster_x.xml b/gr-qtgui/grc/qtgui_time_raster_x.xml
deleted file mode 100644
index d458f67eb..000000000
--- a/gr-qtgui/grc/qtgui_time_raster_x.xml
+++ /dev/null
@@ -1,466 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##QT GUI Sink
-###################################################
- -->
-<block>
- <name>QT GUI Time Raster Sink</name>
- <key>qtgui_time_raster_sink_x</key>
- <import>from PyQt5 import Qt</import>
- <import>from gnuradio import qtgui</import>
- <import>import sip</import>
- <make>#set $win = 'self._%s_win'%$id
-qtgui.$(type.fcn)(
- $samp_rate,
- $nrows,
- $ncols,
- $mult,
- $offset,
- $name,
- #if $type.t == 'message' then 0 else $nconnections#,
- )
-
-self.$(id).set_update_time($update_time)
-self.$(id).set_intensity_range($zmin, $zmax)
-self.$(id).enable_grid($grid)
-self.$(id).enable_axis_labels($axislabels)
-
-labels = [$label1, $label2, $label3, $label4, $label5,
- $label6, $label7, $label8, $label9, $label10]
-colors = [$color1, $color2, $color3, $color4, $color5,
- $color6, $color7, $color8, $color9, $color10]
-alphas = [$alpha1, $alpha2, $alpha3, $alpha4, $alpha5,
- $alpha6, $alpha7, $alpha8, $alpha9, $alpha10]
-for i in xrange(#if $type.t == 'message' then 1 else $nconnections#):
- if len(labels[i]) == 0:
- self.$(id).set_line_label(i, "Data {0}".format(i))
- else:
- self.$(id).set_line_label(i, labels[i])
- self.$(id).set_color_map(i, colors[i])
- self.$(id).set_line_alpha(i, alphas[i])
-
-self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
-$(gui_hint()($win))</make>
- <callback>set_num_rows($nrows)</callback>
- <callback>set_num_cols($ncols)</callback>
- <callback>set_multiplier($mult)</callback>
- <callback>set_offset($offset)</callback>
- <callback>set_update_time($update_time)</callback>
- <callback>set_title($which, $title)</callback>
- <callback>set_color($which, $color)</callback>
-
- <param_tab_order>
- <tab>General</tab>
- <tab>Config</tab>
- </param_tab_order>
-
- <param>
- <name>Type</name>
- <key>type</key>
- <value>complex</value>
- <type>enum</type>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:time_raster_sink_b</opt>
- <opt>t:byte</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:time_raster_sink_f</opt>
- <opt>t:float</opt>
- </option>
- <option>
- <name>Byte Message</name>
- <key>msg_byte</key>
- <opt>fcn:time_raster_sink_b</opt>
- <opt>t:message</opt>
- </option>
- <option>
- <name>Float Message</name>
- <key>msg_float</key>
- <opt>fcn:time_raster_sink_f</opt>
- <opt>t:message</opt>
- </option>
- </param>
-
- <param>
- <name>Name</name>
- <key>name</key>
- <value>""</value>
- <type>string</type>
- <hide>#if len($name()) > 0 then 'none' else 'part'#</hide>
- </param>
-
- <param>
- <name>Sample Rate</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Num. Rows</name>
- <key>nrows</key>
- <type>int</type>
- <hide>#if $type.t == 'message' then 'all' else 'none'#</hide>
- </param>
-
- <param>
- <name>Num. Cols</name>
- <key>ncols</key>
- <type>int</type>
- </param>
-
- <param>
- <name>Grid</name>
- <key>grid</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Int. min</name>
- <key>zmin</key>
- <value>-1</value>
- <type>real</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Int. max</name>
- <key>zmax</key>
- <value>1</value>
- <type>real</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Multiplier</name>
- <key>mult</key>
- <value>[]</value>
- <type>real_vector</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Offset</name>
- <key>offset</key>
- <value>[]</value>
- <type>real_vector</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Number of Inputs</name>
- <key>nconnections</key>
- <value>1</value>
- <type>int</type>
- <hide>#if $type.t == 'message' then 'all' else 'part'#</hide>
- </param>
-
- <param>
- <name>Update Period</name>
- <key>update_time</key>
- <value>0.10</value>
- <type>real</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Axis Labels</name>
- <key>axislabels</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Label</name>
- <key>label1</key>
- <type>string</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Color</name>
- <key>color1</key>
- <type>enum</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <option>
- <name>Multi Color</name>
- <key>0</key>
- </option>
- <option>
- <name>White Hot</name>
- <key>1</key>
- </option>
- <option>
- <name>Black Hot</name>
- <key>2</key>
- </option>
- <option>
- <name>Incandescent</name>
- <key>3</key>
- </option>
- <option>
- <name>Sunset</name>
- <key>5</key>
- </option>
- <option>
- <name>Cool</name>
- <key>6</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Alpha</name>
- <key>alpha1</key>
- <value>1.0</value>
- <type>float</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 2 Label</name>
- <key>label2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 2 Color</name>
- <key>color2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 2 Alpha</name>
- <key>alpha2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 3 Label</name>
- <key>label3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 3 Color</name>
- <key>color3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 3 Alpha</name>
- <key>alpha3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 4 Label</name>
- <key>label4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 4 Color</name>
- <key>color4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 4 Alpha</name>
- <key>alpha4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 5 Label</name>
- <key>label5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 5 Color</name>
- <key>color5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 5 Alpha</name>
- <key>alpha5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 6 Label</name>
- <key>label6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 6 Color</name>
- <key>color6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 6 Alpha</name>
- <key>alpha6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 7 Label</name>
- <key>label7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 7 Color</name>
- <key>color7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 7 Alpha</name>
- <key>alpha7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 8 Label</name>
- <key>label8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 8 Color</name>
- <key>color8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 8 Alpha</name>
- <key>alpha8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 9 Label</name>
- <key>label9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 9 Color</name>
- <key>color9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 9 Alpha</name>
- <key>alpha9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 10 Label</name>
- <key>label10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 10 Color</name>
- <key>color10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 10 Alpha</name>
- <key>alpha10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
-
- <sink>
- <name>in</name>
- <type>$type.t</type>
- <nports>#if $type.t == 'message' then 0 else $nconnections#</nports>
- <optional>1</optional>
- </sink>
-
- <doc>
-The GUI hint can be used to position the widget within the application. \
-The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
-Both the tab specification and the grid position are optional.
- </doc>
-</block>
diff --git a/gr-qtgui/grc/qtgui_time_sink_x.block.yml b/gr-qtgui/grc/qtgui_time_sink_x.block.yml
new file mode 100644
index 000000000..e59bbca04
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_time_sink_x.block.yml
@@ -0,0 +1,568 @@
+id: qtgui_time_sink_x
+label: QT GUI Time Sink
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ default: complex
+ options: [complex, float, msg_complex, msg_float]
+ option_labels: [Complex, Float, Complex Message, Float Message]
+ option_attributes:
+ fcn: [time_sink_c, time_sink_f, time_sink_c, time_sink_f]
+ t: [complex, float, message, message]
+ hide: part
+- id: name
+ label: Name
+ dtype: string
+ default: '""'
+ hide: ${ ('none' if len(name) > 0 else 'part') }
+- id: ylabel
+ label: Y Axis Label
+ dtype: string
+ default: Amplitude
+ hide: part
+- id: yunit
+ label: Y Axis Unit
+ dtype: string
+ default: '""'
+ hide: part
+- id: size
+ label: Number of Points
+ dtype: int
+ default: '1024'
+ hide: ${ ('all' if type.startswith('msg') else 'none') }
+- id: srate
+ label: Sample Rate
+ dtype: float
+ default: samp_rate
+- id: grid
+ label: Grid
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: autoscale
+ label: Autoscale
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: ymin
+ label: Y min
+ dtype: float
+ default: '-1'
+ hide: part
+- id: ymax
+ label: Y max
+ dtype: float
+ default: '1'
+ hide: part
+- id: nconnections
+ label: Number of Inputs
+ dtype: int
+ default: '1'
+ hide: ${ ('all' if type.startswith('msg') else 'part') }
+- id: update_time
+ label: Update Period
+ dtype: float
+ default: '0.10'
+ hide: part
+- id: entags
+ label: Disp. Tags
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: ${ ('all' if type.startswith('msg') else 'part') }
+- id: gui_hint
+ label: GUI Hint
+ dtype: gui_hint
+ hide: part
+- id: tr_mode
+ label: Trigger Mode
+ category: Trigger
+ dtype: enum
+ default: qtgui.TRIG_MODE_FREE
+ options: [qtgui.TRIG_MODE_FREE, qtgui.TRIG_MODE_AUTO, qtgui.TRIG_MODE_NORM, qtgui.TRIG_MODE_TAG]
+ option_labels: [Free, Auto, Normal, Tag]
+ hide: part
+- id: tr_slope
+ label: Trigger Slope
+ category: Trigger
+ dtype: enum
+ default: qtgui.TRIG_MODE_POS
+ options: [qtgui.TRIG_SLOPE_POS, qtgui.TRIG_SLOPE_NEG]
+ option_labels: [Positive, Negative]
+ hide: part
+- id: tr_level
+ label: Trigger Level
+ category: Trigger
+ dtype: float
+ default: '0.0'
+ hide: part
+- id: tr_delay
+ label: Trigger Delay
+ category: Trigger
+ dtype: float
+ default: '0'
+ hide: part
+- id: tr_chan
+ label: Trigger Channel
+ category: Trigger
+ dtype: int
+ default: '0'
+ hide: part
+- id: tr_tag
+ label: Trigger Tag Key
+ category: Trigger
+ dtype: string
+ default: '""'
+ hide: part
+- id: ctrlpanel
+ label: Control Panel
+ category: Config
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: legend
+ label: Legend
+ category: Config
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: axislabels
+ label: Axis Labels
+ category: Config
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: stemplot
+ label: Stem Plot
+ category: Config
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: label1
+ label: Line 1 Label
+ category: Config
+ dtype: string
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: width1
+ label: Line 1 Width
+ category: Config
+ dtype: int
+ default: '1'
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: color1
+ label: Line 1 Color
+ category: Config
+ dtype: enum
+ options: ['"blue"', '"red"', '"green"', '"black"', '"cyan"', '"magenta"', '"yellow"',
+ '"dark red"', '"dark green"', '"Dark Blue"']
+ option_labels: [Blue, Red, Green, Black, Cyan, Magenta, Yellow, Dark Red, Dark
+ Green, Dark Blue]
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: style1
+ label: Line 1 Style
+ category: Config
+ dtype: enum
+ options: ['1', '2', '3', '4', '5', '0']
+ option_labels: [Solid, Dash, Dots, Dash-Dot, Dash-Dot-Dot, None]
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: marker1
+ label: Line 1 Marker
+ category: Config
+ dtype: enum
+ options: ['-1', '0', '1', '2', '3', '4', '6', '7', '8', '9']
+ option_labels: [None, Circle, Rectangle, Diamond, Triangle, Down Triangle, Left
+ Triangle, Right Triangle, Cross, X-Cross]
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: alpha1
+ label: Line 1 Alpha
+ category: Config
+ dtype: float
+ default: '1.0'
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: label2
+ label: Line 2 Label
+ dtype: ''
+ hide: ${ ('part' if (int(nconnections) >= 2 or (type == "complex" and int(nconnections)
+ >= 1) or (type == "msg_complex")) and (not type == "msg_float") else 'all')
+ }
+- id: width2
+ label: Line 2 Width
+ dtype: ''
+ hide: ${ ('part' if (int(nconnections) >= 2 or (type == "complex" and int(nconnections)
+ >= 1) or (type == "msg_complex")) and (not type == "msg_float") else 'all')
+ }
+- id: color2
+ label: Line 2 Color
+ dtype: ''
+ default: '"red"'
+ hide: ${ ('part' if (int(nconnections) >= 2 or (type == "complex" and int(nconnections)
+ >= 1) or (type == "msg_complex")) and (not type == "msg_float") else 'all')
+ }
+- id: style2
+ label: Line 2 Style
+ dtype: ''
+ hide: ${ ('part' if (int(nconnections) >= 2 or (type == "complex" and int(nconnections)
+ >= 1) or (type == "msg_complex")) and (not type == "msg_float") else 'all')
+ }
+- id: marker2
+ label: Line 2 Marker
+ dtype: ''
+ hide: ${ ('part' if (int(nconnections) >= 2 or (type == "complex" and int(nconnections)
+ >= 1) or (type == "msg_complex")) and (not type == "msg_float") else 'all')
+ }
+- id: alpha2
+ label: Line 2 Alpha
+ dtype: ''
+ hide: ${ ('part' if (int(nconnections) >= 2 or (type == "complex" and int(nconnections)
+ >= 1) or (type == "msg_complex")) and (not type == "msg_float") else 'all')
+ }
+- id: label3
+ label: Line 3 Label
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 3 or (type == "complex" and int(nconnections)
+ >= 2)) and not type.t == "message") else 'all') }
+- id: width3
+ label: Line 3 Width
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 3 or (type == "complex" and int(nconnections)
+ >= 2)) and not type.t == "message") else 'all') }
+- id: color3
+ label: Line 3 Color
+ dtype: ''
+ default: '"green"'
+ hide: ${ ('part' if ((int(nconnections) >= 3 or (type == "complex" and int(nconnections)
+ >= 2)) and not type.t == "message") else 'all') }
+- id: style3
+ label: Line 3 Style
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 3 or (type == "complex" and int(nconnections)
+ >= 2)) and not type.t == "message") else 'all') }
+- id: marker3
+ label: Line 3 Marker
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 3 or (type == "complex" and int(nconnections)
+ >= 2)) and not type.t == "message") else 'all') }
+- id: alpha3
+ label: Line 3 Alpha
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 3 or (type == "complex" and int(nconnections)
+ >= 2)) and not type.t == "message") else 'all') }
+- id: label4
+ label: Line 4 Label
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 4 or (type == "complex" and int(nconnections)
+ >= 2)) and not type.t == "message") else 'all') }
+- id: width4
+ label: Line 4 Width
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 4 or (type == "complex" and int(nconnections)
+ >= 2)) and not type.t == "message") else 'all') }
+- id: color4
+ label: Line 4 Color
+ dtype: ''
+ default: '"black"'
+ hide: ${ ('part' if ((int(nconnections) >= 4 or (type == "complex" and int(nconnections)
+ >= 2)) and not type.t == "message") else 'all') }
+- id: style4
+ label: Line 4 Style
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 4 or (type == "complex" and int(nconnections)
+ >= 2)) and not type.t == "message") else 'all') }
+- id: marker4
+ label: Line 4 Marker
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 4 or (type == "complex" and int(nconnections)
+ >= 2)) and not type.t == "message") else 'all') }
+- id: alpha4
+ label: Line 4 Alpha
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 4 or (type == "complex" and int(nconnections)
+ >= 2)) and not type.t == "message") else 'all') }
+- id: label5
+ label: Line 5 Label
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 5 or (type == "complex" and int(nconnections)
+ >= 3)) and not type.t == "message") else 'all') }
+- id: width5
+ label: Line 5 Width
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 5 or (type == "complex" and int(nconnections)
+ >= 3)) and not type.t == "message") else 'all') }
+- id: color5
+ label: Line 5 Color
+ dtype: ''
+ default: '"cyan"'
+ hide: ${ ('part' if ((int(nconnections) >= 5 or (type == "complex" and int(nconnections)
+ >= 3)) and not type.t == "message") else 'all') }
+- id: style5
+ label: Line 5 Style
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 5 or (type == "complex" and int(nconnections)
+ >= 3)) and not type.t == "message") else 'all') }
+- id: marker5
+ label: Line 5 Marker
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 5 or (type == "complex" and int(nconnections)
+ >= 3)) and not type.t == "message") else 'all') }
+- id: alpha5
+ label: Line 5 Alpha
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 5 or (type == "complex" and int(nconnections)
+ >= 3)) and not type.t == "message") else 'all') }
+- id: label6
+ label: Line 6 Label
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 6 or (type == "complex" and int(nconnections)
+ >= 3)) and not type.t == "message") else 'all') }
+- id: width6
+ label: Line 6 Width
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 6 or (type == "complex" and int(nconnections)
+ >= 3)) and not type.t == "message") else 'all') }
+- id: color6
+ label: Line 6 Color
+ dtype: ''
+ default: '"magenta"'
+ hide: ${ ('part' if ((int(nconnections) >= 6 or (type == "complex" and int(nconnections)
+ >= 3)) and not type.t == "message") else 'all') }
+- id: style6
+ label: Line 6 Style
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 6 or (type == "complex" and int(nconnections)
+ >= 3)) and not type.t == "message") else 'all') }
+- id: marker6
+ label: Line 6 Marker
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 6 or (type == "complex" and int(nconnections)
+ >= 3)) and not type.t == "message") else 'all') }
+- id: alpha6
+ label: Line 6 Alpha
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 6 or (type == "complex" and int(nconnections)
+ >= 3)) and not type.t == "message") else 'all') }
+- id: label7
+ label: Line 7 Label
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 7 or (type == "complex" and int(nconnections)
+ >= 4)) and not type.t == "message") else 'all') }
+- id: width7
+ label: Line 7 Width
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 7 or (type == "complex" and int(nconnections)
+ >= 4)) and not type.t == "message") else 'all') }
+- id: color7
+ label: Line 7 Color
+ dtype: ''
+ default: '"yellow"'
+ hide: ${ ('part' if ((int(nconnections) >= 7 or (type == "complex" and int(nconnections)
+ >= 4)) and not type.t == "message") else 'all') }
+- id: style7
+ label: Line 7 Style
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 7 or (type == "complex" and int(nconnections)
+ >= 4)) and not type.t == "message") else 'all') }
+- id: marker7
+ label: Line 7 Marker
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 7 or (type == "complex" and int(nconnections)
+ >= 4)) and not type.t == "message") else 'all') }
+- id: alpha7
+ label: Line 7 Alpha
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 7 or (type == "complex" and int(nconnections)
+ >= 4)) and not type.t == "message") else 'all') }
+- id: label8
+ label: Line 8 Label
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 8 or (type == "complex" and int(nconnections)
+ >= 4)) and not type.t == "message") else 'all') }
+- id: width8
+ label: Line 8 Width
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 8 or (type == "complex" and int(nconnections)
+ >= 4)) and not type.t == "message") else 'all') }
+- id: color8
+ label: Line 8 Color
+ dtype: ''
+ default: '"dark red"'
+ hide: ${ ('part' if ((int(nconnections) >= 8 or (type == "complex" and int(nconnections)
+ >= 4)) and not type.t == "message") else 'all') }
+- id: style8
+ label: Line 8 Style
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 8 or (type == "complex" and int(nconnections)
+ >= 4)) and not type.t == "message") else 'all') }
+- id: marker8
+ label: Line 8 Marker
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 8 or (type == "complex" and int(nconnections)
+ >= 4)) and not type.t == "message") else 'all') }
+- id: alpha8
+ label: Line 8 Alpha
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 8 or (type == "complex" and int(nconnections)
+ >= 4)) and not type.t == "message") else 'all') }
+- id: label9
+ label: Line 9 Label
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 9 or (type == "complex" and int(nconnections)
+ >= 5)) and not type.t == "message") else 'all') }
+- id: width9
+ label: Line 9 Width
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 9 or (type == "complex" and int(nconnections)
+ >= 5)) and not type.t == "message") else 'all') }
+- id: color9
+ label: Line 9 Color
+ dtype: ''
+ default: '"dark green"'
+ hide: ${ ('part' if ((int(nconnections) >= 9 or (type == "complex" and int(nconnections)
+ >= 5)) and not type.t == "message") else 'all') }
+- id: style9
+ label: Line 9 Style
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 9 or (type == "complex" and int(nconnections)
+ >= 5)) and not type.t == "message") else 'all') }
+- id: marker9
+ label: Line 9 Marker
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 9 or (type == "complex" and int(nconnections)
+ >= 5)) and not type.t == "message") else 'all') }
+- id: alpha9
+ label: Line 9 Alpha
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 9 or (type == "complex" and int(nconnections)
+ >= 5)) and not type.t == "message") else 'all') }
+- id: label10
+ label: Line 10 Label
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 10 or (type == "complex" and int(nconnections)
+ >= 5)) and not type.t == "message") else 'all') }
+- id: width10
+ label: Line 10 Width
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 10 or (type == "complex" and int(nconnections)
+ >= 5)) and not type.t == "message") else 'all') }
+- id: color10
+ label: Line 10 Color
+ dtype: ''
+ default: '"dark blue"'
+ hide: ${ ('part' if ((int(nconnections) >= 10 or (type == "complex" and int(nconnections)
+ >= 5)) and not type.t == "message") else 'all') }
+- id: style10
+ label: Line 10 Style
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 10 or (type == "complex" and int(nconnections)
+ >= 5)) and not type.t == "message") else 'all') }
+- id: marker10
+ label: Line 10 Marker
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 10 or (type == "complex" and int(nconnections)
+ >= 5)) and not type.t == "message") else 'all') }
+- id: alpha10
+ label: Line 10 Alpha
+ dtype: ''
+ hide: ${ ('part' if ((int(nconnections) >= 10 or (type == "complex" and int(nconnections)
+ >= 5)) and not type.t == "message") else 'all') }
+
+asserts:
+- ${nconnections <= (5 if type == 'complex' else 10)}
+
+inputs:
+- domain: stream
+ dtype: ${ type.t }
+ multiplicity: ${ (0 if type.startswith('msg') else nconnections) }
+ optional: true
+
+templates:
+ imports: |-
+ from PyQt5 import Qt
+ from gnuradio import qtgui
+ from gnuradio.filter import firdes
+ import sip
+ callbacks:
+ - set_time_domain_axis(${min}, ${max})
+ - set_update_time(${update_time})
+ - set_title(${which}, ${title})
+ - set_color(${which}, ${color})
+ - set_y_axis(${ymin}, ${ymax})
+ - set_samp_rate(${srate})
+ - self.${id}.set_trigger_mode(${tr_mode}, ${tr_slope}, ${tr_level}, ${tr_delay},
+ ${tr_chan}, ${tr_tag})
+ make: |-
+ <%
+ win = 'self._%s_win'%id
+ %>\
+ qtgui.${type.fcn}(
+ ${size}, #size
+ ${srate}, #samp_rate
+ ${name}, #name
+ ${0 if type.startswith('msg') else nconnections} #number of inputs
+ )
+ self.${id}.set_update_time(${update_time})
+ self.${id}.set_y_axis(${ymin}, ${ymax})
+
+ self.${id}.set_y_label(${ylabel}, ${yunit})
+
+ self.${id}.enable_tags(-1, ${entags})
+ self.${id}.set_trigger_mode(${tr_mode}, ${tr_slope}, ${tr_level}, ${tr_delay}, ${tr_chan}, ${tr_tag})
+ self.${id}.enable_autoscale(${autoscale})
+ self.${id}.enable_grid(${grid})
+ self.${id}.enable_axis_labels(${axislabels})
+ self.${id}.enable_control_panel(${ctrlpanel})
+ self.${id}.enable_stem_plot(${stemplot})
+
+ if not ${legend}:
+ self.${id}.disable_legend()
+
+ labels = [${label1}, ${label2}, ${label3}, ${label4}, ${label5},
+ ${label6}, ${label7}, ${label8}, ${label9}, ${label10}]
+ widths = [${width1}, ${width2}, ${width3}, ${width4}, ${width5},
+ ${width6}, ${width7}, ${width8}, ${width9}, ${width10}]
+ colors = [${color1}, ${color2}, ${color3}, ${color4}, ${color5},
+ ${color6}, ${color7}, ${color8}, ${color9}, ${color10}]
+ alphas = [${alpha1}, ${alpha2}, ${alpha3}, ${alpha4}, ${alpha5},
+ ${alpha6}, ${alpha7}, ${alpha8}, ${alpha9}, ${alpha10}]
+ styles = [${style1}, ${style2}, ${style3}, ${style4}, ${style5},
+ ${style6}, ${style7}, ${style8}, ${style9}, ${style10}]
+ markers = [${marker1}, ${marker2}, ${marker3}, ${marker4}, ${marker5},
+ ${marker6}, ${marker7}, ${marker8}, ${marker9}, ${marker10}]
+
+
+ % if type.endswith('complex'):
+ for i in range(${2 if type.startswith('msg') else 2*nconnections}):
+ if len(labels[i]) == 0:
+ if (i % 2 == 0):
+ self.${id}.set_line_label(i, "Re{{Data {0}}}".format(i/2))
+ else:
+ self.${id}.set_line_label(i, "Im{{Data {0}}}".format(i/2))
+ else:
+ self.${id}.set_line_label(i, labels[i])
+ self.${id].set_line_width(i, widths[i])
+ self.${id].set_line_color(i, colors[i])
+ self.${id].set_line_style(i, styles[i])
+ self.${id].set_line_marker(i, markers[i])
+ self.${id].set_line_alpha(i, alphas[i])
+ % endif
+
+ ${win} = sip.wrapinstance(self.${id}.pyqwidget(), Qt.QWidget)
+ ${gui_hint() % win}
+
+documentation: |-
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/gr-qtgui/grc/qtgui_time_sink_x.xml b/gr-qtgui/grc/qtgui_time_sink_x.xml
deleted file mode 100644
index 7358c7885..000000000
--- a/gr-qtgui/grc/qtgui_time_sink_x.xml
+++ /dev/null
@@ -1,966 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##QT GUI Sink
-###################################################
- -->
-<block>
- <name>QT GUI Time Sink</name>
- <key>qtgui_time_sink_x</key>
- <import>from PyQt5 import Qt</import>
- <import>from gnuradio import qtgui</import>
- <import>from gnuradio.filter import firdes</import>
- <import>import sip</import>
- <make>#set $win = 'self._%s_win'%$id
-qtgui.$(type.fcn)(
- $size, \#size
- $srate, \#samp_rate
- $name, \#name
- #if $type.t == 'message' then 0 else $nconnections# \#number of inputs
-)
-self.$(id).set_update_time($update_time)
-self.$(id).set_y_axis($ymin, $ymax)
-
-self.$(id).set_y_label($ylabel, $yunit)
-
-self.$(id).enable_tags(-1, $entags)
-self.$(id).set_trigger_mode($tr_mode, $tr_slope, $tr_level, $tr_delay, $tr_chan, $tr_tag)
-self.$(id).enable_autoscale($autoscale)
-self.$(id).enable_grid($grid)
-self.$(id).enable_axis_labels($axislabels)
-self.$(id).enable_control_panel($ctrlpanel)
-self.$(id).enable_stem_plot($stemplot)
-
-if not $legend:
- self.$(id).disable_legend()
-
-labels = [$label1, $label2, $label3, $label4, $label5,
- $label6, $label7, $label8, $label9, $label10]
-widths = [$width1, $width2, $width3, $width4, $width5,
- $width6, $width7, $width8, $width9, $width10]
-colors = [$color1, $color2, $color3, $color4, $color5,
- $color6, $color7, $color8, $color9, $color10]
-styles = [$style1, $style2, $style3, $style4, $style5,
- $style6, $style7, $style8, $style9, $style10]
-markers = [$marker1, $marker2, $marker3, $marker4, $marker5,
- $marker6, $marker7, $marker8, $marker9, $marker10]
-alphas = [$alpha1, $alpha2, $alpha3, $alpha4, $alpha5,
- $alpha6, $alpha7, $alpha8, $alpha9, $alpha10]
-
-#if ($type() == 'complex' or $type() == 'msg_complex')
-for i in xrange(#if $type.t == 'message' then 2 else 2*$nconnections()#):
- if len(labels[i]) == 0:
- if(i % 2 == 0):
- self.$(id).set_line_label(i, "Re{{Data {0}}}".format(i/2))
- else:
- self.$(id).set_line_label(i, "Im{{Data {0}}}".format(i/2))
- else:
- self.$(id).set_line_label(i, labels[i])
- self.$(id).set_line_width(i, widths[i])
- self.$(id).set_line_color(i, colors[i])
- self.$(id).set_line_style(i, styles[i])
- self.$(id).set_line_marker(i, markers[i])
- self.$(id).set_line_alpha(i, alphas[i])
-#else
-for i in xrange(#if $type.t == 'message' then 1 else $nconnections#):
- if len(labels[i]) == 0:
- self.$(id).set_line_label(i, "Data {0}".format(i))
- else:
- self.$(id).set_line_label(i, labels[i])
- self.$(id).set_line_width(i, widths[i])
- self.$(id).set_line_color(i, colors[i])
- self.$(id).set_line_style(i, styles[i])
- self.$(id).set_line_marker(i, markers[i])
- self.$(id).set_line_alpha(i, alphas[i])
-#end if
-
-self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
-$(gui_hint()($win))</make>
- <callback>set_time_domain_axis($min, $max)</callback>
- <callback>set_update_time($update_time)</callback>
- <callback>set_title($which, $title)</callback>
- <callback>set_color($which, $color)</callback>
- <callback>set_y_axis($ymin, $ymax)</callback>
- <callback>set_samp_rate($srate)</callback>
- <callback>self.$(id).set_trigger_mode($tr_mode, $tr_slope, $tr_level, $tr_delay, $tr_chan, $tr_tag)</callback>
-
- <param_tab_order>
- <tab>General</tab>
- <tab>Trigger</tab>
- <tab>Config</tab>
- </param_tab_order>
-
- <param>
- <name>Type</name>
- <key>type</key>
- <value>complex</value>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:time_sink_c</opt>
- <opt>t:complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:time_sink_f</opt>
- <opt>t:float</opt>
- </option>
- <option>
- <name>Complex Message</name>
- <key>msg_complex</key>
- <opt>fcn:time_sink_c</opt>
- <opt>t:message</opt>
- </option>
- <option>
- <name>Float Message</name>
- <key>msg_float</key>
- <opt>fcn:time_sink_f</opt>
- <opt>t:message</opt>
- </option>
- </param>
-
- <param>
- <name>Name</name>
- <key>name</key>
- <value>""</value>
- <type>string</type>
- <hide>#if len($name()) > 0 then 'none' else 'part'#</hide>
- </param>
-
- <param>
- <name>Y Axis Label</name>
- <key>ylabel</key>
- <value>Amplitude</value>
- <type>string</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Y Axis Unit</name>
- <key>yunit</key>
- <value>""</value>
- <type>string</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Number of Points</name>
- <key>size</key>
- <value>1024</value>
- <type>int</type>
- <hide>#if $type.t == 'message' then 'all' else 'none'#</hide>
- </param>
-
- <param>
- <name>Sample Rate</name>
- <key>srate</key>
- <value>samp_rate</value>
- <type>float</type>
- </param>
-
- <param>
- <name>Grid</name>
- <key>grid</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Autoscale</name>
- <key>autoscale</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Y min</name>
- <key>ymin</key>
- <value>-1</value>
- <type>float</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Y max</name>
- <key>ymax</key>
- <value>1</value>
- <type>float</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Number of Inputs</name>
- <key>nconnections</key>
- <value>1</value>
- <type>int</type>
- <hide>#if $type.t == 'message' then 'all' else 'part'#</hide>
- </param>
-
- <param>
- <name>Update Period</name>
- <key>update_time</key>
- <value>0.10</value>
- <type>float</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Disp. Tags</name>
- <key>entags</key>
- <value>True</value>
- <type>enum</type>
- <hide>#if $type.t == 'message' then 'all' else 'part'#</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- </param>
-
-
- <param>
- <name>Trigger Mode</name>
- <key>tr_mode</key>
- <value>qtgui.TRIG_MODE_FREE</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Free</name>
- <key>qtgui.TRIG_MODE_FREE</key>
- </option>
- <option>
- <name>Auto</name>
- <key>qtgui.TRIG_MODE_AUTO</key>
- </option>
- <option>
- <name>Normal</name>
- <key>qtgui.TRIG_MODE_NORM</key>
- </option>
- <option>
- <name>Tag</name>
- <key>qtgui.TRIG_MODE_TAG</key>
- </option>
- <tab>Trigger</tab>
- </param>
-
- <param>
- <name>Trigger Slope</name>
- <key>tr_slope</key>
- <value>qtgui.TRIG_MODE_POS</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Positive</name>
- <key>qtgui.TRIG_SLOPE_POS</key>
- </option>
- <option>
- <name>Negative</name>
- <key>qtgui.TRIG_SLOPE_NEG</key>
- </option>
- <tab>Trigger</tab>
- </param>
-
- <param>
- <name>Trigger Level</name>
- <key>tr_level</key>
- <value>0.0</value>
- <type>float</type>
- <hide>part</hide>
- <tab>Trigger</tab>
- </param>
-
- <param>
- <name>Trigger Delay</name>
- <key>tr_delay</key>
- <value>0</value>
- <type>float</type>
- <hide>part</hide>
- <tab>Trigger</tab>
- </param>
-
- <param>
- <name>Trigger Channel</name>
- <key>tr_chan</key>
- <value>0</value>
- <type>int</type>
- <hide>part</hide>
- <tab>Trigger</tab>
- </param>
-
- <param>
- <name>Trigger Tag Key</name>
- <key>tr_tag</key>
- <value>""</value>
- <type>string</type>
- <hide>part</hide>
- <tab>Trigger</tab>
- </param>
-
-
-
- <!-- Begin Config Tab items -->
-
- <param>
- <name>Control Panel</name>
- <key>ctrlpanel</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Legend</name>
- <key>legend</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Axis Labels</name>
- <key>axislabels</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Stem Plot</name>
- <key>stemplot</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Label</name>
- <key>label1</key>
- <type>string</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Width</name>
- <key>width1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Color</name>
- <key>color1</key>
- <type>enum</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <option>
- <name>Blue</name>
- <key>"blue"</key>
- </option>
- <option>
- <name>Red</name>
- <key>"red"</key>
- </option>
- <option>
- <name>Green</name>
- <key>"green"</key>
- </option>
- <option>
- <name>Black</name>
- <key>"black"</key>
- </option>
- <option>
- <name>Cyan</name>
- <key>"cyan"</key>
- </option>
- <option>
- <name>Magenta</name>
- <key>"magenta"</key>
- </option>
- <option>
- <name>Yellow</name>
- <key>"yellow"</key>
- </option>
- <option>
- <name>Dark Red</name>
- <key>"dark red"</key>
- </option>
- <option>
- <name>Dark Green</name>
- <key>"dark green"</key>
- </option>
- <option>
- <name>Dark Blue</name>
- <key>"Dark Blue"</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Style</name>
- <key>style1</key>
- <type>enum</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <option>
- <name>Solid</name>
- <key>1</key>
- </option>
- <option>
- <name>Dash</name>
- <key>2</key>
- </option>
- <option>
- <name>Dots</name>
- <key>3</key>
- </option>
- <option>
- <name>Dash-Dot</name>
- <key>4</key>
- </option>
- <option>
- <name>Dash-Dot-Dot</name>
- <key>5</key>
- </option>
- <option>
- <name>None</name>
- <key>0</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Marker</name>
- <key>marker1</key>
- <type>enum</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <option>
- <name>None</name>
- <key>-1</key>
- </option>
- <option>
- <name>Circle</name>
- <key>0</key>
- </option>
- <option>
- <name>Rectangle</name>
- <key>1</key>
- </option>
- <option>
- <name>Diamond</name>
- <key>2</key>
- </option>
- <option>
- <name>Triangle</name>
- <key>3</key>
- </option>
- <option>
- <name>Down Triangle</name>
- <key>4</key>
- </option>
- <option>
- <name>Left Triangle</name>
- <key>6</key>
- </option>
- <option>
- <name>Right Triangle</name>
- <key>7</key>
- </option>
- <option>
- <name>Cross</name>
- <key>8</key>
- </option>
- <option>
- <name>X-Cross</name>
- <key>9</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Alpha</name>
- <key>alpha1</key>
- <value>1.0</value>
- <type>float</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 2 Label</name>
- <key>label2</key>
- <hide>#if (int($nconnections()) >= 2 or ($type() == "complex" and int($nconnections()) >= 1) or ($type() == "msg_complex")) and (not $type() == "msg_float") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 2 Width</name>
- <key>width2</key>
- <hide>#if (int($nconnections()) >= 2 or ($type() == "complex" and int($nconnections()) >= 1) or ($type() == "msg_complex")) and (not $type() == "msg_float") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 2 Color</name>
- <key>color2</key>
- <value>"red"</value>
- <hide>#if (int($nconnections()) >= 2 or ($type() == "complex" and int($nconnections()) >= 1) or ($type() == "msg_complex")) and (not $type() == "msg_float") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 2 Style</name>
- <key>style2</key>
- <hide>#if (int($nconnections()) >= 2 or ($type() == "complex" and int($nconnections()) >= 1) or ($type() == "msg_complex")) and (not $type() == "msg_float") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 2 Marker</name>
- <key>marker2</key>
- <hide>#if (int($nconnections()) >= 2 or ($type() == "complex" and int($nconnections()) >= 1) or ($type() == "msg_complex")) and (not $type() == "msg_float") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 2 Alpha</name>
- <key>alpha2</key>
- <hide>#if (int($nconnections()) >= 2 or ($type() == "complex" and int($nconnections()) >= 1) or ($type() == "msg_complex")) and (not $type() == "msg_float") then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 3 Label</name>
- <key>label3</key>
- <hide>#if ((int($nconnections()) >= 3 or ($type() == "complex" and int($nconnections()) >= 2)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 3 Width</name>
- <key>width3</key>
- <hide>#if ((int($nconnections()) >= 3 or ($type() == "complex" and int($nconnections()) >= 2)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 3 Color</name>
- <key>color3</key>
- <value>"green"</value>
- <hide>#if ((int($nconnections()) >= 3 or ($type() == "complex" and int($nconnections()) >= 2)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 3 Style</name>
- <key>style3</key>
- <hide>#if ((int($nconnections()) >= 3 or ($type() == "complex" and int($nconnections()) >= 2)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 3 Marker</name>
- <key>marker3</key>
- <hide>#if ((int($nconnections()) >= 3 or ($type() == "complex" and int($nconnections()) >= 2)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 3 Alpha</name>
- <key>alpha3</key>
- <hide>#if ((int($nconnections()) >= 3 or ($type() == "complex" and int($nconnections()) >= 2)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 4 Label</name>
- <key>label4</key>
- <hide>#if ((int($nconnections()) >= 4 or ($type() == "complex" and int($nconnections()) >= 2)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 4 Width</name>
- <key>width4</key>
- <hide>#if ((int($nconnections()) >= 4 or ($type() == "complex" and int($nconnections()) >= 2)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 4 Color</name>
- <key>color4</key>
- <value>"black"</value>
- <hide>#if ((int($nconnections()) >= 4 or ($type() == "complex" and int($nconnections()) >= 2)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 4 Style</name>
- <key>style4</key>
- <hide>#if ((int($nconnections()) >= 4 or ($type() == "complex" and int($nconnections()) >= 2)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 4 Marker</name>
- <key>marker4</key>
- <hide>#if ((int($nconnections()) >= 4 or ($type() == "complex" and int($nconnections()) >= 2)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 4 Alpha</name>
- <key>alpha4</key>
- <hide>#if ((int($nconnections()) >= 4 or ($type() == "complex" and int($nconnections()) >= 2)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 5 Label</name>
- <key>label5</key>
- <hide>#if ((int($nconnections()) >= 5 or ($type() == "complex" and int($nconnections()) >= 3)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 5 Width</name>
- <key>width5</key>
- <hide>#if ((int($nconnections()) >= 5 or ($type() == "complex" and int($nconnections()) >= 3)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 5 Color</name>
- <key>color5</key>
- <value>"cyan"</value>
- <hide>#if ((int($nconnections()) >= 5 or ($type() == "complex" and int($nconnections()) >= 3)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 5 Style</name>
- <key>style5</key>
- <hide>#if ((int($nconnections()) >= 5 or ($type() == "complex" and int($nconnections()) >= 3)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 5 Marker</name>
- <key>marker5</key>
- <hide>#if ((int($nconnections()) >= 5 or ($type() == "complex" and int($nconnections()) >= 3)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 5 Alpha</name>
- <key>alpha5</key>
- <hide>#if ((int($nconnections()) >= 5 or ($type() == "complex" and int($nconnections()) >= 3)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 6 Label</name>
- <key>label6</key>
- <hide>#if ((int($nconnections()) >= 6 or ($type() == "complex" and int($nconnections()) >= 3)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 6 Width</name>
- <key>width6</key>
- <hide>#if ((int($nconnections()) >= 6 or ($type() == "complex" and int($nconnections()) >= 3)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 6 Color</name>
- <key>color6</key>
- <value>"magenta"</value>
- <hide>#if ((int($nconnections()) >= 6 or ($type() == "complex" and int($nconnections()) >= 3)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 6 Style</name>
- <key>style6</key>
- <hide>#if ((int($nconnections()) >= 6 or ($type() == "complex" and int($nconnections()) >= 3)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 6 Marker</name>
- <key>marker6</key>
- <hide>#if ((int($nconnections()) >= 6 or ($type() == "complex" and int($nconnections()) >= 3)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 6 Alpha</name>
- <key>alpha6</key>
- <hide>#if ((int($nconnections()) >= 6 or ($type() == "complex" and int($nconnections()) >= 3)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 7 Label</name>
- <key>label7</key>
- <hide>#if ((int($nconnections()) >= 7 or ($type() == "complex" and int($nconnections()) >= 4)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 7 Width</name>
- <key>width7</key>
- <hide>#if ((int($nconnections()) >= 7 or ($type() == "complex" and int($nconnections()) >= 4)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 7 Color</name>
- <key>color7</key>
- <value>"yellow"</value>
- <hide>#if ((int($nconnections()) >= 7 or ($type() == "complex" and int($nconnections()) >= 4)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 7 Style</name>
- <key>style7</key>
- <hide>#if ((int($nconnections()) >= 7 or ($type() == "complex" and int($nconnections()) >= 4)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 7 Marker</name>
- <key>marker7</key>
- <hide>#if ((int($nconnections()) >= 7 or ($type() == "complex" and int($nconnections()) >= 4)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 7 Alpha</name>
- <key>alpha7</key>
- <hide>#if ((int($nconnections()) >= 7 or ($type() == "complex" and int($nconnections()) >= 4)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 8 Label</name>
- <key>label8</key>
- <hide>#if ((int($nconnections()) >= 8 or ($type() == "complex" and int($nconnections()) >= 4)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 8 Width</name>
- <key>width8</key>
- <hide>#if ((int($nconnections()) >= 8 or ($type() == "complex" and int($nconnections()) >= 4)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 8 Color</name>
- <key>color8</key>
- <value>"dark red"</value>
- <hide>#if ((int($nconnections()) >= 8 or ($type() == "complex" and int($nconnections()) >= 4)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 8 Style</name>
- <key>style8</key>
- <hide>#if ((int($nconnections()) >= 8 or ($type() == "complex" and int($nconnections()) >= 4)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 8 Marker</name>
- <key>marker8</key>
- <hide>#if ((int($nconnections()) >= 8 or ($type() == "complex" and int($nconnections()) >= 4)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 8 Alpha</name>
- <key>alpha8</key>
- <hide>#if ((int($nconnections()) >= 8 or ($type() == "complex" and int($nconnections()) >= 4)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 9 Label</name>
- <key>label9</key>
- <hide>#if ((int($nconnections()) >= 9 or ($type() == "complex" and int($nconnections()) >= 5)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 9 Width</name>
- <key>width9</key>
- <hide>#if ((int($nconnections()) >= 9 or ($type() == "complex" and int($nconnections()) >= 5)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 9 Color</name>
- <key>color9</key>
- <value>"dark green"</value>
- <hide>#if ((int($nconnections()) >= 9 or ($type() == "complex" and int($nconnections()) >= 5)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 9 Style</name>
- <key>style9</key>
- <hide>#if ((int($nconnections()) >= 9 or ($type() == "complex" and int($nconnections()) >= 5)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 9 Marker</name>
- <key>marker9</key>
- <hide>#if ((int($nconnections()) >= 9 or ($type() == "complex" and int($nconnections()) >= 5)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 9 Alpha</name>
- <key>alpha9</key>
- <hide>#if ((int($nconnections()) >= 9 or ($type() == "complex" and int($nconnections()) >= 5)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 10 Label</name>
- <key>label10</key>
- <hide>#if ((int($nconnections()) >= 10 or ($type() == "complex" and int($nconnections()) >= 5)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 10 Width</name>
- <key>width10</key>
- <hide>#if ((int($nconnections()) >= 10 or ($type() == "complex" and int($nconnections()) >= 5)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 10 Color</name>
- <key>color10</key>
- <value>"dark blue"</value>
- <hide>#if ((int($nconnections()) >= 10 or ($type() == "complex" and int($nconnections()) >= 5)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>style1</base_key>
- <name>Line 10 Style</name>
- <key>style10</key>
- <hide>#if ((int($nconnections()) >= 10 or ($type() == "complex" and int($nconnections()) >= 5)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>marker1</base_key>
- <name>Line 10 Marker</name>
- <key>marker10</key>
- <hide>#if ((int($nconnections()) >= 10 or ($type() == "complex" and int($nconnections()) >= 5)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 10 Alpha</name>
- <key>alpha10</key>
- <hide>#if ((int($nconnections()) >= 10 or ($type() == "complex" and int($nconnections()) >= 5)) and not $type.t == "message") then 'part' else 'all'#</hide>
- </param>
-
- <check>$nconnections &lt;= #if $type() == "complex" then 5 else 10#</check>
-
- <sink>
- <name>in</name>
- <type>$type.t</type>
- <nports>#if $type.t == 'message' then 0 else $nconnections#</nports>
- <optional>1</optional>
- </sink>
-
- <doc>
-The GUI hint can be used to position the widget within the application. \
-The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
-Both the tab specification and the grid position are optional.
- </doc>
-</block>
diff --git a/gr-qtgui/grc/qtgui_vector_sink_f.block.yml b/gr-qtgui/grc/qtgui_vector_sink_f.block.yml
new file mode 100644
index 000000000..d2fb1a7d5
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_vector_sink_f.block.yml
@@ -0,0 +1,352 @@
+id: qtgui_vector_sink_f
+label: QT GUI Vector Sink
+
+parameters:
+- id: name
+ label: Name
+ dtype: string
+ default: '""'
+ hide: ${ ('none' if len(name) > 0 else 'part') }
+- id: vlen
+ label: Vector Size
+ dtype: int
+ default: '1024'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: x_start
+ label: X-Axis Start Value
+ dtype: real
+ default: '0'
+- id: x_step
+ label: X-Axis Step Value
+ dtype: real
+ default: '1.0'
+- id: x_axis_label
+ label: X-Axis Label
+ dtype: string
+ default: '"x-Axis"'
+ hide: ${ ('none' if (len(x_axis_label) > 0 and x_axis_label != "x-Axis") else
+ 'part') }
+- id: y_axis_label
+ label: Y-Axis Label
+ dtype: string
+ default: '"y-Axis"'
+ hide: ${ ('none' if (len(y_axis_label) > 0 and y_axis_label != "y-Axis") else
+ 'part') }
+- id: x_units
+ label: X-Axis Units
+ dtype: string
+ default: '""'
+ hide: '''part'''
+- id: y_units
+ label: Y-Axis Units
+ dtype: string
+ default: '""'
+ hide: '''part'''
+- id: ref_level
+ label: Ref Level
+ dtype: real
+ default: '0'
+- id: grid
+ label: Grid
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: autoscale
+ label: Autoscale
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: average
+ label: Average
+ dtype: enum
+ default: 'False'
+ options: ['1.0', '0.2', '0.1', '0.05']
+ option_labels: [None, Low, Medium, High]
+ hide: part
+- id: ymin
+ label: Y min
+ dtype: real
+ default: '-140'
+ hide: part
+- id: ymax
+ label: Y max
+ dtype: real
+ default: '10'
+ hide: part
+- id: nconnections
+ label: Number of Inputs
+ dtype: int
+ default: '1'
+ hide: part
+- id: update_time
+ label: Update Period
+ dtype: real
+ default: '0.10'
+ hide: part
+- id: gui_hint
+ label: GUI Hint
+ dtype: gui_hint
+ hide: part
+- id: showports
+ label: Show Msg Ports
+ dtype: enum
+ default: 'True'
+ options: ['False', 'True']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: label1
+ label: Line 1 Label
+ category: Config
+ dtype: string
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: width1
+ label: Line 1 Width
+ category: Config
+ dtype: int
+ default: '1'
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: color1
+ label: Line 1 Color
+ category: Config
+ dtype: enum
+ options: ['"blue"', '"red"', '"green"', '"black"', '"cyan"', '"magenta"', '"yellow"',
+ '"dark red"', '"dark green"', '"dark blue"']
+ option_labels: [Blue, Red, Green, Black, Cyan, Magenta, Yellow, Dark Red, Dark
+ Green, Dark Blue]
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: alpha1
+ label: Line 1 Alpha
+ category: Config
+ dtype: float
+ default: '1.0'
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: label2
+ label: Line 2 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: width2
+ label: Line 2 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: color2
+ label: Line 2 Color
+ dtype: ''
+ default: '"red"'
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: alpha2
+ label: Line 2 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: label3
+ label: Line 3 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: width3
+ label: Line 3 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: color3
+ label: Line 3 Color
+ dtype: ''
+ default: '"green"'
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: alpha3
+ label: Line 3 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: label4
+ label: Line 4 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: width4
+ label: Line 4 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: color4
+ label: Line 4 Color
+ dtype: ''
+ default: '"black"'
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: alpha4
+ label: Line 4 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: label5
+ label: Line 5 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: width5
+ label: Line 5 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: color5
+ label: Line 5 Color
+ dtype: ''
+ default: '"cyan"'
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: alpha5
+ label: Line 5 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: label6
+ label: Line 6 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: width6
+ label: Line 6 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: color6
+ label: Line 6 Color
+ dtype: ''
+ default: '"magenta"'
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: alpha6
+ label: Line 6 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: label7
+ label: Line 7 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: width7
+ label: Line 7 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: color7
+ label: Line 7 Color
+ dtype: ''
+ default: '"yellow"'
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: alpha7
+ label: Line 7 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: label8
+ label: Line 8 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: width8
+ label: Line 8 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: color8
+ label: Line 8 Color
+ dtype: ''
+ default: '"dark red"'
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: alpha8
+ label: Line 8 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: label9
+ label: Line 9 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: width9
+ label: Line 9 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: color9
+ label: Line 9 Color
+ dtype: ''
+ default: '"dark green"'
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: alpha9
+ label: Line 9 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: label10
+ label: Line 10 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: width10
+ label: Line 10 Width
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: color10
+ label: Line 10 Color
+ dtype: ''
+ default: '"dark blue"'
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: alpha10
+ label: Line 10 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+
+inputs:
+- domain: stream
+ dtype: float
+ vlen: ${ vlen }
+ multiplicity: ${ nconnections }
+
+outputs:
+- domain: message
+ id: xval
+ optional: true
+ hide: ${ showports }
+
+templates:
+ imports: |-
+ from PyQt5 import Qt
+ from gnuradio import qtgui
+ import sip
+ callbacks:
+ - set_update_time(${update_time})
+ - set_title(${title})
+ - set_color(${which}, ${color})
+ - set_x_axis(${x_start}, ${x_step})
+ - set_y_axis(${ymin}, ${ymax})
+ - set_ref_level(${ref_level})
+ - set_x_axis_units(${x_units})
+ - set_y_axis_units(${y_units})
+ make: |-
+ <%
+ win = 'self._%s_win'%id
+ %>\
+ qtgui.vector_sink_f(
+ ${vlen},
+ ${x_start},
+ ${x_step},
+ ${x_axis_label},
+ ${y_axis_label},
+ ${name},
+ ${nconnections} # Number of inputs
+ )
+ self.${id}.set_update_time(${update_time})
+ self.${id}.set_y_axis(${ymin}, ${ymax})
+ self.${id}.enable_autoscale(${autoscale})
+ self.${id}.enable_grid(${grid})
+ self.${id}.set_x_axis_units(${x_units})
+ self.${id}.set_y_axis_units(${y_units})
+ self.${id}.set_ref_level(${ref_level})
+
+ labels = [${label1}, ${label2}, ${label3}, ${label4}, ${label5},
+ ${label6}, ${label7}, ${label8}, ${label9}, ${label10}]
+ widths = [${width1}, ${width2}, ${width3}, ${width4}, ${width5},
+ ${width6}, ${width7}, ${width8}, ${width9}, ${width10}]
+ colors = [${color1}, ${color2}, ${color3}, ${color4}, ${color5},
+ ${color6}, ${color7}, ${color8}, ${color9}, ${color10}]
+ alphas = [${alpha1}, ${alpha2}, ${alpha3}, ${alpha4}, ${alpha5},
+ ${alpha6}, ${alpha7}, ${alpha8}, ${alpha9}, ${alpha10}]
+
+ for i in range(${nconnections}):
+ if len(labels[i]) == 0:
+ self.${id}.set_line_label(i, "Data {0}".format(i))
+ else:
+ self.${id}.set_line_label(i, labels[i])
+ self.${id}.set_line_width(i, widths[i])
+ self.${id}.set_line_color(i, colors[i])
+ self.${id}.set_line_alpha(i, alphas[i])
+
+ ${win} = sip.wrapinstance(self.${id}.pyqwidget(), Qt.QWidget)
+ ${gui_hint() % win}
+
+documentation: |-
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/gr-qtgui/grc/qtgui_vector_sink_f.xml b/gr-qtgui/grc/qtgui_vector_sink_f.xml
deleted file mode 100644
index 0f456323b..000000000
--- a/gr-qtgui/grc/qtgui_vector_sink_f.xml
+++ /dev/null
@@ -1,603 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##QT GUI Sink
-###################################################
- -->
-<block>
- <name>QT GUI Vector Sink</name>
- <key>qtgui_vector_sink_f</key>
- <import>from PyQt5 import Qt</import>
- <import>from gnuradio import qtgui</import>
- <import>import sip</import>
- <make>#set $win = 'self._%s_win'%$id
-qtgui.vector_sink_f(
- $vlen,
- $x_start,
- $x_step,
- $x_axis_label,
- $y_axis_label,
- $name,
- $nconnections \# Number of inputs
-)
-self.$(id).set_update_time($update_time)
-self.$(id).set_y_axis($ymin, $ymax)
-self.$(id).enable_autoscale($autoscale)
-self.$(id).enable_grid($grid)
-self.$(id).set_x_axis_units($x_units)
-self.$(id).set_y_axis_units($y_units)
-self.$(id).set_ref_level($ref_level)
-
-labels = [$label1, $label2, $label3, $label4, $label5,
- $label6, $label7, $label8, $label9, $label10]
-widths = [$width1, $width2, $width3, $width4, $width5,
- $width6, $width7, $width8, $width9, $width10]
-colors = [$color1, $color2, $color3, $color4, $color5,
- $color6, $color7, $color8, $color9, $color10]
-alphas = [$alpha1, $alpha2, $alpha3, $alpha4, $alpha5,
- $alpha6, $alpha7, $alpha8, $alpha9, $alpha10]
-for i in xrange($nconnections):
- if len(labels[i]) == 0:
- self.$(id).set_line_label(i, "Data {0}".format(i))
- else:
- self.$(id).set_line_label(i, labels[i])
- self.$(id).set_line_width(i, widths[i])
- self.$(id).set_line_color(i, colors[i])
- self.$(id).set_line_alpha(i, alphas[i])
-
-self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
-$(gui_hint()($win))</make>
- <callback>set_update_time($update_time)</callback>
- <callback>set_title($title)</callback>
- <callback>set_color($which, $color)</callback>
- <callback>set_x_axis($x_start, $x_step)</callback>
- <callback>set_y_axis($ymin, $ymax)</callback>
- <callback>set_ref_level($ref_level)</callback>
- <callback>set_x_axis_units($x_units)</callback>
- <callback>set_y_axis_units($y_units)</callback>
-
- <param_tab_order>
- <tab>General</tab>
- <tab>Config</tab>
- </param_tab_order>
-
- <param>
- <name>Name</name>
- <key>name</key>
- <value>""</value>
- <type>string</type>
- <hide>#if len($name()) > 0 then 'none' else 'part'#</hide>
- </param>
-
- <param>
- <name>Vector Size</name>
- <key>vlen</key>
- <value>1024</value>
- <type>int</type>
- </param>
-
- <param>
- <name>X-Axis Start Value</name>
- <key>x_start</key>
- <value>0</value>
- <type>real</type>
- </param>
-
- <param>
- <name>X-Axis Step Value</name>
- <key>x_step</key>
- <value>1.0</value>
- <type>real</type>
- </param>
-
- <param>
- <name>X-Axis Label</name>
- <key>x_axis_label</key>
- <value>"x-Axis"</value>
- <type>string</type>
- <hide>#if (len($x_axis_label()) > 0 and $x_axis_label != "x-Axis") then 'none' else 'part'#</hide>
- </param>
-
- <param>
- <name>Y-Axis Label</name>
- <key>y_axis_label</key>
- <value>"y-Axis"</value>
- <type>string</type>
- <hide>#if (len($y_axis_label()) > 0 and $y_axis_label != "y-Axis") then 'none' else 'part'#</hide>
- </param>
-
- <param>
- <name>X-Axis Units</name>
- <key>x_units</key>
- <value>""</value>
- <type>string</type>
- <hide>'part'</hide>
- </param>
-
- <param>
- <name>Y-Axis Units</name>
- <key>y_units</key>
- <value>""</value>
- <type>string</type>
- <hide>'part'</hide>
- </param>
-
- <param>
- <name>Ref Level</name>
- <key>ref_level</key>
- <value>0</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Grid</name>
- <key>grid</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Autoscale</name>
- <key>autoscale</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Average</name>
- <key>average</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>None</name>
- <key>1.0</key>
- </option>
- <option>
- <name>Low</name>
- <key>0.2</key>
- </option>
- <option>
- <name>Medium</name>
- <key>0.1</key>
- </option>
- <option>
- <name>High</name>
- <key>0.05</key>
- </option>
- </param>
-
- <param>
- <name>Y min</name>
- <key>ymin</key>
- <value>-140</value>
- <type>real</type>
- <hide>part</hide>
- </param>
- <param>
- <name>Y max</name>
- <key>ymax</key>
- <value>10</value>
- <type>real</type>
- <hide>part</hide>
- </param>
- <param>
- <name>Number of Inputs</name>
- <key>nconnections</key>
- <value>1</value>
- <type>int</type>
- <hide>part</hide>
- </param>
- <param>
- <name>Update Period</name>
- <key>update_time</key>
- <value>0.10</value>
- <type>real</type>
- <hide>part</hide>
- </param>
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Show Msg Ports</name>
- <key>showports</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>False</key>
- </option>
- <option>
- <name>No</name>
- <key>True</key>
- </option>
- </param>
-
- <param>
- <name>Line 1 Label</name>
- <key>label1</key>
- <type>string</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Width</name>
- <key>width1</key>
- <value>1</value>
- <type>int</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Color</name>
- <key>color1</key>
- <type>enum</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <option>
- <name>Blue</name>
- <key>"blue"</key>
- </option>
- <option>
- <name>Red</name>
- <key>"red"</key>
- </option>
- <option>
- <name>Green</name>
- <key>"green"</key>
- </option>
- <option>
- <name>Black</name>
- <key>"black"</key>
- </option>
- <option>
- <name>Cyan</name>
- <key>"cyan"</key>
- </option>
- <option>
- <name>Magenta</name>
- <key>"magenta"</key>
- </option>
- <option>
- <name>Yellow</name>
- <key>"yellow"</key>
- </option>
- <option>
- <name>Dark Red</name>
- <key>"dark red"</key>
- </option>
- <option>
- <name>Dark Green</name>
- <key>"dark green"</key>
- </option>
- <option>
- <name>Dark Blue</name>
- <key>"dark blue"</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Alpha</name>
- <key>alpha1</key>
- <value>1.0</value>
- <type>float</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 2 Label</name>
- <key>label2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 2 Width</name>
- <key>width2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 2 Color</name>
- <key>color2</key>
- <value>"red"</value>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 2 Alpha</name>
- <key>alpha2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 3 Label</name>
- <key>label3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 3 Width</name>
- <key>width3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 3 Color</name>
- <key>color3</key>
- <value>"green"</value>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 3 Alpha</name>
- <key>alpha3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 4 Label</name>
- <key>label4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 4 Width</name>
- <key>width4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 4 Color</name>
- <key>color4</key>
- <value>"black"</value>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 4 Alpha</name>
- <key>alpha4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 5 Label</name>
- <key>label5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 5 Width</name>
- <key>width5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 5 Color</name>
- <key>color5</key>
- <value>"cyan"</value>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 5 Alpha</name>
- <key>alpha5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 6 Label</name>
- <key>label6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 6 Width</name>
- <key>width6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 6 Color</name>
- <key>color6</key>
- <value>"magenta"</value>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 6 Alpha</name>
- <key>alpha6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 7 Label</name>
- <key>label7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 7 Width</name>
- <key>width7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 7 Color</name>
- <key>color7</key>
- <value>"yellow"</value>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 7 Alpha</name>
- <key>alpha7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 8 Label</name>
- <key>label8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 8 Width</name>
- <key>width8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 8 Color</name>
- <key>color8</key>
- <value>"dark red"</value>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 8 Alpha</name>
- <key>alpha8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 9 Label</name>
- <key>label9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 9 Width</name>
- <key>width9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 9 Color</name>
- <key>color9</key>
- <value>"dark green"</value>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 9 Alpha</name>
- <key>alpha9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 10 Label</name>
- <key>label10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>width1</base_key>
- <name>Line 10 Width</name>
- <key>width10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 10 Color</name>
- <key>color10</key>
- <value>"dark blue"</value>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 10 Alpha</name>
- <key>alpha10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <sink>
- <name>in</name>
- <type>float</type>
- <vlen>$vlen</vlen>
- <nports>$nconnections</nports>
- </sink>
-
- <source>
- <name>xval</name>
- <type>message</type>
- <optional>1</optional>
- <hide>$showports</hide>
- </source>
-
- <doc>
-The GUI hint can be used to position the widget within the application. \
-The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
-Both the tab specification and the grid position are optional.
- </doc>
-</block>
diff --git a/gr-qtgui/grc/qtgui_waterfall_sink_x.block.yml b/gr-qtgui/grc/qtgui_waterfall_sink_x.block.yml
new file mode 100644
index 000000000..45fc6c41f
--- /dev/null
+++ b/gr-qtgui/grc/qtgui_waterfall_sink_x.block.yml
@@ -0,0 +1,303 @@
+id: qtgui_waterfall_sink_x
+label: QT GUI Waterfall Sink
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ default: complex
+ options: [complex, float, msg_complex, msg_float]
+ option_labels: [Complex, Float, Complex Message, Float Message]
+ option_attributes:
+ fcn: [waterfall_sink_c, waterfall_sink_f, waterfall_sink_c, waterfall_sink_f]
+ t: [complex, float, message, message]
+ hide: part
+- id: name
+ label: Name
+ dtype: string
+ default: '""'
+ hide: ${ ('none' if len(name) > 0 else 'part') }
+- id: fftsize
+ label: FFT Size
+ dtype: int
+ default: '1024'
+ hide: ${ ('all' if type.startswith('msg') else 'none') }
+- id: freqhalf
+ label: Spectrum Width
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: [Full, Half]
+ hide: ${ ('part' if type == "float" or type == "msg_float" else 'all') }
+- id: wintype
+ label: Window Type
+ dtype: int
+ default: firdes.WIN_BLACKMAN_hARRIS
+ options: [firdes.WIN_BLACKMAN_hARRIS, firdes.WIN_HAMMING, firdes.WIN_HANN, firdes.WIN_BLACKMAN,
+ firdes.WIN_RECTANGULAR, firdes.WIN_KAISER, firdes.WIN_FLATTOP]
+ option_labels: [Blackman-harris, Hamming, Hann, Blackman, Rectangular, Kaiser,
+ Flat-top]
+ hide: part
+- id: fc
+ label: Center Frequency (Hz)
+ dtype: real
+ default: '0'
+- id: bw
+ label: Bandwidth (Hz)
+ dtype: real
+ default: samp_rate
+- id: int_min
+ label: Intensity Min
+ dtype: float
+ default: '-140'
+ hide: part
+- id: int_max
+ label: Intensity Max
+ dtype: float
+ default: '10'
+ hide: part
+- id: grid
+ label: Grid
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: nconnections
+ label: Number of Inputs
+ dtype: int
+ default: '1'
+ hide: ${ ('all' if type.startswith('msg') else 'part') }
+- id: update_time
+ label: Update Period
+ dtype: real
+ default: '0.10'
+ hide: part
+- id: gui_hint
+ label: GUI Hint
+ dtype: gui_hint
+ hide: part
+- id: showports
+ label: Show Msg Ports
+ dtype: enum
+ default: 'True'
+ options: ['False', 'True']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: legend
+ label: Legend
+ category: Config
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: label1
+ label: Line 1 Label
+ category: Config
+ dtype: string
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: axislabels
+ label: Axis Labels
+ category: Config
+ dtype: enum
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+ hide: part
+- id: color1
+ label: Line 1 Color
+ category: Config
+ dtype: enum
+ options: ['0', '1', '2', '3', '5', '6']
+ option_labels: [Multi Color, White Hot, Black Hot, Incandescent, Sunset, Cool]
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: alpha1
+ label: Line 1 Alpha
+ category: Config
+ dtype: float
+ default: '1.0'
+ hide: ${ ('part' if int(nconnections) >= 1 else 'all') }
+- id: label2
+ label: Line 2 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: color2
+ label: Line 2 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: alpha2
+ label: Line 2 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 2 else 'all') }
+- id: label3
+ label: Line 3 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: color3
+ label: Line 3 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: alpha3
+ label: Line 3 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 3 else 'all') }
+- id: label4
+ label: Line 4 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: color4
+ label: Line 4 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: alpha4
+ label: Line 4 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 4 else 'all') }
+- id: label5
+ label: Line 5 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: color5
+ label: Line 5 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: alpha5
+ label: Line 5 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 5 else 'all') }
+- id: label6
+ label: Line 6 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: color6
+ label: Line 6 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: alpha6
+ label: Line 6 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 6 else 'all') }
+- id: label7
+ label: Line 7 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: color7
+ label: Line 7 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: alpha7
+ label: Line 7 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 7 else 'all') }
+- id: label8
+ label: Line 8 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: color8
+ label: Line 8 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: alpha8
+ label: Line 8 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 8 else 'all') }
+- id: label9
+ label: Line 9 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: color9
+ label: Line 9 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: alpha9
+ label: Line 9 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 9 else 'all') }
+- id: label10
+ label: Line 10 Label
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: color10
+ label: Line 10 Color
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+- id: alpha10
+ label: Line 10 Alpha
+ dtype: ''
+ hide: ${ ('part' if int(nconnections) >= 10 else 'all') }
+
+inputs:
+- domain: stream
+ dtype: ${ type.t }
+ multiplicity: ${ (0 if type.startswith('msg') else nconnections) }
+ optional: true
+- domain: message
+ id: freq
+ optional: true
+ hide: ${ showports }
+
+outputs:
+- domain: message
+ id: freq
+ optional: true
+ hide: ${ showports }
+
+templates:
+ imports: |-
+ from PyQt5 import Qt
+ from gnuradio import qtgui
+ from gnuradio.filter import firdes
+ import sip
+ callbacks:
+ - set_frequency_range(${fc}, ${bw})
+ - set_update_time(${update_time})
+ - set_title(${which}, ${title})
+ - set_color(${which}, ${color})
+ - set_intensity_range(${int_min}, ${int_max})
+ make: |-
+ <%
+ win = 'self._%s_win'%id
+ %>\
+ qtgui.${type.fcn}(
+ ${fftsize}, #size
+ ${wintype}, #wintype
+ ${fc}, #fc
+ ${bw}, #bw
+ ${name}, #name
+ ${ (0 if type.startswith('msg') else nconnections) } #number of inputs
+ )
+ self.${id}.set_update_time(${update_time})
+ self.${id}.enable_grid(${grid})
+ self.${id}.enable_axis_labels(${axislabels})
+
+ if not ${legend}:
+ self.${id}.disable_legend()
+
+ if "${type}" == "float" or "${type}" == "msg_float":
+ self.${id}.set_plot_pos_half(not ${freqhalf})
+
+ labels = [${label1}, ${label2}, ${label3}, ${label4}, ${label5},
+ ${label6}, ${label7}, ${label8}, ${label9}, ${label10}]
+ colors = [${color1}, ${color2}, ${color3}, ${color4}, ${color5},
+ ${color6}, ${color7}, ${color8}, ${color9}, ${color10}]
+ alphas = [${alpha1}, ${alpha2}, ${alpha3}, ${alpha4}, ${alpha5},
+ ${alpha6}, ${alpha7}, ${alpha8}, ${alpha9}, ${alpha10}]
+
+ for i in range(${1 if type.startswith('msg') else nconnections}):
+ if len(labels[i]) == 0:
+ self.${id}.set_line_label(i, "Data {0}".format(i))
+ else:
+ self.${id}.set_line_label(i, labels[i])
+ self.${id}.set_color_map(i, colors[i])
+ self.${id}.set_line_alpha(i, alphas[i])
+
+ self.${id}.set_intensity_range(${int_min}, ${int_max})
+
+ ${win} = sip.wrapinstance(self.${id}.pyqwidget(), Qt.QWidget)
+ ${gui_hint() % win}
+
+documentation: |-
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/gr-qtgui/grc/qtgui_waterfall_sink_x.xml b/gr-qtgui/grc/qtgui_waterfall_sink_x.xml
deleted file mode 100644
index a68449224..000000000
--- a/gr-qtgui/grc/qtgui_waterfall_sink_x.xml
+++ /dev/null
@@ -1,557 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##QT GUI Sink
-###################################################
- -->
-<block>
- <name>QT GUI Waterfall Sink</name>
- <key>qtgui_waterfall_sink_x</key>
- <import>from PyQt5 import Qt</import>
- <import>from gnuradio import qtgui</import>
- <import>from gnuradio.filter import firdes</import>
- <import>import sip</import>
- <make>#set $win = 'self._%s_win'%$id
-qtgui.$(type.fcn)(
- $fftsize, \#size
- $wintype, \#wintype
- $fc, \#fc
- $bw, \#bw
- $name, \#name
- #if $type.t == 'message' then 0 else $nconnections# \#number of inputs
-)
-self.$(id).set_update_time($update_time)
-self.$(id).enable_grid($grid)
-self.$(id).enable_axis_labels($axislabels)
-
-if not $legend:
- self.$(id).disable_legend()
-
-if "$type" == "float" or "$type" == "msg_float":
- self.$(id).set_plot_pos_half(not $freqhalf)
-
-labels = [$label1, $label2, $label3, $label4, $label5,
- $label6, $label7, $label8, $label9, $label10]
-colors = [$color1, $color2, $color3, $color4, $color5,
- $color6, $color7, $color8, $color9, $color10]
-alphas = [$alpha1, $alpha2, $alpha3, $alpha4, $alpha5,
- $alpha6, $alpha7, $alpha8, $alpha9, $alpha10]
-for i in xrange(#if $type.t == 'message' then 1 else $nconnections#):
- if len(labels[i]) == 0:
- self.$(id).set_line_label(i, "Data {0}".format(i))
- else:
- self.$(id).set_line_label(i, labels[i])
- self.$(id).set_color_map(i, colors[i])
- self.$(id).set_line_alpha(i, alphas[i])
-
-self.$(id).set_intensity_range($int_min, $int_max)
-
-self._$(id)_win = sip.wrapinstance(self.$(id).pyqwidget(), Qt.QWidget)
-$(gui_hint()($win))</make>
- <callback>set_frequency_range($fc, $bw)</callback>
- <callback>set_update_time($update_time)</callback>
- <callback>set_title($which, $title)</callback>
- <callback>set_color($which, $color)</callback>
- <callback>set_intensity_range($int_min, $int_max)</callback>
-
- <param_tab_order>
- <tab>General</tab>
- <tab>Config</tab>
- </param_tab_order>
-
- <param>
- <name>Type</name>
- <key>type</key>
- <value>complex</value>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>fcn:waterfall_sink_c</opt>
- <opt>t:complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>fcn:waterfall_sink_f</opt>
- <opt>t:float</opt>
- </option>
- <option>
- <name>Complex Message</name>
- <key>msg_complex</key>
- <opt>fcn:waterfall_sink_c</opt>
- <opt>t:message</opt>
- </option>
- <option>
- <name>Float Message</name>
- <key>msg_float</key>
- <opt>fcn:waterfall_sink_f</opt>
- <opt>t:message</opt>
- </option>
- </param>
-
- <param>
- <name>Name</name>
- <key>name</key>
- <value>""</value>
- <type>string</type>
- <hide>#if len($name()) > 0 then 'none' else 'part'#</hide>
- </param>
-
- <param>
- <name>FFT Size</name>
- <key>fftsize</key>
- <value>1024</value>
- <type>int</type>
- <hide>#if $type.t == 'message' then 'all' else 'none'#</hide>
- </param>
-
- <param>
- <name>Spectrum Width</name>
- <key>freqhalf</key>
- <value>True</value>
- <type>enum</type>
- <hide>#if $type() == "float" or $type() == "msg_float" then 'part' else 'all'#</hide>
- <option>
- <name>Full</name>
- <key>True</key>
- </option>
- <option>
- <name>Half</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Window Type</name>
- <key>wintype</key>
- <value>firdes.WIN_BLACKMAN_hARRIS</value>
- <type>int</type>
- <hide>part</hide>
- <option>
- <name>Blackman-harris</name>
- <key>firdes.WIN_BLACKMAN_hARRIS</key>
- </option>
- <option>
- <name>Hamming</name>
- <key>firdes.WIN_HAMMING</key>
- </option>
- <option>
- <name>Hann</name>
- <key>firdes.WIN_HANN</key>
- </option>
- <option>
- <name>Blackman</name>
- <key>firdes.WIN_BLACKMAN</key>
- </option>
- <option>
- <name>Rectangular</name>
- <key>firdes.WIN_RECTANGULAR</key>
- </option>
- <option>
- <name>Kaiser</name>
- <key>firdes.WIN_KAISER</key>
- </option>
- <option>
- <name>Flat-top</name>
- <key>firdes.WIN_FLATTOP</key>
- </option>
- </param>
-
- <param>
- <name>Center Frequency (Hz)</name>
- <key>fc</key>
- <value>0</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Bandwidth (Hz)</name>
- <key>bw</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
-
- <param>
- <name>Intensity Min</name>
- <key>int_min</key>
- <value>-140</value>
- <type>float</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Intensity Max</name>
- <key>int_max</key>
- <value>10</value>
- <type>float</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Grid</name>
- <key>grid</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>Number of Inputs</name>
- <key>nconnections</key>
- <value>1</value>
- <type>int</type>
- <hide>#if $type.t == 'message' then 'all' else 'part'#</hide>
- </param>
-
- <param>
- <name>Update Period</name>
- <key>update_time</key>
- <value>0.10</value>
- <type>real</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>GUI Hint</name>
- <key>gui_hint</key>
- <value></value>
- <type>gui_hint</type>
- <hide>part</hide>
- </param>
-
- <param>
- <name>Show Msg Ports</name>
- <key>showports</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>False</key>
- </option>
- <option>
- <name>No</name>
- <key>True</key>
- </option>
- </param>
-
-
- <!-- Begin Config Tab items -->
- <param>
- <name>Legend</name>
- <key>legend</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Label</name>
- <key>label1</key>
- <type>string</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Axis Labels</name>
- <key>axislabels</key>
- <value>True</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Color</name>
- <key>color1</key>
- <type>enum</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <option>
- <name>Multi Color</name>
- <key>0</key>
- </option>
- <option>
- <name>White Hot</name>
- <key>1</key>
- </option>
- <option>
- <name>Black Hot</name>
- <key>2</key>
- </option>
- <option>
- <name>Incandescent</name>
- <key>3</key>
- </option>
- <option>
- <name>Sunset</name>
- <key>5</key>
- </option>
- <option>
- <name>Cool</name>
- <key>6</key>
- </option>
- <tab>Config</tab>
- </param>
-
- <param>
- <name>Line 1 Alpha</name>
- <key>alpha1</key>
- <value>1.0</value>
- <type>float</type>
- <hide>#if int($nconnections()) >= 1 then 'part' else 'all'#</hide>
- <tab>Config</tab>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 2 Label</name>
- <key>label2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 2 Color</name>
- <key>color2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 2 Alpha</name>
- <key>alpha2</key>
- <hide>#if int($nconnections()) >= 2 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 3 Label</name>
- <key>label3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 3 Color</name>
- <key>color3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 3 Alpha</name>
- <key>alpha3</key>
- <hide>#if int($nconnections()) >= 3 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 4 Label</name>
- <key>label4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 4 Color</name>
- <key>color4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 4 Alpha</name>
- <key>alpha4</key>
- <hide>#if int($nconnections()) >= 4 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 5 Label</name>
- <key>label5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 5 Color</name>
- <key>color5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 5 Alpha</name>
- <key>alpha5</key>
- <hide>#if int($nconnections()) >= 5 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 6 Label</name>
- <key>label6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 6 Color</name>
- <key>color6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 6 Alpha</name>
- <key>alpha6</key>
- <hide>#if int($nconnections()) >= 6 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 7 Label</name>
- <key>label7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 7 Color</name>
- <key>color7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 7 Alpha</name>
- <key>alpha7</key>
- <hide>#if int($nconnections()) >= 7 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 8 Label</name>
- <key>label8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 8 Color</name>
- <key>color8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 8 Alpha</name>
- <key>alpha8</key>
- <hide>#if int($nconnections()) >= 8 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 9 Label</name>
- <key>label9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 9 Color</name>
- <key>color9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 9 Alpha</name>
- <key>alpha9</key>
- <hide>#if int($nconnections()) >= 9 then 'part' else 'all'#</hide>
- </param>
-
-
- <param>
- <base_key>label1</base_key>
- <name>Line 10 Label</name>
- <key>label10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>color1</base_key>
- <name>Line 10 Color</name>
- <key>color10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
- <param>
- <base_key>alpha1</base_key>
- <name>Line 10 Alpha</name>
- <key>alpha10</key>
- <hide>#if int($nconnections()) >= 10 then 'part' else 'all'#</hide>
- </param>
-
-
- <sink>
- <name>in</name>
- <type>$type.t</type>
- <nports>#if $type.t == 'message' then 0 else $nconnections#</nports>
- <optional>1</optional>
- </sink>
-
- <sink>
- <name>freq</name>
- <type>message</type>
- <optional>1</optional>
- <hide>$showports</hide>
- </sink>
-
- <source>
- <name>freq</name>
- <type>message</type>
- <optional>1</optional>
- <hide>$showports</hide>
- </source>
-
- <doc>
-The GUI hint can be used to position the widget within the application. \
-The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
-Both the tab specification and the grid position are optional.
- </doc>
-</block>
diff --git a/gr-qtgui/python/qtgui/CMakeLists.txt b/gr-qtgui/python/qtgui/CMakeLists.txt
index 5df3a7d91..f3fc70351 100644
--- a/gr-qtgui/python/qtgui/CMakeLists.txt
+++ b/gr-qtgui/python/qtgui/CMakeLists.txt
@@ -51,6 +51,6 @@ if(ENABLE_TESTING)
file(GLOB py_qa_test_files "qa_*.py")
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gr-qtgui/python/qtgui/__init__.py b/gr-qtgui/python/qtgui/__init__.py
index 8b60dc6db..c5527410a 100644
--- a/gr-qtgui/python/qtgui/__init__.py
+++ b/gr-qtgui/python/qtgui/__init__.py
@@ -22,17 +22,18 @@
'''
Provides a GUI interface using the QT backend.
'''
+from __future__ import unicode_literals
# The presence of this file turns this directory into a Python package
import os
try:
- from qtgui_swig import *
+ from .qtgui_swig import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
- from qtgui_swig import *
+ from .qtgui_swig import *
-from range import Range, RangeWidget
-import util
+from .range import Range, RangeWidget
+from . import util
diff --git a/gr-qtgui/python/qtgui/qa_qtgui.py b/gr-qtgui/python/qtgui/qa_qtgui.py
index d98cf1fc2..e46301071 100755..100644
--- a/gr-qtgui/python/qtgui/qa_qtgui.py
+++ b/gr-qtgui/python/qtgui/qa_qtgui.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, qtgui
class test_qtgui(gr_unittest.TestCase):
diff --git a/gr-qtgui/python/qtgui/range.py.cmakein b/gr-qtgui/python/qtgui/range.py.cmakein
index 9ed770619..70d004538 100755
--- a/gr-qtgui/python/qtgui/range.py.cmakein
+++ b/gr-qtgui/python/qtgui/range.py.cmakein
@@ -22,7 +22,7 @@
#
@PY_QT_IMPORT@
-import util
+from .util import check_set_qss
class Range(object):
def __init__(self, minv, maxv, step, default, min_length):
@@ -33,7 +33,7 @@ class Range(object):
self.min_length = min_length
self.find_precision()
self.find_nsteps()
- util.check_set_qss()
+ check_set_qss()
def find_precision(self):
# Get the decimal part of the step
diff --git a/gr-qtgui/python/qtgui/util.py.cmakein b/gr-qtgui/python/qtgui/util.py.cmakein
index ec654d9ba..4014fc1db 100644
--- a/gr-qtgui/python/qtgui/util.py.cmakein
+++ b/gr-qtgui/python/qtgui/util.py.cmakein
@@ -21,7 +21,10 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+
@PY_QT_IMPORT@
+
from gnuradio import gr
def check_set_qss():
@@ -31,4 +34,4 @@ def check_set_qss():
try:
app.setStyleSheet(open(qssfile).read())
except:
- print "WARNING: bad QSS file, %s"%(qssfile)
+ print("WARNING: bad QSS file, %s"%(qssfile))
diff --git a/gr-trellis/docs/make_numbered_listing.py b/gr-trellis/docs/make_numbered_listing.py
index c295dc876..09a82cfaa 100755..100644
--- a/gr-trellis/docs/make_numbered_listing.py
+++ b/gr-trellis/docs/make_numbered_listing.py
@@ -1,5 +1,6 @@
#!/usr/bin/env python
+from __future__ import unicode_literals
import sys
import os, os.path
from optparse import OptionParser
diff --git a/gr-trellis/docs/test_tcm.py b/gr-trellis/docs/test_tcm.py
index 61ab00f1c..e9a0ba59e 100644
--- a/gr-trellis/docs/test_tcm.py
+++ b/gr-trellis/docs/test_tcm.py
@@ -1,5 +1,8 @@
#!/usr/bin/env python
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio import trellis, digital, blocks
@@ -20,14 +23,14 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
# TX
src = blocks.lfsr_32k_source_s()
- src_head = blocks.head (gr.sizeof_short,Kb/16) # packet size in shorts
+ src_head = blocks.head (gr.sizeof_short,Kb / 16) # packet size in shorts
s2fsmi = blocks.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality
enc = trellis.encoder_ss(f,0) # initial state = 0
mod = digital.chunks_to_symbols_sf(constellation,dimensionality)
# CHANNEL
add = blocks.add_ff()
- noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed)
+ noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0 / 2),seed)
# RX
metrics = trellis.metrics_f(f.O(),dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # data preprocessing to generate metrics for Viterbi
@@ -67,31 +70,31 @@ def main(args):
# system parameters
f=trellis.fsm(fname) # get the FSM specification from a file
Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short)
- bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol
- K=Kb/bitspersymbol # packet size in trellis steps
+ bitspersymbol = int(round(math.log(f.I()) / math.log(2))) # bits per FSM input symbol
+ K=Kb / bitspersymbol # packet size in trellis steps
modulation = fsm_utils.psk4 # see fsm_utlis.py for available predefined modulations
dimensionality = modulation[0]
constellation = modulation[1]
- if len(constellation)/dimensionality != f.O():
+ if len(constellation) / dimensionality != f.O():
sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n')
sys.exit (1)
# calculate average symbol energy
Es = 0
for i in range(len(constellation)):
Es = Es + constellation[i]**2
- Es = Es / (len(constellation)/dimensionality)
- N0=Es/pow(10.0,esn0_db/10.0); # noise variance
+ Es = Es / (old_div(len(constellation,dimensionality)))
+ N0=Es / pow(10.0,old_div(esn0_db,10.0)); # noise variance
tot_s=0
terr_s=0
for i in range(rep):
- (s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-long(666+i)) # run experiment with different seed to get different noise realizations
+ (s,e)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,N0,-int(666+i)) # run experiment with different seed to get different noise realizations
tot_s=tot_s+s
terr_s=terr_s+e
if (i%100==0):
- print i,s,e,tot_s,terr_s, '%e' % ((1.0*terr_s)/tot_s)
+ print(i,s,e,tot_s,terr_s, '%e' % ((1.0*terr_s) / tot_s))
# estimate of the (short) error rate
- print tot_s,terr_s, '%e' % ((1.0*terr_s)/tot_s)
+ print(tot_s,terr_s, '%e' % ((1.0*terr_s) / tot_s))
if __name__ == '__main__':
diff --git a/gr-trellis/docs/test_viterbi_equalization1.py b/gr-trellis/docs/test_viterbi_equalization1.py
index c1a831d0b..95cb119ed 100755..100644
--- a/gr-trellis/docs/test_viterbi_equalization1.py
+++ b/gr-trellis/docs/test_viterbi_equalization1.py
@@ -1,5 +1,8 @@
#!/usr/bin/env python
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio import trellis, digital, filter, blocks
@@ -34,7 +37,7 @@ def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constel
# CHANNEL
isi = filter.fir_filter_fff(1,channel)
add = blocks.add_ff()
- noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed)
+ noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0 / 2),seed)
# RX
skip = blocks.skiphead(gr.sizeof_float, L) # skip the first L samples since you know they are coming from the L zero symbols
@@ -78,14 +81,14 @@ def main(args):
modulation = fsm_utils.pam4 # see fsm_utlis.py for available predefined modulations
channel = fsm_utils.c_channel # see fsm_utlis.py for available predefined test channels
f=trellis.fsm(len(modulation[1]),len(channel)) # generate the FSM automatically
- bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol
- K=Kb/bitspersymbol # packet size in trellis steps
+ bitspersymbol = int(round(math.log(f.I()) / math.log(2))) # bits per FSM input symbol
+ K=Kb / bitspersymbol # packet size in trellis steps
tot_channel = fsm_utils.make_isi_lookup(modulation,channel,True) # generate the lookup table (normalize energy to 1)
dimensionality = tot_channel[0]
tot_constellation = tot_channel[1]
- N0=pow(10.0,-esn0_db/10.0); # noise variance
- if len(tot_constellation)/dimensionality != f.O():
+ N0=pow(10.0,-esn0_db / 10.0); # noise variance
+ if len(tot_constellation) / dimensionality != f.O():
sys.stderr.write ('Incompatible FSM output cardinality and lookup table size.\n')
sys.exit (1)
@@ -94,14 +97,14 @@ def main(args):
terr_p=0 # total number of packets in error
for i in range(rep):
- (s,e)=run_test(f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,N0,-long(666+i)) # run experiment with different seed to get different data and noise realizations
+ (s,e)=run_test(f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constellation,N0,-int(666+i)) # run experiment with different seed to get different data and noise realizations
tot_s=tot_s+s
terr_s=terr_s+e
terr_p=terr_p+(terr_s!=0)
if ((i+1)%100==0) : # display progress
- print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s)
+ print(i+1,terr_p, '%.2e' % ((1.0*terr_p) / (i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s) / tot_s))
# estimate of the (short or symbol) error rate
- print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s)/tot_s)
+ print(rep,terr_p, '%.2e' % ((1.0*terr_p) / (i+1)),tot_s,terr_s, '%.2e' % ((1.0*terr_s) / tot_s))
if __name__ == '__main__':
diff --git a/gr-trellis/examples/python/test_tcm.py b/gr-trellis/examples/python/test_tcm.py
index dfc565616..e2eb87fcd 100755..100644
--- a/gr-trellis/examples/python/test_tcm.py
+++ b/gr-trellis/examples/python/test_tcm.py
@@ -1,5 +1,8 @@
#!/usr/bin/env python
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import trellis, digital, blocks
from gnuradio import eng_notation
@@ -33,7 +36,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
# CHANNEL
add = blocks.add_ff()
- noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0/2),long(seed))
+ noise = analog.noise_source_f(analog.GR_GAUSSIAN,math.sqrt(N0 / 2),int(seed))
# RX
va = trellis.viterbi_combined_fs(f,K,0,0,dimensionality,constellation,digital.TRELLIS_EUCLIDEAN) # Put -1 if the Initial/Final states are not set.
@@ -56,7 +59,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed):
#print "final state = " , enc.ST()
if len(dst.data()) != len(packet):
- print "Error: not enough data:", len(dst.data()), len(packet)
+ print("Error: not enough data:", len(dst.data()), len(packet))
ntotal=len(packet)
nwrong = sum(abs(packet-numpy.array(dst.data())));
return (ntotal,nwrong,abs(packet-numpy.array(dst.data())))
@@ -73,7 +76,7 @@ def main():
(options, args) = parser.parse_args ()
if len(args) != 0:
parser.print_help()
- raise SystemExit, 1
+ raise SystemExit(1)
fname=options.fsm_file
esn0_db=float(options.esn0)
@@ -84,20 +87,20 @@ def main():
# alternatively you can specify the fsm from its generator matrix
#f=trellis.fsm(1,2,[5,7])
Kb=1024*16 # packet size in bits (make it multiple of 16 so it can be packed in a short)
- bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol
- K=Kb/bitspersymbol # packet size in trellis steps
+ bitspersymbol = int(round(math.log(f.I()) / math.log(2))) # bits per FSM input symbol
+ K=Kb / bitspersymbol # packet size in trellis steps
modulation = fsm_utils.psk4 # see fsm_utlis.py for available predefined modulations
dimensionality = modulation[0]
constellation = modulation[1]
- if len(constellation)/dimensionality != f.O():
+ if len(constellation) / dimensionality != f.O():
sys.stderr.write ('Incompatible FSM output cardinality and modulation size.\n')
sys.exit (1)
# calculate average symbol energy
Es = 0
for i in range(len(constellation)):
Es = Es + constellation[i]**2
- Es = Es / (len(constellation)/dimensionality)
- N0=Es/pow(10.0,esn0_db/10.0); # calculate noise variance
+ Es = Es / (old_div(len(constellation,dimensionality)))
+ N0=Es / pow(10.0,old_div(esn0_db,10.0)); # calculate noise variance
tot_b=0 # total number of transmitted bits
terr_b=0 # total number of bits in error
@@ -108,14 +111,14 @@ def main():
terr_b=terr_b+e
terr_p=terr_p+(e!=0)
if ((i+1)%100==0) : # display progress
- print i+1,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_b,terr_b, '%.2e' % ((1.0*terr_b)/tot_b)
+ print(i+1,terr_p, '%.2e' % ((1.0*terr_p) / (i+1)),tot_b,terr_b, '%.2e' % ((1.0*terr_b) / tot_b))
if e!=0:
- print "rep=",i, e
+ print("rep=",i, e)
for k in range(Kb):
if pattern[k]!=0:
- print k
+ print(k)
# estimate of the bit error rate
- print rep,terr_p, '%.2e' % ((1.0*terr_p)/(i+1)),tot_b,terr_b, '%.2e' % ((1.0*terr_b)/tot_b)
+ print(rep,terr_p, '%.2e' % ((1.0*terr_p) / (i+1)),tot_b,terr_b, '%.2e' % ((1.0*terr_b) / tot_b))
diff --git a/gr-trellis/grc/CMakeLists.txt b/gr-trellis/grc/CMakeLists.txt
index 9fbadd50d..f727da92d 100644
--- a/gr-trellis/grc/CMakeLists.txt
+++ b/gr-trellis/grc/CMakeLists.txt
@@ -18,18 +18,18 @@
# Boston, MA 02110-1301, USA.
install(FILES
- trellis_encoder_xx.xml
- trellis_siso_combined_f.xml
- trellis_viterbi_x.xml
- trellis_metrics_x.xml
- trellis_siso_f.xml
- trellis_permutation.xml
- trellis_viterbi_combined_xx.xml
- trellis_sccc_encoder_xx.xml
- trellis_sccc_decoder_x.xml
- trellis_sccc_decoder_combined_xx.xml
- trellis_pccc_encoder_xx.xml
- trellis_pccc_decoder_x.xml
- trellis_pccc_decoder_combined_xx.xml
+ trellis_encoder_xx.block.yml
+ trellis_siso_combined_f.block.yml
+ trellis_viterbi_x.block.yml
+ trellis_metrics_x.block.yml
+ trellis_siso_f.block.yml
+ trellis_permutation.block.yml
+ trellis_viterbi_combined_xx.block.yml
+ trellis_sccc_encoder_xx.block.yml
+ trellis_sccc_decoder_x.block.yml
+ trellis_sccc_decoder_combined_xx.block.yml
+ trellis_pccc_encoder_xx.block.yml
+ trellis_pccc_decoder_x.block.yml
+ trellis_pccc_decoder_combined_xx.block.yml
DESTINATION ${GRC_BLOCKS_DIR}
)
diff --git a/gr-trellis/grc/trellis_encoder_xx.block.yml b/gr-trellis/grc/trellis_encoder_xx.block.yml
new file mode 100644
index 000000000..d437c1611
--- /dev/null
+++ b/gr-trellis/grc/trellis_encoder_xx.block.yml
@@ -0,0 +1,59 @@
+id: trellis_encoder_xx
+label: Trellis Encoder
+category: '[Core]/Trellis Coding'
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [bb, bs, bi, ss, si, ii]
+ option_labels: [Byte->Byte, Byte->Short, Byte->Int, Short->Short, Short->Int,
+ Int->Int]
+ option_attributes:
+ input: [byte, byte, byte, short, short, int]
+ output: [byte, short, int, short, int, int]
+ hide: part
+- id: fsm_args
+ label: FSM Args
+ dtype: raw
+- id: init_state
+ label: Initial State
+ dtype: int
+ default: '0'
+- id: blockwise
+ label: Blockwise
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['On', 'Off']
+ hide: part
+- id: blocklength
+ label: Block length
+ dtype: int
+ default: '0'
+ hide: ${ ('none' if blockwise == 'True' else 'all') }
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+
+asserts:
+- ${ (isinstance(eval(""" fsm_args """[1:-1], locals(),globals()), str) and open(fsm_args).close()) or True }
+
+templates:
+ imports: from gnuradio import trellis
+ make: ' trellis.encoder_${type}(trellis.fsm(${fsm_args}), ${init_state}, ${blocklength})
+ if ${blockwise} else trellis.encoder_${type}(trellis.fsm(${fsm_args}), ${init_state}) '
+ callbacks:
+ - set_FSM(trellis.fsm(${fsm_args}))
+ - set_ST(${init_state})
+ - set_K(${blocklength})
+
+documentation: |-
+ The fsm arguments are passed directly to the trellis.fsm() constructor.
+
+file_format: 1
diff --git a/gr-trellis/grc/trellis_encoder_xx.xml b/gr-trellis/grc/trellis_encoder_xx.xml
deleted file mode 100644
index ab7d5226e..000000000
--- a/gr-trellis/grc/trellis_encoder_xx.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Trellis Encoder
-###################################################
- -->
-
-<block>
- <name>Trellis Encoder</name>
- <key>trellis_encoder_xx</key>
- <category>[Core]/Trellis Coding</category>
- <import>from gnuradio import trellis</import>
- <make> trellis.encoder_$(type)(trellis.fsm($fsm_args), $init_state, $blocklength) if $blockwise else trellis.encoder_$(type)(trellis.fsm($fsm_args), $init_state) </make>
- <callback>set_FSM(trellis.fsm($fsm_args))</callback>
- <callback>set_ST($init_state)</callback>
- <callback>set_K($blocklength)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Byte->Byte</name>
- <key>bb</key>
- <opt>input:byte</opt>
- <opt>output:byte</opt>
- </option>
- <option>
- <name>Byte->Short</name>
- <key>bs</key>
- <opt>input:byte</opt>
- <opt>output:short</opt>
- </option>
- <option>
- <name>Byte->Int</name>
- <key>bi</key>
- <opt>input:byte</opt>
- <opt>output:int</opt>
- </option>
- <option>
- <name>Short->Short</name>
- <key>ss</key>
- <opt>input:short</opt>
- <opt>output:short</opt>
- </option>
- <option>
- <name>Short->Int</name>
- <key>si</key>
- <opt>input:short</opt>
- <opt>output:int</opt>
- </option>
- <option>
- <name>Int->Int</name>
- <key>ii</key>
- <opt>input:int</opt>
- <opt>output:int</opt>
- </option>
- </param>
- <param>
- <name>FSM Args</name>
- <key>fsm_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Initial State</name>
- <key>init_state</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Blockwise</name>
- <key>blockwise</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>On</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Block length</name>
- <key>blocklength</key>
- <value>0</value>
- <type>int</type>
- <hide>#if $blockwise() == 'True' then 'none' else 'all'#</hide>
- </param>
- <check>(isinstance(eval(""" $fsm_args """[1:-1], locals(),globals()), str) and open($fsm_args).close()) or True</check>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
- <doc>
-The fsm arguments are passed directly to the trellis.fsm() constructor.
- </doc>
-</block>
diff --git a/gr-trellis/grc/trellis_metrics_x.block.yml b/gr-trellis/grc/trellis_metrics_x.block.yml
new file mode 100644
index 000000000..e4559ea15
--- /dev/null
+++ b/gr-trellis/grc/trellis_metrics_x.block.yml
@@ -0,0 +1,50 @@
+id: trellis_metrics_x
+label: Trellis Metrics
+category: '[Core]/Trellis Coding'
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [c, f, i, s]
+ option_labels: [Complex, Float, Int, Short]
+ option_attributes:
+ io: [complex, float, int, short]
+ table: [complex_vector, real_vector, int_vector, int_vector]
+ hide: part
+- id: card
+ label: Output Cardinality
+ dtype: int
+- id: dim
+ label: Dimensionality
+ dtype: int
+- id: table
+ label: Constellation
+ dtype: ${ type.table }
+- id: metric_type
+ label: Metric Type
+ dtype: enum
+ options: [digital.TRELLIS_EUCLIDEAN, digital.TRELLIS_HARD_SYMBOL, digital.TRELLIS_HARD_BIT]
+ option_labels: [Euclidean, Hard Symbol, Hard Bit]
+
+inputs:
+- domain: stream
+ dtype: ${ type.io }
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import trellis, digital
+ make: trellis.metrics_${type}(${card}, ${dim}, ${table}, ${metric_type})
+ callbacks:
+ - set_O(${card})
+ - set_D(${dim})
+ - set_TYPE(${metric_type})
+ - set_TABLE(${table})
+
+documentation: |-
+ Generate metrics required for Viterbi or SISO algorithms.
+
+file_format: 1
diff --git a/gr-trellis/grc/trellis_metrics_x.xml b/gr-trellis/grc/trellis_metrics_x.xml
deleted file mode 100644
index 15e733809..000000000
--- a/gr-trellis/grc/trellis_metrics_x.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Trellis Metrics
-###################################################
- -->
-
-
-<block>
- <name>Trellis Metrics</name>
- <key>trellis_metrics_x</key>
- <category>[Core]/Trellis Coding</category>
- <import>from gnuradio import trellis, digital</import>
- <make>trellis.metrics_$(type)($card, $dim, $table, $metric_type)</make>
- <callback>set_O($card)</callback>
- <callback>set_D($dim)</callback>
- <callback>set_TYPE($metric_type)</callback>
- <callback>set_TABLE($table)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>c</key>
- <opt>io:complex</opt>
- <opt>table:complex_vector</opt>
- </option>
- <option>
- <name>Float</name>
- <key>f</key>
- <opt>io:float</opt>
- <opt>table:real_vector</opt>
- </option>
- <option>
- <name>Int</name>
- <key>i</key>
- <opt>io:int</opt>
- <opt>table:int_vector</opt>
- </option>
- <option>
- <name>Short</name>
- <key>s</key>
- <opt>io:short</opt>
- <opt>table:int_vector</opt>
- </option>
- </param>
- <param>
- <name>Output Cardinality</name>
- <key>card</key>
- <type>int</type>
- </param>
- <param>
- <name>Dimensionality</name>
- <key>dim</key>
- <type>int</type>
- </param>
- <param>
- <name>Constellation</name>
- <key>table</key>
- <type>$type.table</type>
- </param>
- <param>
- <name>Metric Type</name>
- <key>metric_type</key>
- <type>enum</type>
- <option>
- <name>Euclidean</name>
- <key>digital.TRELLIS_EUCLIDEAN</key>
- </option>
- <option>
- <name>Hard Symbol</name>
- <key>digital.TRELLIS_HARD_SYMBOL</key>
- </option>
- <option>
- <name>Hard Bit</name>
- <key>digital.TRELLIS_HARD_BIT</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>$type.io</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
- <doc>
-Generate metrics required for Viterbi or SISO algorithms.
- </doc>
-</block>
diff --git a/gr-trellis/grc/trellis_pccc_decoder_combined_xx.block.yml b/gr-trellis/grc/trellis_pccc_decoder_combined_xx.block.yml
new file mode 100644
index 000000000..dbfe1ec31
--- /dev/null
+++ b/gr-trellis/grc/trellis_pccc_decoder_combined_xx.block.yml
@@ -0,0 +1,102 @@
+id: trellis_pccc_decoder_combined_xx
+label: PCCC Decoder Combo
+category: '[Core]/Trellis Coding'
+
+parameters:
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [c, f]
+ option_labels: [Complex, Float]
+ option_attributes:
+ io: [complex, float]
+ table: [complex_vector, real_vector]
+ hide: part
+- id: out_type
+ label: Output Type
+ dtype: enum
+ options: [i, s, b]
+ option_labels: [Int, Short, Byte]
+ option_attributes:
+ io: [int, short, byte]
+ hide: part
+- id: o_fsm_args
+ label: FSM 1
+ dtype: raw
+- id: o_init_state
+ label: Initial State 1
+ dtype: int
+ default: '0'
+- id: o_final_state
+ label: Final State 1
+ dtype: int
+ default: '-1'
+- id: i_fsm_args
+ label: FSM 2
+ dtype: raw
+- id: i_init_state
+ label: Initial State 2
+ dtype: int
+ default: '0'
+- id: i_final_state
+ label: Final State 2
+ dtype: int
+ default: '-1'
+- id: interleaver
+ label: Interleaver
+ dtype: raw
+- id: block_size
+ label: Block Size
+ dtype: int
+- id: iterations
+ label: Iterations
+ dtype: int
+ default: '10'
+- id: dim
+ label: Dimensionality
+ dtype: int
+- id: table
+ label: Constellation
+ dtype: ${ type.table }
+- id: metric_type
+ label: Metric Type
+ dtype: enum
+ options: [digital.TRELLIS_EUCLIDEAN, digital.TRELLIS_HARD_SYMBOL, digital.TRELLIS_HARD_BIT]
+ option_labels: [Euclidean, Hard Symbol, Hard Bit]
+- id: siso_type
+ label: SISO Type
+ dtype: enum
+ options: [trellis.TRELLIS_MIN_SUM, trellis.TRELLIS_SUM_PRODUCT]
+ option_labels: [Min Sum, Sum Product]
+- id: scaling
+ label: Scaling
+ dtype: real
+ default: '1.0'
+
+inputs:
+- domain: stream
+ dtype: ${ type.io }
+
+outputs:
+- domain: stream
+ dtype: ${ out_type.io }
+
+asserts:
+- ${ (isinstance(eval(""" o_fsm_args """[1:-1], locals(),globals()), str) and open(o_fsm_args).close()) or True }
+- ${ (isinstance(eval(""" i_fsm_args """[1:-1], locals(),globals()), str) and open(i_fsm_args).close()) or True }
+
+templates:
+ imports: from gnuradio import trellis, digital
+ make: "trellis.pccc_decoder_combined_${type}${out_type}(\n trellis.fsm(${o_fsm_args}),\
+ \ ${o_init_state}, ${o_final_state},\n trellis.fsm(${i_fsm_args}), ${i_init_state},\
+ \ ${i_final_state},\n trellis.interleaver(${interleaver}),\n ${block_size},\n\
+ \ ${iterations},\n ${siso_type},\n ${dim}, ${table}, ${metric_type},\n\
+ \ ${scaling})\n "
+ callbacks:
+ - set_scaling(${scaling})
+
+documentation: |-
+ PCCC turbo Decoder combined with metric calculation.
+ The fsm arguments are passed directly to the trellis.fsm() constructor.
+
+file_format: 1
diff --git a/gr-trellis/grc/trellis_pccc_decoder_combined_xx.xml b/gr-trellis/grc/trellis_pccc_decoder_combined_xx.xml
deleted file mode 100644
index 7bb38db89..000000000
--- a/gr-trellis/grc/trellis_pccc_decoder_combined_xx.xml
+++ /dev/null
@@ -1,172 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## PCCC Decoder Combined
-###################################################
- -->
-
-
-<block>
- <name>PCCC Decoder Combo</name>
- <key>trellis_pccc_decoder_combined_xx</key>
- <category>[Core]/Trellis Coding</category>
- <import>from gnuradio import trellis, digital</import>
- <make>trellis.pccc_decoder_combined_$(type)$(out_type)(
- trellis.fsm($o_fsm_args), $o_init_state, $o_final_state,
- trellis.fsm($i_fsm_args), $i_init_state, $i_final_state,
- trellis.interleaver($interleaver),
- $block_size,
- $iterations,
- $siso_type,
- $dim, $table, $metric_type,
- $scaling)
- </make>
- <callback>set_scaling($scaling)</callback>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>c</key>
- <opt>io:complex</opt>
- <opt>table:complex_vector</opt>
- </option>
- <option>
- <name>Float</name>
- <key>f</key>
- <opt>io:float</opt>
- <opt>table:real_vector</opt>
- </option>
- </param>
- <param>
- <name>Output Type</name>
- <key>out_type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>i</key>
- <opt>io:int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>s</key>
- <opt>io:short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>b</key>
- <opt>io:byte</opt>
- </option>
- </param>
- <param>
- <name>FSM 1</name>
- <key>o_fsm_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Initial State 1</name>
- <key>o_init_state</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Final State 1</name>
- <key>o_final_state</key>
- <value>-1</value>
- <type>int</type>
- </param>
- <param>
- <name>FSM 2</name>
- <key>i_fsm_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Initial State 2</name>
- <key>i_init_state</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Final State 2</name>
- <key>i_final_state</key>
- <value>-1</value>
- <type>int</type>
- </param>
- <param>
- <name>Interleaver</name>
- <key>interleaver</key>
- <type>raw</type>
- </param>
- <param>
- <name>Block Size</name>
- <key>block_size</key>
- <type>int</type>
- </param>
- <param>
- <name>Iterations</name>
- <key>iterations</key>
- <value>10</value>
- <type>int</type>
- </param>
- <param>
- <name>Dimensionality</name>
- <key>dim</key>
- <type>int</type>
- </param>
- <param>
- <name>Constellation</name>
- <key>table</key>
- <type>$type.table</type>
- </param>
- <param>
- <name>Metric Type</name>
- <key>metric_type</key>
- <type>enum</type>
- <option>
- <name>Euclidean</name>
- <key>digital.TRELLIS_EUCLIDEAN</key>
- </option>
- <option>
- <name>Hard Symbol</name>
- <key>digital.TRELLIS_HARD_SYMBOL</key>
- </option>
- <option>
- <name>Hard Bit</name>
- <key>digital.TRELLIS_HARD_BIT</key>
- </option>
- </param>
- <param>
- <name>SISO Type</name>
- <key>siso_type</key>
- <type>enum</type>
- <option>
- <name>Min Sum</name>
- <key>trellis.TRELLIS_MIN_SUM</key>
- </option>
- <option>
- <name>Sum Product</name>
- <key>trellis.TRELLIS_SUM_PRODUCT</key>
- </option>
- </param>
- <param>
- <name>Scaling</name>
- <key>scaling</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <check>(isinstance(eval(""" $o_fsm_args """[1:-1], locals(),globals()), str) and open($o_fsm_args).close()) or True</check>
- <check>(isinstance(eval(""" $i_fsm_args """[1:-1], locals(),globals()), str) and open($i_fsm_args).close()) or True </check>
- <sink>
- <name>in</name>
- <type>$type.io</type>
- </sink>
- <source>
- <name>out</name>
- <type>$out_type.io</type>
- </source>
- <doc>
-PCCC turbo Decoder combined with metric calculation.
-The fsm arguments are passed directly to the trellis.fsm() constructor.
- </doc>
-</block>
diff --git a/gr-trellis/grc/trellis_pccc_decoder_x.block.yml b/gr-trellis/grc/trellis_pccc_decoder_x.block.yml
new file mode 100644
index 000000000..f49ec91a7
--- /dev/null
+++ b/gr-trellis/grc/trellis_pccc_decoder_x.block.yml
@@ -0,0 +1,75 @@
+id: trellis_pccc_decoder_x
+label: PCCC Decoder
+category: '[Core]/Trellis Coding'
+
+parameters:
+- id: out_type
+ label: Output Type
+ dtype: enum
+ options: [i, s, b]
+ option_labels: [Int, Short, Byte]
+ option_attributes:
+ io: [int, short, byte]
+ hide: part
+- id: o_fsm_args
+ label: FSM 1
+ dtype: raw
+- id: o_init_state
+ label: Initial State 1
+ dtype: int
+ default: '0'
+- id: o_final_state
+ label: Final State 1
+ dtype: int
+ default: '-1'
+- id: i_fsm_args
+ label: FSM 2
+ dtype: raw
+- id: i_init_state
+ label: Initial State 2
+ dtype: int
+ default: '0'
+- id: i_final_state
+ label: Final State 2
+ dtype: int
+ default: '-1'
+- id: interleaver
+ label: Interleaver
+ dtype: raw
+- id: block_size
+ label: Block Size
+ dtype: int
+- id: iterations
+ label: Iterations
+ dtype: int
+ default: '10'
+- id: siso_type
+ label: SISO Type
+ dtype: enum
+ options: [trellis.TRELLIS_MIN_SUM, trellis.TRELLIS_SUM_PRODUCT]
+ option_labels: [Min Sum, Sum Product]
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: ${ out_type.io }
+
+asserts:
+- ${ (isinstance(eval(""" o_fsm_args """[1:-1], locals(),globals()), str) and open(o_fsm_args).close()) or True }
+- ${ (isinstance(eval(""" i_fsm_args """[1:-1], locals(),globals()), str) and open(i_fsm_args).close()) or True }
+
+templates:
+ imports: from gnuradio import trellis
+ make: "trellis.pccc_decoder_${out_type}(\n trellis.fsm(${o_fsm_args}), ${o_init_state},\
+ \ ${o_final_state},\n trellis.fsm(${i_fsm_args}), ${i_init_state}, ${i_final_state},\n\
+ \ trellis.interleaver(${interleaver}),\n ${block_size},\n ${iterations},\n\
+ \ ${siso_type})\n "
+
+documentation: |-
+ PCCC turbo Decoder.
+ The fsm and interleaver arguments are passed directly to the trellis.fsm() and trellis.interleaver() constructors.
+
+file_format: 1
diff --git a/gr-trellis/grc/trellis_pccc_decoder_x.xml b/gr-trellis/grc/trellis_pccc_decoder_x.xml
deleted file mode 100644
index 08d1f526a..000000000
--- a/gr-trellis/grc/trellis_pccc_decoder_x.xml
+++ /dev/null
@@ -1,119 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## PCCC Decoder
-###################################################
- -->
-
-
-<block>
- <name>PCCC Decoder</name>
- <key>trellis_pccc_decoder_x</key>
- <category>[Core]/Trellis Coding</category>
- <import>from gnuradio import trellis</import>
- <make>trellis.pccc_decoder_$(out_type)(
- trellis.fsm($o_fsm_args), $o_init_state, $o_final_state,
- trellis.fsm($i_fsm_args), $i_init_state, $i_final_state,
- trellis.interleaver($interleaver),
- $block_size,
- $iterations,
- $siso_type)
- </make>
- <param>
- <name>Output Type</name>
- <key>out_type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>i</key>
- <opt>io:int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>s</key>
- <opt>io:short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>b</key>
- <opt>io:byte</opt>
- </option>
- </param>
- <param>
- <name>FSM 1</name>
- <key>o_fsm_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Initial State 1</name>
- <key>o_init_state</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Final State 1</name>
- <key>o_final_state</key>
- <value>-1</value>
- <type>int</type>
- </param>
- <param>
- <name>FSM 2</name>
- <key>i_fsm_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Initial State 2</name>
- <key>i_init_state</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Final State 2</name>
- <key>i_final_state</key>
- <value>-1</value>
- <type>int</type>
- </param>
- <param>
- <name>Interleaver</name>
- <key>interleaver</key>
- <type>raw</type>
- </param>
- <param>
- <name>Block Size</name>
- <key>block_size</key>
- <type>int</type>
- </param>
- <param>
- <name>Iterations</name>
- <key>iterations</key>
- <value>10</value>
- <type>int</type>
- </param>
- <param>
- <name>SISO Type</name>
- <key>siso_type</key>
- <type>enum</type>
- <option>
- <name>Min Sum</name>
- <key>trellis.TRELLIS_MIN_SUM</key>
- </option>
- <option>
- <name>Sum Product</name>
- <key>trellis.TRELLIS_SUM_PRODUCT</key>
- </option>
- </param>
- <check>(isinstance(eval(""" $o_fsm_args """[1:-1], locals(),globals()), str) and open($o_fsm_args).close()) or True</check>
- <check>(isinstance(eval(""" $i_fsm_args """[1:-1], locals(),globals()), str) and open($i_fsm_args).close()) or True </check>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>$out_type.io</type>
- </source>
- <doc>
-PCCC turbo Decoder.
-The fsm and interleaver arguments are passed directly to the trellis.fsm() and trellis.interleaver() constructors.
- </doc>
-</block>
diff --git a/gr-trellis/grc/trellis_pccc_encoder_xx.block.yml b/gr-trellis/grc/trellis_pccc_encoder_xx.block.yml
new file mode 100644
index 000000000..4bc2f10b3
--- /dev/null
+++ b/gr-trellis/grc/trellis_pccc_encoder_xx.block.yml
@@ -0,0 +1,58 @@
+id: trellis_pccc_encoder_xx
+label: PCCC Encoder
+category: '[Core]/Trellis Coding'
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [bb, bs, bi, ss, si, ii]
+ option_labels: [Byte->Byte, Byte->Short, Byte->Int, Short->Short, Short->Int,
+ Int->Int]
+ option_attributes:
+ input: [byte, byte, byte, short, short, int]
+ output: [byte, short, int, short, int, int]
+ hide: part
+- id: o_fsm_args
+ label: FSM 1
+ dtype: raw
+- id: o_init_state
+ label: Initial State 1
+ dtype: int
+ default: '0'
+- id: i_fsm_args
+ label: FSM 2
+ dtype: raw
+- id: i_init_state
+ label: Initial State 2
+ dtype: int
+ default: '0'
+- id: interleaver_args
+ label: Interleaver
+ dtype: raw
+- id: bl
+ label: Blocklength
+ dtype: int
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+
+asserts:
+- ${ (isinstance(eval(""" o_fsm_args """[1:-1], locals(),globals()), str) and open(o_fsm_args).close()) or True }
+- ${ (isinstance(eval(""" i_fsm_args """[1:-1], locals(),globals()), str) and open(i_fsm_args).close()) or True }
+
+templates:
+ imports: from gnuradio import trellis
+ make: trellis.pccc_encoder_${type}(trellis.fsm(${o_fsm_args}), ${o_init_state},
+ trellis.fsm(${i_fsm_args}), ${i_init_state}, trellis.interleaver(${interleaver_args}),
+ ${bl})
+
+documentation: |-
+ The fsm and interleaver arguments are passed directly to the trellis.fsm() and trellis.interleaver() constructors.
+
+file_format: 1
diff --git a/gr-trellis/grc/trellis_pccc_encoder_xx.xml b/gr-trellis/grc/trellis_pccc_encoder_xx.xml
deleted file mode 100644
index 85348e6e9..000000000
--- a/gr-trellis/grc/trellis_pccc_encoder_xx.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## PCCC Encoder
-###################################################
- -->
-
-<block>
- <name>PCCC Encoder</name>
- <key>trellis_pccc_encoder_xx</key>
- <category>[Core]/Trellis Coding</category>
- <import>from gnuradio import trellis</import>
- <make>trellis.pccc_encoder_$(type)(trellis.fsm($o_fsm_args), $o_init_state, trellis.fsm($i_fsm_args), $i_init_state, trellis.interleaver($interleaver_args), $bl)</make>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Byte->Byte</name>
- <key>bb</key>
- <opt>input:byte</opt>
- <opt>output:byte</opt>
- </option>
- <option>
- <name>Byte->Short</name>
- <key>bs</key>
- <opt>input:byte</opt>
- <opt>output:short</opt>
- </option>
- <option>
- <name>Byte->Int</name>
- <key>bi</key>
- <opt>input:byte</opt>
- <opt>output:int</opt>
- </option>
- <option>
- <name>Short->Short</name>
- <key>ss</key>
- <opt>input:short</opt>
- <opt>output:short</opt>
- </option>
- <option>
- <name>Short->Int</name>
- <key>si</key>
- <opt>input:short</opt>
- <opt>output:int</opt>
- </option>
- <option>
- <name>Int->Int</name>
- <key>ii</key>
- <opt>input:int</opt>
- <opt>output:int</opt>
- </option>
- </param>
- <param>
- <name>FSM 1</name>
- <key>o_fsm_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Initial State 1</name>
- <key>o_init_state</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>FSM 2</name>
- <key>i_fsm_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Initial State 2</name>
- <key>i_init_state</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Interleaver</name>
- <key>interleaver_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Blocklength</name>
- <key>bl</key>
- <type>int</type>
- </param>
- <check>(isinstance(eval(""" $o_fsm_args """[1:-1], locals(),globals()), str) and open($o_fsm_args).close()) or True</check>
- <check>(isinstance(eval(""" $i_fsm_args """[1:-1], locals(),globals()), str) and open($i_fsm_args).close()) or True </check>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
- <doc>
-The fsm and interleaver arguments are passed directly to the trellis.fsm() and trellis.interleaver() constructors.
- </doc>
-</block>
diff --git a/gr-trellis/grc/trellis_permutation.block.yml b/gr-trellis/grc/trellis_permutation.block.yml
new file mode 100644
index 000000000..2dba67144
--- /dev/null
+++ b/gr-trellis/grc/trellis_permutation.block.yml
@@ -0,0 +1,54 @@
+id: trellis_permutation
+label: Trellis Permutation
+category: '[Core]/Trellis Coding'
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: interleaver_size
+ label: Interleaver Size
+ dtype: int
+- id: table
+ label: Table
+ dtype: int_vector
+- id: syms_per_block
+ label: Symbols per Block
+ dtype: int
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ imports: from gnuradio import trellis
+ make: trellis.permutation(${interleaver_size}, ${table}, ${syms_per_block}, ${type.size}*${vlen})
+ callbacks:
+ - set_K(${interleaver_size})
+ - set_TABLE(${table})
+ - set_SYMS_PER_BLOCK(${syms_per_block})
+
+documentation: |-
+ Interleaver size is given in blocks.
+ One Symbol = (in/out type) * (vector length)
+
+file_format: 1
diff --git a/gr-trellis/grc/trellis_permutation.xml b/gr-trellis/grc/trellis_permutation.xml
deleted file mode 100644
index 99eb2d291..000000000
--- a/gr-trellis/grc/trellis_permutation.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Trellis Permutation
-###################################################
- -->
-
-
-<block>
- <name>Trellis Permutation</name>
- <key>trellis_permutation</key>
- <category>[Core]/Trellis Coding</category>
- <import>from gnuradio import trellis</import>
- <make>trellis.permutation($interleaver_size, $table, $syms_per_block, $type.size*$vlen)</make>
- <callback>set_K($interleaver_size)</callback>
- <callback>set_TABLE($table)</callback>
- <callback>set_SYMS_PER_BLOCK($syms_per_block)</callback>
-
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- </param>
- <param>
- <name>Interleaver Size</name>
- <key>interleaver_size</key>
- <type>int</type>
- </param>
- <param>
- <name>Table</name>
- <key>table</key>
- <type>int_vector</type>
- </param>
- <param>
- <name>Symbols per Block</name>
- <key>syms_per_block</key>
- <type>int</type>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
- <check>$vlen &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
- <doc>
-Interleaver size is given in blocks.
-One Symbol = (in/out type) * (vector length)
- </doc>
-</block>
diff --git a/gr-trellis/grc/trellis_sccc_decoder_combined_xx.block.yml b/gr-trellis/grc/trellis_sccc_decoder_combined_xx.block.yml
new file mode 100644
index 000000000..441d9593b
--- /dev/null
+++ b/gr-trellis/grc/trellis_sccc_decoder_combined_xx.block.yml
@@ -0,0 +1,102 @@
+id: trellis_sccc_decoder_combined_xx
+label: SCCC Decoder Combo
+category: '[Core]/Trellis Coding'
+
+parameters:
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [c, f]
+ option_labels: [Complex, Float]
+ option_attributes:
+ io: [complex, float]
+ table: [complex_vector, real_vector]
+ hide: part
+- id: out_type
+ label: Output Type
+ dtype: enum
+ options: [i, s, b]
+ option_labels: [Int, Short, Byte]
+ option_attributes:
+ io: [int, short, byte]
+ hide: part
+- id: o_fsm_args
+ label: Outer FSM
+ dtype: raw
+- id: o_init_state
+ label: Outer Initial State
+ dtype: int
+ default: '0'
+- id: o_final_state
+ label: Outer Final State
+ dtype: int
+ default: '-1'
+- id: i_fsm_args
+ label: Inner FSM
+ dtype: raw
+- id: i_init_state
+ label: Inner Initial State
+ dtype: int
+ default: '0'
+- id: i_final_state
+ label: Inner Final State
+ dtype: int
+ default: '-1'
+- id: interleaver
+ label: Interleaver
+ dtype: raw
+- id: block_size
+ label: Block Size
+ dtype: int
+- id: iterations
+ label: Iterations
+ dtype: int
+ default: '10'
+- id: dim
+ label: Dimensionality
+ dtype: int
+- id: table
+ label: Constellation
+ dtype: ${ type.table }
+- id: metric_type
+ label: Metric Type
+ dtype: enum
+ options: [digital.TRELLIS_EUCLIDEAN, digital.TRELLIS_HARD_SYMBOL, digital.TRELLIS_HARD_BIT]
+ option_labels: [Euclidean, Hard Symbol, Hard Bit]
+- id: siso_type
+ label: SISO Type
+ dtype: enum
+ options: [trellis.TRELLIS_MIN_SUM, trellis.TRELLIS_SUM_PRODUCT]
+ option_labels: [Min Sum, Sum Product]
+- id: scaling
+ label: Scaling
+ dtype: real
+ default: '1.0'
+
+inputs:
+- domain: stream
+ dtype: ${ type.io }
+
+outputs:
+- domain: stream
+ dtype: ${ out_type.io }
+
+asserts:
+- ${ (isinstance(eval(""" o_fsm_args """[1:-1], locals(),globals()), str) and open(o_fsm_args).close()) or True }
+- ${ (isinstance(eval(""" i_fsm_args """[1:-1], locals(),globals()), str) and open(i_fsm_args).close()) or True }
+
+templates:
+ imports: from gnuradio import trellis, digital
+ make: "trellis.sccc_decoder_combined_${type}${out_type}(\n trellis.fsm(${o_fsm_args}),\
+ \ ${o_init_state}, ${o_final_state},\n trellis.fsm(${i_fsm_args}), ${i_init_state},\
+ \ ${i_final_state},\n trellis.interleaver(${interleaver}),\n ${block_size},\n\
+ \ ${iterations},\n ${siso_type},\n ${dim}, ${table},\
+ \ ${metric_type},\n ${scaling})\n "
+ callbacks:
+ - set_scaling(${scaling})
+
+documentation: |-
+ SCCC turbo Decoder combined with metric calculation.
+ The fsm arguments are passed directly to the trellis.fsm() constructor.
+
+file_format: 1
diff --git a/gr-trellis/grc/trellis_sccc_decoder_combined_xx.xml b/gr-trellis/grc/trellis_sccc_decoder_combined_xx.xml
deleted file mode 100644
index 79be0b8b5..000000000
--- a/gr-trellis/grc/trellis_sccc_decoder_combined_xx.xml
+++ /dev/null
@@ -1,172 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## SCCC Decoder Combined
-###################################################
- -->
-
-
-<block>
- <name>SCCC Decoder Combo</name>
- <key>trellis_sccc_decoder_combined_xx</key>
- <category>[Core]/Trellis Coding</category>
- <import>from gnuradio import trellis, digital</import>
- <make>trellis.sccc_decoder_combined_$(type)$(out_type)(
- trellis.fsm($o_fsm_args), $o_init_state, $o_final_state,
- trellis.fsm($i_fsm_args), $i_init_state, $i_final_state,
- trellis.interleaver($interleaver),
- $block_size,
- $iterations,
- $siso_type,
- $dim, $table, $metric_type,
- $scaling)
- </make>
- <callback>set_scaling($scaling)</callback>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>c</key>
- <opt>io:complex</opt>
- <opt>table:complex_vector</opt>
- </option>
- <option>
- <name>Float</name>
- <key>f</key>
- <opt>io:float</opt>
- <opt>table:real_vector</opt>
- </option>
- </param>
- <param>
- <name>Output Type</name>
- <key>out_type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>i</key>
- <opt>io:int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>s</key>
- <opt>io:short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>b</key>
- <opt>io:byte</opt>
- </option>
- </param>
- <param>
- <name>Outer FSM</name>
- <key>o_fsm_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Outer Initial State</name>
- <key>o_init_state</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Outer Final State</name>
- <key>o_final_state</key>
- <value>-1</value>
- <type>int</type>
- </param>
- <param>
- <name>Inner FSM</name>
- <key>i_fsm_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Inner Initial State</name>
- <key>i_init_state</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Inner Final State</name>
- <key>i_final_state</key>
- <value>-1</value>
- <type>int</type>
- </param>
- <param>
- <name>Interleaver</name>
- <key>interleaver</key>
- <type>raw</type>
- </param>
- <param>
- <name>Block Size</name>
- <key>block_size</key>
- <type>int</type>
- </param>
- <param>
- <name>Iterations</name>
- <key>iterations</key>
- <value>10</value>
- <type>int</type>
- </param>
- <param>
- <name>Dimensionality</name>
- <key>dim</key>
- <type>int</type>
- </param>
- <param>
- <name>Constellation</name>
- <key>table</key>
- <type>$type.table</type>
- </param>
- <param>
- <name>Metric Type</name>
- <key>metric_type</key>
- <type>enum</type>
- <option>
- <name>Euclidean</name>
- <key>digital.TRELLIS_EUCLIDEAN</key>
- </option>
- <option>
- <name>Hard Symbol</name>
- <key>digital.TRELLIS_HARD_SYMBOL</key>
- </option>
- <option>
- <name>Hard Bit</name>
- <key>digital.TRELLIS_HARD_BIT</key>
- </option>
- </param>
- <param>
- <name>SISO Type</name>
- <key>siso_type</key>
- <type>enum</type>
- <option>
- <name>Min Sum</name>
- <key>trellis.TRELLIS_MIN_SUM</key>
- </option>
- <option>
- <name>Sum Product</name>
- <key>trellis.TRELLIS_SUM_PRODUCT</key>
- </option>
- </param>
- <param>
- <name>Scaling</name>
- <key>scaling</key>
- <value>1.0</value>
- <type>real</type>
- </param>
- <check>(isinstance(eval(""" $o_fsm_args """[1:-1], locals(),globals()), str) and open($o_fsm_args).close()) or True</check>
- <check>(isinstance(eval(""" $i_fsm_args """[1:-1], locals(),globals()), str) and open($i_fsm_args).close()) or True </check>
- <sink>
- <name>in</name>
- <type>$type.io</type>
- </sink>
- <source>
- <name>out</name>
- <type>$out_type.io</type>
- </source>
- <doc>
-SCCC turbo Decoder combined with metric calculation.
-The fsm arguments are passed directly to the trellis.fsm() constructor.
- </doc>
-</block>
diff --git a/gr-trellis/grc/trellis_sccc_decoder_x.block.yml b/gr-trellis/grc/trellis_sccc_decoder_x.block.yml
new file mode 100644
index 000000000..794115d48
--- /dev/null
+++ b/gr-trellis/grc/trellis_sccc_decoder_x.block.yml
@@ -0,0 +1,75 @@
+id: trellis_sccc_decoder_x
+label: SCCC Decoder
+category: '[Core]/Trellis Coding'
+
+parameters:
+- id: out_type
+ label: Output Type
+ dtype: enum
+ options: [i, s, b]
+ option_labels: [Int, Short, Byte]
+ option_attributes:
+ io: [int, short, byte]
+ hide: part
+- id: o_fsm_args
+ label: Outer FSM
+ dtype: raw
+- id: o_init_state
+ label: Outer Initial State
+ dtype: int
+ default: '0'
+- id: o_final_state
+ label: Outer Final State
+ dtype: int
+ default: '-1'
+- id: i_fsm_args
+ label: Inner FSM
+ dtype: raw
+- id: i_init_state
+ label: Inner Initial State
+ dtype: int
+ default: '0'
+- id: i_final_state
+ label: Inner Final State
+ dtype: int
+ default: '-1'
+- id: interleaver
+ label: Interleaver
+ dtype: raw
+- id: block_size
+ label: Block Size
+ dtype: int
+- id: iterations
+ label: Iterations
+ dtype: int
+ default: '10'
+- id: siso_type
+ label: SISO Type
+ dtype: enum
+ options: [trellis.TRELLIS_MIN_SUM, trellis.TRELLIS_SUM_PRODUCT]
+ option_labels: [Min Sum, Sum Product]
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: ${ out_type.io }
+
+asserts:
+- ${ (isinstance(eval(""" o_fsm_args """[1:-1], locals(),globals()), str) and open(o_fsm_args).close()) or True }
+- ${ (isinstance(eval(""" i_fsm_args """[1:-1], locals(),globals()), str) and open(i_fsm_args).close()) or True }
+
+templates:
+ imports: from gnuradio import trellis
+ make: "trellis.sccc_decoder_${out_type}(\n trellis.fsm(${o_fsm_args}), ${o_init_state},\
+ \ ${o_final_state},\n trellis.fsm(${i_fsm_args}), ${i_init_state}, ${i_final_state},\n\
+ \ trellis.interleaver(${interleaver}),\n ${block_size},\n ${iterations},\n\
+ \ ${siso_type})\n "
+
+documentation: |-
+ SCCC turbo Decoder.
+ The fsm and interleaver arguments are passed directly to the trellis.fsm() and trellis.interleaver() constructors.
+
+file_format: 1
diff --git a/gr-trellis/grc/trellis_sccc_decoder_x.xml b/gr-trellis/grc/trellis_sccc_decoder_x.xml
deleted file mode 100644
index 584ff0b0a..000000000
--- a/gr-trellis/grc/trellis_sccc_decoder_x.xml
+++ /dev/null
@@ -1,119 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## SCCC Decoder
-###################################################
- -->
-
-
-<block>
- <name>SCCC Decoder</name>
- <key>trellis_sccc_decoder_x</key>
- <category>[Core]/Trellis Coding</category>
- <import>from gnuradio import trellis</import>
- <make>trellis.sccc_decoder_$(out_type)(
- trellis.fsm($o_fsm_args), $o_init_state, $o_final_state,
- trellis.fsm($i_fsm_args), $i_init_state, $i_final_state,
- trellis.interleaver($interleaver),
- $block_size,
- $iterations,
- $siso_type)
- </make>
- <param>
- <name>Output Type</name>
- <key>out_type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>i</key>
- <opt>io:int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>s</key>
- <opt>io:short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>b</key>
- <opt>io:byte</opt>
- </option>
- </param>
- <param>
- <name>Outer FSM</name>
- <key>o_fsm_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Outer Initial State</name>
- <key>o_init_state</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Outer Final State</name>
- <key>o_final_state</key>
- <value>-1</value>
- <type>int</type>
- </param>
- <param>
- <name>Inner FSM</name>
- <key>i_fsm_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Inner Initial State</name>
- <key>i_init_state</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Inner Final State</name>
- <key>i_final_state</key>
- <value>-1</value>
- <type>int</type>
- </param>
- <param>
- <name>Interleaver</name>
- <key>interleaver</key>
- <type>raw</type>
- </param>
- <param>
- <name>Block Size</name>
- <key>block_size</key>
- <type>int</type>
- </param>
- <param>
- <name>Iterations</name>
- <key>iterations</key>
- <value>10</value>
- <type>int</type>
- </param>
- <param>
- <name>SISO Type</name>
- <key>siso_type</key>
- <type>enum</type>
- <option>
- <name>Min Sum</name>
- <key>trellis.TRELLIS_MIN_SUM</key>
- </option>
- <option>
- <name>Sum Product</name>
- <key>trellis.TRELLIS_SUM_PRODUCT</key>
- </option>
- </param>
- <check>(isinstance(eval(""" $o_fsm_args """[1:-1], locals(),globals()), str) and open($o_fsm_args).close()) or True</check>
- <check>(isinstance(eval(""" $i_fsm_args """[1:-1], locals(),globals()), str) and open($i_fsm_args).close()) or True </check>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>$out_type.io</type>
- </source>
- <doc>
-SCCC turbo Decoder.
-The fsm and interleaver arguments are passed directly to the trellis.fsm() and trellis.interleaver() constructors.
- </doc>
-</block>
diff --git a/gr-trellis/grc/trellis_sccc_encoder_xx.block.yml b/gr-trellis/grc/trellis_sccc_encoder_xx.block.yml
new file mode 100644
index 000000000..5068af38f
--- /dev/null
+++ b/gr-trellis/grc/trellis_sccc_encoder_xx.block.yml
@@ -0,0 +1,58 @@
+id: trellis_sccc_encoder_xx
+label: SCCC Encoder
+category: '[Core]/Trellis Coding'
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [bb, bs, bi, ss, si, ii]
+ option_labels: [Byte->Byte, Byte->Short, Byte->Int, Short->Short, Short->Int,
+ Int->Int]
+ option_attributes:
+ input: [byte, byte, byte, short, short, int]
+ output: [byte, short, int, short, int, int]
+ hide: part
+- id: o_fsm_args
+ label: Outer FSM
+ dtype: raw
+- id: o_init_state
+ label: Outer Initial State
+ dtype: int
+ default: '0'
+- id: i_fsm_args
+ label: Inner FSM
+ dtype: raw
+- id: i_init_state
+ label: Inner Initial State
+ dtype: int
+ default: '0'
+- id: interleaver_args
+ label: Interleaver
+ dtype: raw
+- id: bl
+ label: Blocklength
+ dtype: int
+
+inputs:
+- domain: stream
+ dtype: ${ type.input }
+
+outputs:
+- domain: stream
+ dtype: ${ type.output }
+
+asserts:
+- ${ (isinstance(eval(""" o_fsm_args """[1:-1], locals(),globals()), str) and open(o_fsm_args).close()) or True }
+- ${ (isinstance(eval(""" i_fsm_args """[1:-1], locals(),globals()), str) and open(i_fsm_args).close()) or True }
+
+templates:
+ imports: from gnuradio import trellis
+ make: trellis.sccc_encoder_${type}(trellis.fsm(${o_fsm_args}), ${o_init_state},
+ trellis.fsm(${i_fsm_args}), ${i_init_state}, trellis.interleaver(${interleaver_args}),
+ ${bl})
+
+documentation: |-
+ The fsm and interleaver arguments are passed directly to the trellis.fsm() and trellis.interleaver() constructors.
+
+file_format: 1
diff --git a/gr-trellis/grc/trellis_sccc_encoder_xx.xml b/gr-trellis/grc/trellis_sccc_encoder_xx.xml
deleted file mode 100644
index 7b4ab30c7..000000000
--- a/gr-trellis/grc/trellis_sccc_encoder_xx.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##SCCC Encoder
-###################################################
- -->
-
-<block>
- <name>SCCC Encoder</name>
- <key>trellis_sccc_encoder_xx</key>
- <category>[Core]/Trellis Coding</category>
- <import>from gnuradio import trellis</import>
- <make>trellis.sccc_encoder_$(type)(trellis.fsm($o_fsm_args), $o_init_state, trellis.fsm($i_fsm_args), $i_init_state, trellis.interleaver($interleaver_args), $bl)</make>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Byte->Byte</name>
- <key>bb</key>
- <opt>input:byte</opt>
- <opt>output:byte</opt>
- </option>
- <option>
- <name>Byte->Short</name>
- <key>bs</key>
- <opt>input:byte</opt>
- <opt>output:short</opt>
- </option>
- <option>
- <name>Byte->Int</name>
- <key>bi</key>
- <opt>input:byte</opt>
- <opt>output:int</opt>
- </option>
- <option>
- <name>Short->Short</name>
- <key>ss</key>
- <opt>input:short</opt>
- <opt>output:short</opt>
- </option>
- <option>
- <name>Short->Int</name>
- <key>si</key>
- <opt>input:short</opt>
- <opt>output:int</opt>
- </option>
- <option>
- <name>Int->Int</name>
- <key>ii</key>
- <opt>input:int</opt>
- <opt>output:int</opt>
- </option>
- </param>
- <param>
- <name>Outer FSM</name>
- <key>o_fsm_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Outer Initial State</name>
- <key>o_init_state</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Inner FSM</name>
- <key>i_fsm_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Inner Initial State</name>
- <key>i_init_state</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Interleaver</name>
- <key>interleaver_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Blocklength</name>
- <key>bl</key>
- <type>int</type>
- </param>
- <check>(isinstance(eval(""" $o_fsm_args """[1:-1], locals(),globals()), str) and open($o_fsm_args).close()) or True</check>
- <check>(isinstance(eval(""" $i_fsm_args """[1:-1], locals(),globals()), str) and open($i_fsm_args).close()) or True </check>
- <sink>
- <name>in</name>
- <type>$type.input</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.output</type>
- </source>
- <doc>
-The fsm and interleaver arguments are passed directly to the trellis.fsm() and trellis.interleaver() constructors.
- </doc>
-</block>
diff --git a/gr-trellis/grc/trellis_siso_combined_f.block.yml b/gr-trellis/grc/trellis_siso_combined_f.block.yml
new file mode 100644
index 000000000..0a10dc14d
--- /dev/null
+++ b/gr-trellis/grc/trellis_siso_combined_f.block.yml
@@ -0,0 +1,79 @@
+id: trellis_siso_combined_f
+label: SISO Combo
+category: '[Core]/Trellis Coding'
+
+parameters:
+- id: fsm_args
+ label: FSM Args
+ dtype: raw
+- id: block_size
+ label: Block Size
+ dtype: int
+- id: init_state
+ label: Initial State
+ dtype: int
+ default: '0'
+- id: final_state
+ label: Final State
+ dtype: int
+ default: '-1'
+- id: a_post_in
+ label: A-posteriori In
+ dtype: enum
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: a_post_out
+ label: A-posteriori Out
+ dtype: enum
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: siso_type
+ label: SISO Type
+ dtype: enum
+ options: [trellis.TRELLIS_MIN_SUM, trellis.TRELLIS_SUM_PRODUCT]
+ option_labels: [Min Sum, Sum Product]
+- id: dim
+ label: Dimensionality
+ dtype: int
+- id: table
+ label: Constellation
+ dtype: real_vector
+- id: metric_type
+ label: Metric Type
+ dtype: enum
+ options: [trellis.TRELLIS_EUCLIDEAN, trellis.TRELLIS_HARD_SYMBOL, trellis.TRELLIS_HARD_BIT]
+ option_labels: [Euclidean, Hard Symbol, Hard Bit]
+
+inputs:
+- label: in_i
+ domain: stream
+ dtype: float
+- label: in_o
+ domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import trellis
+ make: trellis.siso_combined_f(trellis.fsm(${fsm_args}), ${block_size}, ${init_state},
+ ${final_state}, ${a_post_in}, ${a_post_out}, ${siso_type}, ${dim}, ${table},
+ ${metric_type})
+ callbacks:
+ - set_FSM(trellis.fsm(${fsm_args}))
+ - set_K(${block_size})
+ - set_S0(${init_state})
+ - set_SK(${final_state})
+ - set_POSTI(${a_post_in})
+ - set_POSTO(${a_post_out})
+ - set_SISO_TYPE(${siso_type})
+ - set_D(${dim})
+ - set_TABLE(${table})
+ - set_TYPE(${metric_type})
+
+documentation: |-
+ BCJR Algorithm combined with metric calculation. The fsm arguments are passed directly to the trellis.fsm() constructor.
+
+file_format: 1
diff --git a/gr-trellis/grc/trellis_siso_combined_f.xml b/gr-trellis/grc/trellis_siso_combined_f.xml
deleted file mode 100644
index f8ec9c2d2..000000000
--- a/gr-trellis/grc/trellis_siso_combined_f.xml
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Trellis SISO Combined
-###################################################
- -->
-
-
-<block>
- <name>SISO Combo</name>
- <key>trellis_siso_combined_f</key>
- <category>[Core]/Trellis Coding</category>
- <import>from gnuradio import trellis</import>
- <make>trellis.siso_combined_f(trellis.fsm($fsm_args), $block_size, $init_state, $final_state, $a_post_in, $a_post_out, $siso_type, $dim, $table, $metric_type)</make>
- <callback>set_FSM(trellis.fsm($fsm_args))</callback>
- <callback>set_K($block_size)</callback>
- <callback>set_S0($init_state)</callback>
- <callback>set_SK($final_state)</callback>
- <callback>set_POSTI($a_post_in)</callback>
- <callback>set_POSTO($a_post_out)</callback>
- <callback>set_SISO_TYPE($siso_type)</callback>
- <callback>set_D($dim)</callback>
- <callback>set_TABLE($table)</callback>
- <callback>set_TYPE($metric_type)</callback>
- <param>
- <name>FSM Args</name>
- <key>fsm_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Block Size</name>
- <key>block_size</key>
- <type>int</type>
- </param>
- <param>
- <name>Initial State</name>
- <key>init_state</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Final State</name>
- <key>final_state</key>
- <value>-1</value>
- <type>int</type>
- </param>
- <param>
- <name>A-posteriori In</name>
- <key>a_post_in</key>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>A-posteriori Out</name>
- <key>a_post_out</key>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>SISO Type</name>
- <key>siso_type</key>
- <type>enum</type>
- <option>
- <name>Min Sum</name>
- <key>trellis.TRELLIS_MIN_SUM</key>
- </option>
- <option>
- <name>Sum Product</name>
- <key>trellis.TRELLIS_SUM_PRODUCT</key>
- </option>
- </param>
- <param>
- <name>Dimensionality</name>
- <key>dim</key>
- <type>int</type>
- </param>
- <param>
- <name>Constellation</name>
- <key>table</key>
- <type>real_vector</type>
- </param>
- <param>
- <name>Metric Type</name>
- <key>metric_type</key>
- <type>enum</type>
- <option>
- <name>Euclidean</name>
- <key>trellis.TRELLIS_EUCLIDEAN</key>
- </option>
- <option>
- <name>Hard Symbol</name>
- <key>trellis.TRELLIS_HARD_SYMBOL</key>
- </option>
- <option>
- <name>Hard Bit</name>
- <key>trellis.TRELLIS_HARD_BIT</key>
- </option>
- </param>
- <sink>
- <name>in_i</name>
- <type>float</type>
- </sink>
- <sink>
- <name>in_o</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
- <doc>
-BCJR Algorithm combined with metric calculation. \
-The fsm arguments are passed directly to the trellis.fsm() constructor.
- </doc>
-</block>
diff --git a/gr-trellis/grc/trellis_siso_f.block.yml b/gr-trellis/grc/trellis_siso_f.block.yml
new file mode 100644
index 000000000..5687dee4e
--- /dev/null
+++ b/gr-trellis/grc/trellis_siso_f.block.yml
@@ -0,0 +1,67 @@
+id: trellis_siso_f
+label: SISO
+category: '[Core]/Trellis Coding'
+
+parameters:
+- id: fsm_args
+ label: FSM Args
+ dtype: raw
+- id: block_size
+ label: Block Size
+ dtype: int
+- id: init_state
+ label: Initial State
+ dtype: int
+ default: '0'
+- id: final_state
+ label: Final State
+ dtype: int
+ default: '-1'
+- id: a_post_in
+ label: A-posteriori In
+ dtype: enum
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: a_post_out
+ label: A-posteriori Out
+ dtype: enum
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: siso_type
+ label: SISO Type
+ dtype: enum
+ options: [trellis.TRELLIS_MIN_SUM, trellis.TRELLIS_SUM_PRODUCT]
+ option_labels: [Min Sum, Sum Product]
+
+inputs:
+- label: priori
+ domain: stream
+ dtype: float
+- label: prioro
+ domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: float
+
+asserts:
+- ${ (isinstance(eval(""" fsm_args """[1:-1], locals(),globals()), str) and open(fsm_args).close()) or True }
+
+templates:
+ imports: from gnuradio import trellis
+ make: trellis.siso_f(trellis.fsm(${fsm_args}), ${block_size}, ${init_state}, ${final_state},
+ ${a_post_in}, ${a_post_out}, ${siso_type})
+ callbacks:
+ - set_FSM(trellis.fsm(${fsm_args}))
+ - set_K(${block_size})
+ - set_S0(${init_state})
+ - set_SK(${final_state})
+ - set_POSTI(${a_post_in})
+ - set_POSTO(${a_post_out})
+ - set_SISO_TYPE(${siso_type})
+
+documentation: |-
+ BCJR Algorithm. The fsm arguments are passed directly to the trellis.fsm() constructor.
+
+file_format: 1
diff --git a/gr-trellis/grc/trellis_siso_f.xml b/gr-trellis/grc/trellis_siso_f.xml
deleted file mode 100644
index e121643e3..000000000
--- a/gr-trellis/grc/trellis_siso_f.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Trellis SISO
-###################################################
- -->
-
-
-<block>
- <name>SISO</name>
- <key>trellis_siso_f</key>
- <category>[Core]/Trellis Coding</category>
- <import>from gnuradio import trellis</import>
- <make>trellis.siso_f(trellis.fsm($fsm_args), $block_size, $init_state, $final_state, $a_post_in, $a_post_out, $siso_type)</make>
- <callback>set_FSM(trellis.fsm($fsm_args))</callback>
- <callback>set_K($block_size)</callback>
- <callback>set_S0($init_state)</callback>
- <callback>set_SK($final_state)</callback>
- <callback>set_POSTI($a_post_in)</callback>
- <callback>set_POSTO($a_post_out)</callback>
- <callback>set_SISO_TYPE($siso_type)</callback>
- <param>
- <name>FSM Args</name>
- <key>fsm_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Block Size</name>
- <key>block_size</key>
- <type>int</type>
- </param>
- <param>
- <name>Initial State</name>
- <key>init_state</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Final State</name>
- <key>final_state</key>
- <value>-1</value>
- <type>int</type>
- </param>
- <param>
- <name>A-posteriori In</name>
- <key>a_post_in</key>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>A-posteriori Out</name>
- <key>a_post_out</key>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>SISO Type</name>
- <key>siso_type</key>
- <type>enum</type>
- <option>
- <name>Min Sum</name>
- <key>trellis.TRELLIS_MIN_SUM</key>
- </option>
- <option>
- <name>Sum Product</name>
- <key>trellis.TRELLIS_SUM_PRODUCT</key>
- </option>
- </param>
- <check>(isinstance(eval(""" $fsm_args """[1:-1], locals(),globals()), str) and open($fsm_args).close()) or True</check>
- <sink>
- <name>priori</name>
- <type>float</type>
- </sink>
- <sink>
- <name>prioro</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
- <doc>
-BCJR Algorithm. \
-The fsm arguments are passed directly to the trellis.fsm() constructor.
- </doc>
-</block>
diff --git a/gr-trellis/grc/trellis_viterbi_combined_xx.block.yml b/gr-trellis/grc/trellis_viterbi_combined_xx.block.yml
new file mode 100644
index 000000000..8d1451e2d
--- /dev/null
+++ b/gr-trellis/grc/trellis_viterbi_combined_xx.block.yml
@@ -0,0 +1,76 @@
+id: trellis_viterbi_combined_xx
+label: Viterbi Combo
+category: '[Core]/Trellis Coding'
+
+parameters:
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [c, f, i, s]
+ option_labels: [Complex, Float, Int, Short]
+ option_attributes:
+ io: [complex, float, int, short]
+ table: [complex_vector, real_vector, int_vector, int_vector]
+ hide: part
+- id: out_type
+ label: Output Type
+ dtype: enum
+ options: [i, s, b]
+ option_labels: [Int, Short, Byte]
+ option_attributes:
+ io: [int, short, byte]
+ hide: part
+- id: fsm_args
+ label: FSM Args
+ dtype: raw
+- id: block_size
+ label: Block Size
+ dtype: int
+- id: init_state
+ label: Initial State
+ dtype: int
+ default: '0'
+- id: final_state
+ label: Final State
+ dtype: int
+ default: '-1'
+- id: dim
+ label: Dimensionality
+ dtype: int
+- id: table
+ label: Constellation
+ dtype: ${ type.table }
+- id: metric_type
+ label: Metric Type
+ dtype: enum
+ options: [digital.TRELLIS_EUCLIDEAN, digital.TRELLIS_HARD_SYMBOL, digital.TRELLIS_HARD_BIT]
+ option_labels: [Euclidean, Hard Symbol, Hard Bit]
+
+inputs:
+- domain: stream
+ dtype: ${ type.io }
+
+outputs:
+- domain: stream
+ dtype: ${ out_type.io }
+
+asserts:
+- ${ (isinstance(eval(""" fsm_args """[1:-1], locals(),globals()), str) and open(fsm_args).close()) or True }
+
+templates:
+ imports: from gnuradio import trellis, digital
+ make: trellis.viterbi_combined_${type}${out_type}(trellis.fsm(${fsm_args}), ${block_size},
+ ${init_state}, ${final_state}, ${dim}, ${table}, ${metric_type})
+ callbacks:
+ - set_FSM(trellis.fsm(${fsm_args}))
+ - set_K(${block_size})
+ - set_S0(${init_state})
+ - set_SK(${final_state})
+ - set_D(${dim})
+ - set_TABLE(${table})
+ - set_TYPE(${metric_type})
+
+documentation: |-
+ Viterbi Decoder combined with metric calculation. The fsm arguments are passed directly to the trellis.fsm() constructor.
+
+file_format: 1
diff --git a/gr-trellis/grc/trellis_viterbi_combined_xx.xml b/gr-trellis/grc/trellis_viterbi_combined_xx.xml
deleted file mode 100644
index a52e5ed2b..000000000
--- a/gr-trellis/grc/trellis_viterbi_combined_xx.xml
+++ /dev/null
@@ -1,133 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Trellis Viterbi Combined
-###################################################
- -->
-
-
-<block>
- <name>Viterbi Combo</name>
- <key>trellis_viterbi_combined_xx</key>
- <category>[Core]/Trellis Coding</category>
- <import>from gnuradio import trellis, digital</import>
- <make>trellis.viterbi_combined_$(type)$(out_type)(trellis.fsm($fsm_args), $block_size, $init_state, $final_state, $dim, $table, $metric_type)</make>
- <callback>set_FSM(trellis.fsm($fsm_args))</callback>
- <callback>set_K($block_size)</callback>
- <callback>set_S0($init_state)</callback>
- <callback>set_SK($final_state)</callback>
- <callback>set_D($dim)</callback>
- <callback>set_TABLE($table)</callback>
- <callback>set_TYPE($metric_type)</callback>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>c</key>
- <opt>io:complex</opt>
- <opt>table:complex_vector</opt>
- </option>
- <option>
- <name>Float</name>
- <key>f</key>
- <opt>io:float</opt>
- <opt>table:real_vector</opt>
- </option>
- <option>
- <name>Int</name>
- <key>i</key>
- <opt>io:int</opt>
- <opt>table:int_vector</opt>
- </option>
- <option>
- <name>Short</name>
- <key>s</key>
- <opt>io:short</opt>
- <opt>table:int_vector</opt>
- </option>
- </param>
- <param>
- <name>Output Type</name>
- <key>out_type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>i</key>
- <opt>io:int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>s</key>
- <opt>io:short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>b</key>
- <opt>io:byte</opt>
- </option>
- </param>
- <param>
- <name>FSM Args</name>
- <key>fsm_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Block Size</name>
- <key>block_size</key>
- <type>int</type>
- </param>
- <param>
- <name>Initial State</name>
- <key>init_state</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Final State</name>
- <key>final_state</key>
- <value>-1</value>
- <type>int</type>
- </param>
- <param>
- <name>Dimensionality</name>
- <key>dim</key>
- <type>int</type>
- </param>
- <param>
- <name>Constellation</name>
- <key>table</key>
- <type>$type.table</type>
- </param>
- <param>
- <name>Metric Type</name>
- <key>metric_type</key>
- <type>enum</type>
- <option>
- <name>Euclidean</name>
- <key>digital.TRELLIS_EUCLIDEAN</key>
- </option>
- <option>
- <name>Hard Symbol</name>
- <key>digital.TRELLIS_HARD_SYMBOL</key>
- </option>
- <option>
- <name>Hard Bit</name>
- <key>digital.TRELLIS_HARD_BIT</key>
- </option>
- </param>
- <check>(isinstance(eval(""" $fsm_args """[1:-1], locals(),globals()), str) and open($fsm_args).close()) or True</check>
- <sink>
- <name>in</name>
- <type>$type.io</type>
- </sink>
- <source>
- <name>out</name>
- <type>$out_type.io</type>
- </source>
- <doc>
-Viterbi Decoder combined with metric calculation. \
-The fsm arguments are passed directly to the trellis.fsm() constructor.
- </doc>
-</block>
diff --git a/gr-trellis/grc/trellis_viterbi_x.block.yml b/gr-trellis/grc/trellis_viterbi_x.block.yml
new file mode 100644
index 000000000..2caa5992e
--- /dev/null
+++ b/gr-trellis/grc/trellis_viterbi_x.block.yml
@@ -0,0 +1,53 @@
+id: trellis_viterbi_x
+label: Viterbi
+category: '[Core]/Trellis Coding'
+
+parameters:
+- id: type
+ label: Type
+ dtype: enum
+ options: [i, s, b]
+ option_labels: [Int, Short, Byte]
+ option_attributes:
+ io: [int, short, byte]
+ hide: part
+- id: fsm_args
+ label: FSM Args
+ dtype: raw
+- id: block_size
+ label: Block Size
+ dtype: int
+- id: init_state
+ label: Initial State
+ dtype: int
+ default: '0'
+- id: final_state
+ label: Final State
+ dtype: int
+ default: '-1'
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: ${ type.io }
+
+asserts:
+- ${ (isinstance(eval(""" fsm_args """[1:-1], locals(),globals()), str) and open(fsm_args).close()) or True }
+
+templates:
+ imports: from gnuradio import trellis
+ make: trellis.viterbi_${type}(trellis.fsm(${fsm_args}), ${block_size}, ${init_state},
+ ${final_state})
+ callbacks:
+ - set_FSM(trellis.fsm(${fsm_args}))
+ - set_K(${block_size})
+ - set_S0(${init_state})
+ - set_SK(${final_state})
+
+documentation: |-
+ Viterbi Decoder. The fsm arguments are passed directly to the trellis.fsm() constructor.
+
+file_format: 1
diff --git a/gr-trellis/grc/trellis_viterbi_x.xml b/gr-trellis/grc/trellis_viterbi_x.xml
deleted file mode 100644
index 21611ee51..000000000
--- a/gr-trellis/grc/trellis_viterbi_x.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Trellis Viterbi
-###################################################
- -->
-
-
-<block>
- <name>Viterbi</name>
- <key>trellis_viterbi_x</key>
- <category>[Core]/Trellis Coding</category>
- <import>from gnuradio import trellis</import>
- <make>trellis.viterbi_$(type)(trellis.fsm($fsm_args), $block_size, $init_state, $final_state)</make>
- <callback>set_FSM(trellis.fsm($fsm_args))</callback>
- <callback>set_K($block_size)</callback>
- <callback>set_S0($init_state)</callback>
- <callback>set_SK($final_state)</callback>
- <param>
- <name>Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Int</name>
- <key>i</key>
- <opt>io:int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>s</key>
- <opt>io:short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>b</key>
- <opt>io:byte</opt>
- </option>
- </param>
- <param>
- <name>FSM Args</name>
- <key>fsm_args</key>
- <type>raw</type>
- </param>
- <param>
- <name>Block Size</name>
- <key>block_size</key>
- <type>int</type>
- </param>
- <param>
- <name>Initial State</name>
- <key>init_state</key>
- <value>0</value>
- <type>int</type>
- </param>
- <param>
- <name>Final State</name>
- <key>final_state</key>
- <value>-1</value>
- <type>int</type>
- </param>
- <check>(isinstance(eval(""" $fsm_args """[1:-1], locals(),globals()), str) and open($fsm_args).close()) or True</check>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>$type.io</type>
- </source>
- <doc>
-Viterbi Decoder. \
-The fsm arguments are passed directly to the trellis.fsm() constructor.
- </doc>
-</block>
diff --git a/gr-trellis/python/trellis/CMakeLists.txt b/gr-trellis/python/trellis/CMakeLists.txt
index 10fd9d5c0..94a160b31 100644
--- a/gr-trellis/python/trellis/CMakeLists.txt
+++ b/gr-trellis/python/trellis/CMakeLists.txt
@@ -44,6 +44,6 @@ if(ENABLE_TESTING)
file(GLOB py_qa_test_files "qa_*.py")
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gr-trellis/python/trellis/__init__.py b/gr-trellis/python/trellis/__init__.py
index a6b5ed003..445a38142 100644
--- a/gr-trellis/python/trellis/__init__.py
+++ b/gr-trellis/python/trellis/__init__.py
@@ -21,15 +21,16 @@
'''
Blocks and utilities for trellis coding and related.
'''
+from __future__ import unicode_literals
# The presence of this file turns this directory into a Python package
import os
try:
- from trellis_swig import *
+ from .trellis_swig import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
- from trellis_swig import *
+ from .trellis_swig import *
# import any pure python here
diff --git a/gr-trellis/python/trellis/fsm_utils.py b/gr-trellis/python/trellis/fsm_utils.py
index 72aa1d366..efc526c0e 100755..100644
--- a/gr-trellis/python/trellis/fsm_utils.py
+++ b/gr-trellis/python/trellis/fsm_utils.py
@@ -20,11 +20,13 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
-import re
import math
import sys
-import operator
+
import numpy
#from gnuradio import trellis
@@ -32,7 +34,7 @@ import numpy
try:
import scipy.linalg
except ImportError:
- print "Error: Program requires scipy (see: www.scipy.org)."
+ print("Error: Program requires scipy (see: www.scipy.org).")
sys.exit(1)
@@ -43,13 +45,13 @@ except ImportError:
# to base 'base' (most significant symbol first).
######################################################################
def dec2base(num,base,l):
- s=range(l)
+ s=list(range(l))
n=num
for i in range(l):
s[l-i-1]=n%base
- n=int(n/base)
+ n=int(n / base)
if n!=0:
- print 'Number ', num, ' requires more than ', l, 'digits.'
+ print('Number ', num, ' requires more than ', l, 'digits.')
return s
@@ -84,9 +86,9 @@ def make_isi_lookup(mod,channel,normalize):
for i in range(len(channel)):
p = p + channel[i]**2
for i in range(len(channel)):
- channel[i] = channel[i]/math.sqrt(p)
+ channel[i] = channel[i] / math.sqrt(p)
- lookup=range(len(constellation)**len(channel))
+ lookup=list(range(len(constellation)**len(channel)))
for o in range(len(constellation)**len(channel)):
ss=dec2base(o,len(constellation),len(channel))
ll=0
@@ -109,11 +111,11 @@ def make_isi_lookup(mod,channel,normalize):
######################################################################
def make_cpm_signals(K,P,M,L,q,frac):
- Q=numpy.size(q)/L
- h=(1.0*K)/P
+ Q=numpy.size(q) / L
+ h=(1.0*K) / P
f0=-h*(M-1)/2
dt=0.0; # maybe start at t=0.5
- t=(dt+numpy.arange(0,Q))/Q
+ t=(dt+numpy.arange(0 / Q),Q)
qq=numpy.zeros(Q)
for m in range(L):
qq=qq + q[m*Q:m*Q+Q]
@@ -122,46 +124,46 @@ def make_cpm_signals(K,P,M,L,q,frac):
X=(M**L)*P
PSI=numpy.empty((X,Q))
for x in range(X):
- xv=dec2base(x/P,M,L)
+ xv=dec2base(x / P,M,L)
xv=numpy.append(xv, x%P)
qq1=numpy.zeros(Q)
for m in range(L):
qq1=qq1+xv[m]*q[m*Q:m*Q+Q]
psi=2*math.pi*h*xv[-1]+4*math.pi*h*qq1+w
- #print psi
+ #print(psi)
PSI[x]=psi
PSI = numpy.transpose(PSI)
SS=numpy.exp(1j*PSI) # contains all signals as columns
- #print SS
+ #print(SS)
# Now we need to orthogonalize the signals
F = scipy.linalg.orth(SS) # find an orthonormal basis for SS
- #print numpy.dot(numpy.transpose(F.conjugate()),F) # check for orthonormality
+ #print(numpy.dot(numpy.transpose(F.conjugate()),F) # check for orthonormality)
S = numpy.dot(numpy.transpose(F.conjugate()),SS)
- #print F
- #print S
+ #print(F)
+ #print(S)
# We only want to keep those dimensions that contain most
# of the energy of the overall constellation (eg, frac=0.9 ==> 90%)
# evaluate mean energy in each dimension
- E=numpy.sum(numpy.absolute(S)**2,axis=1)/Q
- E=E/numpy.sum(E)
- #print E
+ E=numpy.sum(numpy.absolute(S)**2, axis=1) / Q
+ E=E / numpy.sum(E)
+ #print(E)
Es = -numpy.sort(-E)
Esi = numpy.argsort(-E)
- #print Es
- #print Esi
+ #print(Es)
+ #print(Esi)
Ecum=numpy.cumsum(Es)
- #print Ecum
+ #print(Ecum)
v0=numpy.searchsorted(Ecum,frac)
N = v0+1
- #print v0
- #print Esi[0:v0+1]
+ #print(v0)
+ #print(Esi[0:v0+1])
Ff=numpy.transpose(numpy.transpose(F)[Esi[0:v0+1]])
- #print Ff
+ #print(Ff)
Sf = S[Esi[0:v0+1]]
- #print Sf
+ #print(Sf)
return (f0,SS,S,F,Sf,Ff,N)
diff --git a/gr-trellis/python/trellis/qa_trellis.py b/gr-trellis/python/trellis/qa_trellis.py
index 0ed802a0f..6d14fefe8 100755..100644
--- a/gr-trellis/python/trellis/qa_trellis.py
+++ b/gr-trellis/python/trellis/qa_trellis.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import math
import os
@@ -71,7 +73,7 @@ class test_trellis (gr_unittest.TestCase):
Runs some coding/decoding tests with a few different FSM
specs.
"""
- for name, args in fsm_args.items():
+ for name, args in list(fsm_args.items()):
constellation = constells[args[2]]
fsms = trellis.fsm(*args)
noise = 0.1
@@ -85,7 +87,7 @@ class trellis_tb(gr.top_block):
"""
A simple top block for use testing gr-trellis.
"""
- def __init__(self, constellation, f, N0=0.25, seed=-666L):
+ def __init__(self, constellation, f, N0=0.25, seed=-666):
"""
constellation - a constellation object used for modulation.
f - a finite state machine specification used for coding.
@@ -96,14 +98,14 @@ class trellis_tb(gr.top_block):
# packet size in bits (make it multiple of 16 so it can be packed in a short)
packet_size = 1024*16
# bits per FSM input symbol
- bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM input symbol
+ bitspersymbol = int(round(math.log(f.I()) / math.log(2))) # bits per FSM input symbol
# packet size in trellis steps
- K = packet_size/bitspersymbol
+ K = packet_size // bitspersymbol
# TX
src = blocks.lfsr_32k_source_s()
# packet size in shorts
- src_head = blocks.head(gr.sizeof_short, packet_size/16)
+ src_head = blocks.head(gr.sizeof_short, packet_size // 16)
# unpack shorts to symbols compatible with the FSM input cardinality
s2fsmi = blocks.packed_to_unpacked_ss(bitspersymbol, gr.GR_MSB_FIRST)
# initial FSM state = 0
@@ -112,7 +114,7 @@ class trellis_tb(gr.top_block):
# CHANNEL
add = blocks.add_cc()
- noise = analog.noise_source_c(analog.GR_GAUSSIAN,math.sqrt(N0/2),seed)
+ noise = analog.noise_source_c(analog.GR_GAUSSIAN,math.sqrt(N0 / 2),seed)
# RX
# data preprocessing to generate metrics for Viterbi
diff --git a/gr-trellis/swig/trellis_swig.py.in b/gr-trellis/swig/trellis_swig.py.in
index fac5f631e..f49e04e0a 100644
--- a/gr-trellis/swig/trellis_swig.py.in
+++ b/gr-trellis/swig/trellis_swig.py.in
@@ -19,5 +19,7 @@
# Boston, MA 02110-1301, USA.
#
-from trellis_swig0 import *
-from trellis_swig1 import *
+from __future__ import absolute_import
+
+from .trellis_swig0 import *
+from .trellis_swig1 import *
diff --git a/gr-uhd/CMakeLists.txt b/gr-uhd/CMakeLists.txt
index 74c815927..e7a25e51e 100644
--- a/gr-uhd/CMakeLists.txt
+++ b/gr-uhd/CMakeLists.txt
@@ -59,7 +59,7 @@ add_subdirectory(examples/c++)
if(ENABLE_PYTHON)
add_subdirectory(swig)
add_subdirectory(python/uhd)
- add_subdirectory(grc)
+ #add_subdirectory(grc)
add_subdirectory(apps)
add_subdirectory(examples/grc)
endif(ENABLE_PYTHON)
diff --git a/gr-uhd/apps/uhd_app.py b/gr-uhd/apps/uhd_app.py
index 5c8881ce3..5a8290fe5 100644
--- a/gr-uhd/apps/uhd_app.py
+++ b/gr-uhd/apps/uhd_app.py
@@ -24,6 +24,8 @@ USRP Helper Module: Common tasks for uhd-based apps.
"""
from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
import sys
import time
import argparse
@@ -163,18 +165,18 @@ class UHDApp(object):
self.spec = self.normalize_sel("mboards", "subdev",
self.usrp.get_num_mboards(), args.spec)
if self.spec:
- for mb_idx in xrange(self.usrp.get_num_mboards()):
+ for mb_idx in range(self.usrp.get_num_mboards()):
self.usrp.set_subdev_spec(self.spec[mb_idx], mb_idx)
# Set the clock and/or time source:
if args.clock_source is not None:
self.clock_source = self.normalize_sel("mboards", "clock-source",
self.usrp.get_num_mboards(), args.clock_source)
- for mb_idx in xrange(self.usrp.get_num_mboards()):
+ for mb_idx in range(self.usrp.get_num_mboards()):
self.usrp.set_clock_source(self.clock_source[mb_idx], mb_idx)
if args.time_source is not None:
self.time_source = self.normalize_sel("mboards", "time-source",
self.usrp.get_num_mboards(), args.time_source)
- for mb_idx in xrange(self.usrp.get_num_mboards()):
+ for mb_idx in range(self.usrp.get_num_mboards()):
self.usrp.set_time_source(self.time_source[mb_idx], mb_idx)
# Sampling rate:
self.usrp.set_samp_rate(args.samp_rate)
@@ -235,7 +237,7 @@ class UHDApp(object):
self.usrp.set_time_unknown_pps(uhd.time_spec())
cmd_time = self.usrp.get_time_now() + uhd.time_spec(COMMAND_DELAY)
try:
- for mb_idx in xrange(self.usrp.get_num_mboards()):
+ for mb_idx in range(self.usrp.get_num_mboards()):
self.usrp.set_command_time(cmd_time, mb_idx)
command_time_set = True
except RuntimeError:
@@ -248,7 +250,7 @@ class UHDApp(object):
))
exit(1)
if command_time_set:
- for mb_idx in xrange(self.usrp.get_num_mboards()):
+ for mb_idx in range(self.usrp.get_num_mboards()):
self.usrp.clear_command_time(mb_idx)
self.vprint("Syncing channels...".format(prefix=self.prefix))
time.sleep(COMMAND_DELAY)
@@ -283,7 +285,7 @@ class UHDApp(object):
"""
Safely tune all channels to freq.
"""
- self.vprint("Tuning all channels to {freq} MHz.".format(freq=freq/1e6))
+ self.vprint("Tuning all channels to {freq} MHz.".format(freq=freq / 1e6))
# Set frequency (tune request takes lo_offset):
if hasattr(self.args, 'lo_offset') and self.args.lo_offset is not None:
treq = uhd.tune_request(freq, self.args.lo_offset)
@@ -310,7 +312,7 @@ class UHDApp(object):
if len(self.channels) > 1 and not skip_sync:
cmd_time = self.usrp.get_time_now() + uhd.time_spec(COMMAND_DELAY)
try:
- for mb_idx in xrange(self.usrp.get_num_mboards()):
+ for mb_idx in range(self.usrp.get_num_mboards()):
self.usrp.set_command_time(cmd_time, mb_idx)
command_time_set = True
except RuntimeError:
@@ -323,12 +325,12 @@ class UHDApp(object):
))
exit(1)
if command_time_set:
- for mb_idx in xrange(self.usrp.get_num_mboards()):
+ for mb_idx in range(self.usrp.get_num_mboards()):
self.usrp.clear_command_time(mb_idx)
self.vprint("Syncing channels...".format(prefix=self.prefix))
time.sleep(COMMAND_DELAY)
self.freq = self.usrp.get_center_freq(0)
- self.vprint("First channel has freq: {freq} MHz.".format(freq=self.freq/1e6))
+ self.vprint("First channel has freq: {freq} MHz.".format(freq=self.freq / 1e6))
@staticmethod
def setup_argparser(
@@ -390,4 +392,3 @@ class UHDApp(object):
group.add_argument("--time-source",
help="Set the time source")
return parser
-
diff --git a/gr-uhd/apps/uhd_fft b/gr-uhd/apps/uhd_fft
index 4cb5eed0d..777461fd6 100755
--- a/gr-uhd/apps/uhd_fft
+++ b/gr-uhd/apps/uhd_fft
@@ -218,7 +218,7 @@ class uhd_fft(gr.top_block, Qt.QWidget, UHDApp):
self.qtgui_waterfall_sink_x_0.enable_grid(False)
self.qtgui_waterfall_sink_x_0.disable_legend()
alpha = 10.**(len(self.channels)-1)
- for i in xrange(len(self.channels)):
+ for i in range(len(self.channels)):
self.qtgui_waterfall_sink_x_0.set_line_label(i, "Channel {0}".format(i))
self.qtgui_waterfall_sink_x_0.set_color_map(i, 0)
self.qtgui_waterfall_sink_x_0.set_line_alpha(i, alpha)
@@ -240,7 +240,7 @@ class uhd_fft(gr.top_block, Qt.QWidget, UHDApp):
self.qtgui_time_sink_x_0.enable_grid(False)
self.qtgui_time_sink_x_0.enable_control_panel(True)
self.qtgui_time_sink_x_0.disable_legend()
- for i in xrange(2*len(self.channels)):
+ for i in range(2*len(self.channels)):
if(i % 2 == 0):
self.qtgui_time_sink_x_0.set_line_label(i, "Re{{Channel {0}}}".format(i/2))
else:
@@ -268,7 +268,7 @@ class uhd_fft(gr.top_block, Qt.QWidget, UHDApp):
self.qtgui_freq_sink_x_0.set_fft_average(self.fft_average)
self.qtgui_freq_sink_x_0.enable_control_panel(True)
self.qtgui_freq_sink_x_0.disable_legend()
- for i in xrange(len(self.channels)):
+ for i in range(len(self.channels)):
self.qtgui_freq_sink_x_0.set_line_label(i, "Channel {0}".format(i))
self.qtgui_freq_sink_x_0.set_line_width(i, widths[i])
self.qtgui_freq_sink_x_0.set_line_color(i, colors[i])
@@ -305,7 +305,7 @@ class uhd_fft(gr.top_block, Qt.QWidget, UHDApp):
self.qtgui_phase_plot.enable_grid(True)
self.qtgui_phase_plot.enable_control_panel(True)
self.qtgui_phase_plot.disable_legend()
- for i in xrange(len(self.channels) - 1):
+ for i in range(len(self.channels) - 1):
self.qtgui_phase_plot.set_line_label(i, "Phase Delta Channels {0}/{1}".format(i, i+1))
self.qtgui_phase_plot.set_line_width(i, widths[i])
self.qtgui_phase_plot.set_line_color(i, colors[i])
diff --git a/gr-uhd/apps/uhd_rx_cfile b/gr-uhd/apps/uhd_rx_cfile
index 2a1ed0fcb..d41027ff3 100755
--- a/gr-uhd/apps/uhd_rx_cfile
+++ b/gr-uhd/apps/uhd_rx_cfile
@@ -79,7 +79,7 @@ class rx_cfile_block(gr.top_block):
)
# Set the subdevice spec:
if options.spec:
- for mb_idx in xrange(self._u.get_num_mboards()):
+ for mb_idx in range(self._u.get_num_mboards()):
self._u.set_subdev_spec(options.spec, mb_idx)
# Set the antenna:
if options.antenna is not None:
@@ -125,7 +125,7 @@ class rx_cfile_block(gr.top_block):
self._u.set_time_unknown_pps(uhd.time_spec())
cmd_time = self._u.get_time_now() + uhd.time_spec(COMMAND_DELAY)
try:
- for mb_idx in xrange(self._u.get_num_mboards()):
+ for mb_idx in range(self._u.get_num_mboards()):
self._u.set_command_time(cmd_time, mb_idx)
command_time_set = True
except RuntimeError:
@@ -136,7 +136,7 @@ class rx_cfile_block(gr.top_block):
sys.stderr.write('[UHD_RX] [ERROR] Failed to set center frequency on channel {chan}\n'.format(chan=chan))
exit(1)
if command_time_set:
- for mb_idx in xrange(self._u.get_num_mboards()):
+ for mb_idx in range(self._u.get_num_mboards()):
self._u.clear_command_time(mb_idx)
print("[UHD_RX] Syncing channels...")
time.sleep(COMMAND_DELAY)
diff --git a/gr-uhd/apps/uhd_siggen_base.py b/gr-uhd/apps/uhd_siggen_base.py
index cc699dd14..9714810cd 100644
--- a/gr-uhd/apps/uhd_siggen_base.py
+++ b/gr-uhd/apps/uhd_siggen_base.py
@@ -24,6 +24,8 @@ Provide a base flow graph for USRP signal generators.
"""
from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
import math
try:
from uhd_app import UHDApp
@@ -124,7 +126,7 @@ class USRPSiggen(gr.top_block, pubsub, UHDApp):
"""
When sampling rate is updated, also update the signal sources.
"""
- self.vprint("Setting sampling rate to: {rate} Msps".format(rate=samp_rate/1e6))
+ self.vprint("Setting sampling rate to: {rate} Msps".format(rate=samp_rate / 1e6))
self.usrp.set_samp_rate(samp_rate)
samp_rate = self.usrp.get_samp_rate()
if self[TYPE_KEY] in (analog.GR_SIN_WAVE, analog.GR_CONST_WAVE):
@@ -137,7 +139,7 @@ class USRPSiggen(gr.top_block, pubsub, UHDApp):
self._src2.set_sampling_freq(self[WAVEFORM_FREQ_KEY]*2*math.pi/self[SAMP_RATE_KEY])
else:
return True # Waveform not yet set
- self.vprint("Set sample rate to: {rate} Msps".format(rate=samp_rate/1e6))
+ self.vprint("Set sample rate to: {rate} Msps".format(rate=samp_rate / 1e6))
return True
def set_waveform_freq(self, freq):
@@ -184,14 +186,14 @@ class USRPSiggen(gr.top_block, pubsub, UHDApp):
self._src1 = analog.sig_source_c(self[SAMP_RATE_KEY],
analog.GR_SIN_WAVE,
self[WAVEFORM_FREQ_KEY],
- self[AMPLITUDE_KEY]/2.0,
+ self[AMPLITUDE_KEY] / 2.0,
0)
if self[WAVEFORM2_FREQ_KEY] is None:
self[WAVEFORM2_FREQ_KEY] = -self[WAVEFORM_FREQ_KEY]
self._src2 = analog.sig_source_c(self[SAMP_RATE_KEY],
analog.GR_SIN_WAVE,
self[WAVEFORM2_FREQ_KEY],
- self[AMPLITUDE_KEY]/2.0,
+ self[AMPLITUDE_KEY] / 2.0,
0)
self._src = blocks.add_cc()
self.connect(self._src1, (self._src, 0))
@@ -213,7 +215,7 @@ class USRPSiggen(gr.top_block, pubsub, UHDApp):
self.connect(self._src1, self._src2, self._src)
else:
raise RuntimeError("[UHD-SIGGEN] Unknown waveform waveform_type")
- for chan in xrange(len(self.channels)):
+ for chan in range(len(self.channels)):
self.connect(self._src, (self.usrp, chan))
if self.extra_sink is not None:
self.connect(self._src, self.extra_sink)
@@ -226,7 +228,7 @@ class USRPSiggen(gr.top_block, pubsub, UHDApp):
self.vprint("Tone 1: %sHz" % (n2s(self[WAVEFORM_FREQ_KEY]),))
self.vprint("Tone 2: %sHz" % (n2s(self[WAVEFORM2_FREQ_KEY]),))
elif waveform_type == "sweep":
- self.vprint("Sweeping across %sHz to %sHz" % (n2s(-self[WAVEFORM_FREQ_KEY]/2.0), n2s(self[WAVEFORM_FREQ_KEY]/2.0)))
+ self.vprint("Sweeping across %sHz to %sHz" % (n2s(-self[WAVEFORM_FREQ_KEY] / 2.0), n2s(self[WAVEFORM_FREQ_KEY] / 2.0)))
self.vprint("Sweep rate: %sHz" % (n2s(self[WAVEFORM2_FREQ_KEY]),))
self.vprint("TX amplitude:", self[AMPLITUDE_KEY])
@@ -240,8 +242,8 @@ class USRPSiggen(gr.top_block, pubsub, UHDApp):
if self[TYPE_KEY] in (analog.GR_SIN_WAVE, analog.GR_CONST_WAVE, analog.GR_GAUSSIAN, analog.GR_UNIFORM):
self._src.set_amplitude(amplitude)
elif self[TYPE_KEY] == "2tone":
- self._src1.set_amplitude(amplitude/2.0)
- self._src2.set_amplitude(amplitude/2.0)
+ self._src1.set_amplitude(amplitude / 2.0)
+ self._src2.set_amplitude(amplitude / 2.0)
elif self[TYPE_KEY] == "sweep":
self._src.set_k(amplitude)
else:
@@ -293,7 +295,7 @@ def main():
print(ex)
exit(1)
tb.start()
- raw_input('[UHD-SIGGEN] Press Enter to quit:\n')
+ input('[UHD-SIGGEN] Press Enter to quit:\n')
tb.stop()
tb.wait()
diff --git a/gr-uhd/grc/CMakeLists.txt b/gr-uhd/grc/CMakeLists.txt
index d748bface..72a6543df 100644
--- a/gr-uhd/grc/CMakeLists.txt
+++ b/gr-uhd/grc/CMakeLists.txt
@@ -18,28 +18,28 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Rules for generating the source and sink xml wrappers
+# Rules for generating the source and sink yml wrappers
########################################################################
include(GrPython)
-macro(GEN_BLOCK_XML _generator _xml_block)
+macro(GEN_BLOCK_YML _generator _yml_block)
set(generator ${CMAKE_CURRENT_SOURCE_DIR}/${_generator})
- set(xml_block ${CMAKE_CURRENT_BINARY_DIR}/${_xml_block})
- list(APPEND xml_blocks ${xml_block})
+ set(yml_block ${CMAKE_CURRENT_BINARY_DIR}/${_yml_block})
+ list(APPEND yml_blocks ${yml_block})
add_custom_command(
- DEPENDS ${generator} OUTPUT ${xml_block}
- COMMAND ${PYTHON_EXECUTABLE} ${generator} ${xml_block}
+ DEPENDS ${generator} OUTPUT ${yml_block}
+ COMMAND ${PYTHON_EXECUTABLE} ${generator} ${yml_block}
)
-endmacro(GEN_BLOCK_XML)
+endmacro(GEN_BLOCK_YML)
-GEN_BLOCK_XML(gen_uhd_usrp_blocks.py uhd_usrp_source.xml)
-GEN_BLOCK_XML(gen_uhd_usrp_blocks.py uhd_usrp_sink.xml)
+GEN_BLOCK_YML(gen_uhd_usrp_blocks.py uhd_usrp_source.block.yml)
+GEN_BLOCK_YML(gen_uhd_usrp_blocks.py uhd_usrp_sink.block.yml)
-add_custom_target(uhd_grc_xml_blocks ALL DEPENDS ${xml_blocks})
+add_custom_target(uhd_grc_yml_blocks ALL DEPENDS ${yml_blocks})
install(FILES
- ${xml_blocks}
- uhd_amsg_source.xml
- uhd_block_tree.xml
+ ${yml_blocks}
+ uhd_amsg_source.block.yml
+ uhd.tree.yml
DESTINATION ${GRC_BLOCKS_DIR}
)
diff --git a/gr-uhd/grc/gen_uhd_usrp_blocks.py b/gr-uhd/grc/gen_uhd_usrp_blocks.py
index 8b7c58682..4a7b484f7 100644
--- a/gr-uhd/grc/gen_uhd_usrp_blocks.py
+++ b/gr-uhd/grc/gen_uhd_usrp_blocks.py
@@ -19,696 +19,372 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
MAIN_TMPL = """\
-<?xml version="1.0"?>
-<block>
- <name>UHD: USRP $sourk.title()</name>
- <key>uhd_usrp_$(sourk)</key>
- <flags>throttle</flags>
- <import>from gnuradio import uhd</import>
- <import>import time</import>
- <make>uhd.usrp_$(sourk)(
- ",".join((\$dev_addr, \$dev_args)),
- uhd.stream_args(
- cpu_format="\$type",
- \#if \$otw()
- otw_format=\$otw,
- \#end if
- \#if \$stream_args()
- args=\$stream_args,
- \#end if
- \#if \$stream_chans()
- channels=\$stream_chans,
- \#else
- channels=range(\$nchan),
- \#end if
- ),$lentag_arg
-)
-\#if \$clock_rate()
-self.\$(id).set_clock_rate(\$clock_rate, uhd.ALL_MBOARDS)
-\#end if
-#for $m in range($max_mboards)
-########################################################################
-\#if \$num_mboards() > $m and \$clock_source$(m)()
-self.\$(id).set_clock_source(\$clock_source$(m), $m)
-\#end if
-########################################################################
-\#if \$num_mboards() > $m and \$time_source$(m)()
-self.\$(id).set_time_source(\$time_source$(m), $m)
-\#end if
-########################################################################
-\#if \$num_mboards() > $m and \$sd_spec$(m)()
-self.\$(id).set_subdev_spec(\$sd_spec$(m), $m)
-\#end if
-########################################################################
-#end for
-self.\$(id).set_samp_rate(\$samp_rate)
-\#if \$sync() == 'sync'
-self.\$(id).set_time_unknown_pps(uhd.time_spec())
-\#elif \$sync() == 'pc_clock'
-self.\$(id).set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS)
-\#end if
-#for $n in range($max_nchan)
-\#if \$nchan() > $n
-self.\$(id).set_center_freq(\$center_freq$(n), $n)
-\#if \$norm_gain${n}()
-self.\$(id).set_normalized_gain(\$gain$(n), $n)
-\#else
-self.\$(id).set_gain(\$gain$(n), $n)
-\#end if
- \#if \$ant$(n)()
-self.\$(id).set_antenna(\$ant$(n), $n)
- \#end if
- \#if \$bw$(n)()
-self.\$(id).set_bandwidth(\$bw$(n), $n)
- \#end if
-#if $sourk == 'source'
- \#if \$lo_export$(n)() and not \$hide_lo_controls()
-self.\$(id).set_lo_export_enabled(\$lo_export$(n), uhd.ALL_LOS, $n)
- \#end if
- \#if \$lo_source$(n)() and not \$hide_lo_controls()
-self.\$(id).set_lo_source(\$lo_source$(n), uhd.ALL_LOS, $n)
- \#end if
- \#if \$dc_offs_enb$(n)()
-self.\$(id).set_auto_dc_offset(\$dc_offs_enb$(n), $n)
- \#end if
- \#if \$iq_imbal_enb$(n)()
-self.\$(id).set_auto_iq_balance(\$iq_imbal_enb$(n), $n)
- \#end if
-#end if
-\#end if
-#end for
-</make>
- <callback>set_samp_rate(\$samp_rate)</callback>
- #for $n in range($max_nchan)
- <callback>set_center_freq(\$center_freq$(n), $n)</callback>
- <callback>\#if \$norm_gain${n}()
-self.\$(id).set_normalized_gain(\$gain$(n), $n)
-\#else
-self.\$(id).set_gain(\$gain$(n), $n)
-\#end if
- </callback>
- <callback>\#if not \$hide_lo_controls()
-set_lo_source(\$lo_source$(n), uhd.ALL_LOS, $n)
-\#end if
- </callback>
- <callback>\#if not \$hide_lo_controls()
-set_lo_export_enabled(\$lo_export$(n), uhd.ALL_LOS, $n)
-\#end if
- </callback>
- <callback>set_antenna(\$ant$(n), $n)</callback>
- <callback>set_bandwidth(\$bw$(n), $n)</callback>
- #end for
- <param>
- <name>$(direction.title())put Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex float32</name>
- <key>fc32</key>
- <opt>type:fc32</opt>
- </option>
- <option>
- <name>Complex int16</name>
- <key>sc16</key>
- <opt>type:sc16</opt>
- </option>
- <option>
- <name>VITA word32</name>
- <key>item32</key>
- <opt>type:s32</opt>
- </option>
- </param>
- <param>
- <name>Wire Format</name>
- <key>otw</key>
- <value></value>
- <type>string</type>
- <hide>
- \#if \$otw()
- none
- \#else
- part
- \#end if
- </hide>
- <option>
- <name>Automatic</name>
- <key></key>
- </option>
- <option>
- <name>Complex int16</name>
- <key>sc16</key>
- </option>
- <option>
- <name>Complex int12</name>
- <key>sc12</key>
- </option>
- <option>
- <name>Complex int8</name>
- <key>sc8</key>
- </option>
- </param>
- <param>
- <name>Stream args</name>
- <key>stream_args</key>
- <value></value>
- <type>string</type>
- <hide>
- \#if \$stream_args()
- none
- \#else
- part
- \#end if
- </hide>
- <option>
- <name>peak=0.003906</name>
- <key>peak=0.003906</key>
- </option>
- </param>
- <param>
- <name>Stream channels</name>
- <key>stream_chans</key>
- <value>[]</value>
- <type>int_vector</type>
- <hide>
- \#if \$stream_chans()
- none
- \#else
- part
- \#end if
- </hide>
- </param>
- <param>
- <name>Device Address</name>
- <key>dev_addr</key>
- <value>""</value>
- <type>string</type>
- <hide>
- \#if \$dev_addr()
- none
- \#else
- part
- \#end if
- </hide>
- </param>
- <param>
- <name>Device Arguments</name>
- <key>dev_args</key>
- <value>""</value>
- <type>string</type>
- <hide>
- \#if \$dev_args()
- none
- \#else
- part
- \#end if
- </hide>
- </param>
- <param>
- <name>Sync</name>
- <key>sync</key>
- <value></value>
- <type>enum</type>
- <hide>\#if \$sync() then 'none' else 'part'#</hide>
- <option>
- <name>unknown PPS</name>
- <key>sync</key>
- </option>
- <option>
- <name>PC Clock</name>
- <key>pc_clock</key>
- </option>
- <option>
- <name>don't sync</name>
- <key></key>
- </option>
- </param>
- <param>
- <name>Clock Rate (Hz)</name>
- <key>clock_rate</key>
- <value>0.0</value>
- <type>real</type>
- <hide>\#if \$clock_rate() then 'none' else 'part'#</hide>
- <option>
- <name>Default</name>
- <key>0.0</key>
- </option>
- <option>
- <name>200 MHz</name>
- <key>200e6</key>
- </option>
- <option>
- <name>184.32 MHz</name>
- <key>184.32e6</key>
- </option>
- <option>
- <name>120 MHz</name>
- <key>120e6</key>
- </option>
- <option>
- <name>30.72 MHz</name>
- <key>30.72e6</key>
- </option>
- </param>
- <param>
- <name>Num Mboards</name>
- <key>num_mboards</key>
- <value>1</value>
- <type>int</type>
- <hide>part</hide>
- #for $m in range(1, $max_mboards+1)
- <option>
- <name>$(m)</name>
- <key>$m</key>
- </option>
- #end for
- </param>
- #for $m in range($max_mboards)
- <param>
- <name>Mb$(m): Clock Source</name>
- <key>clock_source$(m)</key>
- <value></value>
- <type>string</type>
- <hide>
- \#if not \$num_mboards() > $m
- all
- \#elif \$clock_source$(m)()
- none
- \#else
- part
- \#end if
- </hide>
- <option><name>Default</name><key></key></option>
- <option><name>Internal</name><key>internal</key></option>
- <option><name>External</name><key>external</key></option>
- <option><name>MIMO Cable</name><key>mimo</key></option>
- <option><name>O/B GPSDO</name><key>gpsdo</key></option>
- </param>
- <param>
- <name>Mb$(m): Time Source</name>
- <key>time_source$(m)</key>
- <value></value>
- <type>string</type>
- <hide>
- \#if not \$num_mboards() > $m
- all
- \#elif \$time_source$(m)()
- none
- \#else
- part
- \#end if
- </hide>
- <option><name>Default</name><key></key></option>
- <option><name>External</name><key>external</key></option>
- <option><name>MIMO Cable</name><key>mimo</key></option>
- <option><name>O/B GPSDO</name><key>gpsdo</key></option>
- </param>
- <param>
- <name>Mb$(m): Subdev Spec</name>
- <key>sd_spec$(m)</key>
- <value></value>
- <type>string</type>
- <hide>
- \#if not \$num_mboards() > $m
- all
- \#elif \$sd_spec$(m)()
- none
- \#else
- part
- \#end if
- </hide>
- </param>
- #end for
- <param>
- <name>Num Channels</name>
- <key>nchan</key>
- <value>1</value>
- <type>int</type>
- #for $n in range(1, $max_nchan+1)
- <option>
- <name>$(n)</name>
- <key>$n</key>
- </option>
- #end for
- </param>
- <param>
- <name>Samp Rate (Sps)</name>
- <key>samp_rate</key>
- <value>samp_rate</value>
- <type>real</type>
- </param>
- $params
- <check>$max_nchan >= \$nchan</check>
- <check>\$nchan > 0</check>
- <check>$max_mboards >= \$num_mboards</check>
- <check>\$num_mboards > 0</check>
- <check>\$nchan >= \$num_mboards</check>
- <check>(not \$stream_chans()) or (\$nchan == len(\$stream_chans))</check>
- #for $n in range($max_nchan)
- <check>(\$norm_gain${n} and \$gain${n} &gt;= 0 and \$gain${n} &lt;= 1) or not \$norm_gain${n}</check>
- #end for
- <sink>
- <name>command</name>
- <type>message</type>
- <optional>1</optional>
- <hide>\$hide_cmd_port</hide>
- </sink>
- <$sourk>
- <name>$direction</name>
- <type>\$type.type</type>
- <nports>\$nchan</nports>
- </$sourk>
- <doc>
-The UHD USRP $sourk.title() Block:
-
-Device Address:
-The device address is a delimited string used to locate UHD devices on your system. \\
-If left blank, the first UHD device found will be used. \\
-Use the device address to specify a specific device or list of devices.
-USRP1 Example: serial=12345678
-USRP2 Example: addr=192.168.10.2
-USRP2 Example: addr0=192.168.10.2, addr1=192.168.10.3
-
-$(direction.title()) Type:
-This parameter controls the data type of the stream in gnuradio.
-
-Wire Format:
-This parameter controls the form of the data over the bus/network. \
-Complex bytes may be used to trade off precision for bandwidth. \
-Not all formats are supported on all devices.
-
-Stream Args:
-Optional arguments to be passed in the UHD streamer object. \
-Streamer args is a list of key/value pairs; usage is determined by the implementation.
-Ex: the scalar key affects the scaling between 16 and 8 bit integers in sc8 wire format.
-
-Num Motherboards:
-Selects the number of USRP motherboards in this device configuration.
-
-Reference Source:
-Where the motherboard should sync its time and clock references.
-If source and sink blocks reference the same device,
-it is only necessary to set the reference source on one of the blocks.
-
-Subdevice specification:
-Each motherboard should have its own subdevice specification \\
-and all subdevice specifications should be the same length. \\
-Select the subdevice or subdevices for each channel using a markup string. \\
-The markup string consists of a list of dboard_slot:subdev_name pairs (one pair per channel). \\
-If left blank, the UHD will try to select the first subdevice on your system. \\
-See the application notes for further details.
-Single channel example: :AB
-Dual channel example: :A :B
-
-Num Channels:
-Selects the total number of channels in this multi-USRP configuration.
-Ex: 4 motherboards with 2 channels per board = 8 channels total
-
-Sample rate:
-The sample rate is the number of samples per second input by this block. \\
-The UHD device driver will try its best to match the requested sample rate. \\
-If the requested rate is not possible, the UHD block will print an error at runtime.
-
-Center frequency:
-The center frequency is the overall frequency of the RF chain. \\
-For greater control of how the UHD tunes elements in the RF chain, \\
+id: uhd_usrp_sink
+label: 'UHD: USRP ${sourk.title()}'
+flags: throttle
+
+parameters:
+- id: type
+ label: ${'$'}{direction.title()}put Type
+ dtype: enum
+ options: [fc32, sc16, item32]
+ option_labels: [Complex float32, Complex int16, VITA word32]
+ option_attributes:
+ type: [fc32, sc16, s32]
+ hide: part
+- id: otw
+ label: Wire Format
+ dtype: enum
+ options: ['', sc16, sc12, sc8]
+ option_labels: [Automatic, Complex int16, Complex int12, Complex int8]
+ hide: ${'$'}{ 'none' if otw else 'part'}
+- id: stream_args
+ label: Stream args
+ dtype: string
+ options: [peak=0.003906]
+ option_labels: [peak=0.003906]
+ hide: ${'$'}{ 'none' if stream_args else 'part'}
+- id: stream_chans
+ label: Stream channels
+ dtype: int_vector
+ default: '[]'
+ hide: ${'$'}{ 'none' if stream_chans else 'part'}
+- id: dev_addr
+ label: Device Address
+ dtype: string
+ default: '""'
+ hide: ${'$'}{ 'none' if dev_addr else 'part'}
+- id: dev_args
+ label: Device Arguments
+ dtype: string
+ default: '""'
+ hide: ${'$'}{ 'none' if dev_args else 'part'}
+- id: sync
+ label: Sync
+ dtype: enum
+ options: [sync, pc_clock, '']
+ option_labels: [unknown PPS, PC Clock, don't sync]
+ hide: ${'$'}{ 'none' if sync else 'part'}
+- id: clock_rate
+ label: Clock Rate (Hz)
+ dtype: real
+ default: '0.0'
+ options: ['0.0', 200e6, 184.32e6, 120e6, 30.72e6]
+ option_labels: [Default, 200 MHz, 184.32 MHz, 120 MHz, 30.72 MHz]
+ hide: ${'$'}{ 'none' if clock_rate else 'part' }
+- id: num_mboards
+ label: Num Mboards
+ dtype: int
+ default: '1'
+ options: ['1', '2', '3', '4', '5', '6', '7', '8']
+ hide: part
+% for m in range(max_mboards):
+- id: clock_source${m}
+ label: 'Mb${m}: Clock Source'
+ dtype: string
+ options: ['', internal, external, mimo, gpsdo]
+ option_labels: [Default, Internal, External, MIMO Cable, O/B GPSDO]
+ hide: ${'$'}{ 'all' if not (num_mboards > ${m}) else ( 'none' if clock_source${m}) else 'part')}
+- id: time_source${m}
+ label: 'Mb${m}: Time Source'
+ dtype: string
+ options: ['', external, mimo, gpsdo]
+ option_labels: [Default, External, MIMO Cable, O/B GPSDO]
+ hide: ${'$'}{ 'all' if not (num_mboards > ${m}) else ('none' if time_source${m}) else 'part')}
+- id: sd_spec${m}
+ label: 'Mb${m}: Subdev Spec'
+ dtype: string
+ hide: ${'$'}{ 'all' if not (num_mboards > ${m}) else ('none' if sd_spec${m}) else 'part')}
+% endfor
+- id: nchan
+ label: Num Channels
+ dtype: int
+ default: 1
+ options: [ ${", ".join([str(n) for n in range(1, max_nchan+1)])} ]
+ hide: part
+- id: samp_rate
+ label: Smp rate (Sps)
+ dtype: real
+${params}
+
+
+
+inputs:
+- domain: message
+ id: command
+ optional: true
+ hide: ${'$'}{hide_cmd_port}
+% if sourk == 'sink':
+- domain: stream
+% else:
+
+outputs:
+- domain: stream
+% endif
+ dtype: ${'$'}{type.type}
+ multiplicity: ${'$'}{nchan}
+
+templates:
+ imports: |-
+ from gnuradio import uhd
+ import time
+ make: |
+ uhd.usrp_sink(
+ ",".join((${'$'}{dev_addr}, ${'$'}{dev_args})),
+ uhd.stream_args(
+ cpu_format="${'$'}{type}",
+ ${'%'} if otw:
+ otw_format=${'$'}{otw},
+ ${'%'} endif
+ ${'%'} if stream_args:
+ args=${'$'}{stream_args},
+ ${'%'} endif
+ ${'%'} if stream_chans:
+ channels=${'$'}{stream_chans},
+ ${'%'} else:
+ channels=range(${'$'}{nchan}),
+ ${'%'} endif
+ ),
+ ${'%'} if len_tag_name:
+ ${'$'}{len_tag_name},
+ ${'%'} endif
+ )
+ ${'%'} if clock_rate:
+ self.${'$'}{id}.set_clock_rate(${'$'}{clock_rate}, uhd.ALL_MBOARDS)
+ ${'%'} endif
+ self.${'$'}{id}.set_samp_rate(${'$'}{samp_rate})
+ ${'%'} if sync == 'sync':
+ self.${'$'}{id}.set_time_unknown_pps(uhd.time_spec())
+ #elif ${'$'}{sync} == 'pc_clock'
+ self.${'$'}{id}.set_time_now(uhd.time_spec(time.time()), uhd.ALL_MBOARDS)
+ ${'%'} endif
+ callbacks:
+ - set_samp_rate(${'$'}{samp_rate})
+ % for n in range(max_nchan):
+ - set_center_freq(${'center_freq' + str(n)}, ${n})
+ - self.${'$'}{id}.set_${'$'}{'normalized_' if eval('norm_gain' + str(n))}gain(gain${n}, ${n})
+ - ${'$'}{'set_lo_source(lo_source${n}, uhd.ALL_LOS, ${n})' if not hide_lo_controls()}
+ - ${'$'}{'set_lo_export_enabled(lo_export${n}, uhd.ALL_LOS, ${n})' if not hide_lo_controls()}
+ - set_antenna(${'ant' + str(n)}, ${n})
+ - set_bandwidth(${'bw' + str(n)}, ${n})
+ % endfor
+
+
+documentation: |-
+ The UHD USRP ${sourk.title()} Block:
+
+ Device Address:
+ The device address is a delimited string used to locate UHD devices on your system. \\
+ If left blank, the first UHD device found will be used. \\
+ Use the device address to specify a specific device or list of devices.
+ USRP1 Example: serial=12345678
+ USRP2 Example: addr=192.168.10.2
+ USRP2 Example: addr0=192.168.10.2, addr1=192.168.10.3
+
+ ${direction.title()} Type:
+ This parameter controls the data type of the stream in gnuradio.
+
+ Wire Format:
+ This parameter controls the form of the data over the bus/network. \
+ Complex bytes may be used to trade off precision for bandwidth. \
+ Not all formats are supported on all devices.
+
+ Stream Args:
+ Optional arguments to be passed in the UHD streamer object. \
+ Streamer args is a list of key/value pairs; usage is determined by the implementation.
+ Ex: the scalar key affects the scaling between 16 and 8 bit integers in sc8 wire format.
+
+ Num Motherboards:
+ Selects the number of USRP motherboards in this device configuration.
+
+ Reference Source:
+ Where the motherboard should sync its time and clock references.
+ If source and sink blocks reference the same device,
+ it is only necessary to set the reference source on one of the blocks.
+
+ Subdevice specification:
+ Each motherboard should have its own subdevice specification \\
+ and all subdevice specifications should be the same length. \\
+ Select the subdevice or subdevices for each channel using a markup string. \\
+ The markup string consists of a list of dboard_slot:subdev_name pairs (one pair per channel). \\
+ If left blank, the UHD will try to select the first subdevice on your system. \\
+ See the application notes for further details.
+ Single channel example: :AB
+ Dual channel example: :A :B
+
+ Num Channels:
+ Selects the total number of channels in this multi-USRP configuration.
+ Ex: 4 motherboards with 2 channels per board = 8 channels total
+
+ Sample rate:
+ The sample rate is the number of samples per second input by this block. \\
+ The UHD device driver will try its best to match the requested sample rate. \\
+ If the requested rate is not possible, the UHD block will print an error at runtime.
+
+ Center frequency:
+ The center frequency is the overall frequency of the RF chain. \\
+ For greater control of how the UHD tunes elements in the RF chain, \\
pass a tune_request object rather than a simple target frequency.
-Tuning with an LO offset example: uhd.tune_request(freq, lo_off)
-Tuning without DSP: uhd.tune_request(target_freq, dsp_freq=0, \\
+ Tuning with an LO offset example: uhd.tune_request(freq, lo_off)
+ Tuning without DSP: uhd.tune_request(target_freq, dsp_freq=0, \\
dsp_freq_policy=uhd.tune_request.POLICY_MANUAL)
-Antenna:
-For subdevices with only one antenna, this may be left blank. \\
-Otherwise, the user should specify one of the possible antenna choices. \\
-See the daughterboard application notes for the possible antenna choices.
+ Antenna:
+ For subdevices with only one antenna, this may be left blank. \\
+ Otherwise, the user should specify one of the possible antenna choices. \\
+ See the daughterboard application notes for the possible antenna choices.
-Bandwidth:
-To use the default bandwidth filter setting, this should be zero. \\
-Only certain subdevices have configurable bandwidth filters. \\
-See the daughterboard application notes for possible configurations.
+ Bandwidth:
+ To use the default bandwidth filter setting, this should be zero. \\
+ Only certain subdevices have configurable bandwidth filters. \\
+ See the daughterboard application notes for possible configurations.
-Length tag key (Sink only):
-When a nonempty string is given, the USRP sink will look for length tags \\
-to determine transmit burst lengths.
+ Length tag key (Sink only):
+ When a nonempty string is given, the USRP sink will look for length tags \\
+ to determine transmit burst lengths.
-See the UHD manual for more detailed documentation:
-http://uhd.ettus.com
- </doc>
-</block>
+ See the UHD manual for more detailed documentation:
+ http://uhd.ettus.com
+
+file_format: 1
"""
-PARAMS_TMPL = """ <param>
- <name>Ch$(n): Center Freq (Hz)</name>
- <key>center_freq$(n)</key>
- <value>0</value>
- <type>real</type>
- <hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
- <tab>RF Options</tab>
- </param>
- <param>
- <name>Ch$(n): Gain Value</name>
- <key>gain$(n)</key>
- <value>0</value>
- <type>float</type>
- <hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
- <tab>RF Options</tab>
- </param>
- <param>
- <name>Ch$(n): Gain Type</name>
- <key>norm_gain$(n)</key>
- <value>False</value>
- <type>bool</type>
- <hide>\#if \$nchan() &lt;= $n
- all
- \#elif bool(\$norm_gain${n}())
- none
- \#else
- part
- \#end if</hide>
- <option>
- <name>Absolute (dB)</name>
- <key>False</key>
- </option>
- <option>
- <name>Normalized</name>
- <key>True</key>
- </option>
- <tab>RF Options</tab>
- </param>
- <param>
- <name>Ch$(n): Antenna</name>
- <key>ant$(n)</key>
- <value></value>
- <type>string</type>
- <hide>
- \#if not \$nchan() > $n
- all
- \#elif \$ant$(n)()
- none
- \#else
- part
- \#end if
- </hide>
- <option>
- <name>TX/RX</name>
- <key>TX/RX</key>
- </option>
-#if $sourk == 'source'
- <option>
- <name>RX2</name>
- <key>RX2</key>
- </option>
- <option>
- <name>RX1</name>
- <key>RX1</key>
- </option>
-#end if
- <tab>RF Options</tab>
- </param>
- <param>
- <name>Ch$(n): Bandwidth (Hz)</name>
- <key>bw$(n)</key>
- <value>0</value>
- <type>real</type>
- <hide>
- \#if not \$nchan() > $n
- all
- \#elif \$bw$(n)()
- none
- \#else
- part
- \#end if
- </hide>
- <tab>RF Options</tab>
- </param>
-#if $sourk == 'source'
- <param>
- <name>Ch$(n): LO Source</name>
- <key>lo_source$(n)</key>
- <value>internal</value>
- <type>string</type>
- <hide>
- \#if not \$nchan() > $n
- all
- \#elif \$hide_lo_controls()
- all
- \#else
- none
- \#end if
- </hide>
- <option>
- <name>Internal</name>
- <key>internal</key>
- </option>
- <option>
- <name>External</name>
- <key>external</key>
- </option>
- <option>
- <name>Companion</name>
- <key>companion</key>
- </option>
- <tab>RF Options</tab>
- </param>
-#end if
-#if $sourk == 'source'
- <param>
- <name>Ch$(n): LO Export</name>
- <key>lo_export$(n)</key>
- <value>False</value>
- <type>bool</type>
- <hide>
- \#if not \$nchan() > $n
- all
- \#elif \$hide_lo_controls()
- all
- \#else
- none
- \#end if
- </hide>
- <option>
- <name>True</name>
- <key>True</key>
- </option>
- <option>
- <name>False</name>
- <key>False</key>
- </option>
- <tab>RF Options</tab>
- </param>
-#end if
-#if $sourk == 'source'
- <param>
- <name>Ch$(n): Enable DC Offset Correction</name>
- <key>dc_offs_enb$(n)</key>
- <value>""</value>
- <type>raw</type>
- <hide>
- \#if not \$nchan() > $n
- all
- \#else
- part
- \#end if
- </hide>
- <tab>FE Corrections</tab>
- </param>
- <param>
- <name>Ch$(n): Enable IQ Imbalance Correction</name>
- <key>iq_imbal_enb$(n)</key>
- <value>""</value>
- <type>raw</type>
- <hide>
- \#if not \$nchan() > $n
- all
- \#else
- part
- \#end if
- </hide>
- <tab>FE Corrections</tab>
- </param>
-#end if
+PARAMS_TMPL = """
+- id: center_freq${n}
+ label: 'Ch${n}: Center Freq (Hz)'
+ category: RF Options
+ dtype: real
+ default: '0'
+ hide: ${'$'}{ 'none' if (nchan > ${n}) else 'all' }
+- id: gain${n}
+ label: 'Ch${n}: Gain Value'
+ category: RF Options
+ dtype: float
+ default: '0'
+ hide: ${'$'}{ 'none' if nchan > ${n} else 'all' }
+- id: norm_gain${n}
+ label: 'Ch${n}: Gain Type'
+ category: RF Options
+ dtype: bool
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: [Absolute (dB), Normalized]
+ hide: ${'$'}{ 'all' if nchan <= ${n} else ('none' if bool(eval('norm_gain' + str(n))) else 'part')}
+- id: ant${n}
+ label: 'Ch${n}: Antenna'
+ category: RF Options
+ dtype: string
+% if sourk == 'source':
+ options: [TX/RX, RX2, RX1]
+ option_labels: [TX/RX, RX2, RX1]
+% else:
+ options: [TX/RX]
+ option_labels: [TX/RX]
+% endif
+ hide: ${'$'}{ 'all' if not nchan > ${n} else ('none' if eval('ant' + str(n)) else 'part')}
+- id: bw${n}
+ label: 'Ch${n}: Bandwidth (Hz)'
+ category: RF Options
+ dtype: real
+ default: '0'
+ hide: ${'$'}{ 'all' if not nchan > ${n} else ('none' if eval('bw' + str(n)) else 'part')}
+% if sourk == 'source':
+- id: lo_source${n}
+ label: 'Ch${n}: LO Source'
+ category: RF Options
+ dtype: string
+ default: internal
+ options: [internal, external, companion]
+ hide: ${'$'}{ 'all' if not nchan > ${n} else ('all' if hide_lo_controls else 'none')}
+- id: lo_export
+ label: 'Ch${n}: LO Export'
+ category: RF Options
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ hide: ${'$'}{ 'all' if not nchan > ${n} else ('all' if hide_lo_controls else 'none')}
+- id: dc_offs_enb${n}
+ label: 'Ch${n}: Enable DC Offset Correction'
+ category: FE Corrections
+ dtype: raw
+ default: '""'
+ hide: ${'$'}{ 'all' if not nchan > ${n} else 'part'}
+- id: iq_imbal_enb${n}
+ label: 'Ch${n}: Enable IQ Imbalance Correction'
+ category: FE Corrections
+ dtype: raw
+ default: '""'
+ hide: ${'$'}{ 'all' if not nchan > ${n} else 'part'}
+% endif
"""
SHOW_CMD_PORT_PARAM = """
- <param>
- <name>Show Command Port</name>
- <key>hide_cmd_port</key>
- <value>False</value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>False</key>
- </option>
- <option>
- <name>No</name>
- <key>True</key>
- </option>
- <tab>Advanced</tab>
- </param>
+- id: hide_cmd_port
+ label: Show Command Port
+ category: Advanced
+ dtype: enum
+ default: 'False'
+ options: ['False', 'True']
+ option_labels: ['Yes', 'No']
+ hide: part
"""
SHOW_LO_CONTROLS_PARAM = """
- <param>
- <name>Show LO Controls</name>
- <key>hide_lo_controls</key>
- <value>True</value>
- <type>bool</type>
- <hide>part</hide>
- <option>
- <name>Yes</name>
- <key>False</key>
- </option>
- <option>
- <name>No</name>
- <key>True</key>
- </option>
- <tab>Advanced</tab>
- </param>
+- id: hide_lo_controls
+ label: Show LO Controls
+ category: Advanced
+ dtype: bool
+ default: 'True'
+ options: ['False', 'True']
+ option_labels: ['Yes', 'No']
+ hide: part
"""
-TSBTAG_PARAM = """ <param>
- <name>TSB tag name</name>
- <key>len_tag_name</key>
- <value></value>
- <type>string</type>
- <hide>\#if len(str(\$len_tag_name())) then 'none' else 'part'#</hide>
- </param>"""
+TSBTAG_PARAM = """
+- id: len_tag_name
+ label: TSB tag name
+ dtype: string
+ hide: ${ 'none' if len(str(len_tag_name)) else 'part'}
+"""
TSBTAG_ARG = """
- #if $len_tag_name()
- $len_tag_name,
- #end if"""
+${'%'} if len_tag_name():
+${'$'}{len_tag_name},
+${'%'} endif
+"""
def parse_tmpl(_tmpl, **kwargs):
- from Cheetah import Template
- return str(Template.Template(_tmpl, kwargs))
+ from mako.template import Template
+ block_template = Template(_tmpl)
+ return str(block_template.render(**kwargs))
max_num_mboards = 8
max_num_channels = max_num_mboards*4
if __name__ == '__main__':
- import sys
- for file in sys.argv[1:]:
- if file.endswith ('source.xml'):
- sourk = 'source'
- direction = 'out'
- elif file.endswith ('sink.xml'):
- sourk = 'sink'
- direction = 'in'
- else: raise Exception, 'is %s a source or sink?'%file
-
- params = ''.join([parse_tmpl(PARAMS_TMPL, n=n, sourk=sourk) for n in range(max_num_channels)])
- params += SHOW_CMD_PORT_PARAM
- params += SHOW_LO_CONTROLS_PARAM
- if sourk == 'sink':
- params += TSBTAG_PARAM
- lentag_arg = TSBTAG_ARG
- else: lentag_arg = ''
- open(file, 'w').write(parse_tmpl(MAIN_TMPL,
- lentag_arg=lentag_arg,
- max_nchan=max_num_channels,
- max_mboards=max_num_mboards,
- params=params,
- sourk=sourk,
- direction=direction,
- ))
+ import sys
+ for file in sys.argv[1:]:
+ if file.endswith ('source.block.yml'):
+ sourk = 'source'
+ direction = 'out'
+ elif file.endswith ('sink.block.yml'):
+ sourk = 'sink'
+ direction = 'in'
+ else: raise Exception('is % a source or sink?'%file)
+
+ params = ''.join([parse_tmpl(PARAMS_TMPL, n=n, sourk=sourk) for n in range(max_num_channels)])
+ params += SHOW_CMD_PORT_PARAM
+ params += SHOW_LO_CONTROLS_PARAM
+ if sourk == 'sink':
+ params += TSBTAG_PARAM
+ lentag_arg = TSBTAG_ARG
+ else: lentag_arg = ''
+
+ open(file, 'w').write(parse_tmpl(MAIN_TMPL,
+ lentag_arg=lentag_arg,
+ max_nchan=max_num_channels,
+ max_mboards=max_num_mboards,
+ params=params,
+ sourk=sourk,
+ direction=direction,
+ ))
diff --git a/gr-uhd/grc/uhd.tree.yml b/gr-uhd/grc/uhd.tree.yml
new file mode 100644
index 000000000..a4d140d77
--- /dev/null
+++ b/gr-uhd/grc/uhd.tree.yml
@@ -0,0 +1,5 @@
+'[Core]':
+- UHD:
+ - uhd_usrp_source
+ - uhd_usrp_sink
+ - uhd_amsg_source
diff --git a/gr-uhd/grc/uhd_amsg_source.block.yml b/gr-uhd/grc/uhd_amsg_source.block.yml
new file mode 100644
index 000000000..b07ab7791
--- /dev/null
+++ b/gr-uhd/grc/uhd_amsg_source.block.yml
@@ -0,0 +1,18 @@
+id: uhd_amsg_source
+label: 'UHD: USRP Async Msg Source'
+
+parameters:
+- id: dev_addr
+ label: Device Addr
+ dtype: string
+ hide: ${ 'none' if dev_addr else 'part' }
+
+outputs:
+- domain: stream
+ dtype: msg
+
+templates:
+ imports: from gnuradio import uhd
+ make: uhd.amsg_source(device_addr=${dev_addr}, msgq=${id}_msgq_out)
+
+file_format: 1
diff --git a/gr-uhd/grc/uhd_amsg_source.xml b/gr-uhd/grc/uhd_amsg_source.xml
deleted file mode 100644
index 78c9d7b58..000000000
--- a/gr-uhd/grc/uhd_amsg_source.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>UHD: USRP Async Msg Source</name>
- <key>uhd_amsg_source</key>
- <import>from gnuradio import uhd</import>
- <make>uhd.amsg_source(device_addr=$dev_addr, msgq=$(id)_msgq_out)</make>
- <param>
- <name>Device Addr</name>
- <key>dev_addr</key>
- <value></value>
- <type>string</type>
- <hide>
- #if $dev_addr()
- none
- #else
- part
- #end if
- </hide>
- </param>
- <source>
- <name>out</name>
- <type>msg</type>
- </source>
-</block>
diff --git a/gr-uhd/grc/uhd_block_tree.xml b/gr-uhd/grc/uhd_block_tree.xml
deleted file mode 100644
index c59864552..000000000
--- a/gr-uhd/grc/uhd_block_tree.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Block Tree for uhd blocks.
-###################################################
- -->
-<cat>
- <name>[Core]</name> <!-- Blank for Root Name -->
- <cat>
- <name>UHD</name>
- <block>uhd_usrp_source</block>
- <block>uhd_usrp_sink</block>
- <block>uhd_amsg_source</block>
- </cat>
-</cat>
diff --git a/gr-uhd/python/uhd/CMakeLists.txt b/gr-uhd/python/uhd/CMakeLists.txt
index ee69e8eb7..e736edebf 100644
--- a/gr-uhd/python/uhd/CMakeLists.txt
+++ b/gr-uhd/python/uhd/CMakeLists.txt
@@ -44,6 +44,6 @@ include(GrTest)
file(GLOB py_qa_test_files "qa_*.py")
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gr-uhd/python/uhd/__init__.py b/gr-uhd/python/uhd/__init__.py
index 0e8176f97..d9f4eaab3 100644
--- a/gr-uhd/python/uhd/__init__.py
+++ b/gr-uhd/python/uhd/__init__.py
@@ -25,17 +25,20 @@ Used to send and receive data between the Ettus Research, LLC product
line.
'''
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
########################################################################
# Prepare uhd swig module to make it more pythonic
########################################################################
def _prepare_uhd_swig():
try:
- import uhd_swig
+ from . import uhd_swig
except ImportError:
import os
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
- import uhd_swig
+ from . import uhd_swig
#some useful typedefs for the user
setattr(uhd_swig, 'freq_range_t', uhd_swig.meta_range_t)
@@ -50,7 +53,7 @@ def _prepare_uhd_swig():
def __float__(self): return self.target_freq
def __init__(self, *args, **kwargs):
super(tune_request_t, self).__init__(*args)
- for key, val in kwargs.iteritems(): setattr(self, key, val)
+ for key, val in list(kwargs.items()): setattr(self, key, val)
setattr(uhd_swig, 'tune_request_t', tune_request_t)
#Make the python tune request object inherit from string
@@ -64,14 +67,14 @@ def _prepare_uhd_swig():
def __init__(self, *args, **kwargs):
super(device_addr_t, self).__init__(*args)
if args and isinstance(args[0], device_addr_t):
- for key in args[0].keys(): self[key] = args[0][key]
+ for key in list(args[0].keys()): self[key] = args[0][key]
setattr(uhd_swig, 'device_addr_t', device_addr_t)
#make the streamer args take **kwargs on init
class stream_args_t(uhd_swig.stream_args_t):
def __init__(self, *args, **kwargs):
super(stream_args_t, self).__init__(*args)
- for key, val in kwargs.iteritems():
+ for key, val in list(kwargs.items()):
#for some reason, I can't assign a list in the constructor
#but what I can do is append the elements individually
if key == 'channels':
@@ -97,7 +100,7 @@ def _prepare_uhd_swig():
def find_devices(*args, **kwargs):
def to_pythonized_dev_addr(dev_addr):
new_dev_addr = uhd_swig.device_addr_t()
- for key in dev_addr.keys(): new_dev_addr[key] = dev_addr.get(key)
+ for key in list(dev_addr.keys()): new_dev_addr[key] = dev_addr.get(key)
return new_dev_addr
return __builtins__['map'](to_pythonized_dev_addr, uhd_swig.find_devices_raw(*args, **kwargs))
setattr(uhd_swig, 'find_devices', find_devices)
@@ -114,11 +117,11 @@ def _prepare_uhd_swig():
):
try:
if len(args) > index: args[index] = cast(args[index])
- if kwargs.has_key(key): kwargs[key] = cast(kwargs[key])
+ if key in kwargs: kwargs[key] = cast(kwargs[key])
except: pass
#don't pass kwargs, it confuses swig, map into args list:
for key in ('device_addr', 'stream_args', 'io_type', 'num_channels', 'msgq'):
- if kwargs.has_key(key): args.append(kwargs[key])
+ if key in kwargs: args.append(kwargs[key])
return old_constructor(*args)
return constructor_interceptor
setattr(uhd_swig, attr, constructor_factory(getattr(uhd_swig, attr)))
@@ -133,4 +136,4 @@ def _prepare_uhd_swig():
# Initialize this module with the contents of uhd swig
########################################################################
_prepare_uhd_swig()
-from uhd_swig import *
+from .uhd_swig import *
diff --git a/gr-uhd/python/uhd/qa_uhd.py b/gr-uhd/python/uhd/qa_uhd.py
index 4df0d4273..bab029a9a 100644
--- a/gr-uhd/python/uhd/qa_uhd.py
+++ b/gr-uhd/python/uhd/qa_uhd.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+
from gnuradio import gr, gr_unittest, uhd
class test_uhd(gr_unittest.TestCase):
@@ -50,7 +52,7 @@ class test_uhd(gr_unittest.TestCase):
sa = uhd.stream_args_t()
sa.channels.append(1)
sa.channels.append(0)
- print sa.channels
+ print(sa.channels)
self.assertEqual(len(sa.channels), 2)
self.assertEqual(sa.channels[0], 1)
self.assertEqual(sa.channels[1], 0)
diff --git a/gr-utils/CMakeLists.txt b/gr-utils/CMakeLists.txt
index d54a06abd..a8dfd9153 100644
--- a/gr-utils/CMakeLists.txt
+++ b/gr-utils/CMakeLists.txt
@@ -22,7 +22,7 @@
########################################################################
include(GrPython)
-GR_PYTHON_CHECK_MODULE("Mako >= 0.4.2" mako "mako.__version__ >= '0.4.2'" MAKO_FOUND)
+GR_PYTHON_CHECK_MODULE("Mako >= ${GR_MAKO_MIN_VERSION}" mako "mako.__version__ >= '${GR_MAKO_MIN_VERSION}'" MAKO_FOUND)
########################################################################
# Register component
diff --git a/gr-utils/python/modtool/__init__.py b/gr-utils/python/modtool/__init__.py
index 897ff97fc..b6d719ac1 100644
--- a/gr-utils/python/modtool/__init__.py
+++ b/gr-utils/python/modtool/__init__.py
@@ -1,3 +1,5 @@
+from __future__ import absolute_import
+from __future__ import unicode_literals
#
# Copyright 2013-2014 Free Software Foundation, Inc.
#
@@ -19,17 +21,17 @@
# Boston, MA 02110-1301, USA.
#
-from cmakefile_editor import CMakeFileEditor
-from grc_xml_generator import GRCXMLGenerator
-from modtool_base import ModTool, ModToolException, get_modtool_modules
-from modtool_add import ModToolAdd
-from modtool_disable import ModToolDisable
-from modtool_info import ModToolInfo
-from modtool_makexml import ModToolMakeXML
-from modtool_newmod import ModToolNewModule
-from modtool_rm import ModToolRemove
-from modtool_rename import ModToolRename
-from templates import Templates
+from .cmakefile_editor import CMakeFileEditor
+from .grc_xml_generator import GRCXMLGenerator
+from .modtool_base import ModTool, ModToolException, get_modtool_modules
+from .modtool_add import ModToolAdd
+from .modtool_disable import ModToolDisable
+from .modtool_info import ModToolInfo
+from .modtool_makexml import ModToolMakeXML
+from .modtool_newmod import ModToolNewModule
+from .modtool_rm import ModToolRemove
+from .modtool_rename import ModToolRename
+from .templates import Templates
# Leave this at the end
-from parser_cc_block import ParserCCBlock
-from util_functions import *
+from .parser_cc_block import ParserCCBlock
+from .util_functions import *
diff --git a/gr-utils/python/modtool/cmakefile_editor.py b/gr-utils/python/modtool/cmakefile_editor.py
index 4148ad196..1b644287f 100644
--- a/gr-utils/python/modtool/cmakefile_editor.py
+++ b/gr-utils/python/modtool/cmakefile_editor.py
@@ -20,6 +20,9 @@
#
""" Edit CMakeLists.txt files """
+from __future__ import print_function
+from __future__ import unicode_literals
+
import re
class CMakeFileEditor(object):
@@ -126,9 +129,9 @@ class CMakeFileEditor(object):
comment_out_re = r'\n' + self.indent + comment_out_re
(self.cfile, nsubs) = re.subn(r'(\b'+fname+r'\b)\s*', comment_out_re, self.cfile)
if nsubs == 0:
- print "Warning: A replacement failed when commenting out %s. Check the CMakeFile.txt manually." % fname
+ print("Warning: A replacement failed when commenting out %s. Check the CMakeFile.txt manually." % fname)
elif nsubs > 1:
- print "Warning: Replaced %s %d times (instead of once). Check the CMakeFile.txt manually." % (fname, nsubs)
+ print("Warning: Replaced %s %d times (instead of once). Check the CMakeFile.txt manually." % (fname, nsubs))
def comment_out_lines(self, pattern, comment_str='#'):
""" Comments out all lines that match with pattern """
diff --git a/gr-utils/python/modtool/code_generator.py b/gr-utils/python/modtool/code_generator.py
index 326b2d598..d95434f57 100644
--- a/gr-utils/python/modtool/code_generator.py
+++ b/gr-utils/python/modtool/code_generator.py
@@ -19,14 +19,16 @@
# Boston, MA 02110-1301, USA.
#
""" A code generator (needed by ModToolAdd) """
+from __future__ import absolute_import
+from __future__ import unicode_literals
from mako.template import Template
-from templates import Templates
-from util_functions import str_to_fancyc_comment
-from util_functions import str_to_python_comment
-from util_functions import strip_default_values
-from util_functions import strip_arg_types
-from util_functions import strip_arg_types_grc
+from .templates import Templates
+from .util_functions import str_to_fancyc_comment
+from .util_functions import str_to_python_comment
+from .util_functions import strip_default_values
+from .util_functions import strip_arg_types
+from .util_functions import strip_arg_types_grc
GRTYPELIST = {
'sync': 'sync_block',
diff --git a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake
index 50d817aa9..cc8e7c17d 100644
--- a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake
+++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrMiscUtils.cmake
@@ -341,7 +341,7 @@ if __name__ == '__main__':
add_custom_command(
OUTPUT ${expanded_files_h}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ COMMAND ${PYTHON_EXECUTABLE} -B
${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
${root} ${root}.h.t ${ARGN}
)
@@ -387,7 +387,7 @@ if __name__ == '__main__':
add_custom_command(
OUTPUT ${expanded_files_cc}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ COMMAND ${PYTHON_EXECUTABLE} -B
${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
${root} ${root}.cc.t ${ARGN}
)
@@ -396,7 +396,7 @@ if __name__ == '__main__':
add_custom_command(
OUTPUT ${expanded_files_h}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ COMMAND ${PYTHON_EXECUTABLE} -B
${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
${root} ${root}.h.t ${ARGN}
)
@@ -450,7 +450,7 @@ if __name__ == '__main__':
add_custom_command(
OUTPUT ${expanded_files_cc_impl}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.cc.t
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ COMMAND ${PYTHON_EXECUTABLE} -B
${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
${root} ${root}_impl.cc.t ${ARGN}
)
@@ -459,7 +459,7 @@ if __name__ == '__main__':
add_custom_command(
OUTPUT ${expanded_files_h_impl}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}_impl.h.t
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ COMMAND ${PYTHON_EXECUTABLE} -B
${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
${root} ${root}_impl.h.t ${ARGN}
)
diff --git a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake
index 0bfa92db8..6b997c086 100644
--- a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake
+++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrPython.cmake
@@ -36,11 +36,12 @@ if(PYTHON_EXECUTABLE)
else(PYTHON_EXECUTABLE)
#use the built-in find script
+ set(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6)
find_package(PythonInterp 2)
#and if that fails use the find program routine
if(NOT PYTHONINTERP_FOUND)
- find_program(PYTHON_EXECUTABLE NAMES python python2 python2.7 python2.6 python2.5)
+ find_program(PYTHON_EXECUTABLE NAMES python python2 python2.7)
if(PYTHON_EXECUTABLE)
set(PYTHONINTERP_FOUND TRUE)
endif(PYTHON_EXECUTABLE)
@@ -86,7 +87,7 @@ macro(GR_PYTHON_CHECK_MODULE desc mod cmd have)
try:
import ${mod}
assert ${cmd}
-except ImportError, AssertionError: exit(-1)
+except (ImportError, AssertionError): exit(-1)
except: pass
#########################################"
RESULT_VARIABLE ${have}
@@ -106,7 +107,7 @@ endmacro(GR_PYTHON_CHECK_MODULE)
if(NOT DEFINED GR_PYTHON_DIR)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "
from distutils import sysconfig
-print sysconfig.get_python_lib(plat_specific=True, prefix='')
+print(sysconfig.get_python_lib(plat_specific=True, prefix=''))
" OUTPUT_VARIABLE GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
@@ -119,7 +120,7 @@ file(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR)
function(GR_UNIQUE_TARGET desc)
file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib
-unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5]
+unique = hashlib.md5(b'${reldir}${ARGN}').hexdigest()[:5]
print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))"
OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE)
add_custom_target(${_target} ALL DEPENDS ${ARGN})
@@ -233,7 +234,7 @@ endfunction(GR_PYTHON_INSTALL)
file(WRITE ${CMAKE_BINARY_DIR}/python_compile_helper.py "
import sys, py_compile
files = sys.argv[1:]
-srcs, gens = files[:len(files)/2], files[len(files)/2:]
+srcs, gens = files[:len(files)//2], files[len(files)//2:]
for src, gen in zip(srcs, gens):
py_compile.compile(file=src, cfile=gen, doraise=True)
")
diff --git a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake
index 543562a28..bce51b23d 100644
--- a/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake
+++ b/gr-utils/python/modtool/gr-newmod/cmake/Modules/GrSwig.cmake
@@ -76,7 +76,7 @@ function(GR_SWIG_MAKE_DOCS output_file)
add_custom_command(
OUTPUT ${output_file}
DEPENDS ${input_files} ${stamp-file} ${OUTPUT_DIRECTORY}/xml/index.xml
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ COMMAND ${PYTHON_EXECUTABLE} -B
${CMAKE_SOURCE_DIR}/docs/doxygen/swig_doc.py
${OUTPUT_DIRECTORY}/xml
${output_file}
diff --git a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py
index 5cd0b3c6c..b7a888451 100644
--- a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py
+++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/__init__.py
@@ -63,8 +63,9 @@ This line is uninformative and is only to test line breaks in the comments.
u'Outputs the vital aadvark statistics.'
"""
+from __future__ import unicode_literals
-from doxyindex import DoxyIndex, DoxyFunction, DoxyParam, DoxyClass, DoxyFile, DoxyNamespace, DoxyGroup, DoxyFriend, DoxyOther
+from .doxyindex import DoxyIndex, DoxyFunction, DoxyParam, DoxyClass, DoxyFile, DoxyNamespace, DoxyGroup, DoxyFriend, DoxyOther
def _test():
import os
diff --git a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py
index e8f026ab9..0f0adf255 100644
--- a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py
+++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/base.py
@@ -24,24 +24,26 @@ A base class is created.
Classes based upon this are used to make more user-friendly interfaces
to the doxygen xml docs than the generated classes provide.
"""
+from __future__ import print_function
+from __future__ import unicode_literals
import os
import pdb
from xml.parsers.expat import ExpatError
-from generated import compound
+from .generated import compound
class Base(object):
- class Duplicate(StandardError):
+ class Duplicate(Exception):
pass
- class NoSuchMember(StandardError):
+ class NoSuchMember(Exception):
pass
- class ParsingError(StandardError):
+ class ParsingError(Exception):
pass
def __init__(self, parse_data, top=None):
@@ -94,7 +96,7 @@ class Base(object):
for cls in self.mem_classes:
if cls.can_parse(mem):
return cls
- raise StandardError(("Did not find a class for object '%s'." \
+ raise Exception(("Did not find a class for object '%s'." \
% (mem.get_name())))
def convert_mem(self, mem):
@@ -102,11 +104,11 @@ class Base(object):
cls = self.get_cls(mem)
converted = cls.from_parse_data(mem, self.top)
if converted is None:
- raise StandardError('No class matched this object.')
+ raise Exception('No class matched this object.')
self.add_ref(converted)
return converted
- except StandardError, e:
- print e
+ except Exception as e:
+ print(e)
@classmethod
def includes(cls, inst):
diff --git a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py
index 78e815376..4284af25e 100644
--- a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py
+++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/doxyindex.py
@@ -22,12 +22,14 @@
Classes providing more user-friendly interfaces to the doxygen xml
docs than the generated classes provide.
"""
+from __future__ import absolute_import
+from __future__ import unicode_literals
import os
-from generated import index
-from base import Base
-from text import description
+from .generated import index
+from .base import Base
+from .text import description
class DoxyIndex(Base):
"""
diff --git a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/__init__.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/__init__.py
index 39823979f..23095c1f3 100644
--- a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/__init__.py
+++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/__init__.py
@@ -5,3 +5,4 @@ These do the real work of parsing the doxygen xml files but the
resultant classes are not very friendly to navigate so the rest of the
doxyxml module processes them further.
"""
+from __future__ import unicode_literals
diff --git a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compound.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compound.py
index 1522ac23f..acfa0dd5c 100644
--- a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compound.py
+++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compound.py
@@ -3,15 +3,17 @@
"""
Generated Mon Feb 9 19:08:05 2009 by generateDS.py.
"""
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
-from string import lower as str_lower
from xml.dom import minidom
from xml.dom import Node
import sys
-import compoundsuper as supermod
-from compoundsuper import MixedContainer
+from . import compoundsuper as supermod
+from .compoundsuper import MixedContainer
class DoxygenTypeSub(supermod.DoxygenType):
diff --git a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py
index 6255dda16..6e984e13e 100644
--- a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py
+++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/compoundsuper.py
@@ -4,12 +4,17 @@
# Generated Thu Jun 11 18:44:25 2009 by generateDS.py.
#
+from __future__ import print_function
+from __future__ import unicode_literals
+
import sys
-import getopt
-from string import lower as str_lower
+
from xml.dom import minidom
from xml.dom import Node
+import six
+
+
#
# User methods
#
@@ -19,9 +24,9 @@ from xml.dom import Node
try:
from generatedssuper import GeneratedsSuper
-except ImportError, exp:
+except ImportError as exp:
- class GeneratedsSuper:
+ class GeneratedsSuper(object):
def format_string(self, input_data, input_name=''):
return input_data
def format_integer(self, input_data, input_name=''):
@@ -64,7 +69,7 @@ def showIndent(outfile, level):
outfile.write(' ')
def quote_xml(inStr):
- s1 = (isinstance(inStr, basestring) and inStr or
+ s1 = (isinstance(inStr, six.string_types) and inStr or
'%s' % inStr)
s1 = s1.replace('&', '&amp;')
s1 = s1.replace('<', '&lt;')
@@ -72,7 +77,7 @@ def quote_xml(inStr):
return s1
def quote_attrib(inStr):
- s1 = (isinstance(inStr, basestring) and inStr or
+ s1 = (isinstance(inStr, six.string_types) and inStr or
'%s' % inStr)
s1 = s1.replace('&', '&amp;')
s1 = s1.replace('<', '&lt;')
@@ -102,7 +107,7 @@ def quote_python(inStr):
return '"""%s"""' % s1
-class MixedContainer:
+class MixedContainer(object):
# Constants for category:
CategoryNone = 0
CategoryText = 1
@@ -4221,7 +4226,7 @@ class codelineType(GeneratedsSuper):
if attrs.get('lineno'):
try:
self.lineno = int(attrs.get('lineno').value)
- except ValueError, exp:
+ except ValueError as exp:
raise ValueError('Bad integer attribute (lineno): %s' % exp)
if attrs.get('refkind'):
self.refkind = attrs.get('refkind').value
@@ -4504,12 +4509,12 @@ class referenceType(GeneratedsSuper):
if attrs.get('endline'):
try:
self.endline = int(attrs.get('endline').value)
- except ValueError, exp:
+ except ValueError as exp:
raise ValueError('Bad integer attribute (endline): %s' % exp)
if attrs.get('startline'):
try:
self.startline = int(attrs.get('startline').value)
- except ValueError, exp:
+ except ValueError as exp:
raise ValueError('Bad integer attribute (startline): %s' % exp)
if attrs.get('refid'):
self.refid = attrs.get('refid').value
@@ -4627,17 +4632,17 @@ class locationType(GeneratedsSuper):
if attrs.get('bodystart'):
try:
self.bodystart = int(attrs.get('bodystart').value)
- except ValueError, exp:
+ except ValueError as exp:
raise ValueError('Bad integer attribute (bodystart): %s' % exp)
if attrs.get('line'):
try:
self.line = int(attrs.get('line').value)
- except ValueError, exp:
+ except ValueError as exp:
raise ValueError('Bad integer attribute (line): %s' % exp)
if attrs.get('bodyend'):
try:
self.bodyend = int(attrs.get('bodyend').value)
- except ValueError, exp:
+ except ValueError as exp:
raise ValueError('Bad integer attribute (bodyend): %s' % exp)
if attrs.get('bodyfile'):
self.bodyfile = attrs.get('bodyfile').value
@@ -6778,12 +6783,12 @@ class docTableType(GeneratedsSuper):
if attrs.get('rows'):
try:
self.rows = int(attrs.get('rows').value)
- except ValueError, exp:
+ except ValueError as exp:
raise ValueError('Bad integer attribute (rows): %s' % exp)
if attrs.get('cols'):
try:
self.cols = int(attrs.get('cols').value)
- except ValueError, exp:
+ except ValueError as exp:
raise ValueError('Bad integer attribute (cols): %s' % exp)
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.ELEMENT_NODE and \
@@ -7108,7 +7113,7 @@ class docHeadingType(GeneratedsSuper):
if attrs.get('level'):
try:
self.level = int(attrs.get('level').value)
- except ValueError, exp:
+ except ValueError as exp:
raise ValueError('Bad integer attribute (level): %s' % exp)
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.TEXT_NODE:
@@ -8283,7 +8288,7 @@ Options:
"""
def usage():
- print USAGE_TEXT
+ print(USAGE_TEXT)
sys.exit(1)
@@ -8339,4 +8344,3 @@ if __name__ == '__main__':
main()
#import pdb
#pdb.run('main()')
-
diff --git a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/index.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/index.py
index 7a70e14a1..0c6351211 100644
--- a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/index.py
+++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/index.py
@@ -3,14 +3,16 @@
"""
Generated Mon Feb 9 19:08:05 2009 by generateDS.py.
"""
+from __future__ import absolute_import
+from __future__ import unicode_literals
from xml.dom import minidom
import os
import sys
-import compound
+from . import compound
-import indexsuper as supermod
+from . import indexsuper as supermod
class DoxygenTypeSub(supermod.DoxygenType):
def __init__(self, version=None, compound=None):
diff --git a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py
index a99153019..11312db63 100644
--- a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py
+++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/generated/indexsuper.py
@@ -4,12 +4,16 @@
# Generated Thu Jun 11 18:43:54 2009 by generateDS.py.
#
+from __future__ import print_function
+from __future__ import unicode_literals
+
import sys
-import getopt
-from string import lower as str_lower
+
from xml.dom import minidom
from xml.dom import Node
+import six
+
#
# User methods
#
@@ -19,9 +23,9 @@ from xml.dom import Node
try:
from generatedssuper import GeneratedsSuper
-except ImportError, exp:
+except ImportError as exp:
- class GeneratedsSuper:
+ class GeneratedsSuper(object):
def format_string(self, input_data, input_name=''):
return input_data
def format_integer(self, input_data, input_name=''):
@@ -64,7 +68,7 @@ def showIndent(outfile, level):
outfile.write(' ')
def quote_xml(inStr):
- s1 = (isinstance(inStr, basestring) and inStr or
+ s1 = (isinstance(inStr, six.string_types) and inStr or
'%s' % inStr)
s1 = s1.replace('&', '&amp;')
s1 = s1.replace('<', '&lt;')
@@ -72,7 +76,7 @@ def quote_xml(inStr):
return s1
def quote_attrib(inStr):
- s1 = (isinstance(inStr, basestring) and inStr or
+ s1 = (isinstance(inStr, six.string_types) and inStr or
'%s' % inStr)
s1 = s1.replace('&', '&amp;')
s1 = s1.replace('<', '&lt;')
@@ -102,7 +106,7 @@ def quote_python(inStr):
return '"""%s"""' % s1
-class MixedContainer:
+class MixedContainer(object):
# Constants for category:
CategoryNone = 0
CategoryText = 1
@@ -462,7 +466,7 @@ Options:
"""
def usage():
- print USAGE_TEXT
+ print(USAGE_TEXT)
sys.exit(1)
@@ -520,4 +524,3 @@ if __name__ == '__main__':
main()
#import pdb
#pdb.run('main()')
-
diff --git a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py
index 629edd180..de2d19b53 100644
--- a/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py
+++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/doxyxml/text.py
@@ -21,12 +21,13 @@
"""
Utilities for extracting text from generated classes.
"""
+from __future__ import unicode_literals
def is_string(txt):
if isinstance(txt, str):
return True
try:
- if isinstance(txt, unicode):
+ if isinstance(txt, str):
return True
except NameError:
pass
@@ -49,7 +50,7 @@ def description_bit(obj):
elif is_string(obj):
return obj
else:
- raise StandardError('Expecting a string or something with content, content_ or value attribute')
+ raise Exception('Expecting a string or something with content, content_ or value attribute')
# If this bit is a paragraph then add one some line breaks.
if hasattr(obj, 'name') and obj.name == 'para':
result += "\n\n"
diff --git a/gr-utils/python/modtool/gr-newmod/docs/doxygen/swig_doc.py b/gr-utils/python/modtool/gr-newmod/docs/doxygen/swig_doc.py
index d3536db8d..c735b1291 100644
--- a/gr-utils/python/modtool/gr-newmod/docs/doxygen/swig_doc.py
+++ b/gr-utils/python/modtool/gr-newmod/docs/doxygen/swig_doc.py
@@ -26,6 +26,7 @@ The file instructs SWIG to transfer the doxygen comments into the
python docstrings.
"""
+from __future__ import unicode_literals
import sys, time
@@ -309,7 +310,7 @@ if __name__ == "__main__":
# Parse command line options and set up doxyxml.
err_msg = "Execute using: python swig_doc.py xml_path outputfilename"
if len(sys.argv) != 3:
- raise StandardError(err_msg)
+ raise Exception(err_msg)
xml_path = sys.argv[1]
swigdocfilename = sys.argv[2]
di = DoxyIndex(xml_path)
diff --git a/gr-utils/python/modtool/gr-newmod/python/__init__.py b/gr-utils/python/modtool/gr-newmod/python/__init__.py
index ed385a0ab..806f287cc 100644
--- a/gr-utils/python/modtool/gr-newmod/python/__init__.py
+++ b/gr-utils/python/modtool/gr-newmod/python/__init__.py
@@ -22,6 +22,7 @@
This is the GNU Radio HOWTO module. Place your Python package
description here (python/__init__.py).
'''
+from __future__ import unicode_literals
# import swig generated symbols into the howto namespace
try:
diff --git a/gr-utils/python/modtool/gr-newmod/python/build_utils.py b/gr-utils/python/modtool/gr-newmod/python/build_utils.py
index cf58a9763..0b26844cb 100644
--- a/gr-utils/python/modtool/gr-newmod/python/build_utils.py
+++ b/gr-utils/python/modtool/gr-newmod/python/build_utils.py
@@ -21,15 +21,17 @@
"""Misc utilities used at build time
"""
+from __future__ import absolute_import
+from __future__ import unicode_literals
import re, os, os.path
-from build_utils_codes import *
+from .build_utils_codes import *
# set srcdir to the directory that contains Makefile.am
try:
srcdir = os.environ['srcdir']
-except KeyError, e:
+except KeyError as e:
srcdir = "."
srcdir = srcdir + '/'
@@ -39,7 +41,7 @@ try:
do_makefile = False
else:
do_makefile = True
-except KeyError, e:
+except KeyError as e:
do_makefile = False
# set do_sources to either true or false dependeing on the environment
@@ -48,7 +50,7 @@ try:
do_sources = False
else:
do_sources = True
-except KeyError, e:
+except KeyError as e:
do_sources = True
name_dict = {}
@@ -127,7 +129,7 @@ def extract_extension (template_name):
# we return everything between the penultimate . and .t
mo = re.search (r'\.([a-z]+)\.t$', template_name)
if not mo:
- raise ValueError, "Incorrectly formed template_name '%s'" % (template_name,)
+ raise ValueError("Incorrectly formed template_name '%s'" % (template_name,))
return mo.group (1)
def open_src (name, mode):
diff --git a/gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py b/gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py
index 9ea96baae..22a6bdb99 100644
--- a/gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py
+++ b/gr-utils/python/modtool/gr-newmod/python/build_utils_codes.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
#
# Copyright 2004 Free Software Foundation, Inc.
#
diff --git a/gr-utils/python/modtool/grc_xml_generator.py b/gr-utils/python/modtool/grc_xml_generator.py
index af17ca182..1109701f7 100644
--- a/gr-utils/python/modtool/grc_xml_generator.py
+++ b/gr-utils/python/modtool/grc_xml_generator.py
@@ -1,3 +1,4 @@
+from __future__ import absolute_import
#
# Copyright 2013 Free Software Foundation, Inc.
#
@@ -19,7 +20,7 @@
# Boston, MA 02110-1301, USA.
#
import xml.etree.ElementTree as ET
-from util_functions import is_number, xml_indent
+from .util_functions import is_number, xml_indent
try:
import lxml.etree
diff --git a/gr-utils/python/modtool/modtool_add.py b/gr-utils/python/modtool/modtool_add.py
index b39c4c3f0..acc0385ac 100644
--- a/gr-utils/python/modtool/modtool_add.py
+++ b/gr-utils/python/modtool/modtool_add.py
@@ -20,14 +20,18 @@
#
""" Module to add new blocks """
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
import os
import re
-from util_functions import append_re_line_sequence, ask_yes_no, SequenceCompleter
-from cmakefile_editor import CMakeFileEditor
-from modtool_base import ModTool, ModToolException
-from templates import Templates
-from code_generator import render_template
+from .util_functions import append_re_line_sequence, ask_yes_no, SequenceCompleter
+from .cmakefile_editor import CMakeFileEditor
+from .modtool_base import ModTool, ModToolException
+from .templates import Templates
+from .code_generator import render_template
class ModToolAdd(ModTool):
""" Add block to the out-of-tree module. """
@@ -70,12 +74,12 @@ class ModToolAdd(ModTool):
self._info['blocktype'] = options.block_type
if self._info['blocktype'] is None:
# Print list out of blocktypes to user for reference
- print str(self._block_types)
+ print(str(self._block_types))
with SequenceCompleter(sorted(self._block_types)):
while self._info['blocktype'] not in self._block_types:
- self._info['blocktype'] = raw_input("Enter block type: ")
+ self._info['blocktype'] = input("Enter block type: ")
if self._info['blocktype'] not in self._block_types:
- print 'Must be one of ' + str(self._block_types)
+ print('Must be one of ' + str(self._block_types))
# Allow user to specify language interactively if not set
self._info['lang'] = options.lang
@@ -83,34 +87,34 @@ class ModToolAdd(ModTool):
language_candidates = ('c++', 'cpp', 'python')
with SequenceCompleter(language_candidates):
while self._info['lang'] not in language_candidates:
- self._info['lang'] = raw_input("Language (python/cpp): ")
+ self._info['lang'] = input("Language (python/cpp): ")
if self._info['lang'] == 'c++':
self._info['lang'] = 'cpp'
- print "Language: %s" % {'cpp': 'C++', 'python': 'Python'}[self._info['lang']]
+ print("Language: %s" % {'cpp': 'C++', 'python': 'Python'}[self._info['lang']])
if ((self._skip_subdirs['lib'] and self._info['lang'] == 'cpp')
or (self._skip_subdirs['python'] and self._info['lang'] == 'python')):
raise ModToolException('Missing or skipping relevant subdir.')
if self._info['blockname'] is None:
- self._info['blockname'] = raw_input("Enter name of block/code (without module name prefix): ")
+ self._info['blockname'] = input("Enter name of block/code (without module name prefix): ")
if not re.match('[a-zA-Z0-9_]+', self._info['blockname']):
raise ModToolException('Invalid block name.')
- print "Block/code identifier: " + self._info['blockname']
+ print("Block/code identifier: " + self._info['blockname'])
self._info['fullblockname'] = self._info['modname'] + '_' + self._info['blockname']
if not options.license_file:
self._info['copyrightholder'] = options.copyright
if self._info['copyrightholder'] is None:
self._info['copyrightholder'] = '<+YOU OR YOUR COMPANY+>'
elif self._info['is_component']:
- print "For GNU Radio components the FSF is added as copyright holder"
+ print("For GNU Radio components the FSF is added as copyright holder")
self._license_file = options.license_file
self._info['license'] = self.setup_choose_license()
if options.argument_list is not None:
self._info['arglist'] = options.argument_list
else:
- self._info['arglist'] = raw_input('Enter valid argument list, including default arguments: ')
+ self._info['arglist'] = input('Enter valid argument list, including default arguments: ')
if not (self._info['blocktype'] in ('noblock') or self._skip_subdirs['python']):
self._add_py_qa = options.add_python_qa
@@ -122,8 +126,8 @@ class ModToolAdd(ModTool):
self._add_cc_qa = ask_yes_no('Add C++ QA code?', not self._add_py_qa)
self._skip_cmakefiles = options.skip_cmakefiles
if self._info['version'] == 'autofoo' and not self._skip_cmakefiles:
- print "Warning: Autotools modules are not supported. ",
- print "Files will be created, but Makefiles will not be edited."
+ print("Warning: Autotools modules are not supported. ",
+ "Files will be created, but Makefiles will not be edited.")
self._skip_cmakefiles = True
def setup_choose_license(self):
@@ -147,7 +151,7 @@ class ModToolAdd(ModTool):
def _write_tpl(self, tpl, path, fname):
""" Shorthand for writing a substituted template to a file"""
path_to_file = os.path.join(path, fname)
- print "Adding file '%s'..." % path_to_file
+ print("Adding file '%s'..." % path_to_file)
open(path_to_file, 'w').write(render_template(tpl, **self._info))
self.scm.add_files((path_to_file,))
@@ -201,7 +205,7 @@ class ModToolAdd(ModTool):
)
self.scm.mark_files_updated((self._file['qalib'],))
except IOError:
- print "Can't add C++ QA files."
+ print("Can't add C++ QA files.")
fname_cc = None
fname_h = None
if self._info['version'] == '37':
@@ -222,9 +226,9 @@ class ModToolAdd(ModTool):
if self._info['version'] == '37':
_add_qa()
elif self._info['version'] == '36':
- print "Warning: C++ QA files not supported for 3.6-style OOTs."
+ print("Warning: C++ QA files not supported for 3.6-style OOTs.")
elif self._info['version'] == 'autofoo':
- print "Warning: C++ QA files not supported for autotools."
+ print("Warning: C++ QA files not supported for autotools.")
if not self._skip_cmakefiles:
ed = CMakeFileEditor(self._file['cmlib'])
cmake_list_var = '[a-z]*_?' + self._info['modname'] + '_sources'
@@ -241,9 +245,9 @@ class ModToolAdd(ModTool):
- Edit main *.i file
"""
if self._get_mainswigfile() is None:
- print 'Warning: No main swig file found.'
+ print('Warning: No main swig file found.')
return
- print "Editing %s..." % self._file['swig']
+ print("Editing %s..." % self._file['swig'])
mod_block_sep = '/'
if self._info['version'] == '36':
mod_block_sep = '_'
@@ -270,11 +274,11 @@ class ModToolAdd(ModTool):
"""
fname_py_qa = 'qa_' + self._info['blockname'] + '.py'
self._write_tpl('qa_python', self._info['pydir'], fname_py_qa)
- os.chmod(os.path.join(self._info['pydir'], fname_py_qa), 0755)
+ os.chmod(os.path.join(self._info['pydir'], fname_py_qa), 0o755)
self.scm.mark_files_updated((os.path.join(self._info['pydir'], fname_py_qa),))
if self._skip_cmakefiles or CMakeFileEditor(self._file['cmpython']).check_for_glob('qa_*.py'):
return
- print "Editing %s/CMakeLists.txt..." % self._info['pydir']
+ print("Editing %s/CMakeLists.txt..." % self._info['pydir'])
open(self._file['cmpython'], 'a').write(
'GR_ADD_TEST(qa_%s ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/%s)\n' % \
(self._info['blockname'], fname_py_qa))
@@ -311,8 +315,7 @@ class ModToolAdd(ModTool):
ed = CMakeFileEditor(self._file['cmgrc'], '\n ')
if self._skip_cmakefiles or ed.check_for_glob('*.xml'):
return
- print "Editing grc/CMakeLists.txt..."
+ print("Editing grc/CMakeLists.txt...")
ed.append_value('install', fname_grc, to_ignore_end='DESTINATION[^()]+')
ed.write()
self.scm.mark_files_updated((self._file['cmgrc'],))
-
diff --git a/gr-utils/python/modtool/modtool_base.py b/gr-utils/python/modtool/modtool_base.py
index 990e63af1..e0ae963f2 100644
--- a/gr-utils/python/modtool/modtool_base.py
+++ b/gr-utils/python/modtool/modtool_base.py
@@ -20,13 +20,17 @@
#
""" Base class for the modules """
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
import os
import re
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from gnuradio import gr
-from util_functions import get_modname
-from scm import SCMRepoFactory
+from .util_functions import get_modname
+from .scm import SCMRepoFactory
class ModToolException(BaseException):
""" Standard exception for modtool classes. """
@@ -94,7 +98,7 @@ class ModTool(object):
self._info['modname'] = get_modname()
if self._info['modname'] is None:
raise ModToolException('No GNU Radio module found in the given directory.')
- print "GNU Radio module name identified: " + self._info['modname']
+ print("GNU Radio module name identified: " + self._info['modname'])
if self._info['version'] == '36' and (
os.path.isdir(os.path.join('include', self._info['modname'])) or
os.path.isdir(os.path.join('include', 'gnuradio', self._info['modname']))
@@ -144,7 +148,7 @@ class ModTool(object):
else:
self.scm = SCMRepoFactory(self.options, '.').make_empty_scm_manager()
if self.scm is None:
- print "Error: Can't set up SCM."
+ print("Error: Can't set up SCM.")
exit(1)
def _check_directory(self, directory):
@@ -156,7 +160,7 @@ class ModTool(object):
files = os.listdir(directory)
os.chdir(directory)
except OSError:
- print "Can't read or chdir to directory %s." % directory
+ print("Can't read or chdir to directory %s." % directory)
return False
self._info['is_component'] = False
for f in files:
@@ -170,11 +174,11 @@ class ModTool(object):
has_makefile = True
# TODO search for autofoo
elif os.path.isdir(f):
- if (f in self._has_subdirs.keys()):
+ if (f in list(self._has_subdirs.keys())):
self._has_subdirs[f] = True
else:
self._skip_subdirs[f] = True
- return bool(has_makefile and (self._has_subdirs.values()))
+ return bool(has_makefile and (list(self._has_subdirs.values())))
def _get_mainswigfile(self):
""" Find out which name the main SWIG file has. In particular, is it
diff --git a/gr-utils/python/modtool/modtool_disable.py b/gr-utils/python/modtool/modtool_disable.py
index 1772a740f..619858978 100644
--- a/gr-utils/python/modtool/modtool_disable.py
+++ b/gr-utils/python/modtool/modtool_disable.py
@@ -20,12 +20,16 @@
#
""" Disable blocks module """
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
import os
import re
import sys
-from modtool_base import ModTool
-from cmakefile_editor import CMakeFileEditor
+from .modtool_base import ModTool
+from .cmakefile_editor import CMakeFileEditor
class ModToolDisable(ModTool):
@@ -46,7 +50,7 @@ class ModToolDisable(ModTool):
if options.blockname is not None:
self._info['pattern'] = options.blockname
else:
- self._info['pattern'] = raw_input('Which blocks do you want to disable? (Regex): ')
+ self._info['pattern'] = input('Which blocks do you want to disable? (Regex): ')
if len(self._info['pattern']) == 0:
self._info['pattern'] = '.'
@@ -62,7 +66,7 @@ class ModToolDisable(ModTool):
try:
initfile = open(self._file['pyinit']).read()
except IOError:
- print "Could not edit __init__.py, that might be a problem."
+ print("Could not edit __init__.py, that might be a problem.")
return False
pymodname = os.path.splitext(fname)[0]
initfile = re.sub(r'((from|import)\s+\b'+pymodname+r'\b)', r'#\1', initfile)
@@ -93,14 +97,14 @@ class ModToolDisable(ModTool):
self._info['modname'], fname),
r'//\1', swigfile)
if nsubs > 0:
- print "Changing %s..." % self._file['swig']
+ print("Changing %s..." % self._file['swig'])
if nsubs > 1: # Need to find a single BLOCK_MAGIC
blockname = os.path.splitext(fname[len(self._info['modname'])+1:])[0]
if self._info['version'] == '37':
blockname = os.path.splitext(fname)[0]
(swigfile, nsubs) = re.subn('(GR_SWIG_BLOCK_MAGIC2?.+%s.+;)' % blockname, r'//\1', swigfile)
if nsubs > 1:
- print "Hm, changed more then expected while editing %s." % self._file['swig']
+ print("Hm, changed more then expected while editing %s." % self._file['swig'])
open(self._file['swig'], 'w').write(swigfile)
self.scm.mark_file_updated(self._file['swig'])
return False
@@ -112,7 +116,7 @@ class ModToolDisable(ModTool):
if self._info['version'] == '37':
blockname = os.path.splitext(fname)[0]
swigfile = re.sub('(%include\s+"'+fname+'")', r'//\1', swigfile)
- print "Changing %s..." % self._file['swig']
+ print("Changing %s..." % self._file['swig'])
swigfile = re.sub('(GR_SWIG_BLOCK_MAGIC2?.+'+blockname+'.+;)', r'//\1', swigfile)
open(self._file['swig'], 'w').write(swigfile)
self.scm.mark_file_updated(self._file['swig'])
@@ -135,13 +139,13 @@ class ModToolDisable(ModTool):
cmake = CMakeFileEditor(os.path.join(subdir, 'CMakeLists.txt'))
except IOError:
continue
- print "Traversing %s..." % subdir
+ print("Traversing %s..." % subdir)
filenames = cmake.find_filenames_match(self._info['pattern'])
yes = self._info['yes']
for fname in filenames:
file_disabled = False
if not yes:
- ans = raw_input("Really disable %s? [Y/n/a/q]: " % fname).lower().strip()
+ ans = input("Really disable %s? [Y/n/a/q]: " % fname).lower().strip()
if ans == 'a':
yes = True
if ans == 'q':
@@ -155,5 +159,5 @@ class ModToolDisable(ModTool):
cmake.disable_file(fname)
cmake.write()
self.scm.mark_files_updated((os.path.join(subdir, 'CMakeLists.txt'),))
- print "Careful: 'gr_modtool disable' does not resolve dependencies."
+ print("Careful: 'gr_modtool disable' does not resolve dependencies.")
diff --git a/gr-utils/python/modtool/modtool_info.py b/gr-utils/python/modtool/modtool_info.py
index 317948239..4be302e03 100644
--- a/gr-utils/python/modtool/modtool_info.py
+++ b/gr-utils/python/modtool/modtool_info.py
@@ -1,4 +1,3 @@
-#
# Copyright 2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
@@ -20,10 +19,14 @@
#
""" Returns information about a module """
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
import os
-from modtool_base import ModTool, ModToolException
-from util_functions import get_modname
+from .modtool_base import ModTool, ModToolException
+from .util_functions import get_modname
class ModToolInfo(ModTool):
@@ -70,7 +73,7 @@ class ModToolInfo(ModTool):
):
self._info['version'] = '37'
mod_info['version'] = self._info['version']
- if 'is_component' in self._info.keys() and self._info['is_component']:
+ if 'is_component' in list(self._info.keys()) and self._info['is_component']:
mod_info['is_component'] = True
mod_info['incdirs'] = []
mod_incl_dir = os.path.join(mod_info['base_dir'], 'include')
@@ -83,7 +86,7 @@ class ModToolInfo(ModTool):
mod_info['build_dir'] = build_dir
mod_info['incdirs'] += self._get_include_dirs(mod_info)
if self._python_readable:
- print str(mod_info)
+ print(str(mod_info))
else:
self._pretty_print(mod_info)
@@ -106,7 +109,7 @@ class ModToolInfo(ModTool):
If that hasn't happened, the build dir cannot be detected, unless it's
called 'build', which is then assumed to be the build dir. """
base_build_dir = mod_info['base_dir']
- if 'is_component' in mod_info.keys():
+ if 'is_component' in list(mod_info.keys()):
(base_build_dir, rest_dir) = os.path.split(base_build_dir)
has_build_dir = os.path.isdir(os.path.join(base_build_dir , 'build'))
if (has_build_dir and os.path.isfile(os.path.join(base_build_dir, 'CMakeCache.txt'))):
@@ -123,7 +126,7 @@ class ModToolInfo(ModTool):
""" Figure out include dirs for the make process. """
inc_dirs = []
path_or_internal = {True: 'INTERNAL',
- False: 'PATH'}['is_component' in mod_info.keys()]
+ False: 'PATH'}['is_component' in list(mod_info.keys())]
try:
cmakecache_fid = open(os.path.join(mod_info['build_dir'], 'CMakeCache.txt'))
for line in cmakecache_fid:
@@ -135,19 +138,19 @@ class ModToolInfo(ModTool):
inc_dirs = [os.path.normpath(path) for path in self._suggested_dirs.split(':') if os.path.isdir(path)]
return inc_dirs
- def _pretty_print(self, mod_info):
+ def _pretty_print(elf, mod_info):
""" Output the module info in human-readable format """
index_names = {'base_dir': 'Base directory',
'modname': 'Module name',
'is_component': 'Is GR component',
'build_dir': 'Build directory',
'incdirs': 'Include directories'}
- for key in mod_info.keys():
+ for key in list(mod_info.keys()):
if key == 'version':
- print " API version: %s" % {
+ print(" API version: %s" % {
'36': 'pre-3.7',
'37': 'post-3.7',
'autofoo': 'Autotools (pre-3.5)'
- }[mod_info['version']]
+ }[mod_info['version']])
else:
- print '%19s: %s' % (index_names[key], mod_info[key])
+ print('%19s: %s' % (index_names[key], mod_info[key]))
diff --git a/gr-utils/python/modtool/modtool_makexml.py b/gr-utils/python/modtool/modtool_makexml.py
index 311ed96cb..74fed4b7a 100644
--- a/gr-utils/python/modtool/modtool_makexml.py
+++ b/gr-utils/python/modtool/modtool_makexml.py
@@ -20,15 +20,19 @@
#
""" Automatically create XML bindings for GRC from block code """
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
import os
import re
import glob
-from modtool_base import ModTool, ModToolException
-from parser_cc_block import ParserCCBlock
-from grc_xml_generator import GRCXMLGenerator
-from cmakefile_editor import CMakeFileEditor
-from util_functions import ask_yes_no
+from .modtool_base import ModTool, ModToolException
+from .parser_cc_block import ParserCCBlock
+from .grc_xml_generator import GRCXMLGenerator
+from .cmakefile_editor import CMakeFileEditor
+from .util_functions import ask_yes_no
class ModToolMakeXML(ModTool):
@@ -54,13 +58,13 @@ class ModToolMakeXML(ModTool):
if options.blockname is not None:
self._info['pattern'] = options.blockname
else:
- self._info['pattern'] = raw_input('Which blocks do you want to parse? (Regex): ')
+ self._info['pattern'] = input('Which blocks do you want to parse? (Regex): ')
if len(self._info['pattern']) == 0:
self._info['pattern'] = '.'
def run(self, options):
""" Go, go, go! """
- print "Warning: This is an experimental feature. Don't expect any magic."
+ print("Warning: This is an experimental feature. Don't expect any magic.")
self.setup(options)
# 1) Go through lib/
if not self._skip_subdirs['lib']:
@@ -80,12 +84,12 @@ class ModToolMakeXML(ModTool):
""" Search for files matching pattern in the given path. """
files = sorted(glob.glob("%s/%s"% (path, path_glob)))
files_filt = []
- print "Searching for matching files in %s/:" % path
+ print("Searching for matching files in %s/:" % path)
for f in files:
if re.search(self._info['pattern'], os.path.basename(f)) is not None:
files_filt.append(f)
if len(files_filt) == 0:
- print "None found."
+ print("None found.")
return files_filt
def _make_grc_xml_from_block_data(self, params, iosig, blockname):
@@ -110,7 +114,7 @@ class ModToolMakeXML(ModTool):
return
else:
file_exists = True
- print "Warning: Overwriting existing GRC file."
+ print("Warning: Overwriting existing GRC file.")
grc_generator = GRCXMLGenerator(
modname=self._info['modname'],
blockname=blockname,
@@ -125,7 +129,7 @@ class ModToolMakeXML(ModTool):
if not self._skip_subdirs['grc']:
ed = CMakeFileEditor(self._file['cmgrc'])
if re.search(fname_xml, ed.cfile) is None and not ed.check_for_glob('*.xml'):
- print "Adding GRC bindings to grc/CMakeLists.txt..."
+ print("Adding GRC bindings to grc/CMakeLists.txt...")
ed.append_value('install', fname_xml, to_ignore_end='DESTINATION[^()]+')
ed.write()
self.scm.mark_files_updated(self._file['cmgrc'])
@@ -158,7 +162,7 @@ class ModToolMakeXML(ModTool):
blockname = blockname.replace(self._info['modname']+'_', '', 1)
return (blockname, fname_h)
# Go, go, go
- print "Making GRC bindings for %s..." % fname_cc
+ print("Making GRC bindings for %s..." % fname_cc)
(blockname, fname_h) = _get_blockdata(fname_cc)
try:
parser = ParserCCBlock(fname_cc,
diff --git a/gr-utils/python/modtool/modtool_newmod.py b/gr-utils/python/modtool/modtool_newmod.py
index 4382d9be7..c283204ee 100644
--- a/gr-utils/python/modtool/modtool_newmod.py
+++ b/gr-utils/python/modtool/modtool_newmod.py
@@ -20,12 +20,16 @@
#
""" Create a whole new out-of-tree module """
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
import shutil
import os
import re
from gnuradio import gr
-from modtool_base import ModTool, ModToolException
-from scm import SCMRepoFactory
+from .modtool_base import ModTool, ModToolException
+from .scm import SCMRepoFactory
class ModToolNewModule(ModTool):
""" Create a new out-of-tree module """
@@ -49,7 +53,7 @@ class ModToolNewModule(ModTool):
if options.module_name:
self._info['modname'] = options.module_name
else:
- self._info['modname'] = raw_input('Name of the new module: ')
+ self._info['modname'] = input('Name of the new module: ')
if not re.match('[a-zA-Z0-9_]+$', self._info['modname']):
raise ModToolException('Invalid module name.')
self._dir = options.directory
@@ -76,7 +80,7 @@ class ModToolNewModule(ModTool):
* Rename files and directories that contain the word howto
"""
self.setup(options)
- print "Creating out-of-tree module in %s..." % self._dir,
+ print("Creating out-of-tree module in %s..." % (self._dir,))
try:
shutil.copytree(self._srcdir, self._dir)
os.chdir(self._dir)
@@ -93,8 +97,8 @@ class ModToolNewModule(ModTool):
os.rename(f, os.path.join(root, filename.replace('howto', self._info['modname'])))
if os.path.basename(root) == 'howto':
os.rename(root, os.path.join(os.path.dirname(root), self._info['modname']))
- print "Done."
+ print("Done.")
if self.scm.init_repo(path_to_repo="."):
- print "Created repository... you might want to commit before continuing."
- print "Use 'gr_modtool add' to add a new block to this currently empty module."
+ print("Created repository... you might want to commit before continuing.")
+ print("Use 'gr_modtool add' to add a new block to this currently empty module.")
diff --git a/gr-utils/python/modtool/modtool_rename.py b/gr-utils/python/modtool/modtool_rename.py
index 6b1f6da11..b9112fb8c 100644
--- a/gr-utils/python/modtool/modtool_rename.py
+++ b/gr-utils/python/modtool/modtool_rename.py
@@ -20,13 +20,17 @@
#
""" Module to rename blocks """
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
import os
import re
-from util_functions import append_re_line_sequence, ask_yes_no
-from cmakefile_editor import CMakeFileEditor
-from modtool_base import ModTool, ModToolException
-from templates import Templates
+from .util_functions import append_re_line_sequence, ask_yes_no
+from .cmakefile_editor import CMakeFileEditor
+from .modtool_base import ModTool, ModToolException
+from .templates import Templates
class ModToolRename(ModTool):
""" Rename a block in the out-of-tree module. """
@@ -58,20 +62,20 @@ class ModToolRename(ModTool):
# first make sure the old block name is provided
self._info['oldname'] = options.blockname
if self._info['oldname'] is None:
- self._info['oldname'] = raw_input("Enter name of block/code to rename (without module name prefix): ")
+ self._info['oldname'] = input("Enter name of block/code to rename (without module name prefix): ")
if not re.match('[a-zA-Z0-9_]+', self._info['oldname']):
raise ModToolException('Invalid block name.')
- print "Block/code to rename identifier: " + self._info['oldname']
+ print("Block/code to rename identifier: " + self._info['oldname'])
self._info['fulloldname'] = self._info['modname'] + '_' + self._info['oldname']
# now get the new block name
if options.new_name is None:
- self._info['newname'] = raw_input("Enter name of block/code (without module name prefix): ")
+ self._info['newname'] = input("Enter name of block/code (without module name prefix): ")
else:
self._info['newname'] = options.new_name[0]
if not re.match('[a-zA-Z0-9_]+', self._info['newname']):
raise ModToolException('Invalid block name.')
- print "Block/code identifier: " + self._info['newname']
+ print("Block/code identifier: " + self._info['newname'])
self._info['fullnewname'] = self._info['modname'] + '_' + self._info['newname']
def run(self, options):
@@ -80,7 +84,7 @@ class ModToolRename(ModTool):
module = self._info['modname']
oldname = self._info['oldname']
newname = self._info['newname']
- print "In module '%s' rename block '%s' to '%s'" % (module, oldname, newname)
+ print("In module '%s' rename block '%s' to '%s'" % (module, oldname, newname))
self._run_swig_rename(self._file['swig'], oldname, newname)
self._run_grc_rename(self._info['modname'], oldname, newname)
self._run_python_qa(self._info['modname'], oldname, newname)
@@ -93,11 +97,11 @@ class ModToolRename(ModTool):
""" Rename SWIG includes and block_magic """
nsubs = self._run_file_replace(swigfilename, old, new)
if nsubs < 1:
- print "Couldn't find '%s' in file '%s'." % (old, swigfilename)
+ print("Couldn't find '%s' in file '%s'." % (old, swigfilename))
if nsubs == 2:
- print "Changing 'noblock' type file"
+ print("Changing 'noblock' type file")
if nsubs > 3:
- print "Hm, changed more then expected while editing %s." % swigfilename
+ print("Hm, changed more then expected while editing %s." % swigfilename)
return False
def _run_lib(self, module, old, new):
@@ -117,7 +121,7 @@ class ModToolRename(ModTool):
filename = 'qa_' + module + '.cc'
nsubs = self._run_file_replace(path + filename, old, new)
if nsubs > 0:
- print "C++ QA code detected, renaming..."
+ print("C++ QA code detected, renaming...")
filename = 'qa_' + old + '.cc'
self._run_file_replace(path + filename, old, new)
filename = 'qa_' + old + '.h'
@@ -125,7 +129,7 @@ class ModToolRename(ModTool):
self._run_file_replace(path + filename, old.upper(), new.upper())
self._run_file_rename(path, 'qa_' + old, 'qa_' + new)
else:
- print "No C++ QA code detected, skipping..."
+ print("No C++ QA code detected, skipping...")
def _run_include(self, module, old, new):
path = './include/' + module + '/'
@@ -140,13 +144,13 @@ class ModToolRename(ModTool):
filename = '__init__.py'
nsubs = self._run_file_replace(path + filename, old, new)
if nsubs > 0:
- print "Python block detected, renaming..."
+ print("Python block detected, renaming...")
filename = old + '.py'
self._run_file_replace(path + filename, old, new)
self._run_cmakelists(path, old, new)
self._run_file_rename(path, old, new)
else:
- print "Not a Python block, nothing to do here..."
+ print("Not a Python block, nothing to do here...")
def _run_python_qa(self, module, old, new):
new = 'qa_' + new
@@ -166,7 +170,7 @@ class ModToolRename(ModTool):
filename = path + 'CMakeLists.txt'
nsubs = self._run_file_replace(filename, first, second)
if nsubs < 1:
- print "'%s' wasn't in '%s'." % (first, filename)
+ print("'%s' wasn't in '%s'." % (first, filename))
def _run_file_rename(self, path, old, new):
files = os.listdir(path)
@@ -175,14 +179,14 @@ class ModToolRename(ModTool):
nl = file.replace(old, new)
src = path + file
dst = path + nl
- print "Renaming file '%s' to '%s'." % (src, dst)
+ print("Renaming file '%s' to '%s'." % (src, dst))
os.rename(src, dst)
def _run_file_replace(self, filename, old, new):
if not os.path.isfile(filename):
return False
else:
- print "In '%s' renaming occurrences of '%s' to '%s'" % (filename, old, new)
+ print("In '%s' renaming occurrences of '%s' to '%s'" % (filename, old, new))
cfile = open(filename).read()
(cfile, nsubs) = re.subn(old, new, cfile)
diff --git a/gr-utils/python/modtool/modtool_rm.py b/gr-utils/python/modtool/modtool_rm.py
index 767cb6b08..b503fa2bf 100644
--- a/gr-utils/python/modtool/modtool_rm.py
+++ b/gr-utils/python/modtool/modtool_rm.py
@@ -20,14 +20,18 @@
#
""" Remove blocks module """
+from __future__ import print_function
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
import os
import re
import sys
import glob
-from util_functions import remove_pattern_from_file, SequenceCompleter
-from modtool_base import ModTool
-from cmakefile_editor import CMakeFileEditor
+from .util_functions import remove_pattern_from_file, SequenceCompleter
+from .modtool_base import ModTool
+from .cmakefile_editor import CMakeFileEditor
class ModToolRemove(ModTool):
@@ -49,7 +53,7 @@ class ModToolRemove(ModTool):
self._info['pattern'] = options.blockname
else:
with SequenceCompleter():
- self._info['pattern'] = raw_input('Which blocks do you want to delete? (Regex): ')
+ self._info['pattern'] = input('Which blocks do you want to delete? (Regex): ')
if len(self._info['pattern']) == 0:
self._info['pattern'] = '.'
@@ -133,12 +137,12 @@ class ModToolRemove(ModTool):
for g in globs:
files = files + sorted(glob.glob("%s/%s"% (path, g)))
files_filt = []
- print "Searching for matching files in %s/:" % path
+ print("Searching for matching files in %s/:" % path)
for f in files:
if re.search(self._info['pattern'], os.path.basename(f)) is not None:
files_filt.append(f)
if len(files_filt) == 0:
- print "None found."
+ print("None found.")
return []
# 2. Delete files, Makefile entries and other occurrences
files_deleted = []
@@ -147,7 +151,7 @@ class ModToolRemove(ModTool):
for f in files_filt:
b = os.path.basename(f)
if not yes:
- ans = raw_input("Really delete %s? [Y/n/a/q]: " % f).lower().strip()
+ ans = input("Really delete %s? [Y/n/a/q]: " % f).lower().strip()
if ans == 'a':
yes = True
if ans == 'q':
@@ -155,10 +159,10 @@ class ModToolRemove(ModTool):
if ans == 'n':
continue
files_deleted.append(b)
- print "Deleting %s." % f
+ print("Deleting %s." % f)
self.scm.remove_file(f)
os.unlink(f)
- print "Deleting occurrences of %s from %s/CMakeLists.txt..." % (b, path)
+ print("Deleting occurrences of %s from %s/CMakeLists.txt..." % (b, path))
for var in makefile_vars:
ed.remove_value(var, b)
if cmakeedit_func is not None:
diff --git a/gr-utils/python/modtool/parser_cc_block.py b/gr-utils/python/modtool/parser_cc_block.py
index 703522c8f..fffdf309d 100644
--- a/gr-utils/python/modtool/parser_cc_block.py
+++ b/gr-utils/python/modtool/parser_cc_block.py
@@ -19,6 +19,10 @@
# Boston, MA 02110-1301, USA.
#
''' A parser for blocks written in C++ '''
+
+from __future__ import print_function
+from __future__ import unicode_literals
+
import re
import sys
@@ -42,7 +46,7 @@ class ParserCCBlock(object):
E.g., for sizeof(int), it will return 'int'.
Returns a list! """
if 'gr::io_signature::makev' in iosigcall:
- print 'tbi'
+ print('tbi')
raise ValueError
return {'type': [_typestr_to_iotype(x) for x in typestr.split(',')],
'vlen': [_typestr_to_vlen(x) for x in typestr.split(',')]
@@ -82,15 +86,15 @@ class ParserCCBlock(object):
iosig_match.group('intype'))
iosig['in']['min_ports'] = iosig_match.group('inmin')
iosig['in']['max_ports'] = iosig_match.group('inmax')
- except ValueError, Exception:
- print "Error: Can't parse input signature."
+ except Exception:
+ print("Error: Can't parse input signature.")
try:
iosig['out'] = _figure_out_iotype_and_vlen(iosig_match.group('outcall'),
iosig_match.group('outtype'))
iosig['out']['min_ports'] = iosig_match.group('outmin')
iosig['out']['max_ports'] = iosig_match.group('outmax')
- except ValueError, Exception:
- print "Error: Can't parse output signature."
+ except Exception:
+ print("Error: Can't parse output signature.")
return iosig
@@ -213,7 +217,7 @@ class ParserCCBlock(object):
try:
params_list = _scan_param_list(make_match.end(0))
except ValueError as ve:
- print "Can't parse the argument list: ", ve.args[0]
+ print("Can't parse the argument list: ", ve.args[0])
sys.exit(0)
params = []
for plist in params_list:
diff --git a/gr-utils/python/modtool/scm.py b/gr-utils/python/modtool/scm.py
index 9b0ef7db5..5e80e2499 100644
--- a/gr-utils/python/modtool/scm.py
+++ b/gr-utils/python/modtool/scm.py
@@ -20,6 +20,9 @@
#
""" Class to handle source code management repositories. """
+from __future__ import print_function
+from __future__ import unicode_literals
+
import subprocess
try:
@@ -191,12 +194,12 @@ class SCMRepoFactory(object):
""" Returns a valid, usable object of type SCMRepository. """
if self.options.scm_mode == 'no':
return SCMRepository(self.path_to_repo)
- for glbl in globals().values():
+ for glbl in list(globals().values()):
try:
if issubclass(glbl, SCMRepository):
the_scm = glbl(self.path_to_repo)
if the_scm.is_active():
- print 'Found SCM of type:', the_scm.handles_scm_type
+ print('Found SCM of type:', the_scm.handles_scm_type)
return the_scm
except (TypeError, AttributeError, InvalidSCMError):
pass
@@ -208,7 +211,7 @@ class SCMRepoFactory(object):
""" Returns a valid, usable object of type SCMRepository for an uninitialized dir. """
if self.options.scm_mode == 'no':
return SCMRepository(self.path_to_repo)
- for glbl in globals().values():
+ for glbl in list(globals().values()):
try:
if issubclass(glbl, SCMRepository):
if glbl.handles_scm_type == scm_type:
diff --git a/gr-utils/python/modtool/templates.py b/gr-utils/python/modtool/templates.py
index 3829f7a64..64c99802f 100644
--- a/gr-utils/python/modtool/templates.py
+++ b/gr-utils/python/modtool/templates.py
@@ -19,6 +19,7 @@
# Boston, MA 02110-1301, USA.
#
''' All the templates for skeleton files (needed by ModToolAdd) '''
+from __future__ import unicode_literals
from datetime import datetime
diff --git a/gr-utils/python/modtool/util_functions.py b/gr-utils/python/modtool/util_functions.py
index 59f8984ca..6ba73d82a 100644
--- a/gr-utils/python/modtool/util_functions.py
+++ b/gr-utils/python/modtool/util_functions.py
@@ -20,6 +20,8 @@
#
""" Utility functions for gr_modtool """
+from __future__ import unicode_literals
+
import re
import sys
import readline
@@ -73,7 +75,7 @@ def strip_arg_types(string):
string = strip_default_values(string)
return ", ".join(
[part.strip().split(' ')[-1] for part in string.split(',')]
- ).translate(None, '*&')
+ ).translate(str.maketrans('','','*&'))
def strip_arg_types_grc(string):
"""" Strip the argument types from a list of arguments for GRC make tag.
@@ -98,7 +100,7 @@ def get_modname():
regexp = r'(project\s*\(\s*|GR_REGISTER_COMPONENT\(")gr-(?P<modname>[a-zA-Z0-9-_]+)(\s*(CXX)?|" ENABLE)'
try:
modname = re.search(regexp, cmfile, flags=re.MULTILINE).group('modname').strip()
- if modname in modname_trans.keys():
+ if modname in list(modname_trans.keys()):
modname = modname_trans[modname]
return modname
except AttributeError:
@@ -132,7 +134,7 @@ def ask_yes_no(question, default):
""" Asks a binary question. Returns True for yes, False for no.
default is given as a boolean. """
question += {True: ' [Y/n] ', False: ' [y/N] '}[default]
- if raw_input(question).lower() != {True: 'n', False: 'y'}[default]:
+ if input(question).lower() != {True: 'n', False: 'y'}[default]:
return default
else:
return not default
diff --git a/gr-utils/python/utils/gr_modtool b/gr-utils/python/utils/gr_modtool
index 7d035a659..f959c91f6 100755
--- a/gr-utils/python/utils/gr_modtool
+++ b/gr-utils/python/utils/gr_modtool
@@ -21,6 +21,8 @@
#
""" A tool for editing GNU Radio out-of-tree modules. """
+from __future__ import print_function
+
from gnuradio.modtool import *
@@ -46,7 +48,7 @@ def main():
try:
args.module().run(args)
except ModToolException as err:
- print >> sys.stderr, err
+ print(err, file=sys.stderr)
exit(1)
if __name__ == '__main__':
diff --git a/gr-utils/python/utils/gr_plot_char b/gr-utils/python/utils/gr_plot_char
index ee644557b..3199919fa 100755
--- a/gr-utils/python/utils/gr_plot_char
+++ b/gr-utils/python/utils/gr_plot_char
@@ -20,11 +20,13 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+
try:
import scipy
except ImportError:
- print "Please install SciPy to run this script (http://www.scipy.org/)"
- raise SystemExit, 1
+ print("Please install SciPy to run this script (http://www.scipy.org/)")
+ raise SystemExit(1)
from argparse import ArgumentParser
from gnuradio.plot_data import plot_data
diff --git a/gr-utils/python/utils/gr_plot_const b/gr-utils/python/utils/gr_plot_const
index 653a2539b..2ec54c358 100755
--- a/gr-utils/python/utils/gr_plot_const
+++ b/gr-utils/python/utils/gr_plot_const
@@ -20,18 +20,20 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+
try:
import scipy
except ImportError:
- print "Please install SciPy to run this script (http://www.scipy.org/)"
- raise SystemExit, 1
+ print("Please install SciPy to run this script (http://www.scipy.org/)")
+ raise SystemExit(1)
try:
from pylab import *
from matplotlib.font_manager import fontManager, FontProperties
except ImportError:
- print "Please install Matplotlib to run this script (http://matplotlib.sourceforge.net/)"
- raise SystemExit, 1
+ print("Please install Matplotlib to run this script (http://matplotlib.sourceforge.net/)")
+ raise SystemExit(1)
from argparse import ArgumentParser
@@ -83,7 +85,7 @@ class draw_constellation:
try:
iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length)
except MemoryError:
- print "End of File"
+ print("End of File")
else:
# retesting length here as newer version of scipy does not throw a MemoryError, just
# returns a zero-length array
@@ -94,7 +96,7 @@ class draw_constellation:
self.time = scipy.array([i*(1/self.sample_rate) for i in range(len(self.reals))])
return True
else:
- print "End of File"
+ print("End of File")
return False
def make_plots(self):
@@ -215,9 +217,9 @@ class draw_constellation:
def find(item_in, list_search):
try:
- return list_search.index(item_in) != None
+ return list_search.index(item_in) != None
except ValueError:
- return False
+ return False
def main():
@@ -241,6 +243,3 @@ if __name__ == "__main__":
main()
except KeyboardInterrupt:
pass
-
-
-
diff --git a/gr-utils/python/utils/gr_plot_float b/gr-utils/python/utils/gr_plot_float
index faf8106d7..4fd86549e 100755
--- a/gr-utils/python/utils/gr_plot_float
+++ b/gr-utils/python/utils/gr_plot_float
@@ -20,11 +20,13 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+
try:
import scipy
except ImportError:
- print "Please install SciPy to run this script (http://www.scipy.org/)"
- raise SystemExit, 1
+ print("Please install SciPy to run this script (http://www.scipy.org/)")
+ raise SystemExit(1)
from argparse import ArgumentParser
from gnuradio.plot_data import plot_data
diff --git a/gr-utils/python/utils/gr_plot_int b/gr-utils/python/utils/gr_plot_int
index c687f13b1..b4051fa15 100755
--- a/gr-utils/python/utils/gr_plot_int
+++ b/gr-utils/python/utils/gr_plot_int
@@ -23,8 +23,8 @@
try:
import scipy
except ImportError:
- print "Please install SciPy to run this script (http://www.scipy.org/)"
- raise SystemExit, 1
+ print("Please install SciPy to run this script (http://www.scipy.org/)")
+ raise SystemExit(1)
from argparse import ArgumentParser
from gnuradio.plot_data import plot_data
diff --git a/gr-utils/python/utils/gr_plot_iq b/gr-utils/python/utils/gr_plot_iq
index 7409b7390..f27f75d41 100755
--- a/gr-utils/python/utils/gr_plot_iq
+++ b/gr-utils/python/utils/gr_plot_iq
@@ -20,17 +20,19 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+
try:
import scipy
except ImportError:
- print "Please install SciPy to run this script (http://www.scipy.org/)"
- raise SystemExit, 1
+ print("Please install SciPy to run this script (http://www.scipy.org/)")
+ raise SystemExit(1)
try:
from pylab import *
except ImportError:
- print "Please install Matplotlib to run this script (http://matplotlib.sourceforge.net/)"
- raise SystemExit, 1
+ print("Please install Matplotlib to run this script (http://matplotlib.sourceforge.net/)")
+ raise SystemExit(1)
from argparse import ArgumentParser
@@ -81,7 +83,7 @@ class draw_iq:
try:
self.iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length)
except MemoryError:
- print "End of File"
+ print("End of File")
else:
self.reals = scipy.array([r.real for r in self.iq])
self.imags = scipy.array([i.imag for i in self.iq])
@@ -144,9 +146,9 @@ class draw_iq:
def find(item_in, list_search):
try:
- return list_search.index(item_in) != None
+ return list_search.index(item_in) != None
except ValueError:
- return False
+ return False
def main():
description = "Takes a GNU Radio complex binary file and displays the I&Q data versus time. You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples."
@@ -170,6 +172,3 @@ if __name__ == "__main__":
main()
except KeyboardInterrupt:
pass
-
-
-
diff --git a/gr-utils/python/utils/gr_plot_qt b/gr-utils/python/utils/gr_plot_qt
index 9205d23a7..854ecc53b 100755
--- a/gr-utils/python/utils/gr_plot_qt
+++ b/gr-utils/python/utils/gr_plot_qt
@@ -4,34 +4,34 @@ try:
import scipy
from scipy import fftpack
except ImportError:
- print "Please install SciPy to run this script (http://www.scipy.org/)"
- raise SystemExit, 1
+ print("Please install SciPy to run this script (http://www.scipy.org/)")
+ raise SystemExit(1)
try:
from matplotlib import mlab
except ImportError:
- print "Please install Matplotlib to run this script (http://matplotlib.sourceforge.net)"
- raise SystemExit, 1
+ print("Please install Matplotlib to run this script (http://matplotlib.sourceforge.net)")
+ raise SystemExit(1)
try:
from PyQt4 import Qt, QtCore, QtGui
except ImportError:
- print "Please install PyQt4 to run this script (http://www.riverbankcomputing.co.uk/software/pyqt/download)"
- raise SystemExit, 1
+ print("Please install PyQt4 to run this script (http://www.riverbankcomputing.co.uk/software/pyqt/download)")
+ raise SystemExit(1)
try:
import PyQt4.Qwt5 as Qwt
except ImportError:
- print "Please install PyQwt5 to run this script (http://pyqwt.sourceforge.net/)"
- raise SystemExit, 1
+ print("Please install PyQwt5 to run this script (http://pyqwt.sourceforge.net/)")
+ raise SystemExit(1)
try:
# FIXME: re-enable this before committing
#from gnuradio.pyqt_plot import Ui_MainWindow
from gnuradio.pyqt_plot import Ui_MainWindow
except ImportError:
- print "Could not import from pyqt_plot. Please build with \"pyuic4 pyqt_plot.ui -o pyqt_plot.py\""
- raise SystemExit, 1
+ print("Could not import from pyqt_plot. Please build with \"pyuic4 pyqt_plot.ui -o pyqt_plot.py\"")
+ raise SystemExit(1)
import sys, os
from optparse import OptionParser
@@ -284,7 +284,7 @@ class gr_plot_qt(QtGui.QMainWindow):
def open_file(self):
filename = Qt.QFileDialog.getOpenFileName(self, "Open", ".")
if(filename != ""):
- #print filename
+ #print(filename)
self.initialize(filename)
def reload_file(self):
@@ -320,7 +320,7 @@ class gr_plot_qt(QtGui.QMainWindow):
def init_data_input(self):
self.hfile.seek(0, os.SEEK_END)
self.signal_size = self.hfile.tell()/self.sizeof_data
- #print "Sizeof File: ", self.signal_size
+ #print("Sizeof File: ", self.signal_size)
self.hfile.seek(0, os.SEEK_SET)
def get_data(self, start, end):
@@ -338,7 +338,7 @@ class gr_plot_qt(QtGui.QMainWindow):
tstep = 1.0 / self.sample_rate
self.iq = iq
- self.time = [tstep*(self.position + i) for i in xrange(len(self.iq))]
+ self.time = [tstep*(self.position + i) for i in range(len(self.iq))]
self.set_file_pos_box(start, end)
except MemoryError:
diff --git a/gr-utils/python/utils/gr_plot_short b/gr-utils/python/utils/gr_plot_short
index f900af1ba..d367ea381 100755
--- a/gr-utils/python/utils/gr_plot_short
+++ b/gr-utils/python/utils/gr_plot_short
@@ -20,11 +20,13 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+
try:
import scipy
except ImportError:
- print "Please install SciPy to run this script (http://www.scipy.org/)"
- raise SystemExit, 1
+ print("Please install SciPy to run this script (http://www.scipy.org/)")
+ raise SystemExit(1)
from argparse import ArgumentParser
from gnuradio.plot_data import plot_data
diff --git a/gr-utils/python/utils/gr_read_file_metadata b/gr-utils/python/utils/gr_read_file_metadata
index a05e7ad2c..1a94560ad 100644
--- a/gr-utils/python/utils/gr_read_file_metadata
+++ b/gr-utils/python/utils/gr_read_file_metadata
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+
import sys
from argparse import ArgumentParser
@@ -45,7 +47,7 @@ def main(filename, detached=False):
sys.stderr.write("Could not deserialize header: invalid or corrupt data file.\n")
sys.exit(1)
- print "HEADER {0}".format(nheaders)
+ print("HEADER {0}".format(nheaders))
info = parse_file_metadata.parse_header(header, True)
if(info["extra_len"] > 0):
@@ -59,7 +61,7 @@ def main(filename, detached=False):
sys.stderr.write("Could not deserialize extras: invalid or corrupt data file.\n")
sys.exit(1)
- print "\nExtra Header:"
+ print("\nExtra Header:")
extra_info = parse_file_metadata.parse_extra_dict(extra, info, True)
nheaders += 1
@@ -67,7 +69,7 @@ def main(filename, detached=False):
if(not detached):
nread += info['nbytes']
handle.seek(nread, 0)
- print "\n\n"
+ print("\n\n")
if __name__ == "__main__":
diff --git a/gr-utils/python/utils/plot_data.py b/gr-utils/python/utils/plot_data.py
index 7d80c714f..a05414711 100644
--- a/gr-utils/python/utils/plot_data.py
+++ b/gr-utils/python/utils/plot_data.py
@@ -22,20 +22,24 @@
Utility to help plotting data from files.
"""
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
try:
import scipy
except ImportError:
- print "Please install SciPy to run this script (http://www.scipy.org/)"
- raise SystemExit, 1
+ print("Please install SciPy to run this script (http://www.scipy.org/)")
+ raise SystemExit(1)
try:
from pylab import *
except ImportError:
- print "Please install Matplotlib to run this script (http://matplotlib.sourceforge.net/)"
- raise SystemExit, 1
+ print("Please install Matplotlib to run this script (http://matplotlib.sourceforge.net/)")
+ raise SystemExit(1)
-class plot_data:
+class plot_data(object):
def __init__(self, datatype, filenames, options):
self.hfile = list()
self.legend_text = list()
@@ -86,10 +90,10 @@ class plot_data:
try:
f = scipy.fromfile(hfile, dtype=self.datatype, count=self.block_length)
except MemoryError:
- print "End of File"
+ print("End of File")
else:
self.f = scipy.array(f)
- self.time = scipy.array([i*(1/self.sample_rate) for i in range(len(self.f))])
+ self.time = scipy.array([i*(1 / self.sample_rate) for i in range(len(self.f))])
def make_plots(self):
self.sp_f = self.fig.add_subplot(2,1,1, position=[0.075, 0.2, 0.875, 0.6])
@@ -162,6 +166,6 @@ class plot_data:
def find(item_in, list_search):
try:
- return list_search.index(item_in) != None
+ return list_search.index(item_in) != None
except ValueError:
- return False
+ return False
diff --git a/gr-utils/python/utils/plot_fft_base.py b/gr-utils/python/utils/plot_fft_base.py
index c99462147..5040aefa8 100755..100644
--- a/gr-utils/python/utils/plot_fft_base.py
+++ b/gr-utils/python/utils/plot_fft_base.py
@@ -20,22 +20,26 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
try:
import scipy
from scipy import fftpack
except ImportError:
- print "Please install SciPy to run this script (http://www.scipy.org/)"
- raise SystemExit, 1
+ print("Please install SciPy to run this script (http://www.scipy.org/)")
+ raise SystemExit(1)
try:
from pylab import *
except ImportError:
- print "Please install Python Matplotlib (http://matplotlib.sourceforge.net/) and Python TkInter https://wiki.python.org/moin/TkInter to run this script"
- raise SystemExit, 1
+ print("Please install Python Matplotlib (http://matplotlib.sourceforge.net/) and Python TkInter https://wiki.python.org/moin/TkInter to run this script")
+ raise SystemExit(1)
from argparse import ArgumentParser
-class plot_fft_base:
+class plot_fft_base(object):
def __init__(self, datatype, filename, options):
self.hfile = open(filename, "r")
self.block_length = options.block
@@ -79,33 +83,33 @@ class plot_fft_base:
show()
def get_data(self):
- self.position = self.hfile.tell()/self.sizeof_data
+ self.position = self.hfile.tell() / self.sizeof_data
self.text_file_pos.set_text("File Position: %d" % (self.position))
try:
self.iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length)
except MemoryError:
- print "End of File"
+ print("End of File")
else:
self.iq_fft = self.dofft(self.iq)
tstep = 1.0 / self.sample_rate
- #self.time = scipy.array([tstep*(self.position + i) for i in xrange(len(self.iq))])
- self.time = scipy.array([tstep*(i) for i in xrange(len(self.iq))])
+ #self.time = scipy.array([tstep*(self.position + i) for i in range(len(self.iq))])
+ self.time = scipy.array([tstep*(i) for i in range(len(self.iq))])
self.freq = self.calc_freq(self.time, self.sample_rate)
def dofft(self, iq):
N = len(iq)
iq_fft = scipy.fftpack.fftshift(scipy.fft(iq)) # fft and shift axis
- iq_fft = 20*scipy.log10(abs((iq_fft+1e-15)/N)) # convert to decibels, adjust power
+ iq_fft = 20*scipy.log10(abs((iq_fft+1e-15) / N)) # convert to decibels, adjust power
# adding 1e-15 (-300 dB) to protect against value errors if an item in iq_fft is 0
return iq_fft
def calc_freq(self, time, sample_rate):
N = len(time)
- Fs = 1.0 / (time.max() - time.min())
+ Fs = 1.0 / (time.max( - time.min()))
Fn = 0.5 * sample_rate
- freq = scipy.array([-Fn + i*Fs for i in xrange(N)])
+ freq = scipy.array([-Fn + i*Fs for i in range(N)])
return freq
def make_plots(self):
@@ -228,9 +232,9 @@ class plot_fft_base:
def find(item_in, list_search):
try:
- return list_search.index(item_in) != None
+ return list_search.index(item_in) != None
except ValueError:
- return False
+ return False
def main():
parser = plot_fft_base.setup_options()
@@ -243,6 +247,3 @@ if __name__ == "__main__":
main()
except KeyboardInterrupt:
pass
-
-
-
diff --git a/gr-utils/python/utils/plot_psd_base.py b/gr-utils/python/utils/plot_psd_base.py
index 2611ed4be..0a0f3cab3 100755..100644
--- a/gr-utils/python/utils/plot_psd_base.py
+++ b/gr-utils/python/utils/plot_psd_base.py
@@ -20,24 +20,28 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
try:
import scipy
from scipy import fftpack
except ImportError:
- print "Please install SciPy to run this script (http://www.scipy.org/)"
- raise SystemExit, 1
+ print("Please install SciPy to run this script (http://www.scipy.org/)")
+ raise SystemExit(1)
try:
from pylab import *
except ImportError:
- print "Please install Matplotlib to run this script (http://matplotlib.sourceforge.net/)"
- raise SystemExit, 1
+ print("Please install Matplotlib to run this script (http://matplotlib.sourceforge.net/)")
+ raise SystemExit(1)
from argparse import ArgumentParser
from scipy import log10
from gnuradio.eng_arg import eng_float, intx
-class plot_psd_base:
+class plot_psd_base(object):
def __init__(self, datatype, filename, options):
self.hfile = open(filename, "r")
self.block_length = options.block
@@ -87,30 +91,30 @@ class plot_psd_base:
show()
def get_data(self):
- self.position = self.hfile.tell()/self.sizeof_data
+ self.position = self.hfile.tell() / self.sizeof_data
self.text_file_pos.set_text("File Position: %d" % self.position)
try:
self.iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length)
except MemoryError:
- print "End of File"
+ print("End of File")
return False
else:
# retesting length here as newer version of scipy does not throw a MemoryError, just
# returns a zero-length array
if(len(self.iq) > 0):
tstep = 1.0 / self.sample_rate
- #self.time = scipy.array([tstep*(self.position + i) for i in xrange(len(self.iq))])
- self.time = scipy.array([tstep*(i) for i in xrange(len(self.iq))])
+ #self.time = scipy.array([tstep*(self.position + i) for i in range(len(self.iq))])
+ self.time = scipy.array([tstep*(i) for i in range(len(self.iq))])
self.iq_psd, self.freq = self.dopsd(self.iq)
return True
else:
- print "End of File"
+ print("End of File")
return False
def dopsd(self, iq):
''' Need to do this here and plot later so we can do the fftshift '''
- overlap = self.psdfftsize/4
+ overlap = self.psdfftsize / 4
winfunc = scipy.blackman
psd,freq = mlab.psd(iq, self.psdfftsize, self.sample_rate,
window = lambda d: d*winfunc(self.psdfftsize),
@@ -174,7 +178,7 @@ class plot_psd_base:
self.sp_psd.set_xlim([f.min(), f.max()])
def draw_spec(self, t, s):
- overlap = self.specfftsize/4
+ overlap = self.specfftsize / 4
winfunc = scipy.blackman
self.sp_spec.clear()
self.sp_spec.specgram(s, self.specfftsize, self.sample_rate,
@@ -270,9 +274,9 @@ class plot_psd_base:
def find(item_in, list_search):
try:
- return list_search.index(item_in) != None
+ return list_search.index(item_in) != None
except ValueError:
- return False
+ return False
def main():
parser = plot_psd_base.setup_options()
@@ -285,6 +289,3 @@ if __name__ == "__main__":
main()
except KeyboardInterrupt:
pass
-
-
-
diff --git a/gr-utils/python/utils/pyqt_filter.py b/gr-utils/python/utils/pyqt_filter.py
index 0c781f234..fac17644d 100644
--- a/gr-utils/python/utils/pyqt_filter.py
+++ b/gr-utils/python/utils/pyqt_filter.py
@@ -7,6 +7,7 @@
#
# WARNING! All changes made in this file will be lost!
+from __future__ import unicode_literals
from PyQt4 import QtCore, QtGui
class Ui_MainWindow(object):
diff --git a/gr-utils/python/utils/pyqt_plot.py b/gr-utils/python/utils/pyqt_plot.py
index 5650135ab..80711b4e8 100644
--- a/gr-utils/python/utils/pyqt_plot.py
+++ b/gr-utils/python/utils/pyqt_plot.py
@@ -7,6 +7,7 @@
#
# WARNING! All changes made in this file will be lost!
+from __future__ import unicode_literals
from PyQt4 import QtCore, QtGui
class Ui_MainWindow(object):
diff --git a/gr-video-sdl/grc/CMakeLists.txt b/gr-video-sdl/grc/CMakeLists.txt
index f62d41b6d..f72c9e357 100644
--- a/gr-video-sdl/grc/CMakeLists.txt
+++ b/gr-video-sdl/grc/CMakeLists.txt
@@ -18,8 +18,8 @@
# Boston, MA 02110-1301, USA.
install(FILES
- video_sdl_sink.xml
- video_block_tree.xml
+ video_sdl_sink.block.yml
+ video.tree.yml
DESTINATION share/gnuradio/grc/blocks
)
diff --git a/gr-video-sdl/grc/video.tree.yml b/gr-video-sdl/grc/video.tree.yml
new file mode 100644
index 000000000..566de33ec
--- /dev/null
+++ b/gr-video-sdl/grc/video.tree.yml
@@ -0,0 +1,3 @@
+'[Core]':
+- Video:
+ - video_sdl_sink
diff --git a/gr-video-sdl/grc/video_block_tree.xml b/gr-video-sdl/grc/video_block_tree.xml
deleted file mode 100644
index f4f3e4199..000000000
--- a/gr-video-sdl/grc/video_block_tree.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Block Tree for video blocks.
-###################################################
- -->
-<cat>
- <name>[Core]</name>
- <cat>
- <name>Video</name>
- <block>video_sdl_sink</block>
- </cat>
-</cat>
diff --git a/gr-video-sdl/grc/video_sdl_sink.block.yml b/gr-video-sdl/grc/video_sdl_sink.block.yml
new file mode 100644
index 000000000..cc3b9949b
--- /dev/null
+++ b/gr-video-sdl/grc/video_sdl_sink.block.yml
@@ -0,0 +1,61 @@
+id: video_sdl_sink
+label: Video SDL Sink
+
+parameters:
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [byte, short]
+ option_attributes:
+ fcn: [uc, s]
+ hide: part
+- id: width
+ label: Input Width
+ dtype: int
+ default: '640'
+- id: height
+ label: Input Height
+ dtype: int
+ default: '480'
+- id: display_width
+ label: Display Width
+ dtype: int
+ default: '640'
+- id: display_height
+ label: Display Height
+ dtype: int
+ default: '480'
+- id: fps
+ label: Framerate
+ dtype: float
+ default: '0'
+- id: num_channels
+ label: Channels
+ dtype: enum
+ options: ['1', '2', '3']
+ option_labels: [1 (Grayscale), '2 (Y, alternating pixels U and V)', 3 (YUV)]
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: 1
+ multiplicity: ${ num_channels }
+
+templates:
+ imports: from gnuradio import video_sdl
+ make: video_sdl.sink_${type.fcn}(${fps}, ${width}, ${height}, 0, ${display_width},
+ ${display_height})
+
+documentation: |-
+ Provides a rudimentary on-screen video display using libsdl.
+
+ A framerate of zero means video will be displayed as quickly as possible.
+
+ In 1-channel mode, input data is assumed to be grayscale, with each input item mapping to a single pixel.
+
+ In 2-channel mode, the first channel is Y for every pixel while the second channel alternates between pixels values for U and V.
+
+ In 3-channel mode, input channels are assumed to be matching triples of YUV values, one byte per pixel, per channel.
+
+file_format: 1
diff --git a/gr-video-sdl/grc/video_sdl_sink.xml b/gr-video-sdl/grc/video_sdl_sink.xml
deleted file mode 100644
index 02ad089af..000000000
--- a/gr-video-sdl/grc/video_sdl_sink.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version='1.0'?>
-<block>
- <name>Video SDL Sink</name>
- <key>video_sdl_sink</key>
- <import>from gnuradio import video_sdl</import>
- <make>video_sdl.sink_$(type.fcn)($fps, $width, $height, 0, $display_width, $display_height)</make>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>fcn:uc</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>fcn:s</opt>
- </option>
- </param>
- <param>
- <name>Input Width</name>
- <key>width</key>
- <value>640</value>
- <type>int</type>
- </param>
- <param>
- <name>Input Height</name>
- <key>height</key>
- <value>480</value>
- <type>int</type>
- </param>
- <param>
- <name>Display Width</name>
- <key>display_width</key>
- <value>640</value>
- <type>int</type>
- </param>
- <param>
- <name>Display Height</name>
- <key>display_height</key>
- <value>480</value>
- <type>int</type>
- </param>
- <param>
- <name>Framerate</name>
- <key>fps</key>
- <value>0</value>
- <type>float</type>
- </param>
- <param>
- <name>Channels</name>
- <key>num_channels</key>
- <type>enum</type>
- <option>
- <name>1 (Grayscale)</name>
- <key>1</key>
- </option>
- <option>
- <name>2 (Y, alternating pixels U and V)</name>
- <key>2</key>
- </option>
- <option>
- <name>3 (YUV)</name>
- <key>3</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>1</vlen>
- <nports>$num_channels</nports>
- </sink>
- <doc>
-Provides a rudimentary on-screen video display using libsdl.
-
-A framerate of zero means video will be displayed as quickly as possible.
-
-In 1-channel mode, input data is assumed to be grayscale, with each input item mapping to a single pixel.
-
-In 2-channel mode, the first channel is Y for every pixel while the second channel alternates between pixels values for U and V.
-
-In 3-channel mode, input channels are assumed to be matching triples of YUV values, one byte per pixel, per channel.
- </doc>
-</block>
diff --git a/gr-video-sdl/python/video_sdl/CMakeLists.txt b/gr-video-sdl/python/video_sdl/CMakeLists.txt
index 6465affa1..f4ae6bd29 100644
--- a/gr-video-sdl/python/video_sdl/CMakeLists.txt
+++ b/gr-video-sdl/python/video_sdl/CMakeLists.txt
@@ -43,6 +43,6 @@ if(ENABLE_TESTING)
file(GLOB py_qa_test_files "qa_*.py")
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gr-video-sdl/python/video_sdl/__init__.py b/gr-video-sdl/python/video_sdl/__init__.py
index 4bad11831..1bcf83ad1 100644
--- a/gr-video-sdl/python/video_sdl/__init__.py
+++ b/gr-video-sdl/python/video_sdl/__init__.py
@@ -21,6 +21,7 @@
'''
Blocks and utilities for Video SDL module
'''
+from __future__ import unicode_literals
# The presence of this file turns this directory into a Python package
import os
diff --git a/gr-video-sdl/python/video_sdl/qa_video_sdl.py b/gr-video-sdl/python/video_sdl/qa_video_sdl.py
index f94957ccc..cb0201cba 100755..100644
--- a/gr-video-sdl/python/video_sdl/qa_video_sdl.py
+++ b/gr-video-sdl/python/video_sdl/qa_video_sdl.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, video_sdl
class test_video_sdl (gr_unittest.TestCase):
diff --git a/gr-vocoder/examples/alaw_audio_loopback.py b/gr-vocoder/examples/alaw_audio_loopback.py
index 5b800b5bf..7dbcbb209 100755..100644
--- a/gr-vocoder/examples/alaw_audio_loopback.py
+++ b/gr-vocoder/examples/alaw_audio_loopback.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio import blocks
@@ -33,7 +35,7 @@ def build_graph():
enc = vocoder.alaw_encode_sb()
dec = vocoder.alaw_decode_bs()
s2f = blocks.short_to_float()
- sink_scale = blocks.multiply_const_ff(1.0/32767.)
+ sink_scale = blocks.multiply_const_ff(1.0 / 32767.)
sink = audio.sink(8000)
tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink)
return tb
@@ -41,6 +43,6 @@ def build_graph():
if __name__ == '__main__':
tb = build_graph()
tb.start()
- raw_input ('Press Enter to exit: ')
+ input ('Press Enter to exit: ')
tb.stop()
tb.wait()
diff --git a/gr-vocoder/examples/codec2_audio_loopback.py b/gr-vocoder/examples/codec2_audio_loopback.py
index b63d50802..ea690861a 100755..100644
--- a/gr-vocoder/examples/codec2_audio_loopback.py
+++ b/gr-vocoder/examples/codec2_audio_loopback.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio import blocks
@@ -34,7 +36,7 @@ def build_graph():
enc = vocoder.codec2_encode_sp(codec2.MODE_2400)
dec = vocoder.codec2_decode_ps(codec2.MODE_2400)
s2f = blocks.short_to_float()
- sink_scale = blocks.multiply_const_ff(1.0/32767.)
+ sink_scale = blocks.multiply_const_ff(1.0 / 32767.)
sink = audio.sink(8000)
tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink)
return tb
@@ -42,6 +44,6 @@ def build_graph():
if __name__ == '__main__':
tb = build_graph()
tb.start()
- raw_input ('Press Enter to exit: ')
+ input ('Press Enter to exit: ')
tb.stop()
tb.wait()
diff --git a/gr-vocoder/examples/cvsd_audio_loopback.py b/gr-vocoder/examples/cvsd_audio_loopback.py
index b9385b7dc..15074d62c 100755..100644
--- a/gr-vocoder/examples/cvsd_audio_loopback.py
+++ b/gr-vocoder/examples/cvsd_audio_loopback.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio import blocks
@@ -43,7 +45,7 @@ def build_graph():
s2f = blocks.short_to_float()
decim = filter.rational_resampler_fff(1, 8)
- sink_scale = blocks.multiply_const_ff(1.0/scale_factor)
+ sink_scale = blocks.multiply_const_ff(1.0 / scale_factor)
sink = audio.sink(sample_rate, "plughw:0,0")
tb.connect(src, src_scale, interp, f2s, enc)
@@ -65,6 +67,6 @@ def build_graph():
if __name__ == '__main__':
tb = build_graph()
tb.start()
- raw_input ('Press Enter to exit: ')
+ input ('Press Enter to exit: ')
tb.stop()
tb.wait()
diff --git a/gr-vocoder/examples/g721_audio_loopback.py b/gr-vocoder/examples/g721_audio_loopback.py
index 42abbabf6..afe9b04b9 100755..100644
--- a/gr-vocoder/examples/g721_audio_loopback.py
+++ b/gr-vocoder/examples/g721_audio_loopback.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio import blocks
@@ -33,7 +35,7 @@ def build_graph():
enc = vocoder.g721_encode_sb()
dec = vocoder.g721_decode_bs()
s2f = blocks.short_to_float()
- sink_scale = blocks.multiply_const_ff(1.0/32767.)
+ sink_scale = blocks.multiply_const_ff(1.0 / 32767.)
sink = audio.sink(8000)
tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink)
return tb
@@ -41,6 +43,6 @@ def build_graph():
if __name__ == '__main__':
tb = build_graph()
tb.start()
- raw_input ('Press Enter to exit: ')
+ input ('Press Enter to exit: ')
tb.stop()
tb.wait()
diff --git a/gr-vocoder/examples/g723_24_audio_loopback.py b/gr-vocoder/examples/g723_24_audio_loopback.py
index cade33f29..62e58c141 100755..100644
--- a/gr-vocoder/examples/g723_24_audio_loopback.py
+++ b/gr-vocoder/examples/g723_24_audio_loopback.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio import blocks
@@ -33,7 +35,7 @@ def build_graph():
enc = vocoder.g723_24_encode_sb()
dec = vocoder.g723_24_decode_bs()
s2f = blocks.short_to_float()
- sink_scale = blocks.multiply_const_ff(1.0/32767.)
+ sink_scale = blocks.multiply_const_ff(1.0 / 32767.)
sink = audio.sink(8000)
tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink)
return tb
@@ -41,6 +43,6 @@ def build_graph():
if __name__ == '__main__':
tb = build_graph()
tb.start()
- raw_input ('Press Enter to exit: ')
+ input ('Press Enter to exit: ')
tb.stop()
tb.wait()
diff --git a/gr-vocoder/examples/g723_40_audio_loopback.py b/gr-vocoder/examples/g723_40_audio_loopback.py
index 77e40884c..edc8f5716 100755..100644
--- a/gr-vocoder/examples/g723_40_audio_loopback.py
+++ b/gr-vocoder/examples/g723_40_audio_loopback.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio import blocks
@@ -33,7 +35,7 @@ def build_graph():
enc = vocoder.g723_40_encode_sb()
dec = vocoder.g723_40_decode_bs()
s2f = blocks.short_to_float()
- sink_scale = blocks.multiply_const_ff(1.0/32767.)
+ sink_scale = blocks.multiply_const_ff(1.0 / 32767.)
sink = audio.sink(8000)
tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink)
return tb
@@ -41,6 +43,6 @@ def build_graph():
if __name__ == '__main__':
tb = build_graph()
tb.start()
- raw_input ('Press Enter to exit: ')
+ input ('Press Enter to exit: ')
tb.stop()
tb.wait()
diff --git a/gr-vocoder/examples/gsm_audio_loopback.py b/gr-vocoder/examples/gsm_audio_loopback.py
index 5d5bf9dd7..c71e6fd38 100755..100644
--- a/gr-vocoder/examples/gsm_audio_loopback.py
+++ b/gr-vocoder/examples/gsm_audio_loopback.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio import blocks
@@ -33,7 +35,7 @@ def build_graph():
enc = vocoder.gsm_fr_encode_sp()
dec = vocoder.gsm_fr_decode_ps()
s2f = blocks.short_to_float()
- sink_scale = blocks.multiply_const_ff(1.0/32767.)
+ sink_scale = blocks.multiply_const_ff(1.0 / 32767.)
sink = audio.sink(8000)
tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink)
return tb
@@ -41,6 +43,6 @@ def build_graph():
if __name__ == '__main__':
tb = build_graph()
tb.start()
- raw_input ('Press Enter to exit: ')
+ input ('Press Enter to exit: ')
tb.stop()
tb.wait()
diff --git a/gr-vocoder/examples/ulaw_audio_loopback.py b/gr-vocoder/examples/ulaw_audio_loopback.py
index 9f0617622..6a8a493f3 100755..100644
--- a/gr-vocoder/examples/ulaw_audio_loopback.py
+++ b/gr-vocoder/examples/ulaw_audio_loopback.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio import blocks
@@ -33,7 +35,7 @@ def build_graph():
enc = vocoder.ulaw_encode_sb()
dec = vocoder.ulaw_decode_bs()
s2f = blocks.short_to_float()
- sink_scale = blocks.multiply_const_ff(1.0/32767.)
+ sink_scale = blocks.multiply_const_ff(1.0 / 32767.)
sink = audio.sink(8000)
tb.connect(src, src_scale, f2s, enc, dec, s2f, sink_scale, sink)
return tb
@@ -41,6 +43,6 @@ def build_graph():
if __name__ == '__main__':
tb = build_graph()
tb.start()
- raw_input ('Press Enter to exit: ')
+ input ('Press Enter to exit: ')
tb.stop()
tb.wait()
diff --git a/gr-vocoder/grc/CMakeLists.txt b/gr-vocoder/grc/CMakeLists.txt
index eef52179c..1d85c69ab 100644
--- a/gr-vocoder/grc/CMakeLists.txt
+++ b/gr-vocoder/grc/CMakeLists.txt
@@ -18,36 +18,35 @@
# Boston, MA 02110-1301, USA.
install(FILES
- vocoder_alaw_decode_bs.xml
- vocoder_alaw_encode_sb.xml
- vocoder_block_tree.xml
- vocoder_cvsd_decode_bs.xml
- vocoder_cvsd_decode.xml
- vocoder_cvsd_encode_sb.xml
- vocoder_cvsd_encode.xml
- vocoder_g721_decode_bs.xml
- vocoder_g721_encode_sb.xml
- vocoder_g723_24_decode_bs.xml
- vocoder_g723_24_encode_sb.xml
- vocoder_g723_40_decode_bs.xml
- vocoder_g723_40_encode_sb.xml
- vocoder_ulaw_decode_bs.xml
- vocoder_ulaw_encode_sb.xml
+ vocoder_alaw_decode_bs.block.yml
+ vocoder_alaw_encode_sb.block.yml
+ vocoder_cvsd_decode_bs.block.yml
+ vocoder_cvsd_decode.block.yml
+ vocoder_cvsd_encode_sb.block.yml
+ vocoder_cvsd_encode.block.yml
+ vocoder_g721_decode_bs.block.yml
+ vocoder_g721_encode_sb.block.yml
+ vocoder_g723_24_decode_bs.block.yml
+ vocoder_g723_24_encode_sb.block.yml
+ vocoder_g723_40_decode_bs.block.yml
+ vocoder_g723_40_encode_sb.block.yml
+ vocoder_ulaw_decode_bs.block.yml
+ vocoder_ulaw_encode_sb.block.yml
DESTINATION ${GRC_BLOCKS_DIR}
)
if(LIBCODEC2_FOUND)
install(FILES
- vocoder_codec2_decode_ps.xml
- vocoder_codec2_encode_sp.xml
+ vocoder_codec2_decode_ps.block.yml
+ vocoder_codec2_encode_sp.block.yml
DESTINATION ${GRC_BLOCKS_DIR}
)
endif(LIBCODEC2_FOUND)
if(LIBCODEC2_HAS_FREEDV_API)
install(FILES
- vocoder_freedv_rx_ss.xml
- vocoder_freedv_tx_ss.xml
+ vocoder_freedv_rx_ss.block.yml
+ vocoder_freedv_tx_ss.block.yml
DESTINATION ${GRC_BLOCKS_DIR}
COMPONENT "vocoder_python"
)
@@ -55,8 +54,8 @@ endif(LIBCODEC2_HAS_FREEDV_API)
if(LIBGSM_FOUND)
install(FILES
- vocoder_gsm_fr_decode_ps.xml
- vocoder_gsm_fr_encode_sp.xml
+ vocoder_gsm_fr_decode_ps.block.yml
+ vocoder_gsm_fr_encode_sp.block.yml
DESTINATION ${GRC_BLOCKS_DIR}
)
endif(LIBGSM_FOUND)
diff --git a/gr-vocoder/grc/vocoder.tree.yml b/gr-vocoder/grc/vocoder.tree.yml
new file mode 100644
index 000000000..bdcf2de46
--- /dev/null
+++ b/gr-vocoder/grc/vocoder.tree.yml
@@ -0,0 +1,22 @@
+'[Core]':
+- Audio:
+ - vocoder_alaw_decode_bs
+ - vocoder_alaw_encode_sb
+ - vocoder_codec2_decode_ps
+ - vocoder_codec2_encode_sp
+ - vocoder_cvsd_decode_bs
+ - vocoder_cvsd_encode_sb
+ - vocoder_cvsd_decode_bf
+ - vocoder_cvsd_encode_fb
+ - vocoder_freedv_tx_ss
+ - vocoder_freedv_rx_ss
+ - vocoder_g721_decode_bs
+ - vocoder_g721_encode_sb
+ - vocoder_g723_24_decode_bs
+ - vocoder_g723_24_encode_sb
+ - vocoder_g723_40_decode_bs
+ - vocoder_g723_40_encode_sb
+ - vocoder_gsm_fr_decode_ps
+ - vocoder_gsm_fr_encode_sp
+ - vocoder_ulaw_decode_bs
+ - vocoder_ulaw_encode_sb
diff --git a/gr-vocoder/grc/vocoder_alaw_decode_bs.block.yml b/gr-vocoder/grc/vocoder_alaw_decode_bs.block.yml
new file mode 100644
index 000000000..f4e7e92e5
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_alaw_decode_bs.block.yml
@@ -0,0 +1,16 @@
+id: vocoder_alaw_decode_bs
+label: Alaw Audio Decoder
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: short
+
+templates:
+ imports: from gnuradio import vocoder
+ make: vocoder.alaw_decode_bs()
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_alaw_decode_bs.xml b/gr-vocoder/grc/vocoder_alaw_decode_bs.xml
deleted file mode 100644
index 776187d4d..000000000
--- a/gr-vocoder/grc/vocoder_alaw_decode_bs.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Alaw audio decoder
-###################################################
- -->
-<block>
- <name>Alaw Audio Decoder</name>
- <key>vocoder_alaw_decode_bs</key>
- <import>from gnuradio import vocoder</import>
- <make>vocoder.alaw_decode_bs()</make>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>short</type>
- </source>
-</block>
diff --git a/gr-vocoder/grc/vocoder_alaw_encode_sb.block.yml b/gr-vocoder/grc/vocoder_alaw_encode_sb.block.yml
new file mode 100644
index 000000000..8a688ed96
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_alaw_encode_sb.block.yml
@@ -0,0 +1,16 @@
+id: vocoder_alaw_encode_sb
+label: g711 Alaw Audio Encoder
+
+inputs:
+- domain: stream
+ dtype: short
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import vocoder
+ make: vocoder.alaw_encode_sb()
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_alaw_encode_sb.xml b/gr-vocoder/grc/vocoder_alaw_encode_sb.xml
deleted file mode 100644
index 728158eec..000000000
--- a/gr-vocoder/grc/vocoder_alaw_encode_sb.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Alaw audio encoder
-###################################################
- -->
-<block>
- <name>g711 Alaw Audio Encoder</name>
- <key>vocoder_alaw_encode_sb</key>
- <import>from gnuradio import vocoder</import>
- <make>vocoder.alaw_encode_sb()</make>
- <sink>
- <name>in</name>
- <type>short</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
-
-
diff --git a/gr-vocoder/grc/vocoder_block_tree.xml b/gr-vocoder/grc/vocoder_block_tree.xml
deleted file mode 100644
index e47af4cdd..000000000
--- a/gr-vocoder/grc/vocoder_block_tree.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Copyright 2011 Free Software Foundation, Inc.
-
- This file is part of GNU Radio
-
- GNU Radio 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.
-
- GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street,
- Boston, MA 02110-1301, USA.
--->
-
-<!--
-###################################################
-##Block Tree for GR Digital blocks.
-###################################################
- -->
-<cat>
- <name>[Core]</name>
- <cat>
- <name>Audio</name>
- <block>vocoder_alaw_decode_bs</block>
- <block>vocoder_alaw_encode_sb</block>
- <block>vocoder_codec2_decode_ps</block>
- <block>vocoder_codec2_encode_sp</block>
- <block>vocoder_cvsd_decode_bs</block>
- <block>vocoder_cvsd_encode_sb</block>
- <block>vocoder_cvsd_decode_bf</block>
- <block>vocoder_cvsd_encode_fb</block>
- <block>vocoder_freedv_tx_ss</block>
- <block>vocoder_freedv_rx_ss</block>
- <block>vocoder_g721_decode_bs</block>
- <block>vocoder_g721_encode_sb</block>
- <block>vocoder_g723_24_decode_bs</block>
- <block>vocoder_g723_24_encode_sb</block>
- <block>vocoder_g723_40_decode_bs</block>
- <block>vocoder_g723_40_encode_sb</block>
- <block>vocoder_gsm_fr_decode_ps</block>
- <block>vocoder_gsm_fr_encode_sp</block>
- <block>vocoder_ulaw_decode_bs</block>
- <block>vocoder_ulaw_encode_sb</block>
- </cat>
-</cat>
diff --git a/gr-vocoder/grc/vocoder_codec2_decode_ps.block.yml b/gr-vocoder/grc/vocoder_codec2_decode_ps.block.yml
new file mode 100644
index 000000000..0aec7ec4c
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_codec2_decode_ps.block.yml
@@ -0,0 +1,30 @@
+id: vocoder_codec2_decode_ps
+label: CODEC2 Audio Decoder
+
+parameters:
+- id: mode
+ label: Bit rate
+ dtype: int
+ default: codec2.MODE_2400
+ options: [codec2.MODE_3200, codec2.MODE_2400, codec2.MODE_1600, codec2.MODE_1400,
+ codec2.MODE_1300, codec2.MODE_1200, codec2.MODE_700, codec2.MODE_700B]
+ option_labels: [3200 bps, 2400 bps, 1600 bps, 1400 bps, 1300 bps, 1200 bps, 700
+ bps, 700B bps]
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: '${ { 0: 64, 1: 48, 2: 64, 3: 56, 4: 52, 5: 48, 6: 28, 7: 28 }[mode] }'
+
+outputs:
+- domain: stream
+ dtype: short
+
+templates:
+ imports: |-
+ from gnuradio import vocoder
+ from gnuradio.vocoder import codec2
+ make: vocoder.codec2_decode_ps(${mode})
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_codec2_decode_ps.xml b/gr-vocoder/grc/vocoder_codec2_decode_ps.xml
deleted file mode 100644
index 8448dc83d..000000000
--- a/gr-vocoder/grc/vocoder_codec2_decode_ps.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## CODEC2 audio decoder
-###################################################
- -->
-<block>
- <name>CODEC2 Audio Decoder</name>
- <key>vocoder_codec2_decode_ps</key>
- <import>from gnuradio import vocoder</import>
- <import>from gnuradio.vocoder import codec2</import>
- <make>vocoder.codec2_decode_ps($mode)</make>
- <param>
- <name>Bit rate</name>
- <key>mode</key>
- <value>codec2.MODE_2400</value>
- <type>int</type>
- <option>
- <name>3200 bps</name>
- <key>codec2.MODE_3200</key>
- </option>
- <option>
- <name>2400 bps</name>
- <key>codec2.MODE_2400</key>
- </option>
- <option>
- <name>1600 bps</name>
- <key>codec2.MODE_1600</key>
- </option>
- <option>
- <name>1400 bps</name>
- <key>codec2.MODE_1400</key>
- </option>
- <option>
- <name>1300 bps</name>
- <key>codec2.MODE_1300</key>
- </option>
- <option>
- <name>1200 bps</name>
- <key>codec2.MODE_1200</key>
- </option>
- <option>
- <name>700 bps</name>
- <key>codec2.MODE_700</key>
- </option>
- <option>
- <name>700B bps</name>
- <key>codec2.MODE_700B</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>{ 0: 64, 1: 48, 2: 64, 3: 56, 4: 52, 5: 48, 6: 28, 7: 28 }[$mode]</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>short</type>
- </source>
-</block>
diff --git a/gr-vocoder/grc/vocoder_codec2_encode_sp.block.yml b/gr-vocoder/grc/vocoder_codec2_encode_sp.block.yml
new file mode 100644
index 000000000..f03787341
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_codec2_encode_sp.block.yml
@@ -0,0 +1,30 @@
+id: vocoder_codec2_encode_sp
+label: CODEC2 Audio Encoder
+
+parameters:
+- id: mode
+ label: Bit rate
+ dtype: int
+ default: codec2.MODE_2400
+ options: [codec2.MODE_3200, codec2.MODE_2400, codec2.MODE_1600, codec2.MODE_1400,
+ codec2.MODE_1300, codec2.MODE_1200, codec2.MODE_700, codec2.MODE_700B]
+ option_labels: [3200 bps, 2400 bps, 1600 bps, 1400 bps, 1300 bps, 1200 bps, 700
+ bps, 700B bps]
+ hide: ${ 'part' if vlen == 1 else 'none' }
+
+inputs:
+- domain: stream
+ dtype: short
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: '${ { 0: 64, 1: 48, 2: 64, 3: 56, 4: 52, 5: 48, 6: 28, 7: 28 }[mode] }'
+
+templates:
+ imports: |-
+ from gnuradio import vocoder
+ from gnuradio.vocoder import codec2
+ make: vocoder.codec2_encode_sp(${mode})
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_codec2_encode_sp.xml b/gr-vocoder/grc/vocoder_codec2_encode_sp.xml
deleted file mode 100644
index f11ad443c..000000000
--- a/gr-vocoder/grc/vocoder_codec2_encode_sp.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## CODEC2 audio encoder
-###################################################
- -->
-<block>
- <name>CODEC2 Audio Encoder</name>
- <key>vocoder_codec2_encode_sp</key>
- <import>from gnuradio import vocoder</import>
- <import>from gnuradio.vocoder import codec2</import>
- <make>vocoder.codec2_encode_sp($mode)</make>
- <param>
- <name>Bit rate</name>
- <key>mode</key>
- <value>codec2.MODE_2400</value>
- <type>int</type>
- <option>
- <name>3200 bps</name>
- <key>codec2.MODE_3200</key>
- </option>
- <option>
- <name>2400 bps</name>
- <key>codec2.MODE_2400</key>
- </option>
- <option>
- <name>1600 bps</name>
- <key>codec2.MODE_1600</key>
- </option>
- <option>
- <name>1400 bps</name>
- <key>codec2.MODE_1400</key>
- </option>
- <option>
- <name>1300 bps</name>
- <key>codec2.MODE_1300</key>
- </option>
- <option>
- <name>1200 bps</name>
- <key>codec2.MODE_1200</key>
- </option>
- <option>
- <name>700 bps</name>
- <key>codec2.MODE_700</key>
- </option>
- <option>
- <name>700B bps</name>
- <key>codec2.MODE_700B</key>
- </option>
- </param>
- <sink>
- <name>in</name>
- <type>short</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>{ 0: 64, 1: 48, 2: 64, 3: 56, 4: 52, 5: 48, 6: 28, 7: 28 }[$mode]</vlen>
- </source>
-</block>
-
diff --git a/gr-vocoder/grc/vocoder_cvsd_decode.block.yml b/gr-vocoder/grc/vocoder_cvsd_decode.block.yml
new file mode 100644
index 000000000..59d9a7a1b
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_cvsd_decode.block.yml
@@ -0,0 +1,26 @@
+id: vocoder_cvsd_decode_bf
+label: CVSD Decoder
+
+parameters:
+- id: resample
+ label: Resample
+ dtype: int
+ default: '8'
+- id: bw
+ label: Frac. Bandwidth
+ dtype: real
+ default: '0.5'
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: float
+
+templates:
+ imports: from gnuradio import vocoder
+ make: vocoder.cvsd_decode_bf(${resample},${bw})
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_cvsd_decode.xml b/gr-vocoder/grc/vocoder_cvsd_decode.xml
deleted file mode 100644
index ce117c5d4..000000000
--- a/gr-vocoder/grc/vocoder_cvsd_decode.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## CVSD Encoder
-###################################################
- -->
-<block>
- <name>CVSD Decoder</name>
- <key>vocoder_cvsd_decode_bf</key>
- <import>from gnuradio import vocoder</import>
- <make>vocoder.cvsd_decode_bf($resample,$bw)</make>
- <param>
- <name>Resample</name>
- <key>resample</key>
- <value>8</value>
- <type>int</type>
- </param>
- <param>
- <name>Frac. Bandwidth</name>
- <key>bw</key>
- <value>0.5</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>float</type>
- </source>
-</block>
diff --git a/gr-vocoder/grc/vocoder_cvsd_decode_bs.block.yml b/gr-vocoder/grc/vocoder_cvsd_decode_bs.block.yml
new file mode 100644
index 000000000..f7893aed2
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_cvsd_decode_bs.block.yml
@@ -0,0 +1,16 @@
+id: vocoder_cvsd_decode_bs
+label: CVSD Audio Decoder (Raw Bit-Level)
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: short
+
+templates:
+ imports: from gnuradio import vocoder
+ make: vocoder.cvsd_decode_bs()
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_cvsd_decode_bs.xml b/gr-vocoder/grc/vocoder_cvsd_decode_bs.xml
deleted file mode 100644
index 40ddc04d4..000000000
--- a/gr-vocoder/grc/vocoder_cvsd_decode_bs.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## CVSD audio decoder
-###################################################
- -->
-<block>
- <name>CVSD Audio Decoder (Raw Bit-Level)</name>
- <key>vocoder_cvsd_decode_bs</key>
- <import>from gnuradio import vocoder</import>
- <make>vocoder.cvsd_decode_bs()</make>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>short</type>
- </source>
-</block>
-
diff --git a/gr-vocoder/grc/vocoder_cvsd_encode.block.yml b/gr-vocoder/grc/vocoder_cvsd_encode.block.yml
new file mode 100644
index 000000000..ab3f43c17
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_cvsd_encode.block.yml
@@ -0,0 +1,26 @@
+id: vocoder_cvsd_encode_fb
+label: CVSD Encoder
+
+parameters:
+- id: resample
+ label: Resample
+ dtype: int
+ default: '8'
+- id: bw
+ label: Frac. Bandwidth
+ dtype: real
+ default: '0.5'
+
+inputs:
+- domain: stream
+ dtype: float
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import vocoder
+ make: vocoder.cvsd_encode_fb(${resample},${bw})
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_cvsd_encode.xml b/gr-vocoder/grc/vocoder_cvsd_encode.xml
deleted file mode 100644
index 12e73f602..000000000
--- a/gr-vocoder/grc/vocoder_cvsd_encode.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## CVSD Encoder
-###################################################
- -->
-<block>
- <name>CVSD Encoder</name>
- <key>vocoder_cvsd_encode_fb</key>
- <import>from gnuradio import vocoder</import>
- <make>vocoder.cvsd_encode_fb($resample,$bw)</make>
- <param>
- <name>Resample</name>
- <key>resample</key>
- <value>8</value>
- <type>int</type>
- </param>
- <param>
- <name>Frac. Bandwidth</name>
- <key>bw</key>
- <value>0.5</value>
- <type>real</type>
- </param>
- <sink>
- <name>in</name>
- <type>float</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
diff --git a/gr-vocoder/grc/vocoder_cvsd_encode_sb.block.yml b/gr-vocoder/grc/vocoder_cvsd_encode_sb.block.yml
new file mode 100644
index 000000000..6b2ab297b
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_cvsd_encode_sb.block.yml
@@ -0,0 +1,16 @@
+id: vocoder_cvsd_encode_sb
+label: CVSD Audio Encoder (Raw Bit-Level)
+
+inputs:
+- domain: stream
+ dtype: short
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import vocoder
+ make: vocoder.cvsd_encode_sb()
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_cvsd_encode_sb.xml b/gr-vocoder/grc/vocoder_cvsd_encode_sb.xml
deleted file mode 100644
index a92387a60..000000000
--- a/gr-vocoder/grc/vocoder_cvsd_encode_sb.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## CVSD audio encoder
-###################################################
- -->
-<block>
- <name>CVSD Audio Encoder (Raw Bit-Level)</name>
- <key>vocoder_cvsd_encode_sb</key>
- <import>from gnuradio import vocoder</import>
- <make>vocoder.cvsd_encode_sb()</make>
- <sink>
- <name>in</name>
- <type>short</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
-
-
diff --git a/gr-vocoder/grc/vocoder_freedv_rx_ss.block.yml b/gr-vocoder/grc/vocoder_freedv_rx_ss.block.yml
new file mode 100644
index 000000000..4b486d41c
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_freedv_rx_ss.block.yml
@@ -0,0 +1,33 @@
+id: vocoder_freedv_rx_ss
+label: FreeDV demodulator
+
+parameters:
+- id: mode
+ label: Operating Mode
+ dtype: int
+ default: freedv_api.MODE_1600
+ options: [freedv_api.MODE_1600, freedv_api.MODE_700, freedv_api.MODE_700B, freedv_api.MODE_2400A,
+ freedv_api.MODE_2400B, freedv_api.MODE_800XA]
+ option_labels: ['1600', '700', 700B, 2400A, 2400B, 800XA]
+- id: squelch_thresh
+ label: Squelch Threshold
+ dtype: float
+ default: '-100.0'
+
+inputs:
+- domain: stream
+ dtype: short
+
+outputs:
+- domain: stream
+ dtype: short
+
+templates:
+ imports: |-
+ from gnuradio import vocoder
+ from gnuradio.vocoder import freedv_api
+ make: vocoder.freedv_rx_ss(${mode},${squelch_thresh})
+ callbacks:
+ - set_squelch_thresh(${squelch_thresh})
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_freedv_rx_ss.xml b/gr-vocoder/grc/vocoder_freedv_rx_ss.xml
deleted file mode 100644
index 14e00a097..000000000
--- a/gr-vocoder/grc/vocoder_freedv_rx_ss.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## FreeDV audio modem demodulator
-###################################################
- -->
-<block>
- <name>FreeDV demodulator</name>
- <key>vocoder_freedv_rx_ss</key>
- <import>from gnuradio import vocoder</import>
- <import>from gnuradio.vocoder import freedv_api</import>
- <make>vocoder.freedv_rx_ss($mode,$squelch_thresh)</make>
- <callback>set_squelch_thresh($squelch_thresh)</callback>
- <param>
- <name>Operating Mode</name>
- <key>mode</key>
- <value>freedv_api.MODE_1600</value>
- <type>int</type>
- <option>
- <name>1600</name>
- <key>freedv_api.MODE_1600</key>
- </option>
- <option>
- <name>700</name>
- <key>freedv_api.MODE_700</key>
- </option>
- <option>
- <name>700B</name>
- <key>freedv_api.MODE_700B</key>
- </option>
- <option>
- <name>2400A</name>
- <key>freedv_api.MODE_2400A</key>
- </option>
- <option>
- <name>2400B</name>
- <key>freedv_api.MODE_2400B</key>
- </option>
- <option>
- <name>800XA</name>
- <key>freedv_api.MODE_800XA</key>
- </option>
- </param>
- <param>
- <name>Squelch Threshold</name>
- <key>squelch_thresh</key>
- <value>-100.0</value>
- <type>float</type>
- </param>
- <sink>
- <name>in</name>
- <type>short</type>
- </sink>
- <source>
- <name>out</name>
- <type>short</type>
- </source>
-</block>
diff --git a/gr-vocoder/grc/vocoder_freedv_tx_ss.block.yml b/gr-vocoder/grc/vocoder_freedv_tx_ss.block.yml
new file mode 100644
index 000000000..6ae73dfbb
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_freedv_tx_ss.block.yml
@@ -0,0 +1,31 @@
+id: vocoder_freedv_tx_ss
+label: FreeDV modulator
+
+parameters:
+- id: mode
+ label: Operating Mode
+ dtype: int
+ default: freedv_api.MODE_1600
+ options: [freedv_api.MODE_1600, freedv_api.MODE_700, freedv_api.MODE_700B, freedv_api.MODE_2400A,
+ freedv_api.MODE_2400B, freedv_api.MODE_800XA]
+ option_labels: ['1600', '700', 700B, 2400A, 2400B, 800XA]
+- id: txt_msg
+ label: Text Message
+ dtype: string
+ default: '''GNU Radio'''
+
+inputs:
+- domain: stream
+ dtype: short
+
+outputs:
+- domain: stream
+ dtype: short
+
+templates:
+ imports: |-
+ from gnuradio import vocoder
+ from gnuradio.vocoder import freedv_api
+ make: vocoder.freedv_tx_ss(${mode},${txt_msg})
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_freedv_tx_ss.xml b/gr-vocoder/grc/vocoder_freedv_tx_ss.xml
deleted file mode 100644
index 54a49b730..000000000
--- a/gr-vocoder/grc/vocoder_freedv_tx_ss.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## FreeDV audio modem modulator
-###################################################
- -->
-<block>
- <name>FreeDV modulator</name>
- <key>vocoder_freedv_tx_ss</key>
- <import>from gnuradio import vocoder</import>
- <import>from gnuradio.vocoder import freedv_api</import>
- <make>vocoder.freedv_tx_ss($mode,$txt_msg)</make>
- <param>
- <name>Operating Mode</name>
- <key>mode</key>
- <value>freedv_api.MODE_1600</value>
- <type>int</type>
- <option>
- <name>1600</name>
- <key>freedv_api.MODE_1600</key>
- </option>
- <option>
- <name>700</name>
- <key>freedv_api.MODE_700</key>
- </option>
- <option>
- <name>700B</name>
- <key>freedv_api.MODE_700B</key>
- </option>
- <option>
- <name>2400A</name>
- <key>freedv_api.MODE_2400A</key>
- </option>
- <option>
- <name>2400B</name>
- <key>freedv_api.MODE_2400B</key>
- </option>
- <option>
- <name>800XA</name>
- <key>freedv_api.MODE_800XA</key>
- </option>
- </param>
- <param>
- <name>Text Message</name>
- <key>txt_msg</key>
- <value>'GNU Radio'</value>
- <type>string</type>
- </param>
- <sink>
- <name>in</name>
- <type>short</type>
- </sink>
- <source>
- <name>out</name>
- <type>short</type>
- </source>
-</block>
diff --git a/gr-vocoder/grc/vocoder_g721_decode_bs.block.yml b/gr-vocoder/grc/vocoder_g721_decode_bs.block.yml
new file mode 100644
index 000000000..8ee30dca0
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_g721_decode_bs.block.yml
@@ -0,0 +1,16 @@
+id: vocoder_g721_decode_bs
+label: g721 Audio Decoder
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: short
+
+templates:
+ imports: from gnuradio import vocoder
+ make: vocoder.g721_decode_bs()
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_g721_decode_bs.xml b/gr-vocoder/grc/vocoder_g721_decode_bs.xml
deleted file mode 100644
index d5c0291b7..000000000
--- a/gr-vocoder/grc/vocoder_g721_decode_bs.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## g271 audio decoder
-###################################################
- -->
-<block>
- <name>g721 Audio Decoder</name>
- <key>vocoder_g721_decode_bs</key>
- <import>from gnuradio import vocoder</import>
- <make>vocoder.g721_decode_bs()</make>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>short</type>
- </source>
-</block>
diff --git a/gr-vocoder/grc/vocoder_g721_encode_sb.block.yml b/gr-vocoder/grc/vocoder_g721_encode_sb.block.yml
new file mode 100644
index 000000000..f9a60ed25
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_g721_encode_sb.block.yml
@@ -0,0 +1,16 @@
+id: vocoder_g721_encode_sb
+label: g721 Audio Encoder
+
+inputs:
+- domain: stream
+ dtype: short
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import vocoder
+ make: vocoder.g721_encode_sb()
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_g721_encode_sb.xml b/gr-vocoder/grc/vocoder_g721_encode_sb.xml
deleted file mode 100644
index f105ff8ff..000000000
--- a/gr-vocoder/grc/vocoder_g721_encode_sb.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## g721 audio encoder
-###################################################
- -->
-<block>
- <name>g721 Audio Encoder</name>
- <key>vocoder_g721_encode_sb</key>
- <import>from gnuradio import vocoder</import>
- <make>vocoder.g721_encode_sb()</make>
- <sink>
- <name>in</name>
- <type>short</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
-
-
diff --git a/gr-vocoder/grc/vocoder_g723_24_decode_bs.block.yml b/gr-vocoder/grc/vocoder_g723_24_decode_bs.block.yml
new file mode 100644
index 000000000..d16a1d3a0
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_g723_24_decode_bs.block.yml
@@ -0,0 +1,16 @@
+id: vocoder_g723_24_decode_bs
+label: g723_24 Audio Decoder
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: short
+
+templates:
+ imports: from gnuradio import vocoder
+ make: vocoder.g723_24_decode_bs()
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_g723_24_decode_bs.xml b/gr-vocoder/grc/vocoder_g723_24_decode_bs.xml
deleted file mode 100644
index 939a7f91b..000000000
--- a/gr-vocoder/grc/vocoder_g723_24_decode_bs.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## g723_24 audio decoder
-###################################################
- -->
-<block>
- <name>g723_24 Audio Decoder</name>
- <key>vocoder_g723_24_decode_bs</key>
- <import>from gnuradio import vocoder</import>
- <make>vocoder.g723_24_decode_bs()</make>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>short</type>
- </source>
-</block>
diff --git a/gr-vocoder/grc/vocoder_g723_24_encode_sb.block.yml b/gr-vocoder/grc/vocoder_g723_24_encode_sb.block.yml
new file mode 100644
index 000000000..36f95b630
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_g723_24_encode_sb.block.yml
@@ -0,0 +1,16 @@
+id: vocoder_g723_24_encode_sb
+label: g723_24 Audio Encoder
+
+inputs:
+- domain: stream
+ dtype: short
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import vocoder
+ make: vocoder.g723_24_encode_sb()
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_g723_24_encode_sb.xml b/gr-vocoder/grc/vocoder_g723_24_encode_sb.xml
deleted file mode 100644
index 0e70ddedc..000000000
--- a/gr-vocoder/grc/vocoder_g723_24_encode_sb.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## g723_24 audio encoder
-###################################################
- -->
-<block>
- <name>g723_24 Audio Encoder</name>
- <key>vocoder_g723_24_encode_sb</key>
- <import>from gnuradio import vocoder</import>
- <make>vocoder.g723_24_encode_sb()</make>
- <sink>
- <name>in</name>
- <type>short</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
-
-
diff --git a/gr-vocoder/grc/vocoder_g723_40_decode_bs.block.yml b/gr-vocoder/grc/vocoder_g723_40_decode_bs.block.yml
new file mode 100644
index 000000000..e42e33d6b
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_g723_40_decode_bs.block.yml
@@ -0,0 +1,16 @@
+id: vocoder_g723_40_decode_bs
+label: g723_40 Audio Decoder
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: short
+
+templates:
+ imports: from gnuradio import vocoder
+ make: vocoder.g723_40_decode_bs()
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_g723_40_decode_bs.xml b/gr-vocoder/grc/vocoder_g723_40_decode_bs.xml
deleted file mode 100644
index f3ba56e5b..000000000
--- a/gr-vocoder/grc/vocoder_g723_40_decode_bs.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## g723_40 audio decoder
-###################################################
- -->
-<block>
- <name>g723_40 Audio Decoder</name>
- <key>vocoder_g723_40_decode_bs</key>
- <import>from gnuradio import vocoder</import>
- <make>vocoder.g723_40_decode_bs()</make>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>short</type>
- </source>
-</block>
diff --git a/gr-vocoder/grc/vocoder_g723_40_encode_sb.block.yml b/gr-vocoder/grc/vocoder_g723_40_encode_sb.block.yml
new file mode 100644
index 000000000..2f58b4151
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_g723_40_encode_sb.block.yml
@@ -0,0 +1,16 @@
+id: vocoder_g723_40_encode_sb
+label: g723_40 Audio Encoder
+
+inputs:
+- domain: stream
+ dtype: short
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import vocoder
+ make: vocoder.g723_40_encode_sb()
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_g723_40_encode_sb.xml b/gr-vocoder/grc/vocoder_g723_40_encode_sb.xml
deleted file mode 100644
index fbbf600ff..000000000
--- a/gr-vocoder/grc/vocoder_g723_40_encode_sb.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## g723_40 audio encoder
-###################################################
- -->
-<block>
- <name>g723_40 Audio Encoder</name>
- <key>vocoder_g723_40_encode_sb</key>
- <import>from gnuradio import vocoder</import>
- <make>vocoder.g723_40_encode_sb()</make>
- <sink>
- <name>in</name>
- <type>short</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
-
-
diff --git a/gr-vocoder/grc/vocoder_gsm_fr_decode_ps.block.yml b/gr-vocoder/grc/vocoder_gsm_fr_decode_ps.block.yml
new file mode 100644
index 000000000..47ff9621b
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_gsm_fr_decode_ps.block.yml
@@ -0,0 +1,17 @@
+id: vocoder_gsm_fr_decode_ps
+label: GSM full-rate Audio Decoder
+
+inputs:
+- domain: stream
+ dtype: byte
+ vlen: 33
+
+outputs:
+- domain: stream
+ dtype: short
+
+templates:
+ imports: from gnuradio import vocoder
+ make: vocoder.gsm_fr_decode_ps()
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_gsm_fr_decode_ps.xml b/gr-vocoder/grc/vocoder_gsm_fr_decode_ps.xml
deleted file mode 100644
index bef07fb82..000000000
--- a/gr-vocoder/grc/vocoder_gsm_fr_decode_ps.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## GSM full-rate audio decoder
-###################################################
- -->
-<block>
- <name>GSM full-rate Audio Decoder</name>
- <key>vocoder_gsm_fr_decode_ps</key>
- <import>from gnuradio import vocoder</import>
- <make>vocoder.gsm_fr_decode_ps()</make>
- <sink>
- <name>in</name>
- <type>byte</type>
- <vlen>33</vlen>
- </sink>
- <source>
- <name>out</name>
- <type>short</type>
- </source>
-</block>
diff --git a/gr-vocoder/grc/vocoder_gsm_fr_encode_sp.block.yml b/gr-vocoder/grc/vocoder_gsm_fr_encode_sp.block.yml
new file mode 100644
index 000000000..4fcd2dc6d
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_gsm_fr_encode_sp.block.yml
@@ -0,0 +1,17 @@
+id: vocoder_gsm_fr_encode_sp
+label: GSM full-rate Audio Encoder
+
+inputs:
+- domain: stream
+ dtype: short
+
+outputs:
+- domain: stream
+ dtype: byte
+ vlen: 33
+
+templates:
+ imports: from gnuradio import vocoder
+ make: vocoder.gsm_fr_encode_sp()
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_gsm_fr_encode_sp.xml b/gr-vocoder/grc/vocoder_gsm_fr_encode_sp.xml
deleted file mode 100644
index 4c3eab71a..000000000
--- a/gr-vocoder/grc/vocoder_gsm_fr_encode_sp.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## GSM full-rate audio encoder
-###################################################
- -->
-<block>
- <name>GSM full-rate Audio Encoder</name>
- <key>vocoder_gsm_fr_encode_sp</key>
- <import>from gnuradio import vocoder</import>
- <make>vocoder.gsm_fr_encode_sp()</make>
- <sink>
- <name>in</name>
- <type>short</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- <vlen>33</vlen>
- </source>
-</block>
-
-
diff --git a/gr-vocoder/grc/vocoder_ulaw_decode_bs.block.yml b/gr-vocoder/grc/vocoder_ulaw_decode_bs.block.yml
new file mode 100644
index 000000000..384036ee5
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_ulaw_decode_bs.block.yml
@@ -0,0 +1,16 @@
+id: vocoder_ulaw_decode_bs
+label: ulaw Audio Decoder
+
+inputs:
+- domain: stream
+ dtype: byte
+
+outputs:
+- domain: stream
+ dtype: short
+
+templates:
+ imports: from gnuradio import vocoder
+ make: vocoder.ulaw_decode_bs()
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_ulaw_decode_bs.xml b/gr-vocoder/grc/vocoder_ulaw_decode_bs.xml
deleted file mode 100644
index ca3c535c1..000000000
--- a/gr-vocoder/grc/vocoder_ulaw_decode_bs.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## Ulaw audio decoder
-###################################################
- -->
-<block>
- <name>ulaw Audio Decoder</name>
- <key>vocoder_ulaw_decode_bs</key>
- <import>from gnuradio import vocoder</import>
- <make>vocoder.ulaw_decode_bs()</make>
- <sink>
- <name>in</name>
- <type>byte</type>
- </sink>
- <source>
- <name>out</name>
- <type>short</type>
- </source>
-</block>
diff --git a/gr-vocoder/grc/vocoder_ulaw_encode_sb.block.yml b/gr-vocoder/grc/vocoder_ulaw_encode_sb.block.yml
new file mode 100644
index 000000000..024384d62
--- /dev/null
+++ b/gr-vocoder/grc/vocoder_ulaw_encode_sb.block.yml
@@ -0,0 +1,16 @@
+id: vocoder_ulaw_encode_sb
+label: ulaw Audio Encoder
+
+inputs:
+- domain: stream
+ dtype: short
+
+outputs:
+- domain: stream
+ dtype: byte
+
+templates:
+ imports: from gnuradio import vocoder
+ make: vocoder.ulaw_encode_sb()
+
+file_format: 1
diff --git a/gr-vocoder/grc/vocoder_ulaw_encode_sb.xml b/gr-vocoder/grc/vocoder_ulaw_encode_sb.xml
deleted file mode 100644
index 8e76d8d08..000000000
--- a/gr-vocoder/grc/vocoder_ulaw_encode_sb.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-## ulaw audio encoder
-###################################################
- -->
-<block>
- <name>ulaw Audio Encoder</name>
- <key>vocoder_ulaw_encode_sb</key>
- <import>from gnuradio import vocoder</import>
- <make>vocoder.ulaw_encode_sb()</make>
- <sink>
- <name>in</name>
- <type>short</type>
- </sink>
- <source>
- <name>out</name>
- <type>byte</type>
- </source>
-</block>
-
-
diff --git a/gr-vocoder/python/vocoder/CMakeLists.txt b/gr-vocoder/python/vocoder/CMakeLists.txt
index d4fe3d9e8..464cc4ff3 100644
--- a/gr-vocoder/python/vocoder/CMakeLists.txt
+++ b/gr-vocoder/python/vocoder/CMakeLists.txt
@@ -61,6 +61,6 @@ if(ENABLE_TESTING)
endif()
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${CMAKE_CURRENT_SOURCE_DIR}/${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${CMAKE_CURRENT_SOURCE_DIR}/${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gr-vocoder/python/vocoder/__init__.py b/gr-vocoder/python/vocoder/__init__.py
index 7b1b82f84..3f4c301d9 100644
--- a/gr-vocoder/python/vocoder/__init__.py
+++ b/gr-vocoder/python/vocoder/__init__.py
@@ -23,13 +23,16 @@
This is the gr-vocoder package. This package includes the various
vocoder blocks in GNU Radio.
'''
+from __future__ import absolute_import
+from __future__ import unicode_literals
+
import os
try:
- from vocoder_swig import *
+ from .vocoder_swig import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
- from vocoder_swig import *
+ from .vocoder_swig import *
-from cvsd import *
+from .cvsd import *
diff --git a/gr-vocoder/python/vocoder/cvsd.py b/gr-vocoder/python/vocoder/cvsd.py
index b6ce82293..00a24df25 100644
--- a/gr-vocoder/python/vocoder/cvsd.py
+++ b/gr-vocoder/python/vocoder/cvsd.py
@@ -20,8 +20,11 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+from __future__ import unicode_literals
from gnuradio import gr, filter, blocks
-import vocoder_swig
+from . import vocoder_swig
+
class cvsd_encode_fb(gr.hier_block2):
'''
@@ -39,9 +42,9 @@ class cvsd_encode_fb(gr.hier_block2):
from 1 to 8. A rate of 8k with a resampling rate of 8 provides a good quality signal.
'''
- gr.hier_block2.__init__(self, "cvsd_encode",
- gr.io_signature(1, 1, gr.sizeof_float), # Input signature
- gr.io_signature(1, 1, gr.sizeof_char)) # Output signature
+ gr.hier_block2.__init__(self, "cvsd_encode",
+ gr.io_signature(1, 1, gr.sizeof_float), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_char)) # Output signature
scale_factor = 32000.0
self.interp = resample
@@ -70,9 +73,9 @@ class cvsd_decode_bf(gr.hier_block2):
When using the CVSD vocoder, appropriate sampling rates are from 8k to 64k with resampling rates
from 1 to 8. A rate of 8k with a resampling rate of 8 provides a good quality signal.
'''
- gr.hier_block2.__init__(self, "cvsd_decode",
- gr.io_signature(1, 1, gr.sizeof_char), # Input signature
- gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
+ gr.hier_block2.__init__(self, "cvsd_decode",
+ gr.io_signature(1, 1, gr.sizeof_char), # Input signature
+ gr.io_signature(1, 1, gr.sizeof_float)) # Output signature
scale_factor = 32000.0
self.decim = resample
@@ -81,6 +84,6 @@ class cvsd_decode_bf(gr.hier_block2):
s2f = blocks.short_to_float()
taps = filter.firdes.low_pass(1, 1, bw, 2*bw)
decim = filter.fir_filter_fff(self.decim, taps)
- sink_scale = blocks.multiply_const_ff(1.0/scale_factor)
+ sink_scale = blocks.multiply_const_ff(1.0 / scale_factor)
self.connect(self, dec, s2f, decim, sink_scale, self)
diff --git a/gr-vocoder/python/vocoder/qa_alaw_vocoder.py b/gr-vocoder/python/vocoder/qa_alaw_vocoder.py
index 4a2b4c3c8..e2398a201 100755..100644
--- a/gr-vocoder/python/vocoder/qa_alaw_vocoder.py
+++ b/gr-vocoder/python/vocoder/qa_alaw_vocoder.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, vocoder, blocks
class test_alaw_vocoder (gr_unittest.TestCase):
diff --git a/gr-vocoder/python/vocoder/qa_codec2_vocoder.py b/gr-vocoder/python/vocoder/qa_codec2_vocoder.py
index 8fe3ac56b..8c7656cb4 100755..100644
--- a/gr-vocoder/python/vocoder/qa_codec2_vocoder.py
+++ b/gr-vocoder/python/vocoder/qa_codec2_vocoder.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, vocoder, blocks
from gnuradio.vocoder import codec2
diff --git a/gr-vocoder/python/vocoder/qa_cvsd_vocoder.py b/gr-vocoder/python/vocoder/qa_cvsd_vocoder.py
index 408c6b74c..b1516e0ef 100755..100644
--- a/gr-vocoder/python/vocoder/qa_cvsd_vocoder.py
+++ b/gr-vocoder/python/vocoder/qa_cvsd_vocoder.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, vocoder, blocks, filter
from gnuradio.vocoder import cvsd
diff --git a/gr-vocoder/python/vocoder/qa_g721_vocoder.py b/gr-vocoder/python/vocoder/qa_g721_vocoder.py
index 8808b8fed..ad1e85471 100755..100644
--- a/gr-vocoder/python/vocoder/qa_g721_vocoder.py
+++ b/gr-vocoder/python/vocoder/qa_g721_vocoder.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, vocoder, blocks
class test_g721_vocoder (gr_unittest.TestCase):
diff --git a/gr-vocoder/python/vocoder/qa_g723_24_vocoder.py b/gr-vocoder/python/vocoder/qa_g723_24_vocoder.py
index c587623e1..755cde922 100755..100644
--- a/gr-vocoder/python/vocoder/qa_g723_24_vocoder.py
+++ b/gr-vocoder/python/vocoder/qa_g723_24_vocoder.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, vocoder, blocks
class test_g723_24_vocoder (gr_unittest.TestCase):
diff --git a/gr-vocoder/python/vocoder/qa_g723_40_vocoder.py b/gr-vocoder/python/vocoder/qa_g723_40_vocoder.py
index 689102237..911de9f66 100755..100644
--- a/gr-vocoder/python/vocoder/qa_g723_40_vocoder.py
+++ b/gr-vocoder/python/vocoder/qa_g723_40_vocoder.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, vocoder, blocks
class test_g723_40_vocoder (gr_unittest.TestCase):
diff --git a/gr-vocoder/python/vocoder/qa_gsm_full_rate.py b/gr-vocoder/python/vocoder/qa_gsm_full_rate.py
index 69ea94bbf..5cca23045 100755..100644
--- a/gr-vocoder/python/vocoder/qa_gsm_full_rate.py
+++ b/gr-vocoder/python/vocoder/qa_gsm_full_rate.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, vocoder, blocks
class test_gsm_vocoder (gr_unittest.TestCase):
diff --git a/gr-vocoder/python/vocoder/qa_ulaw_vocoder.py b/gr-vocoder/python/vocoder/qa_ulaw_vocoder.py
index 46c8d490a..8cfc13fc0 100755..100644
--- a/gr-vocoder/python/vocoder/qa_ulaw_vocoder.py
+++ b/gr-vocoder/python/vocoder/qa_ulaw_vocoder.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, vocoder, blocks
class test_ulaw_vocoder (gr_unittest.TestCase):
diff --git a/gr-wavelet/python/wavelet/CMakeLists.txt b/gr-wavelet/python/wavelet/CMakeLists.txt
index 9e1961d4e..493a24d1c 100644
--- a/gr-wavelet/python/wavelet/CMakeLists.txt
+++ b/gr-wavelet/python/wavelet/CMakeLists.txt
@@ -41,6 +41,6 @@ if(ENABLE_TESTING)
file(GLOB py_qa_test_files "qa_*.py")
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gr-wavelet/python/wavelet/__init__.py b/gr-wavelet/python/wavelet/__init__.py
index 7f3d9afa5..8fbab42f5 100644
--- a/gr-wavelet/python/wavelet/__init__.py
+++ b/gr-wavelet/python/wavelet/__init__.py
@@ -22,11 +22,12 @@
'''
Processing blocks for wavelet transforms.
'''
+from __future__ import unicode_literals
import os
try:
- from wavelet_swig import *
+ from .wavelet_swig import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
- from wavelet_swig import *
+ from .wavelet_swig import *
diff --git a/gr-wavelet/python/wavelet/qa_classify.py b/gr-wavelet/python/wavelet/qa_classify.py
index 4752620f4..7f562c628 100755..100644
--- a/gr-wavelet/python/wavelet/qa_classify.py
+++ b/gr-wavelet/python/wavelet/qa_classify.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+
import numpy
from gnuradio import gr, gr_unittest, wavelet, analog, blocks
import copy
@@ -79,14 +81,14 @@ class test_classify(gr_unittest.TestCase):
def test_002_(self):
src_data = numpy.array([-1.0,
- -1.0/2.0,
- -1.0/3.0,
- -1.0/4.0,
- -1.0/5.0])
+ -1.0 / 2.0,
+ -1.0 / 3.0,
+ -1.0 / 4.0,
+ -1.0 / 5.0])
trg_data = copy.deepcopy(src_data)
src = blocks.vector_source_f(src_data, False, len(src_data))
- st = blocks.stretch_ff(-1.0/5.0, len(src_data))
+ st = blocks.stretch_ff(-1.0 / 5.0, len(src_data))
dst = blocks.vector_sink_f(len(src_data))
self.tb.connect(src, st)
self.tb.connect(st, dst)
@@ -155,11 +157,11 @@ class test_classify(gr_unittest.TestCase):
dwav = numpy.array(src_data)
wvps = numpy.zeros(3)
# wavelet power spectrum
- scl = 1.0/sqr(dwav[0])
+ scl = 1.0 / sqr(dwav[0])
k = 1
for e in range(len(wvps)):
- wvps[e] = scl*sqr(dwav[k:k+(01<<e)]).sum()
- k += 01<<e
+ wvps[e] = scl*sqr(dwav[k:k+(0o1<<e)]).sum()
+ k += 0o1<<e
src = blocks.vector_source_f(src_data, False, len(src_data))
kon = wavelet.wvps_ff(len(src_data))
diff --git a/gr-zeromq/examples/python/client.py b/gr-zeromq/examples/python/client.py
index ca7ad1830..39055bd3f 100755..100644
--- a/gr-zeromq/examples/python/client.py
+++ b/gr-zeromq/examples/python/client.py
@@ -1,3 +1,5 @@
+from __future__ import print_function
+from __future__ import unicode_literals
#
# Copyright 2013 Free Software Foundation, Inc.
#
@@ -67,14 +69,14 @@ class top_block(gr.top_block):
self.rpc_manager.start_watcher()
def start_fg(self):
- print "Start Flowgraph"
+ print("Start Flowgraph")
try:
self.start()
except RuntimeError:
- print "Can't start, flowgraph already running!"
+ print("Can't start, flowgraph already running!")
def stop_fg(self):
- print "Stop Flowgraph"
+ print("Stop Flowgraph")
self.stop()
self.wait()
@@ -110,7 +112,7 @@ if __name__ == "__main__":
time.sleep(1)
except KeyboardInterrupt:
pass
- print "Shutting down flowgraph."
+ print("Shutting down flowgraph.")
tb.rpc_manager.stop_watcher()
tb.stop()
tb.wait()
diff --git a/gr-zeromq/examples/python/gui.py b/gr-zeromq/examples/python/gui.py
index c93254940..832392f0a 100755..100644
--- a/gr-zeromq/examples/python/gui.py
+++ b/gr-zeromq/examples/python/gui.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
#
# Copyright 2013 Free Software Foundation, Inc.
#
@@ -112,7 +113,7 @@ class gui(QtGui.QMainWindow):
# plot the data from the queues
def plot_data(self, plot, samples):
- self.x = range(0,len(samples),1)
+ self.x = list(range(0,len(samples),1))
self.y = samples
# clear the previous points from the plot
plot.clear()
diff --git a/gr-zeromq/examples/python/server.py b/gr-zeromq/examples/python/server.py
index 23951664c..b2cd8e8ef 100755..100644
--- a/gr-zeromq/examples/python/server.py
+++ b/gr-zeromq/examples/python/server.py
@@ -1,3 +1,5 @@
+from __future__ import print_function
+from __future__ import unicode_literals
#
# Copyright 2013 Free Software Foundation, Inc.
#
@@ -78,14 +80,14 @@ class top_block(gr.top_block):
self.rpc_manager.start_watcher()
def start_fg(self):
- print "Start Flowgraph"
+ print("Start Flowgraph")
try:
self.start()
except RuntimeError:
- print "Can't start, flowgraph already running!"
+ print("Can't start, flowgraph already running!")
def stop_fg(self):
- print "Stop Flowgraph"
+ print("Stop Flowgraph")
self.stop()
self.wait()
@@ -119,7 +121,7 @@ if __name__ == "__main__":
time.sleep(1)
except KeyboardInterrupt:
pass
- print "Shutting down flowgraph."
+ print("Shutting down flowgraph.")
tb.rpc_manager.stop_watcher()
tb.stop()
tb.wait()
diff --git a/gr-zeromq/grc/CMakeLists.txt b/gr-zeromq/grc/CMakeLists.txt
index 7807bcfe9..50aa1d7d5 100644
--- a/gr-zeromq/grc/CMakeLists.txt
+++ b/gr-zeromq/grc/CMakeLists.txt
@@ -18,18 +18,18 @@
# Boston, MA 02110-1301, USA.
install(FILES
- zeromq_pub_sink.xml
- zeromq_pub_msg_sink.xml
- zeromq_sub_source.xml
- zeromq_sub_msg_source.xml
- zeromq_push_sink.xml
- zeromq_push_msg_sink.xml
- zeromq_pull_source.xml
- zeromq_pull_msg_source.xml
- zeromq_rep_sink.xml
- zeromq_rep_msg_sink.xml
- zeromq_req_source.xml
- zeromq_req_msg_source.xml
+ zeromq_pub_sink.block.yml
+ zeromq_pub_msg_sink.block.yml
+ zeromq_sub_source.block.yml
+ zeromq_sub_msg_source.block.yml
+ zeromq_push_sink.block.yml
+ zeromq_push_msg_sink.block.yml
+ zeromq_pull_source.block.yml
+ zeromq_pull_msg_source.block.yml
+ zeromq_rep_sink.block.yml
+ zeromq_rep_msg_sink.block.yml
+ zeromq_req_source.block.yml
+ zeromq_req_msg_source.block.yml
DESTINATION share/gnuradio/grc/blocks
)
diff --git a/gr-zeromq/grc/zeromq_pub_msg_sink.block.yml b/gr-zeromq/grc/zeromq_pub_msg_sink.block.yml
new file mode 100644
index 000000000..ee4e9739d
--- /dev/null
+++ b/gr-zeromq/grc/zeromq_pub_msg_sink.block.yml
@@ -0,0 +1,23 @@
+id: zeromq_pub_msg_sink
+label: ZMQ PUB Message Sink
+category: '[Core]/ZeroMQ Interfaces'
+
+parameters:
+- id: address
+ label: Address
+ dtype: string
+- id: timeout
+ label: Timeout (msec)
+ dtype: float
+ default: '100'
+
+inputs:
+- domain: message
+ id: in
+ optional: true
+
+templates:
+ imports: from gnuradio import zeromq
+ make: zeromq.pub_msg_sink(${address}, ${timeout})
+
+file_format: 1
diff --git a/gr-zeromq/grc/zeromq_pub_msg_sink.xml b/gr-zeromq/grc/zeromq_pub_msg_sink.xml
deleted file mode 100644
index 245ac3718..000000000
--- a/gr-zeromq/grc/zeromq_pub_msg_sink.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>ZMQ PUB Message Sink</name>
- <key>zeromq_pub_msg_sink</key>
- <category>[Core]/ZeroMQ Interfaces</category>
- <import>from gnuradio import zeromq</import>
- <make>zeromq.pub_msg_sink($address, $timeout)</make>
-
- <param>
- <name>Address</name>
- <key>address</key>
- <type>string</type>
- </param>
-
- <param>
- <name>Timeout (msec)</name>
- <key>timeout</key>
- <value>100</value>
- <type>float</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
-
-</block>
diff --git a/gr-zeromq/grc/zeromq_pub_sink.block.yml b/gr-zeromq/grc/zeromq_pub_sink.block.yml
new file mode 100644
index 000000000..d8e5983d2
--- /dev/null
+++ b/gr-zeromq/grc/zeromq_pub_sink.block.yml
@@ -0,0 +1,48 @@
+id: zeromq_pub_sink
+label: ZMQ PUB Sink
+category: '[Core]/ZeroMQ Interfaces'
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ itemsize: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: address
+ label: Address
+ dtype: string
+- id: timeout
+ label: Timeout (msec)
+ dtype: float
+ default: '100'
+- id: pass_tags
+ label: Pass Tags
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: hwm
+ label: High Watermark
+ dtype: int
+ default: '-1'
+ hide: ${ ('part' if hwm == -1 else 'none') }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import zeromq
+ make: zeromq.pub_sink(${type.itemsize}, ${vlen}, ${address}, ${timeout}, ${pass_tags},
+ ${hwm})
+
+file_format: 1
diff --git a/gr-zeromq/grc/zeromq_pub_sink.xml b/gr-zeromq/grc/zeromq_pub_sink.xml
deleted file mode 100644
index af130eeb2..000000000
--- a/gr-zeromq/grc/zeromq_pub_sink.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>ZMQ PUB Sink</name>
- <key>zeromq_pub_sink</key>
- <category>[Core]/ZeroMQ Interfaces</category>
- <import>from gnuradio import zeromq</import>
- <make>zeromq.pub_sink($type.itemsize, $vlen, $address, $timeout, $pass_tags, $hwm)</make>
-
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>itemsize:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>itemsize:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>itemsize:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>itemsize:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>itemsize:gr.sizeof_char</opt>
- </option>
- </param>
-
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Address</name>
- <key>address</key>
- <type>string</type>
- </param>
-
- <param>
- <name>Timeout (msec)</name>
- <key>timeout</key>
- <value>100</value>
- <type>float</type>
- </param>
-
- <param>
- <name>Pass Tags</name>
- <key>pass_tags</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>High Watermark</name>
- <key>hwm</key>
- <value>-1</value>
- <type>int</type>
- <hide>#if $hwm() == -1 then 'part' else 'none'#</hide>
- </param>
-
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
-
-</block>
diff --git a/gr-zeromq/grc/zeromq_pull_msg_source.block.yml b/gr-zeromq/grc/zeromq_pull_msg_source.block.yml
new file mode 100644
index 000000000..00be80c2c
--- /dev/null
+++ b/gr-zeromq/grc/zeromq_pull_msg_source.block.yml
@@ -0,0 +1,23 @@
+id: zeromq_pull_msg_source
+label: ZMQ PULL Message Source
+category: '[Core]/ZeroMQ Interfaces'
+
+parameters:
+- id: address
+ label: Address
+ dtype: string
+- id: timeout
+ label: Timeout (msec)
+ dtype: float
+ default: '100'
+
+outputs:
+- domain: message
+ id: out
+ optional: true
+
+templates:
+ imports: from gnuradio import zeromq
+ make: zeromq.pull_msg_source(${address}, ${timeout})
+
+file_format: 1
diff --git a/gr-zeromq/grc/zeromq_pull_msg_source.xml b/gr-zeromq/grc/zeromq_pull_msg_source.xml
deleted file mode 100644
index c6004d987..000000000
--- a/gr-zeromq/grc/zeromq_pull_msg_source.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>ZMQ PULL Message Source</name>
- <key>zeromq_pull_msg_source</key>
- <category>[Core]/ZeroMQ Interfaces</category>
- <import>from gnuradio import zeromq</import>
- <make>zeromq.pull_msg_source($address, $timeout)</make>
-
- <param>
- <name>Address</name>
- <key>address</key>
- <type>string</type>
- </param>
-
- <param>
- <name>Timeout (msec)</name>
- <key>timeout</key>
- <value>100</value>
- <type>float</type>
- </param>
-
- <source>
- <name>out</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-
-</block>
diff --git a/gr-zeromq/grc/zeromq_pull_source.block.yml b/gr-zeromq/grc/zeromq_pull_source.block.yml
new file mode 100644
index 000000000..a318b568f
--- /dev/null
+++ b/gr-zeromq/grc/zeromq_pull_source.block.yml
@@ -0,0 +1,48 @@
+id: zeromq_pull_source
+label: ZMQ PULL Source
+category: '[Core]/ZeroMQ Interfaces'
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ itemsize: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: address
+ label: Address
+ dtype: string
+- id: timeout
+ label: Timeout (msec)
+ dtype: float
+ default: '100'
+- id: pass_tags
+ label: Pass Tags
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: hwm
+ label: High Watermark
+ dtype: int
+ default: '-1'
+ hide: ${ ('part' if hwm == -1 else 'none') }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import zeromq
+ make: zeromq.pull_source(${type.itemsize}, ${vlen}, ${address}, ${timeout}, ${pass_tags},
+ ${hwm})
+
+file_format: 1
diff --git a/gr-zeromq/grc/zeromq_pull_source.xml b/gr-zeromq/grc/zeromq_pull_source.xml
deleted file mode 100644
index f2c8b61d8..000000000
--- a/gr-zeromq/grc/zeromq_pull_source.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>ZMQ PULL Source</name>
- <key>zeromq_pull_source</key>
- <category>[Core]/ZeroMQ Interfaces</category>
- <import>from gnuradio import zeromq</import>
- <make>zeromq.pull_source($type.itemsize, $vlen, $address, $timeout, $pass_tags, $hwm)</make>
-
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>itemsize:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>itemsize:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>itemsize:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>itemsize:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>itemsize:gr.sizeof_char</opt>
- </option>
- </param>
-
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Address</name>
- <key>address</key>
- <type>string</type>
- </param>
-
- <param>
- <name>Timeout (msec)</name>
- <key>timeout</key>
- <value>100</value>
- <type>float</type>
- </param>
-
- <param>
- <name>Pass Tags</name>
- <key>pass_tags</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>High Watermark</name>
- <key>hwm</key>
- <value>-1</value>
- <type>int</type>
- <hide>#if $hwm() == -1 then 'part' else 'none'#</hide>
- </param>
-
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-
-</block>
diff --git a/gr-zeromq/grc/zeromq_push_msg_sink.block.yml b/gr-zeromq/grc/zeromq_push_msg_sink.block.yml
new file mode 100644
index 000000000..d1c9d8f82
--- /dev/null
+++ b/gr-zeromq/grc/zeromq_push_msg_sink.block.yml
@@ -0,0 +1,23 @@
+id: zeromq_push_msg_sink
+label: ZMQ PUSH Message Sink
+category: '[Core]/ZeroMQ Interfaces'
+
+parameters:
+- id: address
+ label: Address
+ dtype: string
+- id: timeout
+ label: Timeout (msec)
+ dtype: float
+ default: '100'
+
+inputs:
+- domain: message
+ id: in
+ optional: true
+
+templates:
+ imports: from gnuradio import zeromq
+ make: zeromq.push_msg_sink(${address}, ${timeout})
+
+file_format: 1
diff --git a/gr-zeromq/grc/zeromq_push_msg_sink.xml b/gr-zeromq/grc/zeromq_push_msg_sink.xml
deleted file mode 100644
index 283a25006..000000000
--- a/gr-zeromq/grc/zeromq_push_msg_sink.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>ZMQ PUSH Message Sink</name>
- <key>zeromq_push_msg_sink</key>
- <category>[Core]/ZeroMQ Interfaces</category>
- <import>from gnuradio import zeromq</import>
- <make>zeromq.push_msg_sink($address, $timeout)</make>
-
- <param>
- <name>Address</name>
- <key>address</key>
- <type>string</type>
- </param>
-
- <param>
- <name>Timeout (msec)</name>
- <key>timeout</key>
- <value>100</value>
- <type>float</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
-
-</block>
diff --git a/gr-zeromq/grc/zeromq_push_sink.block.yml b/gr-zeromq/grc/zeromq_push_sink.block.yml
new file mode 100644
index 000000000..63b9d2497
--- /dev/null
+++ b/gr-zeromq/grc/zeromq_push_sink.block.yml
@@ -0,0 +1,48 @@
+id: zeromq_push_sink
+label: ZMQ PUSH Sink
+category: '[Core]/ZeroMQ Interfaces'
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ itemsize: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: address
+ label: Address
+ dtype: string
+- id: timeout
+ label: Timeout (msec)
+ dtype: float
+ default: '100'
+- id: pass_tags
+ label: Pass Tags
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: hwm
+ label: High Watermark
+ dtype: int
+ default: '-1'
+ hide: ${ ('part' if hwm == -1 else 'none') }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import zeromq
+ make: zeromq.push_sink(${type.itemsize}, ${vlen}, ${address}, ${timeout}, ${pass_tags},
+ ${hwm})
+
+file_format: 1
diff --git a/gr-zeromq/grc/zeromq_push_sink.xml b/gr-zeromq/grc/zeromq_push_sink.xml
deleted file mode 100644
index 8277c02c2..000000000
--- a/gr-zeromq/grc/zeromq_push_sink.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>ZMQ PUSH Sink</name>
- <key>zeromq_push_sink</key>
- <category>[Core]/ZeroMQ Interfaces</category>
- <import>from gnuradio import zeromq</import>
- <make>zeromq.push_sink($type.itemsize, $vlen, $address, $timeout, $pass_tags, $hwm)</make>
-
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>itemsize:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>itemsize:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>itemsize:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>itemsize:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>itemsize:gr.sizeof_char</opt>
- </option>
- </param>
-
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Address</name>
- <key>address</key>
- <type>string</type>
- </param>
-
- <param>
- <name>Timeout (msec)</name>
- <key>timeout</key>
- <value>100</value>
- <type>float</type>
- </param>
-
- <param>
- <name>Pass Tags</name>
- <key>pass_tags</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>High Watermark</name>
- <key>hwm</key>
- <value>-1</value>
- <type>int</type>
- <hide>#if $hwm() == -1 then 'part' else 'none'#</hide>
- </param>
-
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
-
-</block>
diff --git a/gr-zeromq/grc/zeromq_rep_msg_sink.block.yml b/gr-zeromq/grc/zeromq_rep_msg_sink.block.yml
new file mode 100644
index 000000000..d4732a705
--- /dev/null
+++ b/gr-zeromq/grc/zeromq_rep_msg_sink.block.yml
@@ -0,0 +1,23 @@
+id: zeromq_rep_msg_sink
+label: ZMQ REP Message Sink
+category: '[Core]/ZeroMQ Interfaces'
+
+parameters:
+- id: address
+ label: Address
+ dtype: string
+- id: timeout
+ label: Timeout (msec)
+ dtype: float
+ default: '100'
+
+inputs:
+- domain: message
+ id: in
+ optional: true
+
+templates:
+ imports: from gnuradio import zeromq
+ make: zeromq.rep_msg_sink(${address}, ${timeout})
+
+file_format: 1
diff --git a/gr-zeromq/grc/zeromq_rep_msg_sink.xml b/gr-zeromq/grc/zeromq_rep_msg_sink.xml
deleted file mode 100644
index 37515b39b..000000000
--- a/gr-zeromq/grc/zeromq_rep_msg_sink.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>ZMQ REP Message Sink</name>
- <key>zeromq_rep_msg_sink</key>
- <category>[Core]/ZeroMQ Interfaces</category>
- <import>from gnuradio import zeromq</import>
- <make>zeromq.rep_msg_sink($address, $timeout)</make>
-
- <param>
- <name>Address</name>
- <key>address</key>
- <type>string</type>
- </param>
-
- <param>
- <name>Timeout (msec)</name>
- <key>timeout</key>
- <value>100</value>
- <type>float</type>
- </param>
-
- <sink>
- <name>in</name>
- <type>message</type>
- <optional>1</optional>
- </sink>
-
-</block>
diff --git a/gr-zeromq/grc/zeromq_rep_sink.block.yml b/gr-zeromq/grc/zeromq_rep_sink.block.yml
new file mode 100644
index 000000000..fbc27fcf0
--- /dev/null
+++ b/gr-zeromq/grc/zeromq_rep_sink.block.yml
@@ -0,0 +1,49 @@
+id: zeromq_rep_sink
+label: ZMQ REP Sink
+category: '[Core]/ZeroMQ Interfaces'
+
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ itemsize: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: address
+ label: Address
+ dtype: string
+- id: timeout
+ label: Timeout (msec)
+ dtype: float
+ default: '100'
+- id: pass_tags
+ label: Pass Tags
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: hwm
+ label: High Watermark
+ dtype: int
+ default: '-1'
+ hide: ${ ('part' if hwm == -1 else 'none') }
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import zeromq
+ make: zeromq.rep_sink(${type.itemsize}, ${vlen}, ${address}, ${timeout}, ${pass_tags},
+ ${hwm})
+
+file_format: 1
diff --git a/gr-zeromq/grc/zeromq_rep_sink.xml b/gr-zeromq/grc/zeromq_rep_sink.xml
deleted file mode 100644
index 17c824156..000000000
--- a/gr-zeromq/grc/zeromq_rep_sink.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>ZMQ REP Sink</name>
- <key>zeromq_rep_sink</key>
- <category>[Core]/ZeroMQ Interfaces</category>
- <import>from gnuradio import zeromq</import>
- <make>zeromq.rep_sink($type.itemsize, $vlen, $address, $timeout, $pass_tags, $hwm)</make>
-
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>itemsize:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>itemsize:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>itemsize:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>itemsize:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>itemsize:gr.sizeof_char</opt>
- </option>
- </param>
-
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Address</name>
- <key>address</key>
- <type>string</type>
- </param>
-
- <param>
- <name>Timeout (msec)</name>
- <key>timeout</key>
- <value>100</value>
- <type>float</type>
- </param>
-
- <param>
- <name>Pass Tags</name>
- <key>pass_tags</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>High Watermark</name>
- <key>hwm</key>
- <value>-1</value>
- <type>int</type>
- <hide>#if $hwm() == -1 then 'part' else 'none'#</hide>
- </param>
-
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </sink>
-
-</block>
diff --git a/gr-zeromq/grc/zeromq_req_msg_source.block.yml b/gr-zeromq/grc/zeromq_req_msg_source.block.yml
new file mode 100644
index 000000000..81cefd573
--- /dev/null
+++ b/gr-zeromq/grc/zeromq_req_msg_source.block.yml
@@ -0,0 +1,23 @@
+id: zeromq_req_msg_source
+label: ZMQ REQ Message Source
+category: '[Core]/ZeroMQ Interfaces'
+
+parameters:
+- id: address
+ label: Address
+ dtype: string
+- id: timeout
+ label: Timeout (msec)
+ dtype: float
+ default: '100'
+
+outputs:
+- domain: message
+ id: out
+ optional: true
+
+templates:
+ imports: from gnuradio import zeromq
+ make: zeromq.req_msg_source(${address}, ${timeout})
+
+file_format: 1
diff --git a/gr-zeromq/grc/zeromq_req_msg_source.xml b/gr-zeromq/grc/zeromq_req_msg_source.xml
deleted file mode 100644
index ae34c30dd..000000000
--- a/gr-zeromq/grc/zeromq_req_msg_source.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>ZMQ REQ Message Source</name>
- <key>zeromq_req_msg_source</key>
- <category>[Core]/ZeroMQ Interfaces</category>
- <import>from gnuradio import zeromq</import>
- <make>zeromq.req_msg_source($address, $timeout)</make>
-
- <param>
- <name>Address</name>
- <key>address</key>
- <type>string</type>
- </param>
-
- <param>
- <name>Timeout (msec)</name>
- <key>timeout</key>
- <value>100</value>
- <type>float</type>
- </param>
-
- <source>
- <name>out</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-
-</block>
diff --git a/gr-zeromq/grc/zeromq_req_source.block.yml b/gr-zeromq/grc/zeromq_req_source.block.yml
new file mode 100644
index 000000000..f534e106a
--- /dev/null
+++ b/gr-zeromq/grc/zeromq_req_source.block.yml
@@ -0,0 +1,48 @@
+id: zeromq_req_source
+label: ZMQ REQ Source
+category: '[Core]/ZeroMQ Interfaces'
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ itemsize: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: address
+ label: Address
+ dtype: string
+- id: timeout
+ label: Timeout (msec)
+ dtype: float
+ default: '100'
+- id: pass_tags
+ label: Pass Tags
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: hwm
+ label: High Watermark
+ dtype: int
+ default: '-1'
+ hide: ${ ('part' if hwm == -1 else 'none') }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import zeromq
+ make: zeromq.req_source(${type.itemsize}, ${vlen}, ${address}, ${timeout}, ${pass_tags},
+ ${hwm})
+
+file_format: 1
diff --git a/gr-zeromq/grc/zeromq_req_source.xml b/gr-zeromq/grc/zeromq_req_source.xml
deleted file mode 100644
index 0fc1aa148..000000000
--- a/gr-zeromq/grc/zeromq_req_source.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>ZMQ REQ Source</name>
- <key>zeromq_req_source</key>
- <category>[Core]/ZeroMQ Interfaces</category>
- <import>from gnuradio import zeromq</import>
- <make>zeromq.req_source($type.itemsize, $vlen, $address, $timeout, $pass_tags, $hwm)</make>
-
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>itemsize:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>itemsize:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>itemsize:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>itemsize:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>itemsize:gr.sizeof_char</opt>
- </option>
- </param>
-
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Address</name>
- <key>address</key>
- <type>string</type>
- </param>
-
- <param>
- <name>Timeout (msec)</name>
- <key>timeout</key>
- <value>100</value>
- <type>float</type>
- </param>
-
- <param>
- <name>Pass Tags</name>
- <key>pass_tags</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>High Watermark</name>
- <key>hwm</key>
- <value>-1</value>
- <type>int</type>
- <hide>#if $hwm() == -1 then 'part' else 'none'#</hide>
- </param>
-
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-
-</block>
diff --git a/gr-zeromq/grc/zeromq_sub_msg_source.block.yml b/gr-zeromq/grc/zeromq_sub_msg_source.block.yml
new file mode 100644
index 000000000..a9202d948
--- /dev/null
+++ b/gr-zeromq/grc/zeromq_sub_msg_source.block.yml
@@ -0,0 +1,23 @@
+id: zeromq_sub_msg_source
+label: ZMQ SUB Message Source
+category: '[Core]/ZeroMQ Interfaces'
+
+parameters:
+- id: address
+ label: Address
+ dtype: string
+- id: timeout
+ label: Timeout (msec)
+ dtype: float
+ default: '100'
+
+outputs:
+- domain: message
+ id: out
+ optional: true
+
+templates:
+ imports: from gnuradio import zeromq
+ make: zeromq.sub_msg_source(${address}, ${timeout})
+
+file_format: 1
diff --git a/gr-zeromq/grc/zeromq_sub_msg_source.xml b/gr-zeromq/grc/zeromq_sub_msg_source.xml
deleted file mode 100644
index 475537f5f..000000000
--- a/gr-zeromq/grc/zeromq_sub_msg_source.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>ZMQ SUB Message Source</name>
- <key>zeromq_sub_msg_source</key>
- <category>[Core]/ZeroMQ Interfaces</category>
- <import>from gnuradio import zeromq</import>
- <make>zeromq.sub_msg_source($address, $timeout)</make>
-
- <param>
- <name>Address</name>
- <key>address</key>
- <type>string</type>
- </param>
-
- <param>
- <name>Timeout (msec)</name>
- <key>timeout</key>
- <value>100</value>
- <type>float</type>
- </param>
-
- <source>
- <name>out</name>
- <type>message</type>
- <optional>1</optional>
- </source>
-
-</block>
diff --git a/gr-zeromq/grc/zeromq_sub_source.block.yml b/gr-zeromq/grc/zeromq_sub_source.block.yml
new file mode 100644
index 000000000..7235d480f
--- /dev/null
+++ b/gr-zeromq/grc/zeromq_sub_source.block.yml
@@ -0,0 +1,48 @@
+id: zeromq_sub_source
+label: ZMQ SUB Source
+category: '[Core]/ZeroMQ Interfaces'
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [complex, float, int, short, byte]
+ option_attributes:
+ itemsize: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char]
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: address
+ label: Address
+ dtype: string
+- id: timeout
+ label: Timeout (msec)
+ dtype: float
+ default: '100'
+- id: pass_tags
+ label: Pass Tags
+ dtype: enum
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: ['Yes', 'No']
+- id: hwm
+ label: High Watermark
+ dtype: int
+ default: '-1'
+ hide: ${ ('part' if hwm == -1 else 'none') }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+
+templates:
+ imports: from gnuradio import zeromq
+ make: zeromq.sub_source(${type.itemsize}, ${vlen}, ${address}, ${timeout}, ${pass_tags},
+ ${hwm})
+
+file_format: 1
diff --git a/gr-zeromq/grc/zeromq_sub_source.xml b/gr-zeromq/grc/zeromq_sub_source.xml
deleted file mode 100644
index 31e6170c6..000000000
--- a/gr-zeromq/grc/zeromq_sub_source.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>ZMQ SUB Source</name>
- <key>zeromq_sub_source</key>
- <category>[Core]/ZeroMQ Interfaces</category>
- <import>from gnuradio import zeromq</import>
- <make>zeromq.sub_source($type.itemsize, $vlen, $address, $timeout, $pass_tags, $hwm)</make>
-
- <param>
- <name>IO Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>itemsize:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>itemsize:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>itemsize:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>itemsize:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>itemsize:gr.sizeof_char</opt>
- </option>
- </param>
-
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Address</name>
- <key>address</key>
- <type>string</type>
- </param>
-
- <param>
- <name>Timeout (msec)</name>
- <key>timeout</key>
- <value>100</value>
- <type>float</type>
- </param>
-
- <param>
- <name>Pass Tags</name>
- <key>pass_tags</key>
- <value>False</value>
- <type>enum</type>
- <option>
- <name>Yes</name>
- <key>True</key>
- </option>
- <option>
- <name>No</name>
- <key>False</key>
- </option>
- </param>
-
- <param>
- <name>High Watermark</name>
- <key>hwm</key>
- <value>-1</value>
- <type>int</type>
- <hide>#if $hwm() == -1 then 'part' else 'none'#</hide>
- </param>
-
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- </source>
-
-</block>
diff --git a/gr-zeromq/python/zeromq/CMakeLists.txt b/gr-zeromq/python/zeromq/CMakeLists.txt
index 66fc65a4b..100d1028f 100644
--- a/gr-zeromq/python/zeromq/CMakeLists.txt
+++ b/gr-zeromq/python/zeromq/CMakeLists.txt
@@ -51,6 +51,6 @@ if(ENABLE_TESTING)
file(GLOB py_qa_test_files "qa_*.py")
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+ GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gr-zeromq/python/zeromq/__init__.py b/gr-zeromq/python/zeromq/__init__.py
index cab4b6764..3b3e3869b 100644
--- a/gr-zeromq/python/zeromq/__init__.py
+++ b/gr-zeromq/python/zeromq/__init__.py
@@ -22,15 +22,17 @@
'''
Blocks for interfacing with ZeroMQ endpoints.
'''
+from __future__ import absolute_import
+from __future__ import unicode_literals
import os
try:
- from zeromq_swig import *
+ from .zeromq_swig import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "..", "..", "swig"))
- from zeromq_swig import *
+ from .zeromq_swig import *
-from probe_manager import probe_manager
-from rpc_manager import rpc_manager
+from .probe_manager import probe_manager
+from .rpc_manager import rpc_manager
diff --git a/gr-zeromq/python/zeromq/probe_manager.py b/gr-zeromq/python/zeromq/probe_manager.py
index 9facb33b2..c224ca787 100644
--- a/gr-zeromq/python/zeromq/probe_manager.py
+++ b/gr-zeromq/python/zeromq/probe_manager.py
@@ -1,3 +1,4 @@
+from __future__ import unicode_literals
#
# Copyright 2013 Free Software Foundation, Inc.
#
@@ -20,10 +21,9 @@
#
import zmq
-import threading
import numpy
-class probe_manager():
+class probe_manager(object):
def __init__(self):
self.zmq_context = zmq.Context()
self.poller = zmq.Poller()
@@ -31,7 +31,7 @@ class probe_manager():
def add_socket(self, address, data_type, callback_func):
socket = self.zmq_context.socket(zmq.SUB)
- socket.setsockopt(zmq.SUBSCRIBE, "")
+ socket.setsockopt(zmq.SUBSCRIBE, b"")
socket.connect(address)
# use a tuple to store interface elements
self.interfaces.append((socket, data_type, callback_func))
diff --git a/gr-zeromq/python/zeromq/qa_zeromq_pub.py b/gr-zeromq/python/zeromq/qa_zeromq_pub.py
index cc856d57c..2cee710d2 100755..100644
--- a/gr-zeromq/python/zeromq/qa_zeromq_pub.py
+++ b/gr-zeromq/python/zeromq/qa_zeromq_pub.py
@@ -21,6 +21,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest
from gnuradio import blocks, zeromq
from gnuradio import eng_notation
@@ -37,7 +38,7 @@ class qa_zeromq_pub (gr_unittest.TestCase):
def test_001 (self):
vlen = 10
self.rx_data = None
- src_data = range(vlen)*100
+ src_data = list(range(vlen))*100
src = blocks.vector_source_f(src_data, False, vlen)
zeromq_pub_sink = zeromq.pub_sink(gr.sizeof_float, vlen, "tcp://127.0.0.1:5555")
self.tb.connect(src, zeromq_pub_sink)
diff --git a/gr-zeromq/python/zeromq/qa_zeromq_pubsub.py b/gr-zeromq/python/zeromq/qa_zeromq_pubsub.py
index bb853d892..21c96a371 100755..100644
--- a/gr-zeromq/python/zeromq/qa_zeromq_pubsub.py
+++ b/gr-zeromq/python/zeromq/qa_zeromq_pubsub.py
@@ -21,6 +21,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest
from gnuradio import blocks, zeromq
import time
@@ -37,7 +38,7 @@ class qa_zeromq_pubsub (gr_unittest.TestCase):
def test_001 (self):
vlen = 10
- src_data = range(vlen)*100
+ src_data = list(range(vlen))*100
src = blocks.vector_source_f(src_data, False, vlen)
zeromq_pub_sink = zeromq.pub_sink(gr.sizeof_float, vlen, "tcp://127.0.0.1:5556", 0)
zeromq_sub_source = zeromq.sub_source(gr.sizeof_float, vlen, "tcp://127.0.0.1:5556", 0)
diff --git a/gr-zeromq/python/zeromq/qa_zeromq_pushpull.py b/gr-zeromq/python/zeromq/qa_zeromq_pushpull.py
index 388f7ff9c..b4dde8b2b 100755..100644
--- a/gr-zeromq/python/zeromq/qa_zeromq_pushpull.py
+++ b/gr-zeromq/python/zeromq/qa_zeromq_pushpull.py
@@ -20,6 +20,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest, blocks, zeromq
import time
@@ -35,7 +36,7 @@ class qa_zeromq_pushpull (gr_unittest.TestCase):
def test_001 (self):
vlen = 10
- src_data = range(vlen)*100
+ src_data = list(range(vlen))*100
src = blocks.vector_source_f(src_data, False, vlen)
zeromq_push_sink = zeromq.push_sink(gr.sizeof_float, vlen, "tcp://127.0.0.1:5557")
zeromq_pull_source = zeromq.pull_source(gr.sizeof_float, vlen, "tcp://127.0.0.1:5557", 0)
diff --git a/gr-zeromq/python/zeromq/qa_zeromq_reqrep.py b/gr-zeromq/python/zeromq/qa_zeromq_reqrep.py
index a5a3d33f6..9fccbf300 100755..100644
--- a/gr-zeromq/python/zeromq/qa_zeromq_reqrep.py
+++ b/gr-zeromq/python/zeromq/qa_zeromq_reqrep.py
@@ -21,6 +21,7 @@
# Boston, MA 02110-1301, USA.
#
+
from gnuradio import gr, gr_unittest
from gnuradio import blocks, zeromq
from gnuradio import eng_notation
@@ -38,7 +39,7 @@ class qa_zeromq_reqrep (gr_unittest.TestCase):
def test_001 (self):
vlen = 10
- src_data = range(vlen)*100
+ src_data = list(range(vlen))*100
src = blocks.vector_source_f(src_data, False, vlen)
zeromq_rep_sink = zeromq.rep_sink(gr.sizeof_float, vlen, "tcp://127.0.0.1:5558", 0)
zeromq_req_source = zeromq.req_source(gr.sizeof_float, vlen, "tcp://127.0.0.1:5558", 0)
diff --git a/gr-zeromq/python/zeromq/qa_zeromq_sub.py b/gr-zeromq/python/zeromq/qa_zeromq_sub.py
index f916901ff..d6006780d 100755
--- a/gr-zeromq/python/zeromq/qa_zeromq_sub.py
+++ b/gr-zeromq/python/zeromq/qa_zeromq_sub.py
@@ -44,7 +44,7 @@ class qa_zeromq_sub (gr_unittest.TestCase):
def test_001 (self):
vlen = 10
- src_data = numpy.array(range(vlen)*100, 'float32')
+ src_data = numpy.array(range(vlen), 'float32')*100
zeromq_sub_source = zeromq.sub_source(gr.sizeof_float, vlen, "tcp://127.0.0.1:5555")
sink = blocks.vector_sink_f(vlen)
self.tb.connect(zeromq_sub_source, sink)
@@ -60,7 +60,7 @@ class qa_zeromq_sub (gr_unittest.TestCase):
vlen = 10
# Construct multipart source data to publish
- raw_data = [numpy.array(range(vlen)*100, 'float32'), numpy.array(range(vlen, 2*vlen)*100, 'float32')]
+ raw_data = [numpy.array(range(vlen), 'float32')*100, numpy.array(range(vlen, 2*vlen), 'float32')*100]
src_data = [a.tostring() for a in raw_data]
zeromq_sub_source = zeromq.sub_source(gr.sizeof_float, vlen, "tcp://127.0.0.1:5555")
sink = blocks.vector_sink_f(vlen)
diff --git a/gr-zeromq/python/zeromq/rpc_manager.py b/gr-zeromq/python/zeromq/rpc_manager.py
index 2dce997bd..f7c972b75 100644
--- a/gr-zeromq/python/zeromq/rpc_manager.py
+++ b/gr-zeromq/python/zeromq/rpc_manager.py
@@ -19,12 +19,15 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import print_function
+from __future__ import unicode_literals
+
import zmq
import pmt
import threading
-class rpc_manager():
+class rpc_manager(object):
def __init__(self):
self.zmq_context = zmq.Context()
self.poller_rep = zmq.Poller()
@@ -39,22 +42,22 @@ class rpc_manager():
def set_reply_socket(self, address):
self.rep_socket = self.zmq_context.socket(zmq.REP)
self.rep_socket.bind(address)
- print "[RPC] reply socket bound to: ", address
+ print("[RPC] reply socket bound to: ", address)
self.poller_rep.register(self.rep_socket, zmq.POLLIN)
def set_request_socket(self, address):
self.req_socket = self.zmq_context.socket(zmq.REQ)
self.req_socket.connect(address)
- print "[RPC] request socket connected to: ", address
+ print("[RPC] request socket connected to: ", address)
self.poller_req_out.register(self.req_socket, zmq.POLLOUT)
self.poller_req_in.register(self.req_socket, zmq.POLLIN)
def add_interface(self, id_str, callback_func):
- if not self.interfaces.has_key(id_str):
+ if id_str not in self.interfaces:
self.interfaces[id_str] = callback_func
- print "[RPC] added reply interface:", id_str
+ print("[RPC] added reply interface:", id_str)
else:
- print "[RPC] ERROR: duplicate id_str:", id_str
+ print("[RPC] ERROR: duplicate id_str:", id_str)
def watcher(self):
self.keep_running = True
@@ -65,7 +68,7 @@ class rpc_manager():
# receive call
msg = self.rep_socket.recv()
(id_str, args) = pmt.to_python(pmt.deserialize_str(msg))
- print "[RPC] request:", id_str, ", args:", args
+ print("[RPC] request:", id_str, ", args:", args)
reply = self.callback(id_str, args)
self.rep_socket.send(pmt.serialize_str(pmt.to_pmt(reply)))
@@ -85,11 +88,11 @@ class rpc_manager():
socks = dict(self.poller_req_in.poll(10))
if socks.get(self.req_socket) == zmq.POLLIN:
reply = pmt.to_python(pmt.deserialize_str(self.req_socket.recv()))
- print "[RPC] reply:", reply
+ print("[RPC] reply:", reply)
return reply
def callback(self, id_str, args):
- if self.interfaces.has_key(id_str):
+ if id_str in self.interfaces:
callback_func = self.interfaces.get(id_str)
if not args == None:
# use unpacking or splat operator * to unpack argument list
@@ -97,5 +100,5 @@ class rpc_manager():
else:
return(callback_func())
else:
- print "[RPC] ERROR: id_str not found:", id_str
+ print("[RPC] ERROR: id_str not found:", id_str)
return None
diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt
index eed520265..77c8d4c00 100644
--- a/grc/CMakeLists.txt
+++ b/grc/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011,2013 Free Software Foundation, Inc.
+# Copyright 2011,2013,2017 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -22,11 +22,64 @@
########################################################################
include(GrPython)
-GR_PYTHON_CHECK_MODULE("python >= 2.5" sys "sys.version.split()[0] >= '2.5'" PYTHON_MIN_VER_FOUND)
-GR_PYTHON_CHECK_MODULE("Cheetah >= 2.0.0" Cheetah "Cheetah.Version >= '2.0.0'" CHEETAH_FOUND)
-GR_PYTHON_CHECK_MODULE("lxml >= 1.3.6" lxml.etree "lxml.etree.LXML_VERSION >= (1, 3, 6, 0)" LXML_FOUND)
-GR_PYTHON_CHECK_MODULE("pygtk >= 2.10.0" gtk "gtk.pygtk_version >= (2, 10, 0)" PYGTK_FOUND)
-GR_PYTHON_CHECK_MODULE("numpy" numpy True NUMPY_FOUND)
+message(STATUS "")
+
+GR_PYTHON_CHECK_MODULE_RAW(
+ "python2 >= 2.7.6 or python3 >= 3.4.0"
+ "import sys; \
+ requirement = (3, 4, 0) if sys.version_info.major >= 3 else (2, 7, 6); \
+ assert sys.version_info[:3] >= requirement"
+ PYTHON_MIN_VER_FOUND
+)
+
+GR_PYTHON_CHECK_MODULE_RAW(
+ "PyYAML >= 3.10"
+ "import yaml; assert yaml.__version__ >= '3.11'"
+ PYYAML_FOUND
+)
+
+GR_PYTHON_CHECK_MODULE_RAW(
+ "mako >= 0.9.1"
+ "import mako; assert mako.__version__ >= '0.9.1'"
+ MAKO_FOUND
+)
+
+GR_PYTHON_CHECK_MODULE_RAW(
+ "lxml >= 1.3.6"
+ "import lxml.etree; assert lxml.etree.LXML_VERSION >= (1, 3, 6, 0)"
+ LXML_FOUND
+)
+
+GR_PYTHON_CHECK_MODULE_RAW(
+ "pygobject >= 2.28.6"
+ "import gi; assert gi.version_info >= (2, 28, 6)"
+ PYGI_FOUND
+)
+
+GR_PYTHON_CHECK_MODULE_RAW(
+ "Gtk (GI) >= 3.10.8"
+ "import gi; gi.require_version('Gtk', '3.0'); \
+ from gi.repository import Gtk; Gtk.check_version(3, 10, 8)"
+ GTK_GI_FOUND
+)
+
+GR_PYTHON_CHECK_MODULE_RAW(
+ "Cairo (GI) >= 1.0"
+ "import gi; gi.require_foreign('cairo', 'Context')" # Cairo 1.13.0
+ CAIRO_GI_FOUND
+)
+
+GR_PYTHON_CHECK_MODULE_RAW(
+ "PangoCairo (GI) >= 1.0"
+ "import gi; gi.require_version('PangoCairo', '1.0')" # pangocairo 1.36.3
+ PANGOCAIRO_GI_FOUND
+)
+
+GR_PYTHON_CHECK_MODULE_RAW(
+ "numpy"
+ "import numpy"
+ NUMPY_FOUND
+)
########################################################################
# Register component
@@ -35,9 +88,13 @@ include(GrComponent)
if(NOT CMAKE_CROSSCOMPILING)
set(grc_python_deps
PYTHON_MIN_VER_FOUND
- CHEETAH_FOUND
+ PYYAML_FOUND
+ MAKO_FOUND
LXML_FOUND
- PYGTK_FOUND
+ PYGI_FOUND
+ GTK_GI_FOUND
+ CAIRO_GI_FOUND
+ PANGOCAIRO_GI_FOUND
NUMPY_FOUND
)
endif(NOT CMAKE_CROSSCOMPILING)
@@ -48,9 +105,6 @@ GR_REGISTER_COMPONENT("gnuradio-companion" ENABLE_GRC
${grc_python_deps}
)
-########################################################################
-# Begin conditional configuration
-########################################################################
if(ENABLE_GRC)
########################################################################
@@ -85,15 +139,23 @@ install(
DESTINATION ${GR_PREFSDIR}
)
+########################################################################
+# Install (+ compile) python sources and data files
+########################################################################
file(GLOB py_files "*.py")
-
GR_PYTHON_INSTALL(
FILES ${py_files}
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc
+ DESTINATION "${GR_PYTHON_DIR}/gnuradio/grc"
+)
+
+GR_PYTHON_INSTALL(
+ DIRECTORY core gui converter
+ DESTINATION "${GR_PYTHON_DIR}/gnuradio/grc"
+ FILES_MATCHING REGEX "\\.(py|dtd|grc|tmpl|png|mako)$"
)
########################################################################
-# Appens NSIS commands to set environment variables
+# Append NSIS commands to set environment variables
########################################################################
if(WIN32)
@@ -112,8 +174,6 @@ endif(WIN32)
# Add subdirectories
########################################################################
add_subdirectory(blocks)
-add_subdirectory(gui)
-add_subdirectory(core)
add_subdirectory(scripts)
endif(ENABLE_GRC)
diff --git a/grc/blocks/CMakeLists.txt b/grc/blocks/CMakeLists.txt
index d46b1febb..f5ec6dd21 100644
--- a/grc/blocks/CMakeLists.txt
+++ b/grc/blocks/CMakeLists.txt
@@ -20,40 +20,40 @@
########################################################################
include(GrPython)
-file(GLOB xml_files "*.xml")
+file(GLOB yml_files "*.yml")
-macro(REPLACE_IN_FILE _xml_block match replace)
- set(xml_block_src "${CMAKE_CURRENT_SOURCE_DIR}/${_xml_block}")
- set(xml_block "${CMAKE_CURRENT_BINARY_DIR}/${_xml_block}")
+macro(REPLACE_IN_FILE _yml_block match replace)
+ set(yml_block_src "${CMAKE_CURRENT_SOURCE_DIR}/${_yml_block}")
+ set(yml_block "${CMAKE_CURRENT_BINARY_DIR}/${_yml_block}")
- list(REMOVE_ITEM xml_files "${xml_block_src}")
- file(READ "${xml_block_src}" xml_block_src_text)
+ list(REMOVE_ITEM yml_files "${yml_block_src}")
+ file(READ "${yml_block_src}" yml_block_src_text)
string(REPLACE "${match}" "${replace}"
- xml_block_text "${xml_block_src_text}")
- file(WRITE "${xml_block}" "${xml_block_text}")
+ yml_block_text "${yml_block_src_text}")
+ file(WRITE "${yml_block}" "${yml_block_text}")
- list(APPEND generated_xml_files "${xml_block}")
+ list(APPEND generated_yml_files "${yml_block}")
endmacro()
-macro(GEN_BLOCK_XML _generator _xml_block)
+macro(GEN_BLOCK_YML _generator _yml_block)
set(generator ${CMAKE_CURRENT_SOURCE_DIR}/${_generator})
- set(xml_block ${CMAKE_CURRENT_BINARY_DIR}/${_xml_block})
- list(APPEND generated_xml_files ${xml_block})
+ set(yml_block ${CMAKE_CURRENT_BINARY_DIR}/${_yml_block})
+ list(APPEND generated_yml_files ${yml_block})
add_custom_command(
- DEPENDS ${generator} OUTPUT ${xml_block}
- COMMAND ${PYTHON_EXECUTABLE} ${generator} ${xml_block}
+ DEPENDS ${generator} OUTPUT ${yml_block}
+ COMMAND ${PYTHON_EXECUTABLE} ${generator} ${yml_block}
)
endmacro()
-GEN_BLOCK_XML(variable_struct.xml.py variable_struct.xml)
+GEN_BLOCK_YML(variable_struct.block.yml.py variable_struct.block.yml)
if(DESIRED_QT_VERSION EQUAL 4)
- REPLACE_IN_FILE(options.xml PyQt5 PyQt4)
+ REPLACE_IN_FILE(options.yml PyQt5 PyQt4)
endif()
-add_custom_target(grc_generated_xml ALL DEPENDS ${generated_xml_files})
+add_custom_target(grc_generated_yml ALL DEPENDS ${generated_yml_files})
install(
- FILES ${xml_files} ${generated_xml_files}
+ FILES ${yml_files} ${generated_yml_files}
DESTINATION ${GRC_BLOCKS_DIR}
)
diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml
deleted file mode 100644
index 3125864d4..000000000
--- a/grc/blocks/block_tree.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<cat>
- <name>[Core]</name>
- <cat>
- <name>Misc</name>
- <block>pad_source</block>
- <block>pad_sink</block>
- <block>virtual_source</block>
- <block>virtual_sink</block>
-
- <block>bus_sink</block>
- <block>bus_source</block>
- <block>bus_structure_sink</block>
- <block>bus_structure_source</block>
-
- <block>epy_block</block>
- <block>epy_module</block>
-
- <block>note</block>
- <block>import</block>
- </cat>
- <cat>
- <name>Variables</name>
- <block>variable</block>
- <block>variable_struct</block>
- <block>variable_config</block>
- <block>variable_function_probe</block>
- <block>parameter</block>
- </cat>
-</cat>
diff --git a/grc/blocks/bus_sink.xml b/grc/blocks/bus_sink.xml
deleted file mode 100644
index 029820dc2..000000000
--- a/grc/blocks/bus_sink.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Bus Sink
-###################################################
- -->
-<block>
- <name>Bus Sink</name>
- <key>bus_sink</key>
- <make>$yesno.yesno</make>
-
- <param>
- <name>On/Off</name>
- <key>yesno</key>
- <type>enum</type>
- <option>
- <name>On</name>
- <key>on</key>
- <opt>yesno:True</opt>
- </option>
- <option>
- <name>Off</name>
- <key>off</key>
- <opt>yesno:False</opt>
- </option>
- </param>
-</block>
diff --git a/grc/blocks/bus_source.xml b/grc/blocks/bus_source.xml
deleted file mode 100644
index e5b5c2b9b..000000000
--- a/grc/blocks/bus_source.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Bus Sink
-###################################################
- -->
-<block>
- <name>Bus Source</name>
- <key>bus_source</key>
- <make>$yesno.yesno</make>
-
- <param>
- <name>On/Off</name>
- <key>yesno</key>
- <type>enum</type>
- <option>
- <name>On</name>
- <key>on</key>
- <opt>yesno:True</opt>
- </option>
- <option>
- <name>Off</name>
- <key>off</key>
- <opt>yesno:False</opt>
- </option>
- </param>
-</block>
diff --git a/grc/blocks/bus_structure_sink.xml b/grc/blocks/bus_structure_sink.xml
deleted file mode 100644
index 3adac9281..000000000
--- a/grc/blocks/bus_structure_sink.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Bus Sink
-###################################################
- -->
-<block>
- <name>Bus Sink Structure</name>
- <key>bus_structure_sink</key>
- <make>None</make>
-
- <param>
- <name>Structure</name>
- <key>struct</key>
- <value></value>
- <type>raw</type>
- </param>
-</block>
diff --git a/grc/blocks/bus_structure_source.xml b/grc/blocks/bus_structure_source.xml
deleted file mode 100644
index 34e7c049a..000000000
--- a/grc/blocks/bus_structure_source.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Bus Sink
-###################################################
- -->
-<block>
- <name>Bus Source Structure</name>
- <key>bus_structure_source</key>
- <make>None</make>
-
- <param>
- <name>Structure</name>
- <key>struct</key>
- <value></value>
- <type>raw</type>
- </param>
-</block>
diff --git a/grc/blocks/dummy.xml b/grc/blocks/dummy.xml
deleted file mode 100644
index c0ca3b669..000000000
--- a/grc/blocks/dummy.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Dummy Block
-###################################################
--->
-<block>
- <name>Missing Block</name>
- <key>dummy_block</key>
- <make>raise NotImplementedError()</make>
-</block>
diff --git a/grc/blocks/epy_block.xml b/grc/blocks/epy_block.xml
deleted file mode 100644
index 65e78c406..000000000
--- a/grc/blocks/epy_block.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>Python Block</name>
- <key>epy_block</key>
- <import></import>
- <make></make>
- <param><!-- Cache the last working block IO to keep FG sane -->
- <name>Block Io</name>
- <key>_io_cache</key>
- <type>string</type>
- <hide>all</hide>
- </param>
- <param>
- <name>Code</name>
- <key>_source_code</key>
- <value>"""
-Embedded Python Blocks:
-
-Each time this file is saved, GRC will instantiate the first class it finds
-to get ports and parameters of your block. The arguments to __init__ will
-be the parameters. All of them are required to have default values!
-"""
-
-import numpy as np
-from gnuradio import gr
-
-
-class blk(gr.sync_block): # other base classes are basic_block, decim_block, interp_block
- """Embedded Python Block example - a simple multiply const"""
-
- def __init__(self, example_param=1.0): # only default arguments here
- """arguments to this function show up as parameters in GRC"""
- gr.sync_block.__init__(
- self,
- name='Embedded Python Block', # will show up in GRC
- in_sig=[np.complex64],
- out_sig=[np.complex64]
- )
- # if an attribute with the same name as a parameter is found,
- # a callback is registered (properties work, too).
- self.example_param = example_param
-
- def work(self, input_items, output_items):
- """example: multiply with constant"""
- output_items[0][:] = input_items[0] * self.example_param
- return len(output_items[0])
-</value>
- <type>_multiline_python_external</type>
- <hide>part</hide>
- </param>
- <doc>This block represents an arbitrary GNU Radio Python Block.
-
-Its source code can be accessed through the parameter 'Code' which opens your editor. Each time you save changes in the editor, GRC will update the block. This includes the number, names and defaults of the parameters, the ports (stream and message) and the block name and documentation.
-
-Block Documentation:
-(will be replaced the docstring of your block class)
-</doc>
-</block>
diff --git a/grc/blocks/epy_module.xml b/grc/blocks/epy_module.xml
deleted file mode 100644
index fa3e5f91f..000000000
--- a/grc/blocks/epy_module.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<block>
- <name>Python Module</name>
- <key>epy_module</key>
- <import>import $id # embedded python module</import>
- <make></make>
- <param>
- <name>Code</name>
- <key>source_code</key>
- <value># this module will be imported in the into your flowgraph</value>
- <type>_multiline_python_external</type>
- <hide>part</hide>
- </param>
- <doc>This block lets you embed a python module in your flowgraph.
-
-Code you put in this module is accessible in other blocks using the ID of this
-block. Example:
-
-If you put
-
- a = 2
-
- def double(arg):
- return 2 * arg
-
-in a Python Module Block with the ID 'stuff' you can use code like
-
- stuff.a # evals to 2
- stuff.double(3) # evals to 6
-
-to set parameters of other blocks in your flowgraph.</doc>
-</block>
diff --git a/grc/blocks/gr_message_domain.xml b/grc/blocks/gr_message_domain.xml
deleted file mode 100644
index bc8add99a..000000000
--- a/grc/blocks/gr_message_domain.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##GNU Radio default domain 'gr_message'
-###################################################
- -->
- <domain>
- <name>GR Message</name>
- <key>gr_message</key>
- <color>#000</color>
- <multiple_sources>True</multiple_sources>
- <connection>
- <source_domain>gr_message</source_domain>
- <sink_domain>gr_message</sink_domain>
- <make>#slurp
- self.msg_connect($make_port_sig($source), $make_port_sig($sink))#slurp
- </make>
- </connection>
-</domain>
diff --git a/grc/blocks/gr_stream_domain.xml b/grc/blocks/gr_stream_domain.xml
deleted file mode 100644
index 66026448c..000000000
--- a/grc/blocks/gr_stream_domain.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##GNU Radio default domain 'gr_stream'
-###################################################
- -->
- <domain>
- <name>GR Stream</name>
- <key>gr_stream</key>
- <color>#000</color>
- <connection>
- <source_domain>gr_stream</source_domain>
- <sink_domain>gr_stream</sink_domain>
- <make>#slurp
- self.connect($make_port_sig($source), $make_port_sig($sink))#slurp
- </make>
- </connection>
-</domain>
diff --git a/grc/blocks/grc.tree.yml b/grc/blocks/grc.tree.yml
new file mode 100644
index 000000000..c84a6dc47
--- /dev/null
+++ b/grc/blocks/grc.tree.yml
@@ -0,0 +1,15 @@
+'[Core]':
+- Misc:
+ - pad_source
+ - pad_sink
+ - virtual_source
+ - virtual_sink
+ - epy_module
+ - note
+ - import
+- Variables:
+ - variable
+ - variable_struct
+ - variable_config
+ - variable_function_probe
+ - parameter
diff --git a/grc/blocks/import.block.yml b/grc/blocks/import.block.yml
new file mode 100644
index 000000000..2d36b7396
--- /dev/null
+++ b/grc/blocks/import.block.yml
@@ -0,0 +1,20 @@
+id: import_
+label: Import
+
+parameters:
+- id: imports
+ label: Import
+ dtype: import
+
+templates:
+ imports: ${imports}
+
+documentation: |-
+ Import additional python modules into the namespace.
+
+ Examples:
+ from gnuradio.filter import firdes
+ import math,cmath
+ from math import pi
+
+file_format: 1
diff --git a/grc/blocks/import.xml b/grc/blocks/import.xml
deleted file mode 100644
index 59f807bac..000000000
--- a/grc/blocks/import.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Import python modules into the namespace
-###################################################
- -->
-<block>
- <name>Import</name>
- <key>import</key>
- <import>$import</import>
- <make></make>
- <param>
- <name>Import</name>
- <key>import</key>
- <value></value>
- <type>import</type>
- </param>
- <doc>
-Import additional python modules into the namespace.
-
-Examples:
-from gnuradio.filter import firdes
-import math,cmath
-from math import pi
- </doc>
-</block>
diff --git a/grc/blocks/message.domain.yml b/grc/blocks/message.domain.yml
new file mode 100644
index 000000000..7e6cc529d
--- /dev/null
+++ b/grc/blocks/message.domain.yml
@@ -0,0 +1,10 @@
+id: message
+label: Message
+color: "#FFFFFF"
+
+multiple_connections_per_input: true
+multiple_connections_per_output: true
+
+templates:
+- type: [message, message]
+ connect: self.msg_connect(${ make_port_sig(source) }, ${ make_port_sig(sink) })
diff --git a/grc/blocks/note.block.yml b/grc/blocks/note.block.yml
new file mode 100644
index 000000000..3f21a75ce
--- /dev/null
+++ b/grc/blocks/note.block.yml
@@ -0,0 +1,9 @@
+id: note
+label: Note
+
+parameters:
+- id: note
+ label: Note
+ dtype: string
+
+file_format: 1
diff --git a/grc/blocks/note.xml b/grc/blocks/note.xml
deleted file mode 100644
index db6687c03..000000000
--- a/grc/blocks/note.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Note Block (dummy)
-###################################################
- -->
-<block>
- <name>Note</name>
- <key>note</key>
- <make></make>
- <param>
- <name>Note</name>
- <key>note</key>
- <value></value>
- <type>string</type>
- </param>
-</block>
diff --git a/grc/blocks/options.block.yml b/grc/blocks/options.block.yml
new file mode 100644
index 000000000..ab18f8ae5
--- /dev/null
+++ b/grc/blocks/options.block.yml
@@ -0,0 +1,146 @@
+id: options
+label: Options
+
+parameters:
+- id: title
+ label: Title
+ dtype: string
+ hide: ${ ('none' if title else 'part') }
+- id: author
+ label: Author
+ dtype: string
+ hide: ${ ('none' if author else 'part') }
+- id: description
+ label: Description
+ dtype: string
+ hide: ${ ('none' if description else 'part') }
+- id: window_size
+ label: Canvas Size
+ dtype: int_vector
+ hide: part
+- id: generate_options
+ label: Generate Options
+ dtype: enum
+ default: qt_gui
+ options: [qt_gui, bokeh_gui, no_gui, hb, hb_qt_gui]
+ option_labels: [QT GUI, Bokeh GUI, No GUI, Hier Block, Hier Block (QT GUI)]
+- id: category
+ label: Category
+ dtype: string
+ default: '[GRC Hier Blocks]'
+ hide: ${ ('none' if generate_options.startswith('hb') else 'all') }
+- id: run_options
+ label: Run Options
+ dtype: enum
+ default: prompt
+ options: [run, prompt]
+ option_labels: [Run to Completion, Prompt for Exit]
+ hide: ${ ('none' if generate_options == 'no_gui' else 'all') }
+- id: placement
+ label: Widget Placement
+ dtype: int_vector
+ default: (0,0)
+ hide: ${ ('part' if generate_options == 'bokeh_gui' else 'all') }
+- id: sizing_mode
+ label: Sizing Mode
+ dtype: enum
+ default: fixed
+ options: [fixed, stretch_both, scale_width, scale_height, scale_both]
+ option_labels: [Fixed, Stretch Both, Scale Width, Scale Height, Scale Both]
+ hide: ${ ('part' if generate_options == 'bokeh_gui' else 'all') }
+- id: run
+ label: Run
+ dtype: bool
+ default: 'True'
+ options: ['True', 'False']
+ option_labels: [Autostart, 'Off']
+ hide: ${ ('all' if generate_options not in ('qt_gui', 'bokeh_gui') else ('part'
+ if run else 'none')) }
+- id: max_nouts
+ label: Max Number of Output
+ dtype: int
+ default: '0'
+ hide: ${ ('all' if generate_options.startswith('hb') else ('none' if max_nouts
+ else 'part')) }
+- id: realtime_scheduling
+ label: Realtime Scheduling
+ dtype: enum
+ options: ['', '1']
+ option_labels: ['Off', 'On']
+ hide: ${ ('all' if generate_options.startswith('hb') else ('none' if realtime_scheduling
+ else 'part')) }
+- id: qt_qss_theme
+ label: QSS Theme
+ dtype: file_open
+ hide: ${ ('all' if generate_options != 'qt_gui' else ('none' if qt_qss_theme else
+ 'part')) }
+- id: thread_safe_setters
+ label: Thread-safe setters
+ category: Advanced
+ dtype: enum
+ options: ['', '1']
+ option_labels: ['Off', 'On']
+ hide: part
+- id: run_command
+ label: Run Command
+ category: Advanced
+ dtype: string
+ default: '{python} -u {filename}'
+ hide: ${ ('all' if generate_options.startswith('hb') else 'part') }
+- id: hier_block_src_path
+ label: Hier Block Source Path
+ category: Advanced
+ dtype: string
+ default: '.:'
+ hide: part
+
+asserts:
+- ${ not window_size or len(window_size) == 2 }
+- ${ not window_size or 300 <= window_size[0] <= 4096 }
+- ${ not window_size or 300 <= window_size[1] <= 4096 }
+- ${ len(placement) == 4 or len(placement) == 2 }
+- ${ all(i >= 0 for i in placement) }
+
+templates:
+ imports: |-
+ from gnuradio import gr
+ from gnuradio.filter import firdes
+ % if generate_options == 'qt_gui':
+ from PyQt5 import Qt
+ import sys
+ % endif
+ % if generate_options == 'bokeh_gui':
+ import time
+ import signal
+ import functools
+ from bokeh.client import push_session
+ from bokeh.plotting import curdoc
+ % endif
+ % if not generate_options.startswith('hb'):
+ from argparse import ArgumentParser
+ from gnuradio.eng_arg import eng_float, intx
+ from gnuradio import eng_notation
+ % endif
+ callbacks:
+ - 'if ${run}: self.start()
+
+ else: self.stop(); self.wait()'
+
+documentation: |-
+ The options block sets special parameters for the flow graph. Only one option block is allowed per flow graph.
+
+ Title, author, and description parameters are for identification purposes.
+
+ The window size controls the dimensions of the flow graph editor. The window size (width, height) must be between (300, 300) and (4096, 4096).
+
+ The generate options controls the type of code generated. Non-graphical flow graphs should avoid using graphical sinks or graphical variable controls.
+
+ In a graphical application, run can be controlled by a variable to start and stop the flowgraph at runtime.
+
+ The id of this block determines the name of the generated file and the name of the class. For example, an id of my_block will generate the file my_block.py and class my_block(gr....
+
+ The category parameter determines the placement of the block in the block selection window. The category only applies when creating hier blocks. To put hier blocks into the root category, enter / for the category.
+
+ The Max Number of Output is the maximum number of output items allowed for any block in the flowgraph; to disable this set the max_nouts equal to 0.Use this to adjust the maximum latency a flowgraph can exhibit.
+
+file_format: 1
diff --git a/grc/blocks/options.xml b/grc/blocks/options.xml
deleted file mode 100644
index bff88cec8..000000000
--- a/grc/blocks/options.xml
+++ /dev/null
@@ -1,250 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Options Block:
-## options for window size,
-## and flow graph building.
-###################################################
- -->
-<block>
- <name>Options</name>
- <key>options</key>
- <import>from gnuradio import gr</import>
- <import>from gnuradio.filter import firdes</import>
- <import>#if $generate_options() == 'qt_gui'
-from PyQt5 import Qt
-import sys
-#end if
-#if $generate_options() == 'bokeh_gui'
-import time
-import signal
-import functools
-from bokeh.client import push_session
-from bokeh.plotting import curdoc
-#end if
-#if not $generate_options().startswith('hb')
-from argparse import ArgumentParser
-from gnuradio.eng_arg import eng_float, intx
-from gnuradio import eng_notation
-#end if</import>
- <make></make>
- <callback>if $run: self.start()
-else: self.stop(); self.wait()</callback>
- <param>
- <name>Title</name>
- <key>title</key>
- <value></value>
- <type>string</type>
- <hide>#if $title() then 'none' else 'part'#</hide>
- </param>
- <param>
- <name>Author</name>
- <key>author</key>
- <value></value>
- <type>string</type>
- <hide>#if $author() then 'none' else 'part'#</hide>
- </param>
- <param>
- <name>Description</name>
- <key>description</key>
- <value></value>
- <type>string</type>
- <hide>#if $description() then 'none' else 'part'#</hide>
- </param>
- <param>
- <name>Canvas Size</name>
- <key>window_size</key>
- <value></value>
- <type>int_vector</type>
- <hide>part</hide>
- </param>
- <param>
- <name>Generate Options</name>
- <key>generate_options</key>
- <value>qt_gui</value>
- <type>enum</type>
- <option>
- <name>Bokeh GUI</name>
- <key>bokeh_gui</key>
- </option>
- <option>
- <name>QT GUI</name>
- <key>qt_gui</key>
- </option>
- <option>
- <name>No GUI</name>
- <key>no_gui</key>
- </option>
- <option>
- <name>Hier Block</name>
- <key>hb</key>
- </option>
- <option>
- <name>Hier Block (QT GUI)</name>
- <key>hb_qt_gui</key>
- </option>
- </param>
- <param>
- <name>Category</name>
- <key>category</key>
- <value>[GRC Hier Blocks]</value>
- <type>string</type>
- <hide>#if $generate_options().startswith('hb') then 'none' else 'all'#</hide>
- </param>
- <param>
- <name>Run Options</name>
- <key>run_options</key>
- <value>prompt</value>
- <type>enum</type>
- <hide>#if $generate_options() == 'no_gui' then 'none' else 'all'#</hide>
- <option>
- <name>Run to Completion</name>
- <key>run</key>
- </option>
- <option>
- <name>Prompt for Exit</name>
- <key>prompt</key>
- </option>
- </param>
- <param>
- <name>Widget Placement</name>
- <key>placement</key>
- <value>(0,0)</value>
- <type>int_vector</type>
- <hide>#if $generate_options() == 'bokeh_gui' then 'part' else 'all'#</hide>
- </param>
- <param>
- <name>Sizing Mode</name>
- <key>sizing_mode</key>
- <value>fixed</value>
- <type>enum</type>
- <hide>#if $generate_options() == 'bokeh_gui' then 'part' else 'all'#</hide>
- <option>
- <name>Fixed</name>
- <key>fixed</key>
- </option>
- <option>
- <name>Stretch Both</name>
- <key>stretch_both</key>
- </option>
- <option>
- <name>Scale Width</name>
- <key>scale_width</key>
- </option>
- <option>
- <name>Scale Height</name>
- <key>scale_height</key>
- </option>
- <option>
- <name>Scale Both</name>
- <key>scale_both</key>
- </option>
- </param>
- <param>
- <name>Run</name>
- <key>run</key>
- <value>True</value>
- <type>bool</type>
- <hide>#if $generate_options() in ('qt_gui', 'bokeh_gui') then ('part' if $run() else 'none') else 'all'#</hide>
- <option>
- <name>Autostart</name>
- <key>True</key>
- </option>
- <option>
- <name>Off</name>
- <key>False</key>
- </option>
- </param>
- <param>
- <name>Max Number of Output</name>
- <key>max_nouts</key>
- <value>0</value>
- <type>int</type>
- <hide>#if $generate_options().startswith('hb') then 'all' else ('none' if $max_nouts() else 'part')#</hide>
- </param>
- <param>
- <name>Realtime Scheduling</name>
- <key>realtime_scheduling</key>
- <value></value>
- <type>enum</type>
- <hide>#if $generate_options().startswith('hb') then 'all' else ('none' if $realtime_scheduling() else 'part')#</hide>
- <option>
- <name>Off</name>
- <key></key>
- </option>
- <option>
- <name>On</name>
- <key>1</key>
- </option>
- </param>
- <param>
- <name>QSS Theme</name>
- <key>qt_qss_theme</key>
- <value></value>
- <type>file_open</type>
- <hide>#if $generate_options() == 'qt_gui' then ('none' if $qt_qss_theme() else 'part') else 'all'#</hide>
- </param>
- <param>
- <name>Thread-safe setters</name>
- <key>thread_safe_setters</key>
- <value></value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Off</name>
- <key></key>
- </option>
- <option>
- <name>On</name>
- <key>1</key>
- </option>
- <tab>Advanced</tab>
- </param>
- <param>
- <name>Run Command</name>
- <key>run_command</key>
- <value>{python} -u {filename}</value>
- <type>string</type>
- <hide>#if $generate_options().startswith('hb') then 'all' else 'part'</hide>
- <tab>Advanced</tab>
- </param>
- <param>
- <name>Hier Block Source Path</name>
- <key>hier_block_src_path</key>
- <value>.:</value>
- <type>string</type>
- <hide>part</hide>
- <tab>Advanced</tab>
- </param>
- <check>not $window_size or len($window_size) == 2</check>
- <check>not $window_size or 300 &lt;= $(window_size)[0] &lt;= 4096</check>
- <check>not $window_size or 300 &lt;= $(window_size)[1] &lt;= 4096</check>
- <check>len($placement) == 4 or len($placement) == 2</check>
- <check>all(i &gt;= 0 for i in $(placement))</check>
- <doc>
-The options block sets special parameters for the flow graph. \
-Only one option block is allowed per flow graph.
-
-Title, author, and description parameters are for identification purposes.
-
-The window size controls the dimensions of the flow graph editor. \
-The window size (width, height) must be between (300, 300) and (4096, 4096).
-
-The generate options controls the type of code generated. \
-Non-graphical flow graphs should avoid using graphical sinks or graphical variable controls.
-
-In a graphical application, \
-run can be controlled by a variable to start and stop the flowgraph at runtime.
-
-The id of this block determines the name of the generated file and the name of the class. \
-For example, an id of my_block will generate the file my_block.py and class my_block(gr....
-
-The category parameter determines the placement of the block in the block selection window. \
-The category only applies when creating hier blocks. \
-To put hier blocks into the root category, enter / for the category.
-
-The Max Number of Output is the maximum number of output items allowed for any block \
-in the flowgraph; to disable this set the max_nouts equal to 0.\
-Use this to adjust the maximum latency a flowgraph can exhibit.
- </doc>
-</block>
diff --git a/grc/blocks/pad_sink.block.yml b/grc/blocks/pad_sink.block.yml
new file mode 100644
index 000000000..d304a998b
--- /dev/null
+++ b/grc/blocks/pad_sink.block.yml
@@ -0,0 +1,51 @@
+id: pad_sink
+label: Pad Sink
+
+parameters:
+- id: label
+ label: Label
+ dtype: string
+ default: out
+- id: type
+ label: Input Type
+ dtype: enum
+ options: [complex, float, int, short, byte, bit, message, '']
+ option_labels: [Complex, Float, Int, Short, Byte, Bits, Message, Wildcard]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char, gr.sizeof_char, '0', '0']
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: num_streams
+ label: Num Streams
+ dtype: int
+ default: '1'
+ hide: part
+- id: optional
+ label: Optional
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: [Optional, Required]
+ hide: part
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_streams }
+
+asserts:
+- ${ vlen > 0 }
+- ${ num_streams > 0 }
+
+documentation: |-
+ The inputs of this block will become the outputs to this flow graph when it is instantiated as a hierarchical block.
+
+ Pad sink will be ordered alphabetically by their ids. The first pad sink will have an index of 0.
+
+file_format: 1
diff --git a/grc/blocks/pad_sink.xml b/grc/blocks/pad_sink.xml
deleted file mode 100644
index 8ea8871d2..000000000
--- a/grc/blocks/pad_sink.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Pad Sink: IO Pads
-###################################################
- -->
-<block>
- <name>Pad Sink</name>
- <key>pad_sink</key>
- <make></make>
- <param>
- <name>Label</name>
- <key>label</key>
- <value>out</value>
- <type>string</type>
- </param>
- <param>
- <name>Input Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- <option>
- <name>Bits</name>
- <key>bit</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- <option>
- <name>Message</name>
- <key>message</key>
- <opt>size:0</opt>
- </option>
- <option>
- <name>Wildcard</name>
- <key></key>
- <opt>size:0</opt>
- </option>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Num Streams</name>
- <key>num_streams</key>
- <value>1</value>
- <type>int</type>
- </param>
- <param>
- <name>Optional</name>
- <key>optional</key>
- <value>False</value>
- <type>bool</type>
- <hide>part</hide>
- <option>
- <name>Optional</name>
- <key>True</key>
- </option>
- <option>
- <name>Required</name>
- <key>False</key>
- </option>
- </param>
- <check>$vlen &gt; 0</check>
- <check>$num_streams &gt; 0</check>
- <sink>
- <name>in</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_streams</nports>
- </sink>
- <doc>
-The inputs of this block will become the outputs to this flow graph when it is instantiated as a hierarchical block.
-
-Pad sink will be ordered alphabetically by their ids. The first pad sink will have an index of 0.
- </doc>
-</block>
diff --git a/grc/blocks/pad_source.block.yml b/grc/blocks/pad_source.block.yml
new file mode 100644
index 000000000..92f7a8b82
--- /dev/null
+++ b/grc/blocks/pad_source.block.yml
@@ -0,0 +1,51 @@
+id: pad_source
+label: Pad Source
+
+parameters:
+- id: label
+ label: Label
+ dtype: string
+ default: in
+- id: type
+ label: Output Type
+ dtype: enum
+ options: [complex, float, int, short, byte, bit, message, '']
+ option_labels: [Complex, Float, Int, Short, Byte, Bits, Message, Wildcard]
+ option_attributes:
+ size: [gr.sizeof_gr_complex, gr.sizeof_float, gr.sizeof_int, gr.sizeof_short,
+ gr.sizeof_char, gr.sizeof_char, '0', '0']
+ hide: part
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: num_streams
+ label: Num Streams
+ dtype: int
+ default: '1'
+ hide: part
+- id: optional
+ label: Optional
+ dtype: bool
+ default: 'False'
+ options: ['True', 'False']
+ option_labels: [Optional, Required]
+ hide: part
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+ vlen: ${ vlen }
+ multiplicity: ${ num_streams }
+
+asserts:
+- ${ vlen > 0 }
+- ${ num_streams > 0 }
+
+documentation: |-
+ The outputs of this block will become the inputs to this flow graph when it is instantiated as a hierarchical block.
+
+ Pad sources will be ordered alphabetically by their ids. The first pad source will have an index of 0.
+
+file_format: 1
diff --git a/grc/blocks/pad_source.xml b/grc/blocks/pad_source.xml
deleted file mode 100644
index 3d8ccbed6..000000000
--- a/grc/blocks/pad_source.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Pad Source: IO Pads
-###################################################
- -->
-<block>
- <name>Pad Source</name>
- <key>pad_source</key>
- <make></make>
- <param>
- <name>Label</name>
- <key>label</key>
- <value>in</value>
- <type>string</type>
- </param>
- <param>
- <name>Output Type</name>
- <key>type</key>
- <type>enum</type>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>size:gr.sizeof_gr_complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>float</key>
- <opt>size:gr.sizeof_float</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>size:gr.sizeof_int</opt>
- </option>
- <option>
- <name>Short</name>
- <key>short</key>
- <opt>size:gr.sizeof_short</opt>
- </option>
- <option>
- <name>Byte</name>
- <key>byte</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- <option>
- <name>Bits</name>
- <key>bit</key>
- <opt>size:gr.sizeof_char</opt>
- </option>
- <option>
- <name>Message</name>
- <key>message</key>
- <opt>size:0</opt>
- </option>
- <option>
- <name>Wildcard</name>
- <key></key>
- <opt>size:0</opt>
- </option>
- </param>
- <param>
- <name>Vec Length</name>
- <key>vlen</key>
- <value>1</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Num Streams</name>
- <key>num_streams</key>
- <value>1</value>
- <type>int</type>
- </param>
-
- <param>
- <name>Optional</name>
- <key>optional</key>
- <value>False</value>
- <type>bool</type>
- <hide>part</hide>
- <option>
- <name>Optional</name>
- <key>True</key>
- </option>
- <option>
- <name>Required</name>
- <key>False</key>
- </option>
- </param>
- <check>$vlen &gt; 0</check>
- <check>$num_streams &gt; 0</check>
- <source>
- <name>out</name>
- <type>$type</type>
- <vlen>$vlen</vlen>
- <nports>$num_streams</nports>
- </source>
- <doc>
-The outputs of this block will become the inputs to this flow graph when it is instantiated as a hierarchical block.
-
-Pad sources will be ordered alphabetically by their ids. The first pad source will have an index of 0.
- </doc>
-</block>
diff --git a/grc/blocks/parameter.block.yml b/grc/blocks/parameter.block.yml
new file mode 100644
index 000000000..387cbbf18
--- /dev/null
+++ b/grc/blocks/parameter.block.yml
@@ -0,0 +1,55 @@
+id: parameter
+label: Parameter
+
+parameters:
+- id: label
+ label: Label
+ dtype: string
+ hide: ${ ('none' if label else 'part') }
+- id: value
+ label: Value
+ dtype: ${ type.type }
+ default: '0'
+- id: type
+ label: Type
+ dtype: enum
+ options: ['', complex, eng_float, intx, long, str]
+ option_labels: [None, Complex, Float, Int, Long, String]
+ option_attributes:
+ type: [raw, complex, real, int, int, string]
+ hide: ${ ('none' if type else 'part') }
+- id: short_id
+ label: Short ID
+ dtype: string
+ hide: ${ 'all' if not type else ('none' if short_id else 'part') }
+- id: hide
+ label: Show
+ dtype: enum
+ options: [none, part]
+ option_labels: [Always, Only in Properties]
+ hide: part
+
+asserts:
+- ${ len(short_id) in (0, 1) }
+- ${ short_id == '' or short_id.isalpha() }
+
+templates:
+ var_make: self.${id} = ${id}
+ make: ${value}
+
+documentation: |-
+ This block represents a parameter to the flow graph. A parameter can be used to pass command line arguments into a top block. Or, parameters can pass arguments into an instantiated hierarchical block.
+
+ The parameter value cannot depend on any variables.
+
+ Leave the label blank to use the parameter id as the label.
+
+ When type is not None, this parameter also becomes a command line option of the form:
+
+ -[short_id] --[id] [value]
+
+ The Short ID field may be left blank.
+
+ To disable showing the parameter on the hierarchical block in GRC, use Only in Properties option in the Show field.
+
+file_format: 1
diff --git a/grc/blocks/parameter.xml b/grc/blocks/parameter.xml
deleted file mode 100644
index 95d03e141..000000000
--- a/grc/blocks/parameter.xml
+++ /dev/null
@@ -1,116 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Parameter block: a grc variable with key, value
-###################################################
- -->
-<block>
- <name>Parameter</name>
- <key>parameter</key>
- <var_make>self.$(id) = $(id)</var_make>
- <make>$value</make>
- <param>
- <name>Label</name>
- <key>label</key>
- <value></value>
- <type>string</type>
- <hide>#if $label() then 'none' else 'part'#</hide>
- </param>
- <param>
- <name>Value</name>
- <key>value</key>
- <value>0</value>
- <type>$type.type</type>
- </param>
- <param>
- <name>Type</name>
- <key>type</key>
- <value></value>
- <type>enum</type>
- <hide>#if $type() then 'none' else 'part'#</hide>
- <option>
- <name>None</name>
- <key></key>
- <opt>type:raw</opt>
- </option>
- <option>
- <name>Complex</name>
- <key>complex</key>
- <opt>type:complex</opt>
- </option>
- <option>
- <name>Float</name>
- <key>eng_float</key>
- <opt>type:real</opt>
- </option>
- <option>
- <name>Int</name>
- <key>intx</key>
- <opt>type:int</opt>
- </option>
- <option>
- <name>Long</name>
- <key>long</key>
- <opt>type:int</opt>
- </option>
- <option>
- <name>String</name>
- <key>string</key>
- <opt>type:string</opt>
- </option>
- <!-- not supported yet in tmpl
- <option>
- <name>Boolean</name>
- <key>bool</key>
- <opt>type:bool</opt>
- </option>
- -->
- </param>
- <param>
- <name>Short ID</name>
- <key>short_id</key>
- <value></value>
- <type>string</type>
- <hide>#if not $type()
-all#slurp
-#elif $short_id()
-none#slurp
-#else
-part#slurp
-#end if</hide>
- </param>
- <param>
- <name>Show</name>
- <key>hide</key>
- <value></value>
- <type>enum</type>
- <hide>part</hide>
- <option>
- <name>Always</name>
- <key>none</key> <!--## Do not hide the parameter value-->
- </option>
- <option>
- <name>Only in Properties</name>
- <key>part</key> <!--## Partially hide the parameter value-->
- </option>
- </param>
- <check>len($short_id) in (0, 1)</check>
- <check>$short_id == '' or $(short_id).isalpha()</check>
- <doc>
-This block represents a parameter to the flow graph. \
-A parameter can be used to pass command line arguments into a top block. \
-Or, parameters can pass arguments into an instantiated hierarchical block.
-
-The paramater value cannot depend on any variables.
-
-Leave the label blank to use the parameter id as the label.
-
-When type is not None, this parameter also becomes a command line option of the form:
-
--[short_id] --[id] [value]
-
-The Short ID field may be left blank.
-
-To disable showing the parameter on the hierarchical block in GRC, use Only in Properties option in the Show field.
- </doc>
-</block>
diff --git a/grc/blocks/stream.domain.yml b/grc/blocks/stream.domain.yml
new file mode 100644
index 000000000..a4d786f8b
--- /dev/null
+++ b/grc/blocks/stream.domain.yml
@@ -0,0 +1,10 @@
+id: stream
+label: Stream
+color: "#000000"
+
+multiple_connections_per_input: false
+multiple_connections_per_output: true
+
+templates:
+- type: [stream, stream]
+ connect: self.connect(${ make_port_sig(source) }, ${ make_port_sig(sink) })
diff --git a/grc/blocks/variable.block.yml b/grc/blocks/variable.block.yml
new file mode 100644
index 000000000..fa62dabe8
--- /dev/null
+++ b/grc/blocks/variable.block.yml
@@ -0,0 +1,19 @@
+id: variable
+label: Variable
+
+parameters:
+- id: value
+ label: Value
+ dtype: raw
+ default: '0'
+value: ${ value }
+
+templates:
+ var_make: self.${id} = ${id} = ${value}
+ callbacks:
+ - self.set_${id}(${value})
+
+documentation: |-
+ This block maps a value to a unique variable. This variable block has no graphical representation.
+
+file_format: 1
diff --git a/grc/blocks/variable.xml b/grc/blocks/variable.xml
deleted file mode 100644
index afee0f5d4..000000000
--- a/grc/blocks/variable.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Variable block: a grc variable with key, value
-###################################################
- -->
-<block>
- <name>Variable</name>
- <key>variable</key>
- <var_make>self.$(id) = $(id) = $value</var_make>
- <make></make>
- <callback>self.set_$(id)($value)</callback>
- <param>
- <name>Value</name>
- <key>value</key>
- <value>0</value>
- <type>raw</type>
- </param>
- <doc>
-This block maps a value to a unique variable. \
-This variable block has no graphical representation.
- </doc>
-</block>
diff --git a/grc/blocks/variable_config.block.yml b/grc/blocks/variable_config.block.yml
new file mode 100644
index 000000000..bb64ea2a8
--- /dev/null
+++ b/grc/blocks/variable_config.block.yml
@@ -0,0 +1,58 @@
+id: variable_config
+label: Variable Config
+
+parameters:
+- id: value
+ label: Default Value
+ dtype: ${ type }
+ default: '0'
+- id: type
+ label: Type
+ dtype: enum
+ default: real
+ options: [real, int, bool, string]
+ option_labels: [Float, Int, Bool, String]
+ option_attributes:
+ get: [getfloat, getint, getboolean, get]
+- id: config_file
+ label: Config File
+ dtype: file_open
+ default: default
+- id: section
+ label: Section
+ dtype: string
+ default: main
+- id: option
+ label: Option
+ dtype: string
+ default: key
+- id: writeback
+ label: WriteBack
+ dtype: raw
+ default: None
+value: ${ value }
+
+templates:
+ imports: import ConfigParser
+ var_make: 'self._${id}_config = ConfigParser.ConfigParser()
+
+ self._${id}_config.read(${config_file})
+
+ try: ${id} = self._${id}_config.${type.get}(${section}, ${option})
+
+ except: ${id} = ${value}
+
+ self.${id} = ${id}'
+ callbacks:
+ - self.set_${id}(${value})
+ - "self._${id}_config = ConfigParser.ConfigParser()\nself._${id}_config.read(${config_file})\n\
+ if not self._${id}_config.has_section(${section}):\n\tself._${id}_config.add_section(${section})\n\
+ self._${id}_config.set(${section}, ${option}, str(${writeback}))\nself._${id}_config.write(open(${config_file},\
+ \ 'w'))"
+
+documentation: |-
+ This block represents a variable that can be read from a config file.
+
+ To save the value back into the config file: enter the name of another variable into the writeback param. When the other variable is changed at runtime, the config file will be re-written.
+
+file_format: 1
diff --git a/grc/blocks/variable_config.xml b/grc/blocks/variable_config.xml
deleted file mode 100644
index 11bff9edc..000000000
--- a/grc/blocks/variable_config.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Variable Config block:
-## a variable that reads and writes to a config file
-###################################################
- -->
-<block>
- <name>Variable Config</name>
- <key>variable_config</key>
- <import>import ConfigParser</import>
- <var_make>self._$(id)_config = ConfigParser.ConfigParser()
-self._$(id)_config.read($config_file)
-try: $(id) = self._$(id)_config.$(type.get)($section, $option)
-except: $(id) = $value
-self.$(id) = $(id)</var_make>
- <make></make>
- <callback>self.set_$(id)($value)</callback>
- <callback>self._$(id)_config = ConfigParser.ConfigParser()
-self._$(id)_config.read($config_file)
-if not self._$(id)_config.has_section($section):
- self._$(id)_config.add_section($section)
-self._$(id)_config.set($section, $option, str($writeback))
-self._$(id)_config.write(open($config_file, 'w'))</callback>
- <param>
- <name>Default Value</name>
- <key>value</key>
- <value>0</value>
- <type>$type</type>
- </param>
- <param>
- <name>Type</name>
- <key>type</key>
- <value>real</value>
- <type>enum</type>
- <option>
- <name>Float</name>
- <key>real</key>
- <opt>get:getfloat</opt>
- </option>
- <option>
- <name>Int</name>
- <key>int</key>
- <opt>get:getint</opt>
- </option>
- <option>
- <name>Bool</name>
- <key>bool</key>
- <opt>get:getboolean</opt>
- </option>
- <option>
- <name>String</name>
- <key>string</key>
- <opt>get:get</opt>
- </option>
- </param>
- <param>
- <name>Config File</name>
- <key>config_file</key>
- <value>default</value>
- <type>file_open</type>
- </param>
- <param>
- <name>Section</name>
- <key>section</key>
- <value>main</value>
- <type>string</type>
- </param>
- <param>
- <name>Option</name>
- <key>option</key>
- <value>key</value>
- <type>string</type>
- </param>
- <param>
- <name>WriteBack</name>
- <key>writeback</key>
- <value>None</value>
- <type>raw</type>
- </param>
- <doc>
-This block represents a variable that can be read from a config file.
-
-To save the value back into the config file: \
-enter the name of another variable into the writeback param. \
-When the other variable is changed at runtime, the config file will be re-written.
- </doc>
-</block>
diff --git a/grc/blocks/variable_function_probe.block.yml b/grc/blocks/variable_function_probe.block.yml
new file mode 100644
index 000000000..702ab5d60
--- /dev/null
+++ b/grc/blocks/variable_function_probe.block.yml
@@ -0,0 +1,54 @@
+id: variable_function_probe
+label: Function Probe
+
+parameters:
+- id: block_id
+ label: Block ID
+ dtype: string
+ default: my_block_0
+- id: function_name
+ label: Function Name
+ dtype: string
+ default: get_number
+- id: function_args
+ label: Function Args
+ dtype: string
+ hide: ${ ('none' if function_args else 'part') }
+- id: poll_rate
+ label: Poll Rate (Hz)
+ dtype: real
+ default: '10'
+- id: value
+ label: Initial Value
+ dtype: raw
+ default: '0'
+ hide: part
+value: ${ value }
+
+templates:
+ imports: |-
+ import time
+ import threading
+ var_make: self.${id} = ${id} = ${value}
+ make: "\ndef _${id}_probe():\n while True:\n <% obj = 'self' + ('.'\
+ \ + block_id if block_id else '') %>\n val = ${obj}.${function_name}(${function_args})\n\
+ \ try:\n self.set_${id}(val)\n except AttributeError:\n\
+ \ pass\n time.sleep(1.0 / (${poll_rate}))\n_${id}_thread\
+ \ = threading.Thread(target=_${id}_probe)\n_${id}_thread.daemon = True\n_${id}_thread.start()\n\
+ \ "
+ callbacks:
+ - self.set_${id}(${value})
+
+documentation: |-
+ Periodically probe a function and set its value to this variable.
+
+ Set the values for block ID, function name, and function args appropriately: Block ID should be the ID of another block in this flow graph. An empty Block ID references the flow graph itself. Function name should be the name of a class method on that block. Function args are the parameters passed into that function. For a function with no arguments, leave function args blank. When passing a string for the function arguments, quote the string literal: '"arg"'.
+
+ The values will used literally, and generated into the following form:
+ self.block_id.function_name(function_args)
+ or, if the Block ID is empty,
+ self.function_name(function_args)
+
+ To poll a stream for a level, use this with the probe signal block.
+
+file_format: 1
diff --git a/grc/blocks/variable_function_probe.xml b/grc/blocks/variable_function_probe.xml
deleted file mode 100644
index 47c11b29f..000000000
--- a/grc/blocks/variable_function_probe.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Variable function probe
-###################################################
- -->
-<block>
- <name>Function Probe</name>
- <key>variable_function_probe</key>
- <import>import time</import>
- <import>import threading</import>
- <var_make>self.$(id) = $(id) = $value</var_make>
- <make>
-def _$(id)_probe():
- while True:
- #set $obj = 'self' + ('.' + $block_id() if $block_id() else '')
- val = $(obj).$(function_name())($(function_args()))
- try:
- self.set_$(id)(val)
- except AttributeError:
- pass
- time.sleep(1.0 / ($poll_rate))
-_$(id)_thread = threading.Thread(target=_$(id)_probe)
-_$(id)_thread.daemon = True
-_$(id)_thread.start()
- </make>
- <callback>self.set_$(id)($value)</callback>
- <param>
- <name>Block ID</name>
- <key>block_id</key>
- <value>my_block_0</value>
- <type>string</type>
- </param>
- <param>
- <name>Function Name</name>
- <key>function_name</key>
- <value>get_number</value>
- <type>string</type>
- </param>
- <param>
- <name>Function Args</name>
- <key>function_args</key>
- <value></value>
- <type>string</type>
- <hide>#if $function_args() then 'none' else 'part'#</hide>
- </param>
- <param>
- <name>Poll Rate (Hz)</name>
- <key>poll_rate</key>
- <value>10</value>
- <type>real</type>
- </param>
- <param>
- <name>Initial Value</name>
- <key>value</key>
- <value>0</value>
- <type>raw</type>
- <hide>part</hide>
- </param>
- <doc>
-Periodically probe a function and set its value to this variable.
-
-Set the values for block ID, function name, and function args appropriately: \
-Block ID should be the ID of another block in this flow graph. \
-An empty Block ID references the flow graph itself. \
-Function name should be the name of a class method on that block. \
-Function args are the parameters passed into that function. \
-For a function with no arguments, leave function args blank. \
-When passing a string for the function arguments, quote the string literal: '"arg"'.
-
-The values will used literally, and generated into the following form:
- self.block_id.function_name(function_args)
-or, if the Block ID is empty,
- self.function_name(function_args)
-
-To poll a stream for a level, use this with the probe signal block.
- </doc>
-</block>
diff --git a/grc/blocks/variable_struct.block.yml.py b/grc/blocks/variable_struct.block.yml.py
new file mode 100644
index 000000000..19b29982e
--- /dev/null
+++ b/grc/blocks/variable_struct.block.yml.py
@@ -0,0 +1,105 @@
+#!/usr/bin/env python
+
+MAX_NUM_FIELDS = 20
+
+HEADER = """\
+id: variable_struct
+label: Struct Variable
+
+parameters:
+"""
+
+TEMPLATES = """\
+
+templates:
+ imports: "def struct(data): return type('Struct', (object,), data)()"
+ var_make: |-
+ self.${{id}} = ${{id}} = struct({{
+ % for i in range({0}):
+ <%
+ field = getVar('field' + str(i))
+ %>
+ % if len(str(field)) > 2:
+ ${{field}}: getVar('value' + str(i)),
+ % endif
+ % endfor
+ }})
+ var_value: |-
+ struct({{
+ % for i in range({0}):
+ <%
+ field = getVar('field' + str(i))
+ %>
+ % if len(str(field)) > 2:
+ ${{field}}: getVar('field' + str(i)),
+ % endif
+ % endfor
+ }})
+"""
+
+FIELD0 = """\
+- id: field0
+ label: Field 0
+ category: Fields
+ dtype: string
+ default: ${field0}
+ hide: part
+"""
+
+FIELDS = """\
+- id: field{0}
+ label: Field {0}
+ category: Fields
+ dtype: string
+ hide: part
+"""
+
+VALUES = """\
+- id: value{0}
+ label: ${{field{0}}}
+ dtype: raw
+ default: '0'
+ hide: ${{ 'none' if field{0} else 'all' }}
+"""
+
+ASSERTS = """\
+- ${{ (str(field{0}) or "a")[0].isalpha() }}
+- ${{ (str(field{0}) or "a").isalnum() }}
+"""
+
+FOOTER = """\
+
+documentation: |-
+ This is a simple struct/record like variable.
+
+ Attribute/field names can be specified in the tab 'Fields'.
+ For each non-empty field a parameter with type raw is shown.
+ Value access via the dot operator, e.g. "variable_struct_0.field0"
+
+file_format: 1
+"""
+
+
+def make_yml(num_fields):
+ return ''.join((
+ HEADER.format(num_fields),
+ FIELD0, ''.join(FIELDS.format(i) for i in range(1, num_fields)),
+ ''.join(VALUES.format(i) for i in range(num_fields)),
+ 'value: ${value}\n\nasserts:\n',
+ ''.join(ASSERTS.format(i) for i in range(num_fields)),
+ ''.join(TEMPLATES.format(num_fields)),
+ FOOTER
+ ))
+
+
+if __name__ == '__main__':
+ import sys
+ try:
+ filename = sys.argv[1]
+ except IndexError:
+ filename = __file__[:-3]
+
+ data = make_yml(MAX_NUM_FIELDS)
+
+ with open(filename, 'wb') as fp:
+ fp.write(data.encode())
diff --git a/grc/blocks/variable_struct.xml.py b/grc/blocks/variable_struct.xml.py
deleted file mode 100644
index de4411e97..000000000
--- a/grc/blocks/variable_struct.xml.py
+++ /dev/null
@@ -1,97 +0,0 @@
-#!/usr/bin/env python
-
-MAX_NUM_FIELDS = 20
-
-HEADER = """\
-<block>
- <name>Struct Variable</name>
- <key>variable_struct</key>
- <import>def struct(data): return type('Struct', (object,), data)()</import>
- <var_make>self.$id = $id = struct({{#slurp
-#for $i in range({0}):
-#set $field = $getVar('field' + str(i))
-#if len(str($field)) > 2
-$field: $getVar('value' + str(i)), #slurp
-#end if
-#end for
-}})</var_make>
- <var_value>struct({{#slurp
-#for $i in range({0}):
-#set $field = $getVar('field' + str(i))
-#if len(str($field)) > 2
-$field: $getVar('value' + str(i)), #slurp
-#end if
-#end for
-}})</var_value>
- <make></make>
-"""
-
-FIELD0 = """\
- <param>
- <name>Field 0</name>
- <key>field0</key>
- <value>field0</value>
- <type>string</type>
- <hide>part</hide>
- <tab>Fields</tab>
- </param>
-"""
-
-FIELDS = """\
- <param>
- <name>Field {0}</name>
- <key>field{0}</key>
- <value></value>
- <type>string</type>
- <hide>part</hide>
- <tab>Fields</tab>
- </param>
-"""
-
-VALUES = """\
- <param>
- <name>$field{0}()</name>
- <key>value{0}</key>
- <value>0</value>
- <type>raw</type>
- <hide>#if $field{0}() then 'none' else 'all'#</hide>
- </param>
-"""
-
-CHECKS = """\
- <check>($str($field{0}) or "a")[0].isalpha()</check>
- <check>($str($field{0}) or "a").isalnum()</check>
-"""
-
-FOOTER = """\
- <doc>This is a simple struct/record like variable.
-
-Attribute/field names can be specified in the tab 'Fields'.
-For each non-empty field a parameter with type raw is shown.
-Value access via the dot operator, e.g. "variable_struct_0.field0"
- </doc>
-</block>
-"""
-
-
-def make_xml(num_fields):
- return ''.join((
- HEADER.format(num_fields),
- FIELD0, ''.join(FIELDS.format(i) for i in range(1, num_fields)),
- ''.join(VALUES.format(i) for i in range(num_fields)),
- ''.join(CHECKS.format(i) for i in range(num_fields)),
- FOOTER
- ))
-
-
-if __name__ == '__main__':
- import sys
- try:
- filename = sys.argv[1]
- except IndexError:
- filename = __file__[:-3]
-
- data = make_xml(MAX_NUM_FIELDS)
-
- with open(filename, 'w') as fp:
- fp.write(data.encode())
diff --git a/grc/blocks/virtual_sink.xml b/grc/blocks/virtual_sink.xml
deleted file mode 100644
index 35fb27e67..000000000
--- a/grc/blocks/virtual_sink.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Virtual Sink
-###################################################
- -->
-<block>
- <name>Virtual Sink</name>
- <key>virtual_sink</key>
- <make></make>
- <param>
- <name>Stream ID</name>
- <key>stream_id</key>
- <value></value>
- <type>stream_id</type>
- </param>
- <sink>
- <name>in</name>
- <type></type>
- </sink>
-</block>
diff --git a/grc/blocks/virtual_source.xml b/grc/blocks/virtual_source.xml
deleted file mode 100644
index e0c775449..000000000
--- a/grc/blocks/virtual_source.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##Virtual Source
-###################################################
- -->
-<block>
- <name>Virtual Source</name>
- <key>virtual_source</key>
- <make></make>
- <param>
- <name>Stream ID</name>
- <key>stream_id</key>
- <value></value>
- <type>stream_id</type>
- </param>
- <source>
- <name>out</name>
- <type></type>
- </source>
-</block>
diff --git a/grc/compiler.py b/grc/compiler.py
index 0cda0d946..a5f6c3edc 100755
--- a/grc/compiler.py
+++ b/grc/compiler.py
@@ -26,7 +26,7 @@ import subprocess
from gnuradio import gr
from .core import Messages
-from .core.Platform import Platform
+from .core.platform import Platform
def argument_parser():
@@ -49,10 +49,12 @@ def main(args=None):
platform = Platform(
name='GNU Radio Companion Compiler',
- prefs_file=gr.prefs(),
+ prefs=gr.prefs(),
version=gr.version(),
version_parts=(gr.major_version(), gr.api_version(), gr.minor_version())
)
+ platform.build_library()
+
out_dir = args.output if not args.user_lib_dir else platform.config.hier_block_lib_dir
if os.path.exists(out_dir):
pass # all is well
diff --git a/grc/converter/__init__.py b/grc/converter/__init__.py
new file mode 100644
index 000000000..224f2e9af
--- /dev/null
+++ b/grc/converter/__init__.py
@@ -0,0 +1,20 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2 of the License, or (at your
+# option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
+
+from .main import Converter
diff --git a/grc/converter/__main__.py b/grc/converter/__main__.py
new file mode 100644
index 000000000..6efc2d7c5
--- /dev/null
+++ b/grc/converter/__main__.py
@@ -0,0 +1,21 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2 of the License, or (at your
+# option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
+
+# TODO: implement cli
+
diff --git a/grc/core/block.dtd b/grc/converter/block.dtd
index 145f4d861..145f4d861 100644
--- a/grc/core/block.dtd
+++ b/grc/converter/block.dtd
diff --git a/grc/converter/block.py b/grc/converter/block.py
new file mode 100644
index 000000000..0e362d97c
--- /dev/null
+++ b/grc/converter/block.py
@@ -0,0 +1,219 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2 of the License, or (at your
+# option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+Converter for legacy block definitions in XML format
+
+- Cheetah expressions that can not be converted are passed to Cheetah for now
+- Instead of generating a Block subclass directly a string representation is
+ used and evaluated. This is slower / lamer but allows us to show the user
+ how a converted definition would look like
+"""
+
+from __future__ import absolute_import, division, print_function
+
+from collections import OrderedDict, defaultdict
+from itertools import chain
+
+from ..core.io import yaml
+from . import cheetah_converter, xml
+
+current_file_format = 1
+reserved_block_keys = ('import', ) # todo: add more keys
+
+
+def from_xml(filename):
+ """Load block description from xml file"""
+ element, version_info = xml.load(filename, 'block.dtd')
+
+ try:
+ data = convert_block_xml(element)
+ except NameError:
+ raise ValueError('Conversion failed', filename)
+
+ return data
+
+
+def dump(data, stream):
+ out = yaml.dump(data)
+
+ replace = [
+ ('parameters:', '\nparameters:'),
+ ('inputs:', '\ninputs:'),
+ ('outputs:', '\noutputs:'),
+ ('templates:', '\ntemplates:'),
+ ('documentation:', '\ndocumentation:'),
+ ('file_format:', '\nfile_format:'),
+ ]
+ for r in replace:
+ out = out.replace(*r)
+ prefix = '# auto-generated by grc.converter\n\n'
+ stream.write(prefix + out)
+
+
+no_value = object()
+dummy = cheetah_converter.DummyConverter()
+
+
+def convert_block_xml(node):
+ converter = cheetah_converter.Converter(names={
+ param_node.findtext('key'): {
+ opt_node.text.split(':')[0]
+ for opt_node in next(param_node.iterfind('option'), param_node).iterfind('opt')
+ } for param_node in node.iterfind('param')
+ })
+
+ block_id = node.findtext('key')
+ if block_id in reserved_block_keys:
+ block_id += '_'
+
+ data = OrderedDict()
+ data['id'] = block_id
+ data['label'] = node.findtext('name') or no_value
+ data['category'] = node.findtext('category') or no_value
+ data['flags'] = node.findtext('flags') or no_value
+
+ data['parameters'] = [convert_param_xml(param_node, converter.to_python_dec)
+ for param_node in node.iterfind('param')] or no_value
+ # data['params'] = {p.pop('key'): p for p in data['params']}
+
+ data['inputs'] = [convert_port_xml(port_node, converter.to_python_dec)
+ for port_node in node.iterfind('sink')] or no_value
+
+ data['outputs'] = [convert_port_xml(port_node, converter.to_python_dec)
+ for port_node in node.iterfind('source')] or no_value
+ data['value'] = (
+ converter.to_python_dec(node.findtext('var_value')) or
+ ('${ value }' if block_id.startswith('variable') else no_value)
+ )
+
+ data['asserts'] = [converter.to_python_dec(check_node.text)
+ for check_node in node.iterfind('check')] or no_value
+
+ data['templates'] = convert_templates(node, converter.to_mako, block_id) or no_value
+
+ docs = node.findtext('doc')
+ if docs:
+ docs = docs.strip().replace('\\\n', '')
+ data['documentation'] = yaml.MultiLineString(docs)
+
+ data['file_format'] = current_file_format
+
+ data = OrderedDict((key, value) for key, value in data.items() if value is not no_value)
+ auto_hide_params_for_item_sizes(data)
+
+ return data
+
+
+def auto_hide_params_for_item_sizes(data):
+ item_size_templates = []
+ vlen_templates = []
+ for port in chain(*[data.get(direction, []) for direction in ['inputs', 'outputs']]):
+ for key in ['dtype', 'multiplicity']:
+ item_size_templates.append(str(port.get(key, '')))
+ vlen_templates.append(str(port.get('vlen', '')))
+ item_size_templates = ' '.join(value for value in item_size_templates if '${' in value)
+ vlen_templates = ' '.join(value for value in vlen_templates if '${' in value)
+
+ for param in data.get('parameters', []):
+ if param['id'] in item_size_templates:
+ param.setdefault('hide', 'part')
+ if param['id'] in vlen_templates:
+ param.setdefault('hide', "${ 'part' if vlen == 1 else 'none' }")
+
+
+def convert_templates(node, convert, block_id=''):
+ templates = OrderedDict()
+
+ imports = '\n'.join(convert(import_node.text)
+ for import_node in node.iterfind('import'))
+ if '\n' in imports:
+ imports = yaml.MultiLineString(imports)
+ templates['imports'] = imports or no_value
+
+ templates['var_make'] = convert(node.findtext('var_make') or '') or no_value
+
+ make = convert(node.findtext('make') or '')
+ if make:
+ check_mako_template(block_id, make)
+ if '\n' in make:
+ make = yaml.MultiLineString(make)
+ templates['make'] = make or no_value
+
+ templates['callbacks'] = [
+ convert(cb_node.text) for cb_node in node.iterfind('callback')
+ ] or no_value
+
+ return OrderedDict((key, value) for key, value in templates.items() if value is not no_value)
+
+
+def convert_param_xml(node, convert):
+ param = OrderedDict()
+ param['id'] = node.findtext('key').strip()
+ param['label'] = node.findtext('name').strip()
+ param['category'] = node.findtext('tab') or no_value
+
+ param['dtype'] = convert(node.findtext('type') or '')
+ param['default'] = node.findtext('value') or no_value
+
+ options = yaml.ListFlowing(on.findtext('key') for on in node.iterfind('option'))
+ option_labels = yaml.ListFlowing(on.findtext('name') for on in node.iterfind('option'))
+ param['options'] = options or no_value
+ if not all(str(o).title() == l for o, l in zip(options, option_labels)):
+ param['option_labels'] = option_labels
+
+ attributes = defaultdict(yaml.ListFlowing)
+ for option_n in node.iterfind('option'):
+ for opt_n in option_n.iterfind('opt'):
+ key, value = opt_n.text.split(':', 2)
+ attributes[key].append(value)
+ param['option_attributes'] = dict(attributes) or no_value
+
+ param['hide'] = convert(node.findtext('hide')) or no_value
+
+ return OrderedDict((key, value) for key, value in param.items() if value is not no_value)
+
+
+def convert_port_xml(node, convert):
+ port = OrderedDict()
+ label = node.findtext('name')
+ # default values:
+ port['label'] = label if label not in ('in', 'out') else no_value
+
+ dtype = convert(node.findtext('type'))
+ # TODO: detect dyn message ports
+ port['domain'] = domain = 'message' if dtype == 'message' else 'stream'
+ if domain == 'message':
+ port['id'], port['label'] = label, no_value
+ else:
+ port['dtype'] = dtype
+ vlen = node.findtext('vlen')
+ port['vlen'] = int(vlen) if vlen and vlen.isdigit() else convert(vlen) or no_value
+
+ port['multiplicity'] = convert(node.findtext('nports')) or no_value
+ port['optional'] = bool(node.findtext('optional')) or no_value
+ port['hide'] = convert(node.findtext('hide')) or no_value
+
+ return OrderedDict((key, value) for key, value in port.items() if value is not no_value)
+
+
+def check_mako_template(block_id, expr):
+ import sys
+ from mako.template import Template
+ try:
+ Template(expr)
+ except Exception as error:
+ print(block_id, expr, type(error), error, '', sep='\n', file=sys.stderr)
diff --git a/grc/core/block_tree.dtd b/grc/converter/block_tree.dtd
index 9e2357647..9e2357647 100644
--- a/grc/core/block_tree.dtd
+++ b/grc/converter/block_tree.dtd
diff --git a/grc/converter/block_tree.py b/grc/converter/block_tree.py
new file mode 100644
index 000000000..dee9adba4
--- /dev/null
+++ b/grc/converter/block_tree.py
@@ -0,0 +1,56 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2 of the License, or (at your
+# option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+Converter for legacy block tree definitions in XML format
+"""
+
+from __future__ import absolute_import, print_function
+
+from ..core.io import yaml
+from . import xml
+
+
+def from_xml(filename):
+ """Load block tree description from xml file"""
+ element, version_info = xml.load(filename, 'block_tree.dtd')
+
+ try:
+ data = convert_category_node(element)
+ except NameError:
+ raise ValueError('Conversion failed', filename)
+
+ return data
+
+
+def dump(data, stream):
+ out = yaml.dump(data, indent=2)
+ prefix = '# auto-generated by grc.converter\n\n'
+ stream.write(prefix + out)
+
+
+def convert_category_node(node):
+ """convert nested <cat> tags to nested lists dicts"""
+ assert node.tag == 'cat'
+ name, elements = '', []
+ for child in node:
+ if child.tag == 'name':
+ name = child.text.strip()
+ elif child.tag == 'block':
+ elements.append(child.text.strip())
+ elif child.tag == 'cat':
+ elements.append(convert_category_node(child))
+ return {name: elements}
diff --git a/grc/converter/cheetah_converter.py b/grc/converter/cheetah_converter.py
new file mode 100644
index 000000000..16fea32c9
--- /dev/null
+++ b/grc/converter/cheetah_converter.py
@@ -0,0 +1,277 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import, print_function
+
+import collections
+import re
+import string
+
+delims = {'(': ')', '[': ']', '{': '}', '': ', #\\*:'}
+identifier_start = '_' + string.ascii_letters + ''.join(delims.keys())
+string_delims = '"\''
+
+cheetah_substitution = re.compile(
+ r'^\$((?P<d1>\()|(?P<d2>\{)|(?P<d3>\[)|)'
+ r'(?P<arg>[_a-zA-Z][_a-zA-Z0-9]*(?:\.[_a-zA-Z][_a-zA-Z0-9]*)?)(?P<eval>\(\))?'
+ r'(?(d1)\)|(?(d2)\}|(?(d3)\]|)))$'
+)
+cheetah_inline_if = re.compile(r'#if (?P<cond>.*) then (?P<then>.*?) ?else (?P<else>.*?) ?(#|$)')
+
+
+class Python(object):
+ start = ''
+ end = ''
+ nested_start = ''
+ nested_end = ''
+ eval = ''
+ type = str # yaml_output.Eval
+
+
+class FormatString(Python):
+ start = '{'
+ end = '}'
+ nested_start = '{'
+ nested_end = '}'
+ eval = ':eval'
+ type = str
+
+
+class Mako(Python):
+ start = '${'
+ end = '}'
+ nested_start = ''
+ nested_end = ''
+ type = str
+
+
+class Converter(object):
+
+ def __init__(self, names):
+ self.stats = collections.defaultdict(int)
+ self.names = set(names)
+ self.extended = set(self._iter_identifiers(names))
+
+ @staticmethod
+ def _iter_identifiers(names):
+ if not isinstance(names, dict):
+ names = {name: {} for name in names}
+ for key, sub_keys in names.items():
+ yield key
+ for sub_key in sub_keys:
+ yield '{}.{}'.format(key, sub_key)
+
+ def to_python(self, expr):
+ return self.convert(expr=expr, spec=Python)
+
+ def to_python_dec(self, expr):
+ converted = self.convert(expr=expr, spec=Python)
+ if converted and converted != expr:
+ converted = '${ ' + converted.strip() + ' }'
+ return converted
+
+ def to_format_string(self, expr):
+ return self.convert(expr=expr, spec=FormatString)
+
+ def to_mako(self, expr):
+ return self.convert(expr=expr, spec=Mako)
+
+ def convert(self, expr, spec=Python):
+ if not expr:
+ return ''
+
+ elif '$' not in expr:
+ return expr
+
+ try:
+ return self.convert_simple(expr, spec)
+ except ValueError:
+ pass
+
+ try:
+ if '#if' in expr and '\n' not in expr:
+ expr = self.convert_inline_conditional(expr, spec)
+ return self.convert_hard(expr, spec)
+ except ValueError:
+ return 'Cheetah! ' + expr
+
+ def convert_simple(self, expr, spec=Python):
+ match = cheetah_substitution.match(expr)
+ if not match:
+ raise ValueError('Not a simple substitution: ' + expr)
+
+ identifier = match.group('arg')
+ if identifier not in self.extended:
+ raise NameError('Unknown substitution {!r}'.format(identifier))
+ if match.group('eval'):
+ identifier += spec.eval
+
+ out = spec.start + identifier + spec.end
+ if '$' in out or '#' in out:
+ raise ValueError('Failed to convert: ' + expr)
+
+ self.stats['simple'] += 1
+ return spec.type(out)
+
+ def convert_hard(self, expr, spec=Python):
+ lines = '\n'.join(self.convert_hard_line(line, spec) for line in expr.split('\n'))
+ if spec == Mako:
+ # no line-continuation before a mako control structure
+ lines = re.sub(r'\\\n(\s*%)', r'\n\1', lines)
+ return lines
+
+ def convert_hard_line(self, expr, spec=Python):
+ if spec == Mako:
+ if '#set' in expr:
+ ws, set_, statement = expr.partition('#set ')
+ return ws + '<% ' + self.to_python(statement) + ' %>'
+
+ if '#if' in expr:
+ ws, if_, condition = expr.partition('#if ')
+ return ws + '% if ' + self.to_python(condition) + ':'
+ if '#else if' in expr:
+ ws, elif_, condition = expr.partition('#else if ')
+ return ws + '% elif ' + self.to_python(condition) + ':'
+ if '#else' in expr:
+ return expr.replace('#else', '% else:')
+ if '#end if' in expr:
+ return expr.replace('#end if', '% endif')
+
+ if '#slurp' in expr:
+ expr = expr.split('#slurp', 1)[0] + '\\'
+ return self.convert_hard_replace(expr, spec)
+
+ def convert_hard_replace(self, expr, spec=Python):
+ counts = collections.Counter()
+
+ def all_delims_closed():
+ for opener_, closer_ in delims.items():
+ if counts[opener_] != counts[closer_]:
+ return False
+ return True
+
+ def extra_close():
+ for opener_, closer_ in delims.items():
+ if counts[opener_] < counts[closer_]:
+ return True
+ return False
+
+ out = []
+ delim_to_find = False
+
+ pos = 0
+ char = ''
+ in_string = None
+ while pos < len(expr):
+ prev, char = char, expr[pos]
+ counts.update(char)
+
+ if char in string_delims:
+ if not in_string:
+ in_string = char
+ elif char == in_string:
+ in_string = None
+ out.append(char)
+ pos += 1
+ continue
+ if in_string:
+ out.append(char)
+ pos += 1
+ continue
+
+ if char == '$':
+ pass # no output
+
+ elif prev == '$':
+ if char not in identifier_start: # not a substitution
+ out.append('$' + char) # now print the $ we skipped over
+
+ elif not delim_to_find: # start of a substitution
+ try:
+ delim_to_find = delims[char]
+ out.append(spec.start)
+ except KeyError:
+ if char in identifier_start:
+ delim_to_find = delims['']
+ out.append(spec.start)
+ out.append(char)
+
+ counts.clear()
+ counts.update(char)
+
+ else: # nested substitution: simply match known variable names
+ found = False
+ for known_identifier in self.names:
+ if expr[pos:].startswith(known_identifier):
+ found = True
+ break
+ if found:
+ out.append(spec.nested_start)
+ out.append(known_identifier)
+ out.append(spec.nested_end)
+ pos += len(known_identifier)
+ continue
+
+ elif delim_to_find and char in delim_to_find and all_delims_closed(): # end of substitution
+ out.append(spec.end)
+ if char in delims['']:
+ out.append(char)
+ delim_to_find = False
+
+ elif delim_to_find and char in ')]}' and extra_close(): # end of substitution
+ out.append(spec.end)
+ out.append(char)
+ delim_to_find = False
+
+ else:
+ out.append(char)
+
+ pos += 1
+
+ if delim_to_find == delims['']:
+ out.append(spec.end)
+
+ out = ''.join(out)
+ # fix: eval stuff
+ out = re.sub(r'(?P<arg>' + r'|'.join(self.extended) + r')\(\)', '\g<arg>', out)
+
+ self.stats['hard'] += 1
+ return spec.type(out)
+
+ def convert_inline_conditional(self, expr, spec=Python):
+ if spec == FormatString:
+ raise ValueError('No conditionals in format strings: ' + expr)
+ matcher = r'\g<then> if \g<cond> else \g<else>'
+ if spec == Python:
+ matcher = '(' + matcher + ')'
+ expr = cheetah_inline_if.sub(matcher, expr)
+ return spec.type(self.convert_hard(expr, spec))
+
+
+class DummyConverter(object):
+
+ def __init__(self, names={}):
+ pass
+
+ def to_python(self, expr):
+ return expr
+
+ def to_format_string(self, expr):
+ return expr
+
+ def to_mako(self, expr):
+ return expr
diff --git a/grc/converter/flow_graph.dtd b/grc/converter/flow_graph.dtd
new file mode 100644
index 000000000..bdfe1dc05
--- /dev/null
+++ b/grc/converter/flow_graph.dtd
@@ -0,0 +1,38 @@
+<!--
+Copyright 2008 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+-->
+<!--
+ flow_graph.dtd
+ Josh Blum
+ The document type definition for flow graph xml files.
+ -->
+<!ELEMENT flow_graph (timestamp?, block*, connection*)> <!-- optional timestamp -->
+<!ELEMENT timestamp (#PCDATA)>
+<!-- Block -->
+<!ELEMENT block (key, param*, bus_sink?, bus_source?)>
+<!ELEMENT param (key, value)>
+<!ELEMENT key (#PCDATA)>
+<!ELEMENT value (#PCDATA)>
+<!ELEMENT bus_sink (#PCDATA)>
+<!ELEMENT bus_source (#PCDATA)>
+<!-- Connection -->
+<!ELEMENT connection (source_block_id, sink_block_id, source_key, sink_key)>
+<!ELEMENT source_block_id (#PCDATA)>
+<!ELEMENT sink_block_id (#PCDATA)>
+<!ELEMENT source_key (#PCDATA)>
+<!ELEMENT sink_key (#PCDATA)>
diff --git a/grc/converter/flow_graph.py b/grc/converter/flow_graph.py
new file mode 100644
index 000000000..d20c67703
--- /dev/null
+++ b/grc/converter/flow_graph.py
@@ -0,0 +1,131 @@
+# Copyright 2017 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import, division
+
+import ast
+from collections import OrderedDict
+
+from ..core.io import yaml
+from . import xml
+
+
+def from_xml(filename):
+ """Load flow graph from xml file"""
+ element, version_info = xml.load(filename, 'flow_graph.dtd')
+
+ data = convert_flow_graph_xml(element)
+ try:
+ file_format = int(version_info['format'])
+ except KeyError:
+ file_format = _guess_file_format_1(data)
+
+ data['metadata'] = {'file_format': file_format}
+
+ return data
+
+
+def dump(data, stream):
+ out = yaml.dump(data, indent=2)
+
+ replace = [
+ ('blocks:', '\nblocks:'),
+ ('connections:', '\nconnections:'),
+ ('metadata:', '\nmetadata:'),
+ ]
+ for r in replace:
+ out = out.replace(*r)
+ prefix = '# auto-generated by grc.converter\n\n'
+ stream.write(prefix + out)
+
+
+def convert_flow_graph_xml(node):
+ blocks = [
+ convert_block(block_data)
+ for block_data in node.findall('block')
+ ]
+
+ options = next(b for b in blocks if b['id'] == 'options')
+ blocks.remove(options)
+ options.pop('id')
+
+ connections = [
+ convert_connection(connection)
+ for connection in node.findall('connection')
+ ]
+
+ flow_graph = OrderedDict()
+ flow_graph['options'] = options
+ flow_graph['blocks'] = blocks
+ flow_graph['connections'] = connections
+ return flow_graph
+
+
+def convert_block(data):
+ block_id = data.findtext('key')
+
+ params = OrderedDict(sorted(
+ (param.findtext('key'), param.findtext('value'))
+ for param in data.findall('param')
+ ))
+ states = OrderedDict()
+ x, y = ast.literal_eval(params.pop('_coordinate', '(10, 10)'))
+ states['coordinate'] = yaml.ListFlowing([x, y])
+ states['rotation'] = int(params.pop('_rotation', '0'))
+ enabled = params.pop('_enabled', 'True')
+ states['state'] = (
+ 'enabled' if enabled in ('1', 'True') else
+ 'bypassed' if enabled == '2' else
+ 'disabled'
+ )
+
+ block = OrderedDict()
+ if block_id != 'options':
+ block['name'] = params.pop('id')
+ block['id'] = block_id
+ block['parameters'] = params
+ block['states'] = states
+
+ return block
+
+
+def convert_connection(data):
+ src_blk_id = data.findtext('source_block_id')
+ src_port_id = data.findtext('source_key')
+ snk_blk_id = data.findtext('sink_block_id')
+ snk_port_id = data.findtext('sink_key')
+
+ if src_port_id.isdigit():
+ src_port_id = 'out' + src_port_id
+ if snk_port_id.isdigit():
+ snk_port_id = 'in' + snk_port_id
+
+ return yaml.ListFlowing([src_blk_id, src_port_id, snk_blk_id, snk_port_id])
+
+
+def _guess_file_format_1(data):
+ """Try to guess the file format for flow-graph files without version tag"""
+
+ def has_numeric_port_ids(src_id, src_port_id, snk_id, snk_port_id):
+ return src_port_id.isdigit() and snk_port_id.is_digit()
+
+ try:
+ if any(not has_numeric_port_ids(*con) for con in data['connections']):
+ return 1
+ except:
+ pass
+ return 0
diff --git a/grc/converter/main.py b/grc/converter/main.py
new file mode 100644
index 000000000..5a18471fc
--- /dev/null
+++ b/grc/converter/main.py
@@ -0,0 +1,165 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2 of the License, or (at your
+# option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
+
+from codecs import open
+import json
+import logging
+import os
+
+import six
+
+from . import block_tree, block
+
+path = os.path
+logger = logging.getLogger(__name__)
+
+excludes = [
+ 'qtgui_',
+ '.grc_gnuradio/',
+ 'blks2',
+ 'wxgui',
+ 'epy_block.xml',
+ 'virtual_sink.xml',
+ 'virtual_source.xml',
+ 'dummy.xml',
+ 'variable_struct.xml', # todo: re-implement as class
+ 'digital_constellation', # todo: fix template
+]
+
+
+class Converter(object):
+
+ def __init__(self, search_path, output_dir='~/.cache/grc_gnuradio'):
+ self.search_path = search_path
+ self.output_dir = os.path.expanduser(output_dir)
+ logger.info("Saving converted files to {}".format(self.output_dir))
+
+ self._force = False
+
+ converter_module_path = path.dirname(__file__)
+ self._converter_mtime = max(path.getmtime(path.join(converter_module_path, module))
+ for module in os.listdir(converter_module_path)
+ if not module.endswith('flow_graph.py'))
+
+ self.cache_file = os.path.join(self.output_dir, '_cache.json')
+ self.cache = {}
+
+ def run(self, force=False):
+ self._force = force
+
+ try:
+ logger.debug("Loading block cache from: {}".format(self.cache_file))
+ with open(self.cache_file, encoding='utf-8') as cache_file:
+ self.cache = byteify(json.load(cache_file))
+ except (IOError, ValueError):
+ self.cache = {}
+ self._force = True
+ need_cache_write = False
+
+ if not path.isdir(self.output_dir):
+ os.makedirs(self.output_dir)
+ if self._force:
+ for name in os.listdir(self.output_dir):
+ os.remove(os.path.join(self.output_dir, name))
+
+ for xml_file in self.iter_files_in_block_path():
+ if xml_file.endswith("block_tree.xml"):
+ changed = self.load_category_tree_xml(xml_file)
+ elif xml_file.endswith('domain.xml'):
+ continue
+ else:
+ changed = self.load_block_xml(xml_file)
+
+ if changed:
+ need_cache_write = True
+
+ if need_cache_write:
+ logger.info('Saving %d entries to json cache', len(self.cache))
+ with open(self.cache_file, 'w', encoding='utf-8') as cache_file:
+ json.dump(self.cache, cache_file)
+
+ def load_block_xml(self, xml_file):
+ """Load block description from xml file"""
+ if any(part in xml_file for part in excludes):
+ return
+
+ block_id_from_xml = path.basename(xml_file)[:-4]
+ yml_file = path.join(self.output_dir, block_id_from_xml + '.block.yml')
+
+ if not self.needs_conversion(xml_file, yml_file):
+ return # yml file up-to-date
+
+ logger.info('Converting block %s', path.basename(xml_file))
+ data = block.from_xml(xml_file)
+ if block_id_from_xml != data['id']:
+ logger.warning('block_id and filename differ')
+ self.cache[yml_file] = data
+
+ with open(yml_file, 'w', encoding='utf-8') as yml_file:
+ block.dump(data, yml_file)
+ return True
+
+ def load_category_tree_xml(self, xml_file):
+ """Validate and parse category tree file and add it to list"""
+ module_name = path.basename(xml_file)[:-len('block_tree.xml')].rstrip('._-')
+ yml_file = path.join(self.output_dir, module_name + '.tree.yml')
+
+ if not self.needs_conversion(xml_file, yml_file):
+ return # yml file up-to-date
+
+ logger.info('Converting module %s', path.basename(xml_file))
+ data = block_tree.from_xml(xml_file)
+ self.cache[yml_file] = data
+
+ with open(yml_file, 'w', encoding='utf-8') as yml_file:
+ block_tree.dump(data, yml_file)
+ return True
+
+ def needs_conversion(self, source, destination):
+ """Check if source has already been converted and destination is up-to-date"""
+ if self._force or not path.exists(destination):
+ return True
+ xml_time = path.getmtime(source)
+ yml_time = path.getmtime(destination)
+
+ return yml_time < xml_time or yml_time < self._converter_mtime
+
+ def iter_files_in_block_path(self, suffix='.xml'):
+ """Iterator for block descriptions and category trees"""
+ for block_path in self.search_path:
+ if path.isfile(block_path):
+ yield block_path
+ elif path.isdir(block_path):
+ for root, _, files in os.walk(block_path, followlinks=True):
+ for name in files:
+ if name.endswith(suffix):
+ yield path.join(root, name)
+ else:
+ logger.warning('Invalid entry in search path: {}'.format(block_path))
+
+
+def byteify(data):
+ if isinstance(data, dict):
+ return {byteify(key): byteify(value) for key, value in six.iteritems(data)}
+ elif isinstance(data, list):
+ return [byteify(element) for element in data]
+ elif isinstance(data, six.text_type) and six.PY2:
+ return data.encode('utf-8')
+ else:
+ return data
diff --git a/grc/converter/xml.py b/grc/converter/xml.py
new file mode 100644
index 000000000..2eda786c0
--- /dev/null
+++ b/grc/converter/xml.py
@@ -0,0 +1,82 @@
+# Copyright 2017 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import, division
+
+import re
+from os import path
+
+try:
+ # raise ImportError()
+ from lxml import etree
+ HAVE_LXML = True
+except ImportError:
+ import xml.etree.ElementTree as etree
+ HAVE_LXML = False
+
+
+_validator_cache = {None: lambda xml: True}
+
+
+def _get_validator(dtd=None):
+ validator = _validator_cache.get(dtd)
+ if not validator:
+ if not path.isabs(dtd):
+ dtd = path.join(path.dirname(__file__), dtd)
+ validator = _validator_cache[dtd] = etree.DTD(dtd).validate
+ return validator
+
+
+def load_lxml(filename, document_type_def=None):
+ """Load block description from xml file"""
+
+ try:
+ xml_tree = etree.parse(filename)
+ _get_validator(document_type_def)
+ element = xml_tree.getroot()
+ except etree.LxmlError:
+ raise ValueError("Failed to parse or validate {}".format(filename))
+
+ version_info = {}
+ for inst in xml_tree.xpath('/processing-instruction()'):
+ if inst.target == 'grc':
+ version_info.update(inst.attrib)
+
+ return element, version_info
+
+
+def load_stdlib(filename, document_type_def=None):
+ """Load block description from xml file"""
+
+ with open(filename, 'rb') as xml_file:
+ data = xml_file.read().decode('utf-8')
+
+ try:
+ element = etree.fromstring(data)
+ except etree.ParseError:
+ raise ValueError("Failed to parse {}".format(filename))
+
+ version_info = {}
+ for body in re.findall(r'<\?(.*?)\?>', data):
+ element = etree.fromstring('<' + body + '/>')
+ if element.tag == 'grc':
+ version_info.update(element.attrib)
+
+ return element, version_info
+
+
+load = load_lxml if HAVE_LXML else load_stdlib
diff --git a/grc/core/Block.py b/grc/core/Block.py
deleted file mode 100644
index e80552a0a..000000000
--- a/grc/core/Block.py
+++ /dev/null
@@ -1,852 +0,0 @@
-"""
-Copyright 2008-2015 Free Software Foundation, Inc.
-This file is part of GNU Radio
-
-GNU Radio Companion 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 2
-of the License, or (at your option) any later version.
-
-GNU Radio Companion 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 program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-"""
-
-import collections
-import itertools
-
-from Cheetah.Template import Template
-
-from .utils import epy_block_io, odict
-from . Constants import (
- BLOCK_FLAG_NEED_QT_GUI,
- ADVANCED_PARAM_TAB, DEFAULT_PARAM_TAB,
- BLOCK_FLAG_THROTTLE, BLOCK_FLAG_DISABLE_BYPASS,
- BLOCK_FLAG_DEPRECATED,
- BLOCK_ENABLED, BLOCK_BYPASSED, BLOCK_DISABLED
-)
-from . Element import Element
-
-
-def _get_keys(lst):
- return [elem.get_key() for elem in lst]
-
-
-def _get_elem(lst, key):
- try:
- return lst[_get_keys(lst).index(key)]
- except ValueError:
- raise ValueError('Key "{}" not found in {}.'.format(key, _get_keys(lst)))
-
-
-class Block(Element):
-
- is_block = True
-
- def __init__(self, flow_graph, n):
- """
- Make a new block from nested data.
-
- Args:
- flow: graph the parent element
- n: the nested odict
-
- Returns:
- block a new block
- """
- # Grab the data
- self._doc = (n.find('doc') or '').strip('\n').replace('\\\n', '')
- self._imports = map(lambda i: i.strip(), n.findall('import'))
- self._make = n.find('make')
- self._var_make = n.find('var_make')
- self._checks = n.findall('check')
- self._callbacks = n.findall('callback')
- self._bus_structure_source = n.find('bus_structure_source') or ''
- self._bus_structure_sink = n.find('bus_structure_sink') or ''
- self.port_counters = [itertools.count(), itertools.count()]
-
- # Build the block
- Element.__init__(self, flow_graph)
-
- # Grab the data
- params = n.findall('param')
- sources = n.findall('source')
- sinks = n.findall('sink')
- self._name = n.find('name')
- self._key = n.find('key')
- category = (n.find('category') or '').split('/')
- self.category = [cat.strip() for cat in category if cat.strip()]
- self._flags = n.find('flags') or ''
- # Backwards compatibility
- if n.find('throttle') and BLOCK_FLAG_THROTTLE not in self._flags:
- self._flags += BLOCK_FLAG_THROTTLE
- self._grc_source = n.find('grc_source') or ''
- self._block_wrapper_path = n.find('block_wrapper_path')
- self._bussify_sink = n.find('bus_sink')
- self._bussify_source = n.find('bus_source')
- self._var_value = n.find('var_value') or '$value'
-
- # Get list of param tabs
- n_tabs = n.find('param_tab_order') or None
- self._param_tab_labels = n_tabs.findall('tab') if n_tabs is not None else [DEFAULT_PARAM_TAB]
-
- # Create the param objects
- self._params = list()
-
- # Add the id param
- self.get_params().append(self.get_parent().get_parent().Param(
- block=self,
- n=odict({
- 'name': 'ID',
- 'key': 'id',
- 'type': 'id',
- })
- ))
- self.get_params().append(self.get_parent().get_parent().Param(
- block=self,
- n=odict({
- 'name': 'Enabled',
- 'key': '_enabled',
- 'type': 'raw',
- 'value': 'True',
- 'hide': 'all',
- })
- ))
- for param in itertools.imap(lambda n: self.get_parent().get_parent().Param(block=self, n=n), params):
- key = param.get_key()
- # Test against repeated keys
- if key in self.get_param_keys():
- raise Exception('Key "{}" already exists in params'.format(key))
- # Store the param
- self.get_params().append(param)
- # Create the source objects
- self._sources = list()
- for source in map(lambda n: self.get_parent().get_parent().Port(block=self, n=n, dir='source'), sources):
- key = source.get_key()
- # Test against repeated keys
- if key in self.get_source_keys():
- raise Exception('Key "{}" already exists in sources'.format(key))
- # Store the port
- self.get_sources().append(source)
- self.back_ofthe_bus(self.get_sources())
- # Create the sink objects
- self._sinks = list()
- for sink in map(lambda n: self.get_parent().get_parent().Port(block=self, n=n, dir='sink'), sinks):
- key = sink.get_key()
- # Test against repeated keys
- if key in self.get_sink_keys():
- raise Exception('Key "{}" already exists in sinks'.format(key))
- # Store the port
- self.get_sinks().append(sink)
- self.back_ofthe_bus(self.get_sinks())
- self.current_bus_structure = {'source': '', 'sink': ''}
-
- # Virtual source/sink and pad source/sink blocks are
- # indistinguishable from normal GR blocks. Make explicit
- # checks for them here since they have no work function or
- # buffers to manage.
- self.is_virtual_or_pad = self._key in (
- "virtual_source", "virtual_sink", "pad_source", "pad_sink")
- self.is_variable = self._key.startswith('variable')
- self.is_import = (self._key == 'import')
-
- # Disable blocks that are virtual/pads or variables
- if self.is_virtual_or_pad or self.is_variable:
- self._flags += BLOCK_FLAG_DISABLE_BYPASS
-
- if not (self.is_virtual_or_pad or self.is_variable or self._key == 'options'):
- self.get_params().append(self.get_parent().get_parent().Param(
- block=self,
- n=odict({'name': 'Block Alias',
- 'key': 'alias',
- 'type': 'string',
- 'hide': 'part',
- 'tab': ADVANCED_PARAM_TAB
- })
- ))
-
- if (len(sources) or len(sinks)) and not self.is_virtual_or_pad:
- self.get_params().append(self.get_parent().get_parent().Param(
- block=self,
- n=odict({'name': 'Core Affinity',
- 'key': 'affinity',
- 'type': 'int_vector',
- 'hide': 'part',
- 'tab': ADVANCED_PARAM_TAB
- })
- ))
- if len(sources) and not self.is_virtual_or_pad:
- self.get_params().append(self.get_parent().get_parent().Param(
- block=self,
- n=odict({'name': 'Min Output Buffer',
- 'key': 'minoutbuf',
- 'type': 'int',
- 'hide': 'part',
- 'value': '0',
- 'tab': ADVANCED_PARAM_TAB
- })
- ))
- self.get_params().append(self.get_parent().get_parent().Param(
- block=self,
- n=odict({'name': 'Max Output Buffer',
- 'key': 'maxoutbuf',
- 'type': 'int',
- 'hide': 'part',
- 'value': '0',
- 'tab': ADVANCED_PARAM_TAB
- })
- ))
-
- self.get_params().append(self.get_parent().get_parent().Param(
- block=self,
- n=odict({'name': 'Comment',
- 'key': 'comment',
- 'type': '_multiline',
- 'hide': 'part',
- 'value': '',
- 'tab': ADVANCED_PARAM_TAB
- })
- ))
-
- self._epy_source_hash = -1 # for epy blocks
- self._epy_reload_error = None
-
- if self._bussify_sink:
- self.bussify({'name': 'bus', 'type': 'bus'}, 'sink')
- if self._bussify_source:
- self.bussify({'name': 'bus', 'type': 'bus'}, 'source')
-
- def get_bus_structure(self, direction):
- if direction == 'source':
- bus_structure = self._bus_structure_source
- else:
- bus_structure = self._bus_structure_sink
-
- bus_structure = self.resolve_dependencies(bus_structure)
-
- if not bus_structure:
- return '' # TODO: Don't like empty strings. should change this to None eventually
-
- try:
- clean_bus_structure = self.get_parent().evaluate(bus_structure)
- return clean_bus_structure
- except:
- return ''
-
- def validate(self):
- """
- Validate this block.
- Call the base class validate.
- Evaluate the checks: each check must evaluate to True.
- """
- Element.validate(self)
- # Evaluate the checks
- for check in self._checks:
- check_res = self.resolve_dependencies(check)
- try:
- if not self.get_parent().evaluate(check_res):
- self.add_error_message('Check "{}" failed.'.format(check))
- except:
- self.add_error_message('Check "{}" did not evaluate.'.format(check))
-
- # For variables check the value (only if var_value is used
- if self.is_variable and self._var_value != '$value':
- value = self._var_value
- try:
- value = self.get_var_value()
- self.get_parent().evaluate(value)
- except Exception as err:
- self.add_error_message('Value "{}" cannot be evaluated:\n{}'.format(value, err))
-
- # check if this is a GUI block and matches the selected generate option
- current_generate_option = self.get_parent().get_option('generate_options')
-
- def check_generate_mode(label, flag, valid_options):
- block_requires_mode = (
- flag in self.get_flags() or
- self.get_name().upper().startswith(label)
- )
- if block_requires_mode and current_generate_option not in valid_options:
- self.add_error_message("Can't generate this block in mode: {} ".format(
- repr(current_generate_option)))
-
- check_generate_mode('QT GUI', BLOCK_FLAG_NEED_QT_GUI, ('qt_gui', 'hb_qt_gui'))
- if self._epy_reload_error:
- self.get_param('_source_code').add_error_message(str(self._epy_reload_error))
-
- def rewrite(self):
- """
- Add and remove ports to adjust for the nports.
- """
- Element.rewrite(self)
- # Check and run any custom rewrite function for this block
- getattr(self, 'rewrite_' + self._key, lambda: None)()
-
- # Adjust nports, disconnect hidden ports
- for ports in (self.get_sources(), self.get_sinks()):
- for i, master_port in enumerate(ports):
- nports = master_port.get_nports() or 1
- num_ports = 1 + len(master_port.get_clones())
- if master_port.get_hide():
- for connection in master_port.get_connections():
- self.get_parent().remove_element(connection)
- if not nports and num_ports == 1: # Not a master port and no left-over clones
- continue
- # Remove excess cloned ports
- for port in master_port.get_clones()[nports-1:]:
- # Remove excess connections
- for connection in port.get_connections():
- self.get_parent().remove_element(connection)
- master_port.remove_clone(port)
- ports.remove(port)
- # Add more cloned ports
- for j in range(num_ports, nports):
- port = master_port.add_clone()
- ports.insert(ports.index(master_port) + j, port)
-
- self.back_ofthe_bus(ports)
- # Renumber non-message/message ports
- domain_specific_port_index = collections.defaultdict(int)
- for port in filter(lambda p: p.get_key().isdigit(), ports):
- domain = port.get_domain()
- port._key = str(domain_specific_port_index[domain])
- domain_specific_port_index[domain] += 1
-
- def port_controller_modify(self, direction):
- """
- Change the port controller.
-
- Args:
- direction: +1 or -1
-
- Returns:
- true for change
- """
- changed = False
- # Concat the nports string from the private nports settings of all ports
- nports_str = ' '.join([port._nports for port in self.get_ports()])
- # Modify all params whose keys appear in the nports string
- for param in self.get_params():
- if param.is_enum() or param.get_key() not in nports_str:
- continue
- # Try to increment the port controller by direction
- try:
- value = param.get_evaluated()
- value = value + direction
- if 0 < value:
- param.set_value(value)
- changed = True
- except:
- pass
- return changed
-
- def get_doc(self):
- platform = self.get_parent().get_parent()
- documentation = platform.block_docstrings.get(self._key, {})
- from_xml = self._doc.strip()
- if from_xml:
- documentation[''] = from_xml
- return documentation
-
- def get_imports(self, raw=False):
- """
- Resolve all import statements.
- Split each import statement at newlines.
- Combine all import statements into a list.
- Filter empty imports.
-
- Returns:
- a list of import statements
- """
- if raw:
- return self._imports
- return filter(lambda i: i, sum(map(lambda i: self.resolve_dependencies(i).split('\n'), self._imports), []))
-
- def get_make(self, raw=False):
- if raw:
- return self._make
- return self.resolve_dependencies(self._make)
-
- def get_var_make(self):
- return self.resolve_dependencies(self._var_make)
-
- def get_var_value(self):
- return self.resolve_dependencies(self._var_value)
-
- def get_callbacks(self):
- """
- Get a list of function callbacks for this block.
-
- Returns:
- a list of strings
- """
- def make_callback(callback):
- callback = self.resolve_dependencies(callback)
- if 'self.' in callback:
- return callback
- return 'self.{}.{}'.format(self.get_id(), callback)
- return map(make_callback, self._callbacks)
-
- def is_virtual_sink(self):
- return self.get_key() == 'virtual_sink'
-
- def is_virtual_source(self):
- return self.get_key() == 'virtual_source'
-
- ###########################################################################
- # Custom rewrite functions
- ###########################################################################
-
- def rewrite_epy_block(self):
- flowgraph = self.get_parent()
- platform = flowgraph.get_parent()
- param_blk = self.get_param('_io_cache')
- param_src = self.get_param('_source_code')
-
- src = param_src.get_value()
- src_hash = hash((self.get_id(), src))
- if src_hash == self._epy_source_hash:
- return
-
- try:
- blk_io = epy_block_io.extract(src)
-
- except Exception as e:
- self._epy_reload_error = ValueError(str(e))
- try: # Load last working block io
- blk_io_args = eval(param_blk.get_value())
- if len(blk_io_args) == 6:
- blk_io_args += ([],) # add empty callbacks
- blk_io = epy_block_io.BlockIO(*blk_io_args)
- except Exception:
- return
- else:
- self._epy_reload_error = None # Clear previous errors
- param_blk.set_value(repr(tuple(blk_io)))
-
- # print "Rewriting embedded python block {!r}".format(self.get_id())
-
- self._epy_source_hash = src_hash
- self._name = blk_io.name or blk_io.cls
- self._doc = blk_io.doc
- self._imports[0] = 'import ' + self.get_id()
- self._make = '{0}.{1}({2})'.format(self.get_id(), blk_io.cls, ', '.join(
- '{0}=${{ {0} }}'.format(key) for key, _ in blk_io.params))
- self._callbacks = ['{0} = ${{ {0} }}'.format(attr) for attr in blk_io.callbacks]
-
- params = {}
- for param in list(self._params):
- if hasattr(param, '__epy_param__'):
- params[param.get_key()] = param
- self._params.remove(param)
-
- for key, value in blk_io.params:
- try:
- param = params[key]
- param.set_default(value)
- except KeyError: # need to make a new param
- name = key.replace('_', ' ').title()
- n = odict(dict(name=name, key=key, type='raw', value=value))
- param = platform.Param(block=self, n=n)
- setattr(param, '__epy_param__', True)
- self._params.append(param)
-
- def update_ports(label, ports, port_specs, direction):
- ports_to_remove = list(ports)
- iter_ports = iter(ports)
- ports_new = []
- port_current = next(iter_ports, None)
- for key, port_type, vlen in port_specs:
- reuse_port = (
- port_current is not None and
- port_current.get_type() == port_type and
- port_current.get_vlen() == vlen and
- (key.isdigit() or port_current.get_key() == key)
- )
- if reuse_port:
- ports_to_remove.remove(port_current)
- port, port_current = port_current, next(iter_ports, None)
- else:
- n = odict(dict(name=label + str(key), type=port_type, key=key))
- if port_type == 'message':
- n['name'] = key
- n['optional'] = '1'
- if vlen > 1:
- n['vlen'] = str(vlen)
- port = platform.Port(block=self, n=n, dir=direction)
- ports_new.append(port)
- # replace old port list with new one
- del ports[:]
- ports.extend(ports_new)
- # remove excess port connections
- for port in ports_to_remove:
- for connection in port.get_connections():
- flowgraph.remove_element(connection)
-
- update_ports('in', self.get_sinks(), blk_io.sinks, 'sink')
- update_ports('out', self.get_sources(), blk_io.sources, 'source')
- self.rewrite()
-
- def back_ofthe_bus(self, portlist):
- portlist.sort(key=lambda p: p._type == 'bus')
-
- def filter_bus_port(self, ports):
- buslist = [p for p in ports if p._type == 'bus']
- return buslist or ports
-
- # Main functions to get and set the block state
- # Also kept get_enabled and set_enabled to keep compatibility
- def get_state(self):
- """
- Gets the block's current state.
-
- Returns:
- ENABLED - 0
- BYPASSED - 1
- DISABLED - 2
- """
- try:
- return int(eval(self.get_param('_enabled').get_value()))
- except:
- return BLOCK_ENABLED
-
- def set_state(self, state):
- """
- Sets the state for the block.
-
- Args:
- ENABLED - 0
- BYPASSED - 1
- DISABLED - 2
- """
- if state in [BLOCK_ENABLED, BLOCK_BYPASSED, BLOCK_DISABLED]:
- self.get_param('_enabled').set_value(str(state))
- else:
- self.get_param('_enabled').set_value(str(BLOCK_ENABLED))
-
- # Enable/Disable Aliases
- def get_enabled(self):
- """
- Get the enabled state of the block.
-
- Returns:
- true for enabled
- """
- return not (self.get_state() == BLOCK_DISABLED)
-
- def set_enabled(self, enabled):
- """
- Set the enabled state of the block.
-
- Args:
- enabled: true for enabled
-
- Returns:
- True if block changed state
- """
- old_state = self.get_state()
- new_state = BLOCK_ENABLED if enabled else BLOCK_DISABLED
- self.set_state(new_state)
- return old_state != new_state
-
- # Block bypassing
- def get_bypassed(self):
- """
- Check if the block is bypassed
- """
- return self.get_state() == BLOCK_BYPASSED
-
- def set_bypassed(self):
- """
- Bypass the block
-
- Returns:
- True if block chagnes state
- """
- if self.get_state() != BLOCK_BYPASSED and self.can_bypass():
- self.set_state(BLOCK_BYPASSED)
- return True
- return False
-
- def can_bypass(self):
- """ Check the number of sinks and sources and see if this block can be bypassed """
- # Check to make sure this is a single path block
- # Could possibly support 1 to many blocks
- if len(self.get_sources()) != 1 or len(self.get_sinks()) != 1:
- return False
- if not (self.get_sources()[0].get_type() == self.get_sinks()[0].get_type()):
- return False
- if self.bypass_disabled():
- return False
- return True
-
- def __str__(self):
- return 'Block - {} - {}({})'.format(self.get_id(), self.get_name(), self.get_key())
-
- def get_id(self):
- return self.get_param('id').get_value()
-
- def get_name(self):
- return self._name
-
- def get_key(self):
- return self._key
-
- def get_ports(self):
- return self.get_sources() + self.get_sinks()
-
- def get_ports_gui(self):
- return self.filter_bus_port(self.get_sources()) + self.filter_bus_port(self.get_sinks())
-
- def get_children(self):
- return self.get_ports() + self.get_params()
-
- def get_children_gui(self):
- return self.get_ports_gui() + self.get_params()
-
- def get_block_wrapper_path(self):
- return self._block_wrapper_path
-
- def get_comment(self):
- return self.get_param('comment').get_value()
-
- def get_flags(self):
- return self._flags
-
- def throtteling(self):
- return BLOCK_FLAG_THROTTLE in self._flags
-
- def bypass_disabled(self):
- return BLOCK_FLAG_DISABLE_BYPASS in self._flags
-
- @property
- def is_deprecated(self):
- return BLOCK_FLAG_DEPRECATED in self._flags
-
- ##############################################
- # Access Params
- ##############################################
- def get_param_tab_labels(self):
- return self._param_tab_labels
-
- def get_param_keys(self):
- return _get_keys(self._params)
-
- def get_param(self, key):
- return _get_elem(self._params, key)
-
- def get_params(self):
- return self._params
-
- def has_param(self, key):
- try:
- _get_elem(self._params, key)
- return True
- except:
- return False
-
- ##############################################
- # Access Sinks
- ##############################################
- def get_sink_keys(self):
- return _get_keys(self._sinks)
-
- def get_sink(self, key):
- return _get_elem(self._sinks, key)
-
- def get_sinks(self):
- return self._sinks
-
- def get_sinks_gui(self):
- return self.filter_bus_port(self.get_sinks())
-
- ##############################################
- # Access Sources
- ##############################################
- def get_source_keys(self):
- return _get_keys(self._sources)
-
- def get_source(self, key):
- return _get_elem(self._sources, key)
-
- def get_sources(self):
- return self._sources
-
- def get_sources_gui(self):
- return self.filter_bus_port(self.get_sources())
-
- def get_connections(self):
- return sum([port.get_connections() for port in self.get_ports()], [])
-
- def resolve_dependencies(self, tmpl):
- """
- Resolve a parameter dependency with cheetah templates.
-
- Args:
- tmpl: the string with dependencies
-
- Returns:
- the resolved value
- """
- tmpl = str(tmpl)
- if '$' not in tmpl:
- return tmpl
- n = dict((param.get_key(), param.template_arg)
- for param in self.get_params()) # TODO: cache that
- try:
- return str(Template(tmpl, n))
- except Exception as err:
- return "Template error: {}\n {}".format(tmpl, err)
-
- ##############################################
- # Controller Modify
- ##############################################
- def type_controller_modify(self, direction):
- """
- Change the type controller.
-
- Args:
- direction: +1 or -1
-
- Returns:
- true for change
- """
- changed = False
- type_param = None
- for param in filter(lambda p: p.is_enum(), self.get_params()):
- children = self.get_ports() + self.get_params()
- # Priority to the type controller
- if param.get_key() in ' '.join(map(lambda p: p._type, children)): type_param = param
- # Use param if type param is unset
- if not type_param:
- type_param = param
- if type_param:
- # Try to increment the enum by direction
- try:
- keys = type_param.get_option_keys()
- old_index = keys.index(type_param.get_value())
- new_index = (old_index + direction + len(keys)) % len(keys)
- type_param.set_value(keys[new_index])
- changed = True
- except:
- pass
- return changed
-
- def form_bus_structure(self, direc):
- if direc == 'source':
- get_p = self.get_sources
- get_p_gui = self.get_sources_gui
- bus_structure = self.get_bus_structure('source')
- else:
- get_p = self.get_sinks
- get_p_gui = self.get_sinks_gui
- bus_structure = self.get_bus_structure('sink')
-
- struct = [range(len(get_p()))]
- if True in map(lambda a: isinstance(a.get_nports(), int), get_p()):
- structlet = []
- last = 0
- for j in [i.get_nports() for i in get_p() if isinstance(i.get_nports(), int)]:
- structlet.extend(map(lambda a: a+last, range(j)))
- last = structlet[-1] + 1
- struct = [structlet]
- if bus_structure:
-
- struct = bus_structure
-
- self.current_bus_structure[direc] = struct
- return struct
-
- def bussify(self, n, direc):
- if direc == 'source':
- get_p = self.get_sources
- get_p_gui = self.get_sources_gui
- bus_structure = self.get_bus_structure('source')
- else:
- get_p = self.get_sinks
- get_p_gui = self.get_sinks_gui
- bus_structure = self.get_bus_structure('sink')
-
- for elt in get_p():
- for connect in elt.get_connections():
- self.get_parent().remove_element(connect)
-
- if ('bus' not in map(lambda a: a.get_type(), get_p())) and len(get_p()) > 0:
- struct = self.form_bus_structure(direc)
- self.current_bus_structure[direc] = struct
- if get_p()[0].get_nports():
- n['nports'] = str(1)
-
- for i in range(len(struct)):
- n['key'] = str(len(get_p()))
- n = odict(n)
- port = self.get_parent().get_parent().Port(block=self, n=n, dir=direc)
- get_p().append(port)
- elif 'bus' in map(lambda a: a.get_type(), get_p()):
- for elt in get_p_gui():
- get_p().remove(elt)
- self.current_bus_structure[direc] = ''
-
- ##############################################
- # Import/Export Methods
- ##############################################
- def export_data(self):
- """
- Export this block's params to nested data.
-
- Returns:
- a nested data odict
- """
- n = odict()
- n['key'] = self.get_key()
- n['param'] = map(lambda p: p.export_data(), sorted(self.get_params(), key=str))
- if 'bus' in map(lambda a: a.get_type(), self.get_sinks()):
- n['bus_sink'] = str(1)
- if 'bus' in map(lambda a: a.get_type(), self.get_sources()):
- n['bus_source'] = str(1)
- return n
-
- def get_hash(self):
- return hash(tuple(map(hash, self.get_params())))
-
- def import_data(self, n):
- """
- Import this block's params from nested data.
- Any param keys that do not exist will be ignored.
- Since params can be dynamically created based another param,
- call rewrite, and repeat the load until the params stick.
- This call to rewrite will also create any dynamic ports
- that are needed for the connections creation phase.
-
- Args:
- n: the nested data odict
- """
- my_hash = 0
- while self.get_hash() != my_hash:
- params_n = n.findall('param')
- for param_n in params_n:
- key = param_n.find('key')
- value = param_n.find('value')
- # The key must exist in this block's params
- if key in self.get_param_keys():
- self.get_param(key).set_value(value)
- # Store hash and call rewrite
- my_hash = self.get_hash()
- self.rewrite()
- bussinks = n.findall('bus_sink')
- if len(bussinks) > 0 and not self._bussify_sink:
- self.bussify({'name': 'bus', 'type': 'bus'}, 'sink')
- elif len(bussinks) > 0:
- self.bussify({'name': 'bus', 'type': 'bus'}, 'sink')
- self.bussify({'name': 'bus', 'type': 'bus'}, 'sink')
- bussrcs = n.findall('bus_source')
- if len(bussrcs) > 0 and not self._bussify_source:
- self.bussify({'name': 'bus', 'type': 'bus'}, 'source')
- elif len(bussrcs) > 0:
- self.bussify({'name': 'bus', 'type': 'bus'}, 'source')
- self.bussify({'name': 'bus', 'type': 'bus'}, 'source')
diff --git a/grc/core/CMakeLists.txt b/grc/core/CMakeLists.txt
deleted file mode 100644
index f34012787..000000000
--- a/grc/core/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright 2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-file(GLOB py_files "*.py")
-
-GR_PYTHON_INSTALL(
- FILES ${py_files}
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core
-)
-
-file(GLOB dtd_files "*.dtd")
-
-install(
- FILES ${dtd_files} default_flow_graph.grc
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core
-)
-
-add_subdirectory(generator)
-add_subdirectory(utils)
diff --git a/grc/core/Config.py b/grc/core/Config.py
index 744ad06ba..4accb74c6 100644
--- a/grc/core/Config.py
+++ b/grc/core/Config.py
@@ -1,5 +1,4 @@
-"""
-Copyright 2016 Free Software Foundation, Inc.
+"""Copyright 2016 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
@@ -17,6 +16,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
+from __future__ import absolute_import
+
import os
from os.path import expanduser, normpath, expandvars, exists
@@ -24,16 +25,14 @@ from . import Constants
class Config(object):
-
- key = 'grc'
name = 'GNU Radio Companion (no gui)'
license = __doc__.strip()
website = 'http://gnuradio.org'
hier_block_lib_dir = os.environ.get('GRC_HIER_PATH', Constants.DEFAULT_HIER_BLOCK_LIB_DIR)
- def __init__(self, prefs_file, version, version_parts=None, name=None):
- self.prefs = prefs_file
+ def __init__(self, version, version_parts=None, name=None, prefs=None):
+ self._gr_prefs = prefs if prefs else DummyPrefs()
self.version = version
self.version_parts = version_parts or version[1:].split('-', 1)[0].split('.')[:3]
if name:
@@ -46,8 +45,8 @@ class Config(object):
paths_sources = (
self.hier_block_lib_dir,
os.environ.get('GRC_BLOCKS_PATH', ''),
- self.prefs.get_string('grc', 'local_blocks_path', ''),
- self.prefs.get_string('grc', 'global_blocks_path', ''),
+ self._gr_prefs.get_string('grc', 'local_blocks_path', ''),
+ self._gr_prefs.get_string('grc', 'global_blocks_path', ''),
)
collected_paths = sum((paths.split(path_list_sep)
@@ -62,7 +61,22 @@ class Config(object):
def default_flow_graph(self):
user_default = (
os.environ.get('GRC_DEFAULT_FLOW_GRAPH') or
- self.prefs.get_string('grc', 'default_flow_graph', '') or
+ self._gr_prefs.get_string('grc', 'default_flow_graph', '') or
os.path.join(self.hier_block_lib_dir, 'default_flow_graph.grc')
)
return user_default if exists(user_default) else Constants.DEFAULT_FLOW_GRAPH
+
+
+class DummyPrefs(object):
+
+ def get_string(self, category, item, default):
+ return str(default)
+
+ def set_string(self, category, item, value):
+ pass
+
+ def get_long(self, category, item, default):
+ return int(default)
+
+ def save(self):
+ pass
diff --git a/grc/core/Connection.py b/grc/core/Connection.py
index c028d89dd..01baaaf8f 100644
--- a/grc/core/Connection.py
+++ b/grc/core/Connection.py
@@ -17,128 +17,95 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-from . import Constants
-from .Element import Element
-from .utils import odict
+from __future__ import absolute_import
+
+from .base import Element
+from .utils.descriptors import lazy_property
class Connection(Element):
is_connection = True
- def __init__(self, flow_graph, porta, portb):
+ def __init__(self, parent, source, sink):
"""
Make a new connection given the parent and 2 ports.
Args:
flow_graph: the parent of this element
- porta: a port (any direction)
- portb: a port (any direction)
+ source: a port (any direction)
+ sink: a port (any direction)
@throws Error cannot make connection
Returns:
a new connection
"""
- Element.__init__(self, flow_graph)
- source = sink = None
- # Separate the source and sink
- for port in (porta, portb):
- if port.is_source:
- source = port
- else:
- sink = port
- if not source:
+ Element.__init__(self, parent)
+
+ if not source.is_source:
+ source, sink = sink, source
+ if not source.is_source:
raise ValueError('Connection could not isolate source')
- if not sink:
+ if not sink.is_sink:
raise ValueError('Connection could not isolate sink')
- busses = len(filter(lambda a: a.get_type() == 'bus', [source, sink])) % 2
- if not busses == 0:
- raise ValueError('busses must get with busses')
-
- if not len(source.get_associated_ports()) == len(sink.get_associated_ports()):
- raise ValueError('port connections must have same cardinality')
- # Ensure that this connection (source -> sink) is unique
- for connection in flow_graph.connections:
- if connection.get_source() is source and connection.get_sink() is sink:
- raise LookupError('This connection between source and sink is not unique.')
- self._source = source
- self._sink = sink
- if source.get_type() == 'bus':
-
- sources = source.get_associated_ports()
- sinks = sink.get_associated_ports()
-
- for i in range(len(sources)):
- try:
- flow_graph.connect(sources[i], sinks[i])
- except:
- pass
+
+ self.source_port = source
+ self.sink_port = sink
def __str__(self):
return 'Connection (\n\t{}\n\t\t{}\n\t{}\n\t\t{}\n)'.format(
- self.get_source().get_parent(),
- self.get_source(),
- self.get_sink().get_parent(),
- self.get_sink(),
+ self.source_block, self.source_port, self.sink_block, self.sink_port,
)
- def is_bus(self):
- return self.get_source().get_type() == self.get_sink().get_type() == 'bus'
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.source_port == other.source_port and self.sink_port == other.sink_port
- def validate(self):
- """
- Validate the connections.
- The ports must match in io size.
- """
- """
- Validate the connections.
- The ports must match in type.
- """
- Element.validate(self)
- platform = self.get_parent().get_parent()
- source_domain = self.get_source().get_domain()
- sink_domain = self.get_sink().get_domain()
- if (source_domain, sink_domain) not in platform.connection_templates:
- self.add_error_message('No connection known for domains "{}", "{}"'.format(
- source_domain, sink_domain))
- too_many_other_sinks = (
- not platform.domains.get(source_domain, []).get('multiple_sinks', False) and
- len(self.get_source().get_enabled_connections()) > 1
- )
- too_many_other_sources = (
- not platform.domains.get(sink_domain, []).get('multiple_sources', False) and
- len(self.get_sink().get_enabled_connections()) > 1
- )
- if too_many_other_sinks:
- self.add_error_message(
- 'Domain "{}" can have only one downstream block'.format(source_domain))
- if too_many_other_sources:
- self.add_error_message(
- 'Domain "{}" can have only one upstream block'.format(sink_domain))
-
- source_size = Constants.TYPE_TO_SIZEOF[self.get_source().get_type()] * self.get_source().get_vlen()
- sink_size = Constants.TYPE_TO_SIZEOF[self.get_sink().get_type()] * self.get_sink().get_vlen()
- if source_size != sink_size:
- self.add_error_message('Source IO size "{}" does not match sink IO size "{}".'.format(source_size, sink_size))
+ def __hash__(self):
+ return hash((self.source_port, self.sink_port))
+
+ def __iter__(self):
+ return iter((self.source_port, self.sink_port))
+
+ @lazy_property
+ def source_block(self):
+ return self.source_port.parent_block
+
+ @lazy_property
+ def sink_block(self):
+ return self.sink_port.parent_block
- def get_enabled(self):
+ @lazy_property
+ def type(self):
+ return self.source_port.domain, self.sink_port.domain
+
+ @property
+ def enabled(self):
"""
Get the enabled state of this connection.
Returns:
true if source and sink blocks are enabled
"""
- return self.get_source().get_parent().get_enabled() and \
- self.get_sink().get_parent().get_enabled()
+ return self.source_block.enabled and self.sink_block.enabled
- #############################
- # Access Ports
- #############################
- def get_sink(self):
- return self._sink
+ def validate(self):
+ """
+ Validate the connections.
+ The ports must match in io size.
+ """
+ Element.validate(self)
+ platform = self.parent_platform
- def get_source(self):
- return self._source
+ if self.type not in platform.connection_templates:
+ self.add_error_message('No connection known between domains "{}" and "{}"'
+ ''.format(*self.type))
+
+ source_size = self.source_port.item_size
+ sink_size = self.sink_port.item_size
+ if source_size != sink_size:
+ self.add_error_message('Source IO size "{}" does not match sink IO size "{}".'.format(source_size, sink_size))
##############################################
# Import/Export Methods
@@ -150,9 +117,7 @@ class Connection(Element):
Returns:
a nested data odict
"""
- n = odict()
- n['source_block_id'] = self.get_source().get_parent().get_id()
- n['sink_block_id'] = self.get_sink().get_parent().get_id()
- n['source_key'] = self.get_source().get_key()
- n['sink_key'] = self.get_sink().get_key()
- return n
+ return (
+ self.source_block.name, self.source_port.key,
+ self.sink_block.name, self.sink_port.key
+ )
diff --git a/grc/core/Constants.py b/grc/core/Constants.py
index 425415468..127e0e05f 100644
--- a/grc/core/Constants.py
+++ b/grc/core/Constants.py
@@ -17,19 +17,24 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
+from __future__ import absolute_import
+
import os
-import numpy
+import numbers
import stat
+import numpy
+
+
# Data files
DATA_DIR = os.path.dirname(__file__)
-FLOW_GRAPH_DTD = os.path.join(DATA_DIR, 'flow_graph.dtd')
-BLOCK_TREE_DTD = os.path.join(DATA_DIR, 'block_tree.dtd')
BLOCK_DTD = os.path.join(DATA_DIR, 'block.dtd')
DEFAULT_FLOW_GRAPH = os.path.join(DATA_DIR, 'default_flow_graph.grc')
DEFAULT_HIER_BLOCK_LIB_DIR = os.path.expanduser('~/.grc_gnuradio')
-DOMAIN_DTD = os.path.join(DATA_DIR, 'domain.dtd')
+CACHE_FILE = os.path.expanduser('~/.cache/grc_gnuradio/cache.json')
+
+BLOCK_DESCRIPTION_FILE_FORMAT_VERSION = 1
# File format versions:
# 0: undefined / legacy
# 1: non-numeric message port keys (label is used instead)
@@ -41,35 +46,35 @@ ADVANCED_PARAM_TAB = "Advanced"
DEFAULT_BLOCK_MODULE_NAME = '(no module specified)'
# Port domains
-GR_STREAM_DOMAIN = "gr_stream"
-GR_MESSAGE_DOMAIN = "gr_message"
+GR_STREAM_DOMAIN = "stream"
+GR_MESSAGE_DOMAIN = "message"
DEFAULT_DOMAIN = GR_STREAM_DOMAIN
-BLOCK_FLAG_THROTTLE = 'throttle'
-BLOCK_FLAG_DISABLE_BYPASS = 'disable_bypass'
-BLOCK_FLAG_NEED_QT_GUI = 'need_qt_gui'
-BLOCK_FLAG_DEPRECATED = 'deprecated'
-
-# Block States
-BLOCK_DISABLED = 0
-BLOCK_ENABLED = 1
-BLOCK_BYPASSED = 2
-
# File creation modes
TOP_BLOCK_FILE_MODE = stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP | \
stat.S_IWGRP | stat.S_IXGRP | stat.S_IROTH
HIER_BLOCK_FILE_MODE = stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IWGRP | stat.S_IROTH
+PARAM_TYPE_NAMES = {
+ 'raw', 'enum',
+ 'complex', 'real', 'float', 'int',
+ 'complex_vector', 'real_vector', 'float_vector', 'int_vector',
+ 'hex', 'string', 'bool',
+ 'file_open', 'file_save', '_multiline', '_multiline_python_external',
+ 'id', 'stream_id',
+ 'gui_hint',
+ 'import',
+}
+
+PARAM_TYPE_MAP = {
+ 'complex': numbers.Complex,
+ 'float': numbers.Real,
+ 'real': numbers.Real,
+ 'int': numbers.Integral,
+}
+
# Define types, native python + numpy
VECTOR_TYPES = (tuple, list, set, numpy.ndarray)
-COMPLEX_TYPES = [complex, numpy.complex, numpy.complex64, numpy.complex128]
-REAL_TYPES = [float, numpy.float, numpy.float32, numpy.float64]
-INT_TYPES = [int, long, numpy.int, numpy.int8, numpy.int16, numpy.int32, numpy.uint64,
- numpy.uint, numpy.uint8, numpy.uint16, numpy.uint32, numpy.uint64]
-# Cast to tuple for isinstance, concat subtypes
-COMPLEX_TYPES = tuple(COMPLEX_TYPES + REAL_TYPES + INT_TYPES)
-REAL_TYPES = tuple(REAL_TYPES + INT_TYPES)
-INT_TYPES = tuple(INT_TYPES)
# Updating colors. Using the standard color palette from:
# http://www.google.com/design/spec/style/color.html#color-color-palette
@@ -95,54 +100,32 @@ GRC_COLOR_GREY = '#BDBDBD'
GRC_COLOR_WHITE = '#FFFFFF'
CORE_TYPES = ( # name, key, sizeof, color
- ('Complex Float 64', 'fc64', 16, GRC_COLOR_BROWN),
- ('Complex Float 32', 'fc32', 8, GRC_COLOR_BLUE),
- ('Complex Integer 64', 'sc64', 16, GRC_COLOR_LIGHT_GREEN),
- ('Complex Integer 32', 'sc32', 8, GRC_COLOR_GREEN),
- ('Complex Integer 16', 'sc16', 4, GRC_COLOR_AMBER),
- ('Complex Integer 8', 'sc8', 2, GRC_COLOR_PURPLE),
- ('Float 64', 'f64', 8, GRC_COLOR_CYAN),
- ('Float 32', 'f32', 4, GRC_COLOR_ORANGE),
- ('Integer 64', 's64', 8, GRC_COLOR_LIME),
- ('Integer 32', 's32', 4, GRC_COLOR_TEAL),
- ('Integer 16', 's16', 2, GRC_COLOR_YELLOW),
- ('Integer 8', 's8', 1, GRC_COLOR_PURPLE_A400),
- ('Bits (unpacked byte)', 'bit', 1, GRC_COLOR_PURPLE_A100),
- ('Async Message', 'message', 0, GRC_COLOR_GREY),
- ('Bus Connection', 'bus', 0, GRC_COLOR_WHITE),
- ('Wildcard', '', 0, GRC_COLOR_WHITE),
+ ('Complex Float 64', 'fc64', 16, GRC_COLOR_BROWN),
+ ('Complex Float 32', 'fc32', 8, GRC_COLOR_BLUE),
+ ('Complex Integer 64', 'sc64', 16, GRC_COLOR_LIGHT_GREEN),
+ ('Complex Integer 32', 'sc32', 8, GRC_COLOR_GREEN),
+ ('Complex Integer 16', 'sc16', 4, GRC_COLOR_AMBER),
+ ('Complex Integer 8', 'sc8', 2, GRC_COLOR_PURPLE),
+ ('Float 64', 'f64', 8, GRC_COLOR_CYAN),
+ ('Float 32', 'f32', 4, GRC_COLOR_ORANGE),
+ ('Integer 64', 's64', 8, GRC_COLOR_LIME),
+ ('Integer 32', 's32', 4, GRC_COLOR_TEAL),
+ ('Integer 16', 's16', 2, GRC_COLOR_YELLOW),
+ ('Integer 8', 's8', 1, GRC_COLOR_PURPLE_A400),
+ ('Bits (unpacked byte)', 'bit', 1, GRC_COLOR_PURPLE_A100),
+ ('Async Message', 'message', 0, GRC_COLOR_GREY),
+ ('Bus Connection', 'bus', 0, GRC_COLOR_WHITE),
+ ('Wildcard', '', 0, GRC_COLOR_WHITE),
)
ALIAS_TYPES = {
'complex': (8, GRC_COLOR_BLUE),
- 'float': (4, GRC_COLOR_ORANGE),
- 'int': (4, GRC_COLOR_TEAL),
- 'short': (2, GRC_COLOR_YELLOW),
- 'byte': (1, GRC_COLOR_PURPLE_A400),
- 'bits': (1, GRC_COLOR_PURPLE_A100),
+ 'float': (4, GRC_COLOR_ORANGE),
+ 'int': (4, GRC_COLOR_TEAL),
+ 'short': (2, GRC_COLOR_YELLOW),
+ 'byte': (1, GRC_COLOR_PURPLE_A400),
+ 'bits': (1, GRC_COLOR_PURPLE_A100),
}
-TYPE_TO_COLOR = dict()
-TYPE_TO_SIZEOF = dict()
-
-for name, key, sizeof, color in CORE_TYPES:
- TYPE_TO_COLOR[key] = color
- TYPE_TO_SIZEOF[key] = sizeof
-
-for key, (sizeof, color) in ALIAS_TYPES.iteritems():
- TYPE_TO_COLOR[key] = color
- TYPE_TO_SIZEOF[key] = sizeof
-
-# Coloring
-COMPLEX_COLOR_SPEC = '#3399FF'
-FLOAT_COLOR_SPEC = '#FF8C69'
-INT_COLOR_SPEC = '#00FF99'
-SHORT_COLOR_SPEC = '#FFFF66'
-BYTE_COLOR_SPEC = '#FF66FF'
-COMPLEX_VECTOR_COLOR_SPEC = '#3399AA'
-FLOAT_VECTOR_COLOR_SPEC = '#CC8C69'
-INT_VECTOR_COLOR_SPEC = '#00CC99'
-SHORT_VECTOR_COLOR_SPEC = '#CCCC33'
-BYTE_VECTOR_COLOR_SPEC = '#CC66CC'
-ID_COLOR_SPEC = '#DDDDDD'
-WILDCARD_COLOR_SPEC = '#FFFFFF'
+TYPE_TO_SIZEOF = {key: sizeof for name, key, sizeof, color in CORE_TYPES}
+TYPE_TO_SIZEOF.update((key, sizeof) for key, (sizeof, _) in ALIAS_TYPES.items())
diff --git a/grc/core/Element.py b/grc/core/Element.py
deleted file mode 100644
index 67c36e12b..000000000
--- a/grc/core/Element.py
+++ /dev/null
@@ -1,114 +0,0 @@
-"""
-Copyright 2008, 2009, 2015 Free Software Foundation, Inc.
-This file is part of GNU Radio
-
-GNU Radio Companion 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 2
-of the License, or (at your option) any later version.
-
-GNU Radio Companion 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 program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-"""
-
-
-class Element(object):
-
- def __init__(self, parent=None):
- self._parent = parent
- self._error_messages = list()
-
- ##################################################
- # Element Validation API
- ##################################################
- def validate(self):
- """
- Validate this element and call validate on all children.
- Call this base method before adding error messages in the subclass.
- """
- del self._error_messages[:]
- for child in self.get_children():
- child.validate()
-
- def is_valid(self):
- """
- Is this element valid?
-
- Returns:
- true when the element is enabled and has no error messages or is bypassed
- """
- return (not self.get_error_messages() or not self.get_enabled()) or self.get_bypassed()
-
- def add_error_message(self, msg):
- """
- Add an error message to the list of errors.
-
- Args:
- msg: the error message string
- """
- self._error_messages.append(msg)
-
- def get_error_messages(self):
- """
- Get the list of error messages from this element and all of its children.
- Do not include the error messages from disabled or bypassed children.
- Cleverly indent the children error messages for printing purposes.
-
- Returns:
- a list of error message strings
- """
- error_messages = list(self._error_messages) # Make a copy
- for child in filter(lambda c: c.get_enabled() and not c.get_bypassed(), self.get_children()):
- for msg in child.get_error_messages():
- error_messages.append("{}:\n\t{}".format(child, msg.replace("\n", "\n\t")))
- return error_messages
-
- def rewrite(self):
- """
- Rewrite this element and call rewrite on all children.
- Call this base method before rewriting the element.
- """
- for child in self.get_children():
- child.rewrite()
-
- def get_enabled(self):
- return True
-
- def get_bypassed(self):
- return False
-
- ##############################################
- # Tree-like API
- ##############################################
- def get_parent(self):
- return self._parent
-
- def get_children(self):
- return list()
-
- ##############################################
- # Type testing
- ##############################################
- is_platform = False
-
- is_flow_graph = False
-
- is_block = False
-
- is_dummy_block = False
-
- is_connection = False
-
- is_port = False
-
- is_param = False
-
- is_variable = False
-
- is_import = False
diff --git a/grc/core/FlowGraph.py b/grc/core/FlowGraph.py
index ecae11cf1..8c59ec0be 100644
--- a/grc/core/FlowGraph.py
+++ b/grc/core/FlowGraph.py
@@ -15,69 +15,57 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+from __future__ import absolute_import, print_function
+
+import collections
import imp
-from itertools import ifilter, chain
-from operator import methodcaller, attrgetter
-import re
+import itertools
import sys
-import time
+from operator import methodcaller, attrgetter
-from . import Messages
+from . import Messages, blocks
from .Constants import FLOW_GRAPH_FILE_FORMAT_VERSION
-from .Element import Element
-from .utils import odict, expr_utils, shlex
-
-_parameter_matcher = re.compile('^(parameter)$')
-_monitors_searcher = re.compile('(ctrlport_monitor)')
-_bussink_searcher = re.compile('^(bus_sink)$')
-_bussrc_searcher = re.compile('^(bus_source)$')
-_bus_struct_sink_searcher = re.compile('^(bus_structure_sink)$')
-_bus_struct_src_searcher = re.compile('^(bus_structure_source)$')
+from .base import Element
+from .utils import expr_utils
+from .utils.backports import shlex
class FlowGraph(Element):
is_flow_graph = True
- def __init__(self, platform):
+ def __init__(self, parent):
"""
Make a flow graph from the arguments.
Args:
- platform: a platforms with blocks and contrcutors
+ parent: a platforms with blocks and element factories
Returns:
the flow graph object
"""
- Element.__init__(self, platform)
- self._elements = []
- self._timestamp = time.ctime()
+ Element.__init__(self, parent)
+ self._options_block = self.parent_platform.make_block(self, 'options')
- self.platform = platform # todo: make this a lazy prop
- self.blocks = []
- self.connections = []
+ self.blocks = [self._options_block]
+ self.connections = set()
self._eval_cache = {}
self.namespace = {}
self.grc_file_path = ''
- self._options_block = self.new_block('options')
def __str__(self):
return 'FlowGraph - {}({})'.format(self.get_option('title'), self.get_option('id'))
- ##############################################
- # TODO: Move these to new generator package
- ##############################################
- def get_imports(self):
+ def imports(self):
"""
Get a set of all import statements in this flow graph namespace.
Returns:
- a set of import statements
+ a list of import statements
"""
- imports = sum([block.get_imports() for block in self.iter_enabled_blocks()], [])
- return sorted(set(imports))
+ return [block.templates.render('imports') for block in self.iter_enabled_blocks()]
def get_variables(self):
"""
@@ -87,8 +75,8 @@ class FlowGraph(Element):
Returns:
a sorted list of variable blocks in order of dependency (indep -> dep)
"""
- variables = filter(attrgetter('is_variable'), self.iter_enabled_blocks())
- return expr_utils.sort_objects(variables, methodcaller('get_id'), methodcaller('get_var_make'))
+ variables = [block for block in self.iter_enabled_blocks() if block.is_variable]
+ return expr_utils.sort_objects(variables, attrgetter('name'), methodcaller('get_var_make'))
def get_parameters(self):
"""
@@ -97,54 +85,27 @@ class FlowGraph(Element):
Returns:
a list of parameterized variables
"""
- parameters = filter(lambda b: _parameter_matcher.match(b.get_key()), self.iter_enabled_blocks())
+ parameters = [b for b in self.iter_enabled_blocks() if b.key == 'parameter']
return parameters
def get_monitors(self):
"""
Get a list of all ControlPort monitors
"""
- monitors = filter(lambda b: _monitors_searcher.search(b.get_key()),
- self.iter_enabled_blocks())
+ monitors = [b for b in self.iter_enabled_blocks() if 'ctrlport_monitor' in b.key]
return monitors
def get_python_modules(self):
"""Iterate over custom code block ID and Source"""
for block in self.iter_enabled_blocks():
- if block.get_key() == 'epy_module':
- yield block.get_id(), block.get_param('source_code').get_value()
-
- def get_bussink(self):
- bussink = filter(lambda b: _bussink_searcher.search(b.get_key()), self.get_enabled_blocks())
-
- for i in bussink:
- for j in i.get_params():
- if j.get_name() == 'On/Off' and j.get_value() == 'on':
- return True
- return False
-
- def get_bussrc(self):
- bussrc = filter(lambda b: _bussrc_searcher.search(b.get_key()), self.get_enabled_blocks())
-
- for i in bussrc:
- for j in i.get_params():
- if j.get_name() == 'On/Off' and j.get_value() == 'on':
- return True
- return False
-
- def get_bus_structure_sink(self):
- bussink = filter(lambda b: _bus_struct_sink_searcher.search(b.get_key()), self.get_enabled_blocks())
- return bussink
-
- def get_bus_structure_src(self):
- bussrc = filter(lambda b: _bus_struct_src_searcher.search(b.get_key()), self.get_enabled_blocks())
- return bussrc
+ if block.key == 'epy_module':
+ yield block.name, block.params[1].get_value()
def iter_enabled_blocks(self):
"""
Get an iterator of all blocks that are enabled and not bypassed.
"""
- return ifilter(methodcaller('get_enabled'), self.blocks)
+ return (block for block in self.blocks if block.enabled)
def get_enabled_blocks(self):
"""
@@ -162,7 +123,7 @@ class FlowGraph(Element):
Returns:
a list of blocks
"""
- return filter(methodcaller('get_bypassed'), self.blocks)
+ return [block for block in self.blocks if block.get_bypassed()]
def get_enabled_connections(self):
"""
@@ -171,7 +132,7 @@ class FlowGraph(Element):
Returns:
a list of connections
"""
- return filter(methodcaller('get_enabled'), self.connections)
+ return [connection for connection in self.connections if connection.enabled]
def get_option(self, key):
"""
@@ -184,7 +145,7 @@ class FlowGraph(Element):
Returns:
the value held by that param
"""
- return self._options_block.get_param(key).get_evaluated()
+ return self._options_block.params[key].get_evaluated()
def get_run_command(self, file_path, split=False):
run_command = self.get_option('run_command')
@@ -199,73 +160,59 @@ class FlowGraph(Element):
##############################################
# Access Elements
##############################################
- def get_block(self, id):
+ def get_block(self, name):
for block in self.blocks:
- if block.get_id() == id:
+ if block.name == name:
return block
- raise KeyError('No block with ID {!r}'.format(id))
+ raise KeyError('No block with name {!r}'.format(name))
def get_elements(self):
- """
- Get a list of all the elements.
- Always ensure that the options block is in the list (only once).
+ elements = list(self.blocks)
+ elements.extend(self.connections)
+ return elements
- Returns:
- the element list
- """
- options_block_count = self.blocks.count(self._options_block)
- if not options_block_count:
- self.blocks.append(self._options_block)
- for i in range(options_block_count-1):
- self.blocks.remove(self._options_block)
-
- return self.blocks + self.connections
-
- get_children = get_elements
+ def children(self):
+ return itertools.chain(self.iter_enabled_blocks(), self.connections)
def rewrite(self):
"""
Flag the namespace to be renewed.
"""
-
self.renew_namespace()
- for child in chain(self.blocks, self.connections):
- child.rewrite()
-
- self.bus_ports_rewrite()
+ Element.rewrite(self)
def renew_namespace(self):
namespace = {}
# Load imports
- for expr in self.get_imports():
+ for expr in self.imports():
try:
- exec expr in namespace
+ exec(expr, namespace)
except:
pass
for id, expr in self.get_python_modules():
try:
module = imp.new_module(id)
- exec expr in module.__dict__
+ exec(expr, module.__dict__)
namespace[id] = module
except:
pass
# Load parameters
np = {} # params don't know each other
- for parameter in self.get_parameters():
+ for parameter_block in self.get_parameters():
try:
- value = eval(parameter.get_param('value').to_code(), namespace)
- np[parameter.get_id()] = value
+ value = eval(parameter_block.params['value'].to_code(), namespace)
+ np[parameter_block.name] = value
except:
pass
namespace.update(np) # Merge param namespace
# Load variables
- for variable in self.get_variables():
+ for variable_block in self.get_variables():
try:
- value = eval(variable.get_var_value(), namespace)
- namespace[variable.get_id()] = value
+ value = eval(variable_block.value, namespace, variable_block.namespace)
+ namespace[variable_block.name] = value
except:
pass
@@ -273,39 +220,37 @@ class FlowGraph(Element):
self._eval_cache.clear()
self.namespace.update(namespace)
- def evaluate(self, expr):
+ def evaluate(self, expr, namespace=None, local_namespace=None):
"""
Evaluate the expression.
-
- Args:
- expr: the string expression
- @throw Exception bad expression
-
- Returns:
- the evaluated data
"""
# Evaluate
if not expr:
raise Exception('Cannot evaluate empty statement.')
- return self._eval_cache.setdefault(expr, eval(expr, self.namespace))
+ if namespace is not None:
+ return eval(expr, namespace, local_namespace)
+ else:
+ return self._eval_cache.setdefault(expr, eval(expr, self.namespace))
##############################################
# Add/remove stuff
##############################################
- def new_block(self, key):
+ def new_block(self, block_id, **kwargs):
"""
Get a new block of the specified key.
Add the block to the list of elements.
Args:
- key: the block key
+ block_id: the block key
Returns:
the new block or None if not found
"""
+ if block_id == 'options':
+ return self._options_block
try:
- block = self.platform.get_new_block(self, key)
+ block = self.parent_platform.make_block(self, block_id, **kwargs)
self.blocks.append(block)
except KeyError:
block = None
@@ -323,12 +268,17 @@ class FlowGraph(Element):
Returns:
the new connection
"""
-
- connection = self.platform.Connection(
- flow_graph=self, porta=porta, portb=portb)
- self.connections.append(connection)
+ connection = self.parent_platform.Connection(
+ parent=self, source=porta, sink=portb)
+ self.connections.add(connection)
return connection
+ def disconnect(self, *ports):
+ to_be_removed = [con for con in self.connections
+ if any(port in con for port in ports)]
+ for con in to_be_removed:
+ self.remove_element(con)
+
def remove_element(self, element):
"""
Remove the element from the list of elements.
@@ -336,22 +286,18 @@ class FlowGraph(Element):
If the element is a block, remove its connections.
If the element is a connection, just remove the connection.
"""
+ if element is self._options_block:
+ return
+
if element.is_port:
- # Found a port, set to parent signal block
- element = element.get_parent()
+ element = element.parent_block # remove parent block
if element in self.blocks:
# Remove block, remove all involved connections
- for port in element.get_ports():
- map(self.remove_element, port.get_connections())
+ self.disconnect(*element.ports())
self.blocks.remove(element)
elif element in self.connections:
- if element.is_bus():
- cons_list = []
- for i in map(lambda a: a.get_connections(), element.get_source().get_associated_ports()):
- cons_list.extend(i)
- map(self.remove_element, cons_list)
self.connections.remove(element)
##############################################
@@ -365,173 +311,107 @@ class FlowGraph(Element):
Returns:
a nested data odict
"""
- # sort blocks and connections for nicer diffs
- blocks = sorted(self.blocks, key=lambda b: (
- b.get_key() != 'options', # options to the front
- not b.get_key().startswith('variable'), # then vars
- str(b)
- ))
- connections = sorted(self.connections, key=str)
- n = odict()
- n['timestamp'] = self._timestamp
- n['block'] = [b.export_data() for b in blocks]
- n['connection'] = [c.export_data() for c in connections]
- instructions = odict({
- 'created': '.'.join(self.get_parent().config.version_parts),
- 'format': FLOW_GRAPH_FILE_FORMAT_VERSION,
- })
- return odict({'flow_graph': n, '_instructions': instructions})
-
- def import_data(self, n):
+ def block_order(b):
+ return not b.key.startswith('variable'), b.name # todo: vars still first ?!?
+
+ data = collections.OrderedDict()
+ data['options'] = self._options_block.export_data()
+ data['blocks'] = [b.export_data() for b in sorted(self.blocks, key=block_order)
+ if b is not self._options_block]
+ data['connections'] = sorted(c.export_data() for c in self.connections)
+ data['metadata'] = {'file_format': FLOW_GRAPH_FILE_FORMAT_VERSION}
+ return data
+
+ def _build_depending_hier_block(self, block_id):
+ # we're before the initial fg update(), so no evaluated values!
+ # --> use raw value instead
+ path_param = self._options_block.params['hier_block_src_path']
+ file_path = self.parent_platform.find_file_in_paths(
+ filename=block_id + '.grc',
+ paths=path_param.get_value(),
+ cwd=self.grc_file_path
+ )
+ if file_path: # grc file found. load and get block
+ self.parent_platform.load_and_generate_flow_graph(file_path, hier_only=True)
+ return self.new_block(block_id) # can be None
+
+ def import_data(self, data):
"""
Import blocks and connections into this flow graph.
- Clear this flowgraph of all previous blocks and connections.
+ Clear this flow graph of all previous blocks and connections.
Any blocks or connections in error will be ignored.
Args:
- n: the nested data odict
+ data: the nested data odict
"""
# Remove previous elements
del self.blocks[:]
- del self.connections[:]
- # set file format
- try:
- instructions = n.find('_instructions') or {}
- file_format = int(instructions.get('format', '0')) or _guess_file_format_1(n)
- except:
- file_format = 0
+ self.connections.clear()
- fg_n = n and n.find('flow_graph') or odict() # use blank data if none provided
- self._timestamp = fg_n.find('timestamp') or time.ctime()
+ file_format = data['metadata']['file_format']
# build the blocks
- self._options_block = self.new_block('options')
- for block_n in fg_n.findall('block'):
- key = block_n.find('key')
- block = self._options_block if key == 'options' else self.new_block(key)
-
- if not block:
- # we're before the initial fg update(), so no evaluated values!
- # --> use raw value instead
- path_param = self._options_block.get_param('hier_block_src_path')
- file_path = self.platform.find_file_in_paths(
- filename=key + '.grc',
- paths=path_param.get_value(),
- cwd=self.grc_file_path
- )
- if file_path: # grc file found. load and get block
- self.platform.load_and_generate_flow_graph(file_path, hier_only=True)
- block = self.new_block(key) # can be None
-
- if not block: # looks like this block key cannot be found
- # create a dummy block instead
- block = self.new_block('dummy_block')
- # Ugly ugly ugly
- _initialize_dummy_block(block, block_n)
- print('Block key "%s" not found' % key)
-
- block.import_data(block_n)
+ self._options_block.import_data(name='', **data.get('options', {}))
+ self.blocks.append(self._options_block)
+
+ for block_data in data.get('blocks', []):
+ block_id = block_data['id']
+ block = (
+ self.new_block(block_id) or
+ self._build_depending_hier_block(block_id) or
+ self.new_block(block_id='_dummy', missing_block_id=block_id, **block_data)
+ )
+
+ if isinstance(block, blocks.DummyBlock):
+ print('Block id "%s" not found' % block_id)
+
+ block.import_data(**block_data)
self.rewrite() # evaluate stuff like nports before adding connections
# build the connections
def verify_and_get_port(key, block, dir):
- ports = block.get_sinks() if dir == 'sink' else block.get_sources()
+ ports = block.sinks if dir == 'sink' else block.sources
for port in ports:
- if key == port.get_key():
+ if key == port.key or key + '0' == port.key:
break
- if not key.isdigit() and port.get_type() == '' and key == port.get_name():
+ if not key.isdigit() and port.dtype == '' and key == port.name:
break
else:
if block.is_dummy_block:
- port = _dummy_block_add_port(block, key, dir)
+ port = block.add_missing_port(key, dir)
else:
raise LookupError('%s key %r not in %s block keys' % (dir, key, dir))
return port
- errors = False
- for connection_n in fg_n.findall('connection'):
- # get the block ids and port keys
- source_block_id = connection_n.find('source_block_id')
- sink_block_id = connection_n.find('sink_block_id')
- source_key = connection_n.find('source_key')
- sink_key = connection_n.find('sink_key')
- try:
- source_block = self.get_block(source_block_id)
- sink_block = self.get_block(sink_block_id)
+ had_connect_errors = False
+ _blocks = {block.name: block for block in self.blocks}
+
+ try:
+ # TODO: Add better error handling if no connections exist in the flowgraph file.
+ for src_blk_id, src_port_id, snk_blk_id, snk_port_id in data.get('connections', []):
+ source_block = _blocks[src_blk_id]
+ sink_block = _blocks[snk_blk_id]
# fix old, numeric message ports keys
if file_format < 1:
- source_key, sink_key = _update_old_message_port_keys(
- source_key, sink_key, source_block, sink_block)
+ src_port_id, snk_port_id = _update_old_message_port_keys(
+ src_port_id, snk_port_id, source_block, sink_block)
# build the connection
- source_port = verify_and_get_port(source_key, source_block, 'source')
- sink_port = verify_and_get_port(sink_key, sink_block, 'sink')
+ source_port = verify_and_get_port(src_port_id, source_block, 'source')
+ sink_port = verify_and_get_port(snk_port_id, sink_block, 'sink')
+
self.connect(source_port, sink_port)
- except LookupError as e:
- Messages.send_error_load(
- 'Connection between {}({}) and {}({}) could not be made.\n\t{}'.format(
- source_block_id, source_key, sink_block_id, sink_key, e))
- errors = True
- self.rewrite() # global rewrite
- return errors
+ except (KeyError, LookupError) as e:
+ Messages.send_error_load(
+ 'Connection between {}({}) and {}({}) could not be made.\n\t{}'.format(
+ src_blk_id, src_port_id, snk_blk_id, snk_port_id, e))
+ had_connect_errors = True
- ##############################################
- # Needs to go
- ##############################################
- def bus_ports_rewrite(self):
- # todo: move to block.rewrite()
- for block in self.blocks:
- for direc in ['source', 'sink']:
- if direc == 'source':
- get_p = block.get_sources
- get_p_gui = block.get_sources_gui
- bus_structure = block.form_bus_structure('source')
- else:
- get_p = block.get_sinks
- get_p_gui = block.get_sinks_gui
- bus_structure = block.form_bus_structure('sink')
-
- if 'bus' in map(lambda a: a.get_type(), get_p_gui()):
- if len(get_p_gui()) > len(bus_structure):
- times = range(len(bus_structure), len(get_p_gui()))
- for i in times:
- for connect in get_p_gui()[-1].get_connections():
- block.get_parent().remove_element(connect)
- get_p().remove(get_p_gui()[-1])
- elif len(get_p_gui()) < len(bus_structure):
- n = {'name': 'bus', 'type': 'bus'}
- if True in map(
- lambda a: isinstance(a.get_nports(), int),
- get_p()):
- n['nports'] = str(1)
-
- times = range(len(get_p_gui()), len(bus_structure))
-
- for i in times:
- n['key'] = str(len(get_p()))
- n = odict(n)
- port = block.get_parent().get_parent().Port(
- block=block, n=n, dir=direc)
- get_p().append(port)
-
- if 'bus' in map(lambda a: a.get_type(),
- block.get_sources_gui()):
- for i in range(len(block.get_sources_gui())):
- if len(block.get_sources_gui()[
- i].get_connections()) > 0:
- source = block.get_sources_gui()[i]
- sink = []
-
- for j in range(len(source.get_connections())):
- sink.append(
- source.get_connections()[j].get_sink())
- for elt in source.get_connections():
- self.remove_element(elt)
- for j in sink:
- self.connect(source, j)
+ self.rewrite() # global rewrite
+ return had_connect_errors
def _update_old_message_port_keys(source_key, sink_key, source_block, sink_block):
@@ -548,55 +428,11 @@ def _update_old_message_port_keys(source_key, sink_key, source_block, sink_block
message port.
"""
try:
- # get ports using the "old way" (assuming liner indexed keys)
- source_port = source_block.get_sources()[int(source_key)]
- sink_port = sink_block.get_sinks()[int(sink_key)]
- if source_port.get_type() == "message" and sink_port.get_type() == "message":
- source_key, sink_key = source_port.get_key(), sink_port.get_key()
+ # get ports using the "old way" (assuming linear indexed keys)
+ source_port = source_block.sources[int(source_key)]
+ sink_port = sink_block.sinks[int(sink_key)]
+ if source_port.dtype == "message" and sink_port.dtype == "message":
+ source_key, sink_key = source_port.key, sink_port.key
except (ValueError, IndexError):
pass
return source_key, sink_key # do nothing
-
-
-def _guess_file_format_1(n):
- """
- Try to guess the file format for flow-graph files without version tag
- """
- try:
- has_non_numeric_message_keys = any(not (
- connection_n.find('source_key').isdigit() and
- connection_n.find('sink_key').isdigit()
- ) for connection_n in n.find('flow_graph').findall('connection'))
- if has_non_numeric_message_keys:
- return 1
- except:
- pass
- return 0
-
-
-def _initialize_dummy_block(block, block_n):
- """
- This is so ugly... dummy-fy a block
- Modify block object to get the behaviour for a missing block
- """
-
- block._key = block_n.find('key')
- block.is_dummy_block = lambda: True
- block.is_valid = lambda: False
- block.get_enabled = lambda: False
- for param_n in block_n.findall('param'):
- if param_n['key'] not in block.get_param_keys():
- new_param_n = odict({'key': param_n['key'], 'name': param_n['key'], 'type': 'string'})
- params = block.get_parent().get_parent().Param(block=block, n=new_param_n)
- block.get_params().append(params)
-
-
-def _dummy_block_add_port(block, key, dir):
- """ This is so ugly... Add a port to a dummy-field block """
- port_n = odict({'name': '?', 'key': key, 'type': ''})
- port = block.get_parent().get_parent().Port(block=block, n=port_n, dir=dir)
- if port.is_source:
- block.get_sources().append(port)
- else:
- block.get_sinks().append(port)
- return port
diff --git a/grc/core/Messages.py b/grc/core/Messages.py
index 8daa12c33..f546c3b62 100644
--- a/grc/core/Messages.py
+++ b/grc/core/Messages.py
@@ -16,9 +16,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+from __future__ import absolute_import
+
import traceback
import sys
-import os
# A list of functions that can receive a message.
MESSENGERS_LIST = list()
@@ -124,8 +125,8 @@ def send_fail_save(file_path):
send('>>> Error: Cannot save: %s\n' % file_path)
-def send_fail_connection():
- send('>>> Error: Cannot create connection.\n')
+def send_fail_connection(msg=''):
+ send('>>> Error: Cannot create connection.\n' + ('\t{}\n'.format(msg) if msg else ''))
def send_fail_load_preferences(prefs_file_path):
diff --git a/grc/core/Param.py b/grc/core/Param.py
deleted file mode 100644
index 207792587..000000000
--- a/grc/core/Param.py
+++ /dev/null
@@ -1,691 +0,0 @@
-"""
-Copyright 2008-2015 Free Software Foundation, Inc.
-This file is part of GNU Radio
-
-GNU Radio Companion 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 2
-of the License, or (at your option) any later version.
-
-GNU Radio Companion 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 program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-"""
-
-import ast
-import weakref
-import re
-
-from . import Constants
-from .Constants import VECTOR_TYPES, COMPLEX_TYPES, REAL_TYPES, INT_TYPES
-from .Element import Element
-from .utils import odict
-
-# Blacklist certain ids, its not complete, but should help
-import __builtin__
-
-
-ID_BLACKLIST = ['self', 'options', 'gr', 'math', 'firdes'] + dir(__builtin__)
-try:
- from gnuradio import gr
- ID_BLACKLIST.extend(attr for attr in dir(gr.top_block()) if not attr.startswith('_'))
-except ImportError:
- pass
-
-_check_id_matcher = re.compile('^[a-z|A-Z]\w*$')
-_show_id_matcher = re.compile('^(variable\w*|parameter|options|notebook)$')
-
-
-def _get_keys(lst):
- return [elem.get_key() for elem in lst]
-
-
-def _get_elem(lst, key):
- try:
- return lst[_get_keys(lst).index(key)]
- except ValueError:
- raise ValueError('Key "{}" not found in {}.'.format(key, _get_keys(lst)))
-
-
-def num_to_str(num):
- """ Display logic for numbers """
- def eng_notation(value, fmt='g'):
- """Convert a number to a string in engineering notation. E.g., 5e-9 -> 5n"""
- template = '{:' + fmt + '}{}'
- magnitude = abs(value)
- for exp, symbol in zip(range(9, -15-1, -3), 'GMk munpf'):
- factor = 10 ** exp
- if magnitude >= factor:
- return template.format(value / factor, symbol.strip())
- return template.format(value, '')
-
- if isinstance(num, COMPLEX_TYPES):
- num = complex(num) # Cast to python complex
- if num == 0:
- return '0'
- output = eng_notation(num.real) if num.real else ''
- output += eng_notation(num.imag, '+g' if output else 'g') + 'j' if num.imag else ''
- return output
- else:
- return str(num)
-
-
-class Option(Element):
-
- def __init__(self, param, n):
- Element.__init__(self, param)
- self._name = n.find('name')
- self._key = n.find('key')
- self._opts = dict()
- opts = n.findall('opt')
- # Test against opts when non enum
- if not self.get_parent().is_enum() and opts:
- raise Exception('Options for non-enum types cannot have sub-options')
- # Extract opts
- for opt in opts:
- # Separate the key:value
- try:
- key, value = opt.split(':')
- except:
- raise Exception('Error separating "{}" into key:value'.format(opt))
- # Test against repeated keys
- if key in self._opts:
- raise Exception('Key "{}" already exists in option'.format(key))
- # Store the option
- self._opts[key] = value
-
- def __str__(self):
- return 'Option {}({})'.format(self.get_name(), self.get_key())
-
- def get_name(self):
- return self._name
-
- def get_key(self):
- return self._key
-
- ##############################################
- # Access Opts
- ##############################################
- def get_opt_keys(self):
- return self._opts.keys()
-
- def get_opt(self, key):
- return self._opts[key]
-
- def get_opts(self):
- return self._opts.values()
-
-
-class TemplateArg(object):
- """
- A cheetah template argument created from a param.
- The str of this class evaluates to the param's to code method.
- The use of this class as a dictionary (enum only) will reveal the enum opts.
- The __call__ or () method can return the param evaluated to a raw python data type.
- """
-
- def __init__(self, param):
- self._param = weakref.proxy(param)
-
- def __getitem__(self, item):
- return str(self._param.get_opt(item)) if self._param.is_enum() else NotImplemented
-
- def __getattr__(self, item):
- if not self._param.is_enum():
- raise AttributeError()
- try:
- return str(self._param.get_opt(item))
- except KeyError:
- raise AttributeError()
-
- def __str__(self):
- return str(self._param.to_code())
-
- def __call__(self):
- return self._param.get_evaluated()
-
-
-class Param(Element):
-
- is_param = True
-
- def __init__(self, block, n):
- """
- Make a new param from nested data.
-
- Args:
- block: the parent element
- n: the nested odict
- """
- # If the base key is a valid param key, copy its data and overlay this params data
- base_key = n.find('base_key')
- if base_key and base_key in block.get_param_keys():
- n_expanded = block.get_param(base_key)._n.copy()
- n_expanded.update(n)
- n = n_expanded
- # Save odict in case this param will be base for another
- self._n = n
- # Parse the data
- self._name = n.find('name')
- self._key = n.find('key')
- value = n.find('value') or ''
- self._type = n.find('type') or 'raw'
- self._hide = n.find('hide') or ''
- self._tab_label = n.find('tab') or block.get_param_tab_labels()[0]
- if self._tab_label not in block.get_param_tab_labels():
- block.get_param_tab_labels().append(self._tab_label)
- # Build the param
- Element.__init__(self, block)
- # Create the Option objects from the n data
- self._options = list()
- self._evaluated = None
- for option in map(lambda o: Option(param=self, n=o), n.findall('option')):
- key = option.get_key()
- # Test against repeated keys
- if key in self.get_option_keys():
- raise Exception('Key "{}" already exists in options'.format(key))
- # Store the option
- self.get_options().append(option)
- # Test the enum options
- if self.is_enum():
- # Test against options with identical keys
- if len(set(self.get_option_keys())) != len(self.get_options()):
- raise Exception('Options keys "{}" are not unique.'.format(self.get_option_keys()))
- # Test against inconsistent keys in options
- opt_keys = self.get_options()[0].get_opt_keys()
- for option in self.get_options():
- if set(opt_keys) != set(option.get_opt_keys()):
- raise Exception('Opt keys "{}" are not identical across all options.'.format(opt_keys))
- # If a value is specified, it must be in the options keys
- if value or value in self.get_option_keys():
- self._value = value
- else:
- self._value = self.get_option_keys()[0]
- if self.get_value() not in self.get_option_keys():
- raise Exception('The value "{}" is not in the possible values of "{}".'.format(self.get_value(), self.get_option_keys()))
- else:
- self._value = value or ''
- self._default = value
- self._init = False
- self._hostage_cells = list()
- self.template_arg = TemplateArg(self)
-
- def get_types(self):
- return (
- 'raw', 'enum',
- 'complex', 'real', 'float', 'int',
- 'complex_vector', 'real_vector', 'float_vector', 'int_vector',
- 'hex', 'string', 'bool',
- 'file_open', 'file_save', '_multiline', '_multiline_python_external',
- 'id', 'stream_id',
- 'gui_hint',
- 'import',
- )
-
- def __repr__(self):
- """
- Get the repr (nice string format) for this param.
-
- Returns:
- the string representation
- """
- ##################################################
- # Truncate helper method
- ##################################################
- def _truncate(string, style=0):
- max_len = max(27 - len(self.get_name()), 3)
- if len(string) > max_len:
- if style < 0: # Front truncate
- string = '...' + string[3-max_len:]
- elif style == 0: # Center truncate
- string = string[:max_len/2 - 3] + '...' + string[-max_len/2:]
- elif style > 0: # Rear truncate
- string = string[:max_len-3] + '...'
- return string
-
- ##################################################
- # Simple conditions
- ##################################################
- if not self.is_valid():
- return _truncate(self.get_value())
- if self.get_value() in self.get_option_keys():
- return self.get_option(self.get_value()).get_name()
-
- ##################################################
- # Split up formatting by type
- ##################################################
- # Default center truncate
- truncate = 0
- e = self.get_evaluated()
- t = self.get_type()
- if isinstance(e, bool):
- return str(e)
- elif isinstance(e, COMPLEX_TYPES):
- dt_str = num_to_str(e)
- elif isinstance(e, VECTOR_TYPES):
- # Vector types
- if len(e) > 8:
- # Large vectors use code
- dt_str = self.get_value()
- truncate = 1
- else:
- # Small vectors use eval
- dt_str = ', '.join(map(num_to_str, e))
- elif t in ('file_open', 'file_save'):
- dt_str = self.get_value()
- truncate = -1
- else:
- # Other types
- dt_str = str(e)
-
- # Done
- return _truncate(dt_str, truncate)
-
- def __repr2__(self):
- """
- Get the repr (nice string format) for this param.
-
- Returns:
- the string representation
- """
- if self.is_enum():
- return self.get_option(self.get_value()).get_name()
- return self.get_value()
-
- def __str__(self):
- return 'Param - {}({})'.format(self.get_name(), self.get_key())
-
- def get_color(self):
- """
- Get the color that represents this param's type.
-
- Returns:
- a hex color code.
- """
- try:
- return {
- # Number types
- 'complex': Constants.COMPLEX_COLOR_SPEC,
- 'real': Constants.FLOAT_COLOR_SPEC,
- 'float': Constants.FLOAT_COLOR_SPEC,
- 'int': Constants.INT_COLOR_SPEC,
- # Vector types
- 'complex_vector': Constants.COMPLEX_VECTOR_COLOR_SPEC,
- 'real_vector': Constants.FLOAT_VECTOR_COLOR_SPEC,
- 'float_vector': Constants.FLOAT_VECTOR_COLOR_SPEC,
- 'int_vector': Constants.INT_VECTOR_COLOR_SPEC,
- # Special
- 'bool': Constants.INT_COLOR_SPEC,
- 'hex': Constants.INT_COLOR_SPEC,
- 'string': Constants.BYTE_VECTOR_COLOR_SPEC,
- 'id': Constants.ID_COLOR_SPEC,
- 'stream_id': Constants.ID_COLOR_SPEC,
- 'raw': Constants.WILDCARD_COLOR_SPEC,
- }[self.get_type()]
- except:
- return '#FFFFFF'
-
- def get_hide(self):
- """
- Get the hide value from the base class.
- Hide the ID parameter for most blocks. Exceptions below.
- If the parameter controls a port type, vlen, or nports, return part.
- If the parameter is an empty grid position, return part.
- These parameters are redundant to display in the flow graph view.
-
- Returns:
- hide the hide property string
- """
- hide = self.get_parent().resolve_dependencies(self._hide).strip()
- if hide:
- return hide
- # Hide ID in non variable blocks
- if self.get_key() == 'id' and not _show_id_matcher.match(self.get_parent().get_key()):
- return 'part'
- # Hide port controllers for type and nports
- if self.get_key() in ' '.join(map(lambda p: ' '.join([p._type, p._nports]),
- self.get_parent().get_ports())):
- return 'part'
- # Hide port controllers for vlen, when == 1
- if self.get_key() in ' '.join(map(
- lambda p: p._vlen, self.get_parent().get_ports())
- ):
- try:
- if int(self.get_evaluated()) == 1:
- return 'part'
- except:
- pass
- return hide
-
- def validate(self):
- """
- Validate the param.
- The value must be evaluated and type must a possible type.
- """
- Element.validate(self)
- if self.get_type() not in self.get_types():
- self.add_error_message('Type "{}" is not a possible type.'.format(self.get_type()))
-
- self._evaluated = None
- try:
- self._evaluated = self.evaluate()
- except Exception, e:
- self.add_error_message(str(e))
-
- def get_evaluated(self):
- return self._evaluated
-
- def evaluate(self):
- """
- Evaluate the value.
-
- Returns:
- evaluated type
- """
- self._init = True
- self._lisitify_flag = False
- self._stringify_flag = False
- self._hostage_cells = list()
- t = self.get_type()
- v = self.get_value()
-
- #########################
- # Enum Type
- #########################
- if self.is_enum():
- return v
-
- #########################
- # Numeric Types
- #########################
- elif t in ('raw', 'complex', 'real', 'float', 'int', 'hex', 'bool'):
- # Raise exception if python cannot evaluate this value
- try:
- e = self.get_parent().get_parent().evaluate(v)
- except Exception, e:
- raise Exception('Value "{}" cannot be evaluated:\n{}'.format(v, e))
- # Raise an exception if the data is invalid
- if t == 'raw':
- return e
- elif t == 'complex':
- if not isinstance(e, COMPLEX_TYPES):
- raise Exception('Expression "{}" is invalid for type complex.'.format(str(e)))
- return e
- elif t == 'real' or t == 'float':
- if not isinstance(e, REAL_TYPES):
- raise Exception('Expression "{}" is invalid for type float.'.format(str(e)))
- return e
- elif t == 'int':
- if not isinstance(e, INT_TYPES):
- raise Exception('Expression "{}" is invalid for type integer.'.format(str(e)))
- return e
- elif t == 'hex':
- return hex(e)
- elif t == 'bool':
- if not isinstance(e, bool):
- raise Exception('Expression "{}" is invalid for type bool.'.format(str(e)))
- return e
- else:
- raise TypeError('Type "{}" not handled'.format(t))
- #########################
- # Numeric Vector Types
- #########################
- elif t in ('complex_vector', 'real_vector', 'float_vector', 'int_vector'):
- if not v:
- # Turn a blank string into an empty list, so it will eval
- v = '()'
- # Raise exception if python cannot evaluate this value
- try:
- e = self.get_parent().get_parent().evaluate(v)
- except Exception, e:
- raise Exception('Value "{}" cannot be evaluated:\n{}'.format(v, e))
- # Raise an exception if the data is invalid
- if t == 'complex_vector':
- if not isinstance(e, VECTOR_TYPES):
- self._lisitify_flag = True
- e = [e]
- if not all([isinstance(ei, COMPLEX_TYPES) for ei in e]):
- raise Exception('Expression "{}" is invalid for type complex vector.'.format(str(e)))
- return e
- elif t == 'real_vector' or t == 'float_vector':
- if not isinstance(e, VECTOR_TYPES):
- self._lisitify_flag = True
- e = [e]
- if not all([isinstance(ei, REAL_TYPES) for ei in e]):
- raise Exception('Expression "{}" is invalid for type float vector.'.format(str(e)))
- return e
- elif t == 'int_vector':
- if not isinstance(e, VECTOR_TYPES):
- self._lisitify_flag = True
- e = [e]
- if not all([isinstance(ei, INT_TYPES) for ei in e]):
- raise Exception('Expression "{}" is invalid for type integer vector.'.format(str(e)))
- return e
- #########################
- # String Types
- #########################
- elif t in ('string', 'file_open', 'file_save', '_multiline', '_multiline_python_external'):
- # Do not check if file/directory exists, that is a runtime issue
- try:
- e = self.get_parent().get_parent().evaluate(v)
- if not isinstance(e, str):
- raise Exception()
- except:
- self._stringify_flag = True
- e = str(v)
- if t == '_multiline_python_external':
- ast.parse(e) # Raises SyntaxError
- return e
- #########################
- # Unique ID Type
- #########################
- elif t == 'id':
- # Can python use this as a variable?
- if not _check_id_matcher.match(v):
- raise Exception('ID "{}" must begin with a letter and may contain letters, numbers, and underscores.'.format(v))
- ids = [param.get_value() for param in self.get_all_params(t, 'id')]
-
- if v in ID_BLACKLIST:
- raise Exception('ID "{}" is blacklisted.'.format(v))
-
- if self._key == 'id':
- # Id should only appear once, or zero times if block is disabled
- if ids.count(v) > 1:
- raise Exception('ID "{}" is not unique.'.format(v))
- else:
- # Id should exist to be a reference
- if ids.count(v) < 1:
- raise Exception('ID "{}" does not exist.'.format(v))
-
- return v
-
- #########################
- # Stream ID Type
- #########################
- elif t == 'stream_id':
- # Get a list of all stream ids used in the virtual sinks
- ids = [param.get_value() for param in filter(
- lambda p: p.get_parent().is_virtual_sink(),
- self.get_all_params(t),
- )]
- # Check that the virtual sink's stream id is unique
- if self.get_parent().is_virtual_sink():
- # Id should only appear once, or zero times if block is disabled
- if ids.count(v) > 1:
- raise Exception('Stream ID "{}" is not unique.'.format(v))
- # Check that the virtual source's steam id is found
- if self.get_parent().is_virtual_source():
- if v not in ids:
- raise Exception('Stream ID "{}" is not found.'.format(v))
- return v
-
- #########################
- # GUI Position/Hint
- #########################
- elif t == 'gui_hint':
- if ':' in v:
- tab, pos = v.split(':')
- elif '@' in v:
- tab, pos = v, ''
- else:
- tab, pos = '', v
-
- if '@' in tab:
- tab, index = tab.split('@')
- else:
- index = '?'
-
- # TODO: Problem with this code. Produces bad tabs
- widget_str = ({
- (True, True): 'self.%(tab)s_grid_layout_%(index)s.addWidget(%(widget)s, %(pos)s)',
- (True, False): 'self.%(tab)s_layout_%(index)s.addWidget(%(widget)s)',
- (False, True): 'self.top_grid_layout.addWidget(%(widget)s, %(pos)s)',
- (False, False): 'self.top_layout.addWidget(%(widget)s)',
- }[bool(tab), bool(pos)]) % {'tab': tab, 'index': index, 'widget': '%s', 'pos': pos}
-
- # FIXME: Move replace(...) into the make template of the qtgui blocks
- # Return a string here
- class GuiHint(object):
- def __init__(self, ws):
- self._ws = ws
-
- def __call__(self, w):
- return (self._ws.replace('addWidget', 'addLayout') if 'layout' in w else self._ws) % w
-
- def __str__(self):
- return self._ws
- return GuiHint(widget_str)
- #########################
- # Import Type
- #########################
- elif t == 'import':
- # New namespace
- n = dict()
- try:
- exec v in n
- except ImportError:
- raise Exception('Import "{}" failed.'.format(v))
- except Exception:
- raise Exception('Bad import syntax: "{}".'.format(v))
- return filter(lambda k: str(k) != '__builtins__', n.keys())
-
- #########################
- else:
- raise TypeError('Type "{}" not handled'.format(t))
-
- def to_code(self):
- """
- Convert the value to code.
- For string and list types, check the init flag, call evaluate().
- This ensures that evaluate() was called to set the xxxify_flags.
-
- Returns:
- a string representing the code
- """
- v = self.get_value()
- t = self.get_type()
- # String types
- if t in ('string', 'file_open', 'file_save', '_multiline', '_multiline_python_external'):
- if not self._init:
- self.evaluate()
- return repr(v) if self._stringify_flag else v
-
- # Vector types
- elif t in ('complex_vector', 'real_vector', 'float_vector', 'int_vector'):
- if not self._init:
- self.evaluate()
- if self._lisitify_flag:
- return '(%s, )' % v
- else:
- return '(%s)' % v
- else:
- return v
-
- def get_all_params(self, type, key=None):
- """
- Get all the params from the flowgraph that have the given type and
- optionally a given key
-
- Args:
- type: the specified type
- key: the key to match against
-
- Returns:
- a list of params
- """
- return sum([filter(lambda p: ((p.get_type() == type) and ((key is None) or (p.get_key() == key))), block.get_params()) for block in self.get_parent().get_parent().get_enabled_blocks()], [])
-
- def is_enum(self):
- return self._type == 'enum'
-
- def get_value(self):
- value = self._value
- if self.is_enum() and value not in self.get_option_keys():
- value = self.get_option_keys()[0]
- self.set_value(value)
- return value
-
- def set_value(self, value):
- # Must be a string
- self._value = str(value)
-
- def set_default(self, value):
- if self._default == self._value:
- self.set_value(value)
- self._default = str(value)
-
- def get_type(self):
- return self.get_parent().resolve_dependencies(self._type)
-
- def get_tab_label(self):
- return self._tab_label
-
- def get_name(self):
- return self.get_parent().resolve_dependencies(self._name).strip()
-
- def get_key(self):
- return self._key
-
- ##############################################
- # Access Options
- ##############################################
- def get_option_keys(self):
- return _get_keys(self.get_options())
-
- def get_option(self, key):
- return _get_elem(self.get_options(), key)
-
- def get_options(self):
- return self._options
-
- ##############################################
- # Access Opts
- ##############################################
- def get_opt_keys(self):
- return self.get_option(self.get_value()).get_opt_keys()
-
- def get_opt(self, key):
- return self.get_option(self.get_value()).get_opt(key)
-
- def get_opts(self):
- return self.get_option(self.get_value()).get_opts()
-
- ##############################################
- # Import/Export Methods
- ##############################################
- def export_data(self):
- """
- Export this param's key/value.
-
- Returns:
- a nested data odict
- """
- n = odict()
- n['key'] = self.get_key()
- n['value'] = self.get_value()
- return n
diff --git a/grc/core/ParseXML.py b/grc/core/ParseXML.py
index c9f6541ee..430ba5b47 100644
--- a/grc/core/ParseXML.py
+++ b/grc/core/ParseXML.py
@@ -17,9 +17,13 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
+from __future__ import absolute_import
+
from lxml import etree
-from .utils import odict
+import six
+from six.moves import map
+
xml_failures = {}
etree.set_default_parser(etree.XMLParser(remove_comments=True))
@@ -75,17 +79,35 @@ def from_file(xml_file):
the nested data with grc version information
"""
xml = etree.parse(xml_file)
- nested_data = _from_file(xml.getroot())
+
+ tag, nested_data = _from_file(xml.getroot())
+ nested_data = {tag: nested_data, '_instructions': {}}
# Get the embedded instructions and build a dictionary item
- nested_data['_instructions'] = {}
xml_instructions = xml.xpath('/processing-instruction()')
- for inst in filter(lambda i: i.target == 'grc', xml_instructions):
- nested_data['_instructions'] = odict(inst.attrib)
+ for inst in xml_instructions:
+ if inst.target != 'grc':
+ continue
+ nested_data['_instructions'] = dict(inst.attrib)
return nested_data
-def _from_file(xml):
+WANT_A_LIST = {
+ '/block': 'import callback param check sink source'.split(),
+ '/block/param_tab_order': 'tab'.split(),
+ '/block/param': 'option'.split(),
+ '/block/param/option': 'opt'.split(),
+ '/flow_graph': 'block connection'.split(),
+ '/flow_graph/block': 'param'.split(),
+ '/cat': 'cat block'.split(),
+ '/cat/cat': 'cat block'.split(),
+ '/cat/cat/cat': 'cat block'.split(),
+ '/cat/cat/cat/cat': 'cat block'.split(),
+ '/domain': 'connection'.split(),
+}
+
+
+def _from_file(xml, parent_tag=''):
"""
Recursively parse the xml tree into nested data format.
@@ -96,21 +118,24 @@ def _from_file(xml):
the nested data
"""
tag = xml.tag
+ tag_path = parent_tag + '/' + tag
+
if not len(xml):
- return odict({tag: xml.text or ''}) # store empty tags (text is None) as empty string
- nested_data = odict()
+ return tag, xml.text or '' # store empty tags (text is None) as empty string
+
+ nested_data = {}
for elem in xml:
- key, value = _from_file(elem).items()[0]
- if key in nested_data:
- nested_data[key].append(value)
+ key, value = _from_file(elem, tag_path)
+
+ if key in WANT_A_LIST.get(tag_path, []):
+ try:
+ nested_data[key].append(value)
+ except KeyError:
+ nested_data[key] = [value]
else:
- nested_data[key] = [value]
- # Delistify if the length of values is 1
- for key, values in nested_data.iteritems():
- if len(values) == 1:
- nested_data[key] = values[0]
+ nested_data[key] = value
- return odict({tag: nested_data})
+ return tag, nested_data
def to_file(nested_data, xml_file):
@@ -127,11 +152,11 @@ def to_file(nested_data, xml_file):
if instructions:
xml_data += etree.tostring(etree.ProcessingInstruction(
'grc', ' '.join(
- "{0}='{1}'".format(*item) for item in instructions.iteritems())
+ "{0}='{1}'".format(*item) for item in six.iteritems(instructions))
), xml_declaration=True, pretty_print=True, encoding='utf-8')
xml_data += etree.tostring(_to_file(nested_data)[0],
pretty_print=True, encoding='utf-8')
- with open(xml_file, 'w') as fp:
+ with open(xml_file, 'wb') as fp:
fp.write(xml_data)
@@ -146,14 +171,14 @@ def _to_file(nested_data):
the xml tree filled with child nodes
"""
nodes = list()
- for key, values in nested_data.iteritems():
+ for key, values in six.iteritems(nested_data):
# Listify the values if not a list
if not isinstance(values, (list, set, tuple)):
values = [values]
for value in values:
node = etree.Element(key)
- if isinstance(value, (str, unicode)):
- node.text = unicode(value)
+ if isinstance(value, (str, six.text_type)):
+ node.text = six.text_type(value)
else:
node.extend(_to_file(value))
nodes.append(node)
diff --git a/grc/core/Platform.py b/grc/core/Platform.py
deleted file mode 100644
index 20702b900..000000000
--- a/grc/core/Platform.py
+++ /dev/null
@@ -1,309 +0,0 @@
-"""
-Copyright 2008-2016 Free Software Foundation, Inc.
-This file is part of GNU Radio
-
-GNU Radio Companion 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 2
-of the License, or (at your option) any later version.
-
-GNU Radio Companion 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 program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-"""
-
-import os
-import sys
-
-from . import ParseXML, Messages, Constants
-
-from .Config import Config
-from .Element import Element
-from .generator import Generator
-from .FlowGraph import FlowGraph
-from .Connection import Connection
-from .Block import Block
-from .Port import Port
-from .Param import Param
-
-from .utils import odict, extract_docs, hide_bokeh_gui_options_if_not_installed
-
-
-class Platform(Element):
-
- Config = Config
- Generator = Generator
- FlowGraph = FlowGraph
- Connection = Connection
- Block = Block
- Port = Port
- Param = Param
-
- is_platform = True
-
- def __init__(self, *args, **kwargs):
- """ Make a platform for GNU Radio """
- Element.__init__(self)
-
- self.config = self.Config(*args, **kwargs)
-
- self.block_docstrings = {}
- self.block_docstrings_loaded_callback = lambda: None # dummy to be replaced by BlockTreeWindow
-
- self._docstring_extractor = extract_docs.SubprocessLoader(
- callback_query_result=self._save_docstring_extraction_result,
- callback_finished=lambda: self.block_docstrings_loaded_callback()
- )
-
- # Create a dummy flow graph for the blocks
- self._flow_graph = Element(self)
- self._flow_graph.connections = []
-
- self.blocks = odict()
- self._blocks_n = odict()
- self._block_categories = {}
- self.domains = {}
- self.connection_templates = {}
-
- self._auto_hier_block_generate_chain = set()
-
- self.build_block_library()
-
- def __str__(self):
- return 'Platform - {}({})'.format(self.config.key, self.config.name)
-
- @staticmethod
- def find_file_in_paths(filename, paths, cwd):
- """Checks the provided paths relative to cwd for a certain filename"""
- if not os.path.isdir(cwd):
- cwd = os.path.dirname(cwd)
- if isinstance(paths, str):
- paths = (p for p in paths.split(':') if p)
-
- for path in paths:
- path = os.path.expanduser(path)
- if not os.path.isabs(path):
- path = os.path.normpath(os.path.join(cwd, path))
- file_path = os.path.join(path, filename)
- if os.path.exists(os.path.normpath(file_path)):
- return file_path
-
- def load_and_generate_flow_graph(self, file_path, out_path=None, hier_only=False):
- """Loads a flow graph from file and generates it"""
- Messages.set_indent(len(self._auto_hier_block_generate_chain))
- Messages.send('>>> Loading: {}\n'.format(file_path))
- if file_path in self._auto_hier_block_generate_chain:
- Messages.send(' >>> Warning: cyclic hier_block dependency\n')
- return None, None
- self._auto_hier_block_generate_chain.add(file_path)
- try:
- flow_graph = self.get_new_flow_graph()
- flow_graph.grc_file_path = file_path
- # Other, nested hier_blocks might be auto-loaded here
- flow_graph.import_data(self.parse_flow_graph(file_path))
- flow_graph.rewrite()
- flow_graph.validate()
- if not flow_graph.is_valid():
- raise Exception('Flowgraph invalid')
- if hier_only and not flow_graph.get_option('generate_options').startswith('hb'):
- raise Exception('Not a hier block')
- except Exception as e:
- Messages.send('>>> Load Error: {}: {}\n'.format(file_path, str(e)))
- return None, None
- finally:
- self._auto_hier_block_generate_chain.discard(file_path)
- Messages.set_indent(len(self._auto_hier_block_generate_chain))
-
- try:
- generator = self.Generator(flow_graph, out_path or file_path)
- Messages.send('>>> Generating: {}\n'.format(generator.file_path))
- generator.write()
- except Exception as e:
- Messages.send('>>> Generate Error: {}: {}\n'.format(file_path, str(e)))
- return None, None
-
- if flow_graph.get_option('generate_options').startswith('hb'):
- self.load_block_xml(generator.get_file_path_xml())
- return flow_graph, generator.file_path
-
- def build_block_library(self):
- """load the blocks and block tree from the search paths"""
- self._docstring_extractor.start()
- # Reset
- self.blocks.clear()
- self._blocks_n.clear()
- self._block_categories.clear()
- self.domains.clear()
- self.connection_templates.clear()
- ParseXML.xml_failures.clear()
-
- # Try to parse and load blocks
- for xml_file in self.iter_xml_files():
- try:
- if xml_file.endswith("block_tree.xml"):
- self.load_category_tree_xml(xml_file)
- elif xml_file.endswith('domain.xml'):
- self.load_domain_xml(xml_file)
- else:
- self.load_block_xml(xml_file)
- except ParseXML.XMLSyntaxError as e:
- # print >> sys.stderr, 'Warning: Block validation failed:\n\t%s\n\tIgnoring: %s' % (e, xml_file)
- pass
- except Exception as e:
- print >> sys.stderr, 'Warning: XML parsing failed:\n\t%r\n\tIgnoring: %s' % (e, xml_file)
-
- # Add blocks to block tree
- for key, block in self.blocks.iteritems():
- category = self._block_categories.get(key, block.category)
- # Blocks with empty categories are hidden
- if not category:
- continue
- root = category[0]
- if root.startswith('[') and root.endswith(']'):
- category[0] = root[1:-1]
- else:
- category.insert(0, Constants.DEFAULT_BLOCK_MODULE_NAME)
- block.category = category
-
- self._docstring_extractor.finish()
- # self._docstring_extractor.wait()
-
- hide_bokeh_gui_options_if_not_installed(self.blocks['options'])
-
- def iter_xml_files(self):
- """Iterator for block descriptions and category trees"""
- for block_path in self.config.block_paths:
- if os.path.isfile(block_path):
- yield block_path
- elif os.path.isdir(block_path):
- for dirpath, dirnames, filenames in os.walk(block_path):
- for filename in sorted(filter(lambda f: f.endswith('.xml'), filenames)):
- yield os.path.join(dirpath, filename)
-
- def load_block_xml(self, xml_file):
- """Load block description from xml file"""
- # Validate and import
- ParseXML.validate_dtd(xml_file, Constants.BLOCK_DTD)
- n = ParseXML.from_file(xml_file).find('block')
- n['block_wrapper_path'] = xml_file # inject block wrapper path
- # Get block instance and add it to the list of blocks
- block = self.Block(self._flow_graph, n)
- key = block.get_key()
- if key in self.blocks:
- print >> sys.stderr, 'Warning: Block with key "{}" already exists.\n\tIgnoring: {}'.format(key, xml_file)
- else: # Store the block
- self.blocks[key] = block
- self._blocks_n[key] = n
-
- self._docstring_extractor.query(
- block.get_key(),
- block.get_imports(raw=True),
- block.get_make(raw=True)
- )
-
- def load_category_tree_xml(self, xml_file):
- """Validate and parse category tree file and add it to list"""
- ParseXML.validate_dtd(xml_file, Constants.BLOCK_TREE_DTD)
- xml = ParseXML.from_file(xml_file)
- path = []
-
- def load_category(cat_n):
- path.append(cat_n.find('name').strip())
- for block_key in cat_n.findall('block'):
- if block_key not in self._block_categories:
- self._block_categories[block_key] = list(path)
- for sub_cat_n in cat_n.findall('cat'):
- load_category(sub_cat_n)
- path.pop()
-
- load_category(xml.find('cat'))
-
- def load_domain_xml(self, xml_file):
- """Load a domain properties and connection templates from XML"""
- ParseXML.validate_dtd(xml_file, Constants.DOMAIN_DTD)
- n = ParseXML.from_file(xml_file).find('domain')
-
- key = n.find('key')
- if not key:
- print >> sys.stderr, 'Warning: Domain with empty key.\n\tIgnoring: {0}'.format(xml_file)
- return
- if key in self.domains: # test against repeated keys
- print >> sys.stderr, 'Warning: Domain with key "{}" already exists.\n\tIgnoring: {}'.format(key, xml_file)
- return
-
- #to_bool = lambda s, d: d if s is None else s.lower() not in ('false', 'off', '0', '')
- def to_bool(s, d):
- if s is not None:
- return s.lower() not in ('false', 'off', '0', '')
- return d
-
- color = n.find('color') or ''
- try:
- import gtk # ugly but handy
- gtk.gdk.color_parse(color)
- except (ValueError, ImportError):
- if color: # no color is okay, default set in GUI
- print >> sys.stderr, 'Warning: Can\'t parse color code "{}" for domain "{}" '.format(color, key)
- color = None
-
- self.domains[key] = dict(
- name=n.find('name') or key,
- multiple_sinks=to_bool(n.find('multiple_sinks'), True),
- multiple_sources=to_bool(n.find('multiple_sources'), False),
- color=color
- )
- for connection_n in n.findall('connection'):
- key = (connection_n.find('source_domain'), connection_n.find('sink_domain'))
- if not all(key):
- print >> sys.stderr, 'Warning: Empty domain key(s) in connection template.\n\t{}'.format(xml_file)
- elif key in self.connection_templates:
- print >> sys.stderr, 'Warning: Connection template "{}" already exists.\n\t{}'.format(key, xml_file)
- else:
- self.connection_templates[key] = connection_n.find('make') or ''
-
- def _save_docstring_extraction_result(self, key, docstrings):
- docs = {}
- for match, docstring in docstrings.iteritems():
- if not docstring or match.endswith('_sptr'):
- continue
- docstring = docstring.replace('\n\n', '\n').strip()
- docs[match] = docstring
- self.block_docstrings[key] = docs
-
- ##############################################
- # Access
- ##############################################
-
- def parse_flow_graph(self, flow_graph_file):
- """
- Parse a saved flow graph file.
- Ensure that the file exists, and passes the dtd check.
-
- Args:
- flow_graph_file: the flow graph file
-
- Returns:
- nested data
- @throws exception if the validation fails
- """
- flow_graph_file = flow_graph_file or self.config.default_flow_graph
- open(flow_graph_file, 'r').close() # Test open
- ParseXML.validate_dtd(flow_graph_file, Constants.FLOW_GRAPH_DTD)
- return ParseXML.from_file(flow_graph_file)
-
- def get_new_flow_graph(self):
- return self.FlowGraph(platform=self)
-
- def get_blocks(self):
- return self.blocks.values()
-
- def get_new_block(self, flow_graph, key):
- return self.Block(flow_graph, n=self._blocks_n[key])
-
- def get_colors(self):
- return [(name, color) for name, key, sizeof, color in Constants.CORE_TYPES]
diff --git a/grc/core/Port.py b/grc/core/Port.py
deleted file mode 100644
index 8549656c9..000000000
--- a/grc/core/Port.py
+++ /dev/null
@@ -1,414 +0,0 @@
-"""
-Copyright 2008-2017 Free Software Foundation, Inc.
-This file is part of GNU Radio
-
-GNU Radio Companion 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 2
-of the License, or (at your option) any later version.
-
-GNU Radio Companion 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 program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-"""
-
-from itertools import chain
-
-from .Constants import DEFAULT_DOMAIN, GR_STREAM_DOMAIN, GR_MESSAGE_DOMAIN
-from .Element import Element
-
-from . import Constants
-
-
-class LoopError(Exception):
- pass
-
-
-def _upstream_ports(port):
- if port.is_sink:
- return _sources_from_virtual_sink_port(port)
- else:
- return _sources_from_virtual_source_port(port)
-
-
-def _sources_from_virtual_sink_port(sink_port, _traversed=None):
- """
- Resolve the source port that is connected to the given virtual sink port.
- Use the get source from virtual source to recursively resolve subsequent ports.
- """
- source_ports_per_virtual_connection = (
- # there can be multiple ports per virtual connection
- _sources_from_virtual_source_port(c.get_source(), _traversed) # type: list
- for c in sink_port.get_enabled_connections()
- )
- return list(chain(*source_ports_per_virtual_connection)) # concatenate generated lists of ports
-
-
-def _sources_from_virtual_source_port(source_port, _traversed=None):
- """
- Recursively resolve source ports over the virtual connections.
- Keep track of traversed sources to avoid recursive loops.
- """
- _traversed = set(_traversed or []) # a new set!
- if source_port in _traversed:
- raise LoopError('Loop found when resolving port type')
- _traversed.add(source_port)
-
- block = source_port.get_parent()
- flow_graph = block.get_parent()
-
- if not block.is_virtual_source():
- return [source_port] # nothing to resolve, we're done
-
- stream_id = block.get_param('stream_id').get_value()
-
- # currently the validation does not allow multiple virtual sinks and one virtual source
- # but in the future it may...
- connected_virtual_sink_blocks = (
- b for b in flow_graph.get_enabled_blocks()
- if b.is_virtual_sink() and b.get_param('stream_id').get_value() == stream_id
- )
- source_ports_per_virtual_connection = (
- _sources_from_virtual_sink_port(b.get_sinks()[0], _traversed) # type: list
- for b in connected_virtual_sink_blocks
- )
- return list(chain(*source_ports_per_virtual_connection)) # concatenate generated lists of ports
-
-
-def _downstream_ports(port):
- if port.is_source:
- return _sinks_from_virtual_source_port(port)
- else:
- return _sinks_from_virtual_sink_port(port)
-
-
-def _sinks_from_virtual_source_port(source_port, _traversed=None):
- """
- Resolve the sink port that is connected to the given virtual source port.
- Use the get sink from virtual sink to recursively resolve subsequent ports.
- """
- sink_ports_per_virtual_connection = (
- # there can be multiple ports per virtual connection
- _sinks_from_virtual_sink_port(c.get_sink(), _traversed) # type: list
- for c in source_port.get_enabled_connections()
- )
- return list(chain(*sink_ports_per_virtual_connection)) # concatenate generated lists of ports
-
-
-def _sinks_from_virtual_sink_port(sink_port, _traversed=None):
- """
- Recursively resolve sink ports over the virtual connections.
- Keep track of traversed sinks to avoid recursive loops.
- """
- _traversed = set(_traversed or []) # a new set!
- if sink_port in _traversed:
- raise LoopError('Loop found when resolving port type')
- _traversed.add(sink_port)
-
- block = sink_port.get_parent()
- flow_graph = block.get_parent()
-
- if not block.is_virtual_sink():
- return [sink_port]
-
- stream_id = block.get_param('stream_id').get_value()
-
- connected_virtual_source_blocks = (
- b for b in flow_graph.get_enabled_blocks()
- if b.is_virtual_source() and b.get_param('stream_id').get_value() == stream_id
- )
- sink_ports_per_virtual_connection = (
- _sinks_from_virtual_source_port(b.get_sources()[0], _traversed) # type: list
- for b in connected_virtual_source_blocks
- )
- return list(chain(*sink_ports_per_virtual_connection)) # concatenate generated lists of ports
-
-
-class Port(Element):
-
- is_port = True
-
- def __init__(self, block, n, dir):
- """
- Make a new port from nested data.
-
- Args:
- block: the parent element
- n: the nested odict
- dir: the direction
- """
- self._n = n
- if n['type'] == 'message':
- n['domain'] = GR_MESSAGE_DOMAIN
- if 'domain' not in n:
- n['domain'] = DEFAULT_DOMAIN
- elif n['domain'] == GR_MESSAGE_DOMAIN:
- n['key'] = n['name']
- n['type'] = 'message' # For port color
- if not n.find('key'):
- n['key'] = str(next(block.port_counters[dir == 'source']))
-
- # Build the port
- Element.__init__(self, block)
- # Grab the data
- self._name = n['name']
- self._key = n['key']
- self._type = n['type'] or ''
- self._domain = n['domain']
- self._hide = n.find('hide') or ''
- self._dir = dir
- self._hide_evaluated = False # Updated on rewrite()
-
- self._nports = n.find('nports') or ''
- self._vlen = n.find('vlen') or ''
- self._optional = n.find('optional') or ''
- self._optional_evaluated = False # Updated on rewrite()
- self._clones = [] # References to cloned ports (for nports > 1)
-
- def __str__(self):
- if self.is_source:
- return 'Source - {}({})'.format(self.get_name(), self.get_key())
- if self.is_sink:
- return 'Sink - {}({})'.format(self.get_name(), self.get_key())
-
- def get_types(self):
- return Constants.TYPE_TO_SIZEOF.keys()
-
- def is_type_empty(self):
- return not self._n['type'] or not self.get_parent().resolve_dependencies(self._n['type'])
-
- def validate(self):
- if self.get_type() not in self.get_types():
- self.add_error_message('Type "{}" is not a possible type.'.format(self.get_type()))
- platform = self.get_parent().get_parent().get_parent()
- if self.get_domain() not in platform.domains:
- self.add_error_message('Domain key "{}" is not registered.'.format(self.get_domain()))
- if not self.get_enabled_connections() and not self.get_optional():
- self.add_error_message('Port is not connected.')
-
- def rewrite(self):
- """
- Handle the port cloning for virtual blocks.
- """
- del self._error_messages[:]
- if self.is_type_empty():
- self.resolve_empty_type()
-
- hide = self.get_parent().resolve_dependencies(self._hide).strip().lower()
- self._hide_evaluated = False if hide in ('false', 'off', '0') else bool(hide)
- optional = self.get_parent().resolve_dependencies(self._optional).strip().lower()
- self._optional_evaluated = False if optional in ('false', 'off', '0') else bool(optional)
-
- # Update domain if was deduced from (dynamic) port type
- type_ = self.get_type()
- if self._domain == GR_STREAM_DOMAIN and type_ == "message":
- self._domain = GR_MESSAGE_DOMAIN
- self._key = self._name
- if self._domain == GR_MESSAGE_DOMAIN and type_ != "message":
- self._domain = GR_STREAM_DOMAIN
- self._key = '0' # Is rectified in rewrite()
-
- def resolve_virtual_source(self):
- """Only used by Generator after validation is passed"""
- return _upstream_ports(self)
-
- def resolve_empty_type(self):
- def find_port(finder):
- try:
- return next((p for p in finder(self) if not p.is_type_empty()), None)
- except LoopError as error:
- self.add_error_message(str(error))
- except (StopIteration, Exception) as error:
- pass
-
- try:
- port = find_port(_upstream_ports) or find_port(_downstream_ports)
- self._type = str(port.get_type())
- self._vlen = str(port.get_vlen())
- except Exception:
- # Reset type and vlen
- self._type = self._vlen = ''
-
- def get_vlen(self):
- """
- Get the vector length.
- If the evaluation of vlen cannot be cast to an integer, return 1.
-
- Returns:
- the vector length or 1
- """
- vlen = self.get_parent().resolve_dependencies(self._vlen)
- try:
- return int(self.get_parent().get_parent().evaluate(vlen))
- except:
- return 1
-
- def get_nports(self):
- """
- Get the number of ports.
- If already blank, return a blank
- If the evaluation of nports cannot be cast to a positive integer, return 1.
-
- Returns:
- the number of ports or 1
- """
- if self._nports == '':
- return ''
-
- nports = self.get_parent().resolve_dependencies(self._nports)
- try:
- return max(1, int(self.get_parent().get_parent().evaluate(nports)))
- except:
- return 1
-
- def get_optional(self):
- return self._optional_evaluated
-
- def get_color(self):
- """
- Get the color that represents this port's type.
- Codes differ for ports where the vec length is 1 or greater than 1.
-
- Returns:
- a hex color code.
- """
- try:
- color = Constants.TYPE_TO_COLOR[self.get_type()]
- vlen = self.get_vlen()
- if vlen == 1:
- return color
- color_val = int(color[1:], 16)
- r = (color_val >> 16) & 0xff
- g = (color_val >> 8) & 0xff
- b = (color_val >> 0) & 0xff
- dark = (0, 0, 30, 50, 70)[min(4, vlen)]
- r = max(r-dark, 0)
- g = max(g-dark, 0)
- b = max(b-dark, 0)
- # TODO: Change this to .format()
- return '#%.2x%.2x%.2x' % (r, g, b)
- except:
- return '#FFFFFF'
-
- def get_clones(self):
- """
- Get the clones of this master port (nports > 1)
-
- Returns:
- a list of ports
- """
- return self._clones
-
- def add_clone(self):
- """
- Create a clone of this (master) port and store a reference in self._clones.
-
- The new port name (and key for message ports) will have index 1... appended.
- If this is the first clone, this (master) port will get a 0 appended to its name (and key)
-
- Returns:
- the cloned port
- """
- # Add index to master port name if there are no clones yet
- if not self._clones:
- self._name = self._n['name'] + '0'
- # Also update key for none stream ports
- if not self._key.isdigit():
- self._key = self._name
-
- # Prepare a copy of the odict for the clone
- n = self._n.copy()
- # Remove nports from the key so the copy cannot be a duplicator
- if 'nports' in n:
- n.pop('nports')
- n['name'] = self._n['name'] + str(len(self._clones) + 1)
- # Dummy value 99999 will be fixed later
- n['key'] = '99999' if self._key.isdigit() else n['name']
-
- # Clone
- port = self.__class__(self.get_parent(), n, self._dir)
- self._clones.append(port)
- return port
-
- def remove_clone(self, port):
- """
- Remove a cloned port (from the list of clones only)
- Remove the index 0 of the master port name (and key9 if there are no more clones left
- """
- self._clones.remove(port)
- # Remove index from master port name if there are no more clones
- if not self._clones:
- self._name = self._n['name']
- # Also update key for none stream ports
- if not self._key.isdigit():
- self._key = self._name
-
- def get_name(self):
- number = ''
- if self.get_type() == 'bus':
- busses = filter(lambda a: a._dir == self._dir, self.get_parent().get_ports_gui())
- number = str(busses.index(self)) + '#' + str(len(self.get_associated_ports()))
- return self._name + number
-
- def get_key(self):
- return self._key
-
- @property
- def is_sink(self):
- return self._dir == 'sink'
-
- @property
- def is_source(self):
- return self._dir == 'source'
-
- def get_type(self):
- return self.get_parent().resolve_dependencies(self._type)
-
- def get_domain(self):
- return self._domain
-
- def get_hide(self):
- return self._hide_evaluated
-
- def get_connections(self):
- """
- Get all connections that use this port.
-
- Returns:
- a list of connection objects
- """
- connections = self.get_parent().get_parent().connections
- connections = filter(lambda c: c.get_source() is self or c.get_sink() is self, connections)
- return connections
-
- def get_enabled_connections(self):
- """
- Get all enabled connections that use this port.
-
- Returns:
- a list of connection objects
- """
- return filter(lambda c: c.get_enabled(), self.get_connections())
-
- def get_associated_ports(self):
- if not self.get_type() == 'bus':
- return [self]
- else:
- if self.is_source:
- get_ports = self.get_parent().get_sources
- bus_structure = self.get_parent().current_bus_structure['source']
- else:
- get_ports = self.get_parent().get_sinks
- bus_structure = self.get_parent().current_bus_structure['sink']
-
- ports = [i for i in get_ports() if not i.get_type() == 'bus']
- if bus_structure:
- busses = [i for i in get_ports() if i.get_type() == 'bus']
- bus_index = busses.index(self)
- ports = filter(lambda a: ports.index(a) in bus_structure[bus_index], ports)
- return ports
diff --git a/grc/core/base.py b/grc/core/base.py
new file mode 100644
index 000000000..e5ff657d8
--- /dev/null
+++ b/grc/core/base.py
@@ -0,0 +1,164 @@
+# Copyright 2008, 2009, 2015, 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+import weakref
+
+from .utils.descriptors import lazy_property
+
+
+class Element(object):
+
+ def __init__(self, parent=None):
+ self._parent = weakref.ref(parent) if parent else lambda: None
+ self._error_messages = []
+
+ ##################################################
+ # Element Validation API
+ ##################################################
+ def validate(self):
+ """
+ Validate this element and call validate on all children.
+ Call this base method before adding error messages in the subclass.
+ """
+ del self._error_messages[:]
+
+ for child in self.children():
+ child.validate()
+
+ def is_valid(self):
+ """
+ Is this element valid?
+
+ Returns:
+ true when the element is enabled and has no error messages or is bypassed
+ """
+ if not self.enabled or self.get_bypassed():
+ return True
+ return not next(self.iter_error_messages(), False)
+
+ def add_error_message(self, msg):
+ """
+ Add an error message to the list of errors.
+
+ Args:
+ msg: the error message string
+ """
+ self._error_messages.append(msg)
+
+ def get_error_messages(self):
+ """
+ Get the list of error messages from this element and all of its children.
+ Do not include the error messages from disabled or bypassed children.
+ Cleverly indent the children error messages for printing purposes.
+
+ Returns:
+ a list of error message strings
+ """
+ return [msg if elem is self else "{}:\n\t{}".format(elem, msg.replace("\n", "\n\t"))
+ for elem, msg in self.iter_error_messages()]
+
+ def iter_error_messages(self):
+ """
+ Iterate over error messages. Yields tuples of (element, message)
+ """
+ for msg in self._error_messages:
+ yield self, msg
+ for child in self.children():
+ if not child.enabled or child.get_bypassed():
+ continue
+ for element_msg in child.iter_error_messages():
+ yield element_msg
+
+ def rewrite(self):
+ """
+ Rewrite this element and call rewrite on all children.
+ Call this base method before rewriting the element.
+ """
+ for child in self.children():
+ child.rewrite()
+
+ @property
+ def enabled(self):
+ return True
+
+ def get_bypassed(self):
+ return False
+
+ ##############################################
+ # Tree-like API
+ ##############################################
+ @property
+ def parent(self):
+ return self._parent()
+
+ def get_parent_by_type(self, cls):
+ parent = self.parent
+ if parent is None:
+ return None
+ elif isinstance(parent, cls):
+ return parent
+ else:
+ return parent.get_parent_by_type(cls)
+
+ @lazy_property
+ def parent_platform(self):
+ from .platform import Platform
+ return self.get_parent_by_type(Platform)
+
+ @lazy_property
+ def parent_flowgraph(self):
+ from .FlowGraph import FlowGraph
+ return self.get_parent_by_type(FlowGraph)
+
+ @lazy_property
+ def parent_block(self):
+ from .blocks import Block
+ return self.get_parent_by_type(Block)
+
+ def reset_parents_by_type(self):
+ """Reset all lazy properties"""
+ for name, obj in vars(Element): # explicitly only in Element, not subclasses
+ if isinstance(obj, lazy_property):
+ delattr(self, name)
+
+ def children(self):
+ return
+ yield # empty generator
+
+ ##############################################
+ # Type testing
+ ##############################################
+ is_flow_graph = False
+ is_block = False
+ is_dummy_block = False
+ is_connection = False
+ is_port = False
+ is_param = False
+ is_variable = False
+ is_import = False
+
+ def get_raw(self, name):
+ descriptor = getattr(self.__class__, name, None)
+ if not descriptor:
+ raise ValueError("No evaluated property '{}' found".format(name))
+ return getattr(self, descriptor.name_raw, None) or getattr(self, descriptor.name, None)
+
+ def set_evaluated(self, name, value):
+ descriptor = getattr(self.__class__, name, None)
+ if not descriptor:
+ raise ValueError("No evaluated property '{}' found".format(name))
+ self.__dict__[descriptor.name] = value
diff --git a/grc/core/blocks/__init__.py b/grc/core/blocks/__init__.py
new file mode 100644
index 000000000..4ca0d5d2b
--- /dev/null
+++ b/grc/core/blocks/__init__.py
@@ -0,0 +1,38 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
+
+from ._flags import Flags
+from ._templates import MakoTemplates
+
+from .block import Block
+
+from ._build import build
+
+
+build_ins = {}
+
+
+def register_build_in(cls):
+ cls.loaded_from = '(build-in)'
+ build_ins[cls.key] = cls
+ return cls
+
+from .dummy import DummyBlock
+from .embedded_python import EPyBlock, EPyModule
+from .virtual import VirtualSink, VirtualSource
diff --git a/grc/core/blocks/_build.py b/grc/core/blocks/_build.py
new file mode 100644
index 000000000..6db06040c
--- /dev/null
+++ b/grc/core/blocks/_build.py
@@ -0,0 +1,135 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
+
+import collections
+import itertools
+import re
+
+from ..Constants import ADVANCED_PARAM_TAB
+from ..utils import to_list
+
+from .block import Block
+from ._flags import Flags
+from ._templates import MakoTemplates
+
+
+def build(id, label='', category='', flags='', documentation='',
+ value=None, asserts=None,
+ parameters=None, inputs=None, outputs=None, templates=None, **kwargs):
+ block_id = id
+
+ cls = type(str(block_id), (Block,), {})
+ cls.key = block_id
+
+ cls.label = label or block_id.title()
+ cls.category = [cat.strip() for cat in category.split('/') if cat.strip()]
+
+ cls.flags = Flags(to_list(flags))
+ if re.match(r'options$|variable|virtual', block_id):
+ cls.flags.set(Flags.NOT_DSP, Flags.DISABLE_BYPASS)
+
+ cls.documentation = {'': documentation.strip('\n\t ').replace('\\\n', '')}
+
+ cls.asserts = [_single_mako_expr(a, block_id) for a in to_list(asserts)]
+
+ cls.inputs_data = _build_ports(inputs, 'sink') if inputs else []
+ cls.outputs_data = _build_ports(outputs, 'source') if outputs else []
+ cls.parameters_data = _build_params(parameters or [],
+ bool(cls.inputs_data), bool(cls.outputs_data), cls.flags)
+ cls.extra_data = kwargs
+
+ templates = templates or {}
+ cls.templates = MakoTemplates(
+ imports=templates.get('imports', ''),
+ make=templates.get('make', ''),
+ callbacks=templates.get('callbacks', []),
+ var_make=templates.get('var_make', ''),
+ )
+ # todo: MakoTemplates.compile() to check for errors
+
+ cls.value = _single_mako_expr(value, block_id)
+
+ return cls
+
+
+def _build_ports(ports_raw, direction):
+ ports = []
+ port_ids = set()
+ stream_port_ids = itertools.count()
+
+ for i, port_params in enumerate(ports_raw):
+ port = port_params.copy()
+ port['direction'] = direction
+
+ port_id = port.setdefault('id', str(next(stream_port_ids)))
+ if port_id in port_ids:
+ raise Exception('Port id "{}" already exists in {}s'.format(port_id, direction))
+ port_ids.add(port_id)
+
+ ports.append(port)
+ return ports
+
+
+def _build_params(params_raw, have_inputs, have_outputs, flags):
+ params = []
+
+ def add_param(**data):
+ params.append(data)
+
+ add_param(id='id', name='ID', dtype='id', hide='part')
+
+ if not flags.not_dsp:
+ add_param(id='alias', name='Block Alias', dtype='string',
+ hide='part', category=ADVANCED_PARAM_TAB)
+
+ if have_outputs or have_inputs:
+ add_param(id='affinity', name='Core Affinity', dtype='int_vector',
+ hide='part', category=ADVANCED_PARAM_TAB)
+
+ if have_outputs:
+ add_param(id='minoutbuf', name='Min Output Buffer', dtype='int',
+ hide='part', value='0', category=ADVANCED_PARAM_TAB)
+ add_param(id='maxoutbuf', name='Max Output Buffer', dtype='int',
+ hide='part', value='0', category=ADVANCED_PARAM_TAB)
+
+ base_params_n = {}
+ for param_data in params_raw:
+ param_id = param_data['id']
+ if param_id in params:
+ raise Exception('Param id "{}" is not unique'.format(param_id))
+
+ base_key = param_data.get('base_key', None)
+ param_data_ext = base_params_n.get(base_key, {}).copy()
+ param_data_ext.update(param_data)
+
+ add_param(**param_data_ext)
+ base_params_n[param_id] = param_data_ext
+
+ add_param(id='comment', name='Comment', dtype='_multiline', hide='part',
+ value='', category=ADVANCED_PARAM_TAB)
+ return params
+
+
+def _single_mako_expr(value, block_id):
+ if not value:
+ return None
+ value = value.strip()
+ if not (value.startswith('${') and value.endswith('}')):
+ raise ValueError('{} is not a mako substitution in {}'.format(value, block_id))
+ return value[2:-1].strip()
diff --git a/grc/core/blocks/_flags.py b/grc/core/blocks/_flags.py
new file mode 100644
index 000000000..bbedd6a2d
--- /dev/null
+++ b/grc/core/blocks/_flags.py
@@ -0,0 +1,39 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
+
+
+class Flags(object):
+
+ THROTTLE = 'throttle'
+ DISABLE_BYPASS = 'disable_bypass'
+ NEED_QT_GUI = 'need_qt_gui'
+ DEPRECATED = 'deprecated'
+ NOT_DSP = 'not_dsp'
+
+ def __init__(self, flags):
+ self.data = set(flags)
+
+ def __getattr__(self, item):
+ return item in self
+
+ def __contains__(self, item):
+ return item in self.data
+
+ def set(self, *flags):
+ self.data.update(flags)
diff --git a/grc/core/blocks/_templates.py b/grc/core/blocks/_templates.py
new file mode 100644
index 000000000..0b1516642
--- /dev/null
+++ b/grc/core/blocks/_templates.py
@@ -0,0 +1,77 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+This dict class holds a (shared) cache of compiled mako templates.
+These
+
+"""
+from __future__ import absolute_import, print_function
+
+from mako.template import Template
+from mako.exceptions import SyntaxException
+
+from ..errors import TemplateError
+
+
+class MakoTemplates(dict):
+
+ _template_cache = {}
+
+ def __init__(self, _bind_to=None, *args, **kwargs):
+ self.instance = _bind_to
+ dict.__init__(self, *args, **kwargs)
+
+ def __get__(self, instance, owner):
+ if instance is None or self.instance is not None:
+ return self
+ copy = self.__class__(_bind_to=instance, **self)
+ if getattr(instance.__class__, 'templates', None) is self:
+ setattr(instance, 'templates', copy)
+ return copy
+
+ @classmethod
+ def compile(cls, text):
+ text = str(text)
+ try:
+ template = Template(text)
+ except SyntaxException as error:
+ raise TemplateError(text, *error.args)
+
+ cls._template_cache[text] = template
+ return template
+
+ def _get_template(self, text):
+ try:
+ return self._template_cache[str(text)]
+ except KeyError:
+ return self.compile(text)
+
+ def render(self, item):
+ text = self.get(item)
+ if not text:
+ return ''
+ namespace = self.instance.namespace_templates
+
+ try:
+ if isinstance(text, list):
+ templates = (self._get_template(t) for t in text)
+ return [template.render(**namespace) for template in templates]
+ else:
+ template = self._get_template(text)
+ return template.render(**namespace)
+ except Exception as error:
+ raise TemplateError(error, text)
diff --git a/grc/core/blocks/block.py b/grc/core/blocks/block.py
new file mode 100644
index 000000000..0cb3f6123
--- /dev/null
+++ b/grc/core/blocks/block.py
@@ -0,0 +1,359 @@
+"""
+Copyright 2008-2015 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from __future__ import absolute_import
+
+import collections
+import itertools
+
+import six
+from six.moves import range
+
+from ._templates import MakoTemplates
+from ._flags import Flags
+
+from ..base import Element
+from ..utils.descriptors import lazy_property
+
+
+def _get_elem(iterable, key):
+ items = list(iterable)
+ for item in items:
+ if item.key == key:
+ return item
+ return ValueError('Key "{}" not found in {}.'.format(key, items))
+
+
+class Block(Element):
+
+ is_block = True
+
+ STATE_LABELS = ['disabled', 'enabled', 'bypassed']
+
+ key = ''
+ label = ''
+ category = ''
+ flags = Flags('')
+ documentation = {'': ''}
+
+ value = None
+ asserts = []
+
+ templates = MakoTemplates()
+ parameters_data = []
+ inputs_data = []
+ outputs_data = []
+
+ extra_data = {}
+ loaded_from = '(unknown)'
+
+ def __init__(self, parent):
+ """Make a new block from nested data."""
+ super(Block, self).__init__(parent)
+ param_factory = self.parent_platform.make_param
+ port_factory = self.parent_platform.make_port
+
+ self.params = collections.OrderedDict(
+ (data['id'], param_factory(parent=self, **data))
+ for data in self.parameters_data
+ )
+ if self.key == 'options' or self.is_variable:
+ self.params['id'].hide = 'part'
+
+ self.sinks = [port_factory(parent=self, **params) for params in self.inputs_data]
+ self.sources = [port_factory(parent=self, **params) for params in self.outputs_data]
+
+ self.active_sources = [] # on rewrite
+ self.active_sinks = [] # on rewrite
+
+ self.states = {'state': True}
+
+ # region Rewrite_and_Validation
+ def rewrite(self):
+ """
+ Add and remove ports to adjust for the nports.
+ """
+ Element.rewrite(self)
+
+ def rekey(ports):
+ """Renumber non-message/message ports"""
+ domain_specific_port_index = collections.defaultdict(int)
+ for port in ports:
+ if not port.key.isdigit():
+ continue
+ domain = port.domain
+ port.key = str(domain_specific_port_index[domain])
+ domain_specific_port_index[domain] += 1
+
+ # Adjust nports
+ for ports in (self.sources, self.sinks):
+ self._rewrite_nports(ports)
+ rekey(ports)
+
+ # disconnect hidden ports
+ self.parent_flowgraph.disconnect(*[p for p in self.ports() if p.hidden])
+
+ self.active_sources = [p for p in self.sources if not p.hidden]
+ self.active_sinks = [p for p in self.sinks if not p.hidden]
+
+ def _rewrite_nports(self, ports):
+ for port in ports:
+ if hasattr(port, 'master_port'): # Not a master port and no left-over clones
+ continue
+ nports = port.multiplicity
+ for clone in port.clones[nports-1:]:
+ # Remove excess connections
+ self.parent_flowgraph.disconnect(clone)
+ port.remove_clone(clone)
+ ports.remove(clone)
+ # Add more cloned ports
+ for j in range(1 + len(port.clones), nports):
+ clone = port.add_clone()
+ ports.insert(ports.index(port) + j, clone)
+
+ def validate(self):
+ """
+ Validate this block.
+ Call the base class validate.
+ Evaluate the checks: each check must evaluate to True.
+ """
+ Element.validate(self)
+ self._run_asserts()
+ self._validate_generate_mode_compat()
+ self._validate_var_value()
+
+ def _run_asserts(self):
+ """Evaluate the checks"""
+ for expr in self.asserts:
+ try:
+ if not self.evaluate(expr):
+ self.add_error_message('Assertion "{}" failed.'.format(expr))
+ except:
+ self.add_error_message('Assertion "{}" did not evaluate.'.format(expr))
+
+ def _validate_generate_mode_compat(self):
+ """check if this is a GUI block and matches the selected generate option"""
+ current_generate_option = self.parent.get_option('generate_options')
+
+ def check_generate_mode(label, flag, valid_options):
+ block_requires_mode = (
+ flag in self.flags or self.label.upper().startswith(label)
+ )
+ if block_requires_mode and current_generate_option not in valid_options:
+ self.add_error_message("Can't generate this block in mode: {} ".format(
+ repr(current_generate_option)))
+
+ check_generate_mode('QT GUI', Flags.NEED_QT_GUI, ('qt_gui', 'hb_qt_gui'))
+
+ def _validate_var_value(self):
+ """or variables check the value (only if var_value is used)"""
+ if self.is_variable and self.value != 'value':
+ try:
+ self.parent_flowgraph.evaluate(self.value, local_namespace=self.namespace)
+ except Exception as err:
+ self.add_error_message('Value "{}" cannot be evaluated:\n{}'.format(self.value, err))
+ # endregion
+
+ # region Properties
+
+ def __str__(self):
+ return 'Block - {} - {}({})'.format(self.name, self.label, self.key)
+
+ def __repr__(self):
+ try:
+ name = self.name
+ except Exception:
+ name = self.key
+ return 'block[' + name + ']'
+
+ @property
+ def name(self):
+ return self.params['id'].value
+
+ @lazy_property
+ def is_virtual_or_pad(self):
+ return self.key in ("virtual_source", "virtual_sink", "pad_source", "pad_sink")
+
+ @lazy_property
+ def is_variable(self):
+ return bool(self.value)
+
+ @lazy_property
+ def is_import(self):
+ return self.key == 'import'
+
+ @property
+ def comment(self):
+ return self.params['comment'].value
+
+ @property
+ def state(self):
+ """Gets the block's current state."""
+ state = self.states['state']
+ return state if state in self.STATE_LABELS else 'enabled'
+
+ @state.setter
+ def state(self, value):
+ """Sets the state for the block."""
+ self.states['state'] = value
+
+ # Enable/Disable Aliases
+ @property
+ def enabled(self):
+ """Get the enabled state of the block"""
+ return self.state != 'disabled'
+
+ # endregion
+
+ ##############################################
+ # Getters (old)
+ ##############################################
+ def get_var_make(self):
+ return self.templates.render('var_make')
+
+ def get_var_value(self):
+ return self.templates.render('var_value')
+
+ def get_callbacks(self):
+ """
+ Get a list of function callbacks for this block.
+
+ Returns:
+ a list of strings
+ """
+ def make_callback(callback):
+ if 'self.' in callback:
+ return callback
+ return 'self.{}.{}'.format(self.name, callback)
+ return [make_callback(c) for c in self.templates.render('callbacks')]
+
+ def is_virtual_sink(self):
+ return self.key == 'virtual_sink'
+
+ def is_virtual_source(self):
+ return self.key == 'virtual_source'
+
+ # Block bypassing
+ def get_bypassed(self):
+ """
+ Check if the block is bypassed
+ """
+ return self.state == 'bypassed'
+
+ def set_bypassed(self):
+ """
+ Bypass the block
+
+ Returns:
+ True if block chagnes state
+ """
+ if self.state != 'bypassed' and self.can_bypass():
+ self.state = 'bypassed'
+ return True
+ return False
+
+ def can_bypass(self):
+ """ Check the number of sinks and sources and see if this block can be bypassed """
+ # Check to make sure this is a single path block
+ # Could possibly support 1 to many blocks
+ if len(self.sources) != 1 or len(self.sinks) != 1:
+ return False
+ if not (self.sources[0].dtype == self.sinks[0].dtype):
+ return False
+ if self.flags.disable_bypass:
+ return False
+ return True
+
+ def ports(self):
+ return itertools.chain(self.sources, self.sinks)
+
+ def active_ports(self):
+ return itertools.chain(self.active_sources, self.active_sinks)
+
+ def children(self):
+ return itertools.chain(six.itervalues(self.params), self.ports())
+
+ ##############################################
+ # Access
+ ##############################################
+
+ def get_sink(self, key):
+ return _get_elem(self.sinks, key)
+
+ def get_source(self, key):
+ return _get_elem(self.sources, key)
+
+ ##############################################
+ # Resolve
+ ##############################################
+ @property
+ def namespace(self):
+ return {key: param.get_evaluated() for key, param in six.iteritems(self.params)}
+
+ @property
+ def namespace_templates(self):
+ return {key: param.template_arg for key, param in six.iteritems(self.params)}
+
+ def evaluate(self, expr):
+ return self.parent_flowgraph.evaluate(expr, self.namespace)
+
+ ##############################################
+ # Import/Export Methods
+ ##############################################
+ def export_data(self):
+ """
+ Export this block's params to nested data.
+
+ Returns:
+ a nested data odict
+ """
+ data = collections.OrderedDict()
+ if self.key != 'options':
+ data['name'] = self.name
+ data['id'] = self.key
+ data['parameters'] = collections.OrderedDict(sorted(
+ (param_id, param.value) for param_id, param in self.params.items()
+ if (param_id != 'id' or self.key == 'options')
+ ))
+ data['states'] = collections.OrderedDict(sorted(self.states.items()))
+ return data
+
+ def import_data(self, name, states, parameters, **_):
+ """
+ Import this block's params from nested data.
+ Any param keys that do not exist will be ignored.
+ Since params can be dynamically created based another param,
+ call rewrite, and repeat the load until the params stick.
+ """
+ self.params['id'].value = name
+ self.states.update(states)
+
+ def get_hash():
+ return hash(tuple(hash(v) for v in self.params.values()))
+
+ pre_rewrite_hash = -1
+ while pre_rewrite_hash != get_hash():
+ for key, value in six.iteritems(parameters):
+ try:
+ self.params[key].set_value(value)
+ except KeyError:
+ continue
+ # Store hash and call rewrite
+ pre_rewrite_hash = get_hash()
+ self.rewrite()
diff --git a/grc/core/blocks/dummy.py b/grc/core/blocks/dummy.py
new file mode 100644
index 000000000..6a5ec2fa7
--- /dev/null
+++ b/grc/core/blocks/dummy.py
@@ -0,0 +1,54 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
+
+from . import Block, register_build_in
+
+
+@register_build_in
+class DummyBlock(Block):
+
+ is_dummy_block = True
+
+ label = 'Missing Block'
+ key = '_dummy'
+
+ def __init__(self, parent, missing_block_id, parameters, **_):
+ self.key = missing_block_id
+ super(DummyBlock, self).__init__(parent=parent)
+
+ param_factory = self.parent_platform.make_param
+ for param_id in parameters:
+ self.params.setdefault(param_id, param_factory(parent=self, id=param_id, dtype='string'))
+
+ def is_valid(self):
+ return False
+
+ @property
+ def enabled(self):
+ return False
+
+ def add_missing_port(self, port_id, direction):
+ port = self.parent_platform.make_port(
+ parent=self, direction=direction, id=port_id, name='?', dtype='',
+ )
+ if port.is_source:
+ self.sources.append(port)
+ else:
+ self.sinks.append(port)
+ return port
diff --git a/grc/core/blocks/embedded_python.py b/grc/core/blocks/embedded_python.py
new file mode 100644
index 000000000..0b5a7a21c
--- /dev/null
+++ b/grc/core/blocks/embedded_python.py
@@ -0,0 +1,242 @@
+# Copyright 2015-16 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
+
+from ast import literal_eval
+from textwrap import dedent
+
+from . import Block, register_build_in
+from ._templates import MakoTemplates
+
+from .. import utils
+from ..base import Element
+
+
+DEFAULT_CODE = '''\
+"""
+Embedded Python Blocks:
+
+Each time this file is saved, GRC will instantiate the first class it finds
+to get ports and parameters of your block. The arguments to __init__ will
+be the parameters. All of them are required to have default values!
+"""
+
+import numpy as np
+from gnuradio import gr
+
+
+class blk(gr.sync_block): # other base classes are basic_block, decim_block, interp_block
+ """Embedded Python Block example - a simple multiply const"""
+
+ def __init__(self, example_param=1.0): # only default arguments here
+ """arguments to this function show up as parameters in GRC"""
+ gr.sync_block.__init__(
+ self,
+ name='Embedded Python Block', # will show up in GRC
+ in_sig=[np.complex64],
+ out_sig=[np.complex64]
+ )
+ # if an attribute with the same name as a parameter is found,
+ # a callback is registered (properties work, too).
+ self.example_param = example_param
+
+ def work(self, input_items, output_items):
+ """example: multiply with constant"""
+ output_items[0][:] = input_items[0] * self.example_param
+ return len(output_items[0])
+'''
+
+DOC = """
+This block represents an arbitrary GNU Radio Python Block.
+
+Its source code can be accessed through the parameter 'Code' which opens your editor. \
+Each time you save changes in the editor, GRC will update the block. \
+This includes the number, names and defaults of the parameters, \
+the ports (stream and message) and the block name and documentation.
+
+Block Documentation:
+(will be replaced the docstring of your block class)
+"""
+
+
+@register_build_in
+class EPyBlock(Block):
+
+ key = 'epy_block'
+ label = 'Python Block'
+ documentation = {'': DOC}
+
+ parameters_data = [dict(
+ label='Code',
+ id='_source_code',
+ dtype='_multiline_python_external',
+ value=DEFAULT_CODE,
+ hide='part',
+ )]
+ inputs_data = []
+ outputs_data = []
+
+ def __init__(self, flow_graph, **kwargs):
+ super(EPyBlock, self).__init__(flow_graph, **kwargs)
+ self.states['_io_cache'] = ''
+
+ self._epy_source_hash = -1
+ self._epy_reload_error = None
+
+ def rewrite(self):
+ Element.rewrite(self)
+
+ param_src = self.params['_source_code']
+
+ src = param_src.get_value()
+ src_hash = hash((self.name, src))
+ if src_hash == self._epy_source_hash:
+ return
+
+ try:
+ blk_io = utils.epy_block_io.extract(src)
+
+ except Exception as e:
+ self._epy_reload_error = ValueError(str(e))
+ try: # Load last working block io
+ blk_io_args = literal_eval(self.states['_io_cache'])
+ if len(blk_io_args) == 6:
+ blk_io_args += ([],) # add empty callbacks
+ blk_io = utils.epy_block_io.BlockIO(*blk_io_args)
+ except Exception:
+ return
+ else:
+ self._epy_reload_error = None # Clear previous errors
+ self.states['_io_cache'] = repr(tuple(blk_io))
+
+ # print "Rewriting embedded python block {!r}".format(self.name)
+ self._epy_source_hash = src_hash
+
+ self.label = blk_io.name or blk_io.cls
+ self.documentation = {'': blk_io.doc}
+
+ self.templates['imports'] = 'import ' + self.name
+ self.templates['make'] = '{mod}.{cls}({args})'.format(
+ mod=self.name,
+ cls=blk_io.cls,
+ args=', '.join('{0}=${{ {0} }}'.format(key) for key, _ in blk_io.params))
+ self.templates['callbacks'] = [
+ '{0} = ${{ {0} }}'.format(attr) for attr in blk_io.callbacks
+ ]
+
+ self._update_params(blk_io.params)
+ self._update_ports('in', self.sinks, blk_io.sinks, 'sink')
+ self._update_ports('out', self.sources, blk_io.sources, 'source')
+
+ super(EPyBlock, self).rewrite()
+
+ def _update_params(self, params_in_src):
+ param_factory = self.parent_platform.make_param
+ params = {}
+ for param in list(self.params):
+ if hasattr(param, '__epy_param__'):
+ params[param.key] = param
+ del self.params[param.key]
+
+ for id_, value in params_in_src:
+ try:
+ param = params[id_]
+ if param.default == param.value:
+ param.set_value(value)
+ param.default = str(value)
+ except KeyError: # need to make a new param
+ param = param_factory(
+ parent=self, id=id_, dtype='raw', value=value,
+ name=id_.replace('_', ' ').title(),
+ )
+ setattr(param, '__epy_param__', True)
+ self.params[id_] = param
+
+ def _update_ports(self, label, ports, port_specs, direction):
+ port_factory = self.parent_platform.make_port
+ ports_to_remove = list(ports)
+ iter_ports = iter(ports)
+ ports_new = []
+ port_current = next(iter_ports, None)
+ for key, port_type, vlen in port_specs:
+ reuse_port = (
+ port_current is not None and
+ port_current.dtype == port_type and
+ port_current.vlen == vlen and
+ (key.isdigit() or port_current.key == key)
+ )
+ if reuse_port:
+ ports_to_remove.remove(port_current)
+ port, port_current = port_current, next(iter_ports, None)
+ else:
+ n = dict(name=label + str(key), dtype=port_type, id=key)
+ if port_type == 'message':
+ n['name'] = key
+ n['optional'] = '1'
+ if vlen > 1:
+ n['vlen'] = str(vlen)
+ port = port_factory(self, direction=direction, **n)
+ ports_new.append(port)
+ # replace old port list with new one
+ del ports[:]
+ ports.extend(ports_new)
+ # remove excess port connections
+ self.parent_flowgraph.disconnect(*ports_to_remove)
+
+ def validate(self):
+ super(EPyBlock, self).validate()
+ if self._epy_reload_error:
+ self.params['_source_code'].add_error_message(str(self._epy_reload_error))
+
+
+@register_build_in
+class EPyModule(Block):
+ key = 'epy_module'
+ label = 'Python Module'
+ documentation = {'': dedent("""
+ This block lets you embed a python module in your flowgraph.
+
+ Code you put in this module is accessible in other blocks using the ID of this
+ block. Example:
+
+ If you put
+
+ a = 2
+
+ def double(arg):
+ return 2 * arg
+
+ in a Python Module Block with the ID 'stuff' you can use code like
+
+ stuff.a # evals to 2
+ stuff.double(3) # evals to 6
+
+ to set parameters of other blocks in your flowgraph.
+ """)}
+
+ parameters_data = [dict(
+ label='Code',
+ id='source_code',
+ dtype='_multiline_python_external',
+ value='# this module will be imported in the into your flowgraph',
+ hide='part',
+ )]
+
+ templates = MakoTemplates(
+ imports='import ${ id } # embedded python module',
+ )
diff --git a/grc/core/blocks/virtual.py b/grc/core/blocks/virtual.py
new file mode 100644
index 000000000..a10853ad1
--- /dev/null
+++ b/grc/core/blocks/virtual.py
@@ -0,0 +1,76 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
+
+import itertools
+
+from . import Block, register_build_in
+
+
+@register_build_in
+class VirtualSink(Block):
+ count = itertools.count()
+
+ key = 'virtual_sink'
+ label = 'Virtual Sink'
+ documentation = {'': ''}
+
+ parameters_data = [dict(
+ label='Stream ID',
+ id='stream_id',
+ dtype='stream_id',
+ )]
+ inputs_data = [dict(
+ domain='stream',
+ dtype=''
+ )]
+
+ def __init__(self, parent, **kwargs):
+ super(VirtualSink, self).__init__(parent, **kwargs)
+ self.params['id'].hide = 'all'
+
+ @property
+ def stream_id(self):
+ return self.params['stream_id'].value
+
+
+@register_build_in
+class VirtualSource(Block):
+ count = itertools.count()
+
+ key = 'virtual_source'
+ label = 'Virtual Source'
+ documentation = {'': ''}
+
+ parameters_data = [dict(
+ label='Stream ID',
+ id='stream_id',
+ dtype='stream_id',
+ )]
+ outputs_data = [dict(
+ domain='stream',
+ dtype=''
+ )]
+
+ def __init__(self, parent, **kwargs):
+ super(VirtualSource, self).__init__(parent, **kwargs)
+ self.params['id'].hide = 'all'
+
+ @property
+ def stream_id(self):
+ return self.params['stream_id'].value
diff --git a/grc/core/cache.py b/grc/core/cache.py
new file mode 100644
index 000000000..f438d58bd
--- /dev/null
+++ b/grc/core/cache.py
@@ -0,0 +1,99 @@
+# Copyright 2017 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import, print_function
+
+from io import open
+import json
+import logging
+import os
+
+import six
+
+from .io import yaml
+
+logger = logging.getLogger(__name__)
+
+
+class Cache(object):
+
+ def __init__(self, filename):
+ self.cache_file = filename
+ self.cache = {}
+ self.need_cache_write = True
+ self._accessed_items = set()
+ try:
+ os.makedirs(os.path.dirname(filename))
+ except OSError:
+ pass
+ try:
+ self._converter_mtime = os.path.getmtime(filename)
+ except OSError:
+ self._converter_mtime = -1
+
+ def load(self):
+ try:
+ logger.debug("Loading block cache from: {}".format(self.cache_file))
+ with open(self.cache_file, encoding='utf-8') as cache_file:
+ self.cache = json.load(cache_file)
+ self.need_cache_write = False
+ except (IOError, ValueError):
+ self.need_cache_write = True
+
+ def get_or_load(self, filename):
+ self._accessed_items.add(filename)
+ if os.path.getmtime(filename) <= self._converter_mtime:
+ try:
+ return self.cache[filename]
+ except KeyError:
+ pass
+
+ with open(filename, encoding='utf-8') as fp:
+ data = yaml.safe_load(fp)
+ self.cache[filename] = data
+ self.need_cache_write = True
+ return data
+
+ def save(self):
+ if not self.need_cache_write:
+ return
+
+ logger.info('Saving %d entries to json cache', len(self.cache))
+ with open(self.cache_file, 'w', encoding='utf8') as cache_file:
+ json.dump(self.cache, cache_file)
+
+ def prune(self):
+ for filename in (set(self.cache) - self._accessed_items):
+ del self.cache[filename]
+
+ def __enter__(self):
+ self.load()
+ return self
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ self.save()
+
+
+def byteify(data):
+ if isinstance(data, dict):
+ return {byteify(key): byteify(value) for key, value in six.iteritems(data)}
+ elif isinstance(data, list):
+ return [byteify(element) for element in data]
+ elif isinstance(data, six.text_type) and six.PY2:
+ return data.encode('utf-8')
+ else:
+ return data
diff --git a/grc/core/default_flow_graph.grc b/grc/core/default_flow_graph.grc
index 059509d34..d57ec75ae 100644
--- a/grc/core/default_flow_graph.grc
+++ b/grc/core/default_flow_graph.grc
@@ -1,43 +1,32 @@
-<?xml version="1.0"?>
-<!--
###################################################
-##Default Flow Graph:
-## include an options block and a variable for sample rate
+# Default Flow Graph:
+# Include an options block and a variable for sample rate
###################################################
- -->
-<flow_graph>
- <block>
- <key>options</key>
- <param>
- <key>id</key>
- <value>top_block</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(8, 8)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>variable</key>
- <param>
- <key>id</key>
- <value>samp_rate</value>
- </param>
- <param>
- <key>value</key>
- <value>32000</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(8, 160)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
-</flow_graph>
+
+options:
+ parameters:
+ id: 'top_block'
+ title: 'top_block'
+ states:
+ coordinate:
+ - 8
+ - 8
+ rotation: 0
+ state: enabled
+
+blocks:
+- name: samp_rate
+ id: variable
+ parameters:
+ comment: ''
+ value: '32000'
+ states:
+ coordinate:
+ - 184
+ - 12
+ rotation: 0
+ state: enabled
+
+metadata:
+ file_format: 1
+ grc_version: 3.8.0
diff --git a/grc/core/errors.py b/grc/core/errors.py
new file mode 100644
index 000000000..6437cc4fa
--- /dev/null
+++ b/grc/core/errors.py
@@ -0,0 +1,30 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import, print_function
+
+
+class GRCError(Exception):
+ """Generic error class"""
+
+
+class BlockLoadError(GRCError):
+ """Error during block loading"""
+
+
+class TemplateError(BlockLoadError):
+ """Mako Template Error"""
diff --git a/grc/core/generator/CMakeLists.txt b/grc/core/generator/CMakeLists.txt
deleted file mode 100644
index 492ad7c4a..000000000
--- a/grc/core/generator/CMakeLists.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-file(GLOB py_files "*.py")
-
-GR_PYTHON_INSTALL(
- FILES ${py_files}
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core/generator
-)
-
-install(FILES
- flow_graph.tmpl
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core/generator
-)
diff --git a/grc/core/generator/FlowGraphProxy.py b/grc/core/generator/FlowGraphProxy.py
index 372300557..f438fa0d3 100644
--- a/grc/core/generator/FlowGraphProxy.py
+++ b/grc/core/generator/FlowGraphProxy.py
@@ -16,13 +16,17 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-class FlowGraphProxy(object):
+from __future__ import absolute_import
+from six.moves import range
+
+
+class FlowGraphProxy(object): # TODO: move this in a refactored Generator
def __init__(self, fg):
- self._fg = fg
+ self.orignal_flowgraph = fg
def __getattr__(self, item):
- return getattr(self._fg, item)
+ return getattr(self.orignal_flowgraph, item)
def get_hier_block_stream_io(self, direction):
"""
@@ -34,7 +38,7 @@ class FlowGraphProxy(object):
Returns:
a list of dicts with: type, label, vlen, size, optional
"""
- return filter(lambda p: p['type'] != "message", self.get_hier_block_io(direction))
+ return [p for p in self.get_hier_block_io(direction) if p['type'] != "message"]
def get_hier_block_message_io(self, direction):
"""
@@ -46,7 +50,7 @@ class FlowGraphProxy(object):
Returns:
a list of dicts with: type, label, vlen, size, optional
"""
- return filter(lambda p: p['type'] == "message", self.get_hier_block_io(direction))
+ return [p for p in self.get_hier_block_io(direction) if p['type'] == "message"]
def get_hier_block_io(self, direction):
"""
@@ -62,16 +66,17 @@ class FlowGraphProxy(object):
self.get_pad_sinks() if direction in ('source', 'out') else []
ports = []
for pad in pads:
+ type_param = pad.params['type']
master = {
- 'label': str(pad.get_param('label').get_evaluated()),
- 'type': str(pad.get_param('type').get_evaluated()),
- 'vlen': str(pad.get_param('vlen').get_value()),
- 'size': pad.get_param('type').get_opt('size'),
- 'optional': bool(pad.get_param('optional').get_evaluated()),
+ 'label': str(pad.params['label'].get_evaluated()),
+ 'type': str(pad.params['type'].get_evaluated()),
+ 'vlen': str(pad.params['vlen'].get_value()),
+ 'size': type_param.options.attributes[type_param.get_value()]['size'],
+ 'optional': bool(pad.params['optional'].get_evaluated()),
}
- num_ports = pad.get_param('num_streams').get_evaluated()
+ num_ports = pad.params['num_streams'].get_evaluated()
if num_ports > 1:
- for i in xrange(num_ports):
+ for i in range(num_ports):
clone = master.copy()
clone['label'] += str(i)
ports.append(clone)
@@ -86,8 +91,8 @@ class FlowGraphProxy(object):
Returns:
a list of pad source blocks in this flow graph
"""
- pads = filter(lambda b: b.get_key() == 'pad_source', self.get_enabled_blocks())
- return sorted(pads, lambda x, y: cmp(x.get_id(), y.get_id()))
+ pads = [b for b in self.get_enabled_blocks() if b.key == 'pad_source']
+ return sorted(pads, key=lambda x: x.name)
def get_pad_sinks(self):
"""
@@ -96,8 +101,8 @@ class FlowGraphProxy(object):
Returns:
a list of pad sink blocks in this flow graph
"""
- pads = filter(lambda b: b.get_key() == 'pad_sink', self.get_enabled_blocks())
- return sorted(pads, lambda x, y: cmp(x.get_id(), y.get_id()))
+ pads = [b for b in self.get_enabled_blocks() if b.key == 'pad_sink']
+ return sorted(pads, key=lambda x: x.name)
def get_pad_port_global_key(self, port):
"""
@@ -112,15 +117,46 @@ class FlowGraphProxy(object):
for pad in pads:
# using the block param 'type' instead of the port domain here
# to emphasize that hier block generation is domain agnostic
- is_message_pad = pad.get_param('type').get_evaluated() == "message"
- if port.get_parent() == pad:
+ is_message_pad = pad.params['type'].get_evaluated() == "message"
+ if port.parent == pad:
if is_message_pad:
- key = pad.get_param('label').get_value()
+ key = pad.params['label'].get_value()
else:
- key = str(key_offset + int(port.get_key()))
+ key = str(key_offset + int(port.key))
return key
else:
# assuming we have either only sources or sinks
if not is_message_pad:
- key_offset += len(pad.get_ports())
- return -1 \ No newline at end of file
+ key_offset += len(pad.sinks) + len(pad.sources)
+ return -1
+
+
+def get_hier_block_io(flow_graph, direction, domain=None):
+ """
+ Get a list of io ports for this flow graph.
+
+ Returns a list of dicts with: type, label, vlen, size, optional
+ """
+ pads = flow_graph.get_pad_sources() if direction in ('sink', 'in') else \
+ flow_graph.get_pad_sinks() if direction in ('source', 'out') else []
+ ports = []
+ for pad in pads:
+ type_param = pad.params['type']
+ master = {
+ 'label': str(pad.params['label'].get_evaluated()),
+ 'type': str(pad.params['type'].get_evaluated()),
+ 'vlen': str(pad.params['vlen'].get_value()),
+ 'size': type_param.options.attributes[type_param.get_value()]['size'],
+ 'optional': bool(pad.params['optional'].get_evaluated()),
+ }
+ num_ports = pad.params['num_streams'].get_evaluated()
+ if num_ports > 1:
+ for i in range(num_ports):
+ clone = master.copy()
+ clone['label'] += str(i)
+ ports.append(clone)
+ else:
+ ports.append(master)
+ if domain is not None:
+ ports = [p for p in ports if p.domain == domain]
+ return ports
diff --git a/grc/core/generator/Generator.py b/grc/core/generator/Generator.py
index dda226c6b..62dc26b8a 100644
--- a/grc/core/generator/Generator.py
+++ b/grc/core/generator/Generator.py
@@ -16,22 +16,18 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-import codecs
+from __future__ import absolute_import
+
import os
-import tempfile
-from Cheetah.Template import Template
+from mako.template import Template
-from .FlowGraphProxy import FlowGraphProxy
-from .. import ParseXML, Messages
-from ..Constants import (
- TOP_BLOCK_FILE_MODE, BLOCK_FLAG_NEED_QT_GUI,
- HIER_BLOCK_FILE_MODE, BLOCK_DTD
-)
-from ..utils import expr_utils, odict
+from .hier_block import HierBlockGenerator, QtHierBlockGenerator
+from .top_block import TopBlockGenerator
DATA_DIR = os.path.dirname(__file__)
-FLOW_GRAPH_TEMPLATE = os.path.join(DATA_DIR, 'flow_graph.tmpl')
+FLOW_GRAPH_TEMPLATE = os.path.join(DATA_DIR, 'flow_graph.py.mako')
+flow_graph_template = Template(filename=FLOW_GRAPH_TEMPLATE)
class Generator(object):
@@ -59,339 +55,3 @@ class Generator(object):
def __getattr__(self, item):
"""get all other attrib from actual generator object"""
return getattr(self._generator, item)
-
-
-class TopBlockGenerator(object):
-
- def __init__(self, flow_graph, file_path):
- """
- Initialize the top block generator object.
-
- Args:
- flow_graph: the flow graph object
- file_path: the path to write the file to
- """
- self._flow_graph = FlowGraphProxy(flow_graph)
- self._generate_options = self._flow_graph.get_option('generate_options')
- self._mode = TOP_BLOCK_FILE_MODE
- dirname = os.path.dirname(file_path)
- # Handle the case where the directory is read-only
- # In this case, use the system's temp directory
- if not os.access(dirname, os.W_OK):
- dirname = tempfile.gettempdir()
- filename = self._flow_graph.get_option('id') + '.py'
- self.file_path = os.path.join(dirname, filename)
- self._dirname = dirname
-
- def get_file_path(self):
- return self.file_path
-
- def write(self):
- """generate output and write it to files"""
- # Do throttle warning
- throttling_blocks = filter(lambda b: b.throtteling(), self._flow_graph.get_enabled_blocks())
- if not throttling_blocks and not self._generate_options.startswith('hb'):
- Messages.send_warning("This flow graph may not have flow control: "
- "no audio or RF hardware blocks found. "
- "Add a Misc->Throttle block to your flow "
- "graph to avoid CPU congestion.")
- if len(throttling_blocks) > 1:
- keys = set(map(lambda b: b.get_key(), throttling_blocks))
- if len(keys) > 1 and 'blocks_throttle' in keys:
- Messages.send_warning("This flow graph contains a throttle "
- "block and another rate limiting block, "
- "e.g. a hardware source or sink. "
- "This is usually undesired. Consider "
- "removing the throttle block.")
- # Generate
- for filename, data in self._build_python_code_from_template():
- with codecs.open(filename, 'w', encoding='utf-8') as fp:
- fp.write(data)
- if filename == self.file_path:
- try:
- os.chmod(filename, self._mode)
- except:
- pass
-
- def _build_python_code_from_template(self):
- """
- Convert the flow graph to python code.
-
- Returns:
- a string of python code
- """
- output = list()
-
- fg = self._flow_graph
- title = fg.get_option('title') or fg.get_option('id').replace('_', ' ').title()
- imports = fg.get_imports()
- variables = fg.get_variables()
- parameters = fg.get_parameters()
- monitors = fg.get_monitors()
-
- # List of blocks not including variables and imports and parameters and disabled
- def _get_block_sort_text(block):
- code = block.get_make().replace(block.get_id(), ' ')
- try:
- code += block.get_param('gui_hint').get_value() # Newer gui markup w/ qtgui
- except:
- pass
- return code
-
- blocks_all = expr_utils.sort_objects(
- filter(lambda b: b.get_enabled() and not b.get_bypassed(), fg.blocks),
- lambda b: b.get_id(), _get_block_sort_text
- )
- deprecated_block_keys = set(block.get_name() for block in blocks_all if block.is_deprecated)
- for key in deprecated_block_keys:
- Messages.send_warning("The block {!r} is deprecated.".format(key))
-
- # List of regular blocks (all blocks minus the special ones)
- blocks = filter(lambda b: b not in (imports + parameters), blocks_all)
-
- for block in blocks:
- key = block.get_key()
- file_path = os.path.join(self._dirname, block.get_id() + '.py')
- if key == 'epy_block':
- src = block.get_param('_source_code').get_value()
- output.append((file_path, src))
- elif key == 'epy_module':
- src = block.get_param('source_code').get_value()
- output.append((file_path, src))
-
- # Filter out virtual sink connections
- def cf(c):
- return not (c.is_bus() or c.get_sink().get_parent().is_virtual_sink())
- connections = filter(cf, fg.get_enabled_connections())
-
- # Get the virtual blocks and resolve their connections
- virtual = filter(lambda c: c.get_source().get_parent().is_virtual_source(), connections)
- for connection in virtual:
- sink = connection.get_sink()
- for source in connection.get_source().resolve_virtual_source():
- resolved = fg.get_parent().Connection(flow_graph=fg, porta=source, portb=sink)
- connections.append(resolved)
- # Remove the virtual connection
- connections.remove(connection)
-
- # Bypassing blocks: Need to find all the enabled connections for the block using
- # the *connections* object rather than get_connections(). Create new connections
- # that bypass the selected block and remove the existing ones. This allows adjacent
- # bypassed blocks to see the newly created connections to downstream blocks,
- # allowing them to correctly construct bypass connections.
- bypassed_blocks = fg.get_bypassed_blocks()
- for block in bypassed_blocks:
- # Get the upstream connection (off of the sink ports)
- # Use *connections* not get_connections()
- source_connection = filter(lambda c: c.get_sink() == block.get_sinks()[0], connections)
- # The source connection should never have more than one element.
- assert (len(source_connection) == 1)
-
- # Get the source of the connection.
- source_port = source_connection[0].get_source()
-
- # Loop through all the downstream connections
- for sink in filter(lambda c: c.get_source() == block.get_sources()[0], connections):
- if not sink.get_enabled():
- # Ignore disabled connections
- continue
- sink_port = sink.get_sink()
- connection = fg.get_parent().Connection(flow_graph=fg, porta=source_port, portb=sink_port)
- connections.append(connection)
- # Remove this sink connection
- connections.remove(sink)
- # Remove the source connection
- connections.remove(source_connection[0])
-
- # List of connections where each endpoint is enabled (sorted by domains, block names)
- connections.sort(key=lambda c: (
- c.get_source().get_domain(), c.get_sink().get_domain(),
- c.get_source().get_parent().get_id(), c.get_sink().get_parent().get_id()
- ))
-
- connection_templates = fg.get_parent().connection_templates
-
- # List of variable names
- var_ids = [var.get_id() for var in parameters + variables]
- replace_dict = dict((var_id, 'self.' + var_id) for var_id in var_ids)
- callbacks_all = []
- for block in blocks_all:
- callbacks_all.extend(expr_utils.expr_replace(cb, replace_dict) for cb in block.get_callbacks())
-
- # Map var id to callbacks
- def uses_var_id():
- used = expr_utils.get_variable_dependencies(callback, [var_id])
- return used and 'self.' + var_id in callback # callback might contain var_id itself
-
- callbacks = {}
- for var_id in var_ids:
- callbacks[var_id] = [callback for callback in callbacks_all if uses_var_id()]
-
- # Load the namespace
- namespace = {
- 'title': title,
- 'imports': imports,
- 'flow_graph': fg,
- 'variables': variables,
- 'parameters': parameters,
- 'monitors': monitors,
- 'blocks': blocks,
- 'connections': connections,
- 'connection_templates': connection_templates,
- 'generate_options': self._generate_options,
- 'callbacks': callbacks,
- }
- # Build the template
- t = Template(open(FLOW_GRAPH_TEMPLATE, 'r').read(), namespace)
- output.append((self.file_path, "\n".join(line.rstrip() for line in str(t).split("\n"))))
- return output
-
-
-class HierBlockGenerator(TopBlockGenerator):
- """Extends the top block generator to also generate a block XML file"""
-
- def __init__(self, flow_graph, file_path):
- """
- Initialize the hier block generator object.
-
- Args:
- flow_graph: the flow graph object
- file_path: where to write the py file (the xml goes into HIER_BLOCK_LIB_DIR)
- """
- TopBlockGenerator.__init__(self, flow_graph, file_path)
- platform = flow_graph.get_parent()
-
- hier_block_lib_dir = platform.config.hier_block_lib_dir
- if not os.path.exists(hier_block_lib_dir):
- os.mkdir(hier_block_lib_dir)
-
- self._mode = HIER_BLOCK_FILE_MODE
- self.file_path = os.path.join(hier_block_lib_dir, self._flow_graph.get_option('id') + '.py')
- self._file_path_xml = self.file_path + '.xml'
-
- def get_file_path_xml(self):
- return self._file_path_xml
-
- def write(self):
- """generate output and write it to files"""
- TopBlockGenerator.write(self)
- ParseXML.to_file(self._build_block_n_from_flow_graph_io(), self.get_file_path_xml())
- ParseXML.validate_dtd(self.get_file_path_xml(), BLOCK_DTD)
- try:
- os.chmod(self.get_file_path_xml(), self._mode)
- except:
- pass
-
- def _build_block_n_from_flow_graph_io(self):
- """
- Generate a block XML nested data from the flow graph IO
-
- Returns:
- a xml node tree
- """
- # Extract info from the flow graph
- block_key = self._flow_graph.get_option('id')
- parameters = self._flow_graph.get_parameters()
-
- def var_or_value(name):
- if name in map(lambda p: p.get_id(), parameters):
- return "$"+name
- return name
-
- # Build the nested data
- block_n = odict()
- block_n['name'] = self._flow_graph.get_option('title') or \
- self._flow_graph.get_option('id').replace('_', ' ').title()
- block_n['key'] = block_key
- block_n['category'] = self._flow_graph.get_option('category')
- block_n['import'] = "from {0} import {0} # grc-generated hier_block".format(
- self._flow_graph.get_option('id'))
- # Make data
- if parameters:
- block_n['make'] = '{cls}(\n {kwargs},\n)'.format(
- cls=block_key,
- kwargs=',\n '.join(
- '{key}=${key}'.format(key=param.get_id()) for param in parameters
- ),
- )
- else:
- block_n['make'] = '{cls}()'.format(cls=block_key)
- # Callback data
- block_n['callback'] = [
- 'set_{key}(${key})'.format(key=param.get_id()) for param in parameters
- ]
-
- # Parameters
- block_n['param'] = list()
- for param in parameters:
- param_n = odict()
- param_n['name'] = param.get_param('label').get_value() or param.get_id()
- param_n['key'] = param.get_id()
- param_n['value'] = param.get_param('value').get_value()
- param_n['type'] = 'raw'
- param_n['hide'] = param.get_param('hide').get_value()
- block_n['param'].append(param_n)
-
- # Bus stuff
- if self._flow_graph.get_bussink():
- block_n['bus_sink'] = '1'
- if self._flow_graph.get_bussrc():
- block_n['bus_source'] = '1'
-
- # Sink/source ports
- for direction in ('sink', 'source'):
- block_n[direction] = list()
- for port in self._flow_graph.get_hier_block_io(direction):
- port_n = odict()
- port_n['name'] = port['label']
- port_n['type'] = port['type']
- if port['type'] != "message":
- port_n['vlen'] = var_or_value(port['vlen'])
- if port['optional']:
- port_n['optional'] = '1'
- block_n[direction].append(port_n)
-
- # More bus stuff
- bus_struct_sink = self._flow_graph.get_bus_structure_sink()
- if bus_struct_sink:
- block_n['bus_structure_sink'] = bus_struct_sink[0].get_param('struct').get_value()
- bus_struct_src = self._flow_graph.get_bus_structure_src()
- if bus_struct_src:
- block_n['bus_structure_source'] = bus_struct_src[0].get_param('struct').get_value()
-
- # Documentation
- block_n['doc'] = "\n".join(field for field in (
- self._flow_graph.get_option('author'),
- self._flow_graph.get_option('description'),
- self.file_path
- ) if field)
- block_n['grc_source'] = str(self._flow_graph.grc_file_path)
-
- n = {'block': block_n}
- return n
-
-
-class QtHierBlockGenerator(HierBlockGenerator):
-
- def _build_block_n_from_flow_graph_io(self):
- n = HierBlockGenerator._build_block_n_from_flow_graph_io(self)
- block_n = n['block']
-
- if not block_n['name'].upper().startswith('QT GUI'):
- block_n['name'] = 'QT GUI ' + block_n['name']
-
- block_n.insert_after('category', 'flags', BLOCK_FLAG_NEED_QT_GUI)
-
- gui_hint_param = odict()
- gui_hint_param['name'] = 'GUI Hint'
- gui_hint_param['key'] = 'gui_hint'
- gui_hint_param['value'] = ''
- gui_hint_param['type'] = 'gui_hint'
- gui_hint_param['hide'] = 'part'
- block_n['param'].append(gui_hint_param)
-
- block_n['make'] += (
- "\n#set $win = 'self.%s' % $id"
- "\n${gui_hint()($win)}"
- )
- return n
diff --git a/grc/core/generator/__init__.py b/grc/core/generator/__init__.py
index f44b94a85..98f410c8d 100644
--- a/grc/core/generator/__init__.py
+++ b/grc/core/generator/__init__.py
@@ -15,4 +15,5 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-from Generator import Generator
+from __future__ import absolute_import
+from .Generator import Generator
diff --git a/grc/core/generator/flow_graph.py.mako b/grc/core/generator/flow_graph.py.mako
new file mode 100644
index 000000000..877c9eee9
--- /dev/null
+++ b/grc/core/generator/flow_graph.py.mako
@@ -0,0 +1,415 @@
+% if not generate_options.startswith('hb'):
+<%
+from sys import version_info
+python_version = version_info.major
+%>\
+% if python_version == 2:
+#!/usr/bin/env python2
+% elif python_version == 3:
+#!/usr/bin/env python3
+% endif
+% endif
+# -*- coding: utf-8 -*-
+<%def name="indent(code)">${ '\n '.join(str(code).splitlines()) }</%def>
+"""
+GNU Radio Python Flow Graph
+
+Title: ${title}
+% if flow_graph.get_option('author'):
+Author: ${flow_graph.get_option('author')}
+% endif
+% if flow_graph.get_option('description'):
+Description: ${flow_graph.get_option('description')}
+% endif
+Generated: ${ generated_time }
+"""
+
+% if generate_options == 'qt_gui':
+from distutils.version import StrictVersion
+
+if __name__ == '__main__':
+ import ctypes
+ import sys
+ if sys.platform.startswith('linux'):
+ try:
+ x11 = ctypes.cdll.LoadLibrary('libX11.so')
+ x11.XInitThreads()
+ except:
+ print("Warning: failed to XInitThreads()")
+
+% endif
+########################################################
+##Create Imports
+########################################################
+% for imp in imports:
+##${imp.replace(" # grc-generated hier_block", "")}
+${imp}
+% endfor
+########################################################
+##Create Class
+## Write the class declaration for a top or hier block.
+## The parameter names are the arguments to __init__.
+## Setup the IO signature (hier block only).
+########################################################
+<%
+ class_name = flow_graph.get_option('id')
+ param_str = ', '.join(['self'] + ['%s=%s'%(param.name, param.templates.render('make')) for param in parameters])
+%>\
+% if generate_options == 'qt_gui':
+from gnuradio import qtgui
+
+class ${class_name}(gr.top_block, Qt.QWidget):
+
+ def __init__(${param_str}):
+ gr.top_block.__init__(self, "${title}")
+ Qt.QWidget.__init__(self)
+ self.setWindowTitle("${title}")
+ qtgui.util.check_set_qss()
+ try:
+ self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
+ except:
+ pass
+ self.top_scroll_layout = Qt.QVBoxLayout()
+ self.setLayout(self.top_scroll_layout)
+ self.top_scroll = Qt.QScrollArea()
+ self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
+ self.top_scroll_layout.addWidget(self.top_scroll)
+ self.top_scroll.setWidgetResizable(True)
+ self.top_widget = Qt.QWidget()
+ self.top_scroll.setWidget(self.top_widget)
+ self.top_layout = Qt.QVBoxLayout(self.top_widget)
+ self.top_grid_layout = Qt.QGridLayout()
+ self.top_layout.addLayout(self.top_grid_layout)
+
+ self.settings = Qt.QSettings("GNU Radio", "${class_name}")
+
+ try:
+ if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
+ self.restoreGeometry(self.settings.value("geometry").toByteArray())
+ else:
+ self.restoreGeometry(self.settings.value("geometry"))
+ except:
+ pass
+% elif generate_options == 'bokeh_gui':
+
+class ${class_name}(gr.top_block):
+ def __init__(self, doc):
+ gr.top_block.__init__(self, "${title}")
+ self.doc = doc
+ self.plot_lst = []
+ self.widget_lst = []
+% elif generate_options == 'no_gui':
+
+class ${class_name}(gr.top_block):
+
+ def __init__(${param_str}):
+ gr.top_block.__init__(self, "${title}")
+% elif generate_options.startswith('hb'):
+ <% in_sigs = flow_graph.get_hier_block_stream_io('in') %>
+ <% out_sigs = flow_graph.get_hier_block_stream_io('out') %>
+
+
+% if generate_options == 'hb_qt_gui':
+class ${class_name}(gr.hier_block2, Qt.QWidget):
+% else:
+class ${class_name}(gr.hier_block2):
+% endif
+<%def name="make_io_sig(io_sigs)">
+ <% size_strs = ['%s*%s'%(io_sig['size'], io_sig['vlen']) for io_sig in io_sigs] %>
+ % if len(io_sigs) == 0:
+gr.io_signature(0, 0, 0)
+ % elif len(io_sigs) == 1:
+gr.io_signature(1, 1, ${size_strs[0]})
+ % else:
+gr.io_signaturev(${len(io_sigs)}, ${len(io_sigs)}, [${', '.join(ize_strs)}])
+ % endif
+</%def>
+
+ def __init__(${param_str}):
+ gr.hier_block2.__init__(
+ self, "${ title }",
+ ${make_io_sig(in_sigs)},
+ ${make_io_sig(out_sigs)},
+ )
+ % for pad in flow_graph.get_hier_block_message_io('in'):
+ self.message_port_register_hier_in("${ pad['label'] }")
+ % endfor
+ % for pad in flow_graph.get_hier_block_message_io('out'):
+ self.message_port_register_hier_out("${ pad['label'] }")
+ % endfor
+ % if generate_options == 'hb_qt_gui':
+
+ Qt.QWidget.__init__(self)
+ self.top_layout = Qt.QVBoxLayout()
+ self.top_grid_layout = Qt.QGridLayout()
+ self.top_layout.addLayout(self.top_grid_layout)
+ self.setLayout(self.top_layout)
+ % endif
+% endif
+% if flow_graph.get_option('thread_safe_setters'):
+
+ self._lock = threading.RLock()
+% endif
+########################################################
+##Create Parameters
+## Set the parameter to a property of self.
+########################################################
+% if parameters:
+
+ ${'##################################################'}
+ # Parameters
+ ${'##################################################'}
+% endif
+% for param in parameters:
+ ${indent(param.get_var_make())}
+% endfor
+########################################################
+##Create Variables
+########################################################
+% if variables:
+
+ ${'##################################################'}
+ # Variables
+ ${'##################################################'}
+% endif
+% for var in variables:
+ ${indent(var.templates.render('var_make'))}
+% endfor
+ % if blocks:
+
+ ${'##################################################'}
+ # Blocks
+ ${'##################################################'}
+ % endif
+ % for blk, blk_make in blocks:
+ ${ indent(blk_make.strip('\n')) }
+## % if 'alias' in blk.params and blk.params['alias'].get_evaluated():
+## (self.${blk.name}).set_block_alias("${blk.params['alias'].get_evaluated()}")
+## % endif
+## % if 'affinity' in blk.params and blk.params['affinity'].get_evaluated():
+## (self.${blk.name}).set_processor_affinity(${blk.params['affinity'].get_evaluated()})
+## % endif
+## % if len(blk.sources) > 0 and 'minoutbuf' in blk.params and int(blk.params['minoutbuf'].get_evaluated()) > 0:
+## (self.${blk.name}).set_min_output_buffer(${blk.params['minoutbuf'].get_evaluated()})
+## % endif
+## % if len(blk.sources) > 0 and 'maxoutbuf' in blk.params and int(blk.params['maxoutbuf'].get_evaluated()) > 0:
+## (self.${blk.name}).set_max_output_buffer(${blk.params['maxoutbuf'].get_evaluated()})
+## % endif
+ % endfor
+
+##########################################################
+## Create a layout entry if not manually done for BokehGUI
+##########################################################
+% if generate_options == 'bokeh_gui':
+ if self.widget_lst:
+ input_t = bokehgui.BokehLayout.widgetbox(self.widget_lst)
+ widgetbox = bokehgui.BokehLayout.WidgetLayout(input_t)
+ widgetbox.set_layout(*(${flow_graph.get_option('placement')}))
+ list_obj = [widgetbox] + self.plot_lst
+ else:
+ list_obj = self.plot_lst
+ layout_t = bokehgui.BokehLayout.create_layout(list_obj, "${flow_graph.get_option('sizing_mode')}")
+ self.doc.add_root(layout_t)
+% endif
+
+ % if connections:
+
+ ${'##################################################'}
+ # Connections
+ ${'##################################################'}
+ % for connection in connections:
+ ${ connection.rstrip() }
+ % endfor
+ % endif
+########################################################
+## QT sink close method reimplementation
+########################################################
+% if generate_options == 'qt_gui':
+
+ def closeEvent(self, event):
+ self.settings = Qt.QSettings("GNU Radio", "${class_name}")
+ self.settings.setValue("geometry", self.saveGeometry())
+ event.accept()
+ % if flow_graph.get_option('qt_qss_theme'):
+
+ def setStyleSheetFromFile(self, filename):
+ try:
+ if not os.path.exists(filename):
+ filename = os.path.join(
+ gr.prefix(), "share", "gnuradio", "themes", filename)
+ with open(filename) as ss:
+ self.setStyleSheet(ss.read())
+ except Exception as e:
+ print >> sys.stderr, e
+ % endif
+% endif
+##
+##
+##
+## Create Callbacks
+## Write a set method for this variable that calls the callbacks
+########################################################
+ % for var in parameters + variables:
+
+ def get_${ var.name }(self):
+ return self.${ var.name }
+
+ def set_${ var.name }(self, ${ var.name }):
+ % if flow_graph.get_option('thread_safe_setters'):
+ with self._lock:
+ self.${ var.name } = ${ var.name }
+ % for callback in callbacks[var.name]:
+ ${ indent(callback) }
+ % endfor
+ % else:
+ self.${ var.name } = ${ var.name }
+ % for callback in callbacks[var.name]:
+ ${ indent(callback) }
+ % endfor
+ % endif
+ % endfor
+########################################################
+##Create Main
+## For top block code, generate a main routine.
+## Instantiate the top block and run as gui or cli.
+########################################################
+<%def name="make_default(type_, param)">
+ % if type_ == 'eng_float':
+eng_notation.num_to_str(${param.templates.render('make')})
+ % else:
+${param.templates.render('make')}
+ % endif
+</%def>\
+% if not generate_options.startswith('hb'):
+<% params_eq_list = list() %>
+% if parameters:
+
+<% arg_parser_args = '' %>\
+def argument_parser():
+ % if flow_graph.get_option('description'):
+ <%
+ arg_parser_args = 'description=description'
+ %>description = ${repr(flow_graph.get_option('description'))}
+ % endif
+ parser = ArgumentParser(${arg_parser_args})
+ % for param in parameters:
+<%
+ switches = ['"--{}"'.format(param.name.replace('_', '-'))]
+ short_id = param.params['short_id'].get_value()
+ if short_id:
+ switches.insert(0, '"-{}"'.format(short_id))
+
+ type_ = param.params['type'].get_value()
+ if type_:
+ params_eq_list.append('%s=options.%s' % (param.name, param.name))
+
+ default = param.templates.render('make')
+ if type_ == 'eng_float':
+ default = eng_notation.num_to_str(default)
+ # FIXME:
+ if type_ == 'string':
+ type_ = 'str'
+ %>\
+ % if type_:
+ parser.add_argument(
+ ${ ', '.join(switches) }, dest="${param.name}", type=${type_}, default=${ default },
+ help="Set ${param.params['label'].get_evaluated() or param.name} [default=%(default)r]")
+ % endif
+ % endfor
+ return parser
+% endif
+
+
+def main(top_block_cls=${class_name}, options=None):
+ % if parameters:
+ if options is None:
+ options = argument_parser().parse_args()
+ % endif
+ % if flow_graph.get_option('realtime_scheduling'):
+ if gr.enable_realtime_scheduling() != gr.RT_OK:
+ print "Error: failed to enable real-time scheduling."
+ % endif
+ % if generate_options == 'qt_gui':
+
+ if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
+ style = gr.prefs().get_string('qtgui', 'style', 'raster')
+ Qt.QApplication.setGraphicsSystem(style)
+ qapp = Qt.QApplication(sys.argv)
+
+ tb = top_block_cls(${ ', '.join(params_eq_list) })
+ % if flow_graph.get_option('run'):
+ tb.start(${flow_graph.get_option('max_nouts') or ''})
+ % endif
+ % if flow_graph.get_option('qt_qss_theme'):
+ tb.setStyleSheetFromFile(${ flow_graph.get_option('qt_qss_theme') })
+ % endif
+ tb.show()
+
+ def quitting():
+ tb.stop()
+ tb.wait()
+ qapp.aboutToQuit.connect(quitting)
+ % for m in monitors:
+ if 'en' in m.params:
+ if m.params['en'].get_value():
+ (tb.${m.name}).start()
+ else:
+ sys.stderr.write("Monitor '{0}' does not have an enable ('en') parameter.".format("tb.${m.name}"))
+ % endfor
+ qapp.exec_()
+ % elif generate_options == 'bokeh_gui':
+ serverProc, port = bokehgui.utils.create_server()
+ def killProc(signum, frame, tb):
+ tb.stop()
+ tb.wait()
+ serverProc.terminate()
+ serverProc.kill()
+ time.sleep(1)
+ try:
+ # Define the document instance
+ doc = curdoc()
+ % if flow_graph.get_option('author'):
+ doc.title = "${title} - ${flow_graph.get_option('author')}"
+ % else:
+ doc.title = "${title}"
+ % endif
+ session = push_session(doc, session_id="${flow_graph.get_option('id')}",
+ url = "http://localhost:" + port + "/bokehgui")
+ # Create Top Block instance
+ tb = top_block_cls(doc)
+ try:
+ tb.start()
+ signal.signal(signal.SIGTERM, functools.partial(killProc, tb=tb))
+ session.loop_until_closed()
+ finally:
+ print("Exiting the simulation. Stopping Bokeh Server")
+ tb.stop()
+ tb.wait()
+ finally:
+ serverProc.terminate()
+ serverProc.kill()
+ % elif generate_options == 'no_gui':
+ tb = top_block_cls(${ ', '.join(params_eq_list) })
+ % if flow_graph.get_option('run_options') == 'prompt':
+ tb.start(${ flow_graph.get_option('max_nouts') or '' })
+ % for m in monitors:
+ (tb.${m.name}).start()
+ % endfor
+ try:
+ input('Press Enter to quit: ')
+ except EOFError:
+ pass
+ tb.stop()
+ % elif flow_graph.get_option('run_options') == 'run':
+ tb.start(${flow_graph.get_option('max_nouts') or ''})
+ % endif
+ % for m in monitors:
+ (tb.${m.name}).start()
+ % endfor
+ tb.wait()
+ % endif
+
+
+if __name__ == '__main__':
+ main()
+% endif
diff --git a/grc/core/generator/flow_graph.tmpl b/grc/core/generator/flow_graph.tmpl
deleted file mode 100644
index 3bcf54eee..000000000
--- a/grc/core/generator/flow_graph.tmpl
+++ /dev/null
@@ -1,475 +0,0 @@
-#if not $generate_options.startswith('hb')
-#!/usr/bin/env python2
-#end if
-# -*- coding: utf-8 -*-
-########################################################
-##Cheetah template - gnuradio_python
-##
-##@param imports the import statements
-##@param flow_graph the flow_graph
-##@param variables the variable blocks
-##@param parameters the parameter blocks
-##@param blocks the signal blocks
-##@param connections the connections
-##@param generate_options the type of flow graph
-##@param callbacks variable id map to callback strings
-########################################################
-#def indent($code)
-#set $code = '\n '.join(str($code).splitlines())
-$code#slurp
-#end def
-#import time
-#set $DIVIDER = '#'*50
-$DIVIDER
-# GNU Radio Python Flow Graph
-# Title: $title
-#if $flow_graph.get_option('author')
-# Author: $flow_graph.get_option('author')
-#end if
-#if $flow_graph.get_option('description')
-# Description: $flow_graph.get_option('description')
-#end if
-# Generated: $time.ctime()
-$DIVIDER
-#if $flow_graph.get_option('thread_safe_setters')
-import threading
-#end if
-
-#if $generate_options == 'qt_gui'
-from distutils.version import StrictVersion
-#end if
-
-## Call XInitThreads as the _very_ first thing.
-## After some Qt import, it's too late
-#if $generate_options == 'qt_gui'
-if __name__ == '__main__':
- import ctypes
- import sys
- if sys.platform.startswith('linux'):
- try:
- x11 = ctypes.cdll.LoadLibrary('libX11.so')
- x11.XInitThreads()
- except:
- print "Warning: failed to XInitThreads()"
-
-#end if
-#
-########################################################
-##Create Imports
-########################################################
-#if $flow_graph.get_option('qt_qss_theme')
-#set imports = $sorted(set($imports + ["import os", "import sys"]))
-#end if
-#if any(imp.endswith("# grc-generated hier_block") for imp in $imports)
-import os
-import sys
-#set imports = $filter(lambda i: i not in ("import os", "import sys"), $imports)
-sys.path.append(os.environ.get('GRC_HIER_PATH', os.path.expanduser('~/.grc_gnuradio')))
-
-#end if
-#for $imp in $imports
-##$(imp.replace(" # grc-generated hier_block", ""))
-$imp
-#end for
-########################################################
-##Create Class
-## Write the class declaration for a top or hier block.
-## The parameter names are the arguments to __init__.
-## Setup the IO signature (hier block only).
-########################################################
-#set $class_name = $flow_graph.get_option('id')
-#set $param_str = ', '.join(['self'] + ['%s=%s'%(param.get_id(), param.get_make()) for param in $parameters])
-#if $generate_options == 'qt_gui'
-from gnuradio import qtgui
-
-class $(class_name)(gr.top_block, Qt.QWidget):
-
- def __init__($param_str):
- gr.top_block.__init__(self, "$title")
- Qt.QWidget.__init__(self)
- self.setWindowTitle("$title")
- qtgui.util.check_set_qss()
- try:
- self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc'))
- except:
- pass
- self.top_scroll_layout = Qt.QVBoxLayout()
- self.setLayout(self.top_scroll_layout)
- self.top_scroll = Qt.QScrollArea()
- self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame)
- self.top_scroll_layout.addWidget(self.top_scroll)
- self.top_scroll.setWidgetResizable(True)
- self.top_widget = Qt.QWidget()
- self.top_scroll.setWidget(self.top_widget)
- self.top_layout = Qt.QVBoxLayout(self.top_widget)
- self.top_grid_layout = Qt.QGridLayout()
- self.top_layout.addLayout(self.top_grid_layout)
-
- self.settings = Qt.QSettings("GNU Radio", "$class_name")
-
- try:
- if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
- self.restoreGeometry(self.settings.value("geometry").toByteArray())
- else:
- self.restoreGeometry(self.settings.value("geometry"))
- except:
- pass
-#elif $generate_options == 'bokeh_gui'
-
-class $(class_name)(gr.top_block):
- def __init__(self, doc):
- gr.top_block.__init__(self, "$title")
- self.doc = doc
- self.plot_lst = []
- self.widget_lst = []
-#elif $generate_options == 'no_gui'
-
-
-class $(class_name)(gr.top_block):
-
- def __init__($param_str):
- gr.top_block.__init__(self, "$title")
-#elif $generate_options.startswith('hb')
- #set $in_sigs = $flow_graph.get_hier_block_stream_io('in')
- #set $out_sigs = $flow_graph.get_hier_block_stream_io('out')
-
-
-#if $generate_options == 'hb_qt_gui'
-class $(class_name)(gr.hier_block2, Qt.QWidget):
-#else
-class $(class_name)(gr.hier_block2):
-#end if
-#def make_io_sig($io_sigs)
- #set $size_strs = ['%s*%s'%(io_sig['size'], io_sig['vlen']) for io_sig in $io_sigs]
- #if len($io_sigs) == 0
-gr.io_signature(0, 0, 0)#slurp
- #elif len($io_sigs) == 1
-gr.io_signature(1, 1, $size_strs[0])#slurp
- #else
-gr.io_signaturev($(len($io_sigs)), $(len($io_sigs)), [$(', '.join($size_strs))])#slurp
- #end if
-#end def
-
- def __init__($param_str):
- gr.hier_block2.__init__(
- self, "$title",
- $make_io_sig($in_sigs),
- $make_io_sig($out_sigs),
- )
- #for $pad in $flow_graph.get_hier_block_message_io('in')
- self.message_port_register_hier_in("$pad['label']")
- #end for
- #for $pad in $flow_graph.get_hier_block_message_io('out')
- self.message_port_register_hier_out("$pad['label']")
- #end for
- #if $generate_options == 'hb_qt_gui'
-
- Qt.QWidget.__init__(self)
- self.top_layout = Qt.QVBoxLayout()
- self.top_grid_layout = Qt.QGridLayout()
- self.top_layout.addLayout(self.top_grid_layout)
- self.setLayout(self.top_layout)
- #end if
-#end if
-#if $flow_graph.get_option('thread_safe_setters')
-
- self._lock = threading.RLock()
-#end if
-########################################################
-##Create Parameters
-## Set the parameter to a property of self.
-########################################################
-#if $parameters
-
- $DIVIDER
- # Parameters
- $DIVIDER
-#end if
-#for $param in $parameters
- $indent($param.get_var_make())
-#end for
-########################################################
-##Create Variables
-########################################################
-#if $variables
-
- $DIVIDER
- # Variables
- $DIVIDER
-#end if
-#for $var in $variables
- $indent($var.get_var_make())
-#end for
-########################################################
-##Create Blocks
-########################################################
-#if $blocks
-
- $DIVIDER
- # Blocks
- $DIVIDER
-#end if
-#for $blk in filter(lambda b: b.get_make(), $blocks)
- #if $blk in $variables
- $indent($blk.get_make())
- #else
- self.$blk.get_id() = $indent($blk.get_make())
- #if $blk.has_param('alias') and $blk.get_param('alias').get_evaluated()
- (self.$blk.get_id()).set_block_alias("$blk.get_param('alias').get_evaluated()")
- #end if
- #if $blk.has_param('affinity') and $blk.get_param('affinity').get_evaluated()
- (self.$blk.get_id()).set_processor_affinity($blk.get_param('affinity').get_evaluated())
- #end if
- #if (len($blk.get_sources())>0) and $blk.has_param('minoutbuf') and (int($blk.get_param('minoutbuf').get_evaluated()) > 0)
- (self.$blk.get_id()).set_min_output_buffer($blk.get_param('minoutbuf').get_evaluated())
- #end if
- #if (len($blk.get_sources())>0) and $blk.has_param('maxoutbuf') and (int($blk.get_param('maxoutbuf').get_evaluated()) > 0)
- (self.$blk.get_id()).set_max_output_buffer($blk.get_param('maxoutbuf').get_evaluated())
- #end if
- #end if
-#end for
-
-##########################################################
-## Create a layout entry if not manually done for BokehGUI
-##########################################################
-#if $generate_options == 'bokeh_gui'
- if self.widget_lst:
- input_t = bokehgui.BokehLayout.widgetbox(self.widget_lst)
- widgetbox = bokehgui.BokehLayout.WidgetLayout(input_t)
- widgetbox.set_layout(*($flow_graph.get_option('placement')))
- list_obj = [widgetbox] + self.plot_lst
- else:
- list_obj = self.plot_lst
- layout_t = bokehgui.BokehLayout.create_layout(list_obj, "$flow_graph.get_option('sizing_mode')")
- self.doc.add_root(layout_t)
-#end if
-
-########################################################
-##Create Connections
-## The port name should be the id of the parent block.
-## However, port names for IO pads should be self.
-########################################################
-#def make_port_sig($port)
- #if $port.get_parent().get_key() in ('pad_source', 'pad_sink')
- #set block = 'self'
- #set key = $flow_graph.get_pad_port_global_key($port)
- #else
- #set block = 'self.' + $port.get_parent().get_id()
- #set key = $port.get_key()
- #end if
- #if not $key.isdigit()
- #set key = repr($key)
- #end if
-($block, $key)#slurp
-#end def
-#if $connections
-
- $DIVIDER
- # Connections
- $DIVIDER
-#end if
-#for $con in $connections
- #set global $source = $con.get_source()
- #set global $sink = $con.get_sink()
- #include source=$connection_templates[($source.get_domain(), $sink.get_domain())]
-
-#end for
-########################################################
-## QT sink close method reimplementation
-########################################################
-#if $generate_options == 'qt_gui'
-
- def closeEvent(self, event):
- self.settings = Qt.QSettings("GNU Radio", "$class_name")
- self.settings.setValue("geometry", self.saveGeometry())
- event.accept()
- #if $flow_graph.get_option('qt_qss_theme')
-
- def setStyleSheetFromFile(self, filename):
- try:
- if not os.path.exists(filename):
- filename = os.path.join(
- gr.prefix(), "share", "gnuradio", "themes", filename)
- with open(filename) as ss:
- self.setStyleSheet(ss.read())
- except Exception as e:
- print >> sys.stderr, e
- #end if
-#end if
-########################################################
-##Create Callbacks
-## Write a set method for this variable that calls the callbacks
-########################################################
-#for $var in $parameters + $variables
-
- #set $id = $var.get_id()
- def get_$(id)(self):
- return self.$id
-
- def set_$(id)(self, $id):
- #if $flow_graph.get_option('thread_safe_setters')
- with self._lock:
- self.$id = $id
- #for $callback in $callbacks[$id]
- $indent($callback)
- #end for
- #else
- self.$id = $id
- #for $callback in $callbacks[$id]
- $indent($callback)
- #end for
- #end if
-#end for
-########################################################
-##Create Main
-## For top block code, generate a main routine.
-## Instantiate the top block and run as gui or cli.
-########################################################
-#def make_default($type, $param)
- #if $type == 'eng_float'
-eng_notation.num_to_str($param.get_make())#slurp
- #else
-$param.get_make()#slurp
- #end if
-#end def
-#def make_short_id($param)
- #set $short_id = $param.get_param('short_id').get_evaluated()
- #if $short_id
- #set $short_id = '-' + $short_id
- #end if
-$short_id#slurp
-#end def
-#if not $generate_options.startswith('hb')
-#set $params_eq_list = list()
-#if $parameters
-
-
-def argument_parser():
- #set $arg_parser_args = ''
- #if $flow_graph.get_option('description')
- #set $arg_parser_args = 'description=description'
- description = $repr($flow_graph.get_option('description'))
- #end if
- parser = ArgumentParser($arg_parser_args)
- #for $param in $parameters
- #set $type = $param.get_param('type').get_value()
- #if $type
- #silent $params_eq_list.append('%s=options.%s'%($param.get_id(), $param.get_id()))
- parser.add_argument(
- #if $make_short_id($param)
- "$make_short_id($param)", #slurp
- #end if
- "--$param.get_id().replace('_', '-')", dest="$param.get_id()", type=$type, default=$make_default($type, $param),
- help="Set $($param.get_param('label').get_evaluated() or $param.get_id()) [default=%(default)r]")
- #end if
- #end for
- return parser
-#end if
-
-
-def main(top_block_cls=$(class_name), options=None):
- #if $parameters
- if options is None:
- options = argument_parser().parse_args()
- #end if
- #if $flow_graph.get_option('realtime_scheduling')
- if gr.enable_realtime_scheduling() != gr.RT_OK:
- print "Error: failed to enable real-time scheduling."
- #end if
-
- #if $generate_options == 'qt_gui'
- if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"):
- style = gr.prefs().get_string('qtgui', 'style', 'raster')
- Qt.QApplication.setGraphicsSystem(style)
- qapp = Qt.QApplication(sys.argv)
-
- tb = top_block_cls($(', '.join($params_eq_list)))
- #if $flow_graph.get_option('run')
- #if $flow_graph.get_option('max_nouts')
- tb.start($flow_graph.get_option('max_nouts'))
- #else
- tb.start()
- #end if
- #end if
- #if $flow_graph.get_option('qt_qss_theme')
- tb.setStyleSheetFromFile($repr($flow_graph.get_option('qt_qss_theme')))
- #end if
- tb.show()
-
- def quitting():
- tb.stop()
- tb.wait()
- qapp.aboutToQuit.connect(quitting)
- #for $m in $monitors
- if $m.has_param('en'):
- if $m.get_param('en').get_value():
- (tb.$m.get_id()).start()
- else:
- sys.stderr.write("Monitor '{0}' does not have an enable ('en') parameter.".format("tb.$m.get_id()"))
- #end for
- qapp.exec_()
- #elif $generate_options == 'bokeh_gui'
- serverProc, port = bokehgui.utils.create_server()
- def killProc(signum, frame, tb):
- tb.stop()
- tb.wait()
- serverProc.terminate()
- serverProc.kill()
- time.sleep(1)
- try:
- \# Define the document instance
- doc = curdoc()
- #if $flow_graph.get_option('author')
- doc.title = "$title - $flow_graph.get_option('author')"
- #else
- doc.title = "$title"
- #end if
- session = push_session(doc, session_id="$flow_graph.get_option('id')",
- url = "http://localhost:" + port + "/bokehgui")
- \# Create Top Block instance
- tb = top_block_cls(doc)
- try:
- tb.start()
- signal.signal(signal.SIGTERM, functools.partial(killProc, tb=tb))
- session.loop_until_closed()
- finally:
- print "Exiting the simulation. Stopping Bokeh Server"
- tb.stop()
- tb.wait()
- finally:
- serverProc.terminate()
- serverProc.kill()
- #elif $generate_options == 'no_gui'
- tb = top_block_cls($(', '.join($params_eq_list)))
- #set $run_options = $flow_graph.get_option('run_options')
- #if $run_options == 'prompt'
- #if $flow_graph.get_option('max_nouts')
- tb.start($flow_graph.get_option('max_nouts'))
- #else
- tb.start()
- #end if
- #for $m in $monitors
- (tb.$m.get_id()).start()
- #end for
- try:
- raw_input('Press Enter to quit: ')
- except EOFError:
- pass
- tb.stop()
- #elif $run_options == 'run'
- #if $flow_graph.get_option('max_nouts')
- tb.start($flow_graph.get_option('max_nouts'))
- #else
- tb.start()
- #end if
- #end if
- #for $m in $monitors
- (tb.$m.get_id()).start()
- #end for
- tb.wait()
- #end if
-
-
-if __name__ == '__main__':
- main()
-#end if
diff --git a/grc/core/generator/hier_block.py b/grc/core/generator/hier_block.py
new file mode 100644
index 000000000..31cd198c0
--- /dev/null
+++ b/grc/core/generator/hier_block.py
@@ -0,0 +1,193 @@
+import collections
+import os
+
+import six
+
+from .top_block import TopBlockGenerator
+
+from .. import ParseXML, Constants
+
+
+class HierBlockGenerator(TopBlockGenerator):
+ """Extends the top block generator to also generate a block XML file"""
+
+ def __init__(self, flow_graph, file_path):
+ """
+ Initialize the hier block generator object.
+
+ Args:
+ flow_graph: the flow graph object
+ file_path: where to write the py file (the xml goes into HIER_BLOCK_LIB_DIR)
+ """
+ TopBlockGenerator.__init__(self, flow_graph, file_path)
+ platform = flow_graph.parent
+
+ hier_block_lib_dir = platform.config.hier_block_lib_dir
+ if not os.path.exists(hier_block_lib_dir):
+ os.mkdir(hier_block_lib_dir)
+
+ self._mode = Constants.HIER_BLOCK_FILE_MODE
+ self.file_path = os.path.join(hier_block_lib_dir, self._flow_graph.get_option('id') + '.py')
+ self.file_path_xml = self.file_path + '.xml'
+
+ def write(self):
+ """generate output and write it to files"""
+ TopBlockGenerator.write(self)
+ ParseXML.to_file(self._build_block_n_from_flow_graph_io(), self.file_path_xml)
+ ParseXML.validate_dtd(self.file_path_xml, Constants.BLOCK_DTD)
+ try:
+ os.chmod(self.file_path_xml, self._mode)
+ except:
+ pass
+
+ def _build_block_n_from_flow_graph_io(self):
+ """
+ Generate a block XML nested data from the flow graph IO
+
+ Returns:
+ a xml node tree
+ """
+ # Extract info from the flow graph
+ block_id = self._flow_graph.get_option('id')
+ parameters = self._flow_graph.get_parameters()
+
+ def var_or_value(name):
+ if name in (p.name for p in parameters):
+ return "${" + name + " }"
+ return name
+
+ # Build the nested data
+ data = collections.OrderedDict()
+ data['id'] = block_id
+ data['label'] = (
+ self._flow_graph.get_option('title') or
+ self._flow_graph.get_option('id').replace('_', ' ').title()
+ )
+ data['category'] = self._flow_graph.get_option('category')
+
+ # Parameters
+ data['parameters'] = []
+ for param_block in parameters:
+ p = collections.OrderedDict()
+ p['id'] = param_block.name
+ p['label'] = param_block.params['label'].get_value() or param_block.name
+ p['dtype'] = 'raw'
+ p['value'] = param_block.params['value'].get_value()
+ p['hide'] = param_block.params['hide'].get_value()
+ data['param'].append(p)
+
+ # Ports
+ for direction in ('inputs', 'outputs'):
+ data[direction] = []
+ for port in get_hier_block_io(self._flow_graph, direction):
+ p = collections.OrderedDict()
+ if port.domain == Constants.GR_MESSAGE_DOMAIN:
+ p['id'] = port.id
+ p['label'] = port.label
+ if port.domain != Constants.DEFAULT_DOMAIN:
+ p['domain'] = port.domain
+ p['dtype'] = port.dtype
+ if port.domain != Constants.GR_MESSAGE_DOMAIN:
+ p['vlen'] = var_or_value(port.vlen)
+ if port.optional:
+ p['optional'] = True
+ data[direction].append(p)
+
+ t = data['templates'] = collections.OrderedDict()
+
+ t['import'] = "from {0} import {0} # grc-generated hier_block".format(
+ self._flow_graph.get_option('id'))
+ # Make data
+ if parameters:
+ t['make'] = '{cls}(\n {kwargs},\n)'.format(
+ cls=block_id,
+ kwargs=',\n '.join(
+ '{key}=${key}'.format(key=param.name) for param in parameters
+ ),
+ )
+ else:
+ t['make'] = '{cls}()'.format(cls=block_id)
+ # Callback data
+ t['callback'] = [
+ 'set_{key}(${key})'.format(key=param_block.name) for param_block in parameters
+ ]
+
+
+ # Documentation
+ data['doc'] = "\n".join(field for field in (
+ self._flow_graph.get_option('author'),
+ self._flow_graph.get_option('description'),
+ self.file_path
+ ) if field)
+ data['grc_source'] = str(self._flow_graph.grc_file_path)
+
+ n = {'block': data}
+ return n
+
+
+class QtHierBlockGenerator(HierBlockGenerator):
+
+ def _build_block_n_from_flow_graph_io(self):
+ n = HierBlockGenerator._build_block_n_from_flow_graph_io(self)
+ block_n = collections.OrderedDict()
+
+ # insert flags after category
+ for key, value in six.iteritems(n['block']):
+ block_n[key] = value
+ if key == 'category':
+ block_n['flags'] = 'need_qt_gui'
+
+ if not block_n['name'].upper().startswith('QT GUI'):
+ block_n['name'] = 'QT GUI ' + block_n['name']
+
+ gui_hint_param = collections.OrderedDict()
+ gui_hint_param['name'] = 'GUI Hint'
+ gui_hint_param['key'] = 'gui_hint'
+ gui_hint_param['value'] = ''
+ gui_hint_param['type'] = 'gui_hint'
+ gui_hint_param['hide'] = 'part'
+ block_n['param'].append(gui_hint_param)
+
+ block_n['make'] += (
+ "\n<% win = 'self.' + id %>"
+ "\n${ gui_hint % win }"
+ )
+
+ return {'block': block_n}
+
+
+def get_hier_block_io(flow_graph, direction, domain=None):
+ """
+ Get a list of io ports for this flow graph.
+
+ Returns a list of dicts with: type, label, vlen, size, optional
+ """
+ pads = flow_graph.get_pad_sources() if direction == 'inputs' else flow_graph.get_pad_sinks()
+
+ ports = []
+ for pad in pads:
+ for port in (pad.sources if direction == 'inputs' else pad.sinks):
+ if domain and port.domain != domain:
+ continue
+ yield port
+
+ type_param = pad.params['type']
+ master = {
+ 'label': str(pad.params['label'].get_evaluated()),
+ 'type': str(pad.params['type'].get_evaluated()),
+ 'vlen': str(pad.params['vlen'].get_value()),
+ 'size': type_param.options.attributes[type_param.get_value()]['size'],
+ 'optional': bool(pad.params['optional'].get_evaluated()),
+ }
+
+ if domain and pad:
+ num_ports = pad.params['num_streams'].get_evaluated()
+ if num_ports <= 1:
+ yield master
+ else:
+ for i in range(num_ports):
+ clone = master.copy()
+ clone['label'] += str(i)
+ ports.append(clone)
+ else:
+ ports.append(master)
diff --git a/grc/core/generator/top_block.py b/grc/core/generator/top_block.py
new file mode 100644
index 000000000..799ebb107
--- /dev/null
+++ b/grc/core/generator/top_block.py
@@ -0,0 +1,284 @@
+import codecs
+import operator
+import os
+import tempfile
+import textwrap
+import time
+
+from mako.template import Template
+
+from .. import Messages, blocks
+from ..Constants import TOP_BLOCK_FILE_MODE
+from .FlowGraphProxy import FlowGraphProxy
+from ..utils import expr_utils
+
+DATA_DIR = os.path.dirname(__file__)
+FLOW_GRAPH_TEMPLATE = os.path.join(DATA_DIR, 'flow_graph.py.mako')
+flow_graph_template = Template(filename=FLOW_GRAPH_TEMPLATE)
+
+
+class TopBlockGenerator(object):
+
+ def __init__(self, flow_graph, file_path):
+ """
+ Initialize the top block generator object.
+
+ Args:
+ flow_graph: the flow graph object
+ file_path: the path to write the file to
+ """
+
+ self._flow_graph = FlowGraphProxy(flow_graph)
+ self._generate_options = self._flow_graph.get_option('generate_options')
+
+ self._mode = TOP_BLOCK_FILE_MODE
+ # Handle the case where the directory is read-only
+ # In this case, use the system's temp directory
+ if not os.access(file_path, os.W_OK):
+ file_path = tempfile.gettempdir()
+ filename = self._flow_graph.get_option('id') + '.py'
+ self.file_path = os.path.join(file_path, filename)
+ self._dirname = file_path
+
+ def _warnings(self):
+ throttling_blocks = [b for b in self._flow_graph.get_enabled_blocks()
+ if b.flags.throttle]
+ if not throttling_blocks and not self._generate_options.startswith('hb'):
+ Messages.send_warning("This flow graph may not have flow control: "
+ "no audio or RF hardware blocks found. "
+ "Add a Misc->Throttle block to your flow "
+ "graph to avoid CPU congestion.")
+ if len(throttling_blocks) > 1:
+ keys = set([b.key for b in throttling_blocks])
+ if len(keys) > 1 and 'blocks_throttle' in keys:
+ Messages.send_warning("This flow graph contains a throttle "
+ "block and another rate limiting block, "
+ "e.g. a hardware source or sink. "
+ "This is usually undesired. Consider "
+ "removing the throttle block.")
+
+ deprecated_block_keys = {b.name for b in self._flow_graph.get_enabled_blocks() if b.flags.deprecated}
+ for key in deprecated_block_keys:
+ Messages.send_warning("The block {!r} is deprecated.".format(key))
+
+ def write(self):
+ """generate output and write it to files"""
+ self._warnings()
+
+ for filename, data in self._build_python_code_from_template():
+ with codecs.open(filename, 'w', encoding='utf-8') as fp:
+ fp.write(data)
+ if filename == self.file_path:
+ try:
+ os.chmod(filename, self._mode)
+ except:
+ pass
+
+ def _build_python_code_from_template(self):
+ """
+ Convert the flow graph to python code.
+
+ Returns:
+ a string of python code
+ """
+ output = []
+
+ fg = self._flow_graph
+ title = fg.get_option('title') or fg.get_option('id').replace('_', ' ').title()
+ variables = fg.get_variables()
+ parameters = fg.get_parameters()
+ monitors = fg.get_monitors()
+
+ for block in fg.iter_enabled_blocks():
+ key = block.key
+ file_path = os.path.join(self._dirname, block.name + '.py')
+ if key == 'epy_block':
+ src = block.params['_source_code'].get_value()
+ output.append((file_path, src))
+ elif key == 'epy_module':
+ src = block.params['source_code'].get_value()
+ output.append((file_path, src))
+
+ namespace = {
+ 'flow_graph': fg,
+ 'variables': variables,
+ 'parameters': parameters,
+ 'monitors': monitors,
+ 'generate_options': self._generate_options,
+ 'generated_time': time.ctime(),
+ }
+ flow_graph_code = flow_graph_template.render(
+ title=title,
+ imports=self._imports(),
+ blocks=self._blocks(),
+ callbacks=self._callbacks(),
+ connections=self._connections(),
+ **namespace
+ )
+ # strip trailing white-space
+ flow_graph_code = "\n".join(line.rstrip() for line in flow_graph_code.split("\n"))
+ output.append((self.file_path, flow_graph_code))
+
+ return output
+
+ def _imports(self):
+ fg = self._flow_graph
+ imports = fg.imports()
+ seen = set()
+ output = []
+
+ need_path_hack = any(imp.endswith("# grc-generated hier_block") for imp in imports)
+ if need_path_hack:
+ output.insert(0, textwrap.dedent("""\
+ import os
+ import sys
+ sys.path.append(os.environ.get('GRC_HIER_PATH', os.path.expanduser('~/.grc_gnuradio')))
+ """))
+ seen.add('import os')
+ seen.add('import sys')
+
+ if fg.get_option('qt_qss_theme'):
+ imports.append('import os')
+ imports.append('import sys')
+
+ if fg.get_option('thread_safe_setters'):
+ imports.append('import threading')
+
+ def is_duplicate(l):
+ if l.startswith('import') or l.startswith('from') and l in seen:
+ return True
+ seen.add(line)
+ return False
+
+ for import_ in sorted(imports):
+ lines = import_.strip().split('\n')
+ if not lines[0]:
+ continue
+ for line in lines:
+ line = line.rstrip()
+ if not is_duplicate(line):
+ output.append(line)
+
+ return output
+
+ def _blocks(self):
+ fg = self._flow_graph
+ parameters = fg.get_parameters()
+
+ # List of blocks not including variables and imports and parameters and disabled
+ def _get_block_sort_text(block):
+ code = block.templates.render('make').replace(block.name, ' ')
+ try:
+ code += block.params['gui_hint'].get_value() # Newer gui markup w/ qtgui
+ except:
+ pass
+ return code
+
+ blocks = [
+ b for b in fg.blocks
+ if b.enabled and not (b.get_bypassed() or b.is_import or b in parameters or b.key == 'options')
+ ]
+
+ blocks = expr_utils.sort_objects(blocks, operator.attrgetter('name'), _get_block_sort_text)
+ blocks_make = []
+ for block in blocks:
+ make = block.templates.render('make')
+ if not block.is_variable:
+ make = 'self.' + block.name + ' = ' + make
+ if make:
+ blocks_make.append((block, make))
+ return blocks_make
+
+ def _callbacks(self):
+ fg = self._flow_graph
+ variables = fg.get_variables()
+ parameters = fg.get_parameters()
+
+ # List of variable names
+ var_ids = [var.name for var in parameters + variables]
+ replace_dict = dict((var_id, 'self.' + var_id) for var_id in var_ids)
+ callbacks_all = []
+ for block in fg.iter_enabled_blocks():
+ callbacks_all.extend(expr_utils.expr_replace(cb, replace_dict) for cb in block.get_callbacks())
+
+ # Map var id to callbacks
+ def uses_var_id(callback):
+ used = expr_utils.get_variable_dependencies(callback, [var_id])
+ return used and 'self.' + var_id in callback # callback might contain var_id itself
+
+ callbacks = {}
+ for var_id in var_ids:
+ callbacks[var_id] = [callback for callback in callbacks_all if uses_var_id(callback)]
+
+ return callbacks
+
+ def _connections(self):
+ fg = self._flow_graph
+ templates = {key: Template(text)
+ for key, text in fg.parent_platform.connection_templates.items()}
+
+ def make_port_sig(port):
+ if port.parent.key in ('pad_source', 'pad_sink'):
+ block = 'self'
+ key = fg.get_pad_port_global_key(port)
+ else:
+ block = 'self.' + port.parent_block.name
+ key = port.key
+
+ if not key.isdigit():
+ key.repr(key)
+
+ return '({block}, {key})'.format(block=block, key=key)
+
+ connections = fg.get_enabled_connections()
+
+ # Get the virtual blocks and resolve their connections
+ connection_factory = fg.parent_platform.Connection
+ virtual = [c for c in connections if isinstance(c.source_block, blocks.VirtualSource)]
+ for connection in virtual:
+ sink = connection.sink_port
+ for source in connection.source_port.resolve_virtual_source():
+ resolved = connection_factory(fg.orignal_flowgraph, source, sink)
+ connections.append(resolved)
+ # Remove the virtual connection
+ connections.remove(connection)
+
+ # Bypassing blocks: Need to find all the enabled connections for the block using
+ # the *connections* object rather than get_connections(). Create new connections
+ # that bypass the selected block and remove the existing ones. This allows adjacent
+ # bypassed blocks to see the newly created connections to downstream blocks,
+ # allowing them to correctly construct bypass connections.
+ bypassed_blocks = fg.get_bypassed_blocks()
+ for block in bypassed_blocks:
+ # Get the upstream connection (off of the sink ports)
+ # Use *connections* not get_connections()
+ source_connection = [c for c in connections if c.sink_port == block.sinks[0]]
+ # The source connection should never have more than one element.
+ assert (len(source_connection) == 1)
+
+ # Get the source of the connection.
+ source_port = source_connection[0].source_port
+
+ # Loop through all the downstream connections
+ for sink in (c for c in connections if c.source_port == block.sources[0]):
+ if not sink.enabled:
+ # Ignore disabled connections
+ continue
+ connection = connection_factory(fg.orignal_flowgraph, source_port, sink.sink_port)
+ connections.append(connection)
+ # Remove this sink connection
+ connections.remove(sink)
+ # Remove the source connection
+ connections.remove(source_connection[0])
+
+ # List of connections where each endpoint is enabled (sorted by domains, block names)
+ def by_domain_and_blocks(c):
+ return c.type, c.source_block.name, c.sink_block.name
+
+ rendered = []
+ for con in sorted(connections, key=by_domain_and_blocks):
+ template = templates[con.type]
+ code = template.render(make_port_sig=make_port_sig, source=con.source_port, sink=con.sink_port)
+ rendered.append(code)
+
+ return rendered
diff --git a/grc/core/io/__init__.py b/grc/core/io/__init__.py
new file mode 100644
index 000000000..f77f1a670
--- /dev/null
+++ b/grc/core/io/__init__.py
@@ -0,0 +1,16 @@
+# Copyright 2017 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
diff --git a/grc/core/io/yaml.py b/grc/core/io/yaml.py
new file mode 100644
index 000000000..29b4cb81d
--- /dev/null
+++ b/grc/core/io/yaml.py
@@ -0,0 +1,91 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2 of the License, or (at your
+# option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
+
+from collections import OrderedDict
+
+import six
+import yaml
+
+
+class GRCDumper(yaml.SafeDumper):
+ @classmethod
+ def add(cls, data_type):
+ def decorator(func):
+ cls.add_representer(data_type, func)
+ return func
+ return decorator
+
+ def represent_ordered_mapping(self, data):
+ value = []
+ node = yaml.MappingNode(u'tag:yaml.org,2002:map', value, flow_style=False)
+
+ if self.alias_key is not None:
+ self.represented_objects[self.alias_key] = node
+
+ for item_key, item_value in six.iteritems(data):
+ node_key = self.represent_data(item_key)
+ node_value = self.represent_data(item_value)
+ value.append((node_key, node_value))
+
+ return node
+
+ def represent_ordered_mapping_flowing(self, data):
+ node = self.represent_ordered_mapping(data)
+ node.flow_style = True
+ return node
+
+ def represent_list_flowing(self, data):
+ node = self.represent_list(data)
+ node.flow_style = True
+ return node
+
+ def represent_ml_string(self, data):
+ node = self.represent_str(data)
+ node.style = '|'
+ return node
+
+
+class OrderedDictFlowing(OrderedDict):
+ pass
+
+
+class ListFlowing(list):
+ pass
+
+
+class MultiLineString(str):
+ pass
+
+
+GRCDumper.add_representer(OrderedDict, GRCDumper.represent_ordered_mapping)
+GRCDumper.add_representer(OrderedDictFlowing, GRCDumper.represent_ordered_mapping_flowing)
+GRCDumper.add_representer(ListFlowing, GRCDumper.represent_list_flowing)
+GRCDumper.add_representer(tuple, GRCDumper.represent_list)
+GRCDumper.add_representer(MultiLineString, GRCDumper.represent_ml_string)
+GRCDumper.add_representer(yaml.nodes.ScalarNode, lambda r, n: n)
+
+
+def dump(data, stream=None, **kwargs):
+ config = dict(stream=stream, default_flow_style=False, indent=4, Dumper=GRCDumper)
+ config.update(kwargs)
+ return yaml.dump_all([data], **config)
+
+
+safe_load = yaml.safe_load
+__with_libyaml__ = yaml.__with_libyaml__
diff --git a/grc/core/params/__init__.py b/grc/core/params/__init__.py
new file mode 100644
index 000000000..93663bdad
--- /dev/null
+++ b/grc/core/params/__init__.py
@@ -0,0 +1,18 @@
+# Copyright 2017 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from .param import Param
diff --git a/grc/core/params/dtypes.py b/grc/core/params/dtypes.py
new file mode 100644
index 000000000..f52868c08
--- /dev/null
+++ b/grc/core/params/dtypes.py
@@ -0,0 +1,103 @@
+# Copyright 2008-2017 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
+
+import re
+
+from six.moves import builtins
+
+from .. import blocks
+from .. import Constants
+
+
+# Blacklist certain ids, its not complete, but should help
+ID_BLACKLIST = ['self', 'options', 'gr', 'math', 'firdes'] + dir(builtins)
+try:
+ from gnuradio import gr
+ ID_BLACKLIST.extend(attr for attr in dir(gr.top_block()) if not attr.startswith('_'))
+except (ImportError, AttributeError):
+ pass
+
+
+validators = {}
+
+
+def validates(*dtypes):
+ def decorator(func):
+ for dtype in dtypes:
+ assert dtype in Constants.PARAM_TYPE_NAMES
+ validators[dtype] = func
+ return func
+ return decorator
+
+
+class ValidateError(Exception):
+ """Raised by validate functions"""
+
+
+@validates('id')
+def validate_block_id(param):
+ value = param.value
+ # Can python use this as a variable?
+ if not re.match(r'^[a-z|A-Z]\w*$', value):
+ raise ValidateError('ID "{}" must begin with a letter and may contain letters, numbers, '
+ 'and underscores.'.format(value))
+ if value in ID_BLACKLIST:
+ raise ValidateError('ID "{}" is blacklisted.'.format(value))
+ block_names = [block.name for block in param.parent_flowgraph.iter_enabled_blocks()]
+ # Id should only appear once, or zero times if block is disabled
+ if param.key == 'id' and block_names.count(value) > 1:
+ raise ValidateError('ID "{}" is not unique.'.format(value))
+ elif value not in block_names:
+ raise ValidateError('ID "{}" does not exist.'.format(value))
+ return value
+
+
+@validates('stream_id')
+def validate_stream_id(param):
+ value = param.value
+ stream_ids = [
+ block.params['stream_id'].value
+ for block in param.parent_flowgraph.iter_enabled_blocks()
+ if isinstance(block, blocks.VirtualSink)
+ ]
+ # Check that the virtual sink's stream id is unique
+ if isinstance(param.parent_block, blocks.VirtualSink) and stream_ids.count(value) >= 2:
+ # Id should only appear once, or zero times if block is disabled
+ raise ValidateError('Stream ID "{}" is not unique.'.format(value))
+ # Check that the virtual source's steam id is found
+ elif isinstance(param.parent_block, blocks.VirtualSource) and value not in stream_ids:
+ raise ValidateError('Stream ID "{}" is not found.'.format(value))
+
+
+@validates('complex', 'real', 'float', 'int')
+def validate_scalar(param):
+ valid_types = Constants.PARAM_TYPE_MAP[param.dtype]
+ if not isinstance(param.get_evaluated(), valid_types):
+ raise ValidateError('Expression {!r} is invalid for type {!r}.'.format(
+ param.get_evaluated(), param.dtype))
+
+
+@validates('complex_vector', 'real_vector', 'float_vector', 'int_vector')
+def validate_vector(param):
+ # todo: check vector types
+
+ valid_types = Constants.PARAM_TYPE_MAP[param.dtype.split('_', 1)[0]]
+ if not all(isinstance(item, valid_types) for item in param.get_evaluated()):
+ raise ValidateError('Expression {!r} is invalid for type {!r}.'.format(
+ param.get_evaluated(), param.dtype))
diff --git a/grc/core/params/param.py b/grc/core/params/param.py
new file mode 100644
index 000000000..30a48bb43
--- /dev/null
+++ b/grc/core/params/param.py
@@ -0,0 +1,407 @@
+# Copyright 2008-2017 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
+
+import ast
+import collections
+import textwrap
+
+import six
+from six.moves import range
+
+from .. import Constants
+from ..base import Element
+from ..utils.descriptors import Evaluated, EvaluatedEnum, setup_names
+
+from . import dtypes
+from .template_arg import TemplateArg
+
+
+@setup_names
+class Param(Element):
+
+ is_param = True
+
+ name = Evaluated(str, default='no name')
+ dtype = EvaluatedEnum(Constants.PARAM_TYPE_NAMES, default='raw')
+ hide = EvaluatedEnum('none all part')
+
+ # region init
+ def __init__(self, parent, id, label='', dtype='raw', default='',
+ options=None, option_labels=None, option_attributes=None,
+ category='', hide='none', **_):
+ """Make a new param from nested data"""
+ super(Param, self).__init__(parent)
+ self.key = id
+ self.name = label.strip() or id.title()
+ self.category = category or Constants.DEFAULT_PARAM_TAB
+
+ self.dtype = dtype
+ self.value = self.default = str(default)
+
+ self.options = self._init_options(options or [], option_labels or [],
+ option_attributes or {})
+ self.hide = hide or 'none'
+ # end of args ########################################################
+
+ self._evaluated = None
+ self._stringify_flag = False
+ self._lisitify_flag = False
+ self.hostage_cells = set()
+ self._init = False
+
+ def _init_options(self, values, labels, attributes):
+ """parse option and option attributes"""
+ options = collections.OrderedDict()
+ options.attributes = collections.defaultdict(dict)
+
+ padding = [''] * max(len(values), len(labels))
+ attributes = {key: value + padding for key, value in six.iteritems(attributes)}
+
+ for i, option in enumerate(values):
+ # Test against repeated keys
+ if option in options:
+ raise KeyError('Value "{}" already exists in options'.format(option))
+ # get label
+ try:
+ label = str(labels[i])
+ except IndexError:
+ label = str(option)
+ # Store the option
+ options[option] = label
+ options.attributes[option] = {attrib: values[i] for attrib, values in six.iteritems(attributes)}
+
+ default = next(iter(options)) if options else ''
+ if not self.value:
+ self.value = self.default = default
+
+ if self.is_enum() and self.value not in options:
+ self.value = self.default = default # TODO: warn
+ # raise ValueError('The value {!r} is not in the possible values of {}.'
+ # ''.format(self.get_value(), ', '.join(self.options)))
+ return options
+ # endregion
+
+ @property
+ def template_arg(self):
+ return TemplateArg(self)
+
+ def __str__(self):
+ return 'Param - {}({})'.format(self.name, self.key)
+
+ def __repr__(self):
+ return '{!r}.param[{}]'.format(self.parent, self.key)
+
+ def is_enum(self):
+ return self.get_raw('dtype') == 'enum'
+
+ def get_value(self):
+ value = self.value
+ if self.is_enum() and value not in self.options:
+ value = self.default
+ self.set_value(value)
+ return value
+
+ def set_value(self, value):
+ # Must be a string
+ self.value = str(value)
+
+ def set_default(self, value):
+ if self.default == self.value:
+ self.set_value(value)
+ self.default = str(value)
+
+ def rewrite(self):
+ Element.rewrite(self)
+ del self.name
+ del self.dtype
+ del self.hide
+
+ self._evaluated = None
+ try:
+ self._evaluated = self.evaluate()
+ except Exception as e:
+ self.add_error_message(str(e))
+
+ rewriter = getattr(dtypes, 'rewrite_' + self.dtype, None)
+ if rewriter:
+ rewriter(self)
+
+ def validate(self):
+ """
+ Validate the param.
+ The value must be evaluated and type must a possible type.
+ """
+ Element.validate(self)
+ if self.dtype not in Constants.PARAM_TYPE_NAMES:
+ self.add_error_message('Type "{}" is not a possible type.'.format(self.dtype))
+
+ validator = dtypes.validators.get(self.dtype, None)
+ if self._init and validator:
+ try:
+ validator(self)
+ except dtypes.ValidateError as e:
+ self.add_error_message(e.message)
+
+ def get_evaluated(self):
+ return self._evaluated
+
+ def evaluate(self):
+ """
+ Evaluate the value.
+
+ Returns:
+ evaluated type
+ """
+ self._init = True
+ self._lisitify_flag = False
+ self._stringify_flag = False
+ dtype = self.dtype
+ expr = self.get_value()
+
+ #########################
+ # ID and Enum types (not evaled)
+ #########################
+ if dtype in ('id', 'stream_id') or self.is_enum():
+ return expr
+
+ #########################
+ # Numeric Types
+ #########################
+ elif dtype in ('raw', 'complex', 'real', 'float', 'int', 'hex', 'bool'):
+ if expr:
+ try:
+ value = self.parent_flowgraph.evaluate(expr)
+ except Exception as e:
+ raise Exception('Value "{}" cannot be evaluated:\n{}'.format(expr, e))
+ else:
+ value = 0
+ if dtype == 'hex':
+ value = hex(value)
+ elif dtype == 'bool':
+ value = bool(value)
+ return value
+
+ #########################
+ # Numeric Vector Types
+ #########################
+ elif dtype in ('complex_vector', 'real_vector', 'float_vector', 'int_vector'):
+ if not expr:
+ return [] # Turn a blank string into an empty list, so it will eval
+ try:
+ value = self.parent.parent.evaluate(expr)
+ except Exception as value:
+ raise Exception('Value "{}" cannot be evaluated:\n{}'.format(expr, value))
+ if not isinstance(value, Constants.VECTOR_TYPES):
+ self._lisitify_flag = True
+ value = [value]
+ return value
+ #########################
+ # String Types
+ #########################
+ elif dtype in ('string', 'file_open', 'file_save', '_multiline', '_multiline_python_external'):
+ # Do not check if file/directory exists, that is a runtime issue
+ try:
+ value = self.parent_flowgraph.evaluate(expr)
+ if not isinstance(value, str):
+ raise Exception()
+ except:
+ self._stringify_flag = True
+ value = str(expr)
+ if dtype == '_multiline_python_external':
+ ast.parse(value) # Raises SyntaxError
+ return value
+ #########################
+ # GUI Position/Hint
+ #########################
+ elif dtype == 'gui_hint':
+ return self.parse_gui_hint(expr) if self.parent_block.state == 'enabled' else ''
+ #########################
+ # Import Type
+ #########################
+ elif dtype == 'import':
+ # New namespace
+ n = dict()
+ try:
+ exec(expr, n)
+ except ImportError:
+ raise Exception('Import "{}" failed.'.format(expr))
+ except Exception:
+ raise Exception('Bad import syntax: "{}".'.format(expr))
+ return [k for k in list(n.keys()) if str(k) != '__builtins__']
+
+ #########################
+ else:
+ raise TypeError('Type "{}" not handled'.format(dtype))
+
+ def to_code(self):
+ """
+ Convert the value to code.
+ For string and list types, check the init flag, call evaluate().
+ This ensures that evaluate() was called to set the xxxify_flags.
+
+ Returns:
+ a string representing the code
+ """
+ self._init = True
+ value = self.get_value()
+ # String types
+ if self.dtype in ('string', 'file_open', 'file_save', '_multiline', '_multiline_python_external'):
+ if not self._init:
+ self.evaluate()
+ return repr(value) if self._stringify_flag else value
+
+ # Vector types
+ elif self.dtype in ('complex_vector', 'real_vector', 'float_vector', 'int_vector'):
+ if not self._init:
+ self.evaluate()
+ return '[' + value + ']' if self._lisitify_flag else value
+ else:
+ return value
+
+ def get_opt(self, item):
+ return self.options.attributes[self.get_value()][item]
+
+ ##############################################
+ # GUI Hint
+ ##############################################
+ def parse_gui_hint(self, expr):
+ """
+ Parse/validate gui hint value.
+
+ Args:
+ expr: gui_hint string from a block's 'gui_hint' param
+
+ Returns:
+ string of python code for positioning GUI elements in pyQT
+ """
+ self.hostage_cells.clear()
+
+ # Parsing
+ if ':' in expr:
+ tab, pos = expr.split(':')
+ elif ',' in expr:
+ tab, pos = '', expr
+ else:
+ tab, pos = expr, ''
+
+ if '@' in tab:
+ tab, index = tab.split('@')
+ else:
+ index = '0'
+ index = int(index)
+
+ # Validation
+ def parse_pos():
+ e = self.parent_flowgraph.evaluate(pos)
+
+ if not isinstance(e, (list, tuple)) or len(e) not in (2, 4) or not all(isinstance(ei, int) for ei in e):
+ raise Exception('Invalid GUI Hint entered: {e!r} (Must be a list of {{2,4}} non-negative integers).'.format(e=e))
+
+ if len(e) == 2:
+ row, col = e
+ row_span = col_span = 1
+ else:
+ row, col, row_span, col_span = e
+
+ if (row < 0) or (col < 0):
+ raise Exception('Invalid GUI Hint entered: {e!r} (non-negative integers only).'.format(e=e))
+
+ if (row_span < 1) or (col_span < 1):
+ raise Exception('Invalid GUI Hint entered: {e!r} (positive row/column span required).'.format(e=e))
+
+ return row, col, row_span, col_span
+
+ def validate_tab():
+ tabs = (block for block in self.parent_flowgraph.iter_enabled_blocks()
+ if block.key == 'qtgui_tab_widget' and block.name == tab)
+ tab_block = next(iter(tabs), None)
+ if not tab_block:
+ raise Exception('Invalid tab name entered: {tab} (Tab name not found).'.format(tab=tab))
+
+ tab_index_size = int(tab_block.params['num_tabs'].value)
+ if index >= tab_index_size:
+ raise Exception('Invalid tab index entered: {tab}@{index} (Index out of range).'.format(
+ tab=tab, index=index))
+
+ # Collision Detection
+ def collision_detection(row, col, row_span, col_span):
+ my_parent = '{tab}@{index}'.format(tab=tab, index=index) if tab else 'main'
+ # Calculate hostage cells
+ for r in range(row, row + row_span):
+ for c in range(col, col + col_span):
+ self.hostage_cells.add((my_parent, (r, c)))
+
+ for other in self.get_all_params('gui_hint'):
+ if other is self:
+ continue
+ collision = next(iter(self.hostage_cells & other.hostage_cells), None)
+ if collision:
+ raise Exception('Block {block!r} is also using parent {parent!r}, cell {cell!r}.'.format(
+ block=other.parent_block.name, parent=collision[0], cell=collision[1]
+ ))
+
+ # Code Generation
+ if tab:
+ validate_tab()
+ layout = '{tab}_grid_layout_{index}'.format(tab=tab, index=index)
+ else:
+ layout = 'top_grid_layout'
+
+ widget = '%s' # to be fill-out in the mail template
+
+ if pos:
+ row, col, row_span, col_span = parse_pos()
+ collision_detection(row, col, row_span, col_span)
+
+ widget_str = textwrap.dedent("""
+ self.{layout}.addWidget({widget}, {row}, {col}, {row_span}, {col_span})
+ for r in range({row}, {row_end}):
+ self.{layout}.setRowStretch(r, 1)
+ for c in range({col}, {col_end}):
+ self.{layout}.setColumnStretch(c, 1)
+ """.strip('\n')).format(
+ layout=layout, widget=widget,
+ row=row, row_span=row_span, row_end=row+row_span,
+ col=col, col_span=col_span, col_end=col+col_span,
+ )
+
+ else:
+ widget_str = 'self.{layout}.addWidget({widget})'.format(layout=layout, widget=widget)
+
+ return widget_str
+
+ def get_all_params(self, dtype, key=None):
+ """
+ Get all the params from the flowgraph that have the given type and
+ optionally a given key
+
+ Args:
+ dtype: the specified type
+ key: the key to match against
+
+ Returns:
+ a list of params
+ """
+ params = []
+ for block in self.parent_flowgraph.iter_enabled_blocks():
+ params.extend(
+ param for param in block.params.values()
+ if param.dtype == dtype and (key is None or key == param.name)
+ )
+ return params
diff --git a/grc/core/params/template_arg.py b/grc/core/params/template_arg.py
new file mode 100644
index 000000000..5c8c610b4
--- /dev/null
+++ b/grc/core/params/template_arg.py
@@ -0,0 +1,50 @@
+# Copyright 2008-2017 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
+
+
+class TemplateArg(str):
+ """
+ A cheetah template argument created from a param.
+ The str of this class evaluates to the param's to code method.
+ The use of this class as a dictionary (enum only) will reveal the enum opts.
+ The __call__ or () method can return the param evaluated to a raw python data type.
+ """
+
+ def __new__(cls, param):
+ value = param.to_code()
+ instance = str.__new__(cls, value)
+ setattr(instance, '_param', param)
+ return instance
+
+ def __getitem__(self, item):
+ return str(self._param.get_opt(item)) if self._param.is_enum() else NotImplemented
+
+ def __getattr__(self, item):
+ if not self._param.is_enum():
+ raise AttributeError()
+ try:
+ return str(self._param.get_opt(item))
+ except KeyError:
+ raise AttributeError()
+
+ def __str__(self):
+ return str(self._param.to_code())
+
+ def __call__(self):
+ return self._param.get_evaluated()
diff --git a/grc/core/platform.py b/grc/core/platform.py
new file mode 100644
index 000000000..6d02cb644
--- /dev/null
+++ b/grc/core/platform.py
@@ -0,0 +1,421 @@
+# Copyright 2008-2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import, print_function
+
+from codecs import open
+from collections import namedtuple
+import os
+import logging
+from itertools import chain
+
+import six
+from six.moves import range
+
+from . import (
+ Messages, Constants,
+ blocks, params, ports, errors, utils, schema_checker
+)
+
+from .Config import Config
+from .cache import Cache
+from .base import Element
+from .io import yaml
+from .generator import Generator
+from .FlowGraph import FlowGraph
+from .Connection import Connection
+
+logger = logging.getLogger(__name__)
+logging.basicConfig(level=logging.INFO)
+
+
+class Platform(Element):
+
+ def __init__(self, *args, **kwargs):
+ """ Make a platform for GNU Radio """
+ Element.__init__(self, parent=None)
+
+ self.config = self.Config(*args, **kwargs)
+ self.block_docstrings = {}
+ self.block_docstrings_loaded_callback = lambda: None # dummy to be replaced by BlockTreeWindow
+
+ self._docstring_extractor = utils.extract_docs.SubprocessLoader(
+ callback_query_result=self._save_docstring_extraction_result,
+ callback_finished=lambda: self.block_docstrings_loaded_callback()
+ )
+
+ self.blocks = self.block_classes
+ self.domains = {}
+ self.connection_templates = {}
+
+ self._block_categories = {}
+ self._auto_hier_block_generate_chain = set()
+
+ if not yaml.__with_libyaml__:
+ logger.warning("Slow YAML loading (libyaml not available)")
+
+ def __str__(self):
+ return 'Platform - {}'.format(self.config.name)
+
+ @staticmethod
+ def find_file_in_paths(filename, paths, cwd):
+ """Checks the provided paths relative to cwd for a certain filename"""
+ if not os.path.isdir(cwd):
+ cwd = os.path.dirname(cwd)
+ if isinstance(paths, str):
+ paths = (p for p in paths.split(':') if p)
+
+ for path in paths:
+ path = os.path.expanduser(path)
+ if not os.path.isabs(path):
+ path = os.path.normpath(os.path.join(cwd, path))
+ file_path = os.path.join(path, filename)
+ if os.path.exists(os.path.normpath(file_path)):
+ return file_path
+
+ def load_and_generate_flow_graph(self, file_path, out_path=None, hier_only=False):
+ """Loads a flow graph from file and generates it"""
+ Messages.set_indent(len(self._auto_hier_block_generate_chain))
+ Messages.send('>>> Loading: {}\n'.format(file_path))
+ if file_path in self._auto_hier_block_generate_chain:
+ Messages.send(' >>> Warning: cyclic hier_block dependency\n')
+ return None, None
+ self._auto_hier_block_generate_chain.add(file_path)
+ try:
+ flow_graph = self.make_flow_graph()
+ flow_graph.grc_file_path = file_path
+ # Other, nested hier_blocks might be auto-loaded here
+ flow_graph.import_data(self.parse_flow_graph(file_path))
+ flow_graph.rewrite()
+ flow_graph.validate()
+ if not flow_graph.is_valid():
+ raise Exception('Flowgraph invalid')
+ if hier_only and not flow_graph.get_option('generate_options').startswith('hb'):
+ raise Exception('Not a hier block')
+ except Exception as e:
+ Messages.send('>>> Load Error: {}: {}\n'.format(file_path, str(e)))
+ return None, None
+ finally:
+ self._auto_hier_block_generate_chain.discard(file_path)
+ Messages.set_indent(len(self._auto_hier_block_generate_chain))
+
+ try:
+ generator = self.Generator(flow_graph, out_path or file_path)
+ Messages.send('>>> Generating: {}\n'.format(generator.file_path))
+ generator.write()
+ except Exception as e:
+ Messages.send('>>> Generate Error: {}: {}\n'.format(file_path, str(e)))
+ return None, None
+
+ if flow_graph.get_option('generate_options').startswith('hb'):
+ # self.load_block_xml(generator.file_path_xml)
+ # TODO: implement yml output for hier blocks
+ pass
+ return flow_graph, generator.file_path
+
+ def build_library(self, path=None):
+ """load the blocks and block tree from the search paths
+
+ path: a list of paths/files to search in or load (defaults to config)
+ """
+ self._docstring_extractor.start()
+
+ # Reset
+ self.blocks.clear()
+ self.domains.clear()
+ self.connection_templates.clear()
+ self._block_categories.clear()
+
+ # # FIXME: remove this as soon as converter is stable
+ # from ..converter import Converter
+ # converter = Converter(self.config.block_paths, self.config.yml_block_cache)
+ # converter.run()
+ # logging.info('XML converter done.')
+
+ with Cache(Constants.CACHE_FILE) as cache:
+ for file_path in self._iter_files_in_block_path(path):
+ data = cache.get_or_load(file_path)
+
+ if file_path.endswith('.block.yml'):
+ loader = self.load_block_description
+ scheme = schema_checker.BLOCK_SCHEME
+ elif file_path.endswith('.domain.yml'):
+ loader = self.load_domain_description
+ scheme = schema_checker.DOMAIN_SCHEME
+ elif file_path.endswith('.tree.yml'):
+ loader = self.load_category_tree_description
+ scheme = None
+ else:
+ continue
+
+ try:
+ checker = schema_checker.Validator(scheme)
+ passed = checker.run(data)
+ for msg in checker.messages:
+ logger.warning('{:<40s} {}'.format(os.path.basename(file_path), msg))
+ if not passed:
+ logger.info('YAML schema check failed for: ' + file_path)
+
+ loader(data, file_path)
+ except Exception as error:
+ logger.exception('Error while loading %s', file_path)
+ logger.exception(error)
+ raise
+
+ for key, block in six.iteritems(self.blocks):
+ category = self._block_categories.get(key, block.category)
+ if not category:
+ continue
+ root = category[0]
+ if root.startswith('[') and root.endswith(']'):
+ category[0] = root[1:-1]
+ else:
+ category.insert(0, Constants.DEFAULT_BLOCK_MODULE_NAME)
+ block.category = category
+
+ self._docstring_extractor.finish()
+ # self._docstring_extractor.wait()
+ utils.hide_bokeh_gui_options_if_not_installed(self.blocks['options'])
+
+ def _iter_files_in_block_path(self, path=None, ext='yml'):
+ """Iterator for block descriptions and category trees"""
+ for entry in (path or self.config.block_paths):
+ if os.path.isfile(entry):
+ yield entry
+ elif os.path.isdir(entry):
+ for dirpath, dirnames, filenames in os.walk(entry):
+ for filename in sorted(filter(lambda f: f.endswith('.' + ext), filenames)):
+ yield os.path.join(dirpath, filename)
+ else:
+ logger.debug('Ignoring invalid path entry %r', entry)
+
+ def _save_docstring_extraction_result(self, block_id, docstrings):
+ docs = {}
+ for match, docstring in six.iteritems(docstrings):
+ if not docstring or match.endswith('_sptr'):
+ continue
+ docs[match] = docstring.replace('\n\n', '\n').strip()
+ try:
+ self.blocks[block_id].documentation.update(docs)
+ except KeyError:
+ pass # in tests platform might be gone...
+
+ ##############################################
+ # Description File Loaders
+ ##############################################
+ # region loaders
+ def load_block_description(self, data, file_path):
+ log = logger.getChild('block_loader')
+
+ # don't load future block format versions
+ file_format = data['file_format']
+ if file_format < 1 or file_format > Constants.BLOCK_DESCRIPTION_FILE_FORMAT_VERSION:
+ log.error('Unknown format version %d in %s', file_format, file_path)
+ return
+
+ block_id = data['id'] = data['id'].rstrip('_')
+
+ if block_id in self.block_classes_build_in:
+ log.warning('Not overwriting build-in block %s with %s', block_id, file_path)
+ return
+ if block_id in self.blocks:
+ log.warning('Block with id "%s" loaded from\n %s\noverwritten by\n %s',
+ block_id, self.blocks[block_id].loaded_from, file_path)
+
+ try:
+ block_cls = self.blocks[block_id] = self.new_block_class(**data)
+ block_cls.loaded_from = file_path
+ except errors.BlockLoadError as error:
+ log.error('Unable to load block %s', block_id)
+ log.exception(error)
+ return
+
+ self._docstring_extractor.query(
+ block_id, block_cls.templates['imports'], block_cls.templates['make'],
+ )
+
+ def load_domain_description(self, data, file_path):
+ log = logger.getChild('domain_loader')
+ domain_id = data['id']
+ if domain_id in self.domains: # test against repeated keys
+ log.debug('Domain "{}" already exists. Ignoring: %s', file_path)
+ return
+
+ color = data.get('color', '')
+ if color.startswith('#'):
+ try:
+ tuple(int(color[o:o + 2], 16) / 255.0 for o in range(1, 6, 2))
+ except ValueError:
+ log.warning('Cannot parse color code "%s" in %s', color, file_path)
+ return
+
+ self.domains[domain_id] = self.Domain(
+ name=data.get('label', domain_id),
+ multi_in=data.get('multiple_connections_per_input', True),
+ multi_out=data.get('multiple_connections_per_output', False),
+ color=color
+ )
+ for connection in data.get('templates', []):
+ try:
+ source_id, sink_id = connection.get('type', [])
+ except ValueError:
+ log.warn('Invalid connection template.')
+ continue
+ connection_id = str(source_id), str(sink_id)
+ self.connection_templates[connection_id] = connection.get('connect', '')
+
+ def load_category_tree_description(self, data, file_path):
+ """Parse category tree file and add it to list"""
+ log = logger.getChild('tree_loader')
+ log.debug('Loading %s', file_path)
+ path = []
+
+ def load_category(name, elements):
+ if not isinstance(name, six.string_types):
+ log.debug('Invalid name %r', name)
+ return
+ path.append(name)
+ for element in utils.to_list(elements):
+ if isinstance(element, six.string_types):
+ block_id = element
+ self._block_categories[block_id] = list(path)
+ elif isinstance(element, dict):
+ load_category(*next(six.iteritems(element)))
+ else:
+ log.debug('Ignoring some elements of %s', name)
+ path.pop()
+
+ try:
+ module_name, categories = next(six.iteritems(data))
+ except (AttributeError, StopIteration):
+ log.warning('no valid data found')
+ else:
+ load_category(module_name, categories)
+
+ ##############################################
+ # Access
+ ##############################################
+ def parse_flow_graph(self, filename):
+ """
+ Parse a saved flow graph file.
+ Ensure that the file exists, and passes the dtd check.
+
+ Args:
+ filename: the flow graph file
+
+ Returns:
+ nested data
+ @throws exception if the validation fails
+ """
+ filename = filename or self.config.default_flow_graph
+ with open(filename, encoding='utf-8') as fp:
+ is_xml = '<flow_graph>' in fp.read(100)
+ fp.seek(0)
+ # todo: try
+ if not is_xml:
+ data = yaml.safe_load(fp)
+ validator = schema_checker.Validator(schema_checker.FLOW_GRAPH_SCHEME)
+ validator.run(data)
+ else:
+ Messages.send('>>> Converting from XML\n')
+ from ..converter.flow_graph import from_xml
+ data = from_xml(fp)
+
+ return data
+
+ def save_flow_graph(self, filename, flow_graph):
+ data = flow_graph.export_data()
+
+ try:
+ data['connections'] = [yaml.ListFlowing(i) for i in data['connections']]
+ except KeyError:
+ pass
+
+ try:
+ for d in chain([data['options']], data['blocks']):
+ d['states']['coordinate'] = yaml.ListFlowing(d['states']['coordinate'])
+ for param_id, value in list(d['parameters'].items()):
+ if value == '':
+ d['parameters'].pop(param_id)
+ except KeyError:
+ pass
+
+ out = yaml.dump(data, indent=2)
+
+ replace = [
+ ('blocks:', '\nblocks:'),
+ ('connections:', '\nconnections:'),
+ ('metadata:', '\nmetadata:'),
+ ]
+ for r in replace:
+ out = out.replace(*r)
+
+ with open(filename, 'w', encoding='utf-8') as fp:
+ fp.write(out)
+
+ def get_generate_options(self):
+ for param in self.block_classes['options'].parameters_data:
+ if param.get('id') == 'generate_options':
+ break
+ else:
+ return []
+ generate_mode_default = param.get('default')
+ return [(value, name, value == generate_mode_default)
+ for value, name in zip(param['options'], param['option_labels'])]
+
+ ##############################################
+ # Factories
+ ##############################################
+ Config = Config
+ Domain = namedtuple('Domain', 'name multi_in multi_out color')
+ Generator = Generator
+ FlowGraph = FlowGraph
+ Connection = Connection
+
+ block_classes_build_in = blocks.build_ins
+ block_classes = utils.backports.ChainMap({}, block_classes_build_in) # separates build-in from loaded blocks)
+
+ port_classes = {
+ None: ports.Port, # default
+ 'clone': ports.PortClone, # clone of ports with multiplicity > 1
+ }
+ param_classes = {
+ None: params.Param, # default
+ }
+
+ def make_flow_graph(self, from_filename=None):
+ fg = self.FlowGraph(parent=self)
+ if from_filename:
+ data = self.parse_flow_graph(from_filename)
+ fg.grc_file_path = from_filename
+ fg.import_data(data)
+ return fg
+
+ def new_block_class(self, **data):
+ return blocks.build(**data)
+
+ def make_block(self, parent, block_id, **kwargs):
+ cls = self.block_classes[block_id]
+ return cls(parent, **kwargs)
+
+ def make_param(self, parent, **kwargs):
+ cls = self.param_classes[kwargs.pop('cls_key', None)]
+ return cls(parent, **kwargs)
+
+ def make_port(self, parent, **kwargs):
+ cls = self.port_classes[kwargs.pop('cls_key', None)]
+ return cls(parent, **kwargs)
diff --git a/grc/core/domain.dtd b/grc/core/ports/__init__.py
index b5b0b8bf3..375b5d63e 100644
--- a/grc/core/domain.dtd
+++ b/grc/core/ports/__init__.py
@@ -1,5 +1,5 @@
-<!--
-Copyright 2014 Free Software Foundation, Inc.
+"""
+Copyright 2008-2015 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
@@ -15,21 +15,9 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
--->
-<!ELEMENT domain (name, key, color?, multiple_sinks?, multiple_sources?, connection*)>
-<!--
- Sub level elements.
- -->
-<!ELEMENT connection (source_domain, sink_domain, make)>
-<!--
- Bottom level elements.
- Character data only.
- -->
-<!ELEMENT name (#PCDATA)>
-<!ELEMENT key (#PCDATA)>
-<!ELEMENT multiple_sinks (#PCDATA)>
-<!ELEMENT multiple_sources (#PCDATA)>
-<!ELEMENT color (#PCDATA)>
-<!ELEMENT make (#PCDATA)>
-<!ELEMENT source_domain (#PCDATA)>
-<!ELEMENT sink_domain (#PCDATA)>
+"""
+
+from __future__ import absolute_import
+
+from .port import Port
+from .clone import PortClone
diff --git a/grc/core/ports/_virtual_connections.py b/grc/core/ports/_virtual_connections.py
new file mode 100644
index 000000000..45f4a247f
--- /dev/null
+++ b/grc/core/ports/_virtual_connections.py
@@ -0,0 +1,126 @@
+# Copyright 2008-2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
+
+from itertools import chain
+
+from .. import blocks
+
+
+class LoopError(Exception):
+ pass
+
+
+def upstream_ports(port):
+ if port.is_sink:
+ return _sources_from_virtual_sink_port(port)
+ else:
+ return _sources_from_virtual_source_port(port)
+
+
+def _sources_from_virtual_sink_port(sink_port, _traversed=None):
+ """
+ Resolve the source port that is connected to the given virtual sink port.
+ Use the get source from virtual source to recursively resolve subsequent ports.
+ """
+ source_ports_per_virtual_connection = (
+ # there can be multiple ports per virtual connection
+ _sources_from_virtual_source_port(c.source_port, _traversed) # type: list
+ for c in sink_port.connections(enabled=True)
+ )
+ return list(chain(*source_ports_per_virtual_connection)) # concatenate generated lists of ports
+
+
+def _sources_from_virtual_source_port(source_port, _traversed=None):
+ """
+ Recursively resolve source ports over the virtual connections.
+ Keep track of traversed sources to avoid recursive loops.
+ """
+ _traversed = set(_traversed or []) # a new set!
+ if source_port in _traversed:
+ raise LoopError('Loop found when resolving port type')
+ _traversed.add(source_port)
+
+ block = source_port.parent_block
+ flow_graph = source_port.parent_flowgraph
+
+ if not isinstance(block, blocks.VirtualSource):
+ return [source_port] # nothing to resolve, we're done
+
+ stream_id = block.params['stream_id'].value
+
+ # currently the validation does not allow multiple virtual sinks and one virtual source
+ # but in the future it may...
+ connected_virtual_sink_blocks = (
+ b for b in flow_graph.iter_enabled_blocks()
+ if isinstance(b, blocks.VirtualSink) and b.params['stream_id'].value == stream_id
+ )
+ source_ports_per_virtual_connection = (
+ _sources_from_virtual_sink_port(b.sinks[0], _traversed) # type: list
+ for b in connected_virtual_sink_blocks
+ )
+ return list(chain(*source_ports_per_virtual_connection)) # concatenate generated lists of ports
+
+
+def downstream_ports(port):
+ if port.is_source:
+ return _sinks_from_virtual_source_port(port)
+ else:
+ return _sinks_from_virtual_sink_port(port)
+
+
+def _sinks_from_virtual_source_port(source_port, _traversed=None):
+ """
+ Resolve the sink port that is connected to the given virtual source port.
+ Use the get sink from virtual sink to recursively resolve subsequent ports.
+ """
+ sink_ports_per_virtual_connection = (
+ # there can be multiple ports per virtual connection
+ _sinks_from_virtual_sink_port(c.sink_port, _traversed) # type: list
+ for c in source_port.connections(enabled=True)
+ )
+ return list(chain(*sink_ports_per_virtual_connection)) # concatenate generated lists of ports
+
+
+def _sinks_from_virtual_sink_port(sink_port, _traversed=None):
+ """
+ Recursively resolve sink ports over the virtual connections.
+ Keep track of traversed sinks to avoid recursive loops.
+ """
+ _traversed = set(_traversed or []) # a new set!
+ if sink_port in _traversed:
+ raise LoopError('Loop found when resolving port type')
+ _traversed.add(sink_port)
+
+ block = sink_port.parent_block
+ flow_graph = sink_port.parent_flowgraph
+
+ if not isinstance(block, blocks.VirtualSink):
+ return [sink_port]
+
+ stream_id = block.params['stream_id'].value
+
+ connected_virtual_source_blocks = (
+ b for b in flow_graph.iter_enabled_blocks()
+ if isinstance(b, blocks.VirtualSource) and b.params['stream_id'].value == stream_id
+ )
+ sink_ports_per_virtual_connection = (
+ _sinks_from_virtual_source_port(b.sources[0], _traversed) # type: list
+ for b in connected_virtual_source_blocks
+ )
+ return list(chain(*sink_ports_per_virtual_connection)) # concatenate generated lists of ports
diff --git a/grc/core/ports/clone.py b/grc/core/ports/clone.py
new file mode 100644
index 000000000..4e1320f81
--- /dev/null
+++ b/grc/core/ports/clone.py
@@ -0,0 +1,38 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from .port import Port, Element
+
+
+class PortClone(Port):
+
+ def __init__(self, parent, direction, master, name, key):
+ Element.__init__(self, parent)
+ self.master_port = master
+
+ self.name = name
+ self.key = key
+ self.multiplicity = 1
+
+ def __getattr__(self, item):
+ return getattr(self.master_port, item)
+
+ def add_clone(self):
+ raise NotImplementedError()
+
+ def remove_clone(self, port):
+ raise NotImplementedError()
diff --git a/grc/core/ports/port.py b/grc/core/ports/port.py
new file mode 100644
index 000000000..139aae0cc
--- /dev/null
+++ b/grc/core/ports/port.py
@@ -0,0 +1,207 @@
+# Copyright 2008-2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
+
+from . import _virtual_connections
+
+from .. import Constants
+from ..base import Element
+from ..utils.descriptors import (
+ EvaluatedFlag, EvaluatedEnum, EvaluatedPInt,
+ setup_names, lazy_property
+)
+
+
+@setup_names
+class Port(Element):
+
+ is_port = True
+
+ dtype = EvaluatedEnum(list(Constants.TYPE_TO_SIZEOF.keys()), default='')
+ vlen = EvaluatedPInt()
+ multiplicity = EvaluatedPInt()
+ hidden = EvaluatedFlag()
+ optional = EvaluatedFlag()
+
+ def __init__(self, parent, direction, id, label='', domain=Constants.DEFAULT_DOMAIN, dtype='',
+ vlen='', multiplicity=1, optional=False, hide='', **_):
+ """Make a new port from nested data."""
+ Element.__init__(self, parent)
+
+ self._dir = direction
+ self.key = id
+ if not label:
+ label = id if not id.isdigit() else {'sink': 'in', 'source': 'out'}[direction] + id
+ self.name = self._base_name = label
+
+ self.domain = domain
+ self.dtype = dtype
+ self.vlen = vlen
+
+ if domain == Constants.GR_MESSAGE_DOMAIN: # ToDo: message port class
+ self.key = self.name
+ self.dtype = 'message'
+
+ self.multiplicity = multiplicity
+ self.optional = optional
+ self.hidden = hide
+ # end of args ########################################################
+ self.clones = [] # References to cloned ports (for nports > 1)
+
+ def __str__(self):
+ if self.is_source:
+ return 'Source - {}({})'.format(self.name, self.key)
+ if self.is_sink:
+ return 'Sink - {}({})'.format(self.name, self.key)
+
+ def __repr__(self):
+ return '{!r}.{}[{}]'.format(self.parent, 'sinks' if self.is_sink else 'sources', self.key)
+
+ @property
+ def item_size(self):
+ return Constants.TYPE_TO_SIZEOF[self.dtype] * self.vlen
+
+ @lazy_property
+ def is_sink(self):
+ return self._dir == 'sink'
+
+ @lazy_property
+ def is_source(self):
+ return self._dir == 'source'
+
+ @property
+ def inherit_type(self):
+ """always empty for e.g. virtual blocks, may eval to empty for 'Wildcard'"""
+ return not self.dtype
+
+ def validate(self):
+ Element.validate(self)
+ platform = self.parent_platform
+
+ num_connections = len(list(self.connections(enabled=True)))
+ need_connection = not self.optional and not self.hidden
+ if need_connection and num_connections == 0:
+ self.add_error_message('Port is not connected.')
+
+ if self.dtype not in Constants.TYPE_TO_SIZEOF.keys():
+ self.add_error_message('Type "{}" is not a possible type.'.format(self.dtype))
+
+ try:
+ domain = platform.domains[self.domain]
+ if self.is_sink and not domain.multi_in and num_connections > 1:
+ self.add_error_message('Domain "{}" can have only one upstream block'
+ ''.format(self.domain))
+ if self.is_source and not domain.multi_out and num_connections > 1:
+ self.add_error_message('Domain "{}" can have only one downstream block'
+ ''.format(self.domain))
+ except KeyError:
+ self.add_error_message('Domain key "{}" is not registered.'.format(self.domain))
+
+ def rewrite(self):
+ del self.vlen
+ del self.multiplicity
+ del self.hidden
+ del self.optional
+ del self.dtype
+
+ if self.inherit_type:
+ self.resolve_empty_type()
+
+ Element.rewrite(self)
+
+ # Update domain if was deduced from (dynamic) port type
+ if self.domain == Constants.GR_STREAM_DOMAIN and self.dtype == "message":
+ self.domain = Constants.GR_MESSAGE_DOMAIN
+ self.key = self.name
+ if self.domain == Constants.GR_MESSAGE_DOMAIN and self.dtype != "message":
+ self.domain = Constants.GR_STREAM_DOMAIN
+ self.key = '0' # Is rectified in rewrite()
+
+ def resolve_virtual_source(self):
+ """Only used by Generator after validation is passed"""
+ return _virtual_connections.upstream_ports(self)
+
+ def resolve_empty_type(self):
+ def find_port(finder):
+ try:
+ return next((p for p in finder(self) if not p.inherit_type), None)
+ except _virtual_connections.LoopError as error:
+ self.add_error_message(str(error))
+ except (StopIteration, Exception):
+ pass
+
+ try:
+ port = find_port(_virtual_connections.upstream_ports) or \
+ find_port(_virtual_connections.downstream_ports)
+ self.set_evaluated('dtype', port.dtype) # we don't want to override the template
+ self.set_evaluated('vlen', port.vlen) # we don't want to override the template
+ self.domain = port.domain
+ except AttributeError:
+ self.domain = Constants.DEFAULT_DOMAIN
+
+ def add_clone(self):
+ """
+ Create a clone of this (master) port and store a reference in self._clones.
+
+ The new port name (and key for message ports) will have index 1... appended.
+ If this is the first clone, this (master) port will get a 0 appended to its name (and key)
+
+ Returns:
+ the cloned port
+ """
+ # Add index to master port name if there are no clones yet
+ if not self.clones:
+ self.name = self._base_name + '0'
+ # Also update key for none stream ports
+ if not self.key.isdigit():
+ self.key = self.name
+
+ name = self._base_name + str(len(self.clones) + 1)
+ # Dummy value 99999 will be fixed later
+ key = '99999' if self.key.isdigit() else name
+
+ # Clone
+ port_factory = self.parent_platform.make_port
+ port = port_factory(self.parent, direction=self._dir,
+ name=name, key=key,
+ master=self, cls_key='clone')
+
+ self.clones.append(port)
+ return port
+
+ def remove_clone(self, port):
+ """
+ Remove a cloned port (from the list of clones only)
+ Remove the index 0 of the master port name (and key9 if there are no more clones left
+ """
+ self.clones.remove(port)
+ # Remove index from master port name if there are no more clones
+ if not self.clones:
+ self.name = self._base_name
+ # Also update key for none stream ports
+ if not self.key.isdigit():
+ self.key = self.name
+
+ def connections(self, enabled=None):
+ """Iterator over all connections to/from this port
+
+ enabled: None for all, True for enabled only, False for disabled only
+ """
+ for con in self.parent_flowgraph.connections:
+ if self in con and (enabled is None or enabled == con.enabled):
+ yield con
diff --git a/grc/core/schema_checker/__init__.py b/grc/core/schema_checker/__init__.py
new file mode 100644
index 000000000..e92500ed4
--- /dev/null
+++ b/grc/core/schema_checker/__init__.py
@@ -0,0 +1,5 @@
+from .validator import Validator
+
+from .block import BLOCK_SCHEME
+from .domain import DOMAIN_SCHEME
+from .flow_graph import FLOW_GRAPH_SCHEME
diff --git a/grc/core/schema_checker/block.py b/grc/core/schema_checker/block.py
new file mode 100644
index 000000000..d511e3688
--- /dev/null
+++ b/grc/core/schema_checker/block.py
@@ -0,0 +1,57 @@
+from .utils import Spec, expand, str_
+
+PARAM_SCHEME = expand(
+ base_key=str_, # todo: rename/remove
+
+ id=str_,
+ label=str_,
+ category=str_,
+
+ dtype=str_,
+ default=object,
+
+ options=list,
+ option_labels=list,
+ option_attributes=Spec(types=dict, required=False, item_scheme=(str_, list)),
+
+ hide=str_,
+)
+PORT_SCHEME = expand(
+ label=str_,
+ domain=str_,
+
+ id=str_,
+ dtype=str_,
+ vlen=(int, str_),
+
+ multiplicity=(int, str_),
+ optional=(bool, int, str_),
+ hide=(bool, str_),
+)
+TEMPLATES_SCHEME = expand(
+ imports=str_,
+ var_make=str_,
+ make=str_,
+ callbacks=list,
+)
+BLOCK_SCHEME = expand(
+ id=Spec(types=str_, required=True, item_scheme=None),
+ label=str_,
+ category=str_,
+ flags=(list, str_),
+
+ parameters=Spec(types=list, required=False, item_scheme=PARAM_SCHEME),
+ inputs=Spec(types=list, required=False, item_scheme=PORT_SCHEME),
+ outputs=Spec(types=list, required=False, item_scheme=PORT_SCHEME),
+
+ asserts=(list, str_),
+ value=str_,
+
+ templates=Spec(types=dict, required=False, item_scheme=TEMPLATES_SCHEME),
+
+ documentation=str_,
+
+ file_format=Spec(types=int, required=True, item_scheme=None),
+
+ block_wrapper_path=str_, # todo: rename/remove
+)
diff --git a/grc/core/schema_checker/domain.py b/grc/core/schema_checker/domain.py
new file mode 100644
index 000000000..86c29ed3c
--- /dev/null
+++ b/grc/core/schema_checker/domain.py
@@ -0,0 +1,16 @@
+from .utils import Spec, expand, str_
+
+DOMAIN_CONNECTION = expand(
+ type=Spec(types=list, required=True, item_scheme=None),
+ connect=str_,
+)
+
+DOMAIN_SCHEME = expand(
+ id=Spec(types=str_, required=True, item_scheme=None),
+ label=str_,
+ color=str_,
+ multiple_connections_per_input=bool,
+ multiple_connections_per_output=bool,
+
+ templates=Spec(types=list, required=False, item_scheme=DOMAIN_CONNECTION)
+) \ No newline at end of file
diff --git a/grc/core/schema_checker/flow_graph.py b/grc/core/schema_checker/flow_graph.py
new file mode 100644
index 000000000..746fbf4aa
--- /dev/null
+++ b/grc/core/schema_checker/flow_graph.py
@@ -0,0 +1,23 @@
+from .utils import Spec, expand, str_
+
+OPTIONS_SCHEME = expand(
+ parameters=Spec(types=dict, required=False, item_scheme=(str_, str_)),
+ states=Spec(types=dict, required=False, item_scheme=(str_, str_)),
+)
+
+BLOCK_SCHEME = expand(
+ name=str_,
+ id=str_,
+ **OPTIONS_SCHEME
+)
+
+FLOW_GRAPH_SCHEME = expand(
+ options=Spec(types=dict, required=False, item_scheme=OPTIONS_SCHEME),
+ blocks=Spec(types=dict, required=False, item_scheme=BLOCK_SCHEME),
+ connections=list,
+
+ metadata=Spec(types=dict, required=True, item_scheme=expand(
+ file_format=Spec(types=int, required=True, item_scheme=None),
+ ))
+
+)
diff --git a/grc/core/schema_checker/utils.py b/grc/core/schema_checker/utils.py
new file mode 100644
index 000000000..a9cf4c017
--- /dev/null
+++ b/grc/core/schema_checker/utils.py
@@ -0,0 +1,27 @@
+import collections
+
+import six
+
+Spec = collections.namedtuple('Spec', 'types required item_scheme')
+
+
+def expand(**kwargs):
+ def expand_spec(spec):
+ if not isinstance(spec, Spec):
+ types_ = spec if isinstance(spec, tuple) else (spec,)
+ spec = Spec(types=types_, required=False, item_scheme=None)
+ elif not isinstance(spec.types, tuple):
+ spec = Spec(types=(spec.types,), required=spec.required,
+ item_scheme=spec.item_scheme)
+ return spec
+ return {key: expand_spec(value) for key, value in kwargs.items()}
+
+
+str_ = six.string_types
+
+
+class Message(collections.namedtuple('Message', 'path type message')):
+ fmt = '{path}: {type}: {message}'
+
+ def __str__(self):
+ return self.fmt.format(**self._asdict())
diff --git a/grc/core/schema_checker/validator.py b/grc/core/schema_checker/validator.py
new file mode 100644
index 000000000..ab4d43bc6
--- /dev/null
+++ b/grc/core/schema_checker/validator.py
@@ -0,0 +1,102 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2 of the License, or (at your
+# option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import print_function
+
+import six
+
+from .utils import Message, Spec
+
+
+class Validator(object):
+
+ def __init__(self, scheme=None):
+ self._path = []
+ self.scheme = scheme
+ self.messages = []
+ self.passed = False
+
+ def run(self, data):
+ if not self.scheme:
+ return True
+ self._reset()
+ self._path.append('block')
+ self._check(data, self.scheme)
+ self._path.pop()
+ return self.passed
+
+ def _reset(self):
+ del self.messages[:]
+ del self._path[:]
+ self.passed = True
+
+ def _check(self, data, scheme):
+ if not data or not isinstance(data, dict):
+ self._error('Empty data or not a dict')
+ return
+ if isinstance(scheme, dict):
+ self._check_dict(data, scheme)
+ else:
+ self._check_var_key_dict(data, *scheme)
+
+ def _check_var_key_dict(self, data, key_type, value_scheme):
+ for key, value in six.iteritems(data):
+ if not isinstance(key, key_type):
+ self._error('Key type {!r} for {!r} not in valid types'.format(
+ type(value).__name__, key))
+ if isinstance(value_scheme, Spec):
+ self._check_dict(value, value_scheme)
+ elif not isinstance(value, value_scheme):
+ self._error('Value type {!r} for {!r} not in valid types'.format(
+ type(value).__name__, key))
+
+ def _check_dict(self, data, scheme):
+ for key, (types_, required, item_scheme) in six.iteritems(scheme):
+ try:
+ value = data[key]
+ except KeyError:
+ if required:
+ self._error('Missing required entry {!r}'.format(key))
+ continue
+
+ self._check_value(value, types_, item_scheme, label=key)
+
+ for key in set(data).difference(scheme):
+ self._warn('Ignoring extra key {!r}'.format(key))
+
+ def _check_list(self, data, scheme, label):
+ for i, item in enumerate(data):
+ self._path.append('{}[{}]'.format(label, i))
+ self._check(item, scheme)
+ self._path.pop()
+
+ def _check_value(self, value, types_, item_scheme, label):
+ if not isinstance(value, types_):
+ self._error('Value type {!r} for {!r} not in valid types'.format(
+ type(value).__name__, label))
+ if item_scheme:
+ if isinstance(value, list):
+ self._check_list(value, item_scheme, label)
+ elif isinstance(value, dict):
+ self._check(value, item_scheme)
+
+ def _error(self, msg):
+ self.messages.append(Message('.'.join(self._path), 'error', msg))
+ self.passed = False
+
+ def _warn(self, msg):
+ self.messages.append(Message('.'.join(self._path), 'warn', msg))
diff --git a/grc/core/utils/__init__.py b/grc/core/utils/__init__.py
index 2aed42d76..f2ac986fb 100644
--- a/grc/core/utils/__init__.py
+++ b/grc/core/utils/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2008-2015 Free Software Foundation, Inc.
+# Copyright 2016 Free Software Foundation, Inc.
# This file is part of GNU Radio
#
# GNU Radio Companion is free software; you can redistribute it and/or
@@ -15,9 +15,19 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-import expr_utils
-import epy_block_io
-import extract_docs
+from __future__ import absolute_import
+
+import six
+
+from . import epy_block_io, expr_utils, extract_docs, flow_graph_complexity
+from .hide_bokeh_gui_options_if_not_installed import hide_bokeh_gui_options_if_not_installed
+
+
+def to_list(value):
+ if not value:
+ return []
+ elif isinstance(value, six.string_types):
+ return [value]
+ else:
+ return list(value)
-from odict import odict
-from hide_bokeh_gui_options_if_not_installed import hide_bokeh_gui_options_if_not_installed
diff --git a/grc/core/utils/CMakeLists.txt b/grc/core/utils/backports/__init__.py
index 3ba65258a..a24ee3ae0 100644
--- a/grc/core/utils/CMakeLists.txt
+++ b/grc/core/utils/backports/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2015 Free Software Foundation, Inc.
+# Copyright 2016 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -17,9 +17,9 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-file(GLOB py_files "*.py")
+from __future__ import absolute_import
-GR_PYTHON_INSTALL(
- FILES ${py_files}
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/core/utils
-)
+try:
+ from collections import ChainMap
+except ImportError:
+ from .chainmap import ChainMap
diff --git a/grc/core/utils/backports/chainmap.py b/grc/core/utils/backports/chainmap.py
new file mode 100644
index 000000000..1f4f4a96f
--- /dev/null
+++ b/grc/core/utils/backports/chainmap.py
@@ -0,0 +1,106 @@
+# from https://hg.python.org/cpython/file/default/Lib/collections/__init__.py
+
+from collections import MutableMapping
+
+
+class ChainMap(MutableMapping):
+ """ A ChainMap groups multiple dicts (or other mappings) together
+ to create a single, updateable view.
+
+ The underlying mappings are stored in a list. That list is public and can
+ be accessed or updated using the *maps* attribute. There is no other
+ state.
+
+ Lookups search the underlying mappings successively until a key is found.
+ In contrast, writes, updates, and deletions only operate on the first
+ mapping.
+
+ """
+
+ def __init__(self, *maps):
+ """Initialize a ChainMap by setting *maps* to the given mappings.
+ If no mappings are provided, a single empty dictionary is used.
+
+ """
+ self.maps = list(maps) or [{}] # always at least one map
+
+ def __missing__(self, key):
+ raise KeyError(key)
+
+ def __getitem__(self, key):
+ for mapping in self.maps:
+ try:
+ return mapping[key] # can't use 'key in mapping' with defaultdict
+ except KeyError:
+ pass
+ return self.__missing__(key) # support subclasses that define __missing__
+
+ def get(self, key, default=None):
+ return self[key] if key in self else default
+
+ def __len__(self):
+ return len(set().union(*self.maps)) # reuses stored hash values if possible
+
+ def __iter__(self):
+ return iter(set().union(*self.maps))
+
+ def __contains__(self, key):
+ return any(key in m for m in self.maps)
+
+ def __bool__(self):
+ return any(self.maps)
+
+ def __repr__(self):
+ return '{0.__class__.__name__}({1})'.format(
+ self, ', '.join(map(repr, self.maps)))
+
+ @classmethod
+ def fromkeys(cls, iterable, *args):
+ """Create a ChainMap with a single dict created from the iterable."""
+ return cls(dict.fromkeys(iterable, *args))
+
+ def copy(self):
+ """New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]"""
+ return self.__class__(self.maps[0].copy(), *self.maps[1:])
+
+ __copy__ = copy
+
+ def new_child(self, m=None): # like Django's Context.push()
+ """New ChainMap with a new map followed by all previous maps.
+ If no map is provided, an empty dict is used.
+ """
+ if m is None:
+ m = {}
+ return self.__class__(m, *self.maps)
+
+ @property
+ def parents(self): # like Django's Context.pop()
+ """New ChainMap from maps[1:]."""
+ return self.__class__(*self.maps[1:])
+
+ def __setitem__(self, key, value):
+ self.maps[0][key] = value
+
+ def __delitem__(self, key):
+ try:
+ del self.maps[0][key]
+ except KeyError:
+ raise KeyError('Key not found in the first mapping: {!r}'.format(key))
+
+ def popitem(self):
+ """Remove and return an item pair from maps[0]. Raise KeyError is maps[0] is empty."""
+ try:
+ return self.maps[0].popitem()
+ except KeyError:
+ raise KeyError('No keys found in the first mapping.')
+
+ def pop(self, key, *args):
+ """Remove *key* from maps[0] and return its value. Raise KeyError if *key* not in maps[0]."""
+ try:
+ return self.maps[0].pop(key, *args)
+ except KeyError:
+ raise KeyError('Key not found in the first mapping: {!r}'.format(key))
+
+ def clear(self):
+ """Clear maps[0], leaving maps[1:] intact."""
+ self.maps[0].clear()
diff --git a/grc/core/utils/shlex.py b/grc/core/utils/backports/shlex.py
index 6b620fa39..6b620fa39 100644
--- a/grc/core/utils/shlex.py
+++ b/grc/core/utils/backports/shlex.py
diff --git a/grc/core/utils/complexity.py b/grc/core/utils/complexity.py
deleted file mode 100644
index baa8040db..000000000
--- a/grc/core/utils/complexity.py
+++ /dev/null
@@ -1,49 +0,0 @@
-
-def calculate_flowgraph_complexity(flowgraph):
- """ Determines the complexity of a flowgraph """
- dbal = 0
- for block in flowgraph.blocks:
- # Skip options block
- if block.get_key() == 'options':
- continue
-
- # Don't worry about optional sinks?
- sink_list = filter(lambda c: not c.get_optional(), block.get_sinks())
- source_list = filter(lambda c: not c.get_optional(), block.get_sources())
- sinks = float(len(sink_list))
- sources = float(len(source_list))
- base = max(min(sinks, sources), 1)
-
- # Port ratio multiplier
- if min(sinks, sources) > 0:
- multi = sinks / sources
- multi = (1 / multi) if multi > 1 else multi
- else:
- multi = 1
-
- # Connection ratio multiplier
- sink_multi = max(float(sum(map(lambda c: len(c.get_connections()), sink_list)) / max(sinks, 1.0)), 1.0)
- source_multi = max(float(sum(map(lambda c: len(c.get_connections()), source_list)) / max(sources, 1.0)), 1.0)
- dbal = dbal + (base * multi * sink_multi * source_multi)
-
- blocks = float(len(flowgraph.blocks))
- connections = float(len(flowgraph.connections))
- elements = blocks + connections
- disabled_connections = len(filter(lambda c: not c.get_enabled(), flowgraph.connections))
- variables = elements - blocks - connections
- enabled = float(len(flowgraph.get_enabled_blocks()))
-
- # Disabled multiplier
- if enabled > 0:
- disabled_multi = 1 / (max(1 - ((blocks - enabled) / max(blocks, 1)), 0.05))
- else:
- disabled_multi = 1
-
- # Connection multiplier (How many connections )
- if (connections - disabled_connections) > 0:
- conn_multi = 1 / (max(1 - (disabled_connections / max(connections, 1)), 0.05))
- else:
- conn_multi = 1
-
- final = round(max((dbal - 1) * disabled_multi * conn_multi * connections, 0.0) / 1000000, 6)
- return final
diff --git a/grc/core/utils/descriptors/__init__.py b/grc/core/utils/descriptors/__init__.py
new file mode 100644
index 000000000..80c525923
--- /dev/null
+++ b/grc/core/utils/descriptors/__init__.py
@@ -0,0 +1,26 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from ._lazy import lazy_property, nop_write
+
+from .evaluated import (
+ Evaluated,
+ EvaluatedEnum,
+ EvaluatedPInt,
+ EvaluatedFlag,
+ setup_names,
+)
diff --git a/grc/core/utils/descriptors/_lazy.py b/grc/core/utils/descriptors/_lazy.py
new file mode 100644
index 000000000..a0cb12693
--- /dev/null
+++ b/grc/core/utils/descriptors/_lazy.py
@@ -0,0 +1,39 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+import functools
+
+
+class lazy_property(object):
+
+ def __init__(self, func):
+ self.func = func
+ functools.update_wrapper(self, func)
+
+ def __get__(self, instance, owner):
+ if instance is None:
+ return self
+ value = self.func(instance)
+ setattr(instance, self.func.__name__, value)
+ return value
+
+
+def nop_write(prop):
+ """Make this a property with a nop setter"""
+ def nop(self, value):
+ pass
+ return prop.setter(nop)
diff --git a/grc/core/utils/descriptors/evaluated.py b/grc/core/utils/descriptors/evaluated.py
new file mode 100644
index 000000000..0e1b68761
--- /dev/null
+++ b/grc/core/utils/descriptors/evaluated.py
@@ -0,0 +1,117 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
+
+import six
+
+
+class Evaluated(object):
+ def __init__(self, expected_type, default, name=None):
+ self.expected_type = expected_type
+ self.default = default
+
+ self.name = name or 'evaled_property_{}'.format(id(self))
+ self.eval_function = self.default_eval_func
+
+ @property
+ def name_raw(self):
+ return '_' + self.name
+
+ def default_eval_func(self, instance):
+ raw = getattr(instance, self.name_raw)
+ try:
+ value = instance.parent_block.evaluate(raw)
+ except Exception as error:
+ if raw:
+ instance.add_error_message("Failed to eval '{}': {}".format(raw, error))
+ return self.default
+
+ if not isinstance(value, self.expected_type):
+ instance.add_error_message("Can not cast evaluated value '{}' to type {}"
+ "".format(value, self.expected_type))
+ return self.default
+ # print(instance, self.name, raw, value)
+ return value
+
+ def __call__(self, func):
+ self.name = func.__name__
+ self.eval_function = func
+ return self
+
+ def __get__(self, instance, owner):
+ if instance is None:
+ return self
+ attribs = instance.__dict__
+ try:
+ value = attribs[self.name]
+ except KeyError:
+ value = attribs[self.name] = self.eval_function(instance)
+ return value
+
+ def __set__(self, instance, value):
+ attribs = instance.__dict__
+ value = value or self.default
+ if isinstance(value, six.text_type) and value.startswith('${') and value.endswith('}'):
+ attribs[self.name_raw] = value[2:-1].strip()
+ else:
+ attribs[self.name] = type(self.default)(value)
+
+ def __delete__(self, instance):
+ attribs = instance.__dict__
+ if self.name_raw in attribs:
+ attribs.pop(self.name, None)
+
+
+class EvaluatedEnum(Evaluated):
+ def __init__(self, allowed_values, default=None, name=None):
+ if isinstance(allowed_values, six.string_types):
+ allowed_values = set(allowed_values.split())
+ self.allowed_values = allowed_values
+ default = default if default is not None else next(iter(self.allowed_values))
+ super(EvaluatedEnum, self).__init__(str, default, name)
+
+ def default_eval_func(self, instance):
+ value = super(EvaluatedEnum, self).default_eval_func(instance)
+ if value not in self.allowed_values:
+ instance.add_error_message("Value '{}' not in allowed values".format(value))
+ return self.default
+ return value
+
+
+class EvaluatedPInt(Evaluated):
+ def __init__(self, name=None):
+ super(EvaluatedPInt, self).__init__(int, 1, name)
+
+ def default_eval_func(self, instance):
+ value = super(EvaluatedPInt, self).default_eval_func(instance)
+ if value < 1:
+ # todo: log
+ return self.default
+ return value
+
+
+class EvaluatedFlag(Evaluated):
+ def __init__(self, name=None):
+ super(EvaluatedFlag, self).__init__((bool, int), False, name)
+
+
+def setup_names(cls):
+ for name, attrib in cls.__dict__.items():
+ if isinstance(attrib, Evaluated):
+ attrib.name = name
+ return cls
diff --git a/grc/core/utils/epy_block_io.py b/grc/core/utils/epy_block_io.py
index a094ab7ad..823116adb 100644
--- a/grc/core/utils/epy_block_io.py
+++ b/grc/core/utils/epy_block_io.py
@@ -1,7 +1,12 @@
+from __future__ import absolute_import
+
import inspect
import collections
+import six
+from six.moves import zip
+
TYPE_MAP = {
'complex64': 'complex', 'complex': 'complex',
@@ -32,10 +37,10 @@ def _ports(sigs, msgs):
def _find_block_class(source_code, cls):
ns = {}
try:
- exec source_code in ns
+ exec(source_code, ns)
except Exception as e:
raise ValueError("Can't interpret source code: " + str(e))
- for var in ns.itervalues():
+ for var in six.itervalues(ns):
if inspect.isclass(var) and issubclass(var, cls):
return var
raise ValueError('No python block class found in code')
@@ -53,7 +58,7 @@ def extract(cls):
spec = inspect.getargspec(cls.__init__)
init_args = spec.args[1:]
- defaults = map(repr, spec.defaults or ())
+ defaults = [repr(arg) for arg in (spec.defaults or ())]
doc = cls.__doc__ or cls.__init__.__doc__ or ''
cls_name = cls.__name__
diff --git a/grc/core/utils/expr_utils.py b/grc/core/utils/expr_utils.py
index 2059ceff9..427585e93 100644
--- a/grc/core/utils/expr_utils.py
+++ b/grc/core/utils/expr_utils.py
@@ -17,18 +17,111 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
+from __future__ import absolute_import, print_function
+
import string
-VAR_CHARS = string.letters + string.digits + '_'
+import six
+
+
+def expr_replace(expr, replace_dict):
+ """
+ Search for vars in the expression and add the prepend.
+
+ Args:
+ expr: an expression string
+ replace_dict: a dict of find:replace
+
+ Returns:
+ a new expression with the prepend
+ """
+ expr_splits = _expr_split(expr, var_chars=VAR_CHARS + '.')
+ for i, es in enumerate(expr_splits):
+ if es in list(replace_dict.keys()):
+ expr_splits[i] = replace_dict[es]
+ return ''.join(expr_splits)
+
+
+def get_variable_dependencies(expr, vars):
+ """
+ Return a set of variables used in this expression.
+
+ Args:
+ expr: an expression string
+ vars: a list of variable names
+
+ Returns:
+ a subset of vars used in the expression
+ """
+ expr_toks = _expr_split(expr)
+ return set(v for v in vars if v in expr_toks)
+
+
+def sort_objects(objects, get_id, get_expr):
+ """
+ Sort a list of objects according to their expressions.
+
+ Args:
+ objects: the list of objects to sort
+ get_id: the function to extract an id from the object
+ get_expr: the function to extract an expression from the object
+
+ Returns:
+ a list of sorted objects
+ """
+ id2obj = {get_id(obj): obj for obj in objects}
+ # Map obj id to expression code
+ id2expr = {get_id(obj): get_expr(obj) for obj in objects}
+ # Sort according to dependency
+ sorted_ids = _sort_variables(id2expr)
+ # Return list of sorted objects
+ return [id2obj[id] for id in sorted_ids]
+
+
+import ast
+
+
+def dependencies(expr, names=None):
+ node = ast.parse(expr, mode='eval')
+ used_ids = frozenset([n.id for n in ast.walk(node) if isinstance(n, ast.Name)])
+ return used_ids & names if names else used_ids
+
+
+def sort_objects2(objects, id_getter, expr_getter, check_circular=True):
+ known_ids = {id_getter(obj) for obj in objects}
+
+ def dependent_ids(obj):
+ deps = dependencies(expr_getter(obj))
+ return [id_ if id_ in deps else None for id_ in known_ids]
-class graph(object):
+ objects = sorted(objects, key=dependent_ids)
+
+ if check_circular: # walk var defines step by step
+ defined_ids = set() # variables defined so far
+ for obj in objects:
+ deps = dependencies(expr_getter(obj), known_ids)
+ if not defined_ids.issuperset(deps): # can't have an undefined dep
+ raise RuntimeError(obj, deps, defined_ids)
+ defined_ids.add(id_getter(obj)) # define this one
+
+ return objects
+
+
+
+
+VAR_CHARS = string.ascii_letters + string.digits + '_'
+
+
+class _graph(object):
"""
Simple graph structure held in a dictionary.
"""
- def __init__(self): self._graph = dict()
+ def __init__(self):
+ self._graph = dict()
- def __str__(self): return str(self._graph)
+ def __str__(self):
+ return str(self._graph)
def add_node(self, node_key):
if node_key in self._graph:
@@ -50,13 +143,13 @@ class graph(object):
self._graph[src_node_key].remove(dest_node_key)
def get_nodes(self):
- return self._graph.keys()
+ return list(self._graph.keys())
def get_edges(self, node_key):
return self._graph[node_key]
-def expr_split(expr, var_chars=VAR_CHARS):
+def _expr_split(expr, var_chars=VAR_CHARS):
"""
Split up an expression by non alphanumeric characters, including underscore.
Leave strings in-tact.
@@ -85,43 +178,10 @@ def expr_split(expr, var_chars=VAR_CHARS):
toks.append(char)
tok = ''
toks.append(tok)
- return filter(lambda t: t, toks)
-
-
-def expr_replace(expr, replace_dict):
- """
- Search for vars in the expression and add the prepend.
-
- Args:
- expr: an expression string
- replace_dict: a dict of find:replace
-
- Returns:
- a new expression with the prepend
- """
- expr_splits = expr_split(expr, var_chars=VAR_CHARS + '.')
- for i, es in enumerate(expr_splits):
- if es in replace_dict.keys():
- expr_splits[i] = replace_dict[es]
- return ''.join(expr_splits)
+ return [t for t in toks if t]
-def get_variable_dependencies(expr, vars):
- """
- Return a set of variables used in this expression.
-
- Args:
- expr: an expression string
- vars: a list of variable names
-
- Returns:
- a subset of vars used in the expression
- """
- expr_toks = expr_split(expr)
- return set(var for var in vars if var in expr_toks)
-
-
-def get_graph(exprs):
+def _get_graph(exprs):
"""
Get a graph representing the variable dependencies
@@ -131,19 +191,19 @@ def get_graph(exprs):
Returns:
a graph of variable deps
"""
- vars = exprs.keys()
+ vars = list(exprs.keys())
# Get dependencies for each expression, load into graph
- var_graph = graph()
+ var_graph = _graph()
for var in vars:
var_graph.add_node(var)
- for var, expr in exprs.iteritems():
+ for var, expr in six.iteritems(exprs):
for dep in get_variable_dependencies(expr, vars):
if dep != var:
var_graph.add_edge(dep, var)
return var_graph
-def sort_variables(exprs):
+def _sort_variables(exprs):
"""
Get a list of variables in order of dependencies.
@@ -154,12 +214,12 @@ def sort_variables(exprs):
a list of variable names
@throws Exception circular dependencies
"""
- var_graph = get_graph(exprs)
+ var_graph = _get_graph(exprs)
sorted_vars = list()
# Determine dependency order
while var_graph.get_nodes():
# Get a list of nodes with no edges
- indep_vars = filter(lambda var: not var_graph.get_edges(var), var_graph.get_nodes())
+ indep_vars = [var for var in var_graph.get_nodes() if not var_graph.get_edges(var)]
if not indep_vars:
raise Exception('circular dependency caught in sort_variables')
# Add the indep vars to the end of the list
@@ -168,24 +228,3 @@ def sort_variables(exprs):
for var in indep_vars:
var_graph.remove_node(var)
return reversed(sorted_vars)
-
-
-def sort_objects(objects, get_id, get_expr):
- """
- Sort a list of objects according to their expressions.
-
- Args:
- objects: the list of objects to sort
- get_id: the function to extract an id from the object
- get_expr: the function to extract an expression from the object
-
- Returns:
- a list of sorted objects
- """
- id2obj = dict([(get_id(obj), obj) for obj in objects])
- # Map obj id to expression code
- id2expr = dict([(get_id(obj), get_expr(obj)) for obj in objects])
- # Sort according to dependency
- sorted_ids = sort_variables(id2expr)
- # Return list of sorted objects
- return [id2obj[id] for id in sorted_ids]
diff --git a/grc/core/utils/extract_docs.py b/grc/core/utils/extract_docs.py
index a6e0bc971..7688f98de 100644
--- a/grc/core/utils/extract_docs.py
+++ b/grc/core/utils/extract_docs.py
@@ -17,15 +17,19 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
+from __future__ import absolute_import, print_function
+
import sys
import re
import subprocess
import threading
import json
-import Queue
import random
import itertools
+import six
+from six.moves import queue, filter, range
+
###############################################################################
# The docstring extraction
@@ -94,8 +98,7 @@ def docstring_from_make(key, imports, make):
if '$' in blk_cls:
raise ValueError('Not an identifier')
ns = dict()
- for _import in imports:
- exec(_import.strip(), ns)
+ exec(imports.strip(), ns)
blk = eval(blk_cls, ns)
doc_strings = {key: blk.__doc__}
@@ -124,7 +127,7 @@ class SubprocessLoader(object):
self.callback_query_result = callback_query_result
self.callback_finished = callback_finished or (lambda: None)
- self._queue = Queue.Queue()
+ self._queue = queue.Queue()
self._thread = None
self._worker = None
self._shutdown = threading.Event()
@@ -157,14 +160,15 @@ class SubprocessLoader(object):
cmd, args = self._last_cmd
if cmd == 'query':
msg += " (crashed while loading {0!r})".format(args[0])
- print >> sys.stderr, msg
+ print(msg, file=sys.stderr)
continue # restart
else:
break # normal termination, return
finally:
- self._worker.terminate()
+ if self._worker:
+ self._worker.terminate()
else:
- print >> sys.stderr, "Warning: docstring loader crashed too often"
+ print("Warning: docstring loader crashed too often", file=sys.stderr)
self._thread = None
self._worker = None
self.callback_finished()
@@ -203,9 +207,9 @@ class SubprocessLoader(object):
key, docs = args
self.callback_query_result(key, docs)
elif cmd == 'error':
- print args
+ print(args)
else:
- print >> sys.stderr, "Unknown response:", cmd, args
+ print("Unknown response:", cmd, args, file=sys.stderr)
def query(self, key, imports=None, make=None):
""" Request docstring extraction for a certain key """
@@ -270,12 +274,12 @@ if __name__ == '__worker__':
elif __name__ == '__main__':
def callback(key, docs):
- print key
- for match, doc in docs.iteritems():
- print '-->', match
- print doc.strip()
- print
- print
+ print(key)
+ for match, doc in six.iteritems(docs):
+ print('-->', match)
+ print(str(doc).strip())
+ print()
+ print()
r = SubprocessLoader(callback)
diff --git a/grc/core/utils/flow_graph_complexity.py b/grc/core/utils/flow_graph_complexity.py
new file mode 100644
index 000000000..e8962b0ae
--- /dev/null
+++ b/grc/core/utils/flow_graph_complexity.py
@@ -0,0 +1,54 @@
+
+def calculate(flowgraph):
+ """ Determines the complexity of a flowgraph """
+
+ try:
+ dbal = 0.0
+ for block in flowgraph.blocks:
+ if block.key == "options":
+ continue
+
+ # Determine the base value for this block
+ sinks = sum(1.0 for port in block.sinks if not port.optional)
+ sources = sum(1.0 for port in block.sources if not port.optional)
+ base = max(min(sinks, sources), 1)
+
+ # Determine the port multiplier
+ block_connections = 0.0
+ for port in block.sources:
+ block_connections += sum(1.0 for c in port.connections())
+ source_multi = max(block_connections / max(sources, 1.0), 1.0)
+
+ # Port ratio multiplier
+ multi = 1.0
+ if min(sinks, sources) > 0:
+ multi = float(sinks / sources)
+ multi = float(1 / multi) if multi > 1 else multi
+
+ dbal += base * multi * source_multi
+
+ blocks = float(len(flowgraph.blocks) - 1)
+ connections = float(len(flowgraph.connections))
+ variables = float(len(flowgraph.get_variables()))
+
+ enabled = float(len(flowgraph.get_enabled_blocks()))
+ enabled_connections = float(len(flowgraph.get_enabled_connections()))
+ disabled_connections = connections - enabled_connections
+
+ # Disabled multiplier
+ if enabled > 0:
+ disabled_multi = 1 / (max(1 - ((blocks - enabled) / max(blocks, 1)), 0.05))
+ else:
+ disabled_multi = 1
+
+ # Connection multiplier (How many connections )
+ if (connections - disabled_connections) > 0:
+ conn_multi = 1 / (max(1 - (disabled_connections / max(connections, 1)), 0.05))
+ else:
+ conn_multi = 1
+
+ final = round(max((dbal - 1) * disabled_multi * conn_multi * connections, 0.0) / 1000000, 6)
+ return final
+
+ except Exception:
+ return "<Error>"
diff --git a/grc/core/utils/hide_bokeh_gui_options_if_not_installed.py b/grc/core/utils/hide_bokeh_gui_options_if_not_installed.py
index fc0141851..ab4a42b2e 100644
--- a/grc/core/utils/hide_bokeh_gui_options_if_not_installed.py
+++ b/grc/core/utils/hide_bokeh_gui_options_if_not_installed.py
@@ -16,13 +16,12 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-def hide_bokeh_gui_options_if_not_installed(options):
+def hide_bokeh_gui_options_if_not_installed(options_blk):
try:
import bokehgui
except ImportError:
- generate_option = options.get_param('generate_options')
- list_generate_option = generate_option.get_options()
- for option in list_generate_option:
- if option.get_key() == 'bokeh_gui':
- list_generate_option.remove(option)
- return
+ for param in options_blk.parameters_data:
+ if param['id'] == 'generate_options':
+ ind = param['options'].index('bokeh_gui')
+ del param['options'][ind]
+ del param['option_labels'][ind]
diff --git a/grc/core/utils/odict.py b/grc/core/utils/odict.py
deleted file mode 100644
index 740a81c60..000000000
--- a/grc/core/utils/odict.py
+++ /dev/null
@@ -1,115 +0,0 @@
-"""
-Copyright 2008-2015 Free Software Foundation, Inc.
-This file is part of GNU Radio
-
-GNU Radio Companion 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 2
-of the License, or (at your option) any later version.
-
-GNU Radio Companion 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 program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-"""
-
-from UserDict import DictMixin
-
-
-class odict(DictMixin):
-
- def __init__(self, d={}):
- self._keys = list(d.keys())
- self._data = dict(d.copy())
-
- def __setitem__(self, key, value):
- if key not in self._data:
- self._keys.append(key)
- self._data[key] = value
-
- def __getitem__(self, key):
- return self._data[key]
-
- def __delitem__(self, key):
- del self._data[key]
- self._keys.remove(key)
-
- def keys(self):
- return list(self._keys)
-
- def copy(self):
- copy_dict = odict()
- copy_dict._data = self._data.copy()
- copy_dict._keys = list(self._keys)
- return copy_dict
-
- def insert_after(self, pos_key, key, val):
- """
- Insert the new key, value entry after the entry given by the position key.
- If the positional key is None, insert at the end.
-
- Args:
- pos_key: the positional key
- key: the key for the new entry
- val: the value for the new entry
- """
- index = (pos_key is None) and len(self._keys) or self._keys.index(pos_key)
- if key in self._keys:
- raise KeyError('Cannot insert, key "{}" already exists'.format(str(key)))
- self._keys.insert(index+1, key)
- self._data[key] = val
-
- def insert_before(self, pos_key, key, val):
- """
- Insert the new key, value entry before the entry given by the position key.
- If the positional key is None, insert at the beginning.
-
- Args:
- pos_key: the positional key
- key: the key for the new entry
- val: the value for the new entry
- """
- index = (pos_key is not None) and self._keys.index(pos_key) or 0
- if key in self._keys:
- raise KeyError('Cannot insert, key "{}" already exists'.format(str(key)))
- self._keys.insert(index, key)
- self._data[key] = val
-
- def find(self, key):
- """
- Get the value for this key if exists.
-
- Args:
- key: the key to search for
-
- Returns:
- the value or None
- """
- if key in self:
- return self[key]
- return None
-
- def findall(self, key):
- """
- Get a list of values for this key.
-
- Args:
- key: the key to search for
-
- Returns:
- a list of values or empty list
- """
- obj = self.find(key)
- if obj is None:
- obj = list()
- if isinstance(obj, list):
- return obj
- return [obj]
-
- def clear(self):
- self._data.clear()
- del self._keys[:] \ No newline at end of file
diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py
index 5e728a350..14b042276 100644
--- a/grc/gui/Actions.py
+++ b/grc/gui/Actions.py
@@ -17,284 +17,327 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-import pygtk
-pygtk.require('2.0')
-import gtk
+from __future__ import absolute_import
-import Preferences
+import six
+import logging
-NO_MODS_MASK = 0
+from gi.repository import Gtk, Gdk, Gio, GLib, GObject
-########################################################################
-# Actions API
-########################################################################
-_actions_keypress_dict = dict()
-_keymap = gtk.gdk.keymap_get_default()
-_used_mods_mask = NO_MODS_MASK
-
-
-def handle_key_press(event):
- """
- Call the action associated with the key press event.
- Both the key value and the mask must have a match.
-
- Args:
- event: a gtk key press event
-
- Returns:
- true if handled
- """
- _used_mods_mask = reduce(lambda x, y: x | y, [mod_mask for keyval, mod_mask in _actions_keypress_dict], NO_MODS_MASK)
- # extract the key value and the consumed modifiers
- keyval, egroup, level, consumed = _keymap.translate_keyboard_state(
- event.hardware_keycode, event.state, event.group)
- # get the modifier mask and ignore irrelevant modifiers
- mod_mask = event.state & ~consumed & _used_mods_mask
- # look up the keypress and call the action
- try:
- _actions_keypress_dict[(keyval, mod_mask)]()
- except KeyError:
- return False # not handled
- else:
- return True # handled here
-
-_all_actions_list = list()
-
-
-def get_all_actions():
- return _all_actions_list
-
-_accel_group = gtk.AccelGroup()
-
-
-def get_accel_group():
- return _accel_group
-
-
-class _ActionBase(object):
- """
- Base class for Action and ToggleAction
- Register actions and keypresses with this module.
- """
- def __init__(self, label, keypresses):
- _all_actions_list.append(self)
- for i in range(len(keypresses)/2):
- keyval, mod_mask = keypresses[i*2:(i+1)*2]
- # register this keypress
- if _actions_keypress_dict.has_key((keyval, mod_mask)):
- raise KeyError('keyval/mod_mask pair already registered "%s"' % str((keyval, mod_mask)))
- _actions_keypress_dict[(keyval, mod_mask)] = self
- # set the accelerator group, and accelerator path
- # register the key name and mod mask with the accelerator path
- if label is None:
- continue # don't register accel
- accel_path = '<main>/' + self.get_name()
- self.set_accel_group(get_accel_group())
- self.set_accel_path(accel_path)
- gtk.accel_map_add_entry(accel_path, keyval, mod_mask)
- self.args = None
+
+log = logging.getLogger(__name__)
+
+
+def filter_from_dict(vars):
+ return filter(lambda x: isinstance(x[1], Action), vars.items())
+
+
+class Namespace(object):
+
+ def __init__(self):
+ self._actions = {}
+
+ def add(self, action):
+ key = action.props.name
+ self._actions[key] = action
+
+ def connect(self, name, handler):
+ #log.debug("Connecting action <{}> to handler <{}>".format(name, handler.__name__))
+ self._actions[name].connect('activate', handler)
+
+ def register(self, name, parameter=None, handler=None, label=None, tooltip=None,
+ icon_name=None, keypresses=None, preference_name=None, default=None):
+ # Check types
+ if not isinstance(name, str):
+ raise TypeError("Cannot register fuction: 'name' must be a str")
+ if parameter and not isinstance(parameter, str):
+ raise TypeError("Cannot register fuction: 'parameter' must be a str")
+ if handler and not callable(handler):
+ raise TypeError("Cannot register fuction: 'handler' must be callable")
+
+ # Check if the name has a prefix.
+ prefix = None
+ if name.startswith("app.") or name.startswith("win."):
+ # Set a prefix for later and remove it
+ prefix = name[0:3]
+ name = name[4:]
+
+ if handler:
+ log.debug("Register action [{}, prefix={}, param={}, handler={}]".format(
+ name, prefix, parameter, handler.__name__))
+ else:
+ log.debug("Register action [{}, prefix={}, param={}, handler=None]".format(
+ name, prefix, parameter))
+
+ action = Action(name, parameter, label=label, tooltip=tooltip,
+ icon_name=icon_name, keypresses=keypresses, prefix=prefix,
+ preference_name=preference_name, default=default)
+ if handler:
+ action.connect('activate', handler)
+
+ key = name
+ if prefix:
+ key = "{}.{}".format(prefix, name)
+ if prefix == "app":
+ pass
+ #self.app.add_action(action)
+ elif prefix == "win":
+ pass
+ #self.win.add_action(action)
+
+ #log.debug("Registering action as '{}'".format(key))
+ self._actions[key] = action
+ return action
+
+
+ # If the actions namespace is called, trigger an action
+ def __call__(self, name):
+ # Try to parse the action string.
+ valid, action_name, target_value = Action.parse_detailed_name(name)
+ if not valid:
+ raise Exception("Invalid action string: '{}'".format(name))
+ if action_name not in self._actions:
+ raise Exception("Action '{}' is not registered!".format(action_name))
+
+ if target_value:
+ self._actions[action_name].activate(target_value)
+ else:
+ self._actions[action_name].activate()
+
+ def __getitem__(self, key):
+ return self._actions[key]
+
+ def __iter__(self):
+ return self._actions.itervalues()
+
+ def __repr__(self):
+ return str(self)
+
+ def get_actions(self):
+ return self._actions
def __str__(self):
- """
- The string representation should be the name of the action id.
- Try to find the action id for this action by searching this module.
- """
- for name, value in globals().iteritems():
- if value == self:
- return name
- return self.get_name()
-
- def __repr__(self): return str(self)
-
- def __call__(self, *args):
- """
- Emit the activate signal when called with ().
- """
- self.args = args
- self.emit('activate')
-
-
-class Action(gtk.Action, _ActionBase):
- """
- A custom Action class based on gtk.Action.
- Pass additional arguments such as keypresses.
- """
-
- def __init__(self, keypresses=(), name=None, label=None, tooltip=None,
- stock_id=None):
- """
- Create a new Action instance.
-
- Args:
- key_presses: a tuple of (keyval1, mod_mask1, keyval2, mod_mask2, ...)
- the: regular gtk.Action parameters (defaults to None)
- """
- if name is None:
- name = label
- gtk.Action.__init__(self, name=name, label=label, tooltip=tooltip,
- stock_id=stock_id)
- _ActionBase.__init__(self, label, keypresses)
-
-
-class ToggleAction(gtk.ToggleAction, _ActionBase):
- """
- A custom Action class based on gtk.ToggleAction.
- Pass additional arguments such as keypresses.
- """
-
- def __init__(self, keypresses=(), name=None, label=None, tooltip=None,
- stock_id=None, preference_name=None, default=True):
- """
- Create a new ToggleAction instance.
-
- Args:
- key_presses: a tuple of (keyval1, mod_mask1, keyval2, mod_mask2, ...)
- the: regular gtk.Action parameters (defaults to None)
- """
- if name is None:
- name = label
- gtk.ToggleAction.__init__(self, name=name, label=label,
- tooltip=tooltip, stock_id=stock_id)
- _ActionBase.__init__(self, label, keypresses)
+ s = "{Actions:"
+ for key in self._actions:
+ s += " {},".format(key)
+ s = s.rstrip(",") + "}"
+ return s
+
+
+class Action(Gio.SimpleAction):
+
+ # Change these to normal python properties.
+ #prefs_name
+
+ def __init__(self, name, parameter=None, label=None, tooltip=None,
+ icon_name=None, keypresses=None, prefix=None,
+ preference_name=None, default=None):
+ self.name = name
+ self.label = label
+ self.tooltip = tooltip
+ self.icon_name = icon_name
+ self.keypresses = keypresses
+ self.prefix = prefix
self.preference_name = preference_name
self.default = default
- def load_from_preferences(self):
+ # Don't worry about checking types here, since it's done in register()
+ # Save the parameter type to use for converting in __call__
+ self.type = None
+
+ variant = None
+ state = None
+ if parameter:
+ variant = GLib.VariantType.new(parameter)
+ if preference_name:
+ state = GLib.Variant.new_boolean(True)
+ Gio.SimpleAction.__init__(self, name=name, parameter_type=variant, state=state)
+
+ def enable(self):
+ self.props.enabled = True
+
+ def disable(self):
+ self.props.enabled = False
+
+ def set_enabled(self, state):
+ if not isinstance(state, bool):
+ raise TypeError("State must be True/False.")
+ self.props.enabled = state
+
+ def __str__(self):
+ return self.props.name
+
+ def __repr__(self):
+ return str(self)
+
+ def get_active(self):
+ if self.props.state:
+ return self.props.state.get_boolean()
+ return False
+
+ def set_active(self, state):
+ if not isinstance(state, bool):
+ raise TypeError("State must be True/False.")
+ self.change_state(GLib.Variant.new_boolean(state))
+
+ # Allows actions to be directly called.
+ def __call__(self, parameter=None):
+ if self.type and parameter:
+ # Try to convert it to the correct type.
+ try:
+ param = GLib.Variant(self.type, parameter)
+ self.activate(param)
+ except TypeError:
+ raise TypeError("Invalid parameter type for action '{}'. Expected: '{}'".format(self.get_name(), self.type))
+ else:
+ self.activate()
+
+ def load_from_preferences(self, *args):
+ log.debug("load_from_preferences({})".format(args))
if self.preference_name is not None:
- self.set_active(Preferences.entry(
- self.preference_name, default=bool(self.default)))
+ config = Gtk.Application.get_default().config
+ self.set_active(config.entry(self.preference_name, default=bool(self.default)))
- def save_to_preferences(self):
+ def save_to_preferences(self, *args):
+ log.debug("save_to_preferences({})".format(args))
if self.preference_name is not None:
- Preferences.entry(self.preference_name, value=self.get_active())
+ config = Gtk.Application.get_default().config
+ config.entry(self.preference_name, value=self.get_active())
+
+
+actions = Namespace()
+
+
+def get_actions():
+ return actions.get_actions()
+
+
+def connect(action, handler=None):
+ return actions.connect(action, handler=handler)
+
########################################################################
-# Actions
+# Old Actions
########################################################################
-PAGE_CHANGE = Action()
-EXTERNAL_UPDATE = Action()
-VARIABLE_EDITOR_UPDATE = Action()
-FLOW_GRAPH_NEW = Action(
+PAGE_CHANGE = actions.register("win.page_change")
+EXTERNAL_UPDATE = actions.register("app.external_update")
+VARIABLE_EDITOR_UPDATE = actions.register("app.variable_editor_update")
+FLOW_GRAPH_NEW = actions.register("app.flowgraph.new",
label='_New',
tooltip='Create a new flow graph',
- stock_id=gtk.STOCK_NEW,
- keypresses=(gtk.keysyms.n, gtk.gdk.CONTROL_MASK),
+ icon_name='document-new',
+ keypresses=["<Ctrl>n"],
+ parameter="s",
)
-FLOW_GRAPH_OPEN = Action(
+FLOW_GRAPH_OPEN = actions.register("app.flowgraph.open",
label='_Open',
tooltip='Open an existing flow graph',
- stock_id=gtk.STOCK_OPEN,
- keypresses=(gtk.keysyms.o, gtk.gdk.CONTROL_MASK),
+ icon_name='document-open',
+ keypresses=["<Ctrl>o"],
)
-FLOW_GRAPH_OPEN_RECENT = Action(
+FLOW_GRAPH_OPEN_RECENT = actions.register("app.flowgraph.open_recent",
label='Open _Recent',
tooltip='Open a recently used flow graph',
- stock_id=gtk.STOCK_OPEN,
+ icon_name='document-open-recent',
+ parameter="s",
)
-FLOW_GRAPH_SAVE = Action(
+FLOW_GRAPH_CLEAR_RECENT = actions.register("app.flowgraph.clear_recent")
+FLOW_GRAPH_SAVE = actions.register("app.flowgraph.save",
label='_Save',
tooltip='Save the current flow graph',
- stock_id=gtk.STOCK_SAVE,
- keypresses=(gtk.keysyms.s, gtk.gdk.CONTROL_MASK),
+ icon_name='document-save',
+ keypresses=["<Ctrl>s"],
)
-FLOW_GRAPH_SAVE_AS = Action(
+FLOW_GRAPH_SAVE_AS = actions.register("app.flowgraph.save_as",
label='Save _As',
tooltip='Save the current flow graph as...',
- stock_id=gtk.STOCK_SAVE_AS,
- keypresses=(gtk.keysyms.s, gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK),
+ icon_name='document-save-as',
+ keypresses=["<Ctrl><Shift>s"],
)
-FLOW_GRAPH_SAVE_A_COPY = Action(
- label='Save A Copy',
- tooltip='Save the copy of current flowgraph',
+FLOW_GRAPH_SAVE_COPY = actions.register("app.flowgraph.save_copy",
+ label='Save Copy',
+ tooltip='Save a copy of current flow graph',
)
-FLOW_GRAPH_DUPLICATE = Action(
+FLOW_GRAPH_DUPLICATE = actions.register("app.flowgraph.duplicate",
label='_Duplicate',
- tooltip='Create a duplicate of current flowgraph',
- stock_id=gtk.STOCK_COPY,
- keypresses=(gtk.keysyms.d, gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK),
+ tooltip='Create a duplicate of current flow graph',
+ #stock_id=Gtk.STOCK_COPY,
+ keypresses=["<Ctrl><Shift>d"],
)
-FLOW_GRAPH_CLOSE = Action(
+FLOW_GRAPH_CLOSE = actions.register("app.flowgraph.close",
label='_Close',
tooltip='Close the current flow graph',
- stock_id=gtk.STOCK_CLOSE,
- keypresses=(gtk.keysyms.w, gtk.gdk.CONTROL_MASK),
+ icon_name='window-close',
+ keypresses=["<Ctrl>w"],
)
-APPLICATION_INITIALIZE = Action()
-APPLICATION_QUIT = Action(
+APPLICATION_INITIALIZE = actions.register("app.initialize")
+APPLICATION_QUIT = actions.register("app.quit",
label='_Quit',
tooltip='Quit program',
- stock_id=gtk.STOCK_QUIT,
- keypresses=(gtk.keysyms.q, gtk.gdk.CONTROL_MASK),
+ icon_name='application-exit',
+ keypresses=["<Ctrl>q"],
)
-FLOW_GRAPH_UNDO = Action(
+FLOW_GRAPH_UNDO = actions.register("win.undo",
label='_Undo',
tooltip='Undo a change to the flow graph',
- stock_id=gtk.STOCK_UNDO,
- keypresses=(gtk.keysyms.z, gtk.gdk.CONTROL_MASK),
+ icon_name='edit-undo',
+ keypresses=["<Ctrl>z"],
)
-FLOW_GRAPH_REDO = Action(
+FLOW_GRAPH_REDO = actions.register("win.redo",
label='_Redo',
tooltip='Redo a change to the flow graph',
- stock_id=gtk.STOCK_REDO,
- keypresses=(gtk.keysyms.y, gtk.gdk.CONTROL_MASK),
+ icon_name='edit-redo',
+ keypresses=["<Ctrl>y"],
)
-NOTHING_SELECT = Action()
-SELECT_ALL = Action(
+NOTHING_SELECT = actions.register("win.unselect")
+SELECT_ALL = actions.register("win.select_all",
label='Select _All',
tooltip='Select all blocks and connections in the flow graph',
- stock_id=gtk.STOCK_SELECT_ALL,
- keypresses=(gtk.keysyms.a, gtk.gdk.CONTROL_MASK),
+ icon_name='edit-select-all',
+ keypresses=["<Ctrl>a"],
)
-ELEMENT_SELECT = Action()
-ELEMENT_CREATE = Action()
-ELEMENT_DELETE = Action(
+ELEMENT_SELECT = actions.register("win.select")
+ELEMENT_CREATE = actions.register("win.add")
+ELEMENT_DELETE = actions.register("win.delete",
label='_Delete',
tooltip='Delete the selected blocks',
- stock_id=gtk.STOCK_DELETE,
- keypresses=(gtk.keysyms.Delete, NO_MODS_MASK),
+ icon_name='edit-delete',
+ keypresses=["Delete"],
)
-BLOCK_MOVE = Action()
-BLOCK_ROTATE_CCW = Action(
+BLOCK_MOVE = actions.register("win.block_move")
+BLOCK_ROTATE_CCW = actions.register("win.block_rotate_ccw",
label='Rotate Counterclockwise',
tooltip='Rotate the selected blocks 90 degrees to the left',
- stock_id=gtk.STOCK_GO_BACK,
- keypresses=(gtk.keysyms.Left, NO_MODS_MASK),
+ icon_name='object-rotate-left',
)
-BLOCK_ROTATE_CW = Action(
+BLOCK_ROTATE_CW = actions.register("win.block_rotate",
label='Rotate Clockwise',
tooltip='Rotate the selected blocks 90 degrees to the right',
- stock_id=gtk.STOCK_GO_FORWARD,
- keypresses=(gtk.keysyms.Right, NO_MODS_MASK),
+ icon_name='object-rotate-right',
)
-BLOCK_VALIGN_TOP = Action(
+BLOCK_VALIGN_TOP = actions.register("win.block_align_top",
label='Vertical Align Top',
tooltip='Align tops of selected blocks',
- keypresses=(gtk.keysyms.t, gtk.gdk.SHIFT_MASK),
)
-BLOCK_VALIGN_MIDDLE = Action(
+BLOCK_VALIGN_MIDDLE = actions.register("win.block_align_middle",
label='Vertical Align Middle',
tooltip='Align centers of selected blocks vertically',
- keypresses=(gtk.keysyms.m, gtk.gdk.SHIFT_MASK),
)
-BLOCK_VALIGN_BOTTOM = Action(
+BLOCK_VALIGN_BOTTOM = actions.register("win.block_align_bottom",
label='Vertical Align Bottom',
tooltip='Align bottoms of selected blocks',
- keypresses=(gtk.keysyms.b, gtk.gdk.SHIFT_MASK),
)
-BLOCK_HALIGN_LEFT = Action(
+BLOCK_HALIGN_LEFT = actions.register("win.block_align_left",
label='Horizontal Align Left',
tooltip='Align left edges of blocks selected blocks',
- keypresses=(gtk.keysyms.l, gtk.gdk.SHIFT_MASK),
)
-BLOCK_HALIGN_CENTER = Action(
+BLOCK_HALIGN_CENTER = actions.register("win.block_align_center",
label='Horizontal Align Center',
tooltip='Align centers of selected blocks horizontally',
- keypresses=(gtk.keysyms.c, gtk.gdk.SHIFT_MASK),
)
-BLOCK_HALIGN_RIGHT = Action(
+BLOCK_HALIGN_RIGHT = actions.register("win.block_align_right",
label='Horizontal Align Right',
tooltip='Align right edges of selected blocks',
- keypresses=(gtk.keysyms.r, gtk.gdk.SHIFT_MASK),
)
BLOCK_ALIGNMENTS = [
BLOCK_VALIGN_TOP,
@@ -305,234 +348,222 @@ BLOCK_ALIGNMENTS = [
BLOCK_HALIGN_CENTER,
BLOCK_HALIGN_RIGHT,
]
-BLOCK_PARAM_MODIFY = Action(
+BLOCK_PARAM_MODIFY = actions.register("win.block_modify",
label='_Properties',
tooltip='Modify params for the selected block',
- stock_id=gtk.STOCK_PROPERTIES,
- keypresses=(gtk.keysyms.Return, NO_MODS_MASK),
+ icon_name='document-properties',
)
-BLOCK_ENABLE = Action(
+BLOCK_ENABLE = actions.register("win.block_enable",
label='E_nable',
tooltip='Enable the selected blocks',
- stock_id=gtk.STOCK_CONNECT,
- keypresses=(gtk.keysyms.e, NO_MODS_MASK),
+ icon_name='network-wired',
)
-BLOCK_DISABLE = Action(
+BLOCK_DISABLE = actions.register("win.block_disable",
label='D_isable',
tooltip='Disable the selected blocks',
- stock_id=gtk.STOCK_DISCONNECT,
- keypresses=(gtk.keysyms.d, NO_MODS_MASK),
+ icon_name='network-wired-disconnected',
)
-BLOCK_BYPASS = Action(
+BLOCK_BYPASS = actions.register("win.block_bypass",
label='_Bypass',
tooltip='Bypass the selected block',
- stock_id=gtk.STOCK_MEDIA_FORWARD,
- keypresses=(gtk.keysyms.b, NO_MODS_MASK),
+ icon_name='media-seek-forward',
)
-TOGGLE_SNAP_TO_GRID = ToggleAction(
+TOGGLE_SNAP_TO_GRID = actions.register("win.snap_to_grid",
label='_Snap to grid',
tooltip='Snap blocks to a grid for an easier connection alignment',
- preference_name='snap_to_grid'
+ preference_name='snap_to_grid',
)
-TOGGLE_HIDE_DISABLED_BLOCKS = ToggleAction(
+TOGGLE_HIDE_DISABLED_BLOCKS = actions.register("win.hide_disabled",
label='Hide _Disabled Blocks',
tooltip='Toggle visibility of disabled blocks and connections',
- stock_id=gtk.STOCK_MISSING_IMAGE,
- keypresses=(gtk.keysyms.d, gtk.gdk.CONTROL_MASK),
+ icon_name='image-missing',
+ keypresses=["<Ctrl>d"],
+ preference_name='hide_disabled',
)
-TOGGLE_HIDE_VARIABLES = ToggleAction(
+TOGGLE_HIDE_VARIABLES = actions.register("win.hide_variables",
label='Hide Variables',
tooltip='Hide all variable blocks',
preference_name='hide_variables',
default=False,
)
-TOGGLE_FLOW_GRAPH_VAR_EDITOR = ToggleAction(
+TOGGLE_FLOW_GRAPH_VAR_EDITOR = actions.register("win.toggle_variable_editor",
label='Show _Variable Editor',
tooltip='Show the variable editor. Modify variables and imports in this flow graph',
- stock_id=gtk.STOCK_EDIT,
+ icon_name='accessories-text-editor',
default=True,
- keypresses=(gtk.keysyms.e, gtk.gdk.CONTROL_MASK),
+ keypresses=["<Ctrl>e"],
preference_name='variable_editor_visable',
)
-TOGGLE_FLOW_GRAPH_VAR_EDITOR_SIDEBAR = ToggleAction(
+TOGGLE_FLOW_GRAPH_VAR_EDITOR_SIDEBAR = actions.register("win.toggle_variable_editor_sidebar",
label='Move the Variable Editor to the Sidebar',
tooltip='Move the variable editor to the sidebar',
default=False,
preference_name='variable_editor_sidebar',
)
-TOGGLE_AUTO_HIDE_PORT_LABELS = ToggleAction(
+TOGGLE_AUTO_HIDE_PORT_LABELS = actions.register("win.auto_hide_port_labels",
label='Auto-Hide _Port Labels',
tooltip='Automatically hide port labels',
preference_name='auto_hide_port_labels'
)
-TOGGLE_SHOW_BLOCK_COMMENTS = ToggleAction(
+TOGGLE_SHOW_BLOCK_COMMENTS = actions.register("win.show_block_comments",
label='Show Block Comments',
tooltip="Show comment beneath each block",
preference_name='show_block_comments'
)
-TOGGLE_SHOW_CODE_PREVIEW_TAB = ToggleAction(
+TOGGLE_SHOW_CODE_PREVIEW_TAB = actions.register("win.toggle_code_preview",
label='Generated Code Preview',
tooltip="Show a preview of the code generated for each Block in its "
"Properties Dialog",
preference_name='show_generated_code_tab',
default=False,
)
-TOGGLE_SHOW_FLOWGRAPH_COMPLEXITY = ToggleAction(
+TOGGLE_SHOW_FLOWGRAPH_COMPLEXITY = actions.register("win.show_flowgraph_complexity",
label='Show Flowgraph Complexity',
tooltip="How many Balints is the flowgraph...",
preference_name='show_flowgraph_complexity',
default=False,
)
-BLOCK_CREATE_HIER = Action(
+BLOCK_CREATE_HIER = actions.register("win.block_create_hier",
label='C_reate Hier',
tooltip='Create hier block from selected blocks',
- stock_id=gtk.STOCK_CONNECT,
-# keypresses=(gtk.keysyms.c, NO_MODS_MASK),
+ icon_name='document-new',
)
-BLOCK_CUT = Action(
+BLOCK_CUT = actions.register("win.block_cut",
label='Cu_t',
tooltip='Cut',
- stock_id=gtk.STOCK_CUT,
- keypresses=(gtk.keysyms.x, gtk.gdk.CONTROL_MASK),
+ icon_name='edit-cut',
+ keypresses=["<Ctrl>x"],
)
-BLOCK_COPY = Action(
+BLOCK_COPY = actions.register("win.block_copy",
label='_Copy',
tooltip='Copy',
- stock_id=gtk.STOCK_COPY,
- keypresses=(gtk.keysyms.c, gtk.gdk.CONTROL_MASK),
+ icon_name='edit-copy',
+ keypresses=["<Ctrl>c"],
)
-BLOCK_PASTE = Action(
+BLOCK_PASTE = actions.register("win.block_paste",
label='_Paste',
tooltip='Paste',
- stock_id=gtk.STOCK_PASTE,
- keypresses=(gtk.keysyms.v, gtk.gdk.CONTROL_MASK),
+ icon_name='edit-paste',
+ keypresses=["<Ctrl>v"],
)
-ERRORS_WINDOW_DISPLAY = Action(
+ERRORS_WINDOW_DISPLAY = actions.register("app.errors",
label='Flowgraph _Errors',
tooltip='View flow graph errors',
- stock_id=gtk.STOCK_DIALOG_ERROR,
+ icon_name='dialog-error',
)
-TOGGLE_CONSOLE_WINDOW = ToggleAction(
+TOGGLE_CONSOLE_WINDOW = actions.register("win.toggle_console_window",
label='Show _Console Panel',
tooltip='Toggle visibility of the console',
- keypresses=(gtk.keysyms.r, gtk.gdk.CONTROL_MASK),
+ keypresses=["<Ctrl>r"],
preference_name='console_window_visible'
)
-TOGGLE_BLOCKS_WINDOW = ToggleAction(
+# TODO: Might be able to convert this to a Gio.PropertyAction eventually.
+# actions would need to be defined in the correct class and not globally
+TOGGLE_BLOCKS_WINDOW = actions.register("win.toggle_blocks_window",
label='Show _Block Tree Panel',
tooltip='Toggle visibility of the block tree widget',
- keypresses=(gtk.keysyms.b, gtk.gdk.CONTROL_MASK),
+ keypresses=["<Ctrl>b"],
preference_name='blocks_window_visible'
)
-TOGGLE_SCROLL_LOCK = ToggleAction(
+TOGGLE_SCROLL_LOCK = actions.register("win.console.scroll_lock",
label='Console Scroll _Lock',
tooltip='Toggle scroll lock for the console window',
preference_name='scroll_lock'
)
-ABOUT_WINDOW_DISPLAY = Action(
+ABOUT_WINDOW_DISPLAY = actions.register("app.about",
label='_About',
tooltip='About this program',
- stock_id=gtk.STOCK_ABOUT,
+ icon_name='help-about',
)
-HELP_WINDOW_DISPLAY = Action(
+HELP_WINDOW_DISPLAY = actions.register("app.help",
label='_Help',
tooltip='Usage tips',
- stock_id=gtk.STOCK_HELP,
- keypresses=(gtk.keysyms.F1, NO_MODS_MASK),
+ icon_name='help-contents',
+ keypresses=["F1"],
)
-TYPES_WINDOW_DISPLAY = Action(
+TYPES_WINDOW_DISPLAY = actions.register("app.types",
label='_Types',
tooltip='Types color mapping',
- stock_id=gtk.STOCK_DIALOG_INFO,
+ icon_name='dialog-information',
)
-FLOW_GRAPH_GEN = Action(
+FLOW_GRAPH_GEN = actions.register("app.flowgraph.generate",
label='_Generate',
tooltip='Generate the flow graph',
- stock_id=gtk.STOCK_CONVERT,
- keypresses=(gtk.keysyms.F5, NO_MODS_MASK),
+ icon_name='insert-object',
+ keypresses=["F5"],
)
-FLOW_GRAPH_EXEC = Action(
+FLOW_GRAPH_EXEC = actions.register("app.flowgraph.execute",
label='_Execute',
tooltip='Execute the flow graph',
- stock_id=gtk.STOCK_MEDIA_PLAY,
- keypresses=(gtk.keysyms.F6, NO_MODS_MASK),
+ icon_name='media-playback-start',
+ keypresses=["F6"],
)
-FLOW_GRAPH_KILL = Action(
+FLOW_GRAPH_KILL = actions.register("app.flowgraph.kill",
label='_Kill',
tooltip='Kill the flow graph',
- stock_id=gtk.STOCK_STOP,
- keypresses=(gtk.keysyms.F7, NO_MODS_MASK),
+ icon_name='media-playback-stop',
+ keypresses=["F7"],
)
-FLOW_GRAPH_SCREEN_CAPTURE = Action(
+FLOW_GRAPH_SCREEN_CAPTURE = actions.register("app.flowgraph.screen_capture",
label='Screen Ca_pture',
tooltip='Create a screen capture of the flow graph',
- stock_id=gtk.STOCK_PRINT,
- keypresses=(gtk.keysyms.Print, NO_MODS_MASK),
-)
-PORT_CONTROLLER_DEC = Action(
- keypresses=(gtk.keysyms.minus, NO_MODS_MASK, gtk.keysyms.KP_Subtract, NO_MODS_MASK),
-)
-PORT_CONTROLLER_INC = Action(
- keypresses=(gtk.keysyms.plus, NO_MODS_MASK, gtk.keysyms.KP_Add, NO_MODS_MASK),
-)
-BLOCK_INC_TYPE = Action(
- keypresses=(gtk.keysyms.Down, NO_MODS_MASK),
-)
-BLOCK_DEC_TYPE = Action(
- keypresses=(gtk.keysyms.Up, NO_MODS_MASK),
-)
-RELOAD_BLOCKS = Action(
+ icon_name='printer',
+ keypresses=["<Ctrl>p"],
+)
+PORT_CONTROLLER_DEC = actions.register("win.port_controller_dec")
+PORT_CONTROLLER_INC = actions.register("win.port_controller_inc")
+BLOCK_INC_TYPE = actions.register("win.block_inc_type")
+BLOCK_DEC_TYPE = actions.register("win.block_dec_type")
+RELOAD_BLOCKS = actions.register("app.reload_blocks",
label='Reload _Blocks',
tooltip='Reload Blocks',
- stock_id=gtk.STOCK_REFRESH
+ icon_name='view-refresh'
)
-FIND_BLOCKS = Action(
+FIND_BLOCKS = actions.register("win.find_blocks",
label='_Find Blocks',
tooltip='Search for a block by name (and key)',
- stock_id=gtk.STOCK_FIND,
- keypresses=(gtk.keysyms.f, gtk.gdk.CONTROL_MASK,
- gtk.keysyms.slash, NO_MODS_MASK),
+ icon_name='edit-find',
+ keypresses=["<Ctrl>f", "slash"],
)
-CLEAR_CONSOLE = Action(
+CLEAR_CONSOLE = actions.register("win.console.clear",
label='_Clear Console',
tooltip='Clear Console',
- stock_id=gtk.STOCK_CLEAR,
+ icon_name='edit-clear',
)
-SAVE_CONSOLE = Action(
+SAVE_CONSOLE = actions.register("win.console.save",
label='_Save Console',
tooltip='Save Console',
- stock_id=gtk.STOCK_SAVE,
+ icon_name='edit-save',
)
-OPEN_HIER = Action(
+OPEN_HIER = actions.register("win.open_hier",
label='Open H_ier',
tooltip='Open the source of the selected hierarchical block',
- stock_id=gtk.STOCK_JUMP_TO,
+ icon_name='go-jump',
)
-BUSSIFY_SOURCES = Action(
+BUSSIFY_SOURCES = actions.register("win.bussify_sources",
label='Toggle So_urce Bus',
tooltip='Gang source ports into a single bus port',
- stock_id=gtk.STOCK_JUMP_TO,
+ icon_name='go-jump',
)
-BUSSIFY_SINKS = Action(
+BUSSIFY_SINKS = actions.register("win.bussify_sinks",
label='Toggle S_ink Bus',
tooltip='Gang sink ports into a single bus port',
- stock_id=gtk.STOCK_JUMP_TO,
+ icon_name='go-jump',
)
-XML_PARSER_ERRORS_DISPLAY = Action(
+XML_PARSER_ERRORS_DISPLAY = actions.register("app.xml_errors",
label='_Parser Errors',
tooltip='View errors that occurred while parsing XML files',
- stock_id=gtk.STOCK_DIALOG_ERROR,
+ icon_name='dialog-error',
)
-FLOW_GRAPH_OPEN_QSS_THEME = Action(
+FLOW_GRAPH_OPEN_QSS_THEME = actions.register("app.open_qss_theme",
label='Set Default QT GUI _Theme',
tooltip='Set a default QT Style Sheet file to use for QT GUI',
- stock_id=gtk.STOCK_OPEN,
+ icon_name='document-open',
)
-TOOLS_RUN_FDESIGN = Action(
+TOOLS_RUN_FDESIGN = actions.register("app.filter_design",
label='Filter Design Tool',
tooltip='Execute gr_filter_design',
- stock_id=gtk.STOCK_EXECUTE,
-)
-TOOLS_MORE_TO_COME = Action(
- label='More to come',
+ icon_name='media-playback-start',
)
+POST_HANDLER = actions.register("app.post_handler")
+READY = actions.register("app.ready")
diff --git a/grc/gui/ActionHandler.py b/grc/gui/Application.py
index 017dab334..70cf9b78b 100644
--- a/grc/gui/ActionHandler.py
+++ b/grc/gui/Application.py
@@ -18,33 +18,36 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-import gobject
-import gtk
+from __future__ import absolute_import, print_function
+
+import logging
import os
import subprocess
-from . import Dialogs, Preferences, Actions, Executor, Constants, Utils
-from .FileDialogs import (OpenFlowGraphFileDialog, SaveFlowGraphFileDialog,
- SaveConsoleFileDialog, SaveScreenShotDialog,
- OpenQSSFileDialog)
+from gi.repository import Gtk, Gio, GLib, GObject
+
+from . import Constants, Dialogs, Actions, Executor, FileDialogs, Utils, Bars
+
from .MainWindow import MainWindow
-from .ParserErrorsDialog import ParserErrorsDialog
+# from .ParserErrorsDialog import ParserErrorsDialog
from .PropsDialog import PropsDialog
-from ..core import ParseXML, Messages
+from ..core import Messages
-gobject.threads_init()
+log = logging.getLogger(__name__)
-class ActionHandler:
+
+class Application(Gtk.Application):
"""
The action handler will setup all the major window components,
and handle button presses and flow graph operations from the GUI.
"""
def __init__(self, file_paths, platform):
+ Gtk.Application.__init__(self)
"""
- ActionHandler constructor.
+ Application constructor.
Create the main window, setup the message handler, import the preferences,
and connect all of the action handlers. Finally, enter the gtk main loop and block.
@@ -54,41 +57,57 @@ class ActionHandler:
"""
self.clipboard = None
self.dialog = None
- for action in Actions.get_all_actions(): action.connect('activate', self._handle_action)
- #setup the main window
+
+ # Setup the main window
self.platform = platform
- self.main_window = MainWindow(platform, self._handle_action)
+ self.config = platform.config
+
+ log.debug("Application()")
+ # Connect all actions to _handle_action
+ for x in Actions.get_actions():
+ Actions.connect(x, handler=self._handle_action)
+ Actions.actions[x].enable()
+ if x.startswith("app."):
+ self.add_action(Actions.actions[x])
+ # Setup the shortcut keys
+ # These are the globally defined shortcuts
+ keypress = Actions.actions[x].keypresses
+ if keypress:
+ self.set_accels_for_action(x, keypress)
+
+ # Initialize
+ self.init_file_paths = [os.path.abspath(file_path) for file_path in file_paths]
+ self.init = False
+
+ def do_startup(self):
+ Gtk.Application.do_startup(self)
+ log.debug("Application.do_startup()")
+
+ # Setup the menu
+ log.debug("Creating menu")
+ '''
+ self.menu = Bars.Menu()
+ self.set_menu()
+ if self.prefers_app_menu():
+ self.set_app_menu(self.menu)
+ else:
+ self.set_menubar(self.menu)
+ '''
+
+ def do_activate(self):
+ Gtk.Application.do_activate(self)
+ log.debug("Application.do_activate()")
+
+ self.main_window = MainWindow(self, self.platform)
self.main_window.connect('delete-event', self._quit)
- self.main_window.connect('key-press-event', self._handle_key_press)
- self.get_page = self.main_window.get_page
self.get_focus_flag = self.main_window.get_focus_flag
+
#setup the messages
Messages.register_messenger(self.main_window.add_console_line)
- Messages.send_init(platform)
- #initialize
- self.init_file_paths = [os.path.abspath(file_path) for file_path in file_paths]
- self.init = False
- Actions.APPLICATION_INITIALIZE()
+ Messages.send_init(self.platform)
- def _handle_key_press(self, widget, event):
- """
- Handle key presses from the keyboard and translate key combinations into actions.
- This key press handler is called prior to the gtk key press handler.
- This handler bypasses built in accelerator key handling when in focus because
- * some keys are ignored by the accelerators like the direction keys,
- * some keys are not registered to any accelerators but are still used.
- When not in focus, gtk and the accelerators handle the the key press.
-
- Returns:
- false to let gtk handle the key action
- """
- # prevent key event stealing while the search box is active
- # .has_focus() only in newer versions 2.17+?
- # .is_focus() seems to work, but exactly the same
- if self.main_window.btwin.search_entry.flags() & gtk.HAS_FOCUS:
- return False
- if not self.get_focus_flag(): return False
- return Actions.handle_key_press(event)
+ log.debug("Calling Actions.APPLICATION_INITIALIZE")
+ Actions.APPLICATION_INITIALIZE()
def _quit(self, window, event):
"""
@@ -103,61 +122,111 @@ class ActionHandler:
return True
def _handle_action(self, action, *args):
- #print action
+ log.debug("_handle_action({0}, {1})".format(action, args))
main = self.main_window
- page = main.get_page()
- flow_graph = page.get_flow_graph() if page else None
+ page = main.current_page
+ flow_graph = page.flow_graph if page else None
def flow_graph_update(fg=flow_graph):
- main.vars.update_gui()
+ main.vars.update_gui(fg.blocks)
fg.update()
##################################################
# Initialize/Quit
##################################################
if action == Actions.APPLICATION_INITIALIZE:
- file_path_to_show = Preferences.file_open()
- for file_path in (self.init_file_paths or Preferences.get_open_files()):
+ log.debug("APPLICATION_INITIALIZE")
+ file_path_to_show = self.config.file_open()
+ for file_path in (self.init_file_paths or self.config.get_open_files()):
if os.path.exists(file_path):
main.new_page(file_path, show=file_path_to_show == file_path)
- if not self.get_page():
+ if not main.current_page:
main.new_page() # ensure that at least a blank page exists
main.btwin.search_entry.hide()
- # Disable all actions, then re-enable a few
- for action in Actions.get_all_actions():
- action.set_sensitive(False) # set all actions disabled
+ """
+ Only disable certain actions on startup. Each of these actions are
+ conditionally enabled in _handle_action, so disable them first.
+ - FLOW_GRAPH_UNDO/REDO are set in gui/StateCache.py
+ - XML_PARSER_ERRORS_DISPLAY is set in RELOAD_BLOCKS
+
+ TODO: These 4 should probably be included, but they are not currently
+ enabled anywhere else:
+ - PORT_CONTROLLER_DEC, PORT_CONTROLLER_INC
+ - BLOCK_INC_TYPE, BLOCK_DEC_TYPE
+
+ TODO: These should be handled better. They are set in
+ update_exec_stop(), but not anywhere else
+ - FLOW_GRAPH_GEN, FLOW_GRAPH_EXEC, FLOW_GRAPH_KILL
+ """
+ for action in (
+ Actions.ERRORS_WINDOW_DISPLAY,
+ Actions.ELEMENT_DELETE,
+ Actions.BLOCK_PARAM_MODIFY,
+ Actions.BLOCK_ROTATE_CCW,
+ Actions.BLOCK_ROTATE_CW,
+ Actions.BLOCK_VALIGN_TOP,
+ Actions.BLOCK_VALIGN_MIDDLE,
+ Actions.BLOCK_VALIGN_BOTTOM,
+ Actions.BLOCK_HALIGN_LEFT,
+ Actions.BLOCK_HALIGN_CENTER,
+ Actions.BLOCK_HALIGN_RIGHT,
+ Actions.BLOCK_CUT,
+ Actions.BLOCK_COPY,
+ Actions.BLOCK_PASTE,
+ Actions.BLOCK_ENABLE,
+ Actions.BLOCK_DISABLE,
+ Actions.BLOCK_BYPASS,
+ Actions.BLOCK_CREATE_HIER,
+ Actions.OPEN_HIER,
+ Actions.BUSSIFY_SOURCES,
+ Actions.BUSSIFY_SINKS,
+ Actions.FLOW_GRAPH_SAVE,
+ Actions.FLOW_GRAPH_UNDO,
+ Actions.FLOW_GRAPH_REDO,
+ Actions.XML_PARSER_ERRORS_DISPLAY
+ ):
+ action.disable()
+
+ # Load preferences
for action in (
- Actions.APPLICATION_QUIT, Actions.FLOW_GRAPH_NEW,
- Actions.FLOW_GRAPH_OPEN, Actions.FLOW_GRAPH_SAVE_AS,
- Actions.FLOW_GRAPH_DUPLICATE, Actions.FLOW_GRAPH_SAVE_A_COPY,
- Actions.FLOW_GRAPH_CLOSE, Actions.ABOUT_WINDOW_DISPLAY,
- Actions.FLOW_GRAPH_SCREEN_CAPTURE, Actions.HELP_WINDOW_DISPLAY,
- Actions.TYPES_WINDOW_DISPLAY, Actions.TOGGLE_BLOCKS_WINDOW,
- Actions.TOGGLE_CONSOLE_WINDOW, Actions.TOGGLE_HIDE_DISABLED_BLOCKS,
- Actions.TOOLS_RUN_FDESIGN, Actions.TOGGLE_SCROLL_LOCK,
- Actions.CLEAR_CONSOLE, Actions.SAVE_CONSOLE,
- Actions.TOGGLE_AUTO_HIDE_PORT_LABELS, Actions.TOGGLE_SNAP_TO_GRID,
+ Actions.TOGGLE_BLOCKS_WINDOW,
+ Actions.TOGGLE_CONSOLE_WINDOW,
+ Actions.TOGGLE_HIDE_DISABLED_BLOCKS,
+ Actions.TOGGLE_SCROLL_LOCK,
+ Actions.TOGGLE_AUTO_HIDE_PORT_LABELS,
+ Actions.TOGGLE_SNAP_TO_GRID,
Actions.TOGGLE_SHOW_BLOCK_COMMENTS,
Actions.TOGGLE_SHOW_CODE_PREVIEW_TAB,
Actions.TOGGLE_SHOW_FLOWGRAPH_COMPLEXITY,
- Actions.FLOW_GRAPH_OPEN_QSS_THEME,
Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR,
Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR_SIDEBAR,
Actions.TOGGLE_HIDE_VARIABLES,
- Actions.SELECT_ALL,
):
- action.set_sensitive(True)
+ action.set_enabled(True)
if hasattr(action, 'load_from_preferences'):
action.load_from_preferences()
- if ParseXML.xml_failures:
- Messages.send_xml_errors_if_any(ParseXML.xml_failures)
- Actions.XML_PARSER_ERRORS_DISPLAY.set_sensitive(True)
+
+ # Hide the panels *IF* it's saved in preferences
+ main.update_panel_visibility(main.BLOCKS, Actions.TOGGLE_BLOCKS_WINDOW.get_active())
+ main.update_panel_visibility(main.CONSOLE, Actions.TOGGLE_CONSOLE_WINDOW.get_active())
+ main.update_panel_visibility(main.VARIABLES, Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR.get_active())
+
+ #if ParseXML.xml_failures:
+ # Messages.send_xml_errors_if_any(ParseXML.xml_failures)
+ # Actions.XML_PARSER_ERRORS_DISPLAY.set_enabled(True)
+
+ # Force an update on the current page to match loaded preferences.
+ # In the future, change the __init__ order to load preferences first
+ page = main.current_page
+ if page:
+ page.flow_graph.update()
+
self.init = True
elif action == Actions.APPLICATION_QUIT:
if main.close_pages():
- gtk.main_quit()
+ Gtk.main_quit()
exit(0)
##################################################
# Selections
@@ -171,21 +240,16 @@ class ActionHandler:
##################################################
# Enable/Disable
##################################################
- elif action == Actions.BLOCK_ENABLE:
- if flow_graph.enable_selected(True):
+ elif action in (Actions.BLOCK_ENABLE, Actions.BLOCK_DISABLE, Actions.BLOCK_BYPASS):
+ changed = flow_graph.change_state_selected(new_state={
+ Actions.BLOCK_ENABLE: 'enabled',
+ Actions.BLOCK_DISABLE: 'disabled',
+ Actions.BLOCK_BYPASS: 'bypassed',
+ }[action])
+ if changed:
flow_graph_update()
- page.get_state_cache().save_new_state(flow_graph.export_data())
- page.set_saved(False)
- elif action == Actions.BLOCK_DISABLE:
- if flow_graph.enable_selected(False):
- flow_graph_update()
- page.get_state_cache().save_new_state(flow_graph.export_data())
- page.set_saved(False)
- elif action == Actions.BLOCK_BYPASS:
- if flow_graph.bypass_selected():
- flow_graph_update()
- page.get_state_cache().save_new_state(flow_graph.export_data())
- page.set_saved(False)
+ page.state_cache.save_new_state(flow_graph.export_data())
+ page.saved = False
##################################################
# Cut/Copy/Paste
##################################################
@@ -198,15 +262,15 @@ class ActionHandler:
if self.clipboard:
flow_graph.paste_from_clipboard(self.clipboard)
flow_graph_update()
- page.get_state_cache().save_new_state(flow_graph.export_data())
- page.set_saved(False)
+ page.state_cache.save_new_state(flow_graph.export_data())
+ page.saved = False
##################################################
# Create heir block
##################################################
elif action == Actions.BLOCK_CREATE_HIER:
# keeping track of coordinates for pasting later
- coords = flow_graph.get_selected_blocks()[0].get_coordinate()
+ coords = flow_graph.selected_blocks()[0].coordinate
x,y = coords
x_min = x
y_min = y
@@ -215,22 +279,22 @@ class ActionHandler:
params = [];
# Save the state of the leaf blocks
- for block in flow_graph.get_selected_blocks():
+ for block in flow_graph.selected_blocks():
# Check for string variables within the blocks
- for param in block.get_params():
+ for param in block.params.values():
for variable in flow_graph.get_variables():
# If a block parameter exists that is a variable, create a parameter for it
- if param.get_value() == variable.get_id():
+ if param.get_value() == variable.name:
params.append(param.get_value())
for flow_param in flow_graph.get_parameters():
# If a block parameter exists that is a parameter, create a parameter for it
- if param.get_value() == flow_param.get_id():
+ if param.get_value() == flow_param.name:
params.append(param.get_value())
# keep track of x,y mins for pasting later
- (x,y) = block.get_coordinate()
+ (x,y) = block.coordinate
if x < x_min:
x_min = x
if y < y_min:
@@ -239,15 +303,15 @@ class ActionHandler:
for connection in block.connections:
# Get id of connected blocks
- source_id = connection.get_source().get_parent().get_id()
- sink_id = connection.get_sink().get_parent().get_id()
+ source_id = connection.source_block.name
+ sink_id = connection.sink_block.name
# If connected block is not in the list of selected blocks create a pad for it
- if flow_graph.get_block(source_id) not in flow_graph.get_selected_blocks():
- pads.append({'key': connection.get_sink().get_key(), 'coord': connection.get_source().get_coordinate(), 'block_id' : block.get_id(), 'direction': 'source'})
+ if flow_graph.get_block(source_id) not in flow_graph.selected_blocks():
+ pads.append({'key': connection.sink_port.key, 'coord': connection.source_port.coordinate, 'block_id' : block.name, 'direction': 'source'})
- if flow_graph.get_block(sink_id) not in flow_graph.get_selected_blocks():
- pads.append({'key': connection.get_source().get_key(), 'coord': connection.get_sink().get_coordinate(), 'block_id' : block.get_id(), 'direction': 'sink'})
+ if flow_graph.get_block(sink_id) not in flow_graph.selected_blocks():
+ pads.append({'key': connection.source_port.key, 'coord': connection.sink_port.coordinate, 'block_id' : block.name, 'direction': 'sink'})
# Copy the selected blocks and paste them into a new page
@@ -261,10 +325,10 @@ class ActionHandler:
# Set flow graph to heir block type
top_block = flow_graph.get_block("top_block")
- top_block.get_param('generate_options').set_value('hb')
+ top_block.params['generate_options'].set_value('hb')
# this needs to be a unique name
- top_block.get_param('id').set_value('new_heir')
+ top_block.params['id'].set_value('new_heir')
# Remove the default samp_rate variable block that is created
remove_me = flow_graph.get_block("samp_rate")
@@ -276,7 +340,7 @@ class ActionHandler:
for param in params:
param_id = flow_graph.add_new_block('parameter',(x_pos,10))
param_block = flow_graph.get_block(param_id)
- param_block.get_param('id').set_value(param)
+ param_block.params['id'].set_value(param)
x_pos = x_pos + 100
for pad in pads:
@@ -288,16 +352,16 @@ class ActionHandler:
# setup the references to the sink and source
pad_block = flow_graph.get_block(pad_id)
- pad_sink = pad_block.get_sinks()[0]
+ pad_sink = pad_block.sinks[0]
source_block = flow_graph.get_block(pad['block_id'])
source = source_block.get_source(pad['key'])
# Ensure the port types match
- while pad_sink.get_type() != source.get_type():
+ while pad_sink.dtype != source.dtype:
# Special case for some blocks that have non-standard type names, e.g. uhd
- if pad_sink.get_type() == 'complex' and source.get_type() == 'fc32':
+ if pad_sink.dtype == 'complex' and source.dtype == 'fc32':
break;
pad_block.type_controller_modify(1)
@@ -309,15 +373,15 @@ class ActionHandler:
# setup the references to the sink and source
pad_block = flow_graph.get_block(pad_id)
- pad_source = pad_block.get_sources()[0]
+ pad_source = pad_block.sources[0]
sink_block = flow_graph.get_block(pad['block_id'])
sink = sink_block.get_sink(pad['key'])
# Ensure the port types match
- while sink.get_type() != pad_source.get_type():
+ while sink.dtype != pad_source.dtype:
# Special case for some blocks that have non-standard type names, e.g. uhd
- if pad_source.get_type() == 'complex' and sink.get_type() == 'fc32':
+ if pad_source.dtype == 'complex' and sink.dtype == 'fc32':
break;
pad_block.type_controller_modify(1)
@@ -332,311 +396,327 @@ class ActionHandler:
# Move/Rotate/Delete/Create
##################################################
elif action == Actions.BLOCK_MOVE:
- page.get_state_cache().save_new_state(flow_graph.export_data())
- page.set_saved(False)
+ page.state_cache.save_new_state(flow_graph.export_data())
+ page.saved = False
elif action in Actions.BLOCK_ALIGNMENTS:
if flow_graph.align_selected(action):
- page.get_state_cache().save_new_state(flow_graph.export_data())
- page.set_saved(False)
+ page.state_cache.save_new_state(flow_graph.export_data())
+ page.saved = False
elif action == Actions.BLOCK_ROTATE_CCW:
if flow_graph.rotate_selected(90):
flow_graph_update()
- page.get_state_cache().save_new_state(flow_graph.export_data())
- page.set_saved(False)
+ page.state_cache.save_new_state(flow_graph.export_data())
+ page.saved = False
elif action == Actions.BLOCK_ROTATE_CW:
if flow_graph.rotate_selected(-90):
flow_graph_update()
- page.get_state_cache().save_new_state(flow_graph.export_data())
- page.set_saved(False)
+ page.state_cache.save_new_state(flow_graph.export_data())
+ page.saved = False
elif action == Actions.ELEMENT_DELETE:
if flow_graph.remove_selected():
flow_graph_update()
- page.get_state_cache().save_new_state(flow_graph.export_data())
+ page.state_cache.save_new_state(flow_graph.export_data())
Actions.NOTHING_SELECT()
- page.set_saved(False)
+ page.saved = False
elif action == Actions.ELEMENT_CREATE:
flow_graph_update()
- page.get_state_cache().save_new_state(flow_graph.export_data())
+ page.state_cache.save_new_state(flow_graph.export_data())
Actions.NOTHING_SELECT()
- page.set_saved(False)
+ page.saved = False
elif action == Actions.BLOCK_INC_TYPE:
if flow_graph.type_controller_modify_selected(1):
flow_graph_update()
- page.get_state_cache().save_new_state(flow_graph.export_data())
- page.set_saved(False)
+ page.state_cache.save_new_state(flow_graph.export_data())
+ page.saved = False
elif action == Actions.BLOCK_DEC_TYPE:
if flow_graph.type_controller_modify_selected(-1):
flow_graph_update()
- page.get_state_cache().save_new_state(flow_graph.export_data())
- page.set_saved(False)
+ page.state_cache.save_new_state(flow_graph.export_data())
+ page.saved = False
elif action == Actions.PORT_CONTROLLER_INC:
if flow_graph.port_controller_modify_selected(1):
flow_graph_update()
- page.get_state_cache().save_new_state(flow_graph.export_data())
- page.set_saved(False)
+ page.state_cache.save_new_state(flow_graph.export_data())
+ page.saved = False
elif action == Actions.PORT_CONTROLLER_DEC:
if flow_graph.port_controller_modify_selected(-1):
flow_graph_update()
- page.get_state_cache().save_new_state(flow_graph.export_data())
- page.set_saved(False)
+ page.state_cache.save_new_state(flow_graph.export_data())
+ page.saved = False
##################################################
# Window stuff
##################################################
elif action == Actions.ABOUT_WINDOW_DISPLAY:
- platform = flow_graph.get_parent()
- Dialogs.AboutDialog(platform.config)
+ Dialogs.show_about(main, self.platform.config)
elif action == Actions.HELP_WINDOW_DISPLAY:
- Dialogs.HelpDialog()
+ Dialogs.show_help(main)
elif action == Actions.TYPES_WINDOW_DISPLAY:
- Dialogs.TypesDialog(flow_graph.get_parent())
+ Dialogs.show_types(main)
elif action == Actions.ERRORS_WINDOW_DISPLAY:
- Dialogs.ErrorsDialog(flow_graph)
+ Dialogs.ErrorsDialog(main, flow_graph).run_and_destroy()
elif action == Actions.TOGGLE_CONSOLE_WINDOW:
+ action.set_active(not action.get_active())
main.update_panel_visibility(main.CONSOLE, action.get_active())
action.save_to_preferences()
elif action == Actions.TOGGLE_BLOCKS_WINDOW:
+ # This would be better matched to a Gio.PropertyAction, but to do
+ # this, actions would have to be defined in the window not globally
+ action.set_active(not action.get_active())
main.update_panel_visibility(main.BLOCKS, action.get_active())
action.save_to_preferences()
elif action == Actions.TOGGLE_SCROLL_LOCK:
+ action.set_active(not action.get_active())
active = action.get_active()
- main.text_display.scroll_lock = active
+ main.console.text_display.scroll_lock = active
if active:
- main.text_display.scroll_to_end()
+ main.console.text_display.scroll_to_end()
action.save_to_preferences()
elif action == Actions.CLEAR_CONSOLE:
- main.text_display.clear()
+ main.console.text_display.clear()
elif action == Actions.SAVE_CONSOLE:
- file_path = SaveConsoleFileDialog(page.get_file_path()).run()
+ file_path = FileDialogs.SaveConsole(main, page.file_path).run()
if file_path is not None:
- main.text_display.save(file_path)
+ main.console.text_display.save(file_path)
elif action == Actions.TOGGLE_HIDE_DISABLED_BLOCKS:
+ action.set_active(not action.get_active())
Actions.NOTHING_SELECT()
elif action == Actions.TOGGLE_AUTO_HIDE_PORT_LABELS:
+ action.set_active(not action.get_active())
action.save_to_preferences()
for page in main.get_pages():
- page.get_flow_graph().create_shapes()
+ page.flow_graph.create_shapes()
elif action in (Actions.TOGGLE_SNAP_TO_GRID,
Actions.TOGGLE_SHOW_BLOCK_COMMENTS,
Actions.TOGGLE_SHOW_CODE_PREVIEW_TAB):
+ action.set_active(not action.get_active())
action.save_to_preferences()
elif action == Actions.TOGGLE_SHOW_FLOWGRAPH_COMPLEXITY:
+ action.set_active(not action.get_active())
action.save_to_preferences()
for page in main.get_pages():
- flow_graph_update(page.get_flow_graph())
+ flow_graph_update(page.flow_graph)
elif action == Actions.TOGGLE_HIDE_VARIABLES:
- # Call the variable editor TOGGLE in case it needs to be showing
- Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR()
+ action.set_active(not action.get_active())
+ active = action.get_active()
+ # Either way, triggering this should simply trigger the variable editor
+ # to be visible.
+ varedit = Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR
+ if active:
+ log.debug("Variables are hidden. Forcing the variable panel to be visible.")
+ varedit.disable()
+ else:
+ varedit.enable()
+ # Just force it to show.
+ varedit.set_active(True)
+ main.update_panel_visibility(main.VARIABLES)
Actions.NOTHING_SELECT()
action.save_to_preferences()
+ varedit.save_to_preferences()
+ flow_graph_update()
elif action == Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR:
- # See if the variables are hidden
- if Actions.TOGGLE_HIDE_VARIABLES.get_active():
- # Force this to be shown
- main.update_panel_visibility(main.VARIABLES, True)
- action.set_active(True)
- action.set_sensitive(False)
- else:
- if action.get_sensitive():
- main.update_panel_visibility(main.VARIABLES, action.get_active())
- else: # This is occurring after variables are un-hidden
- # Leave it enabled
- action.set_sensitive(True)
- action.set_active(True)
- #Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR_SIDEBAR.set_sensitive(action.get_active())
+ # TODO: There may be issues at startup since these aren't triggered
+ # the same was as Gtk.Actions when loading preferences.
+ action.set_active(not action.get_active())
+ # Just assume this was triggered because it was enabled.
+ main.update_panel_visibility(main.VARIABLES, action.get_active())
+ action.save_to_preferences()
+
+ # Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR_SIDEBAR.set_enabled(action.get_active())
action.save_to_preferences()
elif action == Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR_SIDEBAR:
+ action.set_active(not action.get_active())
if self.init:
- md = gtk.MessageDialog(main,
- gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_INFO,
- gtk.BUTTONS_CLOSE, "Moving the variable editor requires a restart of GRC.")
- md.run()
- md.destroy()
+ Dialogs.MessageDialogWrapper(
+ main, Gtk.MessageType.INFO, Gtk.ButtonsType.CLOSE,
+ markup="Moving the variable editor requires a restart of GRC."
+ ).run_and_destroy()
action.save_to_preferences()
##################################################
# Param Modifications
##################################################
elif action == Actions.BLOCK_PARAM_MODIFY:
- if action.args:
- selected_block = action.args[0]
- else:
- selected_block = flow_graph.get_selected_block()
+ selected_block = args[0] if args[0] else flow_graph.selected_block
if selected_block:
- self.dialog = PropsDialog(selected_block)
- response = gtk.RESPONSE_APPLY
- while response == gtk.RESPONSE_APPLY: # rerun the dialog if Apply was hit
+ self.dialog = PropsDialog(self.main_window, selected_block)
+ response = Gtk.ResponseType.APPLY
+ while response == Gtk.ResponseType.APPLY: # rerun the dialog if Apply was hit
response = self.dialog.run()
- if response in (gtk.RESPONSE_APPLY, gtk.RESPONSE_ACCEPT):
+ if response in (Gtk.ResponseType.APPLY, Gtk.ResponseType.ACCEPT):
flow_graph_update()
- page.get_state_cache().save_new_state(flow_graph.export_data())
- page.set_saved(False)
+ page.state_cache.save_new_state(flow_graph.export_data())
+ page.saved = False
else: # restore the current state
- n = page.get_state_cache().get_current_state()
+ n = page.state_cache.get_current_state()
flow_graph.import_data(n)
flow_graph_update()
- if response == gtk.RESPONSE_APPLY:
+ if response == Gtk.ResponseType.APPLY:
# null action, that updates the main window
Actions.ELEMENT_SELECT()
self.dialog.destroy()
self.dialog = None
elif action == Actions.EXTERNAL_UPDATE:
- page.get_state_cache().save_new_state(flow_graph.export_data())
+ page.state_cache.save_new_state(flow_graph.export_data())
flow_graph_update()
if self.dialog is not None:
self.dialog.update_gui(force=True)
- page.set_saved(False)
+ page.saved = False
elif action == Actions.VARIABLE_EDITOR_UPDATE:
- page.get_state_cache().save_new_state(flow_graph.export_data())
+ page.state_cache.save_new_state(flow_graph.export_data())
flow_graph_update()
- page.set_saved(False)
+ page.saved = False
##################################################
# View Parser Errors
##################################################
elif action == Actions.XML_PARSER_ERRORS_DISPLAY:
- ParserErrorsDialog(ParseXML.xml_failures).run()
+ # ParserErrorsDialog(ParseXML.xml_failures).run()
+ pass
##################################################
# Undo/Redo
##################################################
elif action == Actions.FLOW_GRAPH_UNDO:
- n = page.get_state_cache().get_prev_state()
+ n = page.state_cache.get_prev_state()
if n:
flow_graph.unselect()
flow_graph.import_data(n)
flow_graph_update()
- page.set_saved(False)
+ page.saved = False
elif action == Actions.FLOW_GRAPH_REDO:
- n = page.get_state_cache().get_next_state()
+ n = page.state_cache.get_next_state()
if n:
flow_graph.unselect()
flow_graph.import_data(n)
flow_graph_update()
- page.set_saved(False)
+ page.saved = False
##################################################
# New/Open/Save/Close
##################################################
elif action == Actions.FLOW_GRAPH_NEW:
main.new_page()
if args:
- flow_graph = main.get_flow_graph()
- flow_graph._options_block.get_param('generate_options').set_value(args[0])
+ flow_graph = main.current_page.flow_graph
+ flow_graph._options_block.params['generate_options'].set_value(str(args[0])[1:-1])
flow_graph_update(flow_graph)
elif action == Actions.FLOW_GRAPH_OPEN:
- file_paths = args if args else OpenFlowGraphFileDialog(page.get_file_path()).run()
- if file_paths: #open a new page for each file, show only the first
+ file_paths = args[0] if args[0] else FileDialogs.OpenFlowGraph(main, page.file_path).run()
+ if file_paths: # Open a new page for each file, show only the first
for i,file_path in enumerate(file_paths):
main.new_page(file_path, show=(i==0))
- Preferences.add_recent_file(file_path)
+ self.config.add_recent_file(file_path)
main.tool_bar.refresh_submenus()
- main.menu_bar.refresh_submenus()
- main.vars.update_gui()
-
+ #main.menu_bar.refresh_submenus()
elif action == Actions.FLOW_GRAPH_OPEN_QSS_THEME:
- file_paths = OpenQSSFileDialog(self.platform.config.install_prefix +
- '/share/gnuradio/themes/').run()
+ file_paths = FileDialogs.OpenQSS(main, self.platform.config.install_prefix +
+ '/share/gnuradio/themes/').run()
if file_paths:
- try:
- prefs = self.platform.config.prefs
- prefs.set_string("qtgui", "qss", file_paths[0])
- prefs.save()
- except Exception as e:
- Messages.send("Failed to save QSS preference: " + str(e))
+ self.platform.config.default_qss_theme = file_paths[0]
elif action == Actions.FLOW_GRAPH_CLOSE:
main.close_page()
elif action == Actions.FLOW_GRAPH_SAVE:
#read-only or undefined file path, do save-as
- if page.get_read_only() or not page.get_file_path():
+ if page.get_read_only() or not page.file_path:
Actions.FLOW_GRAPH_SAVE_AS()
#otherwise try to save
else:
try:
- ParseXML.to_file(flow_graph.export_data(), page.get_file_path())
- flow_graph.grc_file_path = page.get_file_path()
- page.set_saved(True)
+ self.platform.save_flow_graph(page.file_path, flow_graph)
+ flow_graph.grc_file_path = page.file_path
+ page.saved = True
except IOError:
- Messages.send_fail_save(page.get_file_path())
- page.set_saved(False)
+ Messages.send_fail_save(page.file_path)
+ page.saved = False
elif action == Actions.FLOW_GRAPH_SAVE_AS:
- file_path = SaveFlowGraphFileDialog(page.get_file_path()).run()
+ file_path = FileDialogs.SaveFlowGraph(main, page.file_path).run()
if file_path is not None:
- page.set_file_path(file_path)
+ page.file_path = os.path.abspath(file_path)
Actions.FLOW_GRAPH_SAVE()
- Preferences.add_recent_file(file_path)
+ self.config.add_recent_file(file_path)
main.tool_bar.refresh_submenus()
- main.menu_bar.refresh_submenus()
- elif action == Actions.FLOW_GRAPH_SAVE_A_COPY:
+ #TODO
+ #main.menu_bar.refresh_submenus()
+ elif action == Actions.FLOW_GRAPH_SAVE_COPY:
try:
- if not page.get_file_path():
+ if not page.file_path:
+ # Make sure the current flowgraph has been saved
Actions.FLOW_GRAPH_SAVE_AS()
else:
- dup_file_path = page.get_file_path()
+ dup_file_path = page.file_path
dup_file_name = '.'.join(dup_file_path.split('.')[:-1]) + "_copy" # Assuming .grc extension at the end of file_path
- dup_file_path_temp = dup_file_name+'.grc'
+ dup_file_path_temp = dup_file_name + Constants.FILE_EXTENSION
count = 1
while os.path.exists(dup_file_path_temp):
- dup_file_path_temp = dup_file_name+'('+str(count)+').grc'
+ dup_file_path_temp = '{}({}){}'.format(dup_file_name, count, Constants.FILE_EXTENSION)
count += 1
- dup_file_path_user = SaveFlowGraphFileDialog(dup_file_path_temp).run()
+ dup_file_path_user = FileDialogs.SaveFlowGraph(main, dup_file_path_temp).run()
if dup_file_path_user is not None:
- ParseXML.to_file(flow_graph.export_data(), dup_file_path_user)
+ self.platform.save_flow_graph(dup_file_path_user, flow_graph)
Messages.send('Saved Copy to: "' + dup_file_path_user + '"\n')
except IOError:
Messages.send_fail_save("Can not create a copy of the flowgraph\n")
elif action == Actions.FLOW_GRAPH_DUPLICATE:
- flow_graph = main.get_flow_graph()
+ previous = flow_graph
+ # Create a new page
main.new_page()
- curr_page = main.get_page()
- new_flow_graph = main.get_flow_graph()
- new_flow_graph.import_data(flow_graph.export_data())
+ page = main.current_page
+ new_flow_graph = page.flow_graph
+ # Import the old data and mark the current as not saved
+ new_flow_graph.import_data(previous.export_data())
flow_graph_update(new_flow_graph)
- curr_page.set_saved(False)
+ page.saved = False
elif action == Actions.FLOW_GRAPH_SCREEN_CAPTURE:
- file_path, background_transparent = SaveScreenShotDialog(page.get_file_path()).run()
+ file_path, background_transparent = SaveScreenShotDialog(main, page.get_file_path()).run()
if file_path is not None:
- pixbuf = flow_graph.get_drawing_area().get_screenshot(background_transparent)
- pixbuf.save(file_path, Constants.IMAGE_FILE_EXTENSION[1:])
+ try:
+ Utils.make_screenshot(flow_graph, file_path, background_transparent)
+ except ValueError:
+ Messages.send('Failed to generate screen shot\n')
##################################################
# Gen/Exec/Stop
##################################################
elif action == Actions.FLOW_GRAPH_GEN:
- if not page.get_proc():
- if not page.get_saved() or not page.get_file_path():
- Actions.FLOW_GRAPH_SAVE() #only save if file path missing or not saved
- if page.get_saved() and page.get_file_path():
+ if not page.process:
+ if not page.saved or not page.file_path:
+ Actions.FLOW_GRAPH_SAVE() # only save if file path missing or not saved
+ if page.saved and page.file_path:
generator = page.get_generator()
try:
- Messages.send_start_gen(generator.get_file_path())
+ Messages.send_start_gen(generator.file_path)
generator.write()
except Exception as e:
Messages.send_fail_gen(e)
else:
self.generator = None
elif action == Actions.FLOW_GRAPH_EXEC:
- if not page.get_proc():
+ if not page.process:
Actions.FLOW_GRAPH_GEN()
xterm = self.platform.config.xterm_executable
- if Preferences.xterm_missing() != xterm:
+ Dialogs.show_missing_xterm(main, xterm)
+ if self.config.xterm_missing() != xterm:
if not os.path.exists(xterm):
- Dialogs.MissingXTermDialog(xterm)
- Preferences.xterm_missing(xterm)
- if page.get_saved() and page.get_file_path():
+ Dialogs.show_missing_xterm(main, xterm)
+ self.config.xterm_missing(xterm)
+ if page.saved and page.file_path:
Executor.ExecFlowGraphThread(
flow_graph_page=page,
xterm_executable=xterm,
callback=self.update_exec_stop
)
elif action == Actions.FLOW_GRAPH_KILL:
- if page.get_proc():
+ if page.process:
try:
page.term_proc()
except:
- print "could not terminate process: %d" % page.get_proc().pid
+ print("could not terminate process: %d" % page.get_proc().pid)
+
elif action == Actions.PAGE_CHANGE: # pass and run the global actions
pass
elif action == Actions.RELOAD_BLOCKS:
- self.platform.build_block_library()
+ self.platform.build_library()
main.btwin.repopulate()
- Actions.XML_PARSER_ERRORS_DISPLAY.set_sensitive(bool(
- ParseXML.xml_failures))
- Messages.send_xml_errors_if_any(ParseXML.xml_failures)
+
+ #todo: implement parser error dialog for YAML
+ #Actions.XML_PARSER_ERRORS_DISPLAY.set_enabled(bool(ParseXML.xml_failures))
+ #Messages.send_xml_errors_if_any(ParseXML.xml_failures)
+
# Force a redraw of the graph, by getting the current state and re-importing it
main.update_pages()
@@ -645,21 +725,20 @@ class ActionHandler:
main.btwin.search_entry.show()
main.btwin.search_entry.grab_focus()
elif action == Actions.OPEN_HIER:
- for b in flow_graph.get_selected_blocks():
- if b._grc_source:
- main.new_page(b._grc_source, show=True)
+ for b in flow_graph.selected_blocks():
+ grc_source = b.extra_data.get('grc_source', '')
+ if grc_source:
+ main.new_page(b.grc_source, show=True)
elif action == Actions.BUSSIFY_SOURCES:
- n = {'name':'bus', 'type':'bus'}
- for b in flow_graph.get_selected_blocks():
- b.bussify(n, 'source')
+ for b in flow_graph.selected_blocks():
+ b.bussify('source')
flow_graph._old_selected_port = None
flow_graph._new_selected_port = None
Actions.ELEMENT_CREATE()
elif action == Actions.BUSSIFY_SINKS:
- n = {'name':'bus', 'type':'bus'}
- for b in flow_graph.get_selected_blocks():
- b.bussify(n, 'sink')
+ for b in flow_graph.selected_blocks():
+ b.bussify('sink')
flow_graph._old_selected_port = None
flow_graph._new_selected_port = None
Actions.ELEMENT_CREATE()
@@ -669,71 +748,67 @@ class ActionHandler:
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
else:
- print '!!! Action "%s" not handled !!!' % action
+ log.warning('!!! Action "%s" not handled !!!' % action)
##################################################
# Global Actions for all States
##################################################
- page = main.get_page() # page and flowgraph might have changed
- flow_graph = page.get_flow_graph() if page else None
+ page = main.current_page # page and flow graph might have changed
+ flow_graph = page.flow_graph if page else None
- selected_blocks = flow_graph.get_selected_blocks()
+ selected_blocks = list(flow_graph.selected_blocks())
selected_block = selected_blocks[0] if selected_blocks else None
#update general buttons
- Actions.ERRORS_WINDOW_DISPLAY.set_sensitive(not flow_graph.is_valid())
- Actions.ELEMENT_DELETE.set_sensitive(bool(flow_graph.get_selected_elements()))
- Actions.BLOCK_PARAM_MODIFY.set_sensitive(bool(selected_block))
- Actions.BLOCK_ROTATE_CCW.set_sensitive(bool(selected_blocks))
- Actions.BLOCK_ROTATE_CW.set_sensitive(bool(selected_blocks))
+ Actions.ERRORS_WINDOW_DISPLAY.set_enabled(not flow_graph.is_valid())
+ Actions.ELEMENT_DELETE.set_enabled(bool(flow_graph.selected_elements))
+ Actions.BLOCK_PARAM_MODIFY.set_enabled(bool(selected_block))
+ Actions.BLOCK_ROTATE_CCW.set_enabled(bool(selected_blocks))
+ Actions.BLOCK_ROTATE_CW.set_enabled(bool(selected_blocks))
#update alignment options
for act in Actions.BLOCK_ALIGNMENTS:
if act:
- act.set_sensitive(len(selected_blocks) > 1)
+ act.set_enabled(len(selected_blocks) > 1)
#update cut/copy/paste
- Actions.BLOCK_CUT.set_sensitive(bool(selected_blocks))
- Actions.BLOCK_COPY.set_sensitive(bool(selected_blocks))
- Actions.BLOCK_PASTE.set_sensitive(bool(self.clipboard))
+ Actions.BLOCK_CUT.set_enabled(bool(selected_blocks))
+ Actions.BLOCK_COPY.set_enabled(bool(selected_blocks))
+ Actions.BLOCK_PASTE.set_enabled(bool(self.clipboard))
#update enable/disable/bypass
- can_enable = any(block.get_state() != Constants.BLOCK_ENABLED
+ can_enable = any(block.state != 'enabled'
for block in selected_blocks)
- can_disable = any(block.get_state() != Constants.BLOCK_DISABLED
+ can_disable = any(block.state != 'disabled'
for block in selected_blocks)
- can_bypass_all = all(block.can_bypass() for block in selected_blocks) \
- and any (not block.get_bypassed() for block in selected_blocks)
- Actions.BLOCK_ENABLE.set_sensitive(can_enable)
- Actions.BLOCK_DISABLE.set_sensitive(can_disable)
- Actions.BLOCK_BYPASS.set_sensitive(can_bypass_all)
-
- Actions.BLOCK_CREATE_HIER.set_sensitive(bool(selected_blocks))
- Actions.OPEN_HIER.set_sensitive(bool(selected_blocks))
- Actions.BUSSIFY_SOURCES.set_sensitive(bool(selected_blocks))
- Actions.BUSSIFY_SINKS.set_sensitive(bool(selected_blocks))
- Actions.RELOAD_BLOCKS.set_sensitive(True)
- Actions.FIND_BLOCKS.set_sensitive(True)
- #set the exec and stop buttons
+ can_bypass_all = (
+ all(block.can_bypass() for block in selected_blocks) and
+ any(not block.get_bypassed() for block in selected_blocks)
+ )
+ Actions.BLOCK_ENABLE.set_enabled(can_enable)
+ Actions.BLOCK_DISABLE.set_enabled(can_disable)
+ Actions.BLOCK_BYPASS.set_enabled(can_bypass_all)
+
+ Actions.BLOCK_CREATE_HIER.set_enabled(bool(selected_blocks))
+ Actions.OPEN_HIER.set_enabled(bool(selected_blocks))
+ #Actions.BUSSIFY_SOURCES.set_enabled(bool(selected_blocks))
+ #Actions.BUSSIFY_SINKS.set_enabled(bool(selected_blocks))
+ Actions.RELOAD_BLOCKS.enable()
+ Actions.FIND_BLOCKS.enable()
+
self.update_exec_stop()
- #saved status
- Actions.FLOW_GRAPH_SAVE.set_sensitive(not page.get_saved())
+
+ Actions.FLOW_GRAPH_SAVE.set_enabled(not page.saved)
main.update()
- try: #set the size of the flow graph area (if changed)
- new_size = Utils.scale(
- flow_graph.get_option('window_size') or
- self.platform.config.default_canvas_size
- )
- if flow_graph.get_size() != tuple(new_size):
- flow_graph.set_size(*new_size)
- except: pass
- #draw the flow graph
+
flow_graph.update_selected()
- flow_graph.queue_draw()
- return True #action was handled
+ page.drawing_area.queue_draw()
+
+ return True # Action was handled
def update_exec_stop(self):
"""
Update the exec and stop buttons.
Lock and unlock the mutex for race conditions with exec flow graph threads.
"""
- sensitive = self.main_window.get_flow_graph().is_valid() and not self.get_page().get_proc()
- Actions.FLOW_GRAPH_GEN.set_sensitive(sensitive)
- Actions.FLOW_GRAPH_EXEC.set_sensitive(sensitive)
- Actions.FLOW_GRAPH_KILL.set_sensitive(self.get_page().get_proc() is not None)
+ page = self.main_window.current_page
+ sensitive = page.flow_graph.is_valid() and not page.process
+ Actions.FLOW_GRAPH_GEN.set_enabled(sensitive)
+ Actions.FLOW_GRAPH_EXEC.set_enabled(sensitive)
+ Actions.FLOW_GRAPH_KILL.set_enabled(page.process is not None)
diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py
index d9bc2aedb..2a8040f5d 100644
--- a/grc/gui/Bars.py
+++ b/grc/gui/Bars.py
@@ -1,5 +1,5 @@
"""
-Copyright 2007, 2008, 2009, 2015 Free Software Foundation, Inc.
+Copyright 2007, 2008, 2009, 2015, 2016 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
@@ -17,304 +17,301 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-import pygtk
-pygtk.require('2.0')
-import gtk
+from __future__ import absolute_import
+
+import logging
+
+from gi.repository import Gtk, GObject, Gio, GLib
from . import Actions
+log = logging.getLogger(__name__)
+
+
+'''
+# Menu/Toolbar Lists:
+#
+# Sub items can be 1 of 3 types
+# - List Creates a section within the current menu
+# - Tuple Creates a submenu using a string or action as the parent. The child
+# can be another menu list or an identifier used to call a helper function.
+# - Action Appends a new menu item to the current menu
+#
+
+LIST_NAME = [
+ [Action1, Action2], # New section
+ (Action3, [Action4, Action5]), # Submenu with action as parent
+ ("Label", [Action6, Action7]), # Submenu with string as parent
+ ("Label2", "helper") # Submenu with helper function. Calls 'create_helper()'
+]
+'''
+
+
# The list of actions for the toolbar.
-TOOLBAR_LIST = (
- (Actions.FLOW_GRAPH_NEW, 'flow_graph_new'),
- (Actions.FLOW_GRAPH_OPEN, 'flow_graph_recent'),
- Actions.FLOW_GRAPH_SAVE,
- Actions.FLOW_GRAPH_CLOSE,
- None,
- Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR,
- Actions.FLOW_GRAPH_SCREEN_CAPTURE,
- None,
- Actions.BLOCK_CUT,
- Actions.BLOCK_COPY,
- Actions.BLOCK_PASTE,
- Actions.ELEMENT_DELETE,
- None,
- Actions.FLOW_GRAPH_UNDO,
- Actions.FLOW_GRAPH_REDO,
- None,
- Actions.ERRORS_WINDOW_DISPLAY,
- Actions.FLOW_GRAPH_GEN,
- Actions.FLOW_GRAPH_EXEC,
- Actions.FLOW_GRAPH_KILL,
- None,
- Actions.BLOCK_ROTATE_CCW,
- Actions.BLOCK_ROTATE_CW,
- None,
- Actions.BLOCK_ENABLE,
- Actions.BLOCK_DISABLE,
- Actions.BLOCK_BYPASS,
- Actions.TOGGLE_HIDE_DISABLED_BLOCKS,
- None,
- Actions.FIND_BLOCKS,
- Actions.RELOAD_BLOCKS,
- Actions.OPEN_HIER,
-)
+TOOLBAR_LIST = [
+ [(Actions.FLOW_GRAPH_NEW, 'flow_graph_new'), Actions.FLOW_GRAPH_OPEN,
+ (Actions.FLOW_GRAPH_OPEN_RECENT, 'flow_graph_recent'), Actions.FLOW_GRAPH_SAVE, Actions.FLOW_GRAPH_CLOSE],
+ [Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR, Actions.FLOW_GRAPH_SCREEN_CAPTURE],
+ [Actions.BLOCK_CUT, Actions.BLOCK_COPY, Actions.BLOCK_PASTE, Actions.ELEMENT_DELETE],
+ [Actions.FLOW_GRAPH_UNDO, Actions.FLOW_GRAPH_REDO],
+ [Actions.ERRORS_WINDOW_DISPLAY, Actions.FLOW_GRAPH_GEN, Actions.FLOW_GRAPH_EXEC, Actions.FLOW_GRAPH_KILL],
+ [Actions.BLOCK_ROTATE_CCW, Actions.BLOCK_ROTATE_CW],
+ [Actions.BLOCK_ENABLE, Actions.BLOCK_DISABLE, Actions.BLOCK_BYPASS, Actions.TOGGLE_HIDE_DISABLED_BLOCKS],
+ [Actions.FIND_BLOCKS, Actions.RELOAD_BLOCKS, Actions.OPEN_HIER]
+]
+
# The list of actions and categories for the menu bar.
-MENU_BAR_LIST = (
- (gtk.Action('File', '_File', None, None), [
- 'flow_graph_new',
- Actions.FLOW_GRAPH_DUPLICATE,
- Actions.FLOW_GRAPH_OPEN,
- 'flow_graph_recent',
- None,
- Actions.FLOW_GRAPH_SAVE,
- Actions.FLOW_GRAPH_SAVE_AS,
- Actions.FLOW_GRAPH_SAVE_A_COPY,
- None,
- Actions.FLOW_GRAPH_SCREEN_CAPTURE,
- None,
- Actions.FLOW_GRAPH_CLOSE,
- Actions.APPLICATION_QUIT,
- ]),
- (gtk.Action('Edit', '_Edit', None, None), [
- Actions.FLOW_GRAPH_UNDO,
- Actions.FLOW_GRAPH_REDO,
- None,
- Actions.BLOCK_CUT,
- Actions.BLOCK_COPY,
- Actions.BLOCK_PASTE,
- Actions.ELEMENT_DELETE,
- Actions.SELECT_ALL,
- None,
- Actions.BLOCK_ROTATE_CCW,
- Actions.BLOCK_ROTATE_CW,
- (gtk.Action('Align', '_Align', None, None), Actions.BLOCK_ALIGNMENTS),
- None,
- Actions.BLOCK_ENABLE,
- Actions.BLOCK_DISABLE,
- Actions.BLOCK_BYPASS,
- None,
- Actions.BLOCK_PARAM_MODIFY,
- ]),
- (gtk.Action('View', '_View', None, None), [
- Actions.TOGGLE_BLOCKS_WINDOW,
- None,
- Actions.TOGGLE_CONSOLE_WINDOW,
- Actions.TOGGLE_SCROLL_LOCK,
- Actions.SAVE_CONSOLE,
- Actions.CLEAR_CONSOLE,
- None,
- Actions.TOGGLE_HIDE_VARIABLES,
- Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR,
- Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR_SIDEBAR,
- None,
- Actions.TOGGLE_HIDE_DISABLED_BLOCKS,
- Actions.TOGGLE_AUTO_HIDE_PORT_LABELS,
- Actions.TOGGLE_SNAP_TO_GRID,
- Actions.TOGGLE_SHOW_BLOCK_COMMENTS,
- None,
- Actions.TOGGLE_SHOW_CODE_PREVIEW_TAB,
- None,
- Actions.ERRORS_WINDOW_DISPLAY,
- Actions.FIND_BLOCKS,
- ]),
- (gtk.Action('Run', '_Run', None, None), [
- Actions.FLOW_GRAPH_GEN,
- Actions.FLOW_GRAPH_EXEC,
- Actions.FLOW_GRAPH_KILL,
- ]),
- (gtk.Action('Tools', '_Tools', None, None), [
- Actions.TOOLS_RUN_FDESIGN,
- Actions.FLOW_GRAPH_OPEN_QSS_THEME,
- None,
- Actions.TOGGLE_SHOW_FLOWGRAPH_COMPLEXITY,
- None,
- Actions.TOOLS_MORE_TO_COME,
- ]),
- (gtk.Action('Help', '_Help', None, None), [
- Actions.HELP_WINDOW_DISPLAY,
- Actions.TYPES_WINDOW_DISPLAY,
- Actions.XML_PARSER_ERRORS_DISPLAY,
- None,
- Actions.ABOUT_WINDOW_DISPLAY,
- ]),
-)
+MENU_BAR_LIST = [
+ ('_File', [
+ [(Actions.FLOW_GRAPH_NEW, 'flow_graph_new'), Actions.FLOW_GRAPH_DUPLICATE,
+ Actions.FLOW_GRAPH_OPEN, (Actions.FLOW_GRAPH_OPEN_RECENT, 'flow_graph_recent')],
+ [Actions.FLOW_GRAPH_SAVE, Actions.FLOW_GRAPH_SAVE_AS, Actions.FLOW_GRAPH_SAVE_COPY],
+ [Actions.FLOW_GRAPH_SCREEN_CAPTURE],
+ [Actions.FLOW_GRAPH_CLOSE, Actions.APPLICATION_QUIT]
+ ]),
+ ('_Edit', [
+ [Actions.FLOW_GRAPH_UNDO, Actions.FLOW_GRAPH_REDO],
+ [Actions.BLOCK_CUT, Actions.BLOCK_COPY, Actions.BLOCK_PASTE, Actions.ELEMENT_DELETE, Actions.SELECT_ALL],
+ [Actions.BLOCK_ROTATE_CCW, Actions.BLOCK_ROTATE_CW, ('_Align', Actions.BLOCK_ALIGNMENTS)],
+ [Actions.BLOCK_ENABLE, Actions.BLOCK_DISABLE, Actions.BLOCK_BYPASS],
+ [Actions.BLOCK_PARAM_MODIFY]
+ ]),
+ ('_View', [
+ [Actions.TOGGLE_BLOCKS_WINDOW],
+ [Actions.TOGGLE_CONSOLE_WINDOW, Actions.TOGGLE_SCROLL_LOCK, Actions.SAVE_CONSOLE, Actions.CLEAR_CONSOLE],
+ [Actions.TOGGLE_HIDE_VARIABLES, Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR, Actions.TOGGLE_FLOW_GRAPH_VAR_EDITOR_SIDEBAR],
+ [Actions.TOGGLE_HIDE_DISABLED_BLOCKS, Actions.TOGGLE_AUTO_HIDE_PORT_LABELS, Actions.TOGGLE_SNAP_TO_GRID, Actions.TOGGLE_SHOW_BLOCK_COMMENTS],
+ [Actions.TOGGLE_SHOW_CODE_PREVIEW_TAB],
+ [Actions.ERRORS_WINDOW_DISPLAY, Actions.FIND_BLOCKS],
+ ]),
+ ('_Run', [
+ Actions.FLOW_GRAPH_GEN, Actions.FLOW_GRAPH_EXEC, Actions.FLOW_GRAPH_KILL
+ ]),
+ ('_Tools', [
+ [Actions.TOOLS_RUN_FDESIGN, Actions.FLOW_GRAPH_OPEN_QSS_THEME],
+ [Actions.TOGGLE_SHOW_FLOWGRAPH_COMPLEXITY]
+ ]),
+ ('_Help', [
+ [Actions.HELP_WINDOW_DISPLAY, Actions.TYPES_WINDOW_DISPLAY, Actions.XML_PARSER_ERRORS_DISPLAY],
+ [Actions.ABOUT_WINDOW_DISPLAY]
+ ])]
+
# The list of actions for the context menu.
CONTEXT_MENU_LIST = [
- Actions.BLOCK_CUT,
- Actions.BLOCK_COPY,
- Actions.BLOCK_PASTE,
- Actions.ELEMENT_DELETE,
- None,
- Actions.BLOCK_ROTATE_CCW,
- Actions.BLOCK_ROTATE_CW,
- Actions.BLOCK_ENABLE,
- Actions.BLOCK_DISABLE,
- Actions.BLOCK_BYPASS,
- None,
- (gtk.Action('More', '_More', None, None), [
- Actions.BLOCK_CREATE_HIER,
- Actions.OPEN_HIER,
- None,
- Actions.BUSSIFY_SOURCES,
- Actions.BUSSIFY_SINKS,
- ]),
- Actions.BLOCK_PARAM_MODIFY
+ [Actions.BLOCK_CUT, Actions.BLOCK_COPY, Actions.BLOCK_PASTE, Actions.ELEMENT_DELETE],
+ [Actions.BLOCK_ROTATE_CCW, Actions.BLOCK_ROTATE_CW, Actions.BLOCK_ENABLE, Actions.BLOCK_DISABLE, Actions.BLOCK_BYPASS],
+ [("_More", [
+ [Actions.BLOCK_CREATE_HIER, Actions.OPEN_HIER],
+ [Actions.BUSSIFY_SOURCES, Actions.BUSSIFY_SINKS]]
+ )],
+ [Actions.BLOCK_PARAM_MODIFY],
]
-class SubMenuCreator(object):
+class SubMenuHelper(object):
+ ''' Generates custom submenus for the main menu or toolbar. '''
- def __init__(self, generate_modes, action_handler_callback):
- self.generate_modes = generate_modes
- self.action_handler_callback = action_handler_callback
- self.submenus = []
+ def __init__(self):
+ self.submenus = {}
- def create_submenu(self, action_tuple, item):
- func = getattr(self, '_fill_' + action_tuple[1] + "_submenu")
- self.submenus.append((action_tuple[0], func, item))
- self.refresh_submenus()
+ def build_submenu(self, name, obj, set_func):
+ # Get the correct helper function
+ create_func = getattr(self, "create_{}".format(name))
+ # Save the helper functions for rebuilding the menu later
+ self.submenus[name] = (create_func, obj, set_func)
+ # Actually build the menu
+ set_func(obj, create_func())
def refresh_submenus(self):
- for action, func, item in self.submenus:
- try:
- item.set_property("menu", func(action))
- except TypeError:
- item.set_property("submenu", func(action))
- item.set_property('sensitive', True)
-
- def callback_adaptor(self, item, action_key):
- action, key = action_key
- self.action_handler_callback(action, key)
-
- def _fill_flow_graph_new_submenu(self, action):
- """Sub menu to create flow-graph with pre-set generate mode"""
- menu = gtk.Menu()
- for key, name, default in self.generate_modes:
- if default:
- item = Actions.FLOW_GRAPH_NEW.create_menu_item()
- item.set_label(name)
- else:
- item = gtk.MenuItem(name, use_underline=False)
- item.connect('activate', self.callback_adaptor, (action, key))
- menu.append(item)
- menu.show_all()
+ for name in self.submenus:
+ create_func, obj, set_func = self.submenus[name]
+ print ("refresh", create_func, obj, set_func)
+ set_func(obj, create_func())
+
+ def create_flow_graph_new(self):
+ """ Different flowgraph types """
+ menu = Gio.Menu()
+ platform = Gtk.Application.get_default().platform
+ generate_modes = platform.get_generate_options()
+ for key, name, default in generate_modes:
+ target = "app.flowgraph.new::{}".format(key)
+ menu.append(name, target)
return menu
- def _fill_flow_graph_recent_submenu(self, action):
- """menu showing recent flow-graphs"""
- import Preferences
- menu = gtk.Menu()
- recent_files = Preferences.get_recent_files()
+ def create_flow_graph_recent(self):
+ """ Recent flow graphs """
+
+ config = Gtk.Application.get_default().config
+ recent_files = config.get_recent_files()
+ menu = Gio.Menu()
if len(recent_files) > 0:
+ files = Gio.Menu()
for i, file_name in enumerate(recent_files):
- item = gtk.MenuItem("%d. %s" % (i+1, file_name), use_underline=False)
- item.connect('activate', self.callback_adaptor,
- (action, file_name))
- menu.append(item)
- menu.show_all()
- return menu
- return None
+ target = "app.flowgraph.open_recent::{}".format(file_name)
+ files.append(file_name, target)
+ menu.append_section(None, files)
+ #clear = Gio.Menu()
+ #clear.append("Clear recent files", "app.flowgraph.clear_recent")
+ #menu.append_section(None, clear)
+ else:
+ # Show an empty menu
+ menuitem = Gio.MenuItem.new("No items found", "app.none")
+ menu.append_item(menuitem)
+ return menu
-class Toolbar(gtk.Toolbar, SubMenuCreator):
- """The gtk toolbar with actions added from the toolbar list."""
+class MenuHelper(SubMenuHelper):
+ """
+ Recursively builds a menu from a given list of actions.
- def __init__(self, generate_modes, action_handler_callback):
- """
- Parse the list of action names in the toolbar list.
- Look up the action for each name in the action list and add it to the
- toolbar.
- """
- gtk.Toolbar.__init__(self)
- self.set_style(gtk.TOOLBAR_ICONS)
- SubMenuCreator.__init__(self, generate_modes, action_handler_callback)
-
- for action in TOOLBAR_LIST:
- if isinstance(action, tuple) and isinstance(action[1], str):
- # create a button with a sub-menu
- action[0].set_tool_item_type(gtk.MenuToolButton)
- item = action[0].create_tool_item()
- self.create_submenu(action, item)
- self.refresh_submenus()
-
- elif action is None:
- item = gtk.SeparatorToolItem()
-
- else:
- action.set_tool_item_type(gtk.ToolButton)
- item = action.create_tool_item()
- # this reset of the tooltip property is required
- # (after creating the tool item) for the tooltip to show
- action.set_property('tooltip', action.get_property('tooltip'))
- self.add(item)
-
-
-class MenuHelperMixin(object):
- """Mixin class to help build menus from the above action lists"""
-
- def _fill_menu(self, actions, menu=None):
- """Create a menu from list of actions"""
- menu = menu or gtk.Menu()
+ Args:
+ - actions: List of actions to build the menu
+ - menu: Current menu being built
+
+ Notes:
+ - Tuple: Create a new submenu from the parent (1st) and child (2nd) elements
+ - Action: Append to current menu
+ - List: Start a new section
+ """
+
+ def __init__(self):
+ SubMenuHelper.__init__(self)
+
+ def build_menu(self, actions, menu):
for item in actions:
if isinstance(item, tuple):
- menu_item = self._make_sub_menu(*item)
- elif isinstance(item, str):
- menu_item = getattr(self, 'create_' + item)()
- elif item is None:
- menu_item = gtk.SeparatorMenuItem()
- else:
- menu_item = item.create_menu_item()
- menu.append(menu_item)
- menu.show_all()
- return menu
+ # Create a new submenu
+ parent, child = (item[0], item[1])
+
+ # Create the parent
+ label, target = (parent, None)
+ if isinstance(parent, Actions.Action):
+ label = parent.label
+ target = "{}.{}".format(parent.prefix, parent.name)
+ menuitem = Gio.MenuItem.new(label, None)
+ if hasattr(parent, "icon_name"):
+ menuitem.set_icon(Gio.Icon.new_for_string(parent.icon_name))
+
+ # Create the new submenu
+ if isinstance(child, list):
+ submenu = Gio.Menu()
+ self.build_menu(child, submenu)
+ menuitem.set_submenu(submenu)
+ elif isinstance(child, str):
+ # Child is the name of the submenu to create
+ def set_func(obj, menu):
+ obj.set_submenu(menu)
+ self.build_submenu(child, menuitem, set_func)
+ menu.append_item(menuitem)
+
+ elif isinstance(item, list):
+ # Create a new section
+ section = Gio.Menu()
+ self.build_menu(item, section)
+ menu.append_section(None, section)
+
+ elif isinstance(item, Actions.Action):
+ # Append a new menuitem
+ target = "{}.{}".format(item.prefix, item.name)
+ menuitem = Gio.MenuItem.new(item.label, target)
+ if item.icon_name:
+ menuitem.set_icon(Gio.Icon.new_for_string(item.icon_name))
+ menu.append_item(menuitem)
+
+
+class ToolbarHelper(SubMenuHelper):
+ """
+ Builds a toolbar from a given list of actions.
+
+ Args:
+ - actions: List of actions to build the menu
+ - item: Current menu being built
+
+ Notes:
+ - Tuple: Create a new submenu from the parent (1st) and child (2nd) elements
+ - Action: Append to current menu
+ - List: Start a new section
+ """
- def _make_sub_menu(self, main, actions):
- """Create a submenu from a main action and a list of actions"""
- main = main.create_menu_item()
- main.set_submenu(self._fill_menu(actions))
- return main
+ def __init__(self):
+ SubMenuHelper.__init__(self)
+ def build_toolbar(self, actions, current):
+ for item in actions:
+ if isinstance(item, list):
+ # Toolbar's don't have sections like menus, so call this function
+ # recursively with the "section" and just append a separator.
+ self.build_toolbar(item, self)
+ current.insert(Gtk.SeparatorToolItem.new(), -1)
+
+ elif isinstance(item, tuple):
+ parent, child = (item[0], item[1])
+ # Create an item with a submenu
+ # Generate the submenu and add to the item.
+ # Add the item to the toolbar
+ button = Gtk.MenuToolButton.new()
+ # The tuple should be made up of an Action and something.
+ button.set_label(parent.label)
+ button.set_tooltip_text(parent.tooltip)
+ button.set_icon_name(parent.icon_name)
+
+ target = "{}.{}".format(parent.prefix, parent.name)
+ button.set_action_name(target)
+
+ def set_func(obj, menu):
+ obj.set_menu(Gtk.Menu.new_from_model(menu))
+
+ self.build_submenu(child, button, set_func)
+ current.insert(button, -1)
+
+ elif isinstance(item, Actions.Action):
+ button = Gtk.ToolButton.new()
+ button.set_label(item.label)
+ button.set_tooltip_text(item.tooltip)
+ button.set_icon_name(item.icon_name)
+ target = "{}.{}".format(item.prefix, item.name)
+ button.set_action_name(target)
+ current.insert(button, -1)
+
+
+class Menu(Gio.Menu, MenuHelper):
+ """ Main Menu """
-class MenuBar(gtk.MenuBar, MenuHelperMixin, SubMenuCreator):
- """The gtk menu bar with actions added from the menu bar list."""
+ def __init__(self):
+ GObject.GObject.__init__(self)
+ MenuHelper.__init__(self)
- def __init__(self, generate_modes, action_handler_callback):
- """
- Parse the list of submenus from the menubar list.
- For each submenu, get a list of action names.
- Look up the action for each name in the action list and add it to the
- submenu. Add the submenu to the menu bar.
- """
- gtk.MenuBar.__init__(self)
- SubMenuCreator.__init__(self, generate_modes, action_handler_callback)
- for main_action, actions in MENU_BAR_LIST:
- self.append(self._make_sub_menu(main_action, actions))
+ log.debug("Building the main menu")
+ self.build_menu(MENU_BAR_LIST, self)
- def create_flow_graph_new(self):
- main = gtk.ImageMenuItem(gtk.STOCK_NEW)
- main.set_label(Actions.FLOW_GRAPH_NEW.get_label())
- func = self._fill_flow_graph_new_submenu
- self.submenus.append((Actions.FLOW_GRAPH_NEW, func, main))
- self.refresh_submenus()
- return main
- def create_flow_graph_recent(self):
- main = gtk.ImageMenuItem(gtk.STOCK_OPEN)
- main.set_label(Actions.FLOW_GRAPH_OPEN_RECENT.get_label())
- func = self._fill_flow_graph_recent_submenu
- self.submenus.append((Actions.FLOW_GRAPH_OPEN, func, main))
- self.refresh_submenus()
- if main.get_submenu() is None:
- main.set_property('sensitive', False)
- return main
+class ContextMenu(Gio.Menu, MenuHelper):
+ """ Context menu for the drawing area """
+
+ def __init__(self):
+ GObject.GObject.__init__(self)
+ log.debug("Building the context menu")
+ self.build_menu(CONTEXT_MENU_LIST, self)
-class ContextMenu(gtk.Menu, MenuHelperMixin):
- """The gtk menu with actions added from the context menu list."""
+
+class Toolbar(Gtk.Toolbar, ToolbarHelper):
+ """ The gtk toolbar with actions added from the toolbar list. """
def __init__(self):
- gtk.Menu.__init__(self)
- self._fill_menu(CONTEXT_MENU_LIST, self)
+ """
+ Parse the list of action names in the toolbar list.
+ Look up the action for each name in the action list and add it to the
+ toolbar.
+ """
+ GObject.GObject.__init__(self)
+ ToolbarHelper.__init__(self)
+
+ self.set_style(Gtk.ToolbarStyle.ICONS)
+ #self.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)
+
+ #SubMenuCreator.__init__(self)
+ self.build_toolbar(TOOLBAR_LIST, self)
diff --git a/grc/gui/Block.py b/grc/gui/Block.py
deleted file mode 100644
index 510ea4b62..000000000
--- a/grc/gui/Block.py
+++ /dev/null
@@ -1,350 +0,0 @@
-"""
-Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
-This file is part of GNU Radio
-
-GNU Radio Companion 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 2
-of the License, or (at your option) any later version.
-
-GNU Radio Companion 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 program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-"""
-
-import pygtk
-pygtk.require('2.0')
-import gtk
-import pango
-
-from . import Actions, Colors, Utils, Constants
-
-from . Element import Element
-from ..core.Param import num_to_str
-from ..core.utils import odict
-from ..core.utils.complexity import calculate_flowgraph_complexity
-from ..core.Block import Block as _Block
-
-BLOCK_MARKUP_TMPL="""\
-#set $foreground = $block.is_valid() and 'black' or 'red'
-<span foreground="$foreground" font_desc="$font"><b>$encode($block.get_name())</b></span>"""
-
-# Includes the additional complexity markup if enabled
-COMMENT_COMPLEXITY_MARKUP_TMPL="""\
-#set $foreground = $block.get_enabled() and '#444' or '#888'
-#if $complexity
-<span foreground="#444" size="medium" font_desc="$font"><b>$encode($complexity)</b></span>#slurp
-#end if
-#if $complexity and $comment
-<span></span>
-#end if
-#if $comment
-<span foreground="$foreground" font_desc="$font">$encode($comment)</span>#slurp
-#end if
-"""
-
-
-class Block(Element, _Block):
- """The graphical signal block."""
-
- def __init__(self, flow_graph, n):
- """
- Block constructor.
- Add graphics related params to the block.
- """
- _Block.__init__(self, flow_graph, n)
-
- self.W = 0
- self.H = 0
- #add the position param
- self.get_params().append(self.get_parent().get_parent().Param(
- block=self,
- n=odict({
- 'name': 'GUI Coordinate',
- 'key': '_coordinate',
- 'type': 'raw',
- 'value': '(0, 0)',
- 'hide': 'all',
- })
- ))
- self.get_params().append(self.get_parent().get_parent().Param(
- block=self,
- n=odict({
- 'name': 'GUI Rotation',
- 'key': '_rotation',
- 'type': 'raw',
- 'value': '0',
- 'hide': 'all',
- })
- ))
- Element.__init__(self)
- self._comment_pixmap = None
- self.has_busses = [False, False] # source, sink
-
- def get_coordinate(self):
- """
- Get the coordinate from the position param.
-
- Returns:
- the coordinate tuple (x, y) or (0, 0) if failure
- """
- proximity = Constants.BORDER_PROXIMITY_SENSITIVITY
- try: #should evaluate to tuple
- x, y = Utils.scale(eval(self.get_param('_coordinate').get_value()))
- fgW, fgH = self.get_parent().get_size()
- if x <= 0:
- x = 0
- elif x >= fgW - proximity:
- x = fgW - proximity
- if y <= 0:
- y = 0
- elif y >= fgH - proximity:
- y = fgH - proximity
- return (x, y)
- except:
- self.set_coordinate((0, 0))
- return (0, 0)
-
- def set_coordinate(self, coor):
- """
- Set the coordinate into the position param.
-
- Args:
- coor: the coordinate tuple (x, y)
- """
- if Actions.TOGGLE_SNAP_TO_GRID.get_active():
- offset_x, offset_y = (0, self.H/2) if self.is_horizontal() else (self.H/2, 0)
- coor = (
- Utils.align_to_grid(coor[0] + offset_x) - offset_x,
- Utils.align_to_grid(coor[1] + offset_y) - offset_y
- )
- self.get_param('_coordinate').set_value(str(Utils.scale(coor, reverse=True)))
-
- def bound_move_delta(self, delta_coor):
- """
- Limit potential moves from exceeding the bounds of the canvas
-
- Args:
- delta_coor: requested delta coordinate (dX, dY) to move
-
- Returns:
- The delta coordinate possible to move while keeping the block on the canvas
- or the input (dX, dY) on failure
- """
- dX, dY = delta_coor
-
- try:
- fgW, fgH = self.get_parent().get_size()
- x, y = Utils.scale(eval(self.get_param('_coordinate').get_value()))
- if self.is_horizontal():
- sW, sH = self.W, self.H
- else:
- sW, sH = self.H, self.W
-
- if x + dX < 0:
- dX = -x
- elif dX + x + sW >= fgW:
- dX = fgW - x - sW
- if y + dY < 0:
- dY = -y
- elif dY + y + sH >= fgH:
- dY = fgH - y - sH
- except:
- pass
-
- return ( dX, dY )
-
- def get_rotation(self):
- """
- Get the rotation from the position param.
-
- Returns:
- the rotation in degrees or 0 if failure
- """
- try: #should evaluate to dict
- rotation = eval(self.get_param('_rotation').get_value())
- return int(rotation)
- except:
- self.set_rotation(Constants.POSSIBLE_ROTATIONS[0])
- return Constants.POSSIBLE_ROTATIONS[0]
-
- def set_rotation(self, rot):
- """
- Set the rotation into the position param.
-
- Args:
- rot: the rotation in degrees
- """
- self.get_param('_rotation').set_value(str(rot))
-
- def create_shapes(self):
- """Update the block, parameters, and ports when a change occurs."""
- Element.create_shapes(self)
- if self.is_horizontal(): self.add_area((0, 0), (self.W, self.H))
- elif self.is_vertical(): self.add_area((0, 0), (self.H, self.W))
-
- def create_labels(self):
- """Create the labels for the signal block."""
- Element.create_labels(self)
- self._bg_color = self.is_dummy_block and Colors.MISSING_BLOCK_BACKGROUND_COLOR or \
- self.get_bypassed() and Colors.BLOCK_BYPASSED_COLOR or \
- self.get_enabled() and Colors.BLOCK_ENABLED_COLOR or Colors.BLOCK_DISABLED_COLOR
-
- layouts = list()
- #create the main layout
- layout = gtk.DrawingArea().create_pango_layout('')
- layouts.append(layout)
- layout.set_markup(Utils.parse_template(BLOCK_MARKUP_TMPL, block=self, font=Constants.BLOCK_FONT))
- self.label_width, self.label_height = layout.get_pixel_size()
- #display the params
- if self.is_dummy_block:
- markups = [
- '<span foreground="black" font_desc="{font}"><b>key: </b>{key}</span>'
- ''.format(font=Constants.PARAM_FONT, key=self._key)
- ]
- else:
- markups = [param.get_markup() for param in self.get_params() if param.get_hide() not in ('all', 'part')]
- if markups:
- layout = gtk.DrawingArea().create_pango_layout('')
- layout.set_spacing(Constants.LABEL_SEPARATION * pango.SCALE)
- layout.set_markup('\n'.join(markups))
- layouts.append(layout)
- w, h = layout.get_pixel_size()
- self.label_width = max(w, self.label_width)
- self.label_height += h + Constants.LABEL_SEPARATION
- width = self.label_width
- height = self.label_height
- #setup the pixmap
- pixmap = self.get_parent().new_pixmap(width, height)
- gc = pixmap.new_gc()
- gc.set_foreground(self._bg_color)
- pixmap.draw_rectangle(gc, True, 0, 0, width, height)
- #draw the layouts
- h_off = 0
- for i,layout in enumerate(layouts):
- w,h = layout.get_pixel_size()
- if i == 0: w_off = (width-w)/2
- else: w_off = 0
- pixmap.draw_layout(gc, w_off, h_off, layout)
- h_off = h + h_off + Constants.LABEL_SEPARATION
- #create vertical and horizontal pixmaps
- self.horizontal_label = pixmap
- if self.is_vertical():
- self.vertical_label = self.get_parent().new_pixmap(height, width)
- Utils.rotate_pixmap(gc, self.horizontal_label, self.vertical_label)
- #calculate width and height needed
- W = self.label_width + 2 * Constants.BLOCK_LABEL_PADDING
-
- def get_min_height_for_ports():
- visible_ports = filter(lambda p: not p.get_hide(), ports)
- min_height = 2*Constants.PORT_BORDER_SEPARATION + len(visible_ports) * Constants.PORT_SEPARATION
- if visible_ports:
- min_height -= ports[0].H
- return min_height
- H = max(
- [ # labels
- self.label_height + 2 * Constants.BLOCK_LABEL_PADDING
- ] +
- [ # ports
- get_min_height_for_ports() for ports in (self.get_sources_gui(), self.get_sinks_gui())
- ] +
- [ # bus ports only
- 2 * Constants.PORT_BORDER_SEPARATION +
- sum([port.H + Constants.PORT_SPACING for port in ports if port.get_type() == 'bus']) - Constants.PORT_SPACING
- for ports in (self.get_sources_gui(), self.get_sinks_gui())
- ]
- )
- self.W, self.H = Utils.align_to_grid((W, H))
- self.has_busses = [
- any(port.get_type() == 'bus' for port in ports)
- for ports in (self.get_sources_gui(), self.get_sinks_gui())
- ]
- self.create_comment_label()
-
- def create_comment_label(self):
- comment = self.get_comment() # Returns None if there are no comments
- complexity = None
-
- # Show the flowgraph complexity on the top block if enabled
- if Actions.TOGGLE_SHOW_FLOWGRAPH_COMPLEXITY.get_active() and self.get_key() == "options":
- complexity = calculate_flowgraph_complexity(self.get_parent())
- complexity = "Complexity: {}bal".format(num_to_str(complexity))
-
- layout = gtk.DrawingArea().create_pango_layout('')
- layout.set_markup(Utils.parse_template(COMMENT_COMPLEXITY_MARKUP_TMPL,
- block=self,
- comment=comment,
- complexity=complexity,
- font=Constants.BLOCK_FONT))
-
- # Setup the pixel map. Make sure that layout not empty
- width, height = layout.get_pixel_size()
- if width and height:
- padding = Constants.BLOCK_LABEL_PADDING
- pixmap = self.get_parent().new_pixmap(width + 2 * padding,
- height + 2 * padding)
- gc = pixmap.new_gc()
- gc.set_foreground(Colors.COMMENT_BACKGROUND_COLOR)
- pixmap.draw_rectangle(
- gc, True, 0, 0, width + 2 * padding, height + 2 * padding)
- pixmap.draw_layout(gc, padding, padding, layout)
- self._comment_pixmap = pixmap
- else:
- self._comment_pixmap = None
-
- def draw(self, gc, window):
- """
- Draw the signal block with label and inputs/outputs.
-
- Args:
- gc: the graphics context
- window: the gtk window to draw on
- """
- # draw ports
- for port in self.get_ports_gui():
- port.draw(gc, window)
- # draw main block
- x, y = self.get_coordinate()
- Element.draw(
- self, gc, window, bg_color=self._bg_color,
- border_color=self.is_highlighted() and Colors.HIGHLIGHT_COLOR or
- self.is_dummy_block and Colors.MISSING_BLOCK_BORDER_COLOR or Colors.BORDER_COLOR,
- )
- #draw label image
- if self.is_horizontal():
- window.draw_drawable(gc, self.horizontal_label, 0, 0, x+Constants.BLOCK_LABEL_PADDING, y+(self.H-self.label_height)/2, -1, -1)
- elif self.is_vertical():
- window.draw_drawable(gc, self.vertical_label, 0, 0, x+(self.H-self.label_height)/2, y+Constants.BLOCK_LABEL_PADDING, -1, -1)
-
- def what_is_selected(self, coor, coor_m=None):
- """
- Get the element that is selected.
-
- Args:
- coor: the (x,y) tuple
- coor_m: the (x_m, y_m) tuple
-
- Returns:
- this block, a port, or None
- """
- for port in self.get_ports_gui():
- port_selected = port.what_is_selected(coor, coor_m)
- if port_selected: return port_selected
- return Element.what_is_selected(self, coor, coor_m)
-
- def draw_comment(self, gc, window):
- if not self._comment_pixmap:
- return
- x, y = self.get_coordinate()
-
- if self.is_horizontal():
- y += self.H + Constants.BLOCK_LABEL_PADDING
- else:
- x += self.H + Constants.BLOCK_LABEL_PADDING
-
- window.draw_drawable(gc, self._comment_pixmap, 0, 0, x, y, -1, -1)
diff --git a/grc/gui/BlockTreeWindow.py b/grc/gui/BlockTreeWindow.py
index 900cbd315..3b9b8642f 100644
--- a/grc/gui/BlockTreeWindow.py
+++ b/grc/gui/BlockTreeWindow.py
@@ -1,5 +1,5 @@
"""
-Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
+Copyright 2007, 2008, 2009, 2016 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
@@ -17,71 +17,56 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-import pygtk
-pygtk.require('2.0')
-import gtk
-import gobject
-
-from . import Actions, Utils
-from . import Constants
-
-
-NAME_INDEX = 0
-KEY_INDEX = 1
-DOC_INDEX = 2
-
-DOC_MARKUP_TMPL = """\
-#set $docs = []
-#if $doc.get('')
- #set $docs += $doc.pop('').splitlines() + ['']
-#end if
-#for b, d in $doc.iteritems()
- #set $docs += ['--- {0} ---'.format(b)] + d.splitlines() + ['']
-#end for
-#set $len_out = 0
-#for $n, $line in $enumerate($docs[:-1])
-#if $n
-
-#end if
-$encode($line)#slurp
-#set $len_out += $len($line)
-#if $n > 10 or $len_out > 500
-
-...#slurp
-#break
-#end if
-#end for
-#if $len_out == 0
-undocumented#slurp
-#end if"""
-
-CAT_MARKUP_TMPL = """
-#set $name = $cat[-1]
-#if len($cat) > 1
-Category: $cat[-1]
-##
-#elif $name == 'Core'
-Module: Core
-
-This subtree is meant for blocks included with GNU Radio (in-tree).
-##
-#elif $name == $default_module
-This subtree holds all blocks (from OOT modules) that specify no module name. \
-The module name is the root category enclosed in square brackets.
-
-Please consider contacting OOT module maintainer for any block in here \
-and kindly ask to update their GRC Block Descriptions or Block Tree to include a module name.
-#else
-Module: $name
-##
-#end if
-""".strip()
-
-
-class BlockTreeWindow(gtk.VBox):
+from __future__ import absolute_import
+import six
+
+from gi.repository import Gtk, Gdk, GObject
+
+from . import Actions, Utils, Constants
+
+
+NAME_INDEX, KEY_INDEX, DOC_INDEX = range(3)
+
+
+def _format_doc(doc):
+ docs = []
+ if doc.get(''):
+ docs += doc.pop('').splitlines() + ['']
+ for block_name, docstring in six.iteritems(doc):
+ docs.append('--- {0} ---'.format(block_name))
+ docs += docstring.splitlines()
+ docs.append('')
+ out = ''
+ for n, line in enumerate(docs[:-1]):
+ if n:
+ out += '\n'
+ out += Utils.encode(line)
+ if n > 10 or len(out) > 500:
+ out += '\n...'
+ break
+ return out or 'undocumented'
+
+
+def _format_cat_tooltip(category):
+ tooltip = '{}: {}'.format('Category' if len(category) > 1 else 'Module', category[-1])
+
+ if category == ('Core',):
+ tooltip += '\n\nThis subtree is meant for blocks included with GNU Radio (in-tree).'
+
+ elif category == (Constants.DEFAULT_BLOCK_MODULE_NAME,):
+ tooltip += '\n\n' + Constants.DEFAULT_BLOCK_MODULE_TOOLTIP
+
+ return tooltip
+
+
+class BlockTreeWindow(Gtk.VBox):
"""The block selection panel."""
- def __init__(self, platform, get_flow_graph):
+ __gsignals__ = {
+ 'create_new_block': (GObject.SignalFlags.RUN_FIRST, None, (str,))
+ }
+
+ def __init__(self, platform):
"""
BlockTreeWindow constructor.
Create a tree view of the possible blocks in the platform.
@@ -90,58 +75,52 @@ class BlockTreeWindow(gtk.VBox):
Args:
platform: the particular platform will all block prototypes
- get_flow_graph: get the selected flow graph
"""
- gtk.VBox.__init__(self)
+ Gtk.VBox.__init__(self)
self.platform = platform
- self.get_flow_graph = get_flow_graph
# search entry
- self.search_entry = gtk.Entry()
+ self.search_entry = Gtk.Entry()
try:
- self.search_entry.set_icon_from_stock(gtk.ENTRY_ICON_PRIMARY, gtk.STOCK_FIND)
- self.search_entry.set_icon_activatable(gtk.ENTRY_ICON_PRIMARY, False)
- self.search_entry.set_icon_from_stock(gtk.ENTRY_ICON_SECONDARY, gtk.STOCK_CLOSE)
+ self.search_entry.set_icon_from_icon_name(Gtk.EntryIconPosition.PRIMARY, 'edit-find')
+ self.search_entry.set_icon_activatable(Gtk.EntryIconPosition.PRIMARY, False)
+ self.search_entry.set_icon_from_icon_name(Gtk.EntryIconPosition.SECONDARY, 'window-close')
self.search_entry.connect('icon-release', self._handle_icon_event)
except AttributeError:
pass # no icon for old pygtk
self.search_entry.connect('changed', self._update_search_tree)
self.search_entry.connect('key-press-event', self._handle_search_key_press)
- self.pack_start(self.search_entry, False)
+ self.pack_start(self.search_entry, False, False, 0)
# make the tree model for holding blocks and a temporary one for search results
- self.treestore = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
- self.treestore_search = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
+ self.treestore = Gtk.TreeStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING)
+ self.treestore_search = Gtk.TreeStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING)
- self.treeview = gtk.TreeView(self.treestore)
+ self.treeview = Gtk.TreeView(model=self.treestore)
self.treeview.set_enable_search(False) # disable pop up search box
self.treeview.set_search_column(-1) # really disable search
self.treeview.set_headers_visible(False)
- self.treeview.add_events(gtk.gdk.BUTTON_PRESS_MASK)
+ self.treeview.add_events(Gdk.EventMask.BUTTON_PRESS_MASK)
self.treeview.connect('button-press-event', self._handle_mouse_button_press)
self.treeview.connect('key-press-event', self._handle_search_key_press)
- self.treeview.get_selection().set_mode('single')
- renderer = gtk.CellRendererText()
- column = gtk.TreeViewColumn('Blocks', renderer, text=NAME_INDEX)
+ self.treeview.get_selection().set_mode(Gtk.SelectionMode.SINGLE)
+ renderer = Gtk.CellRendererText()
+ column = Gtk.TreeViewColumn('Blocks', renderer, text=NAME_INDEX)
self.treeview.append_column(column)
- # try to enable the tooltips (available in pygtk 2.12 and above)
- try:
- self.treeview.set_tooltip_column(DOC_INDEX)
- except:
- pass
+ self.treeview.set_tooltip_column(DOC_INDEX)
# setup sort order
column.set_sort_column_id(0)
- self.treestore.set_sort_column_id(0, gtk.SORT_ASCENDING)
+ self.treestore.set_sort_column_id(0, Gtk.SortType.ASCENDING)
# setup drag and drop
- self.treeview.enable_model_drag_source(gtk.gdk.BUTTON1_MASK, Constants.DND_TARGETS, gtk.gdk.ACTION_COPY)
+ self.treeview.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, Constants.DND_TARGETS, Gdk.DragAction.COPY)
self.treeview.connect('drag-data-get', self._handle_drag_get_data)
# make the scrolled window to hold the tree view
- scrolled_window = gtk.ScrolledWindow()
- scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- scrolled_window.add_with_viewport(self.treeview)
+ scrolled_window = Gtk.ScrolledWindow()
+ scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
+ scrolled_window.add(self.treeview)
scrolled_window.set_size_request(Constants.DEFAULT_BLOCKS_WINDOW_WIDTH, -1)
- self.pack_start(scrolled_window)
+ self.pack_start(scrolled_window, True, True, 0)
# map categories to iters, automatic mapping for root
self._categories = {tuple(): None}
self._categories_search = {tuple(): None}
@@ -154,7 +133,7 @@ class BlockTreeWindow(gtk.VBox):
def repopulate(self):
self.clear()
- for block in self.platform.blocks.itervalues():
+ for block in six.itervalues(self.platform.blocks):
if block.category:
self.add_block(block)
self.expand_module_in_tree()
@@ -188,15 +167,13 @@ class BlockTreeWindow(gtk.VBox):
iter_ = treestore.insert_before(categories[parent_category[:-1]], None)
treestore.set_value(iter_, NAME_INDEX, parent_cat_name)
treestore.set_value(iter_, KEY_INDEX, '')
- treestore.set_value(iter_, DOC_INDEX, Utils.parse_template(
- CAT_MARKUP_TMPL, cat=parent_category, default_module=Constants.DEFAULT_BLOCK_MODULE_NAME))
+ treestore.set_value(iter_, DOC_INDEX, _format_cat_tooltip(parent_cat_name))
categories[parent_category] = iter_
-
# add block
iter_ = treestore.insert_before(categories[category], None)
- treestore.set_value(iter_, NAME_INDEX, block.get_name())
- treestore.set_value(iter_, KEY_INDEX, block.get_key())
- treestore.set_value(iter_, DOC_INDEX, Utils.parse_template(DOC_MARKUP_TMPL, doc=block.get_doc()))
+ treestore.set_value(iter_, KEY_INDEX, block.key)
+ treestore.set_value(iter_, NAME_INDEX, block.label)
+ treestore.set_value(iter_, DOC_INDEX, _format_doc(block.documentation))
def update_docs(self):
"""Update the documentation column of every block"""
@@ -206,8 +183,7 @@ class BlockTreeWindow(gtk.VBox):
if not key:
return # category node, no doc string
block = self.platform.blocks[key]
- doc = Utils.parse_template(DOC_MARKUP_TMPL, doc=block.get_doc())
- model.set_value(iter_, DOC_INDEX, doc)
+ model.set_value(iter_, DOC_INDEX, _format_doc(block.documentation))
self.treestore.foreach(update_doc)
self.treestore_search.foreach(update_doc)
@@ -226,16 +202,6 @@ class BlockTreeWindow(gtk.VBox):
treestore, iter = selection.get_selected()
return iter and treestore.get_value(iter, KEY_INDEX) or ''
- def _add_selected_block(self):
- """
- Add the selected block with the given key to the flow graph.
- """
- key = self._get_selected_block_key()
- if key:
- self.get_flow_graph().add_new_block(key)
- return True
- return False
-
def _expand_category(self):
treestore, iter = self.treeview.get_selection().get_selected()
if iter and treestore.iter_has_child(iter):
@@ -246,9 +212,9 @@ class BlockTreeWindow(gtk.VBox):
## Event Handlers
############################################################
def _handle_icon_event(self, widget, icon, event):
- if icon == gtk.ENTRY_ICON_PRIMARY:
+ if icon == Gtk.EntryIconPosition.PRIMARY:
pass
- elif icon == gtk.ENTRY_ICON_SECONDARY:
+ elif icon == Gtk.EntryIconPosition.SECONDARY:
widget.set_text('')
self.search_entry.hide()
@@ -258,8 +224,8 @@ class BlockTreeWindow(gtk.VBox):
self.treeview.set_model(self.treestore)
self.expand_module_in_tree()
else:
- matching_blocks = filter(lambda b: key in b.get_key().lower() or key in b.get_name().lower(),
- self.platform.blocks.values())
+ matching_blocks = [b for b in list(self.platform.blocks.values())
+ if key in b.key.lower() or key in b.label.lower()]
self.treestore_search.clear()
self._categories_search = {tuple(): None}
@@ -270,7 +236,7 @@ class BlockTreeWindow(gtk.VBox):
def _handle_search_key_press(self, widget, event):
"""Handle Return and Escape key events in search entry and treeview"""
- if event.keyval == gtk.keysyms.Return:
+ if event.keyval == Gdk.KEY_Return:
# add block on enter
if widget == self.search_entry:
@@ -280,24 +246,28 @@ class BlockTreeWindow(gtk.VBox):
selected = self.treestore_search.iter_children(selected)
if selected is not None:
key = self.treestore_search.get_value(selected, KEY_INDEX)
- if key: self.get_flow_graph().add_new_block(key)
+ if key: self.emit('create_new_block', key)
elif widget == self.treeview:
- self._add_selected_block() or self._expand_category()
+ key = self._get_selected_block_key()
+ if key:
+ self.emit('create_new_block', key)
+ else:
+ self._expand_category()
else:
return False # propagate event
- elif event.keyval == gtk.keysyms.Escape:
+ elif event.keyval == Gdk.KEY_Escape:
# reset the search
self.search_entry.set_text('')
self.search_entry.hide()
- elif (event.state & gtk.gdk.CONTROL_MASK and event.keyval == gtk.keysyms.f) \
- or event.keyval == gtk.keysyms.slash:
+ elif (event.get_state() & Gdk.ModifierType.CONTROL_MASK and event.keyval == Gdk.KEY_f) \
+ or event.keyval == Gdk.KEY_slash:
# propagation doesn't work although treeview search is disabled =(
# manually trigger action...
Actions.FIND_BLOCKS.activate()
- elif event.state & gtk.gdk.CONTROL_MASK and event.keyval == gtk.keysyms.b:
+ elif event.get_state() & Gdk.ModifierType.CONTROL_MASK and event.keyval == Gdk.KEY_b:
# ugly...
Actions.TOGGLE_BLOCKS_WINDOW.activate()
@@ -313,12 +283,15 @@ class BlockTreeWindow(gtk.VBox):
Only call set when the key is valid to ignore DND from categories.
"""
key = self._get_selected_block_key()
- if key: selection_data.set(selection_data.target, 8, key)
+ if key:
+ selection_data.set_text(key, len(key))
def _handle_mouse_button_press(self, widget, event):
"""
Handle the mouse button press.
If a left double click is detected, call add selected block.
"""
- if event.button == 1 and event.type == gtk.gdk._2BUTTON_PRESS:
- self._add_selected_block()
+ if event.button == 1 and event.type == Gdk.EventType._2BUTTON_PRESS:
+ key = self._get_selected_block_key()
+ if key:
+ self.emit('create_new_block', key)
diff --git a/grc/gui/CMakeLists.txt b/grc/gui/CMakeLists.txt
deleted file mode 100644
index dc661c44e..000000000
--- a/grc/gui/CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright 2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio 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.
-#
-# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-file(GLOB py_files "*.py")
-
-GR_PYTHON_INSTALL(
- FILES ${py_files}
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/gui
-)
-
-install(
- FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/icon.png
- DESTINATION ${GR_PYTHON_DIR}/gnuradio/grc/gui
- COMPONENT "grc"
-)
diff --git a/grc/gui/Colors.py b/grc/gui/Colors.py
deleted file mode 100644
index d322afa41..000000000
--- a/grc/gui/Colors.py
+++ /dev/null
@@ -1,50 +0,0 @@
-"""
-Copyright 2008,2013 Free Software Foundation, Inc.
-This file is part of GNU Radio
-
-GNU Radio Companion 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 2
-of the License, or (at your option) any later version.
-
-GNU Radio Companion 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 program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-"""
-try:
- import pygtk
- pygtk.require('2.0')
- import gtk
-
- _COLORMAP = gtk.gdk.colormap_get_system() #create all of the colors
- def get_color(color_code): return _COLORMAP.alloc_color(color_code, True, True)
-
- HIGHLIGHT_COLOR = get_color('#00FFFF')
- BORDER_COLOR = get_color('#444444')
- # missing blocks stuff
- MISSING_BLOCK_BACKGROUND_COLOR = get_color('#FFF2F2')
- MISSING_BLOCK_BORDER_COLOR = get_color('red')
- #param entry boxes
- PARAM_ENTRY_TEXT_COLOR = get_color('black')
- ENTRYENUM_CUSTOM_COLOR = get_color('#EEEEEE')
- #flow graph color constants
- FLOWGRAPH_BACKGROUND_COLOR = get_color('#FFFFFF')
- COMMENT_BACKGROUND_COLOR = get_color('#F3F3F3')
- FLOWGRAPH_EDGE_COLOR = COMMENT_BACKGROUND_COLOR
- #block color constants
- BLOCK_ENABLED_COLOR = get_color('#F1ECFF')
- BLOCK_DISABLED_COLOR = get_color('#CCCCCC')
- BLOCK_BYPASSED_COLOR = get_color('#F4FF81')
- #connection color constants
- CONNECTION_ENABLED_COLOR = get_color('black')
- CONNECTION_DISABLED_COLOR = get_color('#BBBBBB')
- CONNECTION_ERROR_COLOR = get_color('red')
-except:
- print 'Unable to import Colors'
-
-DEFAULT_DOMAIN_COLOR_CODE = '#777777'
diff --git a/grc/gui/Config.py b/grc/gui/Config.py
index 9b0c5d4af..613529666 100644
--- a/grc/gui/Config.py
+++ b/grc/gui/Config.py
@@ -17,13 +17,26 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
+from __future__ import absolute_import, print_function
+
import sys
import os
-from ..core.Config import Config as _Config
+
+from ..core.Config import Config as CoreConfig
from . import Constants
+from six.moves import configparser
-class Config(_Config):
+HEADER = """\
+# This contains only GUI settings for GRC and is not meant for users to edit.
+#
+# GRC settings not accessible through the GUI are in gnuradio.conf under
+# section [grc].
+
+"""
+
+
+class Config(CoreConfig):
name = 'GNU Radio Companion'
@@ -31,44 +44,163 @@ class Config(_Config):
'GRC_PREFS_PATH', os.path.expanduser('~/.gnuradio/grc.conf'))
def __init__(self, install_prefix, *args, **kwargs):
- _Config.__init__(self, *args, **kwargs)
+ CoreConfig.__init__(self, *args, **kwargs)
self.install_prefix = install_prefix
Constants.update_font_size(self.font_size)
+ self.parser = configparser.ConfigParser()
+ for section in ['main', 'files_open', 'files_recent']:
+ try:
+ self.parser.add_section(section)
+ except Exception as e:
+ print(e)
+ try:
+ self.parser.read(self.gui_prefs_file)
+ except Exception as err:
+ print(err, file=sys.stderr)
+
+ def save(self):
+ try:
+ with open(self.gui_prefs_file, 'w') as fp:
+ fp.write(HEADER)
+ self.parser.write(fp)
+ except Exception as err:
+ print(err, file=sys.stderr)
+
+ def entry(self, key, value=None, default=None):
+ if value is not None:
+ self.parser.set('main', key, str(value))
+ result = value
+ else:
+ _type = type(default) if default is not None else str
+ getter = {
+ bool: self.parser.getboolean,
+ int: self.parser.getint,
+ }.get(_type, self.parser.get)
+ try:
+ result = getter('main', key)
+ except (AttributeError, configparser.Error):
+ result = _type() if default is None else default
+ return result
+
@property
def editor(self):
- return self.prefs.get_string('grc', 'editor', '')
+ return self._gr_prefs.get_string('grc', 'editor', '')
@editor.setter
def editor(self, value):
- self.prefs.get_string('grc', 'editor', value)
- self.prefs.save()
+ self._gr_prefs.get_string('grc', 'editor', value)
+ self._gr_prefs.save()
@property
def xterm_executable(self):
- return self.prefs.get_string('grc', 'xterm_executable', 'xterm')
+ return self._gr_prefs.get_string('grc', 'xterm_executable', 'xterm')
@property
def default_canvas_size(self):
try: # ugly, but matches current code style
- raw = self.prefs.get_string('grc', 'canvas_default_size', '1280, 1024')
+ raw = self._gr_prefs.get_string('grc', 'canvas_default_size', '1280, 1024')
value = tuple(int(x.strip('() ')) for x in raw.split(','))
if len(value) != 2 or not all(300 < x < 4096 for x in value):
raise Exception()
return value
except:
- print >> sys.stderr, "Error: invalid 'canvas_default_size' setting."
+ print("Error: invalid 'canvas_default_size' setting.", file=sys.stderr)
return Constants.DEFAULT_CANVAS_SIZE_DEFAULT
@property
def font_size(self):
try: # ugly, but matches current code style
- font_size = self.prefs.get_long('grc', 'canvas_font_size',
- Constants.DEFAULT_FONT_SIZE)
+ font_size = self._gr_prefs.get_long('grc', 'canvas_font_size',
+ Constants.DEFAULT_FONT_SIZE)
if font_size <= 0:
raise Exception()
except:
font_size = Constants.DEFAULT_FONT_SIZE
- print >> sys.stderr, "Error: invalid 'canvas_font_size' setting."
+ print("Error: invalid 'canvas_font_size' setting.", file=sys.stderr)
return font_size
+
+ @property
+ def default_qss_theme(self):
+ return self._gr_prefs.get_string('qtgui', 'qss', '')
+
+ @default_qss_theme.setter
+ def default_qss_theme(self, value):
+ self._gr_prefs.set_string("qtgui", "qss", value)
+ self._gr_prefs.save()
+
+ ##### Originally from Preferences.py #####
+ def main_window_size(self, size=None):
+ if size is None:
+ size = [None, None]
+ w = self.entry('main_window_width', size[0], default=1)
+ h = self.entry('main_window_height', size[1], default=1)
+ return w, h
+
+ def file_open(self, filename=None):
+ return self.entry('file_open', filename, default='')
+
+ def set_file_list(self, key, files):
+ self.parser.remove_section(key) # clear section
+ self.parser.add_section(key)
+ for i, filename in enumerate(files):
+ self.parser.set(key, '%s_%d' % (key, i), filename)
+
+ def get_file_list(self, key):
+ try:
+ files = [value for name, value in self.parser.items(key)
+ if name.startswith('%s_' % key)]
+ except (AttributeError, configparser.Error):
+ files = []
+ return files
+
+ def get_open_files(self):
+ return self.get_file_list('files_open')
+
+ def set_open_files(self, files):
+ return self.set_file_list('files_open', files)
+
+ def get_recent_files(self):
+ """ Gets recent files, removes any that do not exist and re-saves it """
+ files = list(filter(os.path.exists, self.get_file_list('files_recent')))
+ self.set_recent_files(files)
+ return files
+
+ def set_recent_files(self, files):
+ return self.set_file_list('files_recent', files)
+
+ def add_recent_file(self, file_name):
+ # double check file_name
+ if os.path.exists(file_name):
+ recent_files = self.get_recent_files()
+ if file_name in recent_files:
+ recent_files.remove(file_name) # Attempt removal
+ recent_files.insert(0, file_name) # Insert at start
+ self.set_recent_files(recent_files[:10]) # Keep up to 10 files
+
+ def console_window_position(self, pos=None):
+ return self.entry('console_window_position', pos, default=-1) or 1
+
+ def blocks_window_position(self, pos=None):
+ return self.entry('blocks_window_position', pos, default=-1) or 1
+
+ def variable_editor_position(self, pos=None, sidebar=False):
+ # Figure out default
+ if sidebar:
+ w, h = self.main_window_size()
+ return self.entry('variable_editor_sidebar_position', pos, default=int(h*0.7))
+ else:
+ return self.entry('variable_editor_position', pos, default=int(self.blocks_window_position()*0.5))
+
+ def variable_editor_sidebar(self, pos=None):
+ return self.entry('variable_editor_sidebar', pos, default=False)
+
+ def variable_editor_confirm_delete(self, pos=None):
+ return self.entry('variable_editor_confirm_delete', pos, default=True)
+
+ def xterm_missing(self, cmd=None):
+ return self.entry('xterm_missing', cmd, default='INVALID_XTERM_SETTING')
+
+ def screen_shot_background_transparent(self, transparent=None):
+ return self.entry('screen_shot_background_transparent', transparent, default=False)
diff --git a/grc/gui/Connection.py b/grc/gui/Connection.py
deleted file mode 100644
index 50361c19d..000000000
--- a/grc/gui/Connection.py
+++ /dev/null
@@ -1,181 +0,0 @@
-"""
-Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
-This file is part of GNU Radio
-
-GNU Radio Companion 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 2
-of the License, or (at your option) any later version.
-
-GNU Radio Companion 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 program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-"""
-
-import gtk
-
-import Colors
-import Utils
-from Constants import CONNECTOR_ARROW_BASE, CONNECTOR_ARROW_HEIGHT
-from Element import Element
-
-from ..core.Constants import GR_MESSAGE_DOMAIN
-from ..core.Connection import Connection as _Connection
-
-
-class Connection(Element, _Connection):
- """
- A graphical connection for ports.
- The connection has 2 parts, the arrow and the wire.
- The coloring of the arrow and wire exposes the status of 3 states:
- enabled/disabled, valid/invalid, highlighted/non-highlighted.
- The wire coloring exposes the enabled and highlighted states.
- The arrow coloring exposes the enabled and valid states.
- """
-
- def __init__(self, **kwargs):
- Element.__init__(self)
- _Connection.__init__(self, **kwargs)
- # can't use Colors.CONNECTION_ENABLED_COLOR here, might not be defined (grcc)
- self._bg_color = self._arrow_color = self._color = None
-
- def get_coordinate(self):
- """
- Get the 0,0 coordinate.
- Coordinates are irrelevant in connection.
-
- Returns:
- 0, 0
- """
- return 0, 0
-
- def get_rotation(self):
- """
- Get the 0 degree rotation.
- Rotations are irrelevant in connection.
-
- Returns:
- 0
- """
- return 0
-
- def create_shapes(self):
- """Precalculate relative coordinates."""
- Element.create_shapes(self)
- self._sink_rot = None
- self._source_rot = None
- self._sink_coor = None
- self._source_coor = None
- #get the source coordinate
- try:
- connector_length = self.get_source().get_connector_length()
- except:
- return
- self.x1, self.y1 = Utils.get_rotated_coordinate((connector_length, 0), self.get_source().get_rotation())
- #get the sink coordinate
- connector_length = self.get_sink().get_connector_length() + CONNECTOR_ARROW_HEIGHT
- self.x2, self.y2 = Utils.get_rotated_coordinate((-connector_length, 0), self.get_sink().get_rotation())
- #build the arrow
- self.arrow = [(0, 0),
- Utils.get_rotated_coordinate((-CONNECTOR_ARROW_HEIGHT, -CONNECTOR_ARROW_BASE/2), self.get_sink().get_rotation()),
- Utils.get_rotated_coordinate((-CONNECTOR_ARROW_HEIGHT, CONNECTOR_ARROW_BASE/2), self.get_sink().get_rotation()),
- ]
- source_domain = self.get_source().get_domain()
- sink_domain = self.get_sink().get_domain()
- self.line_attributes[0] = 2 if source_domain != sink_domain else 0
- self.line_attributes[1] = gtk.gdk.LINE_DOUBLE_DASH \
- if not source_domain == sink_domain == GR_MESSAGE_DOMAIN \
- else gtk.gdk.LINE_ON_OFF_DASH
- get_domain_color = lambda d: Colors.get_color((
- self.get_parent().get_parent().domains.get(d, {})
- ).get('color') or Colors.DEFAULT_DOMAIN_COLOR_CODE)
- self._color = get_domain_color(source_domain)
- self._bg_color = get_domain_color(sink_domain)
- self._arrow_color = self._bg_color if self.is_valid() else Colors.CONNECTION_ERROR_COLOR
- self._update_after_move()
-
- def _update_after_move(self):
- """Calculate coordinates."""
- self.clear() #FIXME do i want this here?
- #source connector
- source = self.get_source()
- X, Y = source.get_connector_coordinate()
- x1, y1 = self.x1 + X, self.y1 + Y
- self.add_line((x1, y1), (X, Y))
- #sink connector
- sink = self.get_sink()
- X, Y = sink.get_connector_coordinate()
- x2, y2 = self.x2 + X, self.y2 + Y
- self.add_line((x2, y2), (X, Y))
- #adjust arrow
- self._arrow = [(x+X, y+Y) for x,y in self.arrow]
- #add the horizontal and vertical lines in this connection
- if abs(source.get_connector_direction() - sink.get_connector_direction()) == 180:
- #2 possible point sets to create a 3-line connector
- mid_x, mid_y = (x1 + x2)/2.0, (y1 + y2)/2.0
- points = [((mid_x, y1), (mid_x, y2)), ((x1, mid_y), (x2, mid_y))]
- #source connector -> points[0][0] should be in the direction of source (if possible)
- if Utils.get_angle_from_coordinates((x1, y1), points[0][0]) != source.get_connector_direction(): points.reverse()
- #points[0][0] -> sink connector should not be in the direction of sink
- if Utils.get_angle_from_coordinates(points[0][0], (x2, y2)) == sink.get_connector_direction(): points.reverse()
- #points[0][0] -> source connector should not be in the direction of source
- if Utils.get_angle_from_coordinates(points[0][0], (x1, y1)) == source.get_connector_direction(): points.reverse()
- #create 3-line connector
- p1, p2 = map(int, points[0][0]), map(int, points[0][1])
- self.add_line((x1, y1), p1)
- self.add_line(p1, p2)
- self.add_line((x2, y2), p2)
- else:
- #2 possible points to create a right-angled connector
- points = [(x1, y2), (x2, y1)]
- #source connector -> points[0] should be in the direction of source (if possible)
- if Utils.get_angle_from_coordinates((x1, y1), points[0]) != source.get_connector_direction(): points.reverse()
- #points[0] -> sink connector should not be in the direction of sink
- if Utils.get_angle_from_coordinates(points[0], (x2, y2)) == sink.get_connector_direction(): points.reverse()
- #points[0] -> source connector should not be in the direction of source
- if Utils.get_angle_from_coordinates(points[0], (x1, y1)) == source.get_connector_direction(): points.reverse()
- #create right-angled connector
- self.add_line((x1, y1), points[0])
- self.add_line((x2, y2), points[0])
-
- def draw(self, gc, window):
- """
- Draw the connection.
-
- Args:
- gc: the graphics context
- window: the gtk window to draw on
- """
- sink = self.get_sink()
- source = self.get_source()
- #check for changes
- if self._sink_rot != sink.get_rotation() or self._source_rot != source.get_rotation(): self.create_shapes()
- elif self._sink_coor != sink.get_coordinate() or self._source_coor != source.get_coordinate():
- try:
- self._update_after_move()
- except:
- return
- #cache values
- self._sink_rot = sink.get_rotation()
- self._source_rot = source.get_rotation()
- self._sink_coor = sink.get_coordinate()
- self._source_coor = source.get_coordinate()
- #draw
- mod_color = lambda color: (
- Colors.HIGHLIGHT_COLOR if self.is_highlighted() else
- Colors.CONNECTION_DISABLED_COLOR if not self.get_enabled() else
- color
- )
- Element.draw(self, gc, window, mod_color(self._color), mod_color(self._bg_color))
- # draw arrow on sink port
- try:
- gc.set_foreground(mod_color(self._arrow_color))
- gc.set_line_attributes(0, gtk.gdk.LINE_SOLID, gtk.gdk.CAP_BUTT, gtk.gdk.JOIN_MITER)
- window.draw_polygon(gc, True, self._arrow)
- except:
- pass
diff --git a/grc/gui/Console.py b/grc/gui/Console.py
new file mode 100644
index 000000000..0ae862493
--- /dev/null
+++ b/grc/gui/Console.py
@@ -0,0 +1,57 @@
+"""
+Copyright 2008, 2009, 2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from __future__ import absolute_import
+
+import os
+import logging
+
+import gi
+gi.require_version('Gtk', '3.0')
+from gi.repository import Gtk, Gdk, GObject
+
+from .Constants import DEFAULT_CONSOLE_WINDOW_WIDTH
+from .Dialogs import TextDisplay, MessageDialogWrapper
+
+from ..core import Messages
+
+
+log = logging.getLogger(__name__)
+
+
+class Console(Gtk.ScrolledWindow):
+ def __init__(self):
+ Gtk.ScrolledWindow.__init__(self)
+ log.debug("console()")
+ self.app = Gtk.Application.get_default()
+
+ self.text_display = TextDisplay()
+
+ self.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
+ self.add(self.text_display)
+ self.set_size_request(-1, DEFAULT_CONSOLE_WINDOW_WIDTH)
+
+ def add_line(self, line):
+ """
+ Place line at the end of the text buffer, then scroll its window all the way down.
+
+ Args:
+ line: the new text
+ """
+ self.text_display.insert(line)
diff --git a/grc/gui/Constants.py b/grc/gui/Constants.py
index f77221e52..a3d08cbe3 100644
--- a/grc/gui/Constants.py
+++ b/grc/gui/Constants.py
@@ -17,17 +17,16 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-import gtk
+from __future__ import absolute_import
+
+from gi.repository import Gtk, Gdk
from ..core.Constants import *
# default path for the open/save dialogs
DEFAULT_FILE_PATH = os.getcwd() if os.name != 'nt' else os.path.expanduser("~/Documents")
-
-# file extensions
-IMAGE_FILE_EXTENSION = '.png'
-TEXT_FILE_EXTENSION = '.txt'
+FILE_EXTENSION = '.grc'
# name for new/unsaved flow graphs
NEW_FLOGRAPH_TITLE = 'untitled'
@@ -36,7 +35,7 @@ NEW_FLOGRAPH_TITLE = 'untitled'
MIN_WINDOW_WIDTH = 600
MIN_WINDOW_HEIGHT = 400
# dialog constraints
-MIN_DIALOG_WIDTH = 500
+MIN_DIALOG_WIDTH = 600
MIN_DIALOG_HEIGHT = 500
# default sizes
DEFAULT_BLOCKS_WINDOW_WIDTH = 100
@@ -53,7 +52,7 @@ PARAM_FONT = "Sans 7.5"
STATE_CACHE_SIZE = 42
# Shared targets for drag and drop of blocks
-DND_TARGETS = [('STRING', gtk.TARGET_SAME_APP, 0)]
+DND_TARGETS = [('STRING', Gtk.TargetFlags.SAME_APP, 0)]
# label constraint dimensions
LABEL_SEPARATION = 3
@@ -70,6 +69,7 @@ PORT_SEPARATION = 32
PORT_MIN_WIDTH = 20
PORT_LABEL_HIDDEN_WIDTH = 10
+PORT_EXTRA_BUS_HEIGHT = 40
# minimal length of connector
CONNECTOR_EXTENSION_MINIMAL = 11
@@ -78,17 +78,14 @@ CONNECTOR_EXTENSION_MINIMAL = 11
CONNECTOR_EXTENSION_INCREMENT = 11
# connection arrow dimensions
-CONNECTOR_ARROW_BASE = 13
-CONNECTOR_ARROW_HEIGHT = 17
+CONNECTOR_ARROW_BASE = 10
+CONNECTOR_ARROW_HEIGHT = 13
# possible rotations in degrees
POSSIBLE_ROTATIONS = (0, 90, 180, 270)
-# How close can the mouse get to the window border before mouse events are ignored.
-BORDER_PROXIMITY_SENSITIVITY = 50
-
# How close the mouse can get to the edge of the visible window before scrolling is invoked.
-SCROLL_PROXIMITY_SENSITIVITY = 30
+SCROLL_PROXIMITY_SENSITIVITY = 50
# When the window has to be scrolled, move it this distance in the required direction.
SCROLL_DISTANCE = 15
@@ -96,8 +93,18 @@ SCROLL_DISTANCE = 15
# How close the mouse click can be to a line and register a connection select.
LINE_SELECT_SENSITIVITY = 5
-_SCREEN_RESOLUTION = gtk.gdk.screen_get_default().get_resolution()
-DPI_SCALING = _SCREEN_RESOLUTION / 96.0 if _SCREEN_RESOLUTION > 0 else 1.0
+DEFAULT_BLOCK_MODULE_TOOLTIP = """\
+This subtree holds all blocks (from OOT modules) that specify no module name. \
+The module name is the root category enclosed in square brackets.
+
+Please consider contacting OOT module maintainer for any block in here \
+and kindly ask to update their GRC Block Descriptions or Block Tree to include a module name."""
+
+
+# _SCREEN = Gdk.Screen.get_default()
+# _SCREEN_RESOLUTION = _SCREEN.get_resolution() if _SCREEN else -1
+# DPI_SCALING = _SCREEN_RESOLUTION / 96.0 if _SCREEN_RESOLUTION > 0 else 1.0
+DPI_SCALING = 1.0 # todo: figure out the GTK3 way (maybe cairo does this for us
def update_font_size(font_size):
diff --git a/grc/gui/Dialogs.py b/grc/gui/Dialogs.py
index 4c89810bb..f58ea78ca 100644
--- a/grc/gui/Dialogs.py
+++ b/grc/gui/Dialogs.py
@@ -1,33 +1,36 @@
-"""
-Copyright 2008, 2009 Free Software Foundation, Inc.
-This file is part of GNU Radio
-
-GNU Radio Companion 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 2
-of the License, or (at your option) any later version.
-
-GNU Radio Companion 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 program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-"""
-
-import gtk
+# Copyright 2008, 2009, 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
import sys
+import textwrap
from distutils.spawn import find_executable
-from . import Utils, Actions
+from gi.repository import Gtk
+
+from . import Utils, Actions, Constants
from ..core import Messages
-class SimpleTextDisplay(gtk.TextView):
- """A non editable gtk text view."""
+class SimpleTextDisplay(Gtk.TextView):
+ """
+ A non user-editable gtk text view.
+ """
def __init__(self, text=''):
"""
@@ -36,16 +39,18 @@ class SimpleTextDisplay(gtk.TextView):
Args:
text: the text to display (string)
"""
- text_buffer = gtk.TextBuffer()
- text_buffer.set_text(text)
- self.set_text = text_buffer.set_text
- gtk.TextView.__init__(self, text_buffer)
+ Gtk.TextView.__init__(self)
+ self.set_text = self.get_buffer().set_text
+ self.set_text(text)
self.set_editable(False)
self.set_cursor_visible(False)
- self.set_wrap_mode(gtk.WRAP_WORD_CHAR)
+ self.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
class TextDisplay(SimpleTextDisplay):
+ """
+ A non user-editable scrollable text view with popup menu.
+ """
def __init__(self, text=''):
"""
@@ -59,220 +64,314 @@ class TextDisplay(SimpleTextDisplay):
self.connect("populate-popup", self.populate_popup)
def insert(self, line):
- # make backspaces work
+ """
+ Append text after handling backspaces and auto-scroll.
+
+ Args:
+ line: the text to append (string)
+ """
line = self._consume_backspaces(line)
- # add the remaining text to buffer
self.get_buffer().insert(self.get_buffer().get_end_iter(), line)
- # Automatically scroll on insert
self.scroll_to_end()
def _consume_backspaces(self, line):
- """removes text from the buffer if line starts with \b*"""
- if not line: return
+ """
+ Removes text from the buffer if line starts with '\b'
+
+ Args:
+ line: a string which may contain backspaces
+
+ Returns:
+ The string that remains from 'line' with leading '\b's removed.
+ """
+ if not line:
+ return
+
# for each \b delete one char from the buffer
back_count = 0
start_iter = self.get_buffer().get_end_iter()
while len(line) > back_count and line[back_count] == '\b':
# stop at the beginning of a line
- if not start_iter.starts_line(): start_iter.backward_char()
+ if not start_iter.starts_line():
+ start_iter.backward_char()
back_count += 1
- # remove chars
+ # remove chars from buffer
self.get_buffer().delete(start_iter, self.get_buffer().get_end_iter())
- # return remaining text
return line[back_count:]
def scroll_to_end(self):
+ """ Update view's scroll position. """
if self.scroll_lock:
- buffer = self.get_buffer()
- buffer.move_mark(buffer.get_insert(), buffer.get_end_iter())
- self.scroll_to_mark(buffer.get_insert(), 0.0)
+ buf = self.get_buffer()
+ mark = buf.get_insert()
+ buf.move_mark(mark, buf.get_end_iter())
+ self.scroll_mark_onscreen(mark)
def clear(self):
- buffer = self.get_buffer()
- buffer.delete(buffer.get_start_iter(), buffer.get_end_iter())
+ """ Clear all text from buffer. """
+ buf = self.get_buffer()
+ buf.delete(buf.get_start_iter(), buf.get_end_iter())
def save(self, file_path):
- console_file = open(file_path, 'w')
- buffer = self.get_buffer()
- console_file.write(buffer.get_text(buffer.get_start_iter(), buffer.get_end_iter(), True))
- console_file.close()
+ """
+ Save context of buffer to the given file.
- # Callback functions to handle the scrolling lock and clear context menus options
- # Action functions are set by the ActionHandler's init function
+ Args:
+ file_path: location to save buffer contents
+ """
+ with open(file_path, 'w') as logfile:
+ buf = self.get_buffer()
+ logfile.write(buf.get_text(buf.get_start_iter(),
+ buf.get_end_iter(), True))
+
+ # Action functions are set by the Application's init function
def clear_cb(self, menu_item, web_view):
+ """ Callback function to clear the text buffer """
Actions.CLEAR_CONSOLE()
def scroll_back_cb(self, menu_item, web_view):
+ """ Callback function to toggle scroll lock """
Actions.TOGGLE_SCROLL_LOCK()
def save_cb(self, menu_item, web_view):
+ """ Callback function to save the buffer """
Actions.SAVE_CONSOLE()
def populate_popup(self, view, menu):
"""Create a popup menu for the scroll lock and clear functions"""
- menu.append(gtk.SeparatorMenuItem())
+ menu.append(Gtk.SeparatorMenuItem())
- lock = gtk.CheckMenuItem("Scroll Lock")
+ lock = Gtk.CheckMenuItem("Scroll Lock")
menu.append(lock)
lock.set_active(self.scroll_lock)
lock.connect('activate', self.scroll_back_cb, view)
- save = gtk.ImageMenuItem(gtk.STOCK_SAVE)
+ save = Gtk.ImageMenuItem(Gtk.STOCK_SAVE)
menu.append(save)
save.connect('activate', self.save_cb, view)
- clear = gtk.ImageMenuItem(gtk.STOCK_CLEAR)
+ clear = Gtk.ImageMenuItem(Gtk.STOCK_CLEAR)
menu.append(clear)
clear.connect('activate', self.clear_cb, view)
menu.show_all()
return False
-def MessageDialogHelper(type, buttons, title=None, markup=None, default_response=None, extra_buttons=None):
- """
- Create a modal message dialog and run it.
+class MessageDialogWrapper(Gtk.MessageDialog):
+ """ Run a message dialog. """
- Args:
- type: the type of message: gtk.MESSAGE_INFO, gtk.MESSAGE_WARNING, gtk.MESSAGE_QUESTION or gtk.MESSAGE_ERROR
- buttons: the predefined set of buttons to use:
- gtk.BUTTONS_NONE, gtk.BUTTONS_OK, gtk.BUTTONS_CLOSE, gtk.BUTTONS_CANCEL, gtk.BUTTONS_YES_NO, gtk.BUTTONS_OK_CANCEL
+ def __init__(self, parent, message_type, buttons, title=None, markup=None,
+ default_response=None, extra_buttons=None):
+ """
+ Create a modal message dialog.
- Args:
- title: the title of the window (string)
- markup: the message text with pango markup
- default_response: if set, determines which button is highlighted by default
- extra_buttons: a tuple containing pairs of values; each value is the button's text and the button's return value
+ Args:
+ message_type: the type of message may be one of:
+ Gtk.MessageType.INFO
+ Gtk.MessageType.WARNING
+ Gtk.MessageType.QUESTION or Gtk.MessageType.ERROR
+ buttons: the predefined set of buttons to use:
+ Gtk.ButtonsType.NONE
+ Gtk.ButtonsType.OK
+ Gtk.ButtonsType.CLOSE
+ Gtk.ButtonsType.CANCEL
+ Gtk.ButtonsType.YES_NO
+ Gtk.ButtonsType.OK_CANCEL
+ title: the title of the window (string)
+ markup: the message text with pango markup
+ default_response: if set, determines which button is highlighted by default
+ extra_buttons: a tuple containing pairs of values:
+ each value is the button's text and the button's return value
- Returns:
- the gtk response from run()
- """
- message_dialog = gtk.MessageDialog(None, gtk.DIALOG_MODAL, type, buttons)
- if title: message_dialog.set_title(title)
- if markup: message_dialog.set_markup(markup)
- if extra_buttons: message_dialog.add_buttons(*extra_buttons)
- if default_response: message_dialog.set_default_response(default_response)
- response = message_dialog.run()
- message_dialog.destroy()
- return response
-
-
-ERRORS_MARKUP_TMPL="""\
-#for $i, $err_msg in enumerate($errors)
-<b>Error $i:</b>
-$encode($err_msg.replace('\t', ' '))
-
-#end for"""
-
-
-def ErrorsDialog(flowgraph): MessageDialogHelper(
- type=gtk.MESSAGE_ERROR,
- buttons=gtk.BUTTONS_CLOSE,
- title='Flow Graph Errors',
- markup=Utils.parse_template(ERRORS_MARKUP_TMPL, errors=flowgraph.get_error_messages()),
-)
-
-
-class AboutDialog(gtk.AboutDialog):
- """A cute little about dialog."""
-
- def __init__(self, config):
- """AboutDialog constructor."""
- gtk.AboutDialog.__init__(self)
- self.set_name(config.name)
- self.set_version(config.version)
- self.set_license(config.license)
- self.set_copyright(config.license.splitlines()[0])
- self.set_website(config.website)
- self.run()
- self.destroy()
-
-
-def HelpDialog(): MessageDialogHelper(
- type=gtk.MESSAGE_INFO,
- buttons=gtk.BUTTONS_CLOSE,
- title='Help',
- markup="""\
-<b>Usage Tips</b>
-
-<u>Add block</u>: drag and drop or double click a block in the block selection window.
-<u>Rotate block</u>: Select a block, press left/right on the keyboard.
-<u>Change type</u>: Select a block, press up/down on the keyboard.
-<u>Edit parameters</u>: double click on a block in the flow graph.
-<u>Make connection</u>: click on the source port of one block, then click on the sink port of another block.
-<u>Remove connection</u>: select the connection and press delete, or drag the connection.
-
-* See the menu for other keyboard shortcuts.""")
-
-COLORS_DIALOG_MARKUP_TMPL = """\
-<b>Color Mapping</b>
-
-#if $colors
- #set $max_len = max([len(color[0]) for color in $colors]) + 10
- #for $title, $color_spec in $colors
-<span background="$color_spec"><tt>$($encode($title).center($max_len))</tt></span>
- #end for
-#end if
-"""
-
-
-def TypesDialog(platform):
- MessageDialogHelper(
- type=gtk.MESSAGE_INFO,
- buttons=gtk.BUTTONS_CLOSE,
- title='Types',
- markup=Utils.parse_template(COLORS_DIALOG_MARKUP_TMPL,
- colors=platform.get_colors())
+ """
+ Gtk.MessageDialog.__init__(
+ self, transient_for=parent, modal=True, destroy_with_parent=True,
+ message_type=message_type, buttons=buttons
+ )
+ if title:
+ self.set_title(title)
+ if markup:
+ self.set_markup(markup)
+ if extra_buttons:
+ self.add_buttons(*extra_buttons)
+ if default_response:
+ self.set_default_response(default_response)
+
+ def run_and_destroy(self):
+ response = self.run()
+ self.hide()
+ return response
+
+
+class ErrorsDialog(Gtk.Dialog):
+ """ Display flowgraph errors. """
+
+ def __init__(self, parent, flowgraph):
+ """Create a listview of errors"""
+ Gtk.Dialog.__init__(
+ self,
+ title='Errors and Warnings',
+ transient_for=parent,
+ modal=True,
+ destroy_with_parent=True,
+ )
+ self.add_buttons(Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT)
+ self.set_size_request(750, Constants.MIN_DIALOG_HEIGHT)
+ self.set_border_width(10)
+
+ self.store = Gtk.ListStore(str, str, str)
+ self.update(flowgraph)
+
+ self.treeview = Gtk.TreeView(model=self.store)
+ for i, column_title in enumerate(["Block", "Aspect", "Message"]):
+ renderer = Gtk.CellRendererText()
+ column = Gtk.TreeViewColumn(column_title, renderer, text=i)
+ column.set_sort_column_id(i) # liststore id matches treeview id
+ column.set_resizable(True)
+ self.treeview.append_column(column)
+
+ self.scrollable = Gtk.ScrolledWindow()
+ self.scrollable.set_vexpand(True)
+ self.scrollable.add(self.treeview)
+
+ self.vbox.pack_start(self.scrollable, True, True, 0)
+ self.show_all()
+
+ def update(self, flowgraph):
+ self.store.clear()
+ for element, message in flowgraph.iter_error_messages():
+ if element.is_block:
+ src, aspect = element.name, ''
+ elif element.is_connection:
+ src = element.source_block.name
+ aspect = "Connection to '{}'".format(element.sink_block.name)
+ elif element.is_port:
+ src = element.parent_block.name
+ aspect = "{} '{}'".format('Sink' if element.is_sink else 'Source', element.name)
+ elif element.is_param:
+ src = element.parent_block.name
+ aspect = "Param '{}'".format(element.name)
+ else:
+ src = aspect = ''
+ self.store.append([src, aspect, message])
+
+ def run_and_destroy(self):
+ response = self.run()
+ self.hide()
+ return response
+
+
+def show_about(parent, config):
+ ad = Gtk.AboutDialog(transient_for=parent)
+ ad.set_program_name(config.name)
+ ad.set_name('')
+ ad.set_license(config.license)
+
+ py_version = sys.version.split()[0]
+ ad.set_version("{} (Python {})".format(config.version, py_version))
+
+ try:
+ ad.set_logo(Gtk.IconTheme().load_icon('gnuradio-grc', 64, 0))
+ except:
+ pass
+
+ #ad.set_comments("")
+ ad.set_copyright(config.license.splitlines()[0])
+ ad.set_website(config.website)
+
+ ad.connect("response", lambda action, param: action.hide())
+ ad.show()
+
+
+def show_help(parent):
+ """ Display basic usage tips. """
+ markup = textwrap.dedent("""\
+ <b>Usage Tips</b>
+ \n\
+ <u>Add block</u>: drag and drop or double click a block in the block selection window.
+ <u>Rotate block</u>: Select a block, press left/right on the keyboard.
+ <u>Change type</u>: Select a block, press up/down on the keyboard.
+ <u>Edit parameters</u>: double click on a block in the flow graph.
+ <u>Make connection</u>: click on the source port of one block, then click on the sink port of another block.
+ <u>Remove connection</u>: select the connection and press delete, or drag the connection.
+ \n\
+ * See the menu for other keyboard shortcuts.\
+ """)
+
+ MessageDialogWrapper(
+ parent, Gtk.MessageType.INFO, Gtk.ButtonsType.CLOSE, title='Help', markup=markup
+ ).run_and_destroy()
+
+
+def show_types(parent):
+ """ Display information about standard data types. """
+ colors = [(name, color) for name, key, sizeof, color in Constants.CORE_TYPES]
+ max_len = 10 + max(len(name) for name, code in colors)
+
+ message = '\n'.join(
+ '<span background="{color}"><tt>{name}</tt></span>'
+ ''.format(color=color, name=Utils.encode(name).center(max_len))
+ for name, color in colors
)
+ MessageDialogWrapper(
+ parent, Gtk.MessageType.INFO, Gtk.ButtonsType.CLOSE, title='Types - Color Mapping', markup=message
+ ).run_and_destroy()
-def MissingXTermDialog(xterm):
- MessageDialogHelper(
- type=gtk.MESSAGE_WARNING,
- buttons=gtk.BUTTONS_OK,
- title='Warning: missing xterm executable',
- markup=("The xterm executable {0!r} is missing.\n\n"
- "You can change this setting in your gnuradio.conf, in "
- "section [grc], 'xterm_executable'.\n"
- "\n"
- "(This message is shown only once)").format(xterm)
- )
+def show_missing_xterm(parent, xterm):
+ markup = textwrap.dedent("""\
+ The xterm executable {0!r} is missing.
+ You can change this setting in your gnurado.conf, in section [grc], 'xterm_executable'.
+ \n\
+ (This message is shown only once)\
+ """).format(xterm)
+
+ MessageDialogWrapper(
+ parent, message_type=Gtk.MessageType.WARNING, buttons=Gtk.ButtonsType.OK,
+ title='Warning: missing xterm executable', markup=markup
+ ).run_and_destroy()
+
+
+def choose_editor(parent, config):
+ """
+ Give the option to either choose an editor or use the default.
+ """
+ if config.editor and find_executable(config.editor):
+ return config.editor
-def ChooseEditorDialog(config):
- # Give the option to either choose an editor or use the default
- # Always return true/false so the caller knows it was successful
buttons = (
- 'Choose Editor', gtk.RESPONSE_YES,
- 'Use Default', gtk.RESPONSE_NO,
- gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL
- )
- response = MessageDialogHelper(
- gtk.MESSAGE_QUESTION, gtk.BUTTONS_NONE, 'Choose Editor',
- 'Would you like to choose the editor to use?', gtk.RESPONSE_YES, buttons
+ 'Choose Editor', Gtk.ResponseType.YES,
+ 'Use Default', Gtk.ResponseType.NO,
+ Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL
)
+ response = MessageDialogWrapper(
+ parent, message_type=Gtk.MessageType.QUESTION, buttons=Gtk.ButtonsType.NONE,
+ title='Choose Editor', markup='Would you like to choose the editor to use?',
+ default_response=Gtk.ResponseType.YES, extra_buttons=buttons
+ ).run_and_destroy()
# Handle the initial default/choose/cancel response
# User wants to choose the editor to use
- if response == gtk.RESPONSE_YES:
- file_dialog = gtk.FileChooserDialog(
+ editor = ''
+ if response == Gtk.ResponseType.YES:
+ file_dialog = Gtk.FileChooserDialog(
'Select an Editor...', None,
- gtk.FILE_CHOOSER_ACTION_OPEN,
- ('gtk-cancel', gtk.RESPONSE_CANCEL, 'gtk-open', gtk.RESPONSE_OK)
+ Gtk.FileChooserAction.OPEN,
+ ('gtk-cancel', Gtk.ResponseType.CANCEL, 'gtk-open', Gtk.ResponseType.OK),
+ transient_for=parent
)
file_dialog.set_select_multiple(False)
file_dialog.set_local_only(True)
file_dialog.set_current_folder('/usr/bin')
try:
- if file_dialog.run() == gtk.RESPONSE_OK:
- config.editor = file_path = file_dialog.get_filename()
- file_dialog.destroy()
- return file_path
+ if file_dialog.run() == Gtk.ResponseType.OK:
+ editor = file_dialog.get_filename()
finally:
- file_dialog.destroy()
+ file_dialog.hide()
# Go with the default editor
- elif response == gtk.RESPONSE_NO:
- # Determine the platform
+ elif response == Gtk.ResponseType.NO:
try:
process = None
if sys.platform.startswith('linux'):
@@ -282,13 +381,10 @@ def ChooseEditorDialog(config):
if process is None:
raise ValueError("Can't find default editor executable")
# Save
- config.editor = process
- return process
+ editor = config.editor = process
except Exception:
Messages.send('>>> Unable to load the default editor. Please choose an editor.\n')
- # Just reset of the constant and force the user to select an editor the next time
- config.editor = ''
- return
- Messages.send('>>> No editor selected.\n')
- return
+ if editor == '':
+ Messages.send('>>> No editor selected.\n')
+ return editor
diff --git a/grc/gui/DrawingArea.py b/grc/gui/DrawingArea.py
index 64862ce6d..3a77d062f 100644
--- a/grc/gui/DrawingArea.py
+++ b/grc/gui/DrawingArea.py
@@ -17,15 +17,16 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-import pygtk
-pygtk.require('2.0')
-import gtk
+from __future__ import absolute_import
-from Constants import MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT, DND_TARGETS
-import Colors
+from gi.repository import Gtk, Gdk
+from .canvas.colors import FLOWGRAPH_BACKGROUND_COLOR
+from . import Constants
+from . import Actions
-class DrawingArea(gtk.DrawingArea):
+
+class DrawingArea(Gtk.DrawingArea):
"""
DrawingArea is the gtk pixel map that graphical elements may draw themselves on.
The drawing area also responds to mouse and key events.
@@ -39,137 +40,225 @@ class DrawingArea(gtk.DrawingArea):
Args:
main_window: the main_window containing all flow graphs
"""
+ Gtk.DrawingArea.__init__(self)
+
+ self._flow_graph = flow_graph
+ self.set_property('can_focus', True)
+
+ self.zoom_factor = 1.0
+ self._update_after_zoom = False
self.ctrl_mask = False
self.mod1_mask = False
- self._flow_graph = flow_graph
- gtk.DrawingArea.__init__(self)
- self.set_size_request(MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT)
+ self.button_state = [False] * 10
+
+ # self.set_size_request(MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT)
self.connect('realize', self._handle_window_realize)
- self.connect('configure-event', self._handle_window_configure)
- self.connect('expose-event', self._handle_window_expose)
+ self.connect('draw', self.draw)
self.connect('motion-notify-event', self._handle_mouse_motion)
self.connect('button-press-event', self._handle_mouse_button_press)
self.connect('button-release-event', self._handle_mouse_button_release)
self.connect('scroll-event', self._handle_mouse_scroll)
self.add_events(
- gtk.gdk.BUTTON_PRESS_MASK | \
- gtk.gdk.POINTER_MOTION_MASK | \
- gtk.gdk.BUTTON_RELEASE_MASK | \
- gtk.gdk.LEAVE_NOTIFY_MASK | \
- gtk.gdk.ENTER_NOTIFY_MASK | \
- gtk.gdk.FOCUS_CHANGE_MASK
+ Gdk.EventMask.BUTTON_PRESS_MASK |
+ Gdk.EventMask.POINTER_MOTION_MASK |
+ Gdk.EventMask.BUTTON_RELEASE_MASK |
+ Gdk.EventMask.SCROLL_MASK |
+ Gdk.EventMask.LEAVE_NOTIFY_MASK |
+ Gdk.EventMask.ENTER_NOTIFY_MASK
+ # Gdk.EventMask.FOCUS_CHANGE_MASK
)
- #setup drag and drop
- self.drag_dest_set(gtk.DEST_DEFAULT_ALL, DND_TARGETS, gtk.gdk.ACTION_COPY)
+
+ # This may not be the correct place to be handling the user events
+ # Should this be in the page instead?
+ # Or should more of the page functionality move here?
+ self.connect('key_press_event', self._handle_key_press)
+
+ # setup drag and drop
+ self.drag_dest_set(Gtk.DestDefaults.ALL, [], Gdk.DragAction.COPY)
self.connect('drag-data-received', self._handle_drag_data_received)
- #setup the focus flag
+ self.drag_dest_set_target_list(None)
+ self.drag_dest_add_text_targets()
+
+ # setup the focus flag
self._focus_flag = False
self.get_focus_flag = lambda: self._focus_flag
- def _handle_notify_event(widget, event, focus_flag): self._focus_flag = focus_flag
+
+ def _handle_notify_event(widget, event, focus_flag):
+ self._focus_flag = focus_flag
+
self.connect('leave-notify-event', _handle_notify_event, False)
self.connect('enter-notify-event', _handle_notify_event, True)
- self.set_flags(gtk.CAN_FOCUS) # self.set_can_focus(True)
- self.connect('focus-out-event', self._handle_focus_lost_event)
-
- def new_pixmap(self, width, height):
- return gtk.gdk.Pixmap(self.window, width, height, -1)
+ # todo: fix
+# self.set_flags(Gtk.CAN_FOCUS) # self.set_can_focus(True)
+# self.connect('focus-out-event', self._handle_focus_lost_event)
- def get_screenshot(self, transparent_bg=False):
- pixmap = self._pixmap
- W, H = pixmap.get_size()
- pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, 0, 8, W, H)
- pixbuf.fill(0xFF + Colors.FLOWGRAPH_BACKGROUND_COLOR.pixel << 8)
- pixbuf.get_from_drawable(pixmap, pixmap.get_colormap(), 0, 0, 0, 0, W-1, H-1)
- if transparent_bg:
- bgc = Colors.FLOWGRAPH_BACKGROUND_COLOR
- pixbuf = pixbuf.add_alpha(True, bgc.red, bgc.green, bgc.blue)
- return pixbuf
+ # Setup a map of the accelerator keys to the action to trigger
+ self.accels = {
+ Gtk.accelerator_parse('d'): Actions.BLOCK_DISABLE,
+ Gtk.accelerator_parse('e'): Actions.BLOCK_ENABLE,
+ Gtk.accelerator_parse('b'): Actions.BLOCK_BYPASS,
+ Gtk.accelerator_parse('c'): Actions.BLOCK_CREATE_HIER,
+ Gtk.accelerator_parse('Up'): Actions.BLOCK_DEC_TYPE,
+ Gtk.accelerator_parse('Down'): Actions.BLOCK_INC_TYPE,
+ Gtk.accelerator_parse('Left'): Actions.BLOCK_ROTATE_CCW,
+ Gtk.accelerator_parse('Right'): Actions.BLOCK_ROTATE_CW,
+ Gtk.accelerator_parse('minus'): Actions.PORT_CONTROLLER_DEC,
+ Gtk.accelerator_parse('plus'): Actions.PORT_CONTROLLER_INC,
+ Gtk.accelerator_parse('Add'): Actions.PORT_CONTROLLER_INC,
+ Gtk.accelerator_parse('Subtract'): Actions.PORT_CONTROLLER_DEC,
+ Gtk.accelerator_parse('Return'): Actions.BLOCK_PARAM_MODIFY,
+ Gtk.accelerator_parse('<Shift>t'): Actions.BLOCK_VALIGN_TOP,
+ Gtk.accelerator_parse('<Shift>m'): Actions.BLOCK_VALIGN_MIDDLE,
+ Gtk.accelerator_parse('<Shift>b'): Actions.BLOCK_VALIGN_BOTTOM,
+ Gtk.accelerator_parse('<Shift>l'): Actions.BLOCK_HALIGN_LEFT,
+ Gtk.accelerator_parse('<Shift>c'): Actions.BLOCK_HALIGN_CENTER,
+ Gtk.accelerator_parse('<Shift>r'): Actions.BLOCK_HALIGN_RIGHT,
+ }
##########################################################################
- ## Handlers
+ # Handlers
##########################################################################
def _handle_drag_data_received(self, widget, drag_context, x, y, selection_data, info, time):
"""
Handle a drag and drop by adding a block at the given coordinate.
"""
- self._flow_graph.add_new_block(selection_data.data, (x, y))
+ coords = x / self.zoom_factor, y / self.zoom_factor
+ self._flow_graph.add_new_block(selection_data.get_text(), coords)
def _handle_mouse_scroll(self, widget, event):
- if event.state & gtk.gdk.SHIFT_MASK:
- if event.direction == gtk.gdk.SCROLL_UP:
- event.direction = gtk.gdk.SCROLL_LEFT
- else:
- event.direction = gtk.gdk.SCROLL_RIGHT
+ if event.get_state() & Gdk.ModifierType.CONTROL_MASK:
+ change = 1.2 if event.direction == Gdk.ScrollDirection.UP else 1/1.2
+ zoom_factor = min(max(self.zoom_factor * change, 0.1), 5.0)
+
+ if zoom_factor != self.zoom_factor:
+ self.zoom_factor = zoom_factor
+ self._update_after_zoom = True
+ self.queue_draw()
+ return True
+
+ return False
def _handle_mouse_button_press(self, widget, event):
"""
Forward button click information to the flow graph.
"""
self.grab_focus()
- self.ctrl_mask = event.state & gtk.gdk.CONTROL_MASK
- self.mod1_mask = event.state & gtk.gdk.MOD1_MASK
- if event.button == 1: self._flow_graph.handle_mouse_selector_press(
- double_click=(event.type == gtk.gdk._2BUTTON_PRESS),
- coordinate=(event.x, event.y),
- )
- if event.button == 3: self._flow_graph.handle_mouse_context_press(
- coordinate=(event.x, event.y),
- event=event,
- )
+ self.ctrl_mask = event.get_state() & Gdk.ModifierType.CONTROL_MASK
+ self.mod1_mask = event.get_state() & Gdk.ModifierType.MOD1_MASK
+ self.button_state[event.button] = True
+
+ if event.button == 1:
+ double_click = (event.type == Gdk.EventType._2BUTTON_PRESS)
+ self.button_state[1] = not double_click
+ self._flow_graph.handle_mouse_selector_press(
+ double_click=double_click,
+ coordinate=self._translate_event_coords(event),
+ )
+ elif event.button == 3:
+ self._flow_graph.handle_mouse_context_press(
+ coordinate=self._translate_event_coords(event),
+ event=event,
+ )
def _handle_mouse_button_release(self, widget, event):
"""
Forward button release information to the flow graph.
"""
- self.ctrl_mask = event.state & gtk.gdk.CONTROL_MASK
- self.mod1_mask = event.state & gtk.gdk.MOD1_MASK
- if event.button == 1: self._flow_graph.handle_mouse_selector_release(
- coordinate=(event.x, event.y),
- )
+ self.ctrl_mask = event.get_state() & Gdk.ModifierType.CONTROL_MASK
+ self.mod1_mask = event.get_state() & Gdk.ModifierType.MOD1_MASK
+ self.button_state[event.button] = False
+ if event.button == 1:
+ self._flow_graph.handle_mouse_selector_release(
+ coordinate=self._translate_event_coords(event),
+ )
def _handle_mouse_motion(self, widget, event):
"""
Forward mouse motion information to the flow graph.
"""
- self.ctrl_mask = event.state & gtk.gdk.CONTROL_MASK
- self.mod1_mask = event.state & gtk.gdk.MOD1_MASK
+ self.ctrl_mask = event.get_state() & Gdk.ModifierType.CONTROL_MASK
+ self.mod1_mask = event.get_state() & Gdk.ModifierType.MOD1_MASK
+
+ if self.button_state[1]:
+ self._auto_scroll(event)
+
self._flow_graph.handle_mouse_motion(
- coordinate=(event.x, event.y),
+ coordinate=self._translate_event_coords(event),
)
+ def _handle_key_press(self, widget, event):
+ """
+ Handle specific keypresses when the drawing area has focus that
+ triggers actions by the user.
+ """
+ key = event.keyval
+ mod = event.state
+
+ try:
+ action = self.accels[(key, mod)]
+ action()
+ return True
+ except KeyError:
+ return False
+
+ def _update_size(self):
+ w, h = self._flow_graph.get_extents()[2:]
+ self.set_size_request(w * self.zoom_factor + 100, h * self.zoom_factor + 100)
+
+ def _auto_scroll(self, event):
+ x, y = event.x, event.y
+ scrollbox = self.get_parent().get_parent()
+
+ self._update_size()
+
+ def scroll(pos, adj):
+ """scroll if we moved near the border"""
+ adj_val = adj.get_value()
+ adj_len = adj.get_page_size()
+ if pos - adj_val > adj_len - Constants.SCROLL_PROXIMITY_SENSITIVITY:
+ adj.set_value(adj_val + Constants.SCROLL_DISTANCE)
+ adj.emit('changed')
+ elif pos - adj_val < Constants.SCROLL_PROXIMITY_SENSITIVITY:
+ adj.set_value(adj_val - Constants.SCROLL_DISTANCE)
+ adj.emit('changed')
+
+ scroll(x, scrollbox.get_hadjustment())
+ scroll(y, scrollbox.get_vadjustment())
+
def _handle_window_realize(self, widget):
"""
Called when the window is realized.
Update the flowgraph, which calls new pixmap.
"""
self._flow_graph.update()
+ self._update_size()
- def _handle_window_configure(self, widget, event):
- """
- Called when the window is resized.
- Create a new pixmap for background buffer.
- """
- self._pixmap = self.new_pixmap(*self.get_size_request())
+ def draw(self, widget, cr):
+ width = widget.get_allocated_width()
+ height = widget.get_allocated_height()
- def _handle_window_expose(self, widget, event):
- """
- Called when window is exposed, or queue_draw is called.
- Double buffering: draw to pixmap, then draw pixmap to window.
- """
- gc = self.window.new_gc()
- self._flow_graph.draw(gc, self._pixmap)
- self.window.draw_drawable(gc, self._pixmap, 0, 0, 0, 0, -1, -1)
- # draw a light grey line on the bottom and right end of the canvas.
- # this is useful when the theme uses the same panel bg color as the canvas
- W, H = self._pixmap.get_size()
- gc.set_foreground(Colors.FLOWGRAPH_EDGE_COLOR)
- self.window.draw_line(gc, 0, H-1, W, H-1)
- self.window.draw_line(gc, W-1, 0, W-1, H)
+ cr.set_source_rgba(*FLOWGRAPH_BACKGROUND_COLOR)
+ cr.rectangle(0, 0, width, height)
+ cr.fill()
+
+ cr.scale(self.zoom_factor, self.zoom_factor)
+ cr.set_line_width(2.0 / self.zoom_factor)
+
+ if self._update_after_zoom:
+ self._flow_graph.create_labels(cr)
+ self._flow_graph.create_shapes()
+ self._update_size()
+ self._update_after_zoom = False
+
+ self._flow_graph.draw(cr)
+
+ def _translate_event_coords(self, event):
+ return event.x / self.zoom_factor, event.y / self.zoom_factor
def _handle_focus_lost_event(self, widget, event):
# don't clear selection while context menu is active
- if not self._flow_graph.get_context_menu().flags() & gtk.VISIBLE:
+ if not self._flow_graph.context_menu.get_take_focus():
self._flow_graph.unselect()
self._flow_graph.update_selected()
self._flow_graph.queue_draw()
diff --git a/grc/gui/Element.py b/grc/gui/Element.py
deleted file mode 100644
index 938542477..000000000
--- a/grc/gui/Element.py
+++ /dev/null
@@ -1,278 +0,0 @@
-"""
-Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
-This file is part of GNU Radio
-
-GNU Radio Companion 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 2
-of the License, or (at your option) any later version.
-
-GNU Radio Companion 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 program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-"""
-
-from Constants import LINE_SELECT_SENSITIVITY
-from Constants import POSSIBLE_ROTATIONS
-
-import gtk
-
-
-class Element(object):
- """
- GraphicalElement is the base class for all graphical elements.
- It contains an X,Y coordinate, a list of rectangular areas that the element occupies,
- and methods to detect selection of those areas.
- """
-
- def __init__(self):
- """
- Make a new list of rectangular areas and lines, and set the coordinate and the rotation.
- """
- self.set_rotation(POSSIBLE_ROTATIONS[0])
- self.set_coordinate((0, 0))
- self.clear()
- self.set_highlighted(False)
- self.line_attributes = [
- 0, gtk.gdk.LINE_SOLID, gtk.gdk.CAP_BUTT, gtk.gdk.JOIN_MITER
- ]
-
- def is_horizontal(self, rotation=None):
- """
- Is this element horizontal?
- If rotation is None, use this element's rotation.
-
- Args:
- rotation: the optional rotation
-
- Returns:
- true if rotation is horizontal
- """
- rotation = rotation or self.get_rotation()
- return rotation in (0, 180)
-
- def is_vertical(self, rotation=None):
- """
- Is this element vertical?
- If rotation is None, use this element's rotation.
-
- Args:
- rotation: the optional rotation
-
- Returns:
- true if rotation is vertical
- """
- rotation = rotation or self.get_rotation()
- return rotation in (90, 270)
-
- def create_labels(self):
- """
- Create labels (if applicable) and call on all children.
- Call this base method before creating labels in the element.
- """
- for child in self.get_children():child.create_labels()
-
- def create_shapes(self):
- """
- Create shapes (if applicable) and call on all children.
- Call this base method before creating shapes in the element.
- """
- self.clear()
- for child in self.get_children(): child.create_shapes()
-
- def draw(self, gc, window, border_color, bg_color):
- """
- Draw in the given window.
-
- Args:
- gc: the graphics context
- window: the gtk window to draw on
- border_color: the color for lines and rectangle borders
- bg_color: the color for the inside of the rectangle
- """
- X, Y = self.get_coordinate()
- gc.set_line_attributes(*self.line_attributes)
- for (rX, rY), (W, H) in self._areas_list:
- aX = X + rX
- aY = Y + rY
- gc.set_foreground(bg_color)
- window.draw_rectangle(gc, True, aX, aY, W, H)
- gc.set_foreground(border_color)
- window.draw_rectangle(gc, False, aX, aY, W, H)
- for (x1, y1), (x2, y2) in self._lines_list:
- gc.set_foreground(border_color)
- gc.set_background(bg_color)
- window.draw_line(gc, X+x1, Y+y1, X+x2, Y+y2)
-
- def rotate(self, rotation):
- """
- Rotate all of the areas by 90 degrees.
-
- Args:
- rotation: multiple of 90 degrees
- """
- self.set_rotation((self.get_rotation() + rotation)%360)
-
- def clear(self):
- """Empty the lines and areas."""
- self._areas_list = list()
- self._lines_list = list()
-
- def set_coordinate(self, coor):
- """
- Set the reference coordinate.
-
- Args:
- coor: the coordinate tuple (x,y)
- """
- self.coor = coor
-
- # def get_parent(self):
- # """
- # Get the parent of this element.
- #
- # Returns:
- # the parent
- # """
- # return self.parent
-
- def set_highlighted(self, highlighted):
- """
- Set the highlight status.
-
- Args:
- highlighted: true to enable highlighting
- """
- self.highlighted = highlighted
-
- def is_highlighted(self):
- """
- Get the highlight status.
-
- Returns:
- true if highlighted
- """
- return self.highlighted
-
- def get_coordinate(self):
- """Get the coordinate.
-
- Returns:
- the coordinate tuple (x,y)
- """
- return self.coor
-
- def move(self, delta_coor):
- """
- Move the element by adding the delta_coor to the current coordinate.
-
- Args:
- delta_coor: (delta_x,delta_y) tuple
- """
- deltaX, deltaY = delta_coor
- X, Y = self.get_coordinate()
- self.set_coordinate((X+deltaX, Y+deltaY))
-
- def add_area(self, rel_coor, area):
- """
- Add an area to the area list.
- An area is actually a coordinate relative to the main coordinate
- with a width/height pair relative to the area coordinate.
- A positive width is to the right of the coordinate.
- A positive height is above the coordinate.
- The area is associated with a rotation.
-
- Args:
- rel_coor: (x,y) offset from this element's coordinate
- area: (width,height) tuple
- """
- self._areas_list.append((rel_coor, area))
-
- def add_line(self, rel_coor1, rel_coor2):
- """
- Add a line to the line list.
- A line is defined by 2 relative coordinates.
- Lines must be horizontal or vertical.
- The line is associated with a rotation.
-
- Args:
- rel_coor1: relative (x1,y1) tuple
- rel_coor2: relative (x2,y2) tuple
- """
- self._lines_list.append((rel_coor1, rel_coor2))
-
- def what_is_selected(self, coor, coor_m=None):
- """
- One coordinate specified:
- Is this element selected at given coordinate?
- ie: is the coordinate encompassed by one of the areas or lines?
- Both coordinates specified:
- Is this element within the rectangular region defined by both coordinates?
- ie: do any area corners or line endpoints fall within the region?
-
- Args:
- coor: the selection coordinate, tuple x, y
- coor_m: an additional selection coordinate.
-
- Returns:
- self if one of the areas/lines encompasses coor, else None.
- """
- #function to test if p is between a and b (inclusive)
- in_between = lambda p, a, b: p >= min(a, b) and p <= max(a, b)
- #relative coordinate
- x, y = [a-b for a,b in zip(coor, self.get_coordinate())]
- if coor_m:
- x_m, y_m = [a-b for a,b in zip(coor_m, self.get_coordinate())]
- #handle rectangular areas
- for (x1,y1), (w,h) in self._areas_list:
- if in_between(x1, x, x_m) and in_between(y1, y, y_m) or \
- in_between(x1+w, x, x_m) and in_between(y1, y, y_m) or \
- in_between(x1, x, x_m) and in_between(y1+h, y, y_m) or \
- in_between(x1+w, x, x_m) and in_between(y1+h, y, y_m):
- return self
- #handle horizontal or vertical lines
- for (x1, y1), (x2, y2) in self._lines_list:
- if in_between(x1, x, x_m) and in_between(y1, y, y_m) or \
- in_between(x2, x, x_m) and in_between(y2, y, y_m):
- return self
- return None
- else:
- #handle rectangular areas
- for (x1,y1), (w,h) in self._areas_list:
- if in_between(x, x1, x1+w) and in_between(y, y1, y1+h): return self
- #handle horizontal or vertical lines
- for (x1, y1), (x2, y2) in self._lines_list:
- if x1 == x2: x1, x2 = x1-LINE_SELECT_SENSITIVITY, x2+LINE_SELECT_SENSITIVITY
- if y1 == y2: y1, y2 = y1-LINE_SELECT_SENSITIVITY, y2+LINE_SELECT_SENSITIVITY
- if in_between(x, x1, x2) and in_between(y, y1, y2): return self
- return None
-
- def get_rotation(self):
- """
- Get the rotation in degrees.
-
- Returns:
- the rotation
- """
- return self.rotation
-
- def set_rotation(self, rotation):
- """
- Set the rotation in degrees.
-
- Args:
- rotation: the rotation"""
- if rotation not in POSSIBLE_ROTATIONS:
- raise Exception('"%s" is not one of the possible rotations: (%s)'%(rotation, POSSIBLE_ROTATIONS))
- self.rotation = rotation
-
- def mouse_over(self):
- pass
-
- def mouse_out(self):
- pass
diff --git a/grc/gui/Executor.py b/grc/gui/Executor.py
index 4082cea18..7db0c955c 100644
--- a/grc/gui/Executor.py
+++ b/grc/gui/Executor.py
@@ -15,14 +15,16 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+from __future__ import absolute_import
+
+import os
+import shlex
import subprocess
import threading
from distutils.spawn import find_executable
-import gobject
-import os
+from gi.repository import GLib
-from ..core.utils import shlex
from ..core import Messages
@@ -32,20 +34,16 @@ class ExecFlowGraphThread(threading.Thread):
def __init__(self, flow_graph_page, xterm_executable, callback):
"""
ExecFlowGraphThread constructor.
-
- Args:
- action_handler: an instance of an ActionHandler
"""
threading.Thread.__init__(self)
self.page = flow_graph_page # store page and don't use main window calls in run
- self.flow_graph = self.page.get_flow_graph()
+ self.flow_graph = self.page.flow_graph
self.xterm_executable = xterm_executable
self.update_callback = callback
try:
- self.process = self._popen()
- self.page.set_proc(self.process)
+ self.process = self.page.process = self._popen()
self.update_callback()
self.start()
except Exception as e:
@@ -79,18 +77,18 @@ class ExecFlowGraphThread(threading.Thread):
def run(self):
"""
Wait on the executing process by reading from its stdout.
- Use gobject.idle_add when calling functions that modify gtk objects.
+ Use GObject.idle_add when calling functions that modify gtk objects.
"""
# handle completion
r = "\n"
while r:
- gobject.idle_add(Messages.send_verbose_exec, r)
+ GLib.idle_add(Messages.send_verbose_exec, r)
r = os.read(self.process.stdout.fileno(), 1024)
self.process.poll()
- gobject.idle_add(self.done)
+ GLib.idle_add(self.done)
def done(self):
"""Perform end of execution tasks."""
Messages.send_end_exec(self.process.returncode)
- self.page.set_proc(None)
+ self.page.process = None
self.update_callback()
diff --git a/grc/gui/FileDialogs.py b/grc/gui/FileDialogs.py
index 30978bbf9..e8c5800d6 100644
--- a/grc/gui/FileDialogs.py
+++ b/grc/gui/FileDialogs.py
@@ -17,140 +17,99 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-import pygtk
-pygtk.require('2.0')
-import gtk
-from Dialogs import MessageDialogHelper
-from Constants import \
- DEFAULT_FILE_PATH, IMAGE_FILE_EXTENSION, TEXT_FILE_EXTENSION, \
- NEW_FLOGRAPH_TITLE
-import Preferences
-from os import path
-import Utils
-
-##################################################
-# Constants
-##################################################
-OPEN_FLOW_GRAPH = 'open flow graph'
-SAVE_FLOW_GRAPH = 'save flow graph'
-SAVE_CONSOLE = 'save console'
-SAVE_IMAGE = 'save image'
-OPEN_QSS_THEME = 'open qss theme'
-
-FILE_OVERWRITE_MARKUP_TMPL="""\
-File <b>$encode($filename)</b> Exists!\nWould you like to overwrite the existing file?"""
-
-FILE_DNE_MARKUP_TMPL="""\
-File <b>$encode($filename)</b> Does not Exist!"""
-
-
-
-# File Filters
-def get_flow_graph_files_filter():
- filter = gtk.FileFilter()
- filter.set_name('Flow Graph Files')
- filter.add_pattern('*'+Preferences.file_extension())
- return filter
-
-
-def get_text_files_filter():
- filter = gtk.FileFilter()
- filter.set_name('Text Files')
- filter.add_pattern('*'+TEXT_FILE_EXTENSION)
- return filter
-
-
-def get_image_files_filter():
- filter = gtk.FileFilter()
- filter.set_name('Image Files')
- filter.add_pattern('*'+IMAGE_FILE_EXTENSION)
- return filter
+from __future__ import absolute_import
+from os import path
-def get_all_files_filter():
- filter = gtk.FileFilter()
- filter.set_name('All Files')
- filter.add_pattern('*')
- return filter
-
+from gi.repository import Gtk
-def get_qss_themes_filter():
- filter = gtk.FileFilter()
- filter.set_name('QSS Themes')
- filter.add_pattern('*.qss')
- return filter
+from . import Constants, Utils, Dialogs
-# File Dialogs
-class FileDialogHelper(gtk.FileChooserDialog):
+class FileDialogHelper(Gtk.FileChooserDialog, object):
"""
A wrapper class for the gtk file chooser dialog.
Implement a file chooser dialog with only necessary parameters.
"""
+ title = ''
+ action = Gtk.FileChooserAction.OPEN
+ filter_label = ''
+ filter_ext = ''
- def __init__(self, action, title):
+ def __init__(self, parent, current_file_path):
"""
FileDialogHelper constructor.
Create a save or open dialog with cancel and ok buttons.
Use standard settings: no multiple selection, local files only, and the * filter.
Args:
- action: gtk.FILE_CHOOSER_ACTION_OPEN or gtk.FILE_CHOOSER_ACTION_SAVE
+ action: Gtk.FileChooserAction.OPEN or Gtk.FileChooserAction.SAVE
title: the title of the dialog (string)
"""
- ok_stock = {gtk.FILE_CHOOSER_ACTION_OPEN : 'gtk-open', gtk.FILE_CHOOSER_ACTION_SAVE : 'gtk-save'}[action]
- gtk.FileChooserDialog.__init__(self, title, None, action, ('gtk-cancel', gtk.RESPONSE_CANCEL, ok_stock, gtk.RESPONSE_OK))
+ ok_stock = {
+ Gtk.FileChooserAction.OPEN: 'gtk-open',
+ Gtk.FileChooserAction.SAVE: 'gtk-save'
+ }[self.action]
+
+ Gtk.FileChooserDialog.__init__(self, title=self.title, action=self.action,
+ transient_for=parent)
+ self.add_buttons('gtk-cancel', Gtk.ResponseType.CANCEL, ok_stock, Gtk.ResponseType.OK)
self.set_select_multiple(False)
self.set_local_only(True)
- self.add_filter(get_all_files_filter())
+
+ self.parent = parent
+ self.current_file_path = current_file_path or path.join(
+ Constants.DEFAULT_FILE_PATH, Constants.NEW_FLOGRAPH_TITLE + Constants.FILE_EXTENSION)
+
+ self.set_current_folder(path.dirname(current_file_path)) # current directory
+ self.setup_filters()
+
+ def setup_filters(self, filters=None):
+ set_default = True
+ filters = filters or ([(self.filter_label, self.filter_ext)] if self.filter_label else [])
+ filters.append(('All Files', ''))
+ for label, ext in filters:
+ if not label:
+ continue
+ f = Gtk.FileFilter()
+ f.set_name(label)
+ f.add_pattern('*' + ext)
+ self.add_filter(f)
+ if not set_default:
+ self.set_filter(f)
+ set_default = True
+
+ def run(self):
+ """Get the filename and destroy the dialog."""
+ response = Gtk.FileChooserDialog.run(self)
+ filename = self.get_filename() if response == Gtk.ResponseType.OK else None
+ self.destroy()
+ return filename
-class FileDialog(FileDialogHelper):
+class SaveFileDialog(FileDialogHelper):
"""A dialog box to save or open flow graph files. This is a base class, do not use."""
+ action = Gtk.FileChooserAction.SAVE
- def __init__(self, current_file_path=''):
- """
- FileDialog constructor.
+ def __init__(self, parent, current_file_path):
+ super(SaveFileDialog, self).__init__(parent, current_file_path)
+ self.set_current_name(path.splitext(path.basename(self.current_file_path))[0] + self.filter_ext)
+ self.set_create_folders(True)
+ self.set_do_overwrite_confirmation(True)
- Args:
- current_file_path: the current directory or path to the open flow graph
- """
- if not current_file_path: current_file_path = path.join(DEFAULT_FILE_PATH, NEW_FLOGRAPH_TITLE + Preferences.file_extension())
- if self.type == OPEN_FLOW_GRAPH:
- FileDialogHelper.__init__(self, gtk.FILE_CHOOSER_ACTION_OPEN, 'Open a Flow Graph from a File...')
- self.add_and_set_filter(get_flow_graph_files_filter())
- self.set_select_multiple(True)
- elif self.type == SAVE_FLOW_GRAPH:
- FileDialogHelper.__init__(self, gtk.FILE_CHOOSER_ACTION_SAVE, 'Save a Flow Graph to a File...')
- self.add_and_set_filter(get_flow_graph_files_filter())
- self.set_current_name(path.basename(current_file_path))
- elif self.type == SAVE_CONSOLE:
- FileDialogHelper.__init__(self, gtk.FILE_CHOOSER_ACTION_SAVE, 'Save Console to a File...')
- self.add_and_set_filter(get_text_files_filter())
- file_path = path.splitext(path.basename(current_file_path))[0]
- self.set_current_name(file_path) #show the current filename
- elif self.type == SAVE_IMAGE:
- FileDialogHelper.__init__(self, gtk.FILE_CHOOSER_ACTION_SAVE, 'Save a Flow Graph Screen Shot...')
- self.add_and_set_filter(get_image_files_filter())
- current_file_path = current_file_path + IMAGE_FILE_EXTENSION
- self.set_current_name(path.basename(current_file_path)) #show the current filename
- elif self.type == OPEN_QSS_THEME:
- FileDialogHelper.__init__(self, gtk.FILE_CHOOSER_ACTION_OPEN, 'Open a QSS theme...')
- self.add_and_set_filter(get_qss_themes_filter())
- self.set_select_multiple(False)
- self.set_current_folder(path.dirname(current_file_path)) #current directory
-
- def add_and_set_filter(self, filter):
- """
- Add the gtk file filter to the list of filters and set it as the default file filter.
- Args:
- filter: a gtk file filter.
- """
- self.add_filter(filter)
- self.set_filter(filter)
+class OpenFileDialog(FileDialogHelper):
+ """A dialog box to save or open flow graph files. This is a base class, do not use."""
+ action = Gtk.FileChooserAction.OPEN
+
+ def show_missing_message(self, filename):
+ Dialogs.MessageDialogWrapper(
+ self.parent,
+ Gtk.MessageType.WARNING, Gtk.ButtonsType.CLOSE, 'Cannot Open!',
+ 'File <b>{filename}</b> Does not Exist!'.format(filename=Utils.encode(filename)),
+ ).run_and_destroy()
- def get_rectified_filename(self):
+ def get_filename(self):
"""
Run the dialog and get the filename.
If this is a save dialog and the file name is missing the extension, append the file extension.
@@ -160,82 +119,82 @@ class FileDialog(FileDialogHelper):
Returns:
the complete file path
"""
- if gtk.FileChooserDialog.run(self) != gtk.RESPONSE_OK: return None #response was cancel
- #############################################
- # Handle Save Dialogs
- #############################################
- if self.type in (SAVE_FLOW_GRAPH, SAVE_CONSOLE, SAVE_IMAGE):
- filename = self.get_filename()
- extension = {
- SAVE_FLOW_GRAPH: Preferences.file_extension(),
- SAVE_CONSOLE: TEXT_FILE_EXTENSION,
- SAVE_IMAGE: IMAGE_FILE_EXTENSION,
- }[self.type]
- #append the missing file extension if the filter matches
- if path.splitext(filename)[1].lower() != extension: filename += extension
- self.set_current_name(path.basename(filename)) #show the filename with extension
- if path.exists(filename): #ask the user to confirm overwrite
- if MessageDialogHelper(
- gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, 'Confirm Overwrite!',
- Utils.parse_template(FILE_OVERWRITE_MARKUP_TMPL, filename=filename),
- ) == gtk.RESPONSE_NO: return self.get_rectified_filename()
- return filename
- #############################################
- # Handle Open Dialogs
- #############################################
- elif self.type in (OPEN_FLOW_GRAPH, OPEN_QSS_THEME):
- filenames = self.get_filenames()
- for filename in filenames:
- if not path.exists(filename): #show a warning and re-run
- MessageDialogHelper(
- gtk.MESSAGE_WARNING, gtk.BUTTONS_CLOSE, 'Cannot Open!',
- Utils.parse_template(FILE_DNE_MARKUP_TMPL, filename=filename),
- )
- return self.get_rectified_filename()
- return filenames
+ filenames = Gtk.FileChooserDialog.get_filenames(self)
+ for filename in filenames:
+ if not path.exists(filename):
+ self.show_missing_message(filename)
+ return None # rerun
+ return filenames
- def run(self):
- """
- Get the filename and destroy the dialog.
-
- Returns:
- the filename or None if a close/cancel occurred.
- """
- filename = self.get_rectified_filename()
- self.destroy()
- return filename
+class OpenFlowGraph(OpenFileDialog):
+ title = 'Open a Flow Graph from a File...'
+ filter_label = 'Flow Graph Files'
+ filter_ext = Constants.FILE_EXTENSION
-class OpenFlowGraphFileDialog(FileDialog):
- type = OPEN_FLOW_GRAPH
+ def __init__(self, parent, current_file_path=''):
+ super(OpenFlowGraph, self).__init__(parent, current_file_path)
+ self.set_select_multiple(True)
-class SaveFlowGraphFileDialog(FileDialog):
- type = SAVE_FLOW_GRAPH
+class OpenQSS(OpenFileDialog):
+ title = 'Open a QSS theme...'
+ filter_label = 'QSS Themes'
+ filter_ext = '.qss'
-class OpenQSSFileDialog(FileDialog):
- type = OPEN_QSS_THEME
+class SaveFlowGraph(SaveFileDialog):
+ title = 'Save a Flow Graph to a File...'
+ filter_label = 'Flow Graph Files'
+ filter_ext = Constants.FILE_EXTENSION
-class SaveConsoleFileDialog(FileDialog):
- type = SAVE_CONSOLE
+class SaveConsole(SaveFileDialog):
+ title = 'Save Console to a File...'
+ filter_label = 'Test Files'
+ filter_ext = '.txt'
-class SaveImageFileDialog(FileDialog):
- type = SAVE_IMAGE
+class SaveScreenShot(SaveFileDialog):
+ title = 'Save a Flow Graph Screen Shot...'
+ filters = [('PDF Files', '.pdf'), ('PNG Files', '.png'), ('SVG Files', '.svg')]
+ filter_ext = '.pdf' # the default
+ def __init__(self, parent, current_file_path=''):
+ super(SaveScreenShot, self).__init__(parent, current_file_path)
-class SaveScreenShotDialog(SaveImageFileDialog):
+ self.config = Gtk.Application.get_default().config
- def __init__(self, current_file_path=''):
- SaveImageFileDialog.__init__(self, current_file_path)
- self._button = button = gtk.CheckButton('_Background transparent')
- self._button.set_active(Preferences.screen_shot_background_transparent())
+ self._button = button = Gtk.CheckButton(label='Background transparent')
+ self._button.set_active(self.config.screen_shot_background_transparent())
self.set_extra_widget(button)
+ def setup_filters(self, filters=None):
+ super(SaveScreenShot, self).setup_filters(self.filters)
+
+ def show_missing_message(self, filename):
+ Dialogs.MessageDialogWrapper(
+ self.parent,
+ Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE, 'Can not Save!',
+ 'File Extention of <b>{filename}</b> not supported!'.format(filename=Utils.encode(filename)),
+ ).run_and_destroy()
+
def run(self):
- filename = SaveImageFileDialog.run(self)
+ valid_exts = {ext for label, ext in self.filters}
+ filename = None
+ while True:
+ response = Gtk.FileChooserDialog.run(self)
+ if response != Gtk.ResponseType.OK:
+ filename = None
+ break
+
+ filename = self.get_filename()
+ if path.splitext(filename)[1] in valid_exts:
+ break
+
+ self.show_missing_message(filename)
+
bg_transparent = self._button.get_active()
- Preferences.screen_shot_background_transparent(bg_transparent)
+ self.config.screen_shot_background_transparent(bg_transparent)
+ self.destroy()
return filename, bg_transparent
diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py
deleted file mode 100644
index 5bcf01812..000000000
--- a/grc/gui/FlowGraph.py
+++ /dev/null
@@ -1,765 +0,0 @@
-"""
-Copyright 2007-2011 Free Software Foundation, Inc.
-This file is part of GNU Radio
-
-GNU Radio Companion 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 2
-of the License, or (at your option) any later version.
-
-GNU Radio Companion 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 program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-"""
-
-import functools
-import random
-from distutils.spawn import find_executable
-from itertools import chain, count
-from operator import methodcaller
-
-import gobject
-
-from . import Actions, Colors, Constants, Utils, Bars, Dialogs
-from .Constants import SCROLL_PROXIMITY_SENSITIVITY, SCROLL_DISTANCE
-from .Element import Element
-from .external_editor import ExternalEditor
-
-from ..core.FlowGraph import FlowGraph as _Flowgraph
-from ..core import Messages
-
-
-class FlowGraph(Element, _Flowgraph):
- """
- FlowGraph is the data structure to store graphical signal blocks,
- graphical inputs and outputs,
- and the connections between inputs and outputs.
- """
-
- def __init__(self, **kwargs):
- """
- FlowGraph constructor.
- Create a list for signal blocks and connections. Connect mouse handlers.
- """
- Element.__init__(self)
- _Flowgraph.__init__(self, **kwargs)
- #when is the flow graph selected? (used by keyboard event handler)
- self.is_selected = lambda: bool(self.get_selected_elements())
- #important vars dealing with mouse event tracking
- self.element_moved = False
- self.mouse_pressed = False
- self._selected_elements = []
- self.press_coor = (0, 0)
- #selected ports
- self._old_selected_port = None
- self._new_selected_port = None
- # current mouse hover element
- self.element_under_mouse = None
- #context menu
- self._context_menu = Bars.ContextMenu()
- self.get_context_menu = lambda: self._context_menu
-
- self._external_updaters = {}
-
- def _get_unique_id(self, base_id=''):
- """
- Get a unique id starting with the base id.
-
- Args:
- base_id: the id starts with this and appends a count
-
- Returns:
- a unique id
- """
- for index in count():
- block_id = '{}_{}'.format(base_id, index)
- if block_id not in (b.get_id() for b in self.blocks):
- break
- return block_id
-
- def install_external_editor(self, param):
- target = (param.get_parent().get_id(), param.get_key())
-
- if target in self._external_updaters:
- editor = self._external_updaters[target]
- else:
- config = self.get_parent().config
- editor = (find_executable(config.editor) or
- Dialogs.ChooseEditorDialog(config))
- if not editor:
- return
- updater = functools.partial(
- self.handle_external_editor_change, target=target)
- editor = self._external_updaters[target] = ExternalEditor(
- editor=editor,
- name=target[0], value=param.get_value(),
- callback=functools.partial(gobject.idle_add, updater)
- )
- editor.start()
- try:
- editor.open_editor()
- except Exception as e:
- # Problem launching the editor. Need to select a new editor.
- Messages.send('>>> Error opening an external editor. Please select a different editor.\n')
- # Reset the editor to force the user to select a new one.
- self.get_parent().config.editor = ''
-
- def handle_external_editor_change(self, new_value, target):
- try:
- block_id, param_key = target
- self.get_block(block_id).get_param(param_key).set_value(new_value)
-
- except (IndexError, ValueError): # block no longer exists
- self._external_updaters[target].stop()
- del self._external_updaters[target]
- return
- Actions.EXTERNAL_UPDATE()
-
-
- ###########################################################################
- # Access Drawing Area
- ###########################################################################
- def get_drawing_area(self): return self.drawing_area
- def queue_draw(self): self.get_drawing_area().queue_draw()
- def get_size(self): return self.get_drawing_area().get_size_request()
- def set_size(self, *args): self.get_drawing_area().set_size_request(*args)
- def get_scroll_pane(self): return self.drawing_area.get_parent()
- def get_ctrl_mask(self): return self.drawing_area.ctrl_mask
- def get_mod1_mask(self): return self.drawing_area.mod1_mask
- def new_pixmap(self, *args): return self.get_drawing_area().new_pixmap(*args)
-
- def add_new_block(self, key, coor=None):
- """
- Add a block of the given key to this flow graph.
-
- Args:
- key: the block key
- coor: an optional coordinate or None for random
- """
- id = self._get_unique_id(key)
- #calculate the position coordinate
- W, H = self.get_size()
- h_adj = self.get_scroll_pane().get_hadjustment()
- v_adj = self.get_scroll_pane().get_vadjustment()
- if coor is None: coor = (
- int(random.uniform(.25, .75) * min(h_adj.page_size, W) +
- h_adj.get_value()),
- int(random.uniform(.25, .75) * min(v_adj.page_size, H) +
- v_adj.get_value()),
- )
- #get the new block
- block = self.new_block(key)
- block.set_coordinate(coor)
- block.set_rotation(0)
- block.get_param('id').set_value(id)
- Actions.ELEMENT_CREATE()
- return id
-
- ###########################################################################
- # Copy Paste
- ###########################################################################
- def copy_to_clipboard(self):
- """
- Copy the selected blocks and connections into the clipboard.
-
- Returns:
- the clipboard
- """
- #get selected blocks
- blocks = self.get_selected_blocks()
- if not blocks: return None
- #calc x and y min
- x_min, y_min = blocks[0].get_coordinate()
- for block in blocks:
- x, y = block.get_coordinate()
- x_min = min(x, x_min)
- y_min = min(y, y_min)
- #get connections between selected blocks
- connections = filter(
- lambda c: c.get_source().get_parent() in blocks and c.get_sink().get_parent() in blocks,
- self.connections,
- )
- clipboard = (
- (x_min, y_min),
- [block.export_data() for block in blocks],
- [connection.export_data() for connection in connections],
- )
- return clipboard
-
- def paste_from_clipboard(self, clipboard):
- """
- Paste the blocks and connections from the clipboard.
-
- Args:
- clipboard: the nested data of blocks, connections
- """
- selected = set()
- (x_min, y_min), blocks_n, connections_n = clipboard
- old_id2block = dict()
- #recalc the position
- h_adj = self.get_scroll_pane().get_hadjustment()
- v_adj = self.get_scroll_pane().get_vadjustment()
- x_off = h_adj.get_value() - x_min + h_adj.page_size/4
- y_off = v_adj.get_value() - y_min + v_adj.page_size/4
- if len(self.get_elements()) <= 1:
- x_off, y_off = 0, 0
- #create blocks
- for block_n in blocks_n:
- block_key = block_n.find('key')
- if block_key == 'options': continue
- block = self.new_block(block_key)
- if not block:
- continue # unknown block was pasted (e.g. dummy block)
- selected.add(block)
- #set params
- params = dict((n.find('key'), n.find('value'))
- for n in block_n.findall('param'))
- if block_key == 'epy_block':
- block.get_param('_io_cache').set_value(params.pop('_io_cache'))
- block.get_param('_source_code').set_value(params.pop('_source_code'))
- block.rewrite() # this creates the other params
- for param_key, param_value in params.iteritems():
- #setup id parameter
- if param_key == 'id':
- old_id2block[param_value] = block
- #if the block id is not unique, get a new block id
- if param_value in (blk.get_id() for blk in self.blocks):
- param_value = self._get_unique_id(param_value)
- #set value to key
- block.get_param(param_key).set_value(param_value)
- #move block to offset coordinate
- block.move((x_off, y_off))
- #update before creating connections
- self.update()
- #create connections
- for connection_n in connections_n:
- source = old_id2block[connection_n.find('source_block_id')].get_source(connection_n.find('source_key'))
- sink = old_id2block[connection_n.find('sink_block_id')].get_sink(connection_n.find('sink_key'))
- self.connect(source, sink)
- #set all pasted elements selected
- for block in selected: selected = selected.union(set(block.get_connections()))
- self._selected_elements = list(selected)
-
- ###########################################################################
- # Modify Selected
- ###########################################################################
- def type_controller_modify_selected(self, direction):
- """
- Change the registered type controller for the selected signal blocks.
-
- Args:
- direction: +1 or -1
-
- Returns:
- true for change
- """
- return any([sb.type_controller_modify(direction) for sb in self.get_selected_blocks()])
-
- def port_controller_modify_selected(self, direction):
- """
- Change port controller for the selected signal blocks.
-
- Args:
- direction: +1 or -1
-
- Returns:
- true for changed
- """
- return any([sb.port_controller_modify(direction) for sb in self.get_selected_blocks()])
-
- def enable_selected(self, enable):
- """
- Enable/disable the selected blocks.
-
- Args:
- enable: true to enable
-
- Returns:
- true if changed
- """
- changed = False
- for selected_block in self.get_selected_blocks():
- if selected_block.set_enabled(enable): changed = True
- return changed
-
- def bypass_selected(self):
- """
- Bypass the selected blocks.
-
- Args:
- None
- Returns:
- true if changed
- """
- changed = False
- for selected_block in self.get_selected_blocks():
- if selected_block.set_bypassed(): changed = True
- return changed
-
- def move_selected(self, delta_coordinate):
- """
- Move the element and by the change in coordinates.
-
- Args:
- delta_coordinate: the change in coordinates
- """
- for selected_block in self.get_selected_blocks():
- delta_coordinate = selected_block.bound_move_delta(delta_coordinate)
-
- for selected_block in self.get_selected_blocks():
- selected_block.move(delta_coordinate)
- self.element_moved = True
-
- def align_selected(self, calling_action=None):
- """
- Align the selected blocks.
-
- Args:
- calling_action: the action initiating the alignment
-
- Returns:
- True if changed, otherwise False
- """
- blocks = self.get_selected_blocks()
- if calling_action is None or not blocks:
- return False
-
- # compute common boundary of selected objects
- min_x, min_y = max_x, max_y = blocks[0].get_coordinate()
- for selected_block in blocks:
- x, y = selected_block.get_coordinate()
- min_x, min_y = min(min_x, x), min(min_y, y)
- x += selected_block.W
- y += selected_block.H
- max_x, max_y = max(max_x, x), max(max_y, y)
- ctr_x, ctr_y = (max_x + min_x)/2, (max_y + min_y)/2
-
- # align the blocks as requested
- transform = {
- Actions.BLOCK_VALIGN_TOP: lambda x, y, w, h: (x, min_y),
- Actions.BLOCK_VALIGN_MIDDLE: lambda x, y, w, h: (x, ctr_y - h/2),
- Actions.BLOCK_VALIGN_BOTTOM: lambda x, y, w, h: (x, max_y - h),
- Actions.BLOCK_HALIGN_LEFT: lambda x, y, w, h: (min_x, y),
- Actions.BLOCK_HALIGN_CENTER: lambda x, y, w, h: (ctr_x-w/2, y),
- Actions.BLOCK_HALIGN_RIGHT: lambda x, y, w, h: (max_x - w, y),
- }.get(calling_action, lambda *args: args)
-
- for selected_block in blocks:
- x, y = selected_block.get_coordinate()
- w, h = selected_block.W, selected_block.H
- selected_block.set_coordinate(transform(x, y, w, h))
-
- return True
-
- def rotate_selected(self, rotation):
- """
- Rotate the selected blocks by multiples of 90 degrees.
-
- Args:
- rotation: the rotation in degrees
-
- Returns:
- true if changed, otherwise false.
- """
- if not self.get_selected_blocks():
- return False
- #initialize min and max coordinates
- min_x, min_y = self.get_selected_block().get_coordinate()
- max_x, max_y = self.get_selected_block().get_coordinate()
- #rotate each selected block, and find min/max coordinate
- for selected_block in self.get_selected_blocks():
- selected_block.rotate(rotation)
- #update the min/max coordinate
- x, y = selected_block.get_coordinate()
- min_x, min_y = min(min_x, x), min(min_y, y)
- max_x, max_y = max(max_x, x), max(max_y, y)
- #calculate center point of slected blocks
- ctr_x, ctr_y = (max_x + min_x)/2, (max_y + min_y)/2
- #rotate the blocks around the center point
- for selected_block in self.get_selected_blocks():
- x, y = selected_block.get_coordinate()
- x, y = Utils.get_rotated_coordinate((x - ctr_x, y - ctr_y), rotation)
- selected_block.set_coordinate((x + ctr_x, y + ctr_y))
- return True
-
- def remove_selected(self):
- """
- Remove selected elements
-
- Returns:
- true if changed.
- """
- changed = False
- for selected_element in self.get_selected_elements():
- self.remove_element(selected_element)
- changed = True
- return changed
-
- def draw(self, gc, window):
- """
- Draw the background and grid if enabled.
- Draw all of the elements in this flow graph onto the pixmap.
- Draw the pixmap to the drawable window of this flow graph.
- """
-
- W, H = self.get_size()
- hide_disabled_blocks = Actions.TOGGLE_HIDE_DISABLED_BLOCKS.get_active()
- hide_variables = Actions.TOGGLE_HIDE_VARIABLES.get_active()
-
- #draw the background
- gc.set_foreground(Colors.FLOWGRAPH_BACKGROUND_COLOR)
- window.draw_rectangle(gc, True, 0, 0, W, H)
-
- # draw comments first
- if Actions.TOGGLE_SHOW_BLOCK_COMMENTS.get_active():
- for block in self.blocks:
- if hide_variables and (block.is_variable or block.is_import):
- continue # skip hidden disabled blocks and connections
- if block.get_enabled():
- block.draw_comment(gc, window)
- #draw multi select rectangle
- if self.mouse_pressed and (not self.get_selected_elements() or self.get_ctrl_mask()):
- #coordinates
- x1, y1 = self.press_coor
- x2, y2 = self.get_coordinate()
- #calculate top-left coordinate and width/height
- x, y = int(min(x1, x2)), int(min(y1, y2))
- w, h = int(abs(x1 - x2)), int(abs(y1 - y2))
- #draw
- gc.set_foreground(Colors.HIGHLIGHT_COLOR)
- window.draw_rectangle(gc, True, x, y, w, h)
- gc.set_foreground(Colors.BORDER_COLOR)
- window.draw_rectangle(gc, False, x, y, w, h)
- #draw blocks on top of connections
- blocks = sorted(self.blocks, key=methodcaller('get_enabled'))
- for element in chain(self.connections, blocks):
- if hide_disabled_blocks and not element.get_enabled():
- continue # skip hidden disabled blocks and connections
- if hide_variables and (element.is_variable or element.is_import):
- continue # skip hidden disabled blocks and connections
- element.draw(gc, window)
- #draw selected blocks on top of selected connections
- for selected_element in self.get_selected_connections() + self.get_selected_blocks():
- selected_element.draw(gc, window)
-
- def update_selected(self):
- """
- Remove deleted elements from the selected elements list.
- Update highlighting so only the selected are highlighted.
- """
- selected_elements = self.get_selected_elements()
- elements = self.get_elements()
- #remove deleted elements
- for selected in selected_elements:
- if selected in elements: continue
- selected_elements.remove(selected)
- if self._old_selected_port and self._old_selected_port.get_parent() not in elements:
- self._old_selected_port = None
- if self._new_selected_port and self._new_selected_port.get_parent() not in elements:
- self._new_selected_port = None
- #update highlighting
- for element in elements:
- element.set_highlighted(element in selected_elements)
-
- def update(self):
- """
- Call the top level rewrite and validate.
- Call the top level create labels and shapes.
- """
- self.rewrite()
- self.validate()
- self.create_labels()
- self.create_shapes()
-
- def reload(self):
- """
- Reload flow-graph (with updated blocks)
-
- Args:
- page: the page to reload (None means current)
- Returns:
- False if some error occurred during import
- """
- success = False
- data = self.export_data()
- if data:
- self.unselect()
- success = self.import_data(data)
- self.update()
- return success
-
- ##########################################################################
- ## Get Selected
- ##########################################################################
- def unselect(self):
- """
- Set selected elements to an empty set.
- """
- self._selected_elements = []
-
- def select_all(self):
- """Select all blocks in the flow graph"""
- self._selected_elements = list(self.get_elements())
-
- def what_is_selected(self, coor, coor_m=None):
- """
- What is selected?
- At the given coordinate, return the elements found to be selected.
- If coor_m is unspecified, return a list of only the first element found to be selected:
- Iterate though the elements backwards since top elements are at the end of the list.
- If an element is selected, place it at the end of the list so that is is drawn last,
- and hence on top. Update the selected port information.
-
- Args:
- coor: the coordinate of the mouse click
- coor_m: the coordinate for multi select
-
- Returns:
- the selected blocks and connections or an empty list
- """
- selected_port = None
- selected = set()
- #check the elements
- hide_disabled_blocks = Actions.TOGGLE_HIDE_DISABLED_BLOCKS.get_active()
- hide_variables = Actions.TOGGLE_HIDE_VARIABLES.get_active()
- for element in reversed(self.get_elements()):
- if hide_disabled_blocks and not element.get_enabled():
- continue # skip hidden disabled blocks and connections
- if hide_variables and (element.is_variable or element.is_import):
- continue # skip hidden disabled blocks and connections
- selected_element = element.what_is_selected(coor, coor_m)
- if not selected_element:
- continue
- #update the selected port information
- if selected_element.is_port:
- if not coor_m: selected_port = selected_element
- selected_element = selected_element.get_parent()
- selected.add(selected_element)
- #place at the end of the list
- self.get_elements().remove(element)
- self.get_elements().append(element)
- #single select mode, break
- if not coor_m: break
- #update selected ports
- if selected_port is not self._new_selected_port:
- self._old_selected_port = self._new_selected_port
- self._new_selected_port = selected_port
- return list(selected)
-
- def get_selected_connections(self):
- """
- Get a group of selected connections.
-
- Returns:
- sub set of connections in this flow graph
- """
- selected = set()
- for selected_element in self.get_selected_elements():
- if selected_element.is_connection:
- selected.add(selected_element)
- return list(selected)
-
- def get_selected_blocks(self):
- """
- Get a group of selected blocks.
-
- Returns:
- sub set of blocks in this flow graph
- """
- selected = set()
- for selected_element in self.get_selected_elements():
- if selected_element.is_block:
- selected.add(selected_element)
- return list(selected)
-
- def get_selected_block(self):
- """
- Get the selected block when a block or port is selected.
-
- Returns:
- a block or None
- """
- selected_blocks = self.get_selected_blocks()
- return selected_blocks[0] if selected_blocks else None
-
- def get_selected_elements(self):
- """
- Get the group of selected elements.
-
- Returns:
- sub set of elements in this flow graph
- """
- return self._selected_elements
-
- def get_selected_element(self):
- """
- Get the selected element.
-
- Returns:
- a block, port, or connection or None
- """
- selected_elements = self.get_selected_elements()
- return selected_elements[0] if selected_elements else None
-
- def update_selected_elements(self):
- """
- Update the selected elements.
- The update behavior depends on the state of the mouse button.
- When the mouse button pressed the selection will change when
- the control mask is set or the new selection is not in the current group.
- When the mouse button is released the selection will change when
- the mouse has moved and the control mask is set or the current group is empty.
- Attempt to make a new connection if the old and ports are filled.
- If the control mask is set, merge with the current elements.
- """
- selected_elements = None
- if self.mouse_pressed:
- new_selections = self.what_is_selected(self.get_coordinate())
- #update the selections if the new selection is not in the current selections
- #allows us to move entire selected groups of elements
- if self.get_ctrl_mask() or not (
- new_selections and new_selections[0] in self.get_selected_elements()
- ): selected_elements = new_selections
- if self._old_selected_port:
- self._old_selected_port.force_label_unhidden(False)
- self.create_shapes()
- self.queue_draw()
- elif self._new_selected_port:
- self._new_selected_port.force_label_unhidden()
- else: # called from a mouse release
- if not self.element_moved and (not self.get_selected_elements() or self.get_ctrl_mask()):
- selected_elements = self.what_is_selected(self.get_coordinate(), self.press_coor)
- #this selection and the last were ports, try to connect them
- if self._old_selected_port and self._new_selected_port:
- try:
- self.connect(self._old_selected_port, self._new_selected_port)
- Actions.ELEMENT_CREATE()
- except: Messages.send_fail_connection()
- self._old_selected_port = None
- self._new_selected_port = None
- return
- #update selected elements
- if selected_elements is None: return
- old_elements = set(self.get_selected_elements())
- self._selected_elements = list(set(selected_elements))
- new_elements = set(self.get_selected_elements())
- #if ctrl, set the selected elements to the union - intersection of old and new
- if self.get_ctrl_mask():
- self._selected_elements = list(
- set.union(old_elements, new_elements) - set.intersection(old_elements, new_elements)
- )
- Actions.ELEMENT_SELECT()
-
- ##########################################################################
- ## Event Handlers
- ##########################################################################
- def handle_mouse_context_press(self, coordinate, event):
- """
- The context mouse button was pressed:
- If no elements were selected, perform re-selection at this coordinate.
- Then, show the context menu at the mouse click location.
- """
- selections = self.what_is_selected(coordinate)
- if not set(selections).intersection(self.get_selected_elements()):
- self.set_coordinate(coordinate)
- self.mouse_pressed = True
- self.update_selected_elements()
- self.mouse_pressed = False
- self._context_menu.popup(None, None, None, event.button, event.time)
-
- def handle_mouse_selector_press(self, double_click, coordinate):
- """
- The selector mouse button was pressed:
- Find the selected element. Attempt a new connection if possible.
- Open the block params window on a double click.
- Update the selection state of the flow graph.
- """
- self.press_coor = coordinate
- self.set_coordinate(coordinate)
- self.time = 0
- self.mouse_pressed = True
- if double_click: self.unselect()
- self.update_selected_elements()
- #double click detected, bring up params dialog if possible
- if double_click and self.get_selected_block():
- self.mouse_pressed = False
- Actions.BLOCK_PARAM_MODIFY()
-
- def handle_mouse_selector_release(self, coordinate):
- """
- The selector mouse button was released:
- Update the state, handle motion (dragging).
- And update the selected flowgraph elements.
- """
- self.set_coordinate(coordinate)
- self.time = 0
- self.mouse_pressed = False
- if self.element_moved:
- Actions.BLOCK_MOVE()
- self.element_moved = False
- self.update_selected_elements()
-
- def handle_mouse_motion(self, coordinate):
- """
- The mouse has moved, respond to mouse dragging or notify elements
- Move a selected element to the new coordinate.
- Auto-scroll the scroll bars at the boundaries.
- """
- #to perform a movement, the mouse must be pressed
- # (no longer checking pending events via gtk.events_pending() - always true in Windows)
- if not self.mouse_pressed:
- # only continue if mouse-over stuff is enabled (just the auto-hide port label stuff for now)
- if not Actions.TOGGLE_AUTO_HIDE_PORT_LABELS.get_active(): return
- redraw = False
- for element in reversed(self.get_elements()):
- over_element = element.what_is_selected(coordinate)
- if not over_element: continue
- if over_element != self.element_under_mouse: # over sth new
- if self.element_under_mouse:
- redraw |= self.element_under_mouse.mouse_out() or False
- self.element_under_mouse = over_element
- redraw |= over_element.mouse_over() or False
- break
- else:
- if self.element_under_mouse:
- redraw |= self.element_under_mouse.mouse_out() or False
- self.element_under_mouse = None
- if redraw:
- #self.create_labels()
- self.create_shapes()
- self.queue_draw()
- else:
- #perform auto-scrolling
- width, height = self.get_size()
- x, y = coordinate
- h_adj = self.get_scroll_pane().get_hadjustment()
- v_adj = self.get_scroll_pane().get_vadjustment()
- for pos, length, adj, adj_val, adj_len in (
- (x, width, h_adj, h_adj.get_value(), h_adj.page_size),
- (y, height, v_adj, v_adj.get_value(), v_adj.page_size),
- ):
- #scroll if we moved near the border
- if pos-adj_val > adj_len-SCROLL_PROXIMITY_SENSITIVITY and adj_val+SCROLL_DISTANCE < length-adj_len:
- adj.set_value(adj_val+SCROLL_DISTANCE)
- adj.emit('changed')
- elif pos-adj_val < SCROLL_PROXIMITY_SENSITIVITY:
- adj.set_value(adj_val-SCROLL_DISTANCE)
- adj.emit('changed')
- #remove the connection if selected in drag event
- if len(self.get_selected_elements()) == 1 and self.get_selected_element().is_connection:
- Actions.ELEMENT_DELETE()
- #move the selected elements and record the new coordinate
- if not self.get_ctrl_mask():
- X, Y = self.get_coordinate()
- dX, dY = int(x - X), int(y - Y)
- active = Actions.TOGGLE_SNAP_TO_GRID.get_active() or self.get_mod1_mask()
- if not active or abs(dX) >= Utils.CANVAS_GRID_SIZE or abs(dY) >= Utils.CANVAS_GRID_SIZE:
- self.move_selected((dX, dY))
- self.set_coordinate((x, y))
- #queue draw for animation
- self.queue_draw()
diff --git a/grc/gui/MainWindow.py b/grc/gui/MainWindow.py
index 9a2823a7a..e737610a7 100644
--- a/grc/gui/MainWindow.py
+++ b/grc/gui/MainWindow.py
@@ -17,52 +17,32 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
+from __future__ import absolute_import
+
import os
+import logging
-import gtk
+from gi.repository import Gtk, Gdk, GObject
-from . import Bars, Actions, Preferences, Utils
+from . import Bars, Actions, Utils
from .BlockTreeWindow import BlockTreeWindow
+from .Console import Console
from .VariableEditor import VariableEditor
from .Constants import \
NEW_FLOGRAPH_TITLE, DEFAULT_CONSOLE_WINDOW_WIDTH
-from .Dialogs import TextDisplay, MessageDialogHelper
-from .NotebookPage import NotebookPage
+from .Dialogs import TextDisplay, MessageDialogWrapper
+from .Notebook import Notebook, Page
from ..core import Messages
-MAIN_WINDOW_TITLE_TMPL = """\
-#if not $saved
-*#slurp
-#end if
-#if $basename
-$basename#slurp
-#else
-$new_flowgraph_title#slurp
-#end if
-#if $read_only
- (read only)#slurp
-#end if
-#if $dirname
- - $dirname#slurp
-#end if
- - $platform_name#slurp
-"""
-PAGE_TITLE_MARKUP_TMPL = """\
-#set $foreground = $saved and 'black' or 'red'
-<span foreground="$foreground">$encode($title or $new_flowgraph_title)</span>#slurp
-#if $read_only
- (ro)#slurp
-#end if
-"""
+log = logging.getLogger(__name__)
############################################################
# Main window
############################################################
-
-class MainWindow(gtk.Window):
+class MainWindow(Gtk.ApplicationWindow):
"""The topmost window with menus, the tool bar, and other major windows."""
# Constants the action handler can use to indicate which panel visibility to change.
@@ -70,105 +50,114 @@ class MainWindow(gtk.Window):
CONSOLE = 1
VARIABLES = 2
- def __init__(self, platform, action_handler_callback):
+ def __init__(self, app, platform):
"""
MainWindow constructor
Setup the menu, toolbar, flow graph editor notebook, block selection window...
"""
- self._platform = platform
+ Gtk.ApplicationWindow.__init__(self, title="GNU Radio Companion", application=app)
+ log.debug("__init__()")
- gen_opts = platform.blocks['options'].get_param('generate_options')
- generate_mode_default = gen_opts.get_value()
- generate_modes = [
- (o.get_key(), o.get_name(), o.get_key() == generate_mode_default)
- for o in gen_opts.get_options()]
+ self._platform = platform
+ self.app = app
+ self.config = platform.config
- # Load preferences
- Preferences.load(platform)
+ # Add all "win" actions to the local
+ for x in Actions.get_actions():
+ if x.startswith("win."):
+ self.add_action(Actions.actions[x])
# Setup window
- gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
- vbox = gtk.VBox()
+ vbox = Gtk.VBox()
self.add(vbox)
- icon_theme = gtk.icon_theme_get_default()
+ icon_theme = Gtk.IconTheme.get_default()
icon = icon_theme.lookup_icon("gnuradio-grc", 48, 0)
if not icon:
# Set window icon
self.set_icon_from_file(os.path.dirname(os.path.abspath(__file__)) + "/icon.png")
# Create the menu bar and toolbar
- self.add_accel_group(Actions.get_accel_group())
- self.menu_bar = Bars.MenuBar(generate_modes, action_handler_callback)
- vbox.pack_start(self.menu_bar, False)
- self.tool_bar = Bars.Toolbar(generate_modes, action_handler_callback)
- vbox.pack_start(self.tool_bar, False)
+ generate_modes = platform.get_generate_options()
+
+ # This needs to be replaced
+ # Have an option for either the application menu or this menu
+ self.menu_bar = Gtk.MenuBar.new_from_model(Bars.Menu())
+ vbox.pack_start(self.menu_bar, False, False, 0)
+
+ self.tool_bar = Bars.Toolbar()
+ self.tool_bar.set_hexpand(True)
+ # Show the toolbar
+ self.tool_bar.show()
+ vbox.pack_start(self.tool_bar, False, False, 0)
# Main parent container for the different panels
- self.container = gtk.HPaned()
- vbox.pack_start(self.container)
+ self.main = Gtk.HPaned() #(orientation=Gtk.Orientation.HORIZONTAL)
+ vbox.pack_start(self.main, True, True, 0)
# Create the notebook
- self.notebook = gtk.Notebook()
+ self.notebook = Notebook()
self.page_to_be_closed = None
- self.current_page = None
- self.notebook.set_show_border(False)
- self.notebook.set_scrollable(True) # scroll arrows for page tabs
- self.notebook.connect('switch-page', self._handle_page_change)
+
+ self.current_page = None # type: Page
# Create the console window
- self.text_display = TextDisplay()
- self.console_window = gtk.ScrolledWindow()
- self.console_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- self.console_window.add(self.text_display)
- self.console_window.set_size_request(-1, DEFAULT_CONSOLE_WINDOW_WIDTH)
+ self.console = Console()
# Create the block tree and variable panels
- self.btwin = BlockTreeWindow(platform, self.get_flow_graph)
- self.vars = VariableEditor(platform, self.get_flow_graph)
+ self.btwin = BlockTreeWindow(platform)
+ self.btwin.connect('create_new_block', self._add_block_to_current_flow_graph)
+ self.vars = VariableEditor()
+ self.vars.connect('create_new_block', self._add_block_to_current_flow_graph)
+ self.vars.connect('remove_block', self._remove_block_from_current_flow_graph)
# Figure out which place to put the variable editor
- self.left = gtk.VPaned()
- self.right = gtk.VPaned()
- self.left_subpanel = gtk.HPaned()
+ self.left = Gtk.VPaned() #orientation=Gtk.Orientation.VERTICAL)
+ self.right = Gtk.VPaned() #orientation=Gtk.Orientation.VERTICAL)
+ self.left_subpanel = Gtk.HPaned() #orientation=Gtk.Orientation.HORIZONTAL)
- self.variable_panel_sidebar = Preferences.variable_editor_sidebar()
+ self.variable_panel_sidebar = self.config.variable_editor_sidebar()
if self.variable_panel_sidebar:
self.left.pack1(self.notebook)
- self.left.pack2(self.console_window, False)
+ self.left.pack2(self.console, False)
self.right.pack1(self.btwin)
self.right.pack2(self.vars, False)
else:
# Put the variable editor in a panel with the console
self.left.pack1(self.notebook)
- self.left_subpanel.pack1(self.console_window, shrink=False)
+ self.left_subpanel.pack1(self.console, shrink=False)
self.left_subpanel.pack2(self.vars, resize=False, shrink=True)
self.left.pack2(self.left_subpanel, False)
# Create the right panel
self.right.pack1(self.btwin)
- self.container.pack1(self.left)
- self.container.pack2(self.right, False)
+ self.main.pack1(self.left)
+ self.main.pack2(self.right, False)
- # load preferences and show the main window
- self.resize(*Preferences.main_window_size())
- self.container.set_position(Preferences.blocks_window_position())
- self.left.set_position(Preferences.console_window_position())
+ # Load preferences and show the main window
+ self.resize(*self.config.main_window_size())
+ self.main.set_position(self.config.blocks_window_position())
+ self.left.set_position(self.config.console_window_position())
if self.variable_panel_sidebar:
- self.right.set_position(Preferences.variable_editor_position(sidebar=True))
+ self.right.set_position(self.config.variable_editor_position(sidebar=True))
else:
- self.left_subpanel.set_position(Preferences.variable_editor_position())
+ self.left_subpanel.set_position(self.config.variable_editor_position())
self.show_all()
- self.console_window.hide()
- self.vars.hide()
- self.btwin.hide()
+ log.debug("Main window ready")
############################################################
# Event Handlers
############################################################
+ def _add_block_to_current_flow_graph(self, widget, key):
+ self.current_flow_graph.add_new_block(key)
+
+ def _remove_block_from_current_flow_graph(self, widget, key):
+ block = self.current_flow_graph.get_block(key)
+ self.current_flow_graph.remove_element(block)
+
def _quit(self, window, event):
"""
Handle the delete event from the main window.
@@ -181,20 +170,6 @@ class MainWindow(gtk.Window):
Actions.APPLICATION_QUIT()
return True
- def _handle_page_change(self, notebook, page, page_num):
- """
- Handle a page change. When the user clicks on a new tab,
- reload the flow graph to update the vars window and
- call handle states (select nothing) to update the buttons.
-
- Args:
- notebook: the notebook
- page: new page
- page_num: new page number
- """
- self.current_page = self.notebook.get_nth_page(page_num)
- Actions.PAGE_CHANGE()
-
def update_panel_visibility(self, panel, visibility=True):
"""
Handles changing visibility of panels.
@@ -204,19 +179,19 @@ class MainWindow(gtk.Window):
if panel == self.BLOCKS:
if visibility:
- self.btwin.show()
+ self.btwin.show()
else:
- self.btwin.hide()
+ self.btwin.hide()
elif panel == self.CONSOLE:
if visibility:
- self.console_window.show()
+ self.console.show()
else:
- self.console_window.hide()
+ self.console.hide()
elif panel == self.VARIABLES:
if visibility:
- self.vars.show()
+ self.vars.show()
else:
- self.vars.hide()
+ self.vars.hide()
else:
return
@@ -231,7 +206,7 @@ class MainWindow(gtk.Window):
self.right.hide()
else:
self.right.show()
- if not (self.vars.get_property('visible')) and not (self.console_window.get_property('visible')):
+ if not (self.vars.get_property('visible')) and not (self.console.get_property('visible')):
self.left_subpanel.hide()
else:
self.left_subpanel.show()
@@ -240,6 +215,14 @@ class MainWindow(gtk.Window):
# Console Window
############################################################
+ @property
+ def current_page(self):
+ return self.notebook.current_page
+
+ @current_page.setter
+ def current_page(self, page):
+ self.notebook.current_page = page
+
def add_console_line(self, line):
"""
Place line at the end of the text buffer, then scroll its window all the way down.
@@ -247,7 +230,7 @@ class MainWindow(gtk.Window):
Args:
line: the new text
"""
- self.text_display.insert(line)
+ self.console.add_line(line)
############################################################
# Pages: create and close
@@ -269,26 +252,24 @@ class MainWindow(gtk.Window):
return
try: #try to load from file
if file_path: Messages.send_start_load(file_path)
- flow_graph = self._platform.get_new_flow_graph()
+ flow_graph = self._platform.make_flow_graph()
flow_graph.grc_file_path = file_path
#print flow_graph
- page = NotebookPage(
+ page = Page(
self,
flow_graph=flow_graph,
file_path=file_path,
)
if file_path: Messages.send_end_load()
- except Exception, e: #return on failure
+ except Exception as e: #return on failure
Messages.send_fail_load(e)
if isinstance(e, KeyError) and str(e) == "'options'":
# This error is unrecoverable, so crash gracefully
exit(-1)
return
#add this page to the notebook
- self.notebook.append_page(page, page.get_tab())
- try: self.notebook.set_tab_reorderable(page, True)
- except: pass #gtk too old
- self.notebook.set_tab_label_packing(page, False, False, gtk.PACK_START)
+ self.notebook.append_page(page, page.tab)
+ self.notebook.set_tab_reorderable(page, True)
#only show if blank or manual
if not file_path or show: self._set_page(page)
@@ -299,26 +280,26 @@ class MainWindow(gtk.Window):
Returns:
true if all closed
"""
- open_files = filter(lambda file: file, self._get_files()) #filter blank files
- open_file = self.get_page().get_file_path()
+ open_files = [file for file in self._get_files() if file] #filter blank files
+ open_file = self.current_page.file_path
#close each page
- for page in sorted(self.get_pages(), key=lambda p: p.get_saved()):
+ for page in sorted(self.get_pages(), key=lambda p: p.saved):
self.page_to_be_closed = page
closed = self.close_page(False)
if not closed:
break
if self.notebook.get_n_pages(): return False
#save state before closing
- Preferences.set_open_files(open_files)
- Preferences.file_open(open_file)
- Preferences.main_window_size(self.get_size())
- Preferences.console_window_position(self.left.get_position())
- Preferences.blocks_window_position(self.container.get_position())
+ self.config.set_open_files(open_files)
+ self.config.file_open(open_file)
+ self.config.main_window_size(self.get_size())
+ self.config.console_window_position(self.left.get_position())
+ self.config.blocks_window_position(self.main.get_position())
if self.variable_panel_sidebar:
- Preferences.variable_editor_position(self.right.get_position(), sidebar=True)
+ self.config.variable_editor_position(self.right.get_position(), sidebar=True)
else:
- Preferences.variable_editor_position(self.left_subpanel.get_position())
- Preferences.save()
+ self.config.variable_editor_position(self.left_subpanel.get_position())
+ self.config.save()
return True
def close_page(self, ensure=True):
@@ -330,23 +311,24 @@ class MainWindow(gtk.Window):
Args:
ensure: boolean
"""
- if not self.page_to_be_closed: self.page_to_be_closed = self.get_page()
+ if not self.page_to_be_closed: self.page_to_be_closed = self.current_page
#show the page if it has an executing flow graph or is unsaved
- if self.page_to_be_closed.get_proc() or not self.page_to_be_closed.get_saved():
+ if self.page_to_be_closed.process or not self.page_to_be_closed.saved:
self._set_page(self.page_to_be_closed)
#unsaved? ask the user
- if not self.page_to_be_closed.get_saved():
+ if not self.page_to_be_closed.saved:
response = self._save_changes() # return value is either OK, CLOSE, or CANCEL
- if response == gtk.RESPONSE_OK:
+ if response == Gtk.ResponseType.OK:
Actions.FLOW_GRAPH_SAVE() #try to save
- if not self.page_to_be_closed.get_saved(): #still unsaved?
+ if not self.page_to_be_closed.saved: #still unsaved?
self.page_to_be_closed = None #set the page to be closed back to None
return False
- elif response == gtk.RESPONSE_CANCEL:
+ elif response == Gtk.ResponseType.CANCEL:
self.page_to_be_closed = None
return False
#stop the flow graph if executing
- if self.page_to_be_closed.get_proc(): Actions.FLOW_GRAPH_KILL()
+ if self.page_to_be_closed.process:
+ Actions.FLOW_GRAPH_KILL()
#remove the page
self.notebook.remove_page(self.notebook.page_num(self.page_to_be_closed))
if ensure and self.notebook.get_n_pages() == 0: self.new_page() #no pages, make a new one
@@ -362,69 +344,49 @@ class MainWindow(gtk.Window):
Set the title of the main window.
Set the titles on the page tabs.
Show/hide the console window.
-
- Args:
- title: the window title
"""
- gtk.Window.set_title(self, Utils.parse_template(MAIN_WINDOW_TITLE_TMPL,
- basename=os.path.basename(self.get_page().get_file_path()),
- dirname=os.path.dirname(self.get_page().get_file_path()),
- new_flowgraph_title=NEW_FLOGRAPH_TITLE,
- read_only=self.get_page().get_read_only(),
- saved=self.get_page().get_saved(),
- platform_name=self._platform.config.name,
- )
- )
- #set tab titles
- for page in self.get_pages(): page.set_markup(
- Utils.parse_template(PAGE_TITLE_MARKUP_TMPL,
- #get filename and strip out file extension
- title=os.path.splitext(os.path.basename(page.get_file_path()))[0],
- read_only=page.get_read_only(), saved=page.get_saved(),
- new_flowgraph_title=NEW_FLOGRAPH_TITLE,
- )
- )
- #show/hide notebook tabs
+ page = self.current_page
+
+ basename = os.path.basename(page.file_path)
+ dirname = os.path.dirname(page.file_path)
+ Gtk.Window.set_title(self, ''.join((
+ '*' if not page.saved else '', basename if basename else NEW_FLOGRAPH_TITLE,
+ '(read only)' if page.get_read_only() else '', ' - ',
+ dirname if dirname else self._platform.config.name,
+ )))
+ # set tab titles
+ for page in self.get_pages():
+ file_name = os.path.splitext(os.path.basename(page.file_path))[0]
+ page.set_markup('<span foreground="{foreground}">{title}{ro}</span>'.format(
+ foreground='black' if page.saved else 'red', ro=' (ro)' if page.get_read_only() else '',
+ title=Utils.encode(file_name or NEW_FLOGRAPH_TITLE),
+ ))
+ # show/hide notebook tabs
self.notebook.set_show_tabs(len(self.get_pages()) > 1)
- # Need to update the variable window when changing
- self.vars.update_gui()
+ # Need to update the variable window when changing
+ self.vars.update_gui(self.current_flow_graph.blocks)
def update_pages(self):
"""
Forces a reload of all the pages in this notebook.
"""
for page in self.get_pages():
- success = page.get_flow_graph().reload()
+ success = page.flow_graph.reload()
if success: # Only set saved if errors occurred during import
- page.set_saved(False)
-
- def get_page(self):
- """
- Get the selected page.
+ page.saved = False
- Returns:
- the selected page
- """
- return self.current_page
-
- def get_flow_graph(self):
- """
- Get the selected flow graph.
-
- Returns:
- the selected flow graph
- """
- return self.get_page().get_flow_graph()
+ @property
+ def current_flow_graph(self):
+ return self.current_page.flow_graph
def get_focus_flag(self):
"""
Get the focus flag from the current page.
-
Returns:
the focus flag
"""
- return self.get_page().get_drawing_area().get_focus_flag()
+ return self.current_page.drawing_area.get_focus_flag()
############################################################
# Helpers
@@ -448,14 +410,14 @@ class MainWindow(gtk.Window):
the response_id (see buttons variable below)
"""
buttons = (
- 'Close without saving', gtk.RESPONSE_CLOSE,
- gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
- gtk.STOCK_SAVE, gtk.RESPONSE_OK
- )
- return MessageDialogHelper(
- gtk.MESSAGE_QUESTION, gtk.BUTTONS_NONE, 'Unsaved Changes!',
- 'Would you like to save changes before closing?', gtk.RESPONSE_OK, buttons
+ 'Close without saving', Gtk.ResponseType.CLOSE,
+ Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
+ Gtk.STOCK_SAVE, Gtk.ResponseType.OK
)
+ return MessageDialogWrapper(
+ self, Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE, 'Unsaved Changes!',
+ 'Would you like to save changes before closing?', Gtk.ResponseType.OK, buttons
+ ).run_and_destroy()
def _get_files(self):
"""
@@ -464,7 +426,7 @@ class MainWindow(gtk.Window):
Returns:
list of file paths
"""
- return map(lambda page: page.get_file_path(), self.get_pages())
+ return [page.file_path for page in self.get_pages()]
def get_pages(self):
"""
@@ -473,4 +435,5 @@ class MainWindow(gtk.Window):
Returns:
list of pages
"""
- return [self.notebook.get_nth_page(page_num) for page_num in range(self.notebook.get_n_pages())]
+ return [self.notebook.get_nth_page(page_num)
+ for page_num in range(self.notebook.get_n_pages())]
diff --git a/grc/gui/Notebook.py b/grc/gui/Notebook.py
new file mode 100644
index 000000000..9f63190b3
--- /dev/null
+++ b/grc/gui/Notebook.py
@@ -0,0 +1,187 @@
+"""
+Copyright 2008, 2009, 2011 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from __future__ import absolute_import
+import os
+import logging
+
+from gi.repository import Gtk, Gdk, GObject
+
+from . import Actions
+from .StateCache import StateCache
+from .Constants import MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT
+from .DrawingArea import DrawingArea
+
+
+log = logging.getLogger(__name__)
+
+
+class Notebook(Gtk.Notebook):
+ def __init__(self):
+ Gtk.Notebook.__init__(self)
+ log.debug("notebook()")
+ self.app = Gtk.Application.get_default()
+ self.current_page = None
+
+ self.set_show_border(False)
+ self.set_scrollable(True)
+ self.connect('switch-page', self._handle_page_change)
+
+ self.add_events(Gdk.EventMask.SCROLL_MASK)
+ self.connect('scroll-event', self._handle_scroll)
+ self._ignore_consecutive_scrolls = 0
+
+ def _handle_page_change(self, notebook, page, page_num):
+ """
+ Handle a page change. When the user clicks on a new tab,
+ reload the flow graph to update the vars window and
+ call handle states (select nothing) to update the buttons.
+
+ Args:
+ notebook: the notebook
+ page: new page
+ page_num: new page number
+ """
+ self.current_page = self.get_nth_page(page_num)
+ Actions.PAGE_CHANGE()
+
+ def _handle_scroll(self, widget, event):
+ # Not sure how to handle this at the moment.
+ natural = True
+ # Slow it down
+ if self._ignore_consecutive_scrolls == 0:
+ if event.direction in (Gdk.ScrollDirection.UP, Gdk.ScrollDirection.LEFT):
+ if natural:
+ self.prev_page()
+ else:
+ self.next_page()
+ elif event.direction in (Gdk.ScrollDirection.DOWN, Gdk.ScrollDirection.RIGHT):
+ if natural:
+ self.next_page()
+ else:
+ self.prev_page()
+ self._ignore_consecutive_scrolls = 3
+ else:
+ self._ignore_consecutive_scrolls -= 1
+ return False
+
+
+class Page(Gtk.HBox):
+ """A page in the notebook."""
+
+ def __init__(self, main_window, flow_graph, file_path=''):
+ """
+ Page constructor.
+
+ Args:
+ main_window: main window
+ file_path: path to a flow graph file
+ """
+ Gtk.HBox.__init__(self)
+
+ self.main_window = main_window
+ self.flow_graph = flow_graph
+ self.file_path = file_path
+
+ self.process = None
+ self.saved = True
+
+ # import the file
+ initial_state = flow_graph.parent_platform.parse_flow_graph(file_path)
+ flow_graph.import_data(initial_state)
+ self.state_cache = StateCache(initial_state)
+
+ # tab box to hold label and close button
+ self.label = Gtk.Label()
+ image = Gtk.Image.new_from_icon_name('window-close', Gtk.IconSize.MENU)
+ image_box = Gtk.HBox(homogeneous=False, spacing=0)
+ image_box.pack_start(image, True, False, 0)
+ button = Gtk.Button()
+ button.connect("clicked", self._handle_button)
+ button.set_relief(Gtk.ReliefStyle.NONE)
+ button.add(image_box)
+
+ tab = self.tab = Gtk.HBox(homogeneous=False, spacing=0)
+ tab.pack_start(self.label, False, False, 0)
+ tab.pack_start(button, False, False, 0)
+ tab.show_all()
+
+ # setup scroll window and drawing area
+ self.drawing_area = DrawingArea(flow_graph)
+ flow_graph.drawing_area = self.drawing_area
+
+ self.scrolled_window = Gtk.ScrolledWindow()
+ self.scrolled_window.set_size_request(MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT)
+ self.scrolled_window.set_policy(Gtk.PolicyType.ALWAYS, Gtk.PolicyType.ALWAYS)
+ self.scrolled_window.connect('key-press-event', self._handle_scroll_window_key_press)
+
+ self.scrolled_window.add(self.drawing_area)
+ self.pack_start(self.scrolled_window, True, True, 0)
+ self.show_all()
+
+ def _handle_scroll_window_key_press(self, widget, event):
+ is_ctrl_pg = (
+ event.state & Gdk.ModifierType.CONTROL_MASK and
+ event.keyval in (Gdk.KEY_Page_Up, Gdk.KEY_Page_Down)
+ )
+ if is_ctrl_pg:
+ return self.get_parent().event(event)
+
+ def get_generator(self):
+ """
+ Get the generator object for this flow graph.
+
+ Returns:
+ generator
+ """
+ platform = self.flow_graph.parent_platform
+ return platform.Generator(self.flow_graph, os.path.dirname(self.file_path))
+
+ def _handle_button(self, button):
+ """
+ The button was clicked.
+ Make the current page selected, then close.
+
+ Args:
+ the: button
+ """
+ self.main_window.page_to_be_closed = self
+ Actions.FLOW_GRAPH_CLOSE()
+
+ def set_markup(self, markup):
+ """
+ Set the markup in this label.
+
+ Args:
+ markup: the new markup text
+ """
+ self.label.set_markup(markup)
+
+ def get_read_only(self):
+ """
+ Get the read-only state of the file.
+ Always false for empty path.
+
+ Returns:
+ true for read-only
+ """
+ if not self.file_path:
+ return False
+ return (os.path.exists(self.file_path) and
+ not os.access(self.file_path, os.W_OK))
diff --git a/grc/gui/NotebookPage.py b/grc/gui/NotebookPage.py
deleted file mode 100644
index 79ad8bf20..000000000
--- a/grc/gui/NotebookPage.py
+++ /dev/null
@@ -1,244 +0,0 @@
-"""
-Copyright 2008, 2009, 2011 Free Software Foundation, Inc.
-This file is part of GNU Radio
-
-GNU Radio Companion 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 2
-of the License, or (at your option) any later version.
-
-GNU Radio Companion 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 program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-"""
-
-import pygtk
-pygtk.require('2.0')
-import gtk
-import gobject
-import Actions
-from StateCache import StateCache
-from Constants import MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT
-from DrawingArea import DrawingArea
-import os
-
-
-class NotebookPage(gtk.HBox):
- """A page in the notebook."""
-
- def __init__(self, main_window, flow_graph, file_path=''):
- """
- Page constructor.
-
- Args:
- main_window: main window
- file_path: path to a flow graph file
- """
- self._flow_graph = flow_graph
- self.process = None
- #import the file
- self.main_window = main_window
- self.file_path = file_path
- initial_state = flow_graph.get_parent().parse_flow_graph(file_path)
- self.state_cache = StateCache(initial_state)
- self.saved = True
- #import the data to the flow graph
- self.get_flow_graph().import_data(initial_state)
- #initialize page gui
- gtk.HBox.__init__(self, False, 0)
- self.show()
- #tab box to hold label and close button
- self.tab = gtk.HBox(False, 0)
- #setup tab label
- self.label = gtk.Label()
- self.tab.pack_start(self.label, False)
- #setup button image
- image = gtk.Image()
- image.set_from_stock('gtk-close', gtk.ICON_SIZE_MENU)
- #setup image box
- image_box = gtk.HBox(False, 0)
- image_box.pack_start(image, True, False, 0)
- #setup the button
- button = gtk.Button()
- button.connect("clicked", self._handle_button)
- button.set_relief(gtk.RELIEF_NONE)
- button.add(image_box)
- #button size
- w, h = gtk.icon_size_lookup_for_settings(button.get_settings(), gtk.ICON_SIZE_MENU)
- button.set_size_request(w+6, h+6)
- self.tab.pack_start(button, False)
- self.tab.show_all()
- #setup scroll window and drawing area
- self.scrolled_window = gtk.ScrolledWindow()
- self.scrolled_window.set_size_request(MIN_WINDOW_WIDTH, MIN_WINDOW_HEIGHT)
- self.scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- self.scrolled_window.connect('key-press-event', self._handle_scroll_window_key_press)
- self.drawing_area = DrawingArea(self.get_flow_graph())
- self.scrolled_window.add_with_viewport(self.get_drawing_area())
- self.pack_start(self.scrolled_window)
- #inject drawing area into flow graph
- self.get_flow_graph().drawing_area = self.get_drawing_area()
- self.show_all()
-
- def get_drawing_area(self): return self.drawing_area
-
- def _handle_scroll_window_key_press(self, widget, event):
- """forward Ctrl-PgUp/Down to NotebookPage (switch fg instead of horiz. scroll"""
- is_ctrl_pg = (
- event.state & gtk.gdk.CONTROL_MASK and
- event.keyval in (gtk.keysyms.Page_Up, gtk.keysyms.Page_Down)
- )
- if is_ctrl_pg:
- return self.get_parent().event(event)
-
- def get_generator(self):
- """
- Get the generator object for this flow graph.
-
- Returns:
- generator
- """
- platform = self.get_flow_graph().get_parent()
- return platform.Generator(self.get_flow_graph(), self.get_file_path())
-
- def _handle_button(self, button):
- """
- The button was clicked.
- Make the current page selected, then close.
-
- Args:
- the: button
- """
- self.main_window.page_to_be_closed = self
- Actions.FLOW_GRAPH_CLOSE()
-
- def set_markup(self, markup):
- """
- Set the markup in this label.
-
- Args:
- markup: the new markup text
- """
- self.label.set_markup(markup)
-
- def get_tab(self):
- """
- Get the gtk widget for this page's tab.
-
- Returns:
- gtk widget
- """
- return self.tab
-
- def get_proc(self):
- """
- Get the subprocess for the flow graph.
-
- Returns:
- the subprocess object
- """
- return self.process
-
- def set_proc(self, process):
- """
- Set the subprocess object.
-
- Args:
- process: the new subprocess
- """
- self.process = process
-
- def term_proc(self):
- """
- Terminate the subprocess object
-
- Add a callback to kill the process
- after 2 seconds if not already terminated
- """
- def kill(process):
- """
- Kill process if not already terminated
-
- Called by gobject.timeout_add
-
- Returns:
- False to stop timeout_add periodic calls
- """
- is_terminated = process.poll()
- if is_terminated is None:
- process.kill()
- return False
-
- self.get_proc().terminate()
- gobject.timeout_add(2000, kill, self.get_proc())
-
- def get_flow_graph(self):
- """
- Get the flow graph.
-
- Returns:
- the flow graph
- """
- return self._flow_graph
-
- def get_read_only(self):
- """
- Get the read-only state of the file.
- Always false for empty path.
-
- Returns:
- true for read-only
- """
- if not self.get_file_path(): return False
- return os.path.exists(self.get_file_path()) and \
- not os.access(self.get_file_path(), os.W_OK)
-
- def get_file_path(self):
- """
- Get the file path for the flow graph.
-
- Returns:
- the file path or ''
- """
- return self.file_path
-
- def set_file_path(self, file_path=''):
- """
- Set the file path, '' for no file path.
-
- Args:
- file_path: file path string
- """
- self.file_path = os.path.abspath(file_path) if file_path else ''
-
- def get_saved(self):
- """
- Get the saved status for the flow graph.
-
- Returns:
- true if saved
- """
- return self.saved
-
- def set_saved(self, saved=True):
- """
- Set the saved status.
-
- Args:
- saved: boolean status
- """
- self.saved = saved
-
- def get_state_cache(self):
- """
- Get the state cache for the flow graph.
-
- Returns:
- the state cache
- """
- return self.state_cache
diff --git a/grc/gui/Param.py b/grc/gui/Param.py
deleted file mode 100644
index c71e1c0aa..000000000
--- a/grc/gui/Param.py
+++ /dev/null
@@ -1,442 +0,0 @@
-"""
-Copyright 2007-2011 Free Software Foundation, Inc.
-This file is part of GNU Radio
-
-GNU Radio Companion 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 2
-of the License, or (at your option) any later version.
-
-GNU Radio Companion 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 program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-"""
-
-import os
-
-import pygtk
-pygtk.require('2.0')
-import gtk
-
-from . import Colors, Utils, Constants
-from .Element import Element
-from . import Utils
-
-from ..core.Param import Param as _Param
-
-
-class InputParam(gtk.HBox):
- """The base class for an input parameter inside the input parameters dialog."""
- expand = False
-
- def __init__(self, param, changed_callback=None, editing_callback=None):
- gtk.HBox.__init__(self)
- self.param = param
- self._changed_callback = changed_callback
- self._editing_callback = editing_callback
- self.label = gtk.Label() #no label, markup is added by set_markup
- self.label.set_size_request(Utils.scale_scalar(150), -1)
- self.pack_start(self.label, False)
- self.set_markup = lambda m: self.label.set_markup(m)
- self.tp = None
- self._have_pending_changes = False
- #connect events
- self.connect('show', self._update_gui)
-
- def set_color(self, color):
- pass
-
- def set_tooltip_text(self, text):
- pass
-
- def get_text(self):
- raise NotImplementedError()
-
- def _update_gui(self, *args):
- """
- Set the markup, color, tooltip, show/hide.
- """
- #set the markup
- has_cb = \
- hasattr(self.param.get_parent(), 'get_callbacks') and \
- filter(lambda c: self.param.get_key() in c, self.param.get_parent()._callbacks)
- self.set_markup(Utils.parse_template(PARAM_LABEL_MARKUP_TMPL,
- param=self.param, has_cb=has_cb,
- modified=self._have_pending_changes))
- #set the color
- self.set_color(self.param.get_color())
- #set the tooltip
- self.set_tooltip_text(
- Utils.parse_template(TIP_MARKUP_TMPL, param=self.param).strip(),
- )
- #show/hide
- if self.param.get_hide() == 'all': self.hide_all()
- else: self.show_all()
-
- def _mark_changed(self, *args):
- """
- Mark this param as modified on change, but validate only on focus-lost
- """
- self._have_pending_changes = True
- self._update_gui()
- if self._editing_callback:
- self._editing_callback(self, None)
-
- def _apply_change(self, *args):
- """
- Handle a gui change by setting the new param value,
- calling the callback (if applicable), and updating.
- """
- #set the new value
- self.param.set_value(self.get_text())
- #call the callback
- if self._changed_callback:
- self._changed_callback(self, None)
- else:
- self.param.validate()
- #gui update
- self._have_pending_changes = False
- self._update_gui()
-
- def _handle_key_press(self, widget, event):
- if event.keyval == gtk.keysyms.Return and event.state & gtk.gdk.CONTROL_MASK:
- self._apply_change(widget, event)
- return True
- return False
-
- def apply_pending_changes(self):
- if self._have_pending_changes:
- self._apply_change()
-
-
-class EntryParam(InputParam):
- """Provide an entry box for strings and numbers."""
-
- def __init__(self, *args, **kwargs):
- InputParam.__init__(self, *args, **kwargs)
- self._input = gtk.Entry()
- self._input.set_text(self.param.get_value())
- self._input.connect('changed', self._mark_changed)
- self._input.connect('focus-out-event', self._apply_change)
- self._input.connect('key-press-event', self._handle_key_press)
- self.pack_start(self._input, True)
-
- def get_text(self):
- return self._input.get_text()
-
- def set_color(self, color):
- need_status_color = self.label not in self.get_children()
- text_color = (
- Colors.PARAM_ENTRY_TEXT_COLOR if not need_status_color else
- gtk.gdk.color_parse('blue') if self._have_pending_changes else
- gtk.gdk.color_parse('red') if not self.param.is_valid() else
- Colors.PARAM_ENTRY_TEXT_COLOR)
- base_color = (
- Colors.BLOCK_DISABLED_COLOR
- if need_status_color and not self.param.get_parent().get_enabled()
- else gtk.gdk.color_parse(color)
- )
- self._input.modify_base(gtk.STATE_NORMAL, base_color)
- self._input.modify_text(gtk.STATE_NORMAL, text_color)
-
- def set_tooltip_text(self, text):
- try:
- self._input.set_tooltip_text(text)
- except AttributeError:
- pass # no tooltips for old GTK
-
-
-class MultiLineEntryParam(InputParam):
- """Provide an multi-line box for strings."""
- expand = True
-
- def __init__(self, *args, **kwargs):
- InputParam.__init__(self, *args, **kwargs)
- self._buffer = gtk.TextBuffer()
- self._buffer.set_text(self.param.get_value())
- self._buffer.connect('changed', self._mark_changed)
-
- self._view = gtk.TextView(self._buffer)
- self._view.connect('focus-out-event', self._apply_change)
- self._view.connect('key-press-event', self._handle_key_press)
-
- self._sw = gtk.ScrolledWindow()
- self._sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- self._sw.add_with_viewport(self._view)
-
- self.pack_start(self._sw, True)
-
- def get_text(self):
- buf = self._buffer
- return buf.get_text(buf.get_start_iter(),
- buf.get_end_iter()).strip()
-
- def set_color(self, color):
- self._view.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
- self._view.modify_text(gtk.STATE_NORMAL, Colors.PARAM_ENTRY_TEXT_COLOR)
-
- def set_tooltip_text(self, text):
- try:
- self._view.set_tooltip_text(text)
- except AttributeError:
- pass # no tooltips for old GTK
-
-
-# try:
-# import gtksourceview
-# lang_manager = gtksourceview.SourceLanguagesManager()
-# py_lang = lang_manager.get_language_from_mime_type('text/x-python')
-#
-# class PythonEditorParam(InputParam):
-# expand = True
-#
-# def __init__(self, *args, **kwargs):
-# InputParam.__init__(self, *args, **kwargs)
-#
-# buf = self._buffer = gtksourceview.SourceBuffer()
-# buf.set_language(py_lang)
-# buf.set_highlight(True)
-# buf.set_text(self.param.get_value())
-# buf.connect('changed', self._mark_changed)
-#
-# view = self._view = gtksourceview.SourceView(self._buffer)
-# view.connect('focus-out-event', self._apply_change)
-# view.connect('key-press-event', self._handle_key_press)
-# view.set_tabs_width(4)
-# view.set_insert_spaces_instead_of_tabs(True)
-# view.set_auto_indent(True)
-# view.set_border_width(2)
-#
-# scroll = gtk.ScrolledWindow()
-# scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
-# scroll.add_with_viewport(view)
-# self.pack_start(scroll, True)
-#
-# def get_text(self):
-# buf = self._buffer
-# return buf.get_text(buf.get_start_iter(),
-# buf.get_end_iter()).strip()
-#
-# except ImportError:
-# print "Package 'gtksourceview' not found. No Syntax highlighting."
-# PythonEditorParam = MultiLineEntryParam
-
-class PythonEditorParam(InputParam):
-
- def __init__(self, *args, **kwargs):
- InputParam.__init__(self, *args, **kwargs)
- button = self._button = gtk.Button('Open in Editor')
- button.connect('clicked', self.open_editor)
- self.pack_start(button, True)
-
- def open_editor(self, widget=None):
- flowgraph = self.param.get_parent().get_parent()
- flowgraph.install_external_editor(self.param)
-
- def get_text(self):
- pass # we never update the value from here
-
- def set_color(self, color):
- # self._button.modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
- self._button.modify_text(gtk.STATE_NORMAL, Colors.PARAM_ENTRY_TEXT_COLOR)
-
- def _apply_change(self, *args):
- pass
-
-
-class EnumParam(InputParam):
- """Provide an entry box for Enum types with a drop down menu."""
-
- def __init__(self, *args, **kwargs):
- InputParam.__init__(self, *args, **kwargs)
- self._input = gtk.combo_box_new_text()
- for option in self.param.get_options(): self._input.append_text(option.get_name())
- self._input.set_active(self.param.get_option_keys().index(self.param.get_value()))
- self._input.connect('changed', self._editing_callback)
- self._input.connect('changed', self._apply_change)
- self.pack_start(self._input, False)
-
- def get_text(self):
- return self.param.get_option_keys()[self._input.get_active()]
-
- def set_tooltip_text(self, text):
- try:
- self._input.set_tooltip_text(text)
- except AttributeError:
- pass # no tooltips for old GTK
-
-
-class EnumEntryParam(InputParam):
- """Provide an entry box and drop down menu for Raw Enum types."""
-
- def __init__(self, *args, **kwargs):
- InputParam.__init__(self, *args, **kwargs)
- self._input = gtk.combo_box_entry_new_text()
- for option in self.param.get_options(): self._input.append_text(option.get_name())
- try: self._input.set_active(self.param.get_option_keys().index(self.param.get_value()))
- except:
- self._input.set_active(-1)
- self._input.get_child().set_text(self.param.get_value())
- self._input.connect('changed', self._apply_change)
- self._input.get_child().connect('changed', self._mark_changed)
- self._input.get_child().connect('focus-out-event', self._apply_change)
- self._input.get_child().connect('key-press-event', self._handle_key_press)
- self.pack_start(self._input, False)
-
- def get_text(self):
- if self._input.get_active() == -1: return self._input.get_child().get_text()
- return self.param.get_option_keys()[self._input.get_active()]
-
- def set_tooltip_text(self, text):
- try:
- if self._input.get_active() == -1: #custom entry
- self._input.get_child().set_tooltip_text(text)
- else:
- self._input.set_tooltip_text(text)
- except AttributeError:
- pass # no tooltips for old GTK
-
- def set_color(self, color):
- if self._input.get_active() == -1: #custom entry, use color
- self._input.get_child().modify_base(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
- self._input.get_child().modify_text(gtk.STATE_NORMAL, Colors.PARAM_ENTRY_TEXT_COLOR)
- else: #from enum, make pale background
- self._input.get_child().modify_base(gtk.STATE_NORMAL, Colors.ENTRYENUM_CUSTOM_COLOR)
- self._input.get_child().modify_text(gtk.STATE_NORMAL, Colors.PARAM_ENTRY_TEXT_COLOR)
-
-
-class FileParam(EntryParam):
- """Provide an entry box for filename and a button to browse for a file."""
-
- def __init__(self, *args, **kwargs):
- EntryParam.__init__(self, *args, **kwargs)
- input = gtk.Button('...')
- input.connect('clicked', self._handle_clicked)
- self.pack_start(input, False)
-
- def _handle_clicked(self, widget=None):
- """
- If the button was clicked, open a file dialog in open/save format.
- Replace the text in the entry with the new filename from the file dialog.
- """
- #get the paths
- file_path = self.param.is_valid() and self.param.get_evaluated() or ''
- (dirname, basename) = os.path.isfile(file_path) and os.path.split(file_path) or (file_path, '')
- # check for qss theme default directory
- if self.param.get_key() == 'qt_qss_theme':
- dirname = os.path.dirname(dirname) # trim filename
- if not os.path.exists(dirname):
- platform = self.param.get_parent().get_parent().get_parent()
- dirname = os.path.join(platform.config.install_prefix,
- '/share/gnuradio/themes')
- if not os.path.exists(dirname):
- dirname = os.getcwd() # fix bad paths
-
- #build the dialog
- if self.param.get_type() == 'file_open':
- file_dialog = gtk.FileChooserDialog('Open a Data File...', None,
- gtk.FILE_CHOOSER_ACTION_OPEN, ('gtk-cancel',gtk.RESPONSE_CANCEL,'gtk-open',gtk.RESPONSE_OK))
- elif self.param.get_type() == 'file_save':
- file_dialog = gtk.FileChooserDialog('Save a Data File...', None,
- gtk.FILE_CHOOSER_ACTION_SAVE, ('gtk-cancel',gtk.RESPONSE_CANCEL, 'gtk-save',gtk.RESPONSE_OK))
- file_dialog.set_do_overwrite_confirmation(True)
- file_dialog.set_current_name(basename) #show the current filename
- else:
- raise ValueError("Can't open file chooser dialog for type " + repr(self.param.get_type()))
- file_dialog.set_current_folder(dirname) #current directory
- file_dialog.set_select_multiple(False)
- file_dialog.set_local_only(True)
- if gtk.RESPONSE_OK == file_dialog.run(): #run the dialog
- file_path = file_dialog.get_filename() #get the file path
- self._input.set_text(file_path)
- self._editing_callback()
- self._apply_change()
- file_dialog.destroy() #destroy the dialog
-
-
-PARAM_MARKUP_TMPL="""\
-#set $foreground = $param.is_valid() and 'black' or 'red'
-<span foreground="$foreground" font_desc="$font"><b>$encode($param.get_name()): </b>$encode(repr($param).replace('\\n',' '))</span>"""
-
-PARAM_LABEL_MARKUP_TMPL="""\
-#set $foreground = $modified and 'blue' or $param.is_valid() and 'black' or 'red'
-#set $underline = $has_cb and 'low' or 'none'
-<span underline="$underline" foreground="$foreground" font_desc="Sans 9">$encode($param.get_name())</span>"""
-
-TIP_MARKUP_TMPL="""\
-########################################
-#def truncate(string)
- #set $max_len = 100
- #set $string = str($string)
- #if len($string) > $max_len
-$('%s...%s'%($string[:$max_len/2], $string[-$max_len/2:]))#slurp
- #else
-$string#slurp
- #end if
-#end def
-########################################
-Key: $param.get_key()
-Type: $param.get_type()
-#if $param.is_valid()
-Value: $truncate($param.get_evaluated())
-#elif len($param.get_error_messages()) == 1
-Error: $(param.get_error_messages()[0])
-#else
-Error:
- #for $error_msg in $param.get_error_messages()
- * $error_msg
- #end for
-#end if"""
-
-
-class Param(Element, _Param):
- """The graphical parameter."""
-
- def __init__(self, **kwargs):
- Element.__init__(self)
- _Param.__init__(self, **kwargs)
-
- def get_input(self, *args, **kwargs):
- """
- Get the graphical gtk class to represent this parameter.
- An enum requires and combo parameter.
- A non-enum with options gets a combined entry/combo parameter.
- All others get a standard entry parameter.
-
- Returns:
- gtk input class
- """
- if self.get_type() in ('file_open', 'file_save'):
- input_widget = FileParam(self, *args, **kwargs)
-
- elif self.is_enum():
- input_widget = EnumParam(self, *args, **kwargs)
-
- elif self.get_options():
- input_widget = EnumEntryParam(self, *args, **kwargs)
-
- elif self.get_type() == '_multiline':
- input_widget = MultiLineEntryParam(self, *args, **kwargs)
-
- elif self.get_type() == '_multiline_python_external':
- input_widget = PythonEditorParam(self, *args, **kwargs)
-
- else:
- input_widget = EntryParam(self, *args, **kwargs)
-
- return input_widget
-
- def get_markup(self):
- """
- Get the markup for this param.
-
- Returns:
- a pango markup string
- """
- return Utils.parse_template(PARAM_MARKUP_TMPL,
- param=self, font=Constants.PARAM_FONT)
diff --git a/grc/gui/ParamWidgets.py b/grc/gui/ParamWidgets.py
new file mode 100644
index 000000000..747c3ffec
--- /dev/null
+++ b/grc/gui/ParamWidgets.py
@@ -0,0 +1,330 @@
+# Copyright 2007-2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
+import os
+
+from gi.repository import Gtk, Gdk
+
+from . import Utils
+
+
+style_provider = Gtk.CssProvider()
+
+style_provider.load_from_data(b"""
+ #dtype_complex { background-color: #3399FF; }
+ #dtype_real { background-color: #FF8C69; }
+ #dtype_float { background-color: #FF8C69; }
+ #dtype_int { background-color: #00FF99; }
+
+ #dtype_complex_vector { background-color: #3399AA; }
+ #dtype_real_vector { background-color: #CC8C69; }
+ #dtype_float_vector { background-color: #CC8C69; }
+ #dtype_int_vector { background-color: #00CC99; }
+
+ #dtype_bool { background-color: #00FF99; }
+ #dtype_hex { background-color: #00FF99; }
+ #dtype_string { background-color: #CC66CC; }
+ #dtype_id { background-color: #DDDDDD; }
+ #dtype_stream_id { background-color: #DDDDDD; }
+ #dtype_raw { background-color: #FFFFFF; }
+
+ #enum_custom { background-color: #EEEEEE; }
+""")
+
+Gtk.StyleContext.add_provider_for_screen(
+ Gdk.Screen.get_default(),
+ style_provider,
+ Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
+)
+
+
+class InputParam(Gtk.HBox):
+ """The base class for an input parameter inside the input parameters dialog."""
+ expand = False
+
+ def __init__(self, param, changed_callback=None, editing_callback=None, transient_for=None):
+ Gtk.HBox.__init__(self)
+
+ self.param = param
+ self._changed_callback = changed_callback
+ self._editing_callback = editing_callback
+ self._transient_for = transient_for
+
+ self.label = Gtk.Label()
+ self.label.set_size_request(Utils.scale_scalar(150), -1)
+ self.label.show()
+ self.pack_start(self.label, False, False, 0)
+
+ self.tp = None
+ self._have_pending_changes = False
+
+ self.connect('show', self._update_gui)
+
+ def set_color(self, css_name):
+ pass
+
+ def set_tooltip_text(self, text):
+ pass
+
+ def get_text(self):
+ raise NotImplementedError()
+
+ def _update_gui(self, *args):
+ """
+ Set the markup, color, tooltip, show/hide.
+ """
+ self.label.set_markup(self.param.format_label_markup(self._have_pending_changes))
+ self.set_color('dtype_' + self.param.dtype)
+
+ self.set_tooltip_text(self.param.format_tooltip_text())
+
+ if self.param.hide == 'all':
+ self.hide()
+ else:
+ self.show_all()
+
+ def _mark_changed(self, *args):
+ """
+ Mark this param as modified on change, but validate only on focus-lost
+ """
+ self._have_pending_changes = True
+ self._update_gui()
+ if self._editing_callback:
+ self._editing_callback(self, None)
+
+ def _apply_change(self, *args):
+ """
+ Handle a gui change by setting the new param value,
+ calling the callback (if applicable), and updating.
+ """
+ #set the new value
+ self.param.set_value(self.get_text())
+ #call the callback
+ if self._changed_callback:
+ self._changed_callback(self, None)
+ else:
+ self.param.validate()
+ #gui update
+ self._have_pending_changes = False
+ self._update_gui()
+
+ def _handle_key_press(self, widget, event):
+ if event.keyval == Gdk.KEY_Return and event.get_state() & Gdk.ModifierType.CONTROL_MASK:
+ self._apply_change(widget, event)
+ return True
+ return False
+
+ def apply_pending_changes(self):
+ if self._have_pending_changes:
+ self._apply_change()
+
+
+class EntryParam(InputParam):
+ """Provide an entry box for strings and numbers."""
+
+ def __init__(self, *args, **kwargs):
+ InputParam.__init__(self, *args, **kwargs)
+ self._input = Gtk.Entry()
+ self._input.set_text(self.param.get_value())
+ self._input.connect('changed', self._mark_changed)
+ self._input.connect('focus-out-event', self._apply_change)
+ self._input.connect('key-press-event', self._handle_key_press)
+ self.pack_start(self._input, True, True, 0)
+
+ def get_text(self):
+ return self._input.get_text()
+
+ def set_color(self, css_name):
+ self._input.set_name(css_name)
+
+ def set_tooltip_text(self, text):
+ self._input.set_tooltip_text(text)
+
+
+class MultiLineEntryParam(InputParam):
+ """Provide an multi-line box for strings."""
+ expand = True
+
+ def __init__(self, *args, **kwargs):
+ InputParam.__init__(self, *args, **kwargs)
+ self._buffer = Gtk.TextBuffer()
+ self._buffer.set_text(self.param.get_value())
+ self._buffer.connect('changed', self._mark_changed)
+
+ self._view = Gtk.TextView()
+ self._view.set_buffer(self._buffer)
+ self._view.connect('focus-out-event', self._apply_change)
+ self._view.connect('key-press-event', self._handle_key_press)
+
+ self._sw = Gtk.ScrolledWindow()
+ self._sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
+ self._sw.set_shadow_type(type=Gtk.ShadowType.IN)
+ self._sw.add(self._view)
+
+ self.pack_start(self._sw, True, True, True)
+
+ def get_text(self):
+ buf = self._buffer
+ text = buf.get_text(buf.get_start_iter(), buf.get_end_iter(),
+ include_hidden_chars=False)
+ return text.strip()
+
+ def set_color(self, css_name):
+ self._view.set_name(css_name)
+
+ def set_tooltip_text(self, text):
+ self._view.set_tooltip_text(text)
+
+
+class PythonEditorParam(InputParam):
+
+ def __init__(self, *args, **kwargs):
+ InputParam.__init__(self, *args, **kwargs)
+ button = self._button = Gtk.Button(label='Open in Editor')
+ button.connect('clicked', self.open_editor)
+ self.pack_start(button, True, True, True)
+
+ def open_editor(self, widget=None):
+ self.param.parent_flowgraph.install_external_editor(self.param, parent=self._transient_for)
+
+ def get_text(self):
+ pass # we never update the value from here
+
+ def _apply_change(self, *args):
+ pass
+
+
+class EnumParam(InputParam):
+ """Provide an entry box for Enum types with a drop down menu."""
+
+ def __init__(self, *args, **kwargs):
+ InputParam.__init__(self, *args, **kwargs)
+ self._input = Gtk.ComboBoxText()
+ for option_name in self.param.options.values():
+ self._input.append_text(option_name)
+
+ self.param_values = list(self.param.options)
+ self._input.set_active(self.param_values.index(self.param.get_value()))
+ self._input.connect('changed', self._editing_callback)
+ self._input.connect('changed', self._apply_change)
+ self.pack_start(self._input, False, False, 0)
+
+ def get_text(self):
+ return self.param_values[self._input.get_active()]
+
+ def set_tooltip_text(self, text):
+ self._input.set_tooltip_text(text)
+
+
+class EnumEntryParam(InputParam):
+ """Provide an entry box and drop down menu for Raw Enum types."""
+
+ def __init__(self, *args, **kwargs):
+ InputParam.__init__(self, *args, **kwargs)
+ self._input = Gtk.ComboBoxText.new_with_entry()
+ for option_name in self.param.options.values():
+ self._input.append_text(option_name)
+
+ self.param_values = list(self.param.options)
+ value = self.param.get_value()
+ try:
+ self._input.set_active(self.param_values.index(value))
+ except ValueError:
+ self._input.set_active(-1)
+ self._input.get_child().set_text(value)
+
+ self._input.connect('changed', self._apply_change)
+ self._input.get_child().connect('changed', self._mark_changed)
+ self._input.get_child().connect('focus-out-event', self._apply_change)
+ self._input.get_child().connect('key-press-event', self._handle_key_press)
+ self.pack_start(self._input, False, False, 0)
+
+ @property
+ def has_custom_value(self):
+ return self._input.get_active() == -1
+
+ def get_text(self):
+ if self.has_custom_value:
+ return self._input.get_child().get_text()
+ else:
+ return self.param_values[self._input.get_active()]
+
+ def set_tooltip_text(self, text):
+ if self.has_custom_value: # custom entry
+ self._input.get_child().set_tooltip_text(text)
+ else:
+ self._input.set_tooltip_text(text)
+
+ def set_color(self, css_name):
+ self._input.get_child().set_name(
+ css_name if not self.has_custom_value else 'enum_custom'
+ )
+
+
+class FileParam(EntryParam):
+ """Provide an entry box for filename and a button to browse for a file."""
+
+ def __init__(self, *args, **kwargs):
+ EntryParam.__init__(self, *args, **kwargs)
+ self._open_button = Gtk.Button(label='...')
+ self._open_button.connect('clicked', self._handle_clicked)
+ self.pack_start(self._open_button, False, False, 0)
+
+ def _handle_clicked(self, widget=None):
+ """
+ If the button was clicked, open a file dialog in open/save format.
+ Replace the text in the entry with the new filename from the file dialog.
+ """
+ # get the paths
+ file_path = self.param.is_valid() and self.param.get_evaluated() or ''
+ (dirname, basename) = os.path.isfile(file_path) and os.path.split(file_path) or (file_path, '')
+ # check for qss theme default directory
+ if self.param.key == 'qt_qss_theme':
+ dirname = os.path.dirname(dirname) # trim filename
+ if not os.path.exists(dirname):
+ config = self.param.parent_platform.config
+ dirname = os.path.join(config.install_prefix, '/share/gnuradio/themes')
+ if not os.path.exists(dirname):
+ dirname = os.getcwd() # fix bad paths
+
+ # build the dialog
+ if self.param.dtype == 'file_open':
+ file_dialog = Gtk.FileChooserDialog(
+ 'Open a Data File...', None, Gtk.FileChooserAction.OPEN,
+ ('gtk-cancel', Gtk.ResponseType.CANCEL, 'gtk-open', Gtk.ResponseType.OK),
+ transient_for=self._transient_for,
+ )
+ elif self.param.dtype == 'file_save':
+ file_dialog = Gtk.FileChooserDialog(
+ 'Save a Data File...', None, Gtk.FileChooserAction.SAVE,
+ ('gtk-cancel', Gtk.ResponseType.CANCEL, 'gtk-save', Gtk.ResponseType.OK),
+ transient_for=self._transient_for,
+ )
+ file_dialog.set_do_overwrite_confirmation(True)
+ file_dialog.set_current_name(basename) # show the current filename
+ else:
+ raise ValueError("Can't open file chooser dialog for type " + repr(self.param.dtype))
+ file_dialog.set_current_folder(dirname) # current directory
+ file_dialog.set_select_multiple(False)
+ file_dialog.set_local_only(True)
+ if Gtk.ResponseType.OK == file_dialog.run(): # run the dialog
+ file_path = file_dialog.get_filename() # get the file path
+ self._input.set_text(file_path)
+ self._editing_callback()
+ self._apply_change()
+ file_dialog.destroy() # destroy the dialog
diff --git a/grc/gui/ParserErrorsDialog.py b/grc/gui/ParserErrorsDialog.py
index 68ee45941..050b9a4f9 100644
--- a/grc/gui/ParserErrorsDialog.py
+++ b/grc/gui/ParserErrorsDialog.py
@@ -17,14 +17,16 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-import pygtk
-pygtk.require('2.0')
-import gtk
+from __future__ import absolute_import
-from Constants import MIN_DIALOG_WIDTH, MIN_DIALOG_HEIGHT
+import six
+from gi.repository import Gtk, GObject
-class ParserErrorsDialog(gtk.Dialog):
+from .Constants import MIN_DIALOG_WIDTH, MIN_DIALOG_HEIGHT
+
+
+class ParserErrorsDialog(Gtk.Dialog):
"""
A dialog for viewing parser errors
"""
@@ -36,32 +38,32 @@ class ParserErrorsDialog(gtk.Dialog):
Args:
block: a block instance
"""
- gtk.Dialog.__init__(self, title='Parser Errors', buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_ACCEPT))
+ GObject.GObject.__init__(self, title='Parser Errors', buttons=(Gtk.STOCK_CLOSE, Gtk.ResponseType.ACCEPT))
self._error_logs = None
- self.tree_store = gtk.TreeStore(str)
+ self.tree_store = Gtk.TreeStore(str)
self.update_tree_store(error_logs)
- column = gtk.TreeViewColumn('XML Parser Errors by Filename')
- renderer = gtk.CellRendererText()
+ column = Gtk.TreeViewColumn('XML Parser Errors by Filename')
+ renderer = Gtk.CellRendererText()
column.pack_start(renderer, True)
column.add_attribute(renderer, 'text', 0)
column.set_sort_column_id(0)
- self.tree_view = tree_view = gtk.TreeView(self.tree_store)
+ self.tree_view = tree_view = Gtk.TreeView(self.tree_store)
tree_view.set_enable_search(False) # disable pop up search box
tree_view.set_search_column(-1) # really disable search
tree_view.set_reorderable(False)
tree_view.set_headers_visible(False)
- tree_view.get_selection().set_mode(gtk.SELECTION_NONE)
+ tree_view.get_selection().set_mode(Gtk.SelectionMode.NONE)
tree_view.append_column(column)
for row in self.tree_store:
tree_view.expand_row(row.path, False)
- scrolled_window = gtk.ScrolledWindow()
- scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- scrolled_window.add_with_viewport(tree_view)
+ scrolled_window = Gtk.ScrolledWindow()
+ scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
+ scrolled_window.add(tree_view)
self.vbox.pack_start(scrolled_window, True)
self.set_size_request(2*MIN_DIALOG_WIDTH, MIN_DIALOG_HEIGHT)
@@ -71,7 +73,7 @@ class ParserErrorsDialog(gtk.Dialog):
"""set up data model"""
self.tree_store.clear()
self._error_logs = error_logs
- for filename, errors in error_logs.iteritems():
+ for filename, errors in six.iteritems(error_logs):
parent = self.tree_store.append(None, [str(filename)])
try:
with open(filename, 'r') as fp:
@@ -95,6 +97,6 @@ class ParserErrorsDialog(gtk.Dialog):
Returns:
true if the response was accept
"""
- response = gtk.Dialog.run(self)
+ response = Gtk.Dialog.run(self)
self.destroy()
- return response == gtk.RESPONSE_ACCEPT
+ return response == Gtk.ResponseType.ACCEPT
diff --git a/grc/gui/Platform.py b/grc/gui/Platform.py
index 500df1cce..8eb79f345 100644
--- a/grc/gui/Platform.py
+++ b/grc/gui/Platform.py
@@ -17,25 +17,21 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-import os
-import sys
+from __future__ import absolute_import, print_function
-from ..core.Platform import Platform as _Platform
+import sys
+import os
-from .Config import Config as _Config
-from .Block import Block as _Block
-from .Connection import Connection as _Connection
-from .Element import Element
-from .FlowGraph import FlowGraph as _FlowGraph
-from .Param import Param as _Param
-from .Port import Port as _Port
+from .Config import Config
+from . import canvas
+from ..core.platform import Platform as CorePlatform
+from ..core.utils.backports import ChainMap
-class Platform(Element, _Platform):
+class Platform(CorePlatform):
def __init__(self, *args, **kwargs):
- Element.__init__(self)
- _Platform.__init__(self, *args, **kwargs)
+ CorePlatform.__init__(self, *args, **kwargs)
# Ensure conf directories
gui_prefs_file = self.config.gui_prefs_file
@@ -58,14 +54,24 @@ class Platform(Element, _Platform):
import shutil
shutil.move(old_gui_prefs_file, gui_prefs_file)
except Exception as e:
- print >> sys.stderr, e
+ print(e, file=sys.stderr)
##############################################
- # Constructors
+ # Factories
##############################################
- FlowGraph = _FlowGraph
- Connection = _Connection
- Block = _Block
- Port = _Port
- Param = _Param
- Config = _Config
+ Config = Config
+ FlowGraph = canvas.FlowGraph
+ Connection = canvas.Connection
+
+ def new_block_class(self, **data):
+ cls = CorePlatform.new_block_class(self, **data)
+ return canvas.Block.make_cls_with_base(cls)
+
+ block_classes_build_in = {key: canvas.Block.make_cls_with_base(cls)
+ for key, cls in CorePlatform.block_classes_build_in.items()}
+ block_classes = ChainMap({}, block_classes_build_in)
+
+ port_classes = {key: canvas.Port.make_cls_with_base(cls)
+ for key, cls in CorePlatform.port_classes.items()}
+ param_classes = {key: canvas.Param.make_cls_with_base(cls)
+ for key, cls in CorePlatform.param_classes.items()}
diff --git a/grc/gui/Port.py b/grc/gui/Port.py
deleted file mode 100644
index 690b1087e..000000000
--- a/grc/gui/Port.py
+++ /dev/null
@@ -1,277 +0,0 @@
-"""
-Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
-This file is part of GNU Radio
-
-GNU Radio Companion 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 2
-of the License, or (at your option) any later version.
-
-GNU Radio Companion 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 program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-"""
-
-import pygtk
-pygtk.require('2.0')
-import gtk
-
-from . import Actions, Colors, Utils
-from .Constants import (
- PORT_SEPARATION, PORT_SPACING, CONNECTOR_EXTENSION_MINIMAL,
- CONNECTOR_EXTENSION_INCREMENT, PORT_LABEL_PADDING, PORT_MIN_WIDTH, PORT_LABEL_HIDDEN_WIDTH, PORT_FONT
-)
-from .Element import Element
-from ..core.Constants import DEFAULT_DOMAIN, GR_MESSAGE_DOMAIN
-
-from ..core.Port import Port as _Port
-
-PORT_MARKUP_TMPL="""\
-<span foreground="black" font_desc="$font">$encode($port.get_name())</span>"""
-
-
-class Port(_Port, Element):
- """The graphical port."""
-
- def __init__(self, block, n, dir):
- """
- Port constructor.
- Create list of connector coordinates.
- """
- _Port.__init__(self, block, n, dir)
- Element.__init__(self)
- self.W = self.H = self.w = self.h = 0
- self._connector_coordinate = (0, 0)
- self._connector_length = 0
- self._hovering = True
- self._force_label_unhidden = False
-
- def create_shapes(self):
- """Create new areas and labels for the port."""
- Element.create_shapes(self)
- if self.get_hide():
- return # this port is hidden, no need to create shapes
- if self.get_domain() == GR_MESSAGE_DOMAIN:
- pass
- elif self.get_domain() != DEFAULT_DOMAIN:
- self.line_attributes[0] = 2
- #get current rotation
- rotation = self.get_rotation()
- #get all sibling ports
- ports = self.get_parent().get_sources_gui() \
- if self.is_source else self.get_parent().get_sinks_gui()
- ports = filter(lambda p: not p.get_hide(), ports)
- #get the max width
- self.W = max([port.W for port in ports] + [PORT_MIN_WIDTH])
- W = self.W if not self._label_hidden() else PORT_LABEL_HIDDEN_WIDTH
- #get a numeric index for this port relative to its sibling ports
- try:
- index = ports.index(self)
- except:
- if hasattr(self, '_connector_length'):
- del self._connector_length
- return
- length = len(filter(lambda p: not p.get_hide(), ports))
- #reverse the order of ports for these rotations
- if rotation in (180, 270):
- index = length-index-1
-
- port_separation = PORT_SEPARATION \
- if not self.get_parent().has_busses[self.is_source] \
- else max([port.H for port in ports]) + PORT_SPACING
-
- offset = (self.get_parent().H - (length-1)*port_separation - self.H)/2
- #create areas and connector coordinates
- if (self.is_sink and rotation == 0) or (self.is_source and rotation == 180):
- x = -W
- y = port_separation*index+offset
- self.add_area((x, y), (W, self.H))
- self._connector_coordinate = (x-1, y+self.H/2)
- elif (self.is_source and rotation == 0) or (self.is_sink and rotation == 180):
- x = self.get_parent().W
- y = port_separation*index+offset
- self.add_area((x, y), (W, self.H))
- self._connector_coordinate = (x+1+W, y+self.H/2)
- elif (self.is_source and rotation == 90) or (self.is_sink and rotation == 270):
- y = -W
- x = port_separation*index+offset
- self.add_area((x, y), (self.H, W))
- self._connector_coordinate = (x+self.H/2, y-1)
- elif (self.is_sink and rotation == 90) or (self.is_source and rotation == 270):
- y = self.get_parent().W
- x = port_separation*index+offset
- self.add_area((x, y), (self.H, W))
- self._connector_coordinate = (x+self.H/2, y+1+W)
- #the connector length
- self._connector_length = CONNECTOR_EXTENSION_MINIMAL + CONNECTOR_EXTENSION_INCREMENT*index
-
- def create_labels(self):
- """Create the labels for the socket."""
- Element.create_labels(self)
- self._bg_color = Colors.get_color(self.get_color())
- # create the layout
- layout = gtk.DrawingArea().create_pango_layout('')
- layout.set_markup(Utils.parse_template(PORT_MARKUP_TMPL, port=self, font=PORT_FONT))
- self.w, self.h = layout.get_pixel_size()
- self.W = 2 * PORT_LABEL_PADDING + self.w
- self.H = 2 * PORT_LABEL_PADDING + self.h * (
- 3 if self.get_type() == 'bus' else 1)
- self.H += self.H % 2
- # create the pixmap
- pixmap = self.get_parent().get_parent().new_pixmap(self.w, self.h)
- gc = pixmap.new_gc()
- gc.set_foreground(self._bg_color)
- pixmap.draw_rectangle(gc, True, 0, 0, self.w, self.h)
- pixmap.draw_layout(gc, 0, 0, layout)
- # create vertical and horizontal pixmaps
- self.horizontal_label = pixmap
- if self.is_vertical():
- self.vertical_label = self.get_parent().get_parent().new_pixmap(self.h, self.w)
- Utils.rotate_pixmap(gc, self.horizontal_label, self.vertical_label)
-
- def draw(self, gc, window):
- """
- Draw the socket with a label.
-
- Args:
- gc: the graphics context
- window: the gtk window to draw on
- """
- Element.draw(
- self, gc, window, bg_color=self._bg_color,
- border_color=self.is_highlighted() and Colors.HIGHLIGHT_COLOR or
- self.get_parent().is_dummy_block and Colors.MISSING_BLOCK_BORDER_COLOR or
- Colors.BORDER_COLOR,
- )
- if not self._areas_list or self._label_hidden():
- return # this port is either hidden (no areas) or folded (no label)
- X, Y = self.get_coordinate()
- (x, y), (w, h) = self._areas_list[0] # use the first area's sizes to place the labels
- if self.is_horizontal():
- window.draw_drawable(gc, self.horizontal_label, 0, 0, x+X+(self.W-self.w)/2, y+Y+(self.H-self.h)/2, -1, -1)
- elif self.is_vertical():
- window.draw_drawable(gc, self.vertical_label, 0, 0, x+X+(self.H-self.h)/2, y+Y+(self.W-self.w)/2, -1, -1)
-
- def get_connector_coordinate(self):
- """
- Get the coordinate where connections may attach to.
-
- Returns:
- the connector coordinate (x, y) tuple
- """
- x, y = self._connector_coordinate
- X, Y = self.get_coordinate()
- return (x + X, y + Y)
-
- def get_connector_direction(self):
- """
- Get the direction that the socket points: 0,90,180,270.
- This is the rotation degree if the socket is an output or
- the rotation degree + 180 if the socket is an input.
-
- Returns:
- the direction in degrees
- """
- if self.is_source: return self.get_rotation()
- elif self.is_sink: return (self.get_rotation() + 180)%360
-
- def get_connector_length(self):
- """
- Get the length of the connector.
- The connector length increases as the port index changes.
-
- Returns:
- the length in pixels
- """
- return self._connector_length
-
- def get_rotation(self):
- """
- Get the parent's rotation rather than self.
-
- Returns:
- the parent's rotation
- """
- return self.get_parent().get_rotation()
-
- def move(self, delta_coor):
- """
- Move the parent rather than self.
-
- Args:
- delta_corr: the (delta_x, delta_y) tuple
- """
- self.get_parent().move(delta_coor)
-
- def rotate(self, direction):
- """
- Rotate the parent rather than self.
-
- Args:
- direction: degrees to rotate
- """
- self.get_parent().rotate(direction)
-
- def get_coordinate(self):
- """
- Get the parent's coordinate rather than self.
-
- Returns:
- the parents coordinate
- """
- return self.get_parent().get_coordinate()
-
- def set_highlighted(self, highlight):
- """
- Set the parent highlight rather than self.
-
- Args:
- highlight: true to enable highlighting
- """
- self.get_parent().set_highlighted(highlight)
-
- def is_highlighted(self):
- """
- Get the parent's is highlight rather than self.
-
- Returns:
- the parent's highlighting status
- """
- return self.get_parent().is_highlighted()
-
- def _label_hidden(self):
- """
- Figure out if the label should be hidden
-
- Returns:
- true if the label should not be shown
- """
- return self._hovering and not self._force_label_unhidden and Actions.TOGGLE_AUTO_HIDE_PORT_LABELS.get_active()
-
- def force_label_unhidden(self, enable=True):
- """
- Disable showing the label on mouse-over for this port
-
- Args:
- enable: true to override the mouse-over behaviour
- """
- self._force_label_unhidden = enable
-
- def mouse_over(self):
- """
- Called from flow graph on mouse-over
- """
- self._hovering = False
- return Actions.TOGGLE_AUTO_HIDE_PORT_LABELS.get_active() # only redraw if necessary
-
- def mouse_out(self):
- """
- Called from flow graph on mouse-out
- """
- self._hovering = True
- return Actions.TOGGLE_AUTO_HIDE_PORT_LABELS.get_active() # only redraw if necessary
diff --git a/grc/gui/Preferences.py b/grc/gui/Preferences.py
deleted file mode 100644
index d377018eb..000000000
--- a/grc/gui/Preferences.py
+++ /dev/null
@@ -1,173 +0,0 @@
-"""
-Copyright 2008 Free Software Foundation, Inc.
-This file is part of GNU Radio
-
-GNU Radio Companion 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 2
-of the License, or (at your option) any later version.
-
-GNU Radio Companion 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 program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-"""
-
-import os
-import sys
-import ConfigParser
-
-
-HEADER = """\
-# This contains only GUI settings for GRC and is not meant for users to edit.
-#
-# GRC settings not accessible through the GUI are in gnuradio.conf under
-# section [grc].
-
-"""
-
-_platform = None
-_config_parser = ConfigParser.SafeConfigParser()
-
-
-def file_extension():
- return '.grc'
-
-
-def load(platform):
- global _platform
- _platform = platform
- # create sections
- for section in ['main', 'files_open', 'files_recent']:
- try:
- _config_parser.add_section(section)
- except Exception, e:
- print e
- try:
- _config_parser.read(_platform.get_prefs_file())
- except Exception as err:
- print >> sys.stderr, err
-
-
-def save():
- try:
- with open(_platform.get_prefs_file(), 'w') as fp:
- fp.write(HEADER)
- _config_parser.write(fp)
- except Exception as err:
- print >> sys.stderr, err
-
-
-def entry(key, value=None, default=None):
- if value is not None:
- _config_parser.set('main', key, str(value))
- result = value
- else:
- _type = type(default) if default is not None else str
- getter = {
- bool: _config_parser.getboolean,
- int: _config_parser.getint,
- }.get(_type, _config_parser.get)
- try:
- result = getter('main', key)
- except (AttributeError, ConfigParser.Error):
- result = _type() if default is None else default
- return result
-
-
-###########################################################################
-# Special methods for specific program functionalities
-###########################################################################
-
-def main_window_size(size=None):
- if size is None:
- size = [None, None]
- w = entry('main_window_width', size[0], default=1)
- h = entry('main_window_height', size[1], default=1)
- return w, h
-
-
-def file_open(filename=None):
- return entry('file_open', filename, default='')
-
-
-def set_file_list(key, files):
- _config_parser.remove_section(key) # clear section
- _config_parser.add_section(key)
- for i, filename in enumerate(files):
- _config_parser.set(key, '%s_%d' % (key, i), filename)
-
-
-def get_file_list(key):
- try:
- files = [value for name, value in _config_parser.items(key)
- if name.startswith('%s_' % key)]
- except (AttributeError, ConfigParser.Error):
- files = []
- return files
-
-
-def get_open_files():
- return get_file_list('files_open')
-
-
-def set_open_files(files):
- return set_file_list('files_open', files)
-
-
-def get_recent_files():
- """ Gets recent files, removes any that do not exist and re-saves it """
- files = filter(os.path.exists, get_file_list('files_recent'))
- set_recent_files(files)
- return files
-
-
-def set_recent_files(files):
- return set_file_list('files_recent', files)
-
-
-def add_recent_file(file_name):
- # double check file_name
- if os.path.exists(file_name):
- recent_files = get_recent_files()
- if file_name in recent_files:
- recent_files.remove(file_name) # Attempt removal
- recent_files.insert(0, file_name) # Insert at start
- set_recent_files(recent_files[:10]) # Keep up to 10 files
-
-
-def console_window_position(pos=None):
- return entry('console_window_position', pos, default=-1) or 1
-
-
-def blocks_window_position(pos=None):
- return entry('blocks_window_position', pos, default=-1) or 1
-
-
-def variable_editor_position(pos=None, sidebar=False):
- # Figure out default
- if sidebar:
- w, h = main_window_size()
- return entry('variable_editor_sidebar_position', pos, default=int(h*0.7))
- else:
- return entry('variable_editor_position', pos, default=int(blocks_window_position()*0.5))
-
-
-def variable_editor_sidebar(pos=None):
- return entry('variable_editor_sidebar', pos, default=False)
-
-
-def variable_editor_confirm_delete(pos=None):
- return entry('variable_editor_confirm_delete', pos, default=True)
-
-
-def xterm_missing(cmd=None):
- return entry('xterm_missing', cmd, default='INVALID_XTERM_SETTING')
-
-
-def screen_shot_background_transparent(transparent=None):
- return entry('screen_shot_background_transparent', transparent, default=False)
diff --git a/grc/gui/PropsDialog.py b/grc/gui/PropsDialog.py
index a5b46cbba..ac4506a3d 100644
--- a/grc/gui/PropsDialog.py
+++ b/grc/gui/PropsDialog.py
@@ -17,116 +17,91 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-import pygtk
-pygtk.require('2.0')
-import gtk
+from __future__ import absolute_import
+from gi.repository import Gtk, Gdk, GObject, Pango
-import Actions
-from Dialogs import SimpleTextDisplay
-from Constants import MIN_DIALOG_WIDTH, MIN_DIALOG_HEIGHT, FONT_SIZE
-import Utils
-import pango
+from . import Actions, Utils, Constants
+from .Dialogs import SimpleTextDisplay
+import six
-TAB_LABEL_MARKUP_TMPL="""\
-#set $foreground = $valid and 'black' or 'red'
-<span foreground="$foreground">$encode($tab)</span>"""
-
-def get_title_label(title):
- """
- Get a title label for the params window.
- The title will be bold, underlined, and left justified.
-
- Args:
- title: the text of the title
-
- Returns:
- a gtk object
- """
- label = gtk.Label()
- label.set_markup('\n<b><span underline="low">%s</span>:</b>\n'%title)
- hbox = gtk.HBox()
- hbox.pack_start(label, False, False, padding=11)
- return hbox
-
-
-class PropsDialog(gtk.Dialog):
+class PropsDialog(Gtk.Dialog):
"""
A dialog to set block parameters, view errors, and view documentation.
"""
- def __init__(self, block):
+ def __init__(self, parent, block):
"""
Properties dialog constructor.
- Args:
+ Args:%
block: a block instance
"""
- self._hash = 0
- gtk.Dialog.__init__(
+ Gtk.Dialog.__init__(
self,
- title='Properties: %s' % block.get_name(),
- buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
- gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
- gtk.STOCK_APPLY, gtk.RESPONSE_APPLY)
+ title='Properties: ' + block.label,
+ transient_for=parent,
+ modal=True,
+ destroy_with_parent=True,
+ )
+ self.add_buttons(
+ Gtk.STOCK_OK, Gtk.ResponseType.ACCEPT,
+ Gtk.STOCK_CANCEL, Gtk.ResponseType.REJECT,
+ Gtk.STOCK_APPLY, Gtk.ResponseType.APPLY,
)
- self.set_response_sensitive(gtk.RESPONSE_APPLY, False)
+ self.set_response_sensitive(Gtk.ResponseType.APPLY, False)
self.set_size_request(*Utils.scale(
- (MIN_DIALOG_WIDTH, MIN_DIALOG_HEIGHT)
+ (Constants.MIN_DIALOG_WIDTH, Constants.MIN_DIALOG_HEIGHT)
))
+
self._block = block
+ self._hash = 0
- vpaned = gtk.VPaned()
- self.vbox.pack_start(vpaned)
+ vpaned = Gtk.VPaned()
+ self.vbox.pack_start(vpaned, True, True, 0)
# Notebook to hold param boxes
- notebook = gtk.Notebook()
+ notebook = self.notebook = Gtk.Notebook()
notebook.set_show_border(False)
notebook.set_scrollable(True) # scroll arrows for page tabs
- notebook.set_tab_pos(gtk.POS_TOP)
+ notebook.set_tab_pos(Gtk.PositionType.TOP)
vpaned.pack1(notebook, True)
# Params boxes for block parameters
- self._params_boxes = list()
- for tab in block.get_param_tab_labels():
- label = gtk.Label()
- vbox = gtk.VBox()
- scroll_box = gtk.ScrolledWindow()
- scroll_box.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- scroll_box.add_with_viewport(vbox)
- notebook.append_page(scroll_box, label)
- self._params_boxes.append((tab, label, vbox))
+ self._params_boxes = []
+ self._build_param_tab_boxes()
# Docs for the block
self._docs_text_display = doc_view = SimpleTextDisplay()
- doc_view.get_buffer().create_tag('b', weight=pango.WEIGHT_BOLD)
- self._docs_box = gtk.ScrolledWindow()
- self._docs_box.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- self._docs_box.add_with_viewport(self._docs_text_display)
- notebook.append_page(self._docs_box, gtk.Label("Documentation"))
+ doc_view.get_buffer().create_tag('b', weight=Pango.Weight.BOLD)
+ self._docs_box = Gtk.ScrolledWindow()
+ self._docs_box.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
+ self._docs_box.add(self._docs_text_display)
+ notebook.append_page(self._docs_box, Gtk.Label(label="Documentation"))
# Generated code for the block
if Actions.TOGGLE_SHOW_CODE_PREVIEW_TAB.get_active():
self._code_text_display = code_view = SimpleTextDisplay()
- code_view.set_wrap_mode(gtk.WRAP_NONE)
- code_view.get_buffer().create_tag('b', weight=pango.WEIGHT_BOLD)
- code_view.modify_font(pango.FontDescription(
- 'monospace %d' % FONT_SIZE))
- code_box = gtk.ScrolledWindow()
- code_box.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- code_box.add_with_viewport(self._code_text_display)
- notebook.append_page(code_box, gtk.Label("Generated Code"))
+ code_view.set_wrap_mode(Gtk.WrapMode.NONE)
+ code_view.get_buffer().create_tag('b', weight=Pango.Weight.BOLD)
+ code_view.set_monospace(True)
+ # todo: set font size in non-deprecated way
+ # code_view.override_font(Pango.FontDescription('monospace %d' % Constants.FONT_SIZE))
+ code_box = Gtk.ScrolledWindow()
+ code_box.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
+ code_box.add(self._code_text_display)
+ notebook.append_page(code_box, Gtk.Label(label="Generated Code"))
else:
self._code_text_display = None
# Error Messages for the block
self._error_messages_text_display = SimpleTextDisplay()
- self._error_box = gtk.ScrolledWindow()
- self._error_box.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- self._error_box.add_with_viewport(self._error_messages_text_display)
+ self._error_box = Gtk.ScrolledWindow()
+ self._error_box.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
+ self._error_box.add(self._error_messages_text_display)
vpaned.pack2(self._error_box)
- vpaned.set_position(int(0.65 * MIN_DIALOG_HEIGHT))
+ vpaned.set_position(int(0.65 * Constants.MIN_DIALOG_HEIGHT))
# Connect events
self.connect('key-press-event', self._handle_key_press)
@@ -134,6 +109,27 @@ class PropsDialog(gtk.Dialog):
self.connect('response', self._handle_response)
self.show_all() # show all (performs initial gui update)
+ def _build_param_tab_boxes(self):
+ categories = (p.category for p in self._block.params.values())
+
+ def unique_categories():
+ seen = {Constants.DEFAULT_PARAM_TAB}
+ yield Constants.DEFAULT_PARAM_TAB
+ for cat in categories:
+ if cat in seen:
+ continue
+ yield cat
+ seen.add(cat)
+
+ for category in unique_categories():
+ label = Gtk.Label()
+ vbox = Gtk.VBox()
+ scroll_box = Gtk.ScrolledWindow()
+ scroll_box.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
+ scroll_box.add(vbox)
+ self.notebook.append_page(scroll_box, label)
+ self._params_boxes.append((category, label, vbox))
+
def _params_changed(self):
"""
Have the params in this dialog changed?
@@ -146,25 +142,23 @@ class PropsDialog(gtk.Dialog):
true if changed
"""
old_hash = self._hash
- # create a tuple of things from each param that affects the params box
- self._hash = hash(tuple([(
- hash(param), param.get_name(), param.get_type(),
- param.get_hide() == 'all',
- ) for param in self._block.get_params()]))
- return self._hash != old_hash
+ new_hash = self._hash = hash(tuple(
+ (hash(param), param.name, param.dtype, param.hide == 'all',)
+ for param in self._block.params.values()
+ ))
+ return new_hash != old_hash
def _handle_changed(self, *args):
"""
A change occurred within a param:
Rewrite/validate the block and update the gui.
"""
- # update for the block
self._block.rewrite()
self._block.validate()
self.update_gui()
def _activate_apply(self, *args):
- self.set_response_sensitive(gtk.RESPONSE_APPLY, True)
+ self.set_response_sensitive(Gtk.ResponseType.APPLY, True)
def update_gui(self, widget=None, force=False):
"""
@@ -175,45 +169,49 @@ class PropsDialog(gtk.Dialog):
Update the documentation block.
Hide the box if there are no docs.
"""
- # update the params box
if force or self._params_changed():
# hide params box before changing
- for tab, label, vbox in self._params_boxes:
- vbox.hide_all()
+ for category, label, vbox in self._params_boxes:
+ vbox.hide()
# empty the params box
for child in vbox.get_children():
vbox.remove(child)
- child.destroy()
+ # child.destroy() # disabled because it throws errors...
# repopulate the params box
box_all_valid = True
- for param in filter(lambda p: p.get_tab_label() == tab, self._block.get_params()):
- if param.get_hide() == 'all':
+ for param in self._block.params.values():
+ # todo: why do we even rebuild instead of really hiding params?
+ if param.category != category or param.hide == 'all':
continue
box_all_valid = box_all_valid and param.is_valid()
- input_widget = param.get_input(self._handle_changed, self._activate_apply)
- vbox.pack_start(input_widget, input_widget.expand)
- label.set_markup(Utils.parse_template(TAB_LABEL_MARKUP_TMPL, valid=box_all_valid, tab=tab))
- # show params box with new params
- vbox.show_all()
- # update the errors box
+
+ input_widget = param.get_input(self._handle_changed, self._activate_apply,
+ transient_for=self.get_transient_for())
+ input_widget.show_all()
+ vbox.pack_start(input_widget, input_widget.expand, True, 1)
+
+ label.set_markup('<span {color}>{name}</span>'.format(
+ color='foreground="red"' if not box_all_valid else '', name=Utils.encode(category)
+ ))
+ vbox.show() # show params box with new params
+
if self._block.is_valid():
self._error_box.hide()
else:
self._error_box.show()
messages = '\n\n'.join(self._block.get_error_messages())
self._error_messages_text_display.set_text(messages)
- # update the docs box
+
self._update_docs_page()
- # update the generated code
self._update_generated_code_page()
def _update_docs_page(self):
"""Show documentation from XML and try to display best matching docstring"""
- buffer = self._docs_text_display.get_buffer()
- buffer.delete(buffer.get_start_iter(), buffer.get_end_iter())
- pos = buffer.get_end_iter()
+ buf = self._docs_text_display.get_buffer()
+ buf.delete(buf.get_start_iter(), buf.get_end_iter())
+ pos = buf.get_end_iter()
- docstrings = self._block.get_doc()
+ docstrings = self._block.documentation
if not docstrings:
return
@@ -221,77 +219,71 @@ class PropsDialog(gtk.Dialog):
from_xml = docstrings.pop('', '')
for line in from_xml.splitlines():
if line.lstrip() == line and line.endswith(':'):
- buffer.insert_with_tags_by_name(pos, line + '\n', 'b')
+ buf.insert_with_tags_by_name(pos, line + '\n', 'b')
else:
- buffer.insert(pos, line + '\n')
+ buf.insert(pos, line + '\n')
if from_xml:
- buffer.insert(pos, '\n')
+ buf.insert(pos, '\n')
# if given the current parameters an exact match can be made
- block_constructor = self._block.get_make().rsplit('.', 2)[-1]
+ block_constructor = self._block.templates.render('make').rsplit('.', 2)[-1]
block_class = block_constructor.partition('(')[0].strip()
if block_class in docstrings:
docstrings = {block_class: docstrings[block_class]}
# show docstring(s) extracted from python sources
- for cls_name, docstring in docstrings.iteritems():
- buffer.insert_with_tags_by_name(pos, cls_name + '\n', 'b')
- buffer.insert(pos, docstring + '\n\n')
+ for cls_name, docstring in six.iteritems(docstrings):
+ buf.insert_with_tags_by_name(pos, cls_name + '\n', 'b')
+ buf.insert(pos, docstring + '\n\n')
pos.backward_chars(2)
- buffer.delete(pos, buffer.get_end_iter())
+ buf.delete(pos, buf.get_end_iter())
def _update_generated_code_page(self):
if not self._code_text_display:
return # user disabled code preview
- buffer = self._code_text_display.get_buffer()
+ buf = self._code_text_display.get_buffer()
block = self._block
- key = block.get_key()
+ key = block.key
if key == 'epy_block':
- src = block.get_param('_source_code').get_value()
+ src = block.params['_source_code'].get_value()
elif key == 'epy_module':
- src = block.get_param('source_code').get_value()
+ src = block.params['source_code'].get_value()
else:
src = ''
def insert(header, text):
if not text:
return
- buffer.insert_with_tags_by_name(buffer.get_end_iter(), header, 'b')
- buffer.insert(buffer.get_end_iter(), text)
-
- buffer.delete(buffer.get_start_iter(), buffer.get_end_iter())
- insert('# Imports\n', '\n'.join(block.get_imports()))
- if key.startswith('variable'):
- insert('\n\n# Variables\n', block.get_var_make())
- insert('\n\n# Blocks\n', block.get_make())
+ buf.insert_with_tags_by_name(buf.get_end_iter(), header, 'b')
+ buf.insert(buf.get_end_iter(), text)
+
+ buf.delete(buf.get_start_iter(), buf.get_end_iter())
+ insert('# Imports\n', block.templates.render('imports').strip('\n'))
+ if block.is_variable:
+ insert('\n\n# Variables\n', block.templates.render('var_make'))
+ insert('\n\n# Blocks\n', block.templates.render('make'))
if src:
- insert('\n\n# External Code ({}.py)\n'.format(block.get_id()), src)
+ insert('\n\n# External Code ({}.py)\n'.format(block.name), src)
def _handle_key_press(self, widget, event):
- """
- Handle key presses from the keyboard.
- Call the ok response when enter is pressed.
-
- Returns:
- false to forward the keypress
- """
- if (event.keyval == gtk.keysyms.Return and
- event.state & gtk.gdk.CONTROL_MASK == 0 and
- not isinstance(widget.get_focus(), gtk.TextView)
- ):
- self.response(gtk.RESPONSE_ACCEPT)
+ close_dialog = (
+ event.keyval == Gdk.KEY_Return and
+ event.get_state() & Gdk.ModifierType.CONTROL_MASK == 0 and
+ not isinstance(widget.get_focus(), Gtk.TextView)
+ )
+ if close_dialog:
+ self.response(Gtk.ResponseType.ACCEPT)
return True # handled here
+
return False # forward the keypress
def _handle_response(self, widget, response):
- if response in (gtk.RESPONSE_APPLY, gtk.RESPONSE_ACCEPT):
+ if response in (Gtk.ResponseType.APPLY, Gtk.ResponseType.ACCEPT):
for tab, label, vbox in self._params_boxes:
for child in vbox.get_children():
child.apply_pending_changes()
- self.set_response_sensitive(gtk.RESPONSE_APPLY, False)
+ self.set_response_sensitive(Gtk.ResponseType.APPLY, False)
return True
return False
-
-
diff --git a/grc/gui/StateCache.py b/grc/gui/StateCache.py
index 12ec9305b..8159d7124 100644
--- a/grc/gui/StateCache.py
+++ b/grc/gui/StateCache.py
@@ -17,8 +17,9 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-import Actions
-from Constants import STATE_CACHE_SIZE
+from __future__ import absolute_import
+from . import Actions
+from .Constants import STATE_CACHE_SIZE
class StateCache(object):
"""
@@ -98,5 +99,5 @@ class StateCache(object):
"""
Update the undo and redo actions based on the number of next and prev states.
"""
- Actions.FLOW_GRAPH_REDO.set_sensitive(self.num_next_states != 0)
- Actions.FLOW_GRAPH_UNDO.set_sensitive(self.num_prev_states != 0)
+ Actions.FLOW_GRAPH_REDO.set_enabled(self.num_next_states != 0)
+ Actions.FLOW_GRAPH_UNDO.set_enabled(self.num_prev_states != 0)
diff --git a/grc/gui/Utils.py b/grc/gui/Utils.py
index 3ab8d2009..1b32e9143 100644
--- a/grc/gui/Utils.py
+++ b/grc/gui/Utils.py
@@ -17,37 +17,16 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-import pygtk
-pygtk.require('2.0')
-import gtk
-import gobject
+from __future__ import absolute_import
-from Cheetah.Template import Template
+import numbers
-from Constants import POSSIBLE_ROTATIONS, CANVAS_GRID_SIZE, DPI_SCALING
+from gi.repository import GLib
+import cairo
+import six
-
-def rotate_pixmap(gc, src_pixmap, dst_pixmap, angle=gtk.gdk.PIXBUF_ROTATE_COUNTERCLOCKWISE):
- """
- Load the destination pixmap with a rotated version of the source pixmap.
- The source pixmap will be loaded into a pixbuf, rotated, and drawn to the destination pixmap.
- The pixbuf is a client-side drawable, where a pixmap is a server-side drawable.
-
- Args:
- gc: the graphics context
- src_pixmap: the source pixmap
- dst_pixmap: the destination pixmap
- angle: the angle to rotate by
- """
- width, height = src_pixmap.get_size()
- pixbuf = gtk.gdk.Pixbuf(
- colorspace=gtk.gdk.COLORSPACE_RGB,
- has_alpha=False, bits_per_sample=8,
- width=width, height=height,
- )
- pixbuf.get_from_drawable(src_pixmap, src_pixmap.get_colormap(), 0, 0, 0, 0, -1, -1)
- pixbuf = pixbuf.rotate_simple(angle)
- dst_pixmap.draw_pixbuf(gc, pixbuf, 0, 0, 0, 0)
+from .canvas.colors import FLOWGRAPH_BACKGROUND_COLOR
+from . import Constants
def get_rotated_coordinate(coor, rotation):
@@ -62,8 +41,8 @@ def get_rotated_coordinate(coor, rotation):
the rotated coordinates
"""
# handles negative angles
- rotation = (rotation + 360)%360
- if rotation not in POSSIBLE_ROTATIONS:
+ rotation = (rotation + 360) % 360
+ if rotation not in Constants.POSSIBLE_ROTATIONS:
raise ValueError('unusable rotation angle "%s"'%str(rotation))
# determine the number of degrees to rotate
cos_r, sin_r = {
@@ -73,7 +52,7 @@ def get_rotated_coordinate(coor, rotation):
return x * cos_r + y * sin_r, -x * sin_r + y * cos_r
-def get_angle_from_coordinates((x1, y1), (x2, y2)):
+def get_angle_from_coordinates(p1, p2):
"""
Given two points, calculate the vector direction from point1 to point2, directions are multiples of 90 degrees.
@@ -84,59 +63,103 @@ def get_angle_from_coordinates((x1, y1), (x2, y2)):
Returns:
the direction in degrees
"""
+ (x1, y1) = p1
+ (x2, y2) = p2
if y1 == y2: # 0 or 180
return 0 if x2 > x1 else 180
else: # 90 or 270
return 270 if y2 > y1 else 90
+def align_to_grid(coor, mode=round):
+ def align(value):
+ return int(mode(value / (1.0 * Constants.CANVAS_GRID_SIZE)) * Constants.CANVAS_GRID_SIZE)
+ try:
+ return [align(c) for c in coor]
+ except TypeError:
+ x = coor
+ return align(coor)
+
+
+def num_to_str(num):
+ """ Display logic for numbers """
+ def eng_notation(value, fmt='g'):
+ """Convert a number to a string in engineering notation. E.g., 5e-9 -> 5n"""
+ template = '{:' + fmt + '}{}'
+ magnitude = abs(value)
+ for exp, symbol in zip(range(9, -15-1, -3), 'GMk munpf'):
+ factor = 10 ** exp
+ if magnitude >= factor:
+ return template.format(value / factor, symbol.strip())
+ return template.format(value, '')
+
+ if isinstance(num, numbers.Complex):
+ num = complex(num) # Cast to python complex
+ if num == 0:
+ return '0'
+ output = eng_notation(num.real) if num.real else ''
+ output += eng_notation(num.imag, '+g' if output else 'g') + 'j' if num.imag else ''
+ return output
+ else:
+ return str(num)
+
+
def encode(value):
"""Make sure that we pass only valid utf-8 strings into markup_escape_text.
Older versions of glib seg fault if the last byte starts a multi-byte
character.
"""
+ if six.PY2:
+ valid_utf8 = value.decode('utf-8', errors='replace').encode('utf-8')
+ else:
+ valid_utf8 = value
+ return GLib.markup_escape_text(valid_utf8)
- valid_utf8 = value.decode('utf-8', errors='replace').encode('utf-8')
- return gobject.markup_escape_text(valid_utf8)
+def make_screenshot(flow_graph, file_path, transparent_bg=False):
+ if not file_path:
+ return
-class TemplateParser(object):
- def __init__(self):
- self.cache = {}
+ x_min, y_min, x_max, y_max = flow_graph.get_extents()
+ padding = Constants.CANVAS_GRID_SIZE
+ width = x_max - x_min + 2 * padding
+ height = y_max - y_min + 2 * padding
- def __call__(self, tmpl_str, **kwargs):
- """
- Parse the template string with the given args.
- Pass in the xml encode method for pango escape chars.
+ if file_path.endswith('.png'):
+ psurf = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height)
+ elif file_path.endswith('.pdf'):
+ psurf = cairo.PDFSurface(file_path, width, height)
+ elif file_path.endswith('.svg'):
+ psurf = cairo.SVGSurface(file_path, width, height)
+ else:
+ raise ValueError('Unknown file format')
- Args:
- tmpl_str: the template as a string
+ cr = cairo.Context(psurf)
- Returns:
- a string of the parsed template
- """
- kwargs['encode'] = encode
- template = self.cache.setdefault(tmpl_str, Template.compile(tmpl_str))
- return str(template(namespaces=kwargs))
+ if not transparent_bg:
+ cr.set_source_rgba(*FLOWGRAPH_BACKGROUND_COLOR)
+ cr.rectangle(0, 0, width, height)
+ cr.fill()
-parse_template = TemplateParser()
+ cr.translate(padding - x_min, padding - y_min)
+ flow_graph.create_labels(cr)
+ flow_graph.create_shapes()
+ flow_graph.draw(cr)
-def align_to_grid(coor, mode=round):
- def align(value):
- return int(mode(value / (1.0 * CANVAS_GRID_SIZE)) * CANVAS_GRID_SIZE)
- try:
- return map(align, coor)
- except TypeError:
- x = coor
- return align(coor)
+ if file_path.endswith('.png'):
+ psurf.write_to_png(file_path)
+ if file_path.endswith('.pdf') or file_path.endswith('.svg'):
+ cr.show_page()
+ psurf.finish()
def scale(coor, reverse=False):
- factor = DPI_SCALING if not reverse else 1 / DPI_SCALING
+ factor = Constants.DPI_SCALING if not reverse else 1 / Constants.DPI_SCALING
return tuple(int(x * factor) for x in coor)
+
def scale_scalar(coor, reverse=False):
- factor = DPI_SCALING if not reverse else 1 / DPI_SCALING
+ factor = Constants.DPI_SCALING if not reverse else 1 / Constants.DPI_SCALING
return int(coor * factor)
diff --git a/grc/gui/VariableEditor.py b/grc/gui/VariableEditor.py
index 45f0bb75f..c179c8bc8 100644
--- a/grc/gui/VariableEditor.py
+++ b/grc/gui/VariableEditor.py
@@ -1,5 +1,5 @@
"""
-Copyright 2015 Free Software Foundation, Inc.
+Copyright 2015, 2016 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
@@ -17,50 +17,45 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
-from operator import attrgetter
+from __future__ import absolute_import
-import pygtk
-pygtk.require('2.0')
-import gtk
-import gobject
+from gi.repository import Gtk, Gdk, GObject
-from . import Actions
-from . import Preferences
-from . import Utils
-from .Constants import DEFAULT_BLOCKS_WINDOW_WIDTH
+from . import Actions, Constants, Utils
BLOCK_INDEX = 0
ID_INDEX = 1
-class VariableEditorContextMenu(gtk.Menu):
+class VariableEditorContextMenu(Gtk.Menu):
""" A simple context menu for our variable editor """
+
def __init__(self, var_edit):
- gtk.Menu.__init__(self)
+ Gtk.Menu.__init__(self)
- self.imports = gtk.MenuItem("Add _Import")
+ self.imports = Gtk.MenuItem(label="Add _Import")
self.imports.connect('activate', var_edit.handle_action, var_edit.ADD_IMPORT)
self.add(self.imports)
- self.variables = gtk.MenuItem("Add _Variable")
+ self.variables = Gtk.MenuItem(label="Add _Variable")
self.variables.connect('activate', var_edit.handle_action, var_edit.ADD_VARIABLE)
self.add(self.variables)
- self.add(gtk.SeparatorMenuItem())
+ self.add(Gtk.SeparatorMenuItem())
- self.enable = gtk.MenuItem("_Enable")
+ self.enable = Gtk.MenuItem(label="_Enable")
self.enable.connect('activate', var_edit.handle_action, var_edit.ENABLE_BLOCK)
- self.disable = gtk.MenuItem("_Disable")
+ self.disable = Gtk.MenuItem(label="_Disable")
self.disable.connect('activate', var_edit.handle_action, var_edit.DISABLE_BLOCK)
self.add(self.enable)
self.add(self.disable)
- self.add(gtk.SeparatorMenuItem())
+ self.add(Gtk.SeparatorMenuItem())
- self.delete = gtk.MenuItem("_Delete")
+ self.delete = Gtk.MenuItem(label="_Delete")
self.delete.connect('activate', var_edit.handle_action, var_edit.DELETE_BLOCK)
self.add(self.delete)
- self.add(gtk.SeparatorMenuItem())
+ self.add(Gtk.SeparatorMenuItem())
- self.properties = gtk.MenuItem("_Properties...")
+ self.properties = Gtk.MenuItem(label="_Properties...")
self.properties.connect('activate', var_edit.handle_action, var_edit.OPEN_PROPERTIES)
self.add(self.properties)
self.show_all()
@@ -72,7 +67,7 @@ class VariableEditorContextMenu(gtk.Menu):
self.disable.set_sensitive(selected and enabled)
-class VariableEditor(gtk.VBox):
+class VariableEditor(Gtk.VBox):
# Actions that are handled by the editor
ADD_IMPORT = 0
@@ -83,23 +78,30 @@ class VariableEditor(gtk.VBox):
ENABLE_BLOCK = 5
DISABLE_BLOCK = 6
- def __init__(self, platform, get_flow_graph):
- gtk.VBox.__init__(self)
- self.platform = platform
- self.get_flow_graph = get_flow_graph
+ __gsignals__ = {
+ 'create_new_block': (GObject.SignalFlags.RUN_FIRST, None, (str,)),
+ 'remove_block': (GObject.SignalFlags.RUN_FIRST, None, (str,))
+ }
+
+ def __init__(self):
+ Gtk.VBox.__init__(self)
+ config = Gtk.Application.get_default().config
+
self._block = None
self._mouse_button_pressed = False
+ self._imports = []
+ self._variables = []
# Only use the model to store the block reference and name.
# Generate everything else dynamically
- self.treestore = gtk.TreeStore(gobject.TYPE_PYOBJECT, # Block reference
- gobject.TYPE_STRING) # Category and block name
- self.treeview = gtk.TreeView(self.treestore)
+ self.treestore = Gtk.TreeStore(GObject.TYPE_PYOBJECT, # Block reference
+ GObject.TYPE_STRING) # Category and block name
+ self.treeview = Gtk.TreeView(model=self.treestore)
self.treeview.set_enable_search(False)
self.treeview.set_search_column(-1)
#self.treeview.set_enable_search(True)
#self.treeview.set_search_column(ID_INDEX)
- self.treeview.get_selection().set_mode('single')
+ self.treeview.get_selection().set_mode(Gtk.SelectionMode.SINGLE)
self.treeview.set_headers_visible(True)
self.treeview.connect('button-press-event', self._handle_mouse_button_press)
self.treeview.connect('button-release-event', self._handle_mouse_button_release)
@@ -107,67 +109,63 @@ class VariableEditor(gtk.VBox):
self.treeview.connect('key-press-event', self._handle_key_button_press)
# Block Name or Category
- self.id_cell = gtk.CellRendererText()
+ self.id_cell = Gtk.CellRendererText()
self.id_cell.connect('edited', self._handle_name_edited_cb)
- id_column = gtk.TreeViewColumn("Id", self.id_cell, text=ID_INDEX)
+ id_column = Gtk.TreeViewColumn("Id", self.id_cell, text=ID_INDEX)
id_column.set_name("id")
id_column.set_resizable(True)
id_column.set_max_width(Utils.scale_scalar(300))
id_column.set_min_width(Utils.scale_scalar(80))
id_column.set_fixed_width(Utils.scale_scalar(100))
- id_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
+ id_column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
id_column.set_cell_data_func(self.id_cell, self.set_properties)
self.id_column = id_column
self.treeview.append_column(id_column)
- self.treestore.set_sort_column_id(ID_INDEX, gtk.SORT_ASCENDING)
+ self.treestore.set_sort_column_id(ID_INDEX, Gtk.SortType.ASCENDING)
# For forcing resize
self._col_width = 0
# Block Value
- self.value_cell = gtk.CellRendererText()
+ self.value_cell = Gtk.CellRendererText()
self.value_cell.connect('edited', self._handle_value_edited_cb)
- value_column = gtk.TreeViewColumn("Value", self.value_cell)
+ value_column = Gtk.TreeViewColumn("Value", self.value_cell)
value_column.set_name("value")
value_column.set_resizable(False)
value_column.set_expand(True)
value_column.set_min_width(Utils.scale_scalar(100))
- value_column.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
+ value_column.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
value_column.set_cell_data_func(self.value_cell, self.set_value)
self.value_column = value_column
self.treeview.append_column(value_column)
# Block Actions (Add, Remove)
- self.action_cell = gtk.CellRendererPixbuf()
+ self.action_cell = Gtk.CellRendererPixbuf()
value_column.pack_start(self.action_cell, False)
value_column.set_cell_data_func(self.action_cell, self.set_icon)
# Make the scrolled window to hold the tree view
- scrolled_window = gtk.ScrolledWindow()
- scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- scrolled_window.add_with_viewport(self.treeview)
- scrolled_window.set_size_request(DEFAULT_BLOCKS_WINDOW_WIDTH, -1)
- self.pack_start(scrolled_window)
+ scrolled_window = Gtk.ScrolledWindow()
+ scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
+ scrolled_window.add(self.treeview)
+ scrolled_window.set_size_request(Constants.DEFAULT_BLOCKS_WINDOW_WIDTH, -1)
+ self.pack_start(scrolled_window, True, True, 0)
# Context menus
self._context_menu = VariableEditorContextMenu(self)
- self._confirm_delete = Preferences.variable_editor_confirm_delete()
+ self._confirm_delete = config.variable_editor_confirm_delete()
# Sets cell contents
- def set_icon(self, col, cell, model, iter):
+ def set_icon(self, col, cell, model, iter, data):
block = model.get_value(iter, BLOCK_INDEX)
- if block:
- pb = self.treeview.render_icon(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU, None)
- else:
- pb = self.treeview.render_icon(gtk.STOCK_ADD, gtk.ICON_SIZE_MENU, None)
- cell.set_property('pixbuf', pb)
+ cell.set_property('icon-name', 'window-close' if block else 'list-add')
- def set_value(self, col, cell, model, iter):
+ def set_value(self, col, cell, model, iter, data):
sp = cell.set_property
block = model.get_value(iter, BLOCK_INDEX)
# Set the default properties for this column first.
# Some set in set_properties() may be overridden (editable for advanced variable blocks)
- self.set_properties(col, cell, model, iter)
+ self.set_properties(col, cell, model, iter, data)
# Set defaults
value = None
@@ -175,14 +173,14 @@ class VariableEditor(gtk.VBox):
# Block specific values
if block:
- if block.get_key() == 'import':
- value = block.get_param('import').get_value()
- elif block.get_key() != "variable":
+ if block.key == 'import':
+ value = block.params['import'].get_value()
+ elif block.key != "variable":
value = "<Open Properties>"
sp('editable', False)
sp('foreground', '#0D47A1')
else:
- value = block.get_param('value').get_value()
+ value = block.params['value'].get_value()
# Check if there are errors in the blocks.
# Show the block error as a tooltip
@@ -193,13 +191,13 @@ class VariableEditor(gtk.VBox):
self.set_tooltip_text(error_message[-1])
else:
# Evaluate and show the value (if it is a variable)
- if block.get_key() == "variable":
- evaluated = str(block.get_param('value').evaluate())
+ if block.key == "variable":
+ evaluated = str(block.params['value'].evaluate())
self.set_tooltip_text(evaluated)
# Always set the text value.
sp('text', value)
- def set_properties(self, col, cell, model, iter):
+ def set_properties(self, col, cell, model, iter, data):
sp = cell.set_property
block = model.get_value(iter, BLOCK_INDEX)
# Set defaults
@@ -209,7 +207,7 @@ class VariableEditor(gtk.VBox):
# Block specific changes
if block:
- if not block.get_enabled():
+ if not block.enabled:
# Disabled block. But, this should still be editable
sp('editable', True)
sp('foreground', 'gray')
@@ -218,39 +216,32 @@ class VariableEditor(gtk.VBox):
if block.get_error_messages():
sp('foreground', 'red')
- def update_gui(self):
- if not self.get_flow_graph():
- return
- self._update_blocks()
+ def update_gui(self, blocks):
+ self._imports = [block for block in blocks if block.is_import]
+ self._variables = [block for block in blocks if block.is_variable]
self._rebuild()
self.treeview.expand_all()
- def _update_blocks(self):
- self._imports = filter(attrgetter('is_import'),
- self.get_flow_graph().blocks)
- self._variables = filter(attrgetter('is_variable'),
- self.get_flow_graph().blocks)
-
def _rebuild(self, *args):
self.treestore.clear()
imports = self.treestore.append(None, [None, 'Imports'])
variables = self.treestore.append(None, [None, 'Variables'])
for block in self._imports:
- self.treestore.append(imports, [block, block.get_param('id').get_value()])
- for block in sorted(self._variables, key=lambda v: v.get_id()):
- self.treestore.append(variables, [block, block.get_param('id').get_value()])
+ self.treestore.append(imports, [block, block.params['id'].get_value()])
+ for block in sorted(self._variables, key=lambda v: v.name):
+ self.treestore.append(variables, [block, block.params['id'].get_value()])
def _handle_name_edited_cb(self, cell, path, new_text):
block = self.treestore[path][BLOCK_INDEX]
- block.get_param('id').set_value(new_text)
+ block.params['id'].set_value(new_text)
Actions.VARIABLE_EDITOR_UPDATE()
def _handle_value_edited_cb(self, cell, path, new_text):
block = self.treestore[path][BLOCK_INDEX]
if block.is_import:
- block.get_param('import').set_value(new_text)
+ block.params['import'].set_value(new_text)
else:
- block.get_param('value').set_value(new_text)
+ block.params['value'].set_value(new_text)
Actions.VARIABLE_EDITOR_UPDATE()
def handle_action(self, item, key, event=None):
@@ -259,29 +250,31 @@ class VariableEditor(gtk.VBox):
key presses or mouse clicks. Also triggers an update of the flow graph and editor.
"""
if key == self.ADD_IMPORT:
- self.get_flow_graph().add_new_block('import')
+ self.emit('create_new_block', 'import')
elif key == self.ADD_VARIABLE:
- self.get_flow_graph().add_new_block('variable')
+ self.emit('create_new_block', 'variable')
elif key == self.OPEN_PROPERTIES:
- Actions.BLOCK_PARAM_MODIFY(self._block)
+ # TODO: This probably isn't working because the action doesn't expect a parameter
+ #Actions.BLOCK_PARAM_MODIFY()
+ pass
elif key == self.DELETE_BLOCK:
- self.get_flow_graph().remove_element(self._block)
+ self.emit('remove_block', self._block.name)
elif key == self.DELETE_CONFIRM:
if self._confirm_delete:
# Create a context menu to confirm the delete operation
- confirmation_menu = gtk.Menu()
- block_id = self._block.get_param('id').get_value().replace("_", "__")
- confirm = gtk.MenuItem("Delete {}".format(block_id))
+ confirmation_menu = Gtk.Menu()
+ block_id = self._block.params['id'].get_value().replace("_", "__")
+ confirm = Gtk.MenuItem(label="Delete {}".format(block_id))
confirm.connect('activate', self.handle_action, self.DELETE_BLOCK)
confirmation_menu.add(confirm)
confirmation_menu.show_all()
- confirmation_menu.popup(None, None, None, event.button, event.time)
+ confirmation_menu.popup(None, None, None, None, event.button, event.time)
else:
self.handle_action(None, self.DELETE_BLOCK, None)
elif key == self.ENABLE_BLOCK:
- self._block.set_enabled(True)
+ self._block.state = 'enabled'
elif key == self.DISABLE_BLOCK:
- self._block.set_enabled(False)
+ self._block.state = 'disabled'
Actions.VARIABLE_EDITOR_UPDATE()
def _handle_mouse_button_press(self, widget, event):
@@ -303,12 +296,12 @@ class VariableEditor(gtk.VBox):
if event.button == 1 and col.get_name() == "value":
# Make sure this has a block (not the import/variable rows)
- if self._block and event.type == gtk.gdk._2BUTTON_PRESS:
+ if self._block and event.type == Gdk.EventType._2BUTTON_PRESS:
# Open the advanced dialog if it is a gui variable
- if self._block.get_key() not in ("variable", "import"):
+ if self._block.key not in ("variable", "import"):
self.handle_action(None, self.OPEN_PROPERTIES, event=event)
return True
- if event.type == gtk.gdk.BUTTON_PRESS:
+ if event.type == Gdk.EventType.BUTTON_PRESS:
# User is adding/removing blocks
# Make sure this is the action cell (Add/Remove Icons)
if path[2] > col.cell_get_position(self.action_cell)[0]:
@@ -321,15 +314,15 @@ class VariableEditor(gtk.VBox):
else:
self.handle_action(None, self.DELETE_CONFIRM, event=event)
return True
- elif event.button == 3 and event.type == gtk.gdk.BUTTON_PRESS:
+ elif event.button == 3 and event.type == Gdk.EventType.BUTTON_PRESS:
if self._block:
- self._context_menu.update_sensitive(True, enabled=self._block.get_enabled())
+ self._context_menu.update_sensitive(True, enabled=self._block.enabled)
else:
self._context_menu.update_sensitive(False)
- self._context_menu.popup(None, None, None, event.button, event.time)
+ self._context_menu.popup(None, None, None, None, event.button, event.time)
# Null handler. Stops the treeview from handling double click events.
- if event.type == gtk.gdk._2BUTTON_PRESS:
+ if event.type == Gdk.EventType._2BUTTON_PRESS:
return True
return False
@@ -346,10 +339,10 @@ class VariableEditor(gtk.VBox):
def _handle_key_button_press(self, widget, event):
model, path = self.treeview.get_selection().get_selected_rows()
if path and self._block:
- if self._block.get_enabled() and event.string == "d":
+ if self._block.enabled and event.string == "d":
self.handle_action(None, self.DISABLE_BLOCK, None)
return True
- elif not self._block.get_enabled() and event.string == "e":
+ elif not self._block.enabled and event.string == "e":
self.handle_action(None, self.ENABLE_BLOCK, None)
return True
return False
diff --git a/grc/gui/canvas/__init__.py b/grc/gui/canvas/__init__.py
new file mode 100644
index 000000000..f90d10c4e
--- /dev/null
+++ b/grc/gui/canvas/__init__.py
@@ -0,0 +1,22 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from .block import Block
+from .connection import Connection
+from .flowgraph import FlowGraph
+from .param import Param
+from .port import Port
diff --git a/grc/gui/canvas/block.py b/grc/gui/canvas/block.py
new file mode 100644
index 000000000..33edf988c
--- /dev/null
+++ b/grc/gui/canvas/block.py
@@ -0,0 +1,400 @@
+"""
+Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from __future__ import absolute_import, division
+
+import math
+
+import six
+from gi.repository import Gtk, Pango, PangoCairo
+
+from . import colors
+from .drawable import Drawable
+from .. import Actions, Utils, Constants
+from ..Constants import (
+ BLOCK_LABEL_PADDING, PORT_SPACING, PORT_SEPARATION, LABEL_SEPARATION,
+ PORT_BORDER_SEPARATION, BLOCK_FONT, PARAM_FONT
+)
+from ...core import utils
+from ...core.blocks import Block as CoreBlock
+
+
+class Block(CoreBlock, Drawable):
+ """The graphical signal block."""
+
+ def __init__(self, parent, **n):
+ """
+ Block constructor.
+ Add graphics related params to the block.
+ """
+ super(self.__class__, self).__init__(parent, **n)
+
+ self.states.update(coordinate=(0, 0), rotation=0)
+ self.width = self.height = 0
+ Drawable.__init__(self) # needs the states and initial sizes
+
+ self._surface_layouts = [
+ None, # title
+ None, # params
+ ]
+ self._surface_layouts_offsets = 0, 0
+ self._comment_layout = None
+
+ self._area = []
+ self._border_color = self._bg_color = colors.BLOCK_ENABLED_COLOR
+ self._font_color = list(colors.FONT_COLOR)
+
+ @property
+ def coordinate(self):
+ """
+ Get the coordinate from the position param.
+
+ Returns:
+ the coordinate tuple (x, y) or (0, 0) if failure
+ """
+ return Utils.scale(self.states['coordinate'])
+
+ @coordinate.setter
+ def coordinate(self, coor):
+ """
+ Set the coordinate into the position param.
+
+ Args:
+ coor: the coordinate tuple (x, y)
+ """
+ coor = Utils.scale(coor, reverse=True)
+ if Actions.TOGGLE_SNAP_TO_GRID.get_active():
+ offset_x, offset_y = (0, self.height / 2) if self.is_horizontal() else (self.height / 2, 0)
+ coor = (
+ Utils.align_to_grid(coor[0] + offset_x) - offset_x,
+ Utils.align_to_grid(coor[1] + offset_y) - offset_y
+ )
+ self.states['coordinate'] = coor
+
+ @property
+ def rotation(self):
+ """
+ Get the rotation from the position param.
+
+ Returns:
+ the rotation in degrees or 0 if failure
+ """
+ return self.states['rotation']
+
+ @rotation.setter
+ def rotation(self, rot):
+ """
+ Set the rotation into the position param.
+
+ Args:
+ rot: the rotation in degrees
+ """
+ self.states['rotation'] = rot
+
+ def _update_colors(self):
+ self._bg_color = (
+ colors.MISSING_BLOCK_BACKGROUND_COLOR if self.is_dummy_block else
+ colors.BLOCK_BYPASSED_COLOR if self.state == 'bypassed' else
+ colors.BLOCK_ENABLED_COLOR if self.state == 'enabled' else
+ colors.BLOCK_DISABLED_COLOR
+ )
+ self._font_color[-1] = 1.0 if self.state == 'enabled' else 0.4
+ self._border_color = (
+ colors.MISSING_BLOCK_BORDER_COLOR if self.is_dummy_block else
+ colors.BORDER_COLOR_DISABLED if not self.state == 'enabled' else colors.BORDER_COLOR
+ )
+
+ def create_shapes(self):
+ """Update the block, parameters, and ports when a change occurs."""
+ if self.is_horizontal():
+ self._area = (0, 0, self.width, self.height)
+ elif self.is_vertical():
+ self._area = (0, 0, self.height, self.width)
+ self.bounds_from_area(self._area)
+
+ # bussified = self.current_bus_structure['source'], self.current_bus_structure['sink']
+ bussified = False, False
+ for ports, has_busses in zip((self.active_sources, self.active_sinks), bussified):
+ if not ports:
+ continue
+ port_separation = PORT_SEPARATION if not has_busses else ports[0].height + PORT_SPACING
+ offset = (self.height - (len(ports) - 1) * port_separation - ports[0].height) / 2
+ for port in ports:
+ port.create_shapes()
+
+ port.coordinate = {
+ 0: (+self.width, offset),
+ 90: (offset, -port.width),
+ 180: (-port.width, offset),
+ 270: (offset, +self.width),
+ }[port.connector_direction]
+
+ offset += PORT_SEPARATION if not has_busses else port.height + PORT_SPACING
+
+ def create_labels(self, cr=None):
+ """Create the labels for the signal block."""
+
+ # (Re-)creating layouts here, because layout.context_changed() doesn't seems to work (after zoom)
+ title_layout, params_layout = self._surface_layouts = [
+ Gtk.DrawingArea().create_pango_layout(''), # title
+ Gtk.DrawingArea().create_pango_layout(''), # params
+ ]
+
+ if cr: # to fix up extents after zooming
+ PangoCairo.update_layout(cr, title_layout)
+ PangoCairo.update_layout(cr, params_layout)
+
+ title_layout.set_markup(
+ '<span {foreground} font_desc="{font}"><b>{label}</b></span>'.format(
+ foreground='foreground="red"' if not self.is_valid() else '', font=BLOCK_FONT,
+ label=Utils.encode(self.label)
+ )
+ )
+ title_width, title_height = title_layout.get_size()
+
+ # update the params layout
+ if not self.is_dummy_block:
+ markups = [param.format_block_surface_markup()
+ for param in self.params.values() if param.hide not in ('all', 'part')]
+ else:
+ markups = ['<span font_desc="{font}"><b>key: </b>{key}</span>'.format(font=PARAM_FONT, key=self.key)]
+
+ params_layout.set_spacing(LABEL_SEPARATION * Pango.SCALE)
+ params_layout.set_markup('\n'.join(markups))
+ params_width, params_height = params_layout.get_size() if markups else (0, 0)
+
+ label_width = max(title_width, params_width) / Pango.SCALE
+ label_height = title_height / Pango.SCALE
+ if markups:
+ label_height += LABEL_SEPARATION + params_height / Pango.SCALE
+
+ # calculate width and height needed
+ width = label_width + 2 * BLOCK_LABEL_PADDING
+ height = label_height + 2 * BLOCK_LABEL_PADDING
+
+ self._update_colors()
+ self.create_port_labels()
+
+ def get_min_height_for_ports(ports):
+ min_height = 2 * PORT_BORDER_SEPARATION + len(ports) * PORT_SEPARATION
+ if ports:
+ min_height -= ports[-1].height
+ return min_height
+
+ height = max(height,
+ get_min_height_for_ports(self.active_sinks),
+ get_min_height_for_ports(self.active_sources))
+
+ # def get_min_height_for_bus_ports(ports):
+ # return 2 * PORT_BORDER_SEPARATION + sum(
+ # port.height + PORT_SPACING for port in ports if port.dtype == 'bus'
+ # ) - PORT_SPACING
+ #
+ # if self.current_bus_structure['sink']:
+ # height = max(height, get_min_height_for_bus_ports(self.active_sinks))
+ # if self.current_bus_structure['source']:
+ # height = max(height, get_min_height_for_bus_ports(self.active_sources))
+
+ self.width, self.height = width, height = Utils.align_to_grid((width, height))
+
+ self._surface_layouts_offsets = [
+ (0, (height - label_height) / 2.0),
+ (0, (height - label_height) / 2.0 + LABEL_SEPARATION + title_height / Pango.SCALE)
+ ]
+
+ title_layout.set_width(width * Pango.SCALE)
+ title_layout.set_alignment(Pango.Alignment.CENTER)
+ params_layout.set_indent((width - label_width) / 2.0 * Pango.SCALE)
+
+ self.create_comment_layout()
+
+ def create_port_labels(self):
+ for ports in (self.active_sinks, self.active_sources):
+ max_width = 0
+ for port in ports:
+ port.create_labels()
+ max_width = max(max_width, port.width_with_label)
+ for port in ports:
+ port.width = max_width
+
+ def create_comment_layout(self):
+ markups = []
+
+ # Show the flow graph complexity on the top block if enabled
+ if Actions.TOGGLE_SHOW_FLOWGRAPH_COMPLEXITY.get_active() and self.key == "options":
+ complexity = utils.flow_graph_complexity.calculate(self.parent)
+ markups.append(
+ '<span foreground="#444" size="medium" font_desc="{font}">'
+ '<b>Complexity: {num}bal</b></span>'.format(num=Utils.num_to_str(complexity), font=BLOCK_FONT)
+ )
+ comment = self.comment # Returns None if there are no comments
+ if comment:
+ if markups:
+ markups.append('<span></span>')
+
+ markups.append('<span foreground="{foreground}" font_desc="{font}">{comment}</span>'.format(
+ foreground='#444' if self.enabled else '#888', font=BLOCK_FONT, comment=Utils.encode(comment)
+ ))
+ if markups:
+ layout = self._comment_layout = Gtk.DrawingArea().create_pango_layout('')
+ layout.set_markup(''.join(markups))
+ else:
+ self._comment_layout = None
+
+ def draw(self, cr):
+ """
+ Draw the signal block with label and inputs/outputs.
+ """
+ border_color = colors.HIGHLIGHT_COLOR if self.highlighted else self._border_color
+ cr.translate(*self.coordinate)
+
+ for port in self.active_ports(): # ports first
+ cr.save()
+ port.draw(cr)
+ cr.restore()
+
+ cr.rectangle(*self._area)
+ cr.set_source_rgba(*self._bg_color)
+ cr.fill_preserve()
+ cr.set_source_rgba(*border_color)
+ cr.stroke()
+
+ # title and params label
+ if self.is_vertical():
+ cr.rotate(-math.pi / 2)
+ cr.translate(-self.width, 0)
+ cr.set_source_rgba(*self._font_color)
+ for layout, offset in zip(self._surface_layouts, self._surface_layouts_offsets):
+ cr.save()
+ cr.translate(*offset)
+ PangoCairo.update_layout(cr, layout)
+ PangoCairo.show_layout(cr, layout)
+ cr.restore()
+
+ def what_is_selected(self, coor, coor_m=None):
+ """
+ Get the element that is selected.
+
+ Args:
+ coor: the (x,y) tuple
+ coor_m: the (x_m, y_m) tuple
+
+ Returns:
+ this block, a port, or None
+ """
+ for port in self.active_ports():
+ port_selected = port.what_is_selected(
+ coor=[a - b for a, b in zip(coor, self.coordinate)],
+ coor_m=[a - b for a, b in zip(coor, self.coordinate)] if coor_m is not None else None
+ )
+ if port_selected:
+ return port_selected
+ return Drawable.what_is_selected(self, coor, coor_m)
+
+ def draw_comment(self, cr):
+ if not self._comment_layout:
+ return
+ x, y = self.coordinate
+
+ if self.is_horizontal():
+ y += self.height + BLOCK_LABEL_PADDING
+ else:
+ x += self.height + BLOCK_LABEL_PADDING
+
+ cr.save()
+ cr.translate(x, y)
+ PangoCairo.update_layout(cr, self._comment_layout)
+ PangoCairo.show_layout(cr, self._comment_layout)
+ cr.restore()
+
+ def get_extents(self):
+ extent = Drawable.get_extents(self)
+ x, y = self.coordinate
+ for port in self.active_ports():
+ extent = (min_or_max(xy, offset + p_xy) for offset, min_or_max, xy, p_xy in zip(
+ (x, y, x, y), (min, min, max, max), extent, port.get_extents()
+ ))
+ return tuple(extent)
+
+ ##############################################
+ # Controller Modify
+ ##############################################
+ def type_controller_modify(self, direction):
+ """
+ Change the type controller.
+
+ Args:
+ direction: +1 or -1
+
+ Returns:
+ true for change
+ """
+ type_templates = ' '.join(p._type for p in self.params.values())
+ type_templates += ' '.join(p.get_raw('dtype') for p in (self.sinks + self.sources))
+ type_param = None
+ for key, param in six.iteritems(self.params):
+ if not param.is_enum():
+ continue
+ # Priority to the type controller
+ if param.key in type_templates:
+ type_param = param
+ break
+ # Use param if type param is unset
+ if not type_param:
+ type_param = param
+ if not type_param:
+ return False
+
+ # Try to increment the enum by direction
+ try:
+ values = list(type_param.options)
+ old_index = values.index(type_param.get_value())
+ new_index = (old_index + direction + len(values)) % len(values)
+ type_param.set_value(values[new_index])
+ return True
+ except:
+ return False
+
+ def port_controller_modify(self, direction):
+ """
+ Change the port controller.
+
+ Args:
+ direction: +1 or -1
+
+ Returns:
+ true for change
+ """
+ changed = False
+ # Concat the nports string from the private nports settings of all ports
+ nports_str = ' '.join(str(port.get_raw('multiplicity')) for port in self.ports())
+ # Modify all params whose keys appear in the nports string
+ for key, param in six.iteritems(self.params):
+ if param.is_enum() or param.key not in nports_str:
+ continue
+ # Try to increment the port controller by direction
+ try:
+ value = param.get_evaluated() + direction
+ if value > 0:
+ param.set_value(value)
+ changed = True
+ except:
+ pass
+ return changed
+
diff --git a/grc/gui/canvas/colors.py b/grc/gui/canvas/colors.py
new file mode 100644
index 000000000..77d3203e7
--- /dev/null
+++ b/grc/gui/canvas/colors.py
@@ -0,0 +1,78 @@
+"""
+Copyright 2008,2013 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from __future__ import absolute_import
+
+from gi.repository import Gtk, Gdk, cairo
+# import pycairo
+
+from .. import Constants
+
+
+def get_color(color_code):
+ color = Gdk.RGBA()
+ color.parse(color_code)
+ return color.red, color.green, color.blue, color.alpha
+ # chars_per_color = 2 if len(color_code) > 4 else 1
+ # offsets = range(1, 3 * chars_per_color + 1, chars_per_color)
+ # return tuple(int(color_code[o:o + 2], 16) / 255.0 for o in offsets)
+
+#################################################################################
+# fg colors
+#################################################################################
+
+HIGHLIGHT_COLOR = get_color('#00FFFF')
+BORDER_COLOR = get_color('#616161')
+BORDER_COLOR_DISABLED = get_color('#888888')
+FONT_COLOR = get_color('#000000')
+
+# Missing blocks stuff
+MISSING_BLOCK_BACKGROUND_COLOR = get_color('#FFF2F2')
+MISSING_BLOCK_BORDER_COLOR = get_color('#FF0000')
+
+# Flow graph color constants
+FLOWGRAPH_BACKGROUND_COLOR = get_color('#FFFFFF')
+COMMENT_BACKGROUND_COLOR = get_color('#F3F3F3')
+FLOWGRAPH_EDGE_COLOR = COMMENT_BACKGROUND_COLOR
+
+# Block color constants
+BLOCK_ENABLED_COLOR = get_color('#F1ECFF')
+BLOCK_DISABLED_COLOR = get_color('#CCCCCC')
+BLOCK_BYPASSED_COLOR = get_color('#F4FF81')
+
+# Connection color constants
+CONNECTION_ENABLED_COLOR = get_color('#000000')
+CONNECTION_DISABLED_COLOR = get_color('#BBBBBB')
+CONNECTION_ERROR_COLOR = get_color('#FF0000')
+
+DEFAULT_DOMAIN_COLOR = get_color('#777777')
+
+
+#################################################################################
+# port colors
+#################################################################################
+
+PORT_TYPE_TO_COLOR = {key: get_color(color) for name, key, sizeof, color in Constants.CORE_TYPES}
+PORT_TYPE_TO_COLOR.update((key, get_color(color)) for key, (_, color) in Constants.ALIAS_TYPES.items())
+
+
+#################################################################################
+# param box colors
+#################################################################################
+
diff --git a/grc/gui/canvas/connection.py b/grc/gui/canvas/connection.py
new file mode 100644
index 000000000..56dab4557
--- /dev/null
+++ b/grc/gui/canvas/connection.py
@@ -0,0 +1,253 @@
+"""
+Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from __future__ import absolute_import, division
+
+from argparse import Namespace
+from math import pi
+
+from . import colors
+from .drawable import Drawable
+from .. import Utils
+from ..Constants import (
+ CONNECTOR_ARROW_BASE,
+ CONNECTOR_ARROW_HEIGHT,
+ GR_MESSAGE_DOMAIN,
+ LINE_SELECT_SENSITIVITY,
+)
+from ...core.Connection import Connection as CoreConnection
+from ...core.utils.descriptors import nop_write
+
+
+class Connection(CoreConnection, Drawable):
+ """
+ A graphical connection for ports.
+ The connection has 2 parts, the arrow and the wire.
+ The coloring of the arrow and wire exposes the status of 3 states:
+ enabled/disabled, valid/invalid, highlighted/non-highlighted.
+ The wire coloring exposes the enabled and highlighted states.
+ The arrow coloring exposes the enabled and valid states.
+ """
+
+ def __init__(self, *args, **kwargs):
+ super(self.__class__, self).__init__(*args, **kwargs)
+ Drawable.__init__(self)
+
+ self._line = []
+ self._line_width_factor = 1.0
+ self._color1 = self._color2 = None
+
+ self._current_port_rotations = self._current_coordinates = None
+
+ self._rel_points = None # connection coordinates relative to sink/source
+ self._arrow_rotation = 0.0 # rotation of the arrow in radians
+ self._current_cr = None # for what_is_selected() of curved line
+ self._line_path = None
+
+ @nop_write
+ @property
+ def coordinate(self):
+ return self.source_port.connector_coordinate_absolute
+
+ @nop_write
+ @property
+ def rotation(self):
+ """
+ Get the 0 degree rotation.
+ Rotations are irrelevant in connection.
+
+ Returns:
+ 0
+ """
+ return 0
+
+ def create_shapes(self):
+ """Pre-calculate relative coordinates."""
+ source = self.source_port
+ sink = self.sink_port
+ rotate = Utils.get_rotated_coordinate
+
+ # first two components relative to source connector, rest relative to sink connector
+ self._rel_points = [
+ rotate((15, 0), source.rotation), # line from 0,0 to here, bezier curve start
+ rotate((50, 0), source.rotation), # bezier curve control point 1
+ rotate((-50, 0), sink.rotation), # bezier curve control point 2
+ rotate((-15, 0), sink.rotation), # bezier curve end
+ rotate((-CONNECTOR_ARROW_HEIGHT, 0), sink.rotation), # line to arrow head
+ ]
+ self._current_coordinates = None # triggers _make_path()
+
+ def get_domain_color(domain_id):
+ domain = self.parent_platform.domains.get(domain_id, None)
+ return colors.get_color(domain.color) if domain else colors.DEFAULT_DOMAIN_COLOR
+
+ if source.domain == GR_MESSAGE_DOMAIN:
+ self._line_width_factor = 1.0
+ self._color1 = None
+ self._color2 = colors.CONNECTION_ENABLED_COLOR
+ else:
+ if source.domain != sink.domain:
+ self._line_width_factor = 2.0
+ self._color1 = get_domain_color(source.domain)
+ self._color2 = get_domain_color(sink.domain)
+
+ self._arrow_rotation = -sink.rotation / 180 * pi
+
+ if not self._bounding_points:
+ self._make_path() # no cr set --> only sets bounding_points for extent
+
+ def _make_path(self, cr=None):
+ x_pos, y_pos = self.coordinate # is source connector coordinate
+ # x_start, y_start = self.source_port.get_connector_coordinate()
+ x_end, y_end = self.sink_port.connector_coordinate_absolute
+
+ # sink connector relative to sink connector
+ x_e, y_e = x_end - x_pos, y_end - y_pos
+
+ # make rel_point all relative to source connector
+ p0 = 0, 0 # x_start - x_pos, y_start - y_pos
+ p1, p2, (dx_e1, dy_e1), (dx_e2, dy_e2), (dx_e3, dy_e3) = self._rel_points
+ p3 = x_e + dx_e1, y_e + dy_e1
+ p4 = x_e + dx_e2, y_e + dy_e2
+ p5 = x_e + dx_e3, y_e + dy_e3
+ self._bounding_points = p0, p1, p4, p5 # ignores curved part =(
+
+ if cr:
+ cr.move_to(*p0)
+ cr.line_to(*p1)
+ cr.curve_to(*(p2 + p3 + p4))
+ cr.line_to(*p5)
+ self._line_path = cr.copy_path()
+
+ def draw(self, cr):
+ """
+ Draw the connection.
+ """
+ self._current_cr = cr
+ sink = self.sink_port
+ source = self.source_port
+
+ # check for changes
+ port_rotations = (source.rotation, sink.rotation)
+ if self._current_port_rotations != port_rotations:
+ self.create_shapes() # triggers _make_path() call below
+ self._current_port_rotations = port_rotations
+
+ new_coordinates = (source.parent_block.coordinate, sink.parent_block.coordinate)
+ if self._current_coordinates != new_coordinates:
+ self._make_path(cr)
+ self._current_coordinates = new_coordinates
+
+ color1, color2 = (
+ None if color is None else
+ colors.HIGHLIGHT_COLOR if self.highlighted else
+ colors.CONNECTION_DISABLED_COLOR if not self.enabled else
+ colors.CONNECTION_ERROR_COLOR if not self.is_valid() else
+ color
+ for color in (self._color1, self._color2)
+ )
+
+ cr.translate(*self.coordinate)
+ cr.set_line_width(self._line_width_factor * cr.get_line_width())
+ cr.new_path()
+ cr.append_path(self._line_path)
+
+ arrow_pos = cr.get_current_point()
+
+ if color1: # not a message connection
+ cr.set_source_rgba(*color1)
+ cr.stroke_preserve()
+
+ if color1 != color2:
+ cr.save()
+ cr.set_dash([5.0, 5.0], 5.0 if color1 else 0.0)
+ cr.set_source_rgba(*color2)
+ cr.stroke()
+ cr.restore()
+ else:
+ cr.new_path()
+
+ cr.move_to(*arrow_pos)
+ cr.set_source_rgba(*color2)
+ cr.rotate(self._arrow_rotation)
+ cr.rel_move_to(CONNECTOR_ARROW_HEIGHT, 0)
+ cr.rel_line_to(-CONNECTOR_ARROW_HEIGHT, -CONNECTOR_ARROW_BASE/2)
+ cr.rel_line_to(0, CONNECTOR_ARROW_BASE)
+ cr.close_path()
+ cr.fill()
+
+ def what_is_selected(self, coor, coor_m=None):
+ """
+ Returns:
+ self if one of the areas/lines encompasses coor, else None.
+ """
+ if coor_m:
+ return Drawable.what_is_selected(self, coor, coor_m)
+
+ x, y = [a - b for a, b in zip(coor, self.coordinate)]
+
+ cr = self._current_cr
+
+ if cr is None:
+ return
+ cr.save()
+ cr.new_path()
+ cr.append_path(self._line_path)
+ cr.set_line_width(cr.get_line_width() * LINE_SELECT_SENSITIVITY)
+ hit = cr.in_stroke(x, y)
+ cr.restore()
+
+ if hit:
+ return self
+
+
+class DummyCoreConnection(object):
+ def __init__(self, source_port, **kwargs):
+ self.parent_platform = source_port.parent_platform
+ self.source_port = source_port
+ self.sink_port = self._dummy_port = Namespace(
+ domain=source_port.domain,
+ rotation=0,
+ coordinate=(0, 0),
+ connector_coordinate_absolute=(0, 0),
+ connector_direction=0,
+ parent_block=Namespace(coordinate=(0, 0)),
+ )
+
+ self.enabled = True
+ self.highlighted = False,
+ self.is_valid = lambda: True
+ self.update(**kwargs)
+
+ def update(self, coordinate=None, rotation=None, sink_port=None):
+ dp = self._dummy_port
+ self.sink_port = sink_port if sink_port else dp
+ if coordinate:
+ dp.coordinate = coordinate
+ dp.connector_coordinate_absolute = coordinate
+ dp.parent_block.coordinate = coordinate
+ if rotation is not None:
+ dp.rotation = rotation
+ dp.connector_direction = (180 + rotation) % 360
+
+ @property
+ def has_real_sink(self):
+ return self.sink_port is not self._dummy_port
+
+DummyConnection = Connection.make_cls_with_base(DummyCoreConnection)
diff --git a/grc/gui/canvas/drawable.py b/grc/gui/canvas/drawable.py
new file mode 100644
index 000000000..d755d4418
--- /dev/null
+++ b/grc/gui/canvas/drawable.py
@@ -0,0 +1,183 @@
+"""
+Copyright 2007, 2008, 2009, 2016 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from __future__ import absolute_import
+from ..Constants import LINE_SELECT_SENSITIVITY
+
+from six.moves import zip
+
+
+class Drawable(object):
+ """
+ GraphicalElement is the base class for all graphical elements.
+ It contains an X,Y coordinate, a list of rectangular areas that the element occupies,
+ and methods to detect selection of those areas.
+ """
+
+ @classmethod
+ def make_cls_with_base(cls, super_cls):
+ name = super_cls.__name__
+ bases = (super_cls,) + cls.__bases__[1:]
+ namespace = cls.__dict__.copy()
+ return type(name, bases, namespace)
+
+ def __init__(self):
+ """
+ Make a new list of rectangular areas and lines, and set the coordinate and the rotation.
+ """
+ self.coordinate = (0, 0)
+ self.rotation = 0
+ self.highlighted = False
+
+ self._bounding_rects = []
+ self._bounding_points = []
+
+ def is_horizontal(self, rotation=None):
+ """
+ Is this element horizontal?
+ If rotation is None, use this element's rotation.
+
+ Args:
+ rotation: the optional rotation
+
+ Returns:
+ true if rotation is horizontal
+ """
+ rotation = rotation or self.rotation
+ return rotation in (0, 180)
+
+ def is_vertical(self, rotation=None):
+ """
+ Is this element vertical?
+ If rotation is None, use this element's rotation.
+
+ Args:
+ rotation: the optional rotation
+
+ Returns:
+ true if rotation is vertical
+ """
+ rotation = rotation or self.rotation
+ return rotation in (90, 270)
+
+ def rotate(self, rotation):
+ """
+ Rotate all of the areas by 90 degrees.
+
+ Args:
+ rotation: multiple of 90 degrees
+ """
+ self.rotation = (self.rotation + rotation) % 360
+
+ def move(self, delta_coor):
+ """
+ Move the element by adding the delta_coor to the current coordinate.
+
+ Args:
+ delta_coor: (delta_x,delta_y) tuple
+ """
+ x, y = self.coordinate
+ dx, dy = delta_coor
+ self.coordinate = (x + dx, y + dy)
+
+ def create_labels(self, cr=None):
+ """
+ Create labels (if applicable) and call on all children.
+ Call this base method before creating labels in the element.
+ """
+
+ def create_shapes(self):
+ """
+ Create shapes (if applicable) and call on all children.
+ Call this base method before creating shapes in the element.
+ """
+
+ def draw(self, cr):
+ raise NotImplementedError()
+
+ def bounds_from_area(self, area):
+ x1, y1, w, h = area
+ x2 = x1 + w
+ y2 = y1 + h
+ self._bounding_rects = [(x1, y1, x2, y2)]
+ self._bounding_points = [(x1, y1), (x2, y1), (x1, y2), (x2, y2)]
+
+ def bounds_from_line(self, line):
+ self._bounding_rects = rects = []
+ self._bounding_points = list(line)
+ last_point = line[0]
+ for x2, y2 in line[1:]:
+ (x1, y1), last_point = last_point, (x2, y2)
+ if x1 == x2:
+ x1, x2 = x1 - LINE_SELECT_SENSITIVITY, x2 + LINE_SELECT_SENSITIVITY
+ if y2 < y1:
+ y1, y2 = y2, y1
+ elif y1 == y2:
+ y1, y2 = y1 - LINE_SELECT_SENSITIVITY, y2 + LINE_SELECT_SENSITIVITY
+ if x2 < x1:
+ x1, x2 = x2, x1
+
+ rects.append((x1, y1, x2, y2))
+
+ def what_is_selected(self, coor, coor_m=None):
+ """
+ One coordinate specified:
+ Is this element selected at given coordinate?
+ ie: is the coordinate encompassed by one of the areas or lines?
+ Both coordinates specified:
+ Is this element within the rectangular region defined by both coordinates?
+ ie: do any area corners or line endpoints fall within the region?
+
+ Args:
+ coor: the selection coordinate, tuple x, y
+ coor_m: an additional selection coordinate.
+
+ Returns:
+ self if one of the areas/lines encompasses coor, else None.
+ """
+ x, y = [a - b for a, b in zip(coor, self.coordinate)]
+
+ if not coor_m:
+ for x1, y1, x2, y2 in self._bounding_rects:
+ if x1 <= x <= x2 and y1 <= y <= y2:
+ return self
+ else:
+ x_m, y_m = [a - b for a, b in zip(coor_m, self.coordinate)]
+ if y_m < y:
+ y, y_m = y_m, y
+ if x_m < x:
+ x, x_m = x_m, x
+
+ for x1, y1 in self._bounding_points:
+ if x <= x1 <= x_m and y <= y1 <= y_m:
+ return self
+
+ def get_extents(self):
+ x_min, y_min = x_max, y_max = self.coordinate
+ x_min += min(x for x, y in self._bounding_points)
+ y_min += min(y for x, y in self._bounding_points)
+ x_max += max(x for x, y in self._bounding_points)
+ y_max += max(y for x, y in self._bounding_points)
+ return x_min, y_min, x_max, y_max
+
+ def mouse_over(self):
+ pass
+
+ def mouse_out(self):
+ pass
diff --git a/grc/gui/canvas/flowgraph.py b/grc/gui/canvas/flowgraph.py
new file mode 100644
index 000000000..3e0fd83da
--- /dev/null
+++ b/grc/gui/canvas/flowgraph.py
@@ -0,0 +1,772 @@
+"""
+Copyright 2007-2011, 2016q Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from __future__ import absolute_import
+
+import ast
+import functools
+import random
+from distutils.spawn import find_executable
+from itertools import count
+
+import six
+from gi.repository import GLib
+from six.moves import filter
+
+from . import colors
+from .drawable import Drawable
+from .connection import DummyConnection
+from .. import Actions, Constants, Utils, Bars, Dialogs
+from ..external_editor import ExternalEditor
+from ...core import Messages
+from ...core.FlowGraph import FlowGraph as CoreFlowgraph
+
+
+class FlowGraph(CoreFlowgraph, Drawable):
+ """
+ FlowGraph is the data structure to store graphical signal blocks,
+ graphical inputs and outputs,
+ and the connections between inputs and outputs.
+ """
+
+ def __init__(self, parent, **kwargs):
+ """
+ FlowGraph constructor.
+ Create a list for signal blocks and connections. Connect mouse handlers.
+ """
+ super(self.__class__, self).__init__(parent, **kwargs)
+ Drawable.__init__(self)
+ self.drawing_area = None
+ # important vars dealing with mouse event tracking
+ self.element_moved = False
+ self.mouse_pressed = False
+ self.press_coor = (0, 0)
+ # selected
+ self.selected_elements = set()
+ self._old_selected_port = None
+ self._new_selected_port = None
+ # current mouse hover element
+ self.element_under_mouse = None
+ # context menu
+ self._context_menu = Bars.ContextMenu()
+ self.get_context_menu = lambda: self._context_menu
+
+ self._new_connection = None
+ self._elements_to_draw = []
+ self._external_updaters = {}
+
+ def _get_unique_id(self, base_id=''):
+ """
+ Get a unique id starting with the base id.
+
+ Args:
+ base_id: the id starts with this and appends a count
+
+ Returns:
+ a unique id
+ """
+ block_ids = set(b.name for b in self.blocks)
+ for index in count():
+ block_id = '{}_{}'.format(base_id, index)
+ if block_id not in block_ids:
+ break
+ return block_id
+
+ def install_external_editor(self, param, parent=None):
+ target = (param.parent_block.name, param.key)
+
+ if target in self._external_updaters:
+ editor = self._external_updaters[target]
+ else:
+ config = self.parent_platform.config
+ editor = (find_executable(config.editor) or
+ Dialogs.choose_editor(parent, config)) # todo: pass in parent
+ if not editor:
+ return
+ updater = functools.partial(
+ self.handle_external_editor_change, target=target)
+ editor = self._external_updaters[target] = ExternalEditor(
+ editor=editor,
+ name=target[0], value=param.get_value(),
+ callback=functools.partial(GLib.idle_add, updater)
+ )
+ editor.start()
+ try:
+ editor.open_editor()
+ except Exception as e:
+ # Problem launching the editor. Need to select a new editor.
+ Messages.send('>>> Error opening an external editor. Please select a different editor.\n')
+ # Reset the editor to force the user to select a new one.
+ self.parent_platform.config.editor = ''
+
+ def handle_external_editor_change(self, new_value, target):
+ try:
+ block_id, param_key = target
+ self.get_block(block_id).params[param_key].set_value(new_value)
+
+ except (IndexError, ValueError): # block no longer exists
+ self._external_updaters[target].stop()
+ del self._external_updaters[target]
+ return
+ Actions.EXTERNAL_UPDATE()
+
+ def add_new_block(self, key, coor=None):
+ """
+ Add a block of the given key to this flow graph.
+
+ Args:
+ key: the block key
+ coor: an optional coordinate or None for random
+ """
+ id = self._get_unique_id(key)
+ scroll_pane = self.drawing_area.get_parent().get_parent()
+ # calculate the position coordinate
+ h_adj = scroll_pane.get_hadjustment()
+ v_adj = scroll_pane.get_vadjustment()
+ if coor is None: coor = (
+ int(random.uniform(.25, .75)*h_adj.get_page_size() + h_adj.get_value()),
+ int(random.uniform(.25, .75)*v_adj.get_page_size() + v_adj.get_value()),
+ )
+ # get the new block
+ block = self.new_block(key)
+ block.coordinate = coor
+ block.params['id'].set_value(id)
+ Actions.ELEMENT_CREATE()
+ return id
+
+ def make_connection(self):
+ """this selection and the last were ports, try to connect them"""
+ if self._new_connection and self._new_connection.has_real_sink:
+ self._old_selected_port = self._new_connection.source_port
+ self._new_selected_port = self._new_connection.sink_port
+ if self._old_selected_port and self._new_selected_port:
+ try:
+ self.connect(self._old_selected_port, self._new_selected_port)
+ Actions.ELEMENT_CREATE()
+ except Exception as e:
+ Messages.send_fail_connection(e)
+ self._old_selected_port = None
+ self._new_selected_port = None
+ return True
+ return False
+
+ def update(self):
+ """
+ Call the top level rewrite and validate.
+ Call the top level create labels and shapes.
+ """
+ self.rewrite()
+ self.validate()
+ self.update_elements_to_draw()
+ self.create_labels()
+ self.create_shapes()
+
+ def reload(self):
+ """
+ Reload flow-graph (with updated blocks)
+
+ Args:
+ page: the page to reload (None means current)
+ Returns:
+ False if some error occurred during import
+ """
+ success = False
+ data = self.export_data()
+ if data:
+ self.unselect()
+ success = self.import_data(data)
+ self.update()
+ return success
+
+ ###########################################################################
+ # Copy Paste
+ ###########################################################################
+ def copy_to_clipboard(self):
+ """
+ Copy the selected blocks and connections into the clipboard.
+
+ Returns:
+ the clipboard
+ """
+ #get selected blocks
+ blocks = list(self.selected_blocks())
+ if not blocks:
+ return None
+ #calc x and y min
+ x_min, y_min = blocks[0].coordinate
+ for block in blocks:
+ x, y = block.coordinate
+ x_min = min(x, x_min)
+ y_min = min(y, y_min)
+ #get connections between selected blocks
+ connections = list(filter(
+ lambda c: c.source_block in blocks and c.sink_block in blocks,
+ self.connections,
+ ))
+ clipboard = (
+ (x_min, y_min),
+ [block.export_data() for block in blocks],
+ [connection.export_data() for connection in connections],
+ )
+ return clipboard
+
+ def paste_from_clipboard(self, clipboard):
+ """
+ Paste the blocks and connections from the clipboard.
+
+ Args:
+ clipboard: the nested data of blocks, connections
+ """
+ # todo: rewrite this...
+ selected = set()
+ (x_min, y_min), blocks_n, connections_n = clipboard
+ old_id2block = dict()
+ # recalc the position
+ scroll_pane = self.drawing_area.get_parent().get_parent()
+ h_adj = scroll_pane.get_hadjustment()
+ v_adj = scroll_pane.get_vadjustment()
+ x_off = h_adj.get_value() - x_min + h_adj.get_page_size() / 4
+ y_off = v_adj.get_value() - y_min + v_adj.get_page_size() / 4
+
+ if len(self.get_elements()) <= 1:
+ x_off, y_off = 0, 0
+
+ # create blocks
+ for block_n in blocks_n:
+ block_key = block_n.get('id')
+ if block_key == 'options':
+ continue
+ block = self.new_block(block_key)
+ if not block:
+ continue # unknown block was pasted (e.g. dummy block)
+
+ selected.add(block)
+ block.import_data(**block_n)
+ old_id2block[block.params['id'].value] = block
+ # move block to offset coordinate
+ block.move((x_off, y_off))
+
+ if block.params['id'].value in (blk.name for blk in self.blocks):
+ block.params['id'].value = self._get_unique_id(block_key)
+
+ # update before creating connections
+ self.update()
+ # create connections
+ for connection_n in connections_n:
+ source = old_id2block[connection_n[0]].get_source(connection_n[1])
+ sink = old_id2block[connection_n[2]].get_sink(connection_n[3])
+ connection = self.connect(source, sink)
+ selected.add(connection)
+ self.selected_elements = selected
+
+ ###########################################################################
+ # Modify Selected
+ ###########################################################################
+ def type_controller_modify_selected(self, direction):
+ """
+ Change the registered type controller for the selected signal blocks.
+
+ Args:
+ direction: +1 or -1
+
+ Returns:
+ true for change
+ """
+ return any(sb.type_controller_modify(direction) for sb in self.selected_blocks())
+
+ def port_controller_modify_selected(self, direction):
+ """
+ Change port controller for the selected signal blocks.
+
+ Args:
+ direction: +1 or -1
+
+ Returns:
+ true for changed
+ """
+ return any(sb.port_controller_modify(direction) for sb in self.selected_blocks())
+
+ def change_state_selected(self, new_state):
+ """
+ Enable/disable the selected blocks.
+
+ Args:
+ new_state: a block state
+
+ Returns:
+ true if changed
+ """
+ changed = False
+ for block in self.selected_blocks():
+ changed |= block.state != new_state
+ block.state = new_state
+ return changed
+
+ def move_selected(self, delta_coordinate):
+ """
+ Move the element and by the change in coordinates.
+
+ Args:
+ delta_coordinate: the change in coordinates
+ """
+ for selected_block in self.selected_blocks():
+ selected_block.move(delta_coordinate)
+ self.element_moved = True
+
+ def align_selected(self, calling_action=None):
+ """
+ Align the selected blocks.
+
+ Args:
+ calling_action: the action initiating the alignment
+
+ Returns:
+ True if changed, otherwise False
+ """
+ blocks = list(self.selected_blocks())
+ if calling_action is None or not blocks:
+ return False
+
+ # compute common boundary of selected objects
+ min_x, min_y = max_x, max_y = blocks[0].coordinate
+ for selected_block in blocks:
+ x, y = selected_block.coordinate
+ min_x, min_y = min(min_x, x), min(min_y, y)
+ x += selected_block.width
+ y += selected_block.height
+ max_x, max_y = max(max_x, x), max(max_y, y)
+ ctr_x, ctr_y = (max_x + min_x)/2, (max_y + min_y)/2
+
+ # align the blocks as requested
+ transform = {
+ Actions.BLOCK_VALIGN_TOP: lambda x, y, w, h: (x, min_y),
+ Actions.BLOCK_VALIGN_MIDDLE: lambda x, y, w, h: (x, ctr_y - h/2),
+ Actions.BLOCK_VALIGN_BOTTOM: lambda x, y, w, h: (x, max_y - h),
+ Actions.BLOCK_HALIGN_LEFT: lambda x, y, w, h: (min_x, y),
+ Actions.BLOCK_HALIGN_CENTER: lambda x, y, w, h: (ctr_x-w/2, y),
+ Actions.BLOCK_HALIGN_RIGHT: lambda x, y, w, h: (max_x - w, y),
+ }.get(calling_action, lambda *args: args)
+
+ for selected_block in blocks:
+ x, y = selected_block.coordinate
+ w, h = selected_block.width, selected_block.height
+ selected_block.coordinate = transform(x, y, w, h)
+
+ return True
+
+ def rotate_selected(self, rotation):
+ """
+ Rotate the selected blocks by multiples of 90 degrees.
+
+ Args:
+ rotation: the rotation in degrees
+
+ Returns:
+ true if changed, otherwise false.
+ """
+ if not any(self.selected_blocks()):
+ return False
+ #initialize min and max coordinates
+ min_x, min_y = max_x, max_y = self.selected_block.coordinate
+ # rotate each selected block, and find min/max coordinate
+ for selected_block in self.selected_blocks():
+ selected_block.rotate(rotation)
+ #update the min/max coordinate
+ x, y = selected_block.coordinate
+ min_x, min_y = min(min_x, x), min(min_y, y)
+ max_x, max_y = max(max_x, x), max(max_y, y)
+ #calculate center point of slected blocks
+ ctr_x, ctr_y = (max_x + min_x)/2, (max_y + min_y)/2
+ #rotate the blocks around the center point
+ for selected_block in self.selected_blocks():
+ x, y = selected_block.coordinate
+ x, y = Utils.get_rotated_coordinate((x - ctr_x, y - ctr_y), rotation)
+ selected_block.coordinate = (x + ctr_x, y + ctr_y)
+ return True
+
+ def remove_selected(self):
+ """
+ Remove selected elements
+
+ Returns:
+ true if changed.
+ """
+ changed = False
+ for selected_element in self.selected_elements:
+ self.remove_element(selected_element)
+ changed = True
+ return changed
+
+ def update_selected(self):
+ """
+ Remove deleted elements from the selected elements list.
+ Update highlighting so only the selected are highlighted.
+ """
+ selected_elements = self.selected_elements
+ elements = self.get_elements()
+ # remove deleted elements
+ for selected in list(selected_elements):
+ if selected in elements:
+ continue
+ selected_elements.remove(selected)
+ if self._old_selected_port and self._old_selected_port.parent not in elements:
+ self._old_selected_port = None
+ if self._new_selected_port and self._new_selected_port.parent not in elements:
+ self._new_selected_port = None
+ # update highlighting
+ for element in elements:
+ element.highlighted = element in selected_elements
+
+ ###########################################################################
+ # Draw stuff
+ ###########################################################################
+
+ def update_elements_to_draw(self):
+ hide_disabled_blocks = Actions.TOGGLE_HIDE_DISABLED_BLOCKS.get_active()
+ hide_variables = Actions.TOGGLE_HIDE_VARIABLES.get_active()
+
+ def draw_order(elem):
+ return elem.highlighted, elem.is_block, elem.enabled
+
+ elements = sorted(self.get_elements(), key=draw_order)
+ del self._elements_to_draw[:]
+
+ for element in elements:
+ if hide_disabled_blocks and not element.enabled:
+ continue # skip hidden disabled blocks and connections
+ if hide_variables and (element.is_variable or element.is_import):
+ continue # skip hidden disabled blocks and connections
+ self._elements_to_draw.append(element)
+
+ def create_labels(self, cr=None):
+ for element in self._elements_to_draw:
+ element.create_labels(cr)
+
+ def create_shapes(self):
+ for element in self._elements_to_draw:
+ element.create_shapes()
+
+ def _drawables(self):
+ # todo: cache that
+ show_comments = Actions.TOGGLE_SHOW_BLOCK_COMMENTS.get_active()
+ for element in self._elements_to_draw:
+ if element.is_block and show_comments and element.enabled:
+ yield element.draw_comment
+ if self._new_connection is not None:
+ yield self._new_connection.draw
+ for element in self._elements_to_draw:
+ yield element.draw
+
+ def draw(self, cr):
+ """Draw blocks connections comment and select rectangle"""
+ for draw_element in self._drawables():
+ cr.save()
+ draw_element(cr)
+ cr.restore()
+
+ draw_multi_select_rectangle = (
+ self.mouse_pressed and
+ (not self.selected_elements or self.drawing_area.ctrl_mask) and
+ not self._new_connection
+ )
+ if draw_multi_select_rectangle:
+ x1, y1 = self.press_coor
+ x2, y2 = self.coordinate
+ x, y = int(min(x1, x2)), int(min(y1, y2))
+ w, h = int(abs(x1 - x2)), int(abs(y1 - y2))
+ cr.set_source_rgba(
+ colors.HIGHLIGHT_COLOR[0],
+ colors.HIGHLIGHT_COLOR[1],
+ colors.HIGHLIGHT_COLOR[2],
+ 0.5,
+ )
+ cr.rectangle(x, y, w, h)
+ cr.fill()
+ cr.rectangle(x, y, w, h)
+ cr.stroke()
+
+ ##########################################################################
+ # selection handling
+ ##########################################################################
+ def update_selected_elements(self):
+ """
+ Update the selected elements.
+ The update behavior depends on the state of the mouse button.
+ When the mouse button pressed the selection will change when
+ the control mask is set or the new selection is not in the current group.
+ When the mouse button is released the selection will change when
+ the mouse has moved and the control mask is set or the current group is empty.
+ Attempt to make a new connection if the old and ports are filled.
+ If the control mask is set, merge with the current elements.
+ """
+ selected_elements = None
+ if self.mouse_pressed:
+ new_selections = self.what_is_selected(self.coordinate)
+ # update the selections if the new selection is not in the current selections
+ # allows us to move entire selected groups of elements
+ if not new_selections:
+ selected_elements = set()
+ elif self.drawing_area.ctrl_mask or self.selected_elements.isdisjoint(new_selections):
+ selected_elements = new_selections
+
+ if self._old_selected_port:
+ self._old_selected_port.force_show_label = False
+ self.create_shapes()
+ self.drawing_area.queue_draw()
+ elif self._new_selected_port:
+ self._new_selected_port.force_show_label = True
+
+ else: # called from a mouse release
+ if not self.element_moved and (not self.selected_elements or self.drawing_area.ctrl_mask) and not self._new_connection:
+ selected_elements = self.what_is_selected(self.coordinate, self.press_coor)
+
+ # this selection and the last were ports, try to connect them
+ if self.make_connection():
+ return
+
+ # update selected elements
+ if selected_elements is None:
+ return
+
+ # if ctrl, set the selected elements to the union - intersection of old and new
+ if self.drawing_area.ctrl_mask:
+ self.selected_elements ^= selected_elements
+ else:
+ self.selected_elements.clear()
+ self.selected_elements.update(selected_elements)
+ Actions.ELEMENT_SELECT()
+
+ def what_is_selected(self, coor, coor_m=None):
+ """
+ What is selected?
+ At the given coordinate, return the elements found to be selected.
+ If coor_m is unspecified, return a list of only the first element found to be selected:
+ Iterate though the elements backwards since top elements are at the end of the list.
+ If an element is selected, place it at the end of the list so that is is drawn last,
+ and hence on top. Update the selected port information.
+
+ Args:
+ coor: the coordinate of the mouse click
+ coor_m: the coordinate for multi select
+
+ Returns:
+ the selected blocks and connections or an empty list
+ """
+ selected_port = None
+ selected = set()
+ # check the elements
+ for element in reversed(self._elements_to_draw):
+ selected_element = element.what_is_selected(coor, coor_m)
+ if not selected_element:
+ continue
+ # update the selected port information
+ if selected_element.is_port:
+ if not coor_m:
+ selected_port = selected_element
+ selected_element = selected_element.parent_block
+
+ selected.add(selected_element)
+ if not coor_m:
+ break
+
+ if selected_port and selected_port.is_source:
+ selected.remove(selected_port.parent_block)
+ self._new_connection = DummyConnection(selected_port, coordinate=coor)
+ self.drawing_area.queue_draw()
+ # update selected ports
+ if selected_port is not self._new_selected_port:
+ self._old_selected_port = self._new_selected_port
+ self._new_selected_port = selected_port
+ return selected
+
+ def unselect(self):
+ """
+ Set selected elements to an empty set.
+ """
+ self.selected_elements.clear()
+
+ def select_all(self):
+ """Select all blocks in the flow graph"""
+ self.selected_elements.clear()
+ self.selected_elements.update(self._elements_to_draw)
+
+ def selected_blocks(self):
+ """
+ Get a group of selected blocks.
+
+ Returns:
+ sub set of blocks in this flow graph
+ """
+ return (e for e in self.selected_elements if e.is_block)
+
+ @property
+ def selected_block(self):
+ """
+ Get the selected block when a block or port is selected.
+
+ Returns:
+ a block or None
+ """
+ return next(self.selected_blocks(), None)
+
+ def get_selected_elements(self):
+ """
+ Get the group of selected elements.
+
+ Returns:
+ sub set of elements in this flow graph
+ """
+ return self.selected_elements
+
+ def get_selected_element(self):
+ """
+ Get the selected element.
+
+ Returns:
+ a block, port, or connection or None
+ """
+ return next(iter(self.selected_elements), None)
+
+ ##########################################################################
+ # Event Handlers
+ ##########################################################################
+ def handle_mouse_context_press(self, coordinate, event):
+ """
+ The context mouse button was pressed:
+ If no elements were selected, perform re-selection at this coordinate.
+ Then, show the context menu at the mouse click location.
+ """
+ selections = self.what_is_selected(coordinate)
+ if not selections.intersection(self.selected_elements):
+ self.coordinate = coordinate
+ self.mouse_pressed = True
+ self.update_selected_elements()
+ self.mouse_pressed = False
+ if self._new_connection:
+ self._new_connection = None
+ self.drawing_area.queue_draw()
+ self._context_menu.popup(None, None, None, None, event.button, event.time)
+
+ def handle_mouse_selector_press(self, double_click, coordinate):
+ """
+ The selector mouse button was pressed:
+ Find the selected element. Attempt a new connection if possible.
+ Open the block params window on a double click.
+ Update the selection state of the flow graph.
+ """
+ self.press_coor = coordinate
+ self.coordinate = coordinate
+ self.mouse_pressed = True
+ if double_click:
+ self.unselect()
+ self.update_selected_elements()
+
+ if double_click and self.selected_block:
+ self.mouse_pressed = False
+ Actions.BLOCK_PARAM_MODIFY()
+
+ def handle_mouse_selector_release(self, coordinate):
+ """
+ The selector mouse button was released:
+ Update the state, handle motion (dragging).
+ And update the selected flowgraph elements.
+ """
+ self.coordinate = coordinate
+ self.mouse_pressed = False
+ if self.element_moved:
+ Actions.BLOCK_MOVE()
+ self.element_moved = False
+ self.update_selected_elements()
+ if self._new_connection:
+ self._new_connection = None
+ self.drawing_area.queue_draw()
+
+ def handle_mouse_motion(self, coordinate):
+ """
+ The mouse has moved, respond to mouse dragging or notify elements
+ Move a selected element to the new coordinate.
+ Auto-scroll the scroll bars at the boundaries.
+ """
+ # to perform a movement, the mouse must be pressed
+ # (no longer checking pending events via Gtk.events_pending() - always true in Windows)
+ redraw = False
+ if not self.mouse_pressed or self._new_connection:
+ redraw = self._handle_mouse_motion_move(coordinate)
+ if self.mouse_pressed:
+ redraw = redraw or self._handle_mouse_motion_drag(coordinate)
+ if redraw:
+ self.drawing_area.queue_draw()
+
+ def _handle_mouse_motion_move(self, coordinate):
+ # only continue if mouse-over stuff is enabled (just the auto-hide port label stuff for now)
+ if not Actions.TOGGLE_AUTO_HIDE_PORT_LABELS.get_active():
+ return
+ redraw = False
+ for element in self._elements_to_draw:
+ over_element = element.what_is_selected(coordinate)
+ if not over_element:
+ continue
+ if over_element != self.element_under_mouse: # over sth new
+ if self.element_under_mouse:
+ redraw |= self.element_under_mouse.mouse_out() or False
+ self.element_under_mouse = over_element
+ redraw |= over_element.mouse_over() or False
+ break
+ else:
+ if self.element_under_mouse:
+ redraw |= self.element_under_mouse.mouse_out() or False
+ self.element_under_mouse = None
+ if redraw:
+ # self.create_labels()
+ self.create_shapes()
+ return redraw
+
+ def _handle_mouse_motion_drag(self, coordinate):
+ redraw = False
+ # remove the connection if selected in drag event
+ if len(self.selected_elements) == 1 and self.get_selected_element().is_connection:
+ Actions.ELEMENT_DELETE()
+ redraw = True
+
+ if self._new_connection:
+ e = self.element_under_mouse
+ if e and e.is_port and e.is_sink:
+ self._new_connection.update(sink_port=self.element_under_mouse)
+ else:
+ self._new_connection.update(coordinate=coordinate, rotation=0)
+ return True
+ # move the selected elements and record the new coordinate
+ x, y = coordinate
+ if not self.drawing_area.ctrl_mask:
+ X, Y = self.coordinate
+ dX, dY = int(x - X), int(y - Y)
+ active = Actions.TOGGLE_SNAP_TO_GRID.get_active() or self.drawing_area.mod1_mask
+ if not active or abs(dX) >= Constants.CANVAS_GRID_SIZE or abs(dY) >= Constants.CANVAS_GRID_SIZE:
+ self.move_selected((dX, dY))
+ self.coordinate = (x, y)
+ redraw = True
+ return redraw
+
+ def get_extents(self):
+ extent = 100000, 100000, 0, 0
+ for element in self._elements_to_draw:
+ extent = (min_or_max(xy, e_xy) for min_or_max, xy, e_xy in zip(
+ (min, min, max, max), extent, element.get_extents()
+ ))
+ return tuple(extent)
diff --git a/grc/gui/canvas/param.py b/grc/gui/canvas/param.py
new file mode 100644
index 000000000..5777423c6
--- /dev/null
+++ b/grc/gui/canvas/param.py
@@ -0,0 +1,162 @@
+# Copyright 2007-2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2
+# of the License, or (at your option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+from __future__ import absolute_import
+
+import numbers
+
+from .drawable import Drawable
+from .. import ParamWidgets, Utils, Constants
+from ...core.params import Param as CoreParam
+
+
+class Param(CoreParam):
+ """The graphical parameter."""
+
+ make_cls_with_base = classmethod(Drawable.make_cls_with_base.__func__)
+
+ def get_input(self, *args, **kwargs):
+ """
+ Get the graphical gtk class to represent this parameter.
+ An enum requires and combo parameter.
+ A non-enum with options gets a combined entry/combo parameter.
+ All others get a standard entry parameter.
+
+ Returns:
+ gtk input class
+ """
+ dtype = self.dtype
+ if dtype in ('file_open', 'file_save'):
+ input_widget_cls = ParamWidgets.FileParam
+
+ elif dtype == 'enum':
+ input_widget_cls = ParamWidgets.EnumParam
+
+ elif self.options:
+ input_widget_cls = ParamWidgets.EnumEntryParam
+
+ elif dtype == '_multiline':
+ input_widget_cls = ParamWidgets.MultiLineEntryParam
+
+ elif dtype == '_multiline_python_external':
+ input_widget_cls = ParamWidgets.PythonEditorParam
+
+ else:
+ input_widget_cls = ParamWidgets.EntryParam
+
+ return input_widget_cls(self, *args, **kwargs)
+
+ def format_label_markup(self, have_pending_changes=False):
+ block = self.parent
+ # fixme: using non-public attribute here
+ has_callback = \
+ hasattr(block, 'templates') and \
+ any(self.key in callback for callback in block.templates.get('callbacks', ''))
+
+ return '<span {underline} {foreground} font_desc="Sans 9">{label}</span>'.format(
+ underline='underline="low"' if has_callback else '',
+ foreground='foreground="blue"' if have_pending_changes else
+ 'foreground="red"' if not self.is_valid() else '',
+ label=Utils.encode(self.name)
+ )
+
+ def format_tooltip_text(self):
+ errors = self.get_error_messages()
+ tooltip_lines = ['Key: ' + self.key, 'Type: ' + self.dtype]
+ if self.is_valid():
+ value = str(self.get_evaluated())
+ if len(value) > 100:
+ value = '{}...{}'.format(value[:50], value[-50:])
+ tooltip_lines.append('Value: ' + value)
+ elif len(errors) == 1:
+ tooltip_lines.append('Error: ' + errors[0])
+ elif len(errors) > 1:
+ tooltip_lines.append('Error:')
+ tooltip_lines.extend(' * ' + msg for msg in errors)
+ return '\n'.join(tooltip_lines)
+
+ def pretty_print(self):
+ """
+ Get the repr (nice string format) for this param.
+
+ Returns:
+ the string representation
+ """
+ ##################################################
+ # Truncate helper method
+ ##################################################
+ def _truncate(string, style=0):
+ max_len = max(27 - len(self.name), 3)
+ if len(string) > max_len:
+ if style < 0: # Front truncate
+ string = '...' + string[3-max_len:]
+ elif style == 0: # Center truncate
+ string = string[:max_len//2 - 3] + '...' + string[-max_len//2:]
+ elif style > 0: # Rear truncate
+ string = string[:max_len-3] + '...'
+ return string
+
+ ##################################################
+ # Simple conditions
+ ##################################################
+ value = self.get_value()
+ if not self.is_valid():
+ return _truncate(value)
+ if value in self.options:
+ return self.options[value] # its name
+
+ ##################################################
+ # Split up formatting by type
+ ##################################################
+ # Default center truncate
+ truncate = 0
+ e = self.get_evaluated()
+ t = self.dtype
+ if isinstance(e, bool):
+ return str(e)
+ elif isinstance(e, numbers.Complex):
+ dt_str = Utils.num_to_str(e)
+ elif isinstance(e, Constants.VECTOR_TYPES):
+ # Vector types
+ if len(e) > 8:
+ # Large vectors use code
+ dt_str = self.get_value()
+ truncate = 1
+ else:
+ # Small vectors use eval
+ dt_str = ', '.join(map(Utils.num_to_str, e))
+ elif t in ('file_open', 'file_save'):
+ dt_str = self.get_value()
+ truncate = -1
+ else:
+ # Other types
+ dt_str = str(e)
+
+ # Done
+ return _truncate(dt_str, truncate)
+
+ def format_block_surface_markup(self):
+ """
+ Get the markup for this param.
+
+ Returns:
+ a pango markup string
+ """
+ return '<span {foreground} font_desc="{font}"><b>{label}:</b> {value}</span>'.format(
+ foreground='foreground="red"' if not self.is_valid() else '', font=Constants.PARAM_FONT,
+ label=Utils.encode(self.name), value=Utils.encode(self.pretty_print().replace('\n', ' '))
+ )
diff --git a/grc/gui/canvas/port.py b/grc/gui/canvas/port.py
new file mode 100644
index 000000000..2ea35f3dd
--- /dev/null
+++ b/grc/gui/canvas/port.py
@@ -0,0 +1,227 @@
+"""
+Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion 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 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion 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 program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+"""
+
+from __future__ import absolute_import, division
+
+import math
+
+from gi.repository import Gtk, PangoCairo, Pango
+
+from . import colors
+from .drawable import Drawable
+from .. import Actions, Utils, Constants
+
+from ...core.utils.descriptors import nop_write
+from ...core.ports import Port as CorePort
+
+
+class Port(CorePort, Drawable):
+ """The graphical port."""
+
+ def __init__(self, parent, direction, **n):
+ """
+ Port constructor.
+ Create list of connector coordinates.
+ """
+ super(self.__class__, self).__init__(parent, direction, **n)
+ Drawable.__init__(self)
+ self._connector_coordinate = (0, 0)
+ self._hovering = False
+ self.force_show_label = False
+
+ self._area = []
+ self._bg_color = self._border_color = 0, 0, 0, 0
+ self._font_color = list(colors.FONT_COLOR)
+
+ self._line_width_factor = 1.0
+ self._label_layout_offsets = 0, 0
+
+ self.width_with_label = self.height = 0
+
+ self.label_layout = None
+
+ @property
+ def width(self):
+ return self.width_with_label if self._show_label else Constants.PORT_LABEL_HIDDEN_WIDTH
+
+ @width.setter
+ def width(self, value):
+ self.width_with_label = value
+ self.label_layout.set_width(value * Pango.SCALE)
+
+ def _update_colors(self):
+ """
+ Get the color that represents this port's type.
+ Codes differ for ports where the vec length is 1 or greater than 1.
+
+ Returns:
+ a hex color code.
+ """
+ if not self.parent_block.enabled:
+ self._font_color[-1] = 0.4
+ color = colors.BLOCK_DISABLED_COLOR
+ elif self.domain == Constants.GR_MESSAGE_DOMAIN:
+ color = colors.PORT_TYPE_TO_COLOR.get('message')
+ else:
+ self._font_color[-1] = 1.0
+ color = colors.PORT_TYPE_TO_COLOR.get(self.dtype) or colors.PORT_TYPE_TO_COLOR.get('')
+ if self.vlen > 1:
+ dark = (0, 0, 30 / 255.0, 50 / 255.0, 70 / 255.0)[min(4, self.vlen)]
+ color = tuple(max(c - dark, 0) for c in color)
+ self._bg_color = color
+ self._border_color = tuple(max(c - 0.3, 0) for c in color)
+
+ def create_shapes(self):
+ """Create new areas and labels for the port."""
+ if self.is_horizontal():
+ self._area = (0, 0, self.width, self.height)
+ elif self.is_vertical():
+ self._area = (0, 0, self.height, self.width)
+ self.bounds_from_area(self._area)
+
+ self._connector_coordinate = {
+ 0: (self.width, self.height / 2),
+ 90: (self.height / 2, 0),
+ 180: (0, self.height / 2),
+ 270: (self.height / 2, self.width)
+ }[self.connector_direction]
+
+ def create_labels(self, cr=None):
+ """Create the labels for the socket."""
+ self.label_layout = Gtk.DrawingArea().create_pango_layout('')
+ self.label_layout.set_alignment(Pango.Alignment.CENTER)
+
+ if cr:
+ PangoCairo.update_layout(cr, self.label_layout)
+
+ if self.domain in (Constants.GR_MESSAGE_DOMAIN, Constants.GR_STREAM_DOMAIN):
+ self._line_width_factor = 1.0
+ else:
+ self._line_width_factor = 2.0
+
+ self._update_colors()
+
+ layout = self.label_layout
+ layout.set_markup('<span font_desc="{font}">{name}</span>'.format(
+ name=Utils.encode(self.name), font=Constants.PORT_FONT
+ ))
+ label_width, label_height = self.label_layout.get_size()
+
+ self.width = 2 * Constants.PORT_LABEL_PADDING + label_width / Pango.SCALE
+ self.height = 2 * Constants.PORT_LABEL_PADDING + label_height / Pango.SCALE
+ self._label_layout_offsets = [0, Constants.PORT_LABEL_PADDING]
+ # if self.dtype == 'bus':
+ # self.height += Constants.PORT_EXTRA_BUS_HEIGHT
+ # self._label_layout_offsets[1] += Constants.PORT_EXTRA_BUS_HEIGHT / 2
+ self.height += self.height % 2 # uneven height
+
+ def draw(self, cr):
+ """
+ Draw the socket with a label.
+ """
+ border_color = self._border_color
+ cr.set_line_width(self._line_width_factor * cr.get_line_width())
+ cr.translate(*self.coordinate)
+
+ cr.rectangle(*self._area)
+ cr.set_source_rgba(*self._bg_color)
+ cr.fill_preserve()
+ cr.set_source_rgba(*border_color)
+ cr.stroke()
+
+ if not self._show_label:
+ return # this port is folded (no label)
+
+ if self.is_vertical():
+ cr.rotate(-math.pi / 2)
+ cr.translate(-self.width, 0)
+ cr.translate(*self._label_layout_offsets)
+
+ cr.set_source_rgba(*self._font_color)
+ PangoCairo.update_layout(cr, self.label_layout)
+ PangoCairo.show_layout(cr, self.label_layout)
+
+ @property
+ def connector_coordinate_absolute(self):
+ """the coordinate where connections may attach to"""
+ return [sum(c) for c in zip(
+ self._connector_coordinate, # relative to port
+ self.coordinate, # relative to block
+ self.parent_block.coordinate # abs
+ )]
+
+ @property
+ def connector_direction(self):
+ """Get the direction that the socket points: 0,90,180,270."""
+ if self.is_source:
+ return self.rotation
+ elif self.is_sink:
+ return (self.rotation + 180) % 360
+
+ @nop_write
+ @property
+ def rotation(self):
+ return self.parent_block.rotation
+
+ def rotate(self, direction):
+ """
+ Rotate the parent rather than self.
+
+ Args:
+ direction: degrees to rotate
+ """
+ self.parent_block.rotate(direction)
+
+ def move(self, delta_coor):
+ """Move the parent rather than self."""
+ self.parent_block.move(delta_coor)
+
+ @property
+ def highlighted(self):
+ return self.parent_block.highlighted
+
+ @highlighted.setter
+ def highlighted(self, value):
+ self.parent_block.highlighted = value
+
+ @property
+ def _show_label(self):
+ """
+ Figure out if the label should be hidden
+
+ Returns:
+ true if the label should not be shown
+ """
+ return self._hovering or self.force_show_label or not Actions.TOGGLE_AUTO_HIDE_PORT_LABELS.get_active()
+
+ def mouse_over(self):
+ """
+ Called from flow graph on mouse-over
+ """
+ changed = not self._show_label
+ self._hovering = True
+ return changed
+
+ def mouse_out(self):
+ """
+ Called from flow graph on mouse-out
+ """
+ label_was_shown = self._show_label
+ self._hovering = False
+ return label_was_shown != self._show_label
diff --git a/grc/gui/external_editor.py b/grc/gui/external_editor.py
index 010bd71d1..155b0915c 100644
--- a/grc/gui/external_editor.py
+++ b/grc/gui/external_editor.py
@@ -17,6 +17,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
+from __future__ import absolute_import, print_function
+
import os
import sys
import time
@@ -67,7 +69,7 @@ class ExternalEditor(threading.Thread):
time.sleep(1)
except Exception as e:
- print >> sys.stderr, "file monitor crashed:", str(e)
+ print("file monitor crashed:", str(e), file=sys.stderr)
finally:
try:
os.remove(self.filename)
@@ -76,10 +78,7 @@ class ExternalEditor(threading.Thread):
if __name__ == '__main__':
- def p(data):
- print data
-
- e = ExternalEditor('/usr/bin/gedit', "test", "content", p)
+ e = ExternalEditor('/usr/bin/gedit', "test", "content", print)
e.open_editor()
e.start()
time.sleep(15)
diff --git a/grc/main.py b/grc/main.py
index 0edab4076..4f4cd6870 100755
--- a/grc/main.py
+++ b/grc/main.py
@@ -15,13 +15,12 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-import argparse
+import argparse, logging, sys
-import gtk
-from gnuradio import gr
-
-from .gui.Platform import Platform
-from .gui.ActionHandler import ActionHandler
+import gi
+gi.require_version('Gtk', '3.0')
+gi.require_version('PangoCairo', '1.0')
+from gi.repository import Gtk
VERSION_AND_DISCLAIMER_TEMPLATE = """\
@@ -32,24 +31,63 @@ GRC comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it.
"""
+LOG_LEVELS = {
+ 'debug': logging.DEBUG,
+ 'info': logging.INFO,
+ 'warning': logging.WARNING,
+ 'error': logging.ERROR,
+ 'critical': logging.CRITICAL,
+}
+
def main():
+ from gnuradio import gr
parser = argparse.ArgumentParser(
description=VERSION_AND_DISCLAIMER_TEMPLATE % gr.version())
parser.add_argument('flow_graphs', nargs='*')
+ parser.add_argument('--log', choices=['debug', 'info', 'warning', 'error', 'critical'], default='warning')
args = parser.parse_args()
try:
- gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0))
+ Gtk.window_set_default_icon(Gtk.IconTheme().load_icon('gnuradio-grc', 256, 0))
except:
pass
+ # Enable logging
+ # Note: All other modules need to use the 'grc.<module>' convention
+ log = logging.getLogger('grc')
+ log.setLevel(logging.DEBUG)
+
+ # Console formatting
+ console = logging.StreamHandler()
+ console.setLevel(LOG_LEVELS[args.log])
+
+ #msg_format = '[%(asctime)s - %(levelname)8s] --- %(message)s (%(filename)s:%(lineno)s)'
+ msg_format = '[%(levelname)s] %(message)s (%(filename)s:%(lineno)s)'
+ date_format = '%I:%M'
+ formatter = logging.Formatter(msg_format, datefmt=date_format)
+
+ #formatter = utils.log.ConsoleFormatter()
+ console.setFormatter(formatter)
+ log.addHandler(console)
+
+ py_version = sys.version.split()[0]
+ log.debug("Starting GNU Radio Companion ({})".format(py_version))
+
+ # Delay importing until the logging is setup
+ from .gui.Platform import Platform
+ from .gui.Application import Application
+
+ log.debug("Loading platform")
platform = Platform(
- prefs_file=gr.prefs(),
version=gr.version(),
version_parts=(gr.major_version(), gr.api_version(), gr.minor_version()),
+ prefs=gr.prefs(),
install_prefix=gr.prefix()
)
- ActionHandler(args.flow_graphs, platform)
- gtk.main()
+ platform.build_library()
+ log.debug("Loading application")
+ app = Application(args.flow_graphs, platform)
+ log.debug("Running")
+ sys.exit(app.run())
diff --git a/grc/scripts/gnuradio-companion b/grc/scripts/gnuradio-companion
index bacbbe233..55e66cc76 100755
--- a/grc/scripts/gnuradio-companion
+++ b/grc/scripts/gnuradio-companion
@@ -37,11 +37,13 @@ Is the library path environment variable set correctly?
def die(error, message):
msg = "{0}\n\n({1})".format(message, error)
try:
- import gtk
- d = gtk.MessageDialog(
- type=gtk.MESSAGE_ERROR,
- buttons=gtk.BUTTONS_CLOSE,
- message_format=msg,
+ import gi
+ gi.require_version('Gtk', '3.0')
+ from gi.repository import Gtk
+ d = Gtk.MessageDialog(
+ message_type=Gtk.MessageType.ERROR,
+ buttons=Gtk.ButtonsType.CLOSE,
+ text=msg,
)
d.set_title(type(error).__name__)
d.run()
@@ -53,10 +55,13 @@ def die(error, message):
def check_gtk():
try:
warnings.filterwarnings("error")
- import pygtk
- pygtk.require('2.0')
- import gtk
- gtk.init_check()
+ import gi
+ gi.require_version('Gtk', '3.0')
+ gi.require_version('PangoCairo', '1.0')
+ gi.require_foreign('cairo', 'Context')
+
+ from gi.repository import Gtk
+ Gtk.init_check()
warnings.filterwarnings("always")
except Exception as err:
die(err, "Failed to initialize GTK. If you are running over ssh, "
diff --git a/grc/tests/__init__.py b/grc/tests/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/grc/tests/__init__.py
diff --git a/grc/tests/resources/file1.block.yml b/grc/tests/resources/file1.block.yml
new file mode 100644
index 000000000..f486c89ea
--- /dev/null
+++ b/grc/tests/resources/file1.block.yml
@@ -0,0 +1,38 @@
+id: block_key
+label: testname
+
+parameters:
+- id: vlen
+ label: Vec Length
+ category: test
+ dtype: int
+ default: '1'
+ hide: ${ 'part' if vlen == 1 else 'none' }
+- id: out_type
+ label: Vec Length
+ dtype: string
+ default: complex
+ hide: part
+- id: a
+ label: Alpha
+ dtype: ${ (out_type) }
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: complex
+ vlen: ${ 2 * vlen }
+- domain: message
+ id: in2
+
+outputs:
+- domain: stream
+ dtype: ${ out_type }
+ vlen: ${ vlen }
+asserts:
+- ${ vlen > 0 }
+
+templates:
+ make: blocks.complex_to_mag_squared(${vlen})
+
+file_format: 1
diff --git a/grc/tests/resources/file2.block.yml b/grc/tests/resources/file2.block.yml
new file mode 100644
index 000000000..459527260
--- /dev/null
+++ b/grc/tests/resources/file2.block.yml
@@ -0,0 +1,31 @@
+id: blocks_and_const_xx
+label: And Const
+
+parameters:
+- id: type
+ label: IO Type
+ dtype: enum
+ options: [int, short, byte]
+ option_attributes:
+ fcn: [ii, ss, bb]
+ hide: part
+- id: const
+ label: Constant
+ dtype: int
+ default: '0'
+
+inputs:
+- domain: stream
+ dtype: ${ type }
+
+outputs:
+- domain: stream
+ dtype: ${ type }
+
+templates:
+ imports: from gnuradio import blocks
+ make: blocks.and_const_${type.fcn}(${const})
+ callbacks:
+ - set_k(${const})
+
+file_format: 1
diff --git a/grc/tests/resources/file3.block.yml b/grc/tests/resources/file3.block.yml
new file mode 100644
index 000000000..e53515d13
--- /dev/null
+++ b/grc/tests/resources/file3.block.yml
@@ -0,0 +1,66 @@
+id: variable_qtgui_check_box
+label: QT GUI Check Box
+
+parameters:
+- id: label
+ label: Label
+ dtype: string
+ hide: ${ ('none' if label else 'part') }
+- id: type
+ label: Type
+ dtype: enum
+ default: int
+ options: [real, int, string, bool, raw]
+ option_labels: [Float, Integer, String, Boolean, Any]
+ option_attributes:
+ conv: [float, int, str, bool, eval]
+ hide: part
+- id: value
+ label: Default Value
+ dtype: ${ type }
+ default: 'True'
+- id: 'true'
+ label: 'True'
+ dtype: ${ type }
+ default: 'True'
+- id: 'false'
+ label: 'False'
+ dtype: ${ type }
+ default: 'False'
+- id: gui_hint
+ label: GUI Hint
+ dtype: gui_hint
+ hide: part
+value: ${ value }
+
+asserts:
+- ${value in (true, false)}
+
+templates:
+ imports: from PyQt4 import Qt
+ var_make: self.${id} = ${id} = ${value}
+ callbacks:
+ - self.set_${id}(${value})
+ - self._${id}_callback(${id})
+ make: |-
+ <%
+ win = '_%s_check_box'%id
+ if not label:
+ label = id
+ %>
+ ${win} = Qt.QCheckBox(${label})
+ self._${id}_choices = {True: ${true}, False: ${false}}
+ self._${id}_choices_inv = dict((v,k) for k,v in self._${id}_choices.iteritems())
+ self._${id}_callback = lambda i: Qt.QMetaObject.invokeMethod(${win}, "setChecked", Qt.Q_ARG("bool", self._${id}_choices_inv[i]))
+ self._${id}_callback(self.${id})
+ ${win}.stateChanged.connect(lambda i: self.set_${id}(self._${id}_choices[bool(i)]))
+ ${gui_hint()(win)}
+
+documentation: |-
+ This block creates a variable check box. Leave the label blank to use the variable id as the label.
+
+ A check box selects between two values of similar type. Te values do not necessarily need to be of boolean type.
+
+ The GUI hint can be used to position the widget within the application. The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. Both the tab specification and the grid position are optional.
+
+file_format: 1
diff --git a/grc/tests/test_block_flags.py b/grc/tests/test_block_flags.py
new file mode 100644
index 000000000..9eecaf20d
--- /dev/null
+++ b/grc/tests/test_block_flags.py
@@ -0,0 +1,26 @@
+
+from grc.core.blocks._flags import Flags
+
+
+def test_simple():
+ assert 'test' in Flags('_test_')
+
+
+def test_deprecated():
+ assert Flags.DEPRECATED == 'deprecated'
+ assert Flags('this is deprecated').deprecated is True
+
+
+def test_extend():
+ f = Flags('a')
+ f += 'b'
+ assert isinstance(f, Flags)
+ f += u'b'
+ assert isinstance(f, Flags)
+ f = Flags(u'a')
+ f += 'b'
+ assert isinstance(f, Flags)
+ f += u'b'
+ assert isinstance(f, Flags)
+
+ assert str(f) == 'abb'
diff --git a/grc/tests/test_block_templates.py b/grc/tests/test_block_templates.py
new file mode 100644
index 000000000..df9ab3755
--- /dev/null
+++ b/grc/tests/test_block_templates.py
@@ -0,0 +1,45 @@
+import pytest
+
+from grc.core.blocks._templates import MakoTemplates
+from grc.core.errors import TemplateError
+
+
+class Block(object):
+ namespace_templates = {}
+
+ templates = MakoTemplates(None)
+
+ def __init__(self, **kwargs):
+ self.namespace_templates.update(kwargs)
+
+
+def test_simple():
+ t = MakoTemplates(_bind_to=Block(num='123'), test='abc${num}')
+ assert t['test'] == 'abc${num}'
+ assert t.render('test') == 'abc123'
+ assert 'abc${num}' in t._template_cache
+
+
+def test_instance():
+ block = Block(num='123')
+ block.templates['test'] = 'abc${num}'
+ assert block.templates.render('test') == 'abc123'
+ assert block.templates is block.__dict__['templates']
+
+
+def test_list():
+ templates = ['abc${num}', '${2 * num}c']
+ t = MakoTemplates(_bind_to=Block(num='123'), test=templates)
+ assert t['test'] == templates
+ assert t.render('test') == ['abc123', '123123c']
+ assert set(templates) == set(t._template_cache.keys())
+
+
+def test_parse_error():
+ with pytest.raises(TemplateError):
+ MakoTemplates(_bind_to=Block(num='123'), test='abc${num NOT CLOSING').render('test')
+
+
+def test_parse_error2():
+ with pytest.raises(TemplateError):
+ MakoTemplates(_bind_to=Block(num='123'), test='abc${ WRONG_VAR }').render('test')
diff --git a/grc/tests/test_cheetah_converter.py b/grc/tests/test_cheetah_converter.py
new file mode 100644
index 000000000..799995543
--- /dev/null
+++ b/grc/tests/test_cheetah_converter.py
@@ -0,0 +1,132 @@
+""""""
+
+import functools
+import grc.converter.cheetah_converter as parser
+
+
+def test_basic():
+ c = parser.Converter(names={'abc'})
+ for convert in (c.convert_simple, c.convert_hard, c.to_python):
+ assert 'abc' == convert('$abc')
+ assert 'abc' == convert('$abc()')
+ assert 'abc' == convert('$(abc)')
+ assert 'abc' == convert('$(abc())')
+ assert 'abc' == convert('${abc}')
+ assert 'abc' == convert('${abc()}')
+
+ assert c.stats['simple'] == 2 * 6
+ assert c.stats['hard'] == 1 * 6
+
+
+def test_simple():
+ convert = parser.Converter(names={'abc': {'def'}})
+ assert 'abc' == convert.convert_simple('$abc')
+ assert 'abc.def' == convert.convert_simple('$abc.def')
+ assert 'abc.def' == convert.convert_simple('$(abc.def)')
+ assert 'abc.def' == convert.convert_simple('${abc.def}')
+ try:
+ convert.convert_simple('$abc.not_a_sub_key')
+ except NameError:
+ assert True
+ else:
+ assert False
+
+
+def test_conditional():
+ convert = parser.Converter(names={'abc'})
+ assert '(asb_asd_ if abc > 0 else __not__)' == convert.convert_inline_conditional(
+ '#if $abc > 0 then asb_$asd_ else __not__')
+
+
+def test_simple_format_string():
+ convert = functools.partial(parser.Converter(names={'abc'}).convert_simple, spec=parser.FormatString)
+ assert '{abc}' == convert('$abc')
+ assert '{abc:eval}' == convert('$abc()')
+ assert '{abc}' == convert('$(abc)')
+ assert '{abc:eval}' == convert('$(abc())')
+ assert '{abc}' == convert('${abc}')
+ assert '{abc:eval}' == convert('${abc()}')
+
+
+def test_hard_format_string():
+ names = {'abc': {'ff'}, 'param1': {}, 'param2': {}}
+ convert = functools.partial(parser.Converter(names).convert_hard, spec=parser.FormatString)
+ assert 'make_a_cool_block_{abc.ff}({param1}, {param2})' == \
+ convert('make_a_cool_block_${abc.ff}($param1, $param2)')
+
+
+converter = parser.Converter(names={'abc'})
+c2p = converter.to_python
+
+
+def test_opts():
+ assert 'abc abc abc' == c2p('$abc $(abc) ${abc}')
+ assert 'abc abc.abc abc' == c2p('$abc $abc.abc ${abc}')
+ assert 'abc abc[''].abc abc' == c2p('$abc $abc[''].abc() ${abc}')
+
+
+def test_nested():
+ assert 'abc(abc) abc + abc abc[abc]' == c2p('$abc($abc) $(abc + $abc) ${abc[$abc]}')
+ assert '(abc_abc_)' == c2p('(abc_$(abc)_)')
+
+
+def test_nested2():
+ class Other(parser.Python):
+ nested_start = '{'
+ nested_end = '}'
+ assert 'abc({abc})' == converter.convert('$abc($abc)', spec=Other)
+
+
+def test_nested3():
+ class Other(parser.Python):
+ start = '{'
+ end = '}'
+ assert '{abc(abc)}' == converter.convert('$abc($abc)', spec=Other)
+
+
+def test_with_string():
+ assert 'abc "$(abc)" abc' == c2p('$abc "$(abc)" ${abc}')
+ assert 'abc \'$(abc)\' abc' == c2p('$abc \'$(abc)\' ${abc}')
+ assert 'abc "\'\'$(abc)" abc' == c2p('$abc "\'\'$(abc)" ${abc}')
+
+
+def test_if():
+ result = converter.to_mako("""
+ #if $abc > 0
+ test
+ #else if $abc < 0
+ test
+ #else
+ bla
+ #end if
+ """)
+
+ expected = """
+ % if abc > 0:
+ test
+ % elif abc < 0:
+ test
+ % else:
+ bla
+ % endif
+ """
+ assert result == expected
+
+
+def test_hash_end():
+ result = converter.to_mako('$abc#slurp')
+ assert result == '${abc}\\'
+
+
+def test_slurp_if():
+ result = converter.to_mako("""
+ $abc#slurp
+ #if $abc
+ """)
+
+ expected = """
+ ${abc}
+ % if abc:
+ """
+ assert result == expected
+
diff --git a/grc/tests/test_evaled_property.py b/grc/tests/test_evaled_property.py
new file mode 100644
index 000000000..27957cd29
--- /dev/null
+++ b/grc/tests/test_evaled_property.py
@@ -0,0 +1,104 @@
+import collections
+import numbers
+
+from grc.core.utils.descriptors import Evaluated, EvaluatedEnum, EvaluatedPInt
+
+
+class A(object):
+ def __init__(self, **kwargs):
+ self.called = collections.defaultdict(int)
+ self.errors = []
+ self.namespace = kwargs
+
+ def add_error_message(self, msg):
+ self.errors.append(msg)
+
+ @property
+ def parent_block(self):
+ return self
+
+ def evaluate(self, expr):
+ self.called['evaluate'] += 1
+ return eval(expr, self.namespace)
+
+ @Evaluated(int, 1)
+ def foo(self):
+ self.called['foo'] += 1
+ return eval(self._foo)
+
+ bar = Evaluated(numbers.Real, 1.0, name='bar')
+
+ test = EvaluatedEnum(['a', 'b'], 'a', name='test')
+
+ lala = EvaluatedPInt()
+
+
+def test_fixed_value():
+ a = A()
+ a.foo = 10
+
+ assert not hasattr(a, '_foo')
+ assert a.foo == 10
+ assert a.called['foo'] == 0
+ delattr(a, 'foo')
+ assert a.foo == 10
+ assert a.called['foo'] == 0
+
+
+def test_evaled():
+ a = A()
+ a.foo = '${ 10 + 1 }'
+ assert getattr(a, '_foo') == '10 + 1'
+ assert a.foo == 11 and a.foo == 11
+ assert a.called['foo'] == 1
+ assert a.called['evaluate'] == 0
+ delattr(a, 'foo')
+ assert a.foo == 11 and a.foo == 11
+ assert a.called['foo'] == 2
+ assert not a.errors
+
+
+def test_evaled_with_default():
+ a = A()
+ a.bar = '${ 10 + 1 }'
+ assert getattr(a, '_bar') == '10 + 1'
+ assert a.bar == 11.0 and type(a.bar) == int
+ assert a.called['evaluate'] == 1
+ assert not a.errors
+
+
+def test_evaled_int_with_default():
+ a = A(ll=10)
+ a.lala = '${ ll * 2 }'
+ assert a.lala == 20
+ a.namespace['ll'] = -10
+ assert a.lala == 20
+ del a.lala
+ assert a.lala == 1
+ assert not a.errors
+
+
+def test_evaled_enum_fixed_value():
+ a = A()
+ a.test = 'a'
+ assert not hasattr(a, '_test')
+ assert a.test == 'a' and type(a.test) == str
+ assert not a.errors
+
+
+def test_evaled_enum():
+ a = A(bla=False)
+ a.test = '${ "a" if bla else "b" }'
+ assert a.test == 'b'
+ a.namespace['bla'] = True
+ assert a.test == 'b'
+ del a.test
+ assert a.test == 'a'
+ assert not a.errors
+
+
+def test_class_access():
+ a = A()
+ a.foo = '${ meme }'
+ descriptor = getattr(a.__class__, 'foo')
+ assert descriptor.name_raw == '_foo'
diff --git a/grc/tests/test_expr_utils.py b/grc/tests/test_expr_utils.py
new file mode 100644
index 000000000..4f25477bf
--- /dev/null
+++ b/grc/tests/test_expr_utils.py
@@ -0,0 +1,41 @@
+import operator
+
+import pytest
+
+from grc.core.utils import expr_utils
+
+id_getter = operator.itemgetter(0)
+expr_getter = operator.itemgetter(1)
+
+
+def test_simple():
+ objects = [
+ ['c', '2 * a + b'],
+ ['a', '1'],
+ ['b', '2 * a + unknown * d'],
+ ['d', '5'],
+ ]
+
+ expected = [
+ ['a', '1'],
+ ['d', '5'],
+ ['b', '2 * a + unknown * d'],
+ ['c', '2 * a + b'],
+ ]
+
+ out = expr_utils.sort_objects2(objects, id_getter, expr_getter)
+
+ assert out == expected
+
+
+def test_other():
+ test = [
+ ['c', '2 * a + b'],
+ ['a', '1'],
+ ['b', '2 * c + unknown'],
+ ]
+
+ expr_utils.sort_objects2(test, id_getter, expr_getter, check_circular=False)
+
+ with pytest.raises(RuntimeError):
+ expr_utils.sort_objects2(test, id_getter, expr_getter)
diff --git a/grc/tests/test_generator.py b/grc/tests/test_generator.py
new file mode 100644
index 000000000..4c79ce4bd
--- /dev/null
+++ b/grc/tests/test_generator.py
@@ -0,0 +1,46 @@
+# Copyright 2016 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio 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.
+#
+# GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+from os import path
+import tempfile
+
+from grc.core.platform import Platform
+
+
+def test_generator():
+ # c&p form compiler code.
+ # todo: make this independent from installed GR
+ grc_file = path.join(path.dirname(__file__), 'resources', 'test_compiler.grc')
+ out_dir = tempfile.gettempdir()
+
+ platform = Platform(
+ name='GNU Radio Companion Compiler',
+ prefs=None,
+ version='0.0.0',
+ )
+ platform.build_library()
+
+ flow_graph = platform.make_flow_graph(grc_file)
+ flow_graph.rewrite()
+ flow_graph.validate()
+
+ assert flow_graph.is_valid()
+
+ generator = platform.Generator(flow_graph, path.join(path.dirname(__file__), 'resources'))
+ generator.write()
diff --git a/grc/core/Element.pyi b/grc/tests/test_xml_parser.py
index c81180a33..c68b6cdc5 100644
--- a/grc/core/Element.pyi
+++ b/grc/tests/test_xml_parser.py
@@ -1,4 +1,4 @@
-# Copyright 2008, 2009, 2015, 2016 Free Software Foundation, Inc.
+# Copyright 2017 Free Software Foundation, Inc.
# This file is part of GNU Radio
#
# GNU Radio Companion is free software; you can redistribute it and/or
@@ -15,40 +15,25 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-from . import Platform, FlowGraph, Block
+from os import path
+import sys
-def lazy_property(func):
- return func
+from grc.converter import flow_graph
-class Element(object):
+def test_flow_graph_converter():
+ filename = path.join(path.dirname(__file__), 'resources', 'test_compiler.grc')
- def __init__(self, parent=None):
- ...
+ data = flow_graph.from_xml(filename)
- @property
- def parent(self):
- ...
+ flow_graph.dump(data, sys.stdout)
- def get_parent_by_type(self, cls):
- parent = self.parent
- if parent is None:
- return None
- elif isinstance(parent, cls):
- return parent
- else:
- return parent.get_parent_by_type(cls)
- @lazy_property
- def parent_platform(self): -> Platform.Platform
- ...
+def test_flow_graph_converter_with_fp():
+ filename = path.join(path.dirname(__file__), 'resources', 'test_compiler.grc')
- @lazy_property
- def parent_flowgraph(self): -> FlowGraph.FlowGraph
- ...
-
- @lazy_property
- def parent_block(self): -> Block.Block
- ...
+ with open(filename) as fp:
+ data = flow_graph.from_xml(fp)
+ flow_graph.dump(data, sys.stdout)
diff --git a/grc/tests/test_yaml_checker.py b/grc/tests/test_yaml_checker.py
new file mode 100644
index 000000000..e6b466e51
--- /dev/null
+++ b/grc/tests/test_yaml_checker.py
@@ -0,0 +1,84 @@
+# Copyright 2016 Free Software Foundation, Inc.
+# This file is part of GNU Radio
+#
+# GNU Radio Companion 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 2 of the License, or (at your
+# option) any later version.
+#
+# GNU Radio Companion 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 program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+import yaml
+
+from grc.core.schema_checker import Validator, BLOCK_SCHEME
+
+
+BLOCK1 = """
+id: block_key
+label: testname
+
+parameters:
+- id: vlen
+ label: Vec Length
+ dtype: int
+ default: 1
+- id: out_type
+ label: Vec Length
+ dtype: string
+ default: complex
+- id: a
+ label: Alpha
+ dtype: ${ out_type }
+ default: '0'
+
+inputs:
+- label: in
+ domain: stream
+ dtype: complex
+ vlen: ${ 2 * vlen }
+- name: in2
+ domain: message
+ id: in2
+
+outputs:
+- label: out
+ domain: stream
+ dtype: ${ out_type }
+ vlen: ${ vlen }
+
+templates:
+ make: blocks.complex_to_mag_squared(${ vlen })
+
+file_format: 1
+"""
+
+
+def test_min():
+ checker = Validator(BLOCK_SCHEME)
+ assert checker.run({'id': 'test', 'file_format': 1}), checker.messages
+ assert not checker.run({'name': 'test', 'file_format': 1})
+
+
+def test_extra_keys():
+ checker = Validator(BLOCK_SCHEME)
+ assert checker.run({'id': 'test', 'abcdefg': 'nonsense', 'file_format': 1})
+ assert checker.messages == [('block', 'warn', "Ignoring extra key 'abcdefg'")]
+
+
+def test_checker():
+ checker = Validator(BLOCK_SCHEME)
+ data = yaml.load(BLOCK1)
+ passed = checker.run(data)
+ if not passed:
+ print()
+ for msg in checker.messages:
+ print(msg)
+
+ assert passed, checker.messages
diff --git a/volk b/volk
-Subproject d2a4c5ce0f1aaae5dbd7939eece3e6892ebb0e1
+Subproject 8dbffe93a07e184d54599f08ffbf48894bc35c0