diff options
Diffstat (limited to 'gr-trellis/python/trellis')
47 files changed, 1870 insertions, 19 deletions
diff --git a/gr-trellis/python/trellis/CMakeLists.txt b/gr-trellis/python/trellis/CMakeLists.txt index c766f13f37..b4da796630 100644 --- a/gr-trellis/python/trellis/CMakeLists.txt +++ b/gr-trellis/python/trellis/CMakeLists.txt @@ -26,13 +26,6 @@ if(ENABLE_TESTING) set(GR_TEST_LIBRARY_DIRS "") set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/gnuradio-runtime/python - ${CMAKE_BINARY_DIR}/gnuradio-runtime/swig - ${CMAKE_BINARY_DIR}/gr-filter/swig - ${CMAKE_BINARY_DIR}/gr-blocks/swig - ${CMAKE_BINARY_DIR}/gr-analog/swig - ${CMAKE_BINARY_DIR}/gr-fft/swig - ${CMAKE_BINARY_DIR}/gr-digital/swig - ${CMAKE_BINARY_DIR}/gr-trellis/swig ) include(GrTest) @@ -42,3 +35,5 @@ if(ENABLE_TESTING) GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) + +add_subdirectory(bindings) diff --git a/gr-trellis/python/trellis/__init__.py b/gr-trellis/python/trellis/__init__.py index e0e2214810..c77a88692c 100644 --- a/gr-trellis/python/trellis/__init__.py +++ b/gr-trellis/python/trellis/__init__.py @@ -15,10 +15,10 @@ from __future__ import unicode_literals import os try: - from .trellis_swig import * + from .trellis_python import * except ImportError: dirname, filename = os.path.split(os.path.abspath(__file__)) - __path__.append(os.path.join(dirname, "..", "..", "swig")) - from .trellis_swig import * + __path__.append(os.path.join(dirname, "bindings")) + from .trellis_python import * # import any pure python here diff --git a/gr-trellis/python/trellis/bindings/CMakeLists.txt b/gr-trellis/python/trellis/bindings/CMakeLists.txt new file mode 100644 index 0000000000..c605b4cd19 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/CMakeLists.txt @@ -0,0 +1,36 @@ +include(GrPybind) + +######################################################################## +# Python Bindings +######################################################################## + +list(APPEND trellis_python_files + # base_python.cc + # calc_metric_python.cc + constellation_metrics_cf_python.cc + # core_algorithms_python.cc + encoder_python.cc + fsm_python.cc + interleaver_python.cc + metrics_python.cc + pccc_decoder_blk_python.cc + pccc_decoder_combined_blk_python.cc + pccc_encoder_python.cc + permutation_python.cc + quicksort_index_python.cc + sccc_decoder_blk_python.cc + sccc_decoder_combined_blk_python.cc + sccc_encoder_python.cc + siso_combined_f_python.cc + siso_f_python.cc + siso_type_python.cc + viterbi_python.cc + viterbi_combined_python.cc + python_bindings.cc) + +GR_PYBIND_MAKE_CHECK_HASH(trellis + ../../.. + gr::trellis + "${trellis_python_files}") + +install(TARGETS trellis_python DESTINATION ${GR_PYTHON_DIR}/gnuradio/trellis COMPONENT pythonapi) diff --git a/gr-trellis/python/trellis/bindings/base_python.cc b/gr-trellis/python/trellis/bindings/base_python.cc new file mode 100644 index 0000000000..32204e32b1 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/base_python.cc @@ -0,0 +1,59 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(base.h) */ +/* BINDTOOL_HEADER_FILE_HASH(37fcf9b8740b0018f3cdd29abb0551de) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/base.h> +// pydoc.h is automatically generated in the build directory +#include <base_pydoc.h> + +void bind_base(py::module& m) +{ + + + m.def("dec2base", + &::gr::trellis::dec2base, + py::arg("num"), + py::arg("base"), + py::arg("s"), + D(dec2base)); + + + m.def("dec2bases", + &::gr::trellis::dec2bases, + py::arg("num"), + py::arg("bases"), + py::arg("s"), + D(dec2bases)); + + + m.def( + "base2dec", &::gr::trellis::base2dec, py::arg("s"), py::arg("base"), D(base2dec)); + + + m.def("bases2dec", + &::gr::trellis::bases2dec, + py::arg("s"), + py::arg("bases"), + D(bases2dec)); +} diff --git a/gr-trellis/python/trellis/bindings/calc_metric_python.cc b/gr-trellis/python/trellis/bindings/calc_metric_python.cc new file mode 100644 index 0000000000..6e86ac75f0 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/calc_metric_python.cc @@ -0,0 +1,43 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(calc_metric.h) */ +/* BINDTOOL_HEADER_FILE_HASH(5550968cecc3bb811d02f3a72e933877) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/calc_metric.h> +// pydoc.h is automatically generated in the build directory +#include <calc_metric_pydoc.h> + +void bind_calc_metric(py::module& m) +{ + + + m.def("calc_metric", + &::gr::trellis::calc_metric, + py::arg("O"), + py::arg("D"), + py::arg("TABLE"), + py::arg("input"), + py::arg("metric"), + py::arg("type"), + D(calc_metric)); +} diff --git a/gr-trellis/python/trellis/bindings/constellation_metrics_cf_python.cc b/gr-trellis/python/trellis/bindings/constellation_metrics_cf_python.cc new file mode 100644 index 0000000000..2f7b105a17 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/constellation_metrics_cf_python.cc @@ -0,0 +1,49 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(constellation_metrics_cf.h) */ +/* BINDTOOL_HEADER_FILE_HASH(d8c12ea63f1709f9a22696b10e739d94) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/constellation_metrics_cf.h> +// pydoc.h is automatically generated in the build directory +#include <constellation_metrics_cf_pydoc.h> + +void bind_constellation_metrics_cf(py::module& m) +{ + + using constellation_metrics_cf = ::gr::trellis::constellation_metrics_cf; + + + py::class_<constellation_metrics_cf, + gr::block, + gr::basic_block, + std::shared_ptr<constellation_metrics_cf>>( + m, "constellation_metrics_cf", D(constellation_metrics_cf)) + + .def(py::init(&constellation_metrics_cf::make), + py::arg("constellation"), + py::arg("TYPE"), + D(constellation_metrics_cf, make)) + + + ; +} diff --git a/gr-trellis/python/trellis/bindings/core_algorithms_python.cc b/gr-trellis/python/trellis/bindings/core_algorithms_python.cc new file mode 100644 index 0000000000..a167f3e2b4 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/core_algorithms_python.cc @@ -0,0 +1,59 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(core_algorithms.h) */ +/* BINDTOOL_HEADER_FILE_HASH(abbd5f62bc12799fc994388e855fe792) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/core_algorithms.h> +// pydoc.h is automatically generated in the build directory +#include <core_algorithms_pydoc.h> + +void bind_core_algorithms(py::module& m) +{ + + + m.def("min", &::gr::trellis::min, py::arg("a"), py::arg("b"), D(min)); + + + m.def("min_star", &::gr::trellis::min_star, py::arg("a"), py::arg("b"), D(min_star)); + + + m.def("siso_algorithm", + &::gr::trellis::siso_algorithm, + py::arg("I"), + py::arg("S"), + py::arg("O"), + py::arg("NS"), + py::arg("OS"), + py::arg("PS"), + py::arg("PI"), + py::arg("K"), + py::arg("S0"), + py::arg("SK"), + py::arg("POSTI"), + py::arg("POSTO"), + py::arg("p2mymin"), + py::arg("priori"), + py::arg("prioro"), + py::arg("post"), + D(siso_algorithm)); +} diff --git a/gr-trellis/python/trellis/bindings/docstrings/base_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/base_pydoc_template.h new file mode 100644 index 0000000000..1edb9c9609 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/base_pydoc_template.h @@ -0,0 +1,27 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_trellis_dec2base = R"doc()doc"; + + +static const char* __doc_gr_trellis_dec2bases = R"doc()doc"; + + +static const char* __doc_gr_trellis_base2dec = R"doc()doc"; + + +static const char* __doc_gr_trellis_bases2dec = R"doc()doc"; diff --git a/gr-trellis/python/trellis/bindings/docstrings/calc_metric_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/calc_metric_pydoc_template.h new file mode 100644 index 0000000000..168c170fc2 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/calc_metric_pydoc_template.h @@ -0,0 +1,18 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_trellis_calc_metric = R"doc()doc"; diff --git a/gr-trellis/python/trellis/bindings/docstrings/constellation_metrics_cf_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/constellation_metrics_cf_pydoc_template.h new file mode 100644 index 0000000000..8495820ef3 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/constellation_metrics_cf_pydoc_template.h @@ -0,0 +1,25 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_trellis_constellation_metrics_cf = R"doc()doc"; + + +static const char* __doc_gr_trellis_constellation_metrics_cf_constellation_metrics_cf = + R"doc()doc"; + + +static const char* __doc_gr_trellis_constellation_metrics_cf_make = R"doc()doc"; diff --git a/gr-trellis/python/trellis/bindings/docstrings/core_algorithms_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/core_algorithms_pydoc_template.h new file mode 100644 index 0000000000..b30b50aa06 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/core_algorithms_pydoc_template.h @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_trellis_min = R"doc()doc"; + + +static const char* __doc_gr_trellis_min_star = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_algorithm = R"doc()doc"; diff --git a/gr-trellis/python/trellis/bindings/docstrings/encoder_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/encoder_pydoc_template.h new file mode 100644 index 0000000000..a90711df10 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/encoder_pydoc_template.h @@ -0,0 +1,15 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ diff --git a/gr-trellis/python/trellis/bindings/docstrings/fsm_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/fsm_pydoc_template.h new file mode 100644 index 0000000000..dbabdf6b85 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/fsm_pydoc_template.h @@ -0,0 +1,81 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_trellis_fsm = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_fsm_0 = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_fsm_1 = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_fsm_2 = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_fsm_3 = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_fsm_4 = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_fsm_5 = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_fsm_6 = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_fsm_7 = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_fsm_8 = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_fsm_9 = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_I = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_S = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_O = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_NS = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_OS = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_PS = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_PI = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_TMi = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_TMl = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_write_trellis_svg = R"doc()doc"; + + +static const char* __doc_gr_trellis_fsm_write_fsm_txt = R"doc()doc"; diff --git a/gr-trellis/python/trellis/bindings/docstrings/interleaver_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/interleaver_pydoc_template.h new file mode 100644 index 0000000000..4c883ec439 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/interleaver_pydoc_template.h @@ -0,0 +1,45 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_trellis_interleaver = R"doc()doc"; + + +static const char* __doc_gr_trellis_interleaver_interleaver_0 = R"doc()doc"; + + +static const char* __doc_gr_trellis_interleaver_interleaver_1 = R"doc()doc"; + + +static const char* __doc_gr_trellis_interleaver_interleaver_2 = R"doc()doc"; + + +static const char* __doc_gr_trellis_interleaver_interleaver_3 = R"doc()doc"; + + +static const char* __doc_gr_trellis_interleaver_interleaver_4 = R"doc()doc"; + + +static const char* __doc_gr_trellis_interleaver_K = R"doc()doc"; + + +static const char* __doc_gr_trellis_interleaver_INTER = R"doc()doc"; + + +static const char* __doc_gr_trellis_interleaver_DEINTER = R"doc()doc"; + + +static const char* __doc_gr_trellis_interleaver_write_interleaver_txt = R"doc()doc"; diff --git a/gr-trellis/python/trellis/bindings/docstrings/metrics_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/metrics_pydoc_template.h new file mode 100644 index 0000000000..a90711df10 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/metrics_pydoc_template.h @@ -0,0 +1,15 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ diff --git a/gr-trellis/python/trellis/bindings/docstrings/pccc_decoder_blk_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/pccc_decoder_blk_pydoc_template.h new file mode 100644 index 0000000000..a90711df10 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/pccc_decoder_blk_pydoc_template.h @@ -0,0 +1,15 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ diff --git a/gr-trellis/python/trellis/bindings/docstrings/pccc_decoder_combined_blk_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/pccc_decoder_combined_blk_pydoc_template.h new file mode 100644 index 0000000000..a90711df10 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/pccc_decoder_combined_blk_pydoc_template.h @@ -0,0 +1,15 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ diff --git a/gr-trellis/python/trellis/bindings/docstrings/pccc_encoder_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/pccc_encoder_pydoc_template.h new file mode 100644 index 0000000000..a90711df10 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/pccc_encoder_pydoc_template.h @@ -0,0 +1,15 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ diff --git a/gr-trellis/python/trellis/bindings/docstrings/permutation_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/permutation_pydoc_template.h new file mode 100644 index 0000000000..545a608bc2 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/permutation_pydoc_template.h @@ -0,0 +1,48 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_trellis_permutation = R"doc()doc"; + + +static const char* __doc_gr_trellis_permutation_permutation_0 = R"doc()doc"; + + +static const char* __doc_gr_trellis_permutation_permutation_1 = R"doc()doc"; + + +static const char* __doc_gr_trellis_permutation_make = R"doc()doc"; + + +static const char* __doc_gr_trellis_permutation_K = R"doc()doc"; + + +static const char* __doc_gr_trellis_permutation_TABLE = R"doc()doc"; + + +static const char* __doc_gr_trellis_permutation_SYMS_PER_BLOCK = R"doc()doc"; + + +static const char* __doc_gr_trellis_permutation_BYTES_PER_SYMBOL = R"doc()doc"; + + +static const char* __doc_gr_trellis_permutation_set_K = R"doc()doc"; + + +static const char* __doc_gr_trellis_permutation_set_TABLE = R"doc()doc"; + + +static const char* __doc_gr_trellis_permutation_set_SYMS_PER_BLOCK = R"doc()doc"; diff --git a/gr-trellis/python/trellis/bindings/docstrings/quicksort_index_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/quicksort_index_pydoc_template.h new file mode 100644 index 0000000000..a90711df10 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/quicksort_index_pydoc_template.h @@ -0,0 +1,15 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ diff --git a/gr-trellis/python/trellis/bindings/docstrings/sccc_decoder_blk_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/sccc_decoder_blk_pydoc_template.h new file mode 100644 index 0000000000..a90711df10 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/sccc_decoder_blk_pydoc_template.h @@ -0,0 +1,15 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ diff --git a/gr-trellis/python/trellis/bindings/docstrings/sccc_decoder_combined_blk_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/sccc_decoder_combined_blk_pydoc_template.h new file mode 100644 index 0000000000..a90711df10 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/sccc_decoder_combined_blk_pydoc_template.h @@ -0,0 +1,15 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ diff --git a/gr-trellis/python/trellis/bindings/docstrings/sccc_encoder_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/sccc_encoder_pydoc_template.h new file mode 100644 index 0000000000..a90711df10 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/sccc_encoder_pydoc_template.h @@ -0,0 +1,15 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ diff --git a/gr-trellis/python/trellis/bindings/docstrings/siso_combined_f_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/siso_combined_f_pydoc_template.h new file mode 100644 index 0000000000..f6ecd93b19 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/siso_combined_f_pydoc_template.h @@ -0,0 +1,87 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_trellis_siso_combined_f = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_siso_combined_f_0 = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_siso_combined_f_1 = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_make = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_FSM = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_K = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_S0 = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_SK = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_POSTI = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_POSTO = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_SISO_TYPE = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_D = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_TABLE = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_TYPE = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_set_FSM = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_set_K = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_set_S0 = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_set_SK = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_set_POSTI = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_set_POSTO = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_set_SISO_TYPE = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_set_D = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_set_TABLE = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_combined_f_set_TYPE = R"doc()doc"; diff --git a/gr-trellis/python/trellis/bindings/docstrings/siso_f_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/siso_f_pydoc_template.h new file mode 100644 index 0000000000..a585568317 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/siso_f_pydoc_template.h @@ -0,0 +1,69 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ + + +static const char* __doc_gr_trellis_siso_f = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_f_siso_f_0 = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_f_siso_f_1 = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_f_make = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_f_FSM = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_f_K = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_f_S0 = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_f_SK = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_f_POSTI = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_f_POSTO = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_f_SISO_TYPE = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_f_set_FSM = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_f_set_K = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_f_set_S0 = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_f_set_SK = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_f_set_POSTI = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_f_set_POSTO = R"doc()doc"; + + +static const char* __doc_gr_trellis_siso_f_set_SISO_TYPE = R"doc()doc"; diff --git a/gr-trellis/python/trellis/bindings/docstrings/siso_type_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/siso_type_pydoc_template.h new file mode 100644 index 0000000000..a90711df10 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/siso_type_pydoc_template.h @@ -0,0 +1,15 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ diff --git a/gr-trellis/python/trellis/bindings/docstrings/viterbi_combined_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/viterbi_combined_pydoc_template.h new file mode 100644 index 0000000000..a90711df10 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/viterbi_combined_pydoc_template.h @@ -0,0 +1,15 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ diff --git a/gr-trellis/python/trellis/bindings/docstrings/viterbi_pydoc_template.h b/gr-trellis/python/trellis/bindings/docstrings/viterbi_pydoc_template.h new file mode 100644 index 0000000000..a90711df10 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/docstrings/viterbi_pydoc_template.h @@ -0,0 +1,15 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ +#include "pydoc_macros.h" +#define D(...) DOC(gr, trellis, __VA_ARGS__) +/* + This file contains placeholders for docstrings for the Python bindings. + Do not edit! These were automatically extracted during the binding process + and will be overwritten during the build process + */ diff --git a/gr-trellis/python/trellis/bindings/encoder_python.cc b/gr-trellis/python/trellis/bindings/encoder_python.cc new file mode 100644 index 0000000000..2a470be228 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/encoder_python.cc @@ -0,0 +1,60 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(encoder.h) */ +/* BINDTOOL_HEADER_FILE_HASH(50192d0209b88c4fc915b31237c0932e) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/encoder.h> +// pydoc.h is automatically generated in the build directory +#include <encoder_pydoc.h> + +template <class IN_T, class OUT_T> +void bind_encoder_template(py::module& m, const char* classname) +{ + using encoder = gr::trellis::encoder<IN_T, OUT_T>; + + py::class_<encoder, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<encoder>>(m, classname) + .def(py::init(&gr::trellis::encoder<IN_T, OUT_T>::make), + py::arg("FSM"), + py::arg("ST"), + py::arg("K") = 0) + .def("FSM", &gr::trellis::encoder<IN_T, OUT_T>::FSM) + .def("ST", &gr::trellis::encoder<IN_T, OUT_T>::ST) + .def("K", &gr::trellis::encoder<IN_T, OUT_T>::K) + .def("set_FSM", &gr::trellis::encoder<IN_T, OUT_T>::set_FSM) + .def("set_ST", &gr::trellis::encoder<IN_T, OUT_T>::set_ST) + .def("set_K", &gr::trellis::encoder<IN_T, OUT_T>::set_K); +} + +void bind_encoder(py::module& m) +{ + bind_encoder_template<std::uint8_t, std::uint8_t>(m, "encoder_bb"); + bind_encoder_template<std::uint8_t, std::int16_t>(m, "encoder_bs"); + bind_encoder_template<std::uint8_t, std::int32_t>(m, "encoder_bi"); + bind_encoder_template<std::int16_t, std::int16_t>(m, "encoder_ss"); + bind_encoder_template<std::int16_t, std::int32_t>(m, "encoder_si"); + bind_encoder_template<std::int32_t, std::int32_t>(m, "encoder_ii"); +} diff --git a/gr-trellis/python/trellis/bindings/fsm_python.cc b/gr-trellis/python/trellis/bindings/fsm_python.cc new file mode 100644 index 0000000000..d8441b08bb --- /dev/null +++ b/gr-trellis/python/trellis/bindings/fsm_python.cc @@ -0,0 +1,121 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(fsm.h) */ +/* BINDTOOL_HEADER_FILE_HASH(55ea410fe82d117d20ec1c63ac3df824) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/fsm.h> +// pydoc.h is automatically generated in the build directory +#include <fsm_pydoc.h> + +void bind_fsm(py::module& m) +{ + + using fsm = ::gr::trellis::fsm; + + + py::class_<fsm, std::shared_ptr<fsm>>(m, "fsm", D(fsm)) + + .def(py::init<>(), D(fsm, fsm, 0)) + .def(py::init<gr::trellis::fsm const&>(), py::arg("FSM"), D(fsm, fsm, 1)) + .def(py::init<int, + int, + int, + std::vector<int, std::allocator<int>> const&, + std::vector<int, std::allocator<int>> const&>(), + py::arg("I"), + py::arg("S"), + py::arg("O"), + py::arg("NS"), + py::arg("OS"), + D(fsm, fsm, 2)) + .def(py::init<char const*>(), py::arg("name"), D(fsm, fsm, 3)) + .def(py::init<int, int, std::vector<int, std::allocator<int>> const&>(), + py::arg("k"), + py::arg("n"), + py::arg("G"), + D(fsm, fsm, 4)) + .def(py::init<int, int>(), + py::arg("mod_size"), + py::arg("ch_length"), + D(fsm, fsm, 5)) + .def(py::init<int, int, int>(), + py::arg("P"), + py::arg("M"), + py::arg("L"), + D(fsm, fsm, 6)) + .def(py::init<gr::trellis::fsm const&, gr::trellis::fsm const&>(), + py::arg("FSM1"), + py::arg("FSM2"), + D(fsm, fsm, 7)) + .def(py::init<gr::trellis::fsm const&, gr::trellis::fsm const&, bool>(), + py::arg("FSMo"), + py::arg("FSMi"), + py::arg("serial"), + D(fsm, fsm, 8)) + .def(py::init<gr::trellis::fsm const&, int>(), + py::arg("FSM"), + py::arg("n"), + D(fsm, fsm, 9)) + + + .def("I", &fsm::I, D(fsm, I)) + + + .def("S", &fsm::S, D(fsm, S)) + + + .def("O", &fsm::O, D(fsm, O)) + + + .def("NS", &fsm::NS, D(fsm, NS)) + + + .def("OS", &fsm::OS, D(fsm, OS)) + + + .def("PS", &fsm::PS, D(fsm, PS)) + + + .def("PI", &fsm::PI, D(fsm, PI)) + + + .def("TMi", &fsm::TMi, D(fsm, TMi)) + + + .def("TMl", &fsm::TMl, D(fsm, TMl)) + + + .def("write_trellis_svg", + &fsm::write_trellis_svg, + py::arg("filename"), + py::arg("number_stages"), + D(fsm, write_trellis_svg)) + + + .def("write_fsm_txt", + &fsm::write_fsm_txt, + py::arg("filename"), + D(fsm, write_fsm_txt)) + + ; +} diff --git a/gr-trellis/python/trellis/bindings/interleaver_python.cc b/gr-trellis/python/trellis/bindings/interleaver_python.cc new file mode 100644 index 0000000000..7ea6612f92 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/interleaver_python.cc @@ -0,0 +1,69 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(interleaver.h) */ +/* BINDTOOL_HEADER_FILE_HASH(09c02f75f85fb3281baace56cc2414cc) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/interleaver.h> +// pydoc.h is automatically generated in the build directory +#include <interleaver_pydoc.h> + +void bind_interleaver(py::module& m) +{ + + using interleaver = ::gr::trellis::interleaver; + + + py::class_<interleaver, std::shared_ptr<interleaver>>( + m, "interleaver", D(interleaver)) + + .def(py::init<>(), D(interleaver, interleaver, 0)) + .def(py::init<gr::trellis::interleaver const&>(), + py::arg("INTERLEAVER"), + D(interleaver, interleaver, 1)) + .def(py::init<unsigned int, std::vector<int, std::allocator<int>> const&>(), + py::arg("K"), + py::arg("INTER"), + D(interleaver, interleaver, 2)) + .def(py::init<char const*>(), py::arg("name"), D(interleaver, interleaver, 3)) + .def(py::init<unsigned int, int>(), + py::arg("K"), + py::arg("seed"), + D(interleaver, interleaver, 4)) + + + .def("K", &interleaver::K, D(interleaver, K)) + + + .def("INTER", &interleaver::INTER, D(interleaver, INTER)) + + + .def("DEINTER", &interleaver::DEINTER, D(interleaver, DEINTER)) + + + .def("write_interleaver_txt", + &interleaver::write_interleaver_txt, + py::arg("filename"), + D(interleaver, write_interleaver_txt)) + + ; +} diff --git a/gr-trellis/python/trellis/bindings/metrics_python.cc b/gr-trellis/python/trellis/bindings/metrics_python.cc new file mode 100644 index 0000000000..c37c9981c6 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/metrics_python.cc @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(metrics.h) */ +/* BINDTOOL_HEADER_FILE_HASH(07780ea3f13158c1311b8998e25c26d4) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/metrics.h> +// pydoc.h is automatically generated in the build directory +#include <metrics_pydoc.h> + +void bind_metrics(py::module& m) {} diff --git a/gr-trellis/python/trellis/bindings/pccc_decoder_blk_python.cc b/gr-trellis/python/trellis/bindings/pccc_decoder_blk_python.cc new file mode 100644 index 0000000000..aa0a42a66f --- /dev/null +++ b/gr-trellis/python/trellis/bindings/pccc_decoder_blk_python.cc @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(pccc_decoder_blk.h) */ +/* BINDTOOL_HEADER_FILE_HASH(86a24cc3e28a9eba4b5cf7ba96c56a63) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/pccc_decoder_blk.h> +// pydoc.h is automatically generated in the build directory +#include <pccc_decoder_blk_pydoc.h> + +void bind_pccc_decoder_blk(py::module& m) {} diff --git a/gr-trellis/python/trellis/bindings/pccc_decoder_combined_blk_python.cc b/gr-trellis/python/trellis/bindings/pccc_decoder_combined_blk_python.cc new file mode 100644 index 0000000000..6a669cb2ff --- /dev/null +++ b/gr-trellis/python/trellis/bindings/pccc_decoder_combined_blk_python.cc @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(pccc_decoder_combined_blk.h) */ +/* BINDTOOL_HEADER_FILE_HASH(ee939cb6c38f26044996af9e6657a80a) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/pccc_decoder_combined_blk.h> +// pydoc.h is automatically generated in the build directory +#include <pccc_decoder_combined_blk_pydoc.h> + +void bind_pccc_decoder_combined_blk(py::module& m) {} diff --git a/gr-trellis/python/trellis/bindings/pccc_encoder_python.cc b/gr-trellis/python/trellis/bindings/pccc_encoder_python.cc new file mode 100644 index 0000000000..bd681948ab --- /dev/null +++ b/gr-trellis/python/trellis/bindings/pccc_encoder_python.cc @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(pccc_encoder.h) */ +/* BINDTOOL_HEADER_FILE_HASH(d0c48f4bedaa0e46f06f9607fb84d36e) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/pccc_encoder.h> +// pydoc.h is automatically generated in the build directory +#include <pccc_encoder_pydoc.h> + +void bind_pccc_encoder(py::module& m) {} diff --git a/gr-trellis/python/trellis/bindings/permutation_python.cc b/gr-trellis/python/trellis/bindings/permutation_python.cc new file mode 100644 index 0000000000..d259a6f701 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/permutation_python.cc @@ -0,0 +1,81 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(permutation.h) */ +/* BINDTOOL_HEADER_FILE_HASH(8bb112727e312d310a6a6b08ec0fbd78) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/permutation.h> +// pydoc.h is automatically generated in the build directory +#include <permutation_pydoc.h> + +void bind_permutation(py::module& m) +{ + + using permutation = ::gr::trellis::permutation; + + + py::class_<permutation, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<permutation>>(m, "permutation", D(permutation)) + + .def(py::init(&permutation::make), + py::arg("K"), + py::arg("TABLE"), + py::arg("SYMS_PER_BLOCK"), + py::arg("NBYTES"), + D(permutation, make)) + + + .def("K", &permutation::K, D(permutation, K)) + + + .def("TABLE", &permutation::TABLE, D(permutation, TABLE)) + + + .def("SYMS_PER_BLOCK", + &permutation::SYMS_PER_BLOCK, + D(permutation, SYMS_PER_BLOCK)) + + + .def("BYTES_PER_SYMBOL", + &permutation::BYTES_PER_SYMBOL, + D(permutation, BYTES_PER_SYMBOL)) + + + .def("set_K", &permutation::set_K, py::arg("K"), D(permutation, set_K)) + + + .def("set_TABLE", + &permutation::set_TABLE, + py::arg("table"), + D(permutation, set_TABLE)) + + + .def("set_SYMS_PER_BLOCK", + &permutation::set_SYMS_PER_BLOCK, + py::arg("spb"), + D(permutation, set_SYMS_PER_BLOCK)) + + ; +} diff --git a/gr-trellis/python/trellis/bindings/python_bindings.cc b/gr-trellis/python/trellis/bindings/python_bindings.cc new file mode 100644 index 0000000000..16c19951c8 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/python_bindings.cc @@ -0,0 +1,80 @@ + +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +#include <pybind11/pybind11.h> + +#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION +#include <numpy/arrayobject.h> + +namespace py = pybind11; + +// void bind_base(py::module&); +// void bind_calc_metric(py::module&); +void bind_constellation_metrics_cf(py::module&); +// void bind_core_algorithms(py::module&); +void bind_encoder(py::module&); +void bind_fsm(py::module&); +void bind_interleaver(py::module&); +void bind_metrics(py::module&); +void bind_pccc_decoder_blk(py::module&); +void bind_pccc_decoder_combined_blk(py::module&); +void bind_pccc_encoder(py::module&); +void bind_permutation(py::module&); +void bind_quicksort_index(py::module&); +void bind_sccc_decoder_blk(py::module&); +void bind_sccc_decoder_combined_blk(py::module&); +void bind_sccc_encoder(py::module&); +void bind_siso_combined_f(py::module&); +void bind_siso_f(py::module&); +void bind_siso_type(py::module&); +void bind_viterbi(py::module&); +void bind_viterbi_combined(py::module&); + +// We need this hack because import_array() returns NULL +// for newer Python versions. +// This function is also necessary because it ensures access to the C API +// and removes a warning. +void* init_numpy() +{ + import_array(); + return NULL; +} + +PYBIND11_MODULE(trellis_python, m) +{ + // Initialize the numpy C API + // (otherwise we will see segmentation faults) + init_numpy(); + + // Allow access to base block methods + py::module::import("gnuradio.gr"); + + // bind_base(m); + // bind_calc_metric(m); + bind_constellation_metrics_cf(m); + // bind_core_algorithms(m); + bind_encoder(m); + bind_fsm(m); + bind_interleaver(m); + bind_metrics(m); + bind_pccc_decoder_blk(m); + bind_pccc_decoder_combined_blk(m); + bind_pccc_encoder(m); + bind_permutation(m); + bind_quicksort_index(m); + bind_sccc_decoder_blk(m); + bind_sccc_decoder_combined_blk(m); + bind_sccc_encoder(m); + bind_siso_combined_f(m); + bind_siso_f(m); + bind_siso_type(m); + bind_viterbi(m); + bind_viterbi_combined(m); +} diff --git a/gr-trellis/python/trellis/bindings/quicksort_index_python.cc b/gr-trellis/python/trellis/bindings/quicksort_index_python.cc new file mode 100644 index 0000000000..3e645cca08 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/quicksort_index_python.cc @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(quicksort_index.h) */ +/* BINDTOOL_HEADER_FILE_HASH(d209b2802d57d915fd1c141495dce9a1) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/quicksort_index.h> +// pydoc.h is automatically generated in the build directory +#include <quicksort_index_pydoc.h> + +void bind_quicksort_index(py::module& m) {} diff --git a/gr-trellis/python/trellis/bindings/sccc_decoder_blk_python.cc b/gr-trellis/python/trellis/bindings/sccc_decoder_blk_python.cc new file mode 100644 index 0000000000..b9c42aa53c --- /dev/null +++ b/gr-trellis/python/trellis/bindings/sccc_decoder_blk_python.cc @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(sccc_decoder_blk.h) */ +/* BINDTOOL_HEADER_FILE_HASH(f419e16a4ec7e5edffaab1b98edaeaa8) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/sccc_decoder_blk.h> +// pydoc.h is automatically generated in the build directory +#include <sccc_decoder_blk_pydoc.h> + +void bind_sccc_decoder_blk(py::module& m) {} diff --git a/gr-trellis/python/trellis/bindings/sccc_decoder_combined_blk_python.cc b/gr-trellis/python/trellis/bindings/sccc_decoder_combined_blk_python.cc new file mode 100644 index 0000000000..836bc97337 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/sccc_decoder_combined_blk_python.cc @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(sccc_decoder_combined_blk.h) */ +/* BINDTOOL_HEADER_FILE_HASH(14dd8487d8cc55c93644aacf4ce2d0d2) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/sccc_decoder_combined_blk.h> +// pydoc.h is automatically generated in the build directory +#include <sccc_decoder_combined_blk_pydoc.h> + +void bind_sccc_decoder_combined_blk(py::module& m) {} diff --git a/gr-trellis/python/trellis/bindings/sccc_encoder_python.cc b/gr-trellis/python/trellis/bindings/sccc_encoder_python.cc new file mode 100644 index 0000000000..4db667522f --- /dev/null +++ b/gr-trellis/python/trellis/bindings/sccc_encoder_python.cc @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(sccc_encoder.h) */ +/* BINDTOOL_HEADER_FILE_HASH(1f6cf0ef063243ab9b0187805a6f9cde) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/sccc_encoder.h> +// pydoc.h is automatically generated in the build directory +#include <sccc_encoder_pydoc.h> + +void bind_sccc_encoder(py::module& m) {} diff --git a/gr-trellis/python/trellis/bindings/siso_combined_f_python.cc b/gr-trellis/python/trellis/bindings/siso_combined_f_python.cc new file mode 100644 index 0000000000..22df3307ff --- /dev/null +++ b/gr-trellis/python/trellis/bindings/siso_combined_f_python.cc @@ -0,0 +1,135 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(siso_combined_f.h) */ +/* BINDTOOL_HEADER_FILE_HASH(7c23b336019cbf7f771376d7d6677088) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/siso_combined_f.h> +// pydoc.h is automatically generated in the build directory +#include <siso_combined_f_pydoc.h> + +void bind_siso_combined_f(py::module& m) +{ + + using siso_combined_f = ::gr::trellis::siso_combined_f; + + + py::class_<siso_combined_f, + gr::block, + gr::basic_block, + std::shared_ptr<siso_combined_f>>(m, "siso_combined_f", D(siso_combined_f)) + + .def(py::init(&siso_combined_f::make), + py::arg("FSM"), + py::arg("K"), + py::arg("S0"), + py::arg("SK"), + py::arg("POSTI"), + py::arg("POSTO"), + py::arg("d_SISO_TYPE"), + py::arg("D"), + py::arg("TABLE"), + py::arg("TYPE"), + D(siso_combined_f, make)) + + + .def("FSM", &siso_combined_f::FSM, D(siso_combined_f, FSM)) + + + .def("K", &siso_combined_f::K, D(siso_combined_f, K)) + + + .def("S0", &siso_combined_f::S0, D(siso_combined_f, S0)) + + + .def("SK", &siso_combined_f::SK, D(siso_combined_f, SK)) + + + .def("POSTI", &siso_combined_f::POSTI, D(siso_combined_f, POSTI)) + + + .def("POSTO", &siso_combined_f::POSTO, D(siso_combined_f, POSTO)) + + + .def("SISO_TYPE", &siso_combined_f::SISO_TYPE, D(siso_combined_f, SISO_TYPE)) + + + .def("D", &siso_combined_f::D, D(siso_combined_f, D)) + + + .def("TABLE", &siso_combined_f::TABLE, D(siso_combined_f, TABLE)) + + + .def("TYPE", &siso_combined_f::TYPE, D(siso_combined_f, TYPE)) + + + .def("set_FSM", + &siso_combined_f::set_FSM, + py::arg("FSM"), + D(siso_combined_f, set_FSM)) + + + .def("set_K", &siso_combined_f::set_K, py::arg("K"), D(siso_combined_f, set_K)) + + + .def( + "set_S0", &siso_combined_f::set_S0, py::arg("S0"), D(siso_combined_f, set_S0)) + + + .def( + "set_SK", &siso_combined_f::set_SK, py::arg("SK"), D(siso_combined_f, set_SK)) + + + .def("set_POSTI", + &siso_combined_f::set_POSTI, + py::arg("POSTI"), + D(siso_combined_f, set_POSTI)) + + + .def("set_POSTO", + &siso_combined_f::set_POSTO, + py::arg("POSTO"), + D(siso_combined_f, set_POSTO)) + + + .def("set_SISO_TYPE", + &siso_combined_f::set_SISO_TYPE, + py::arg("type"), + D(siso_combined_f, set_SISO_TYPE)) + + + .def("set_D", &siso_combined_f::set_D, py::arg("D"), D(siso_combined_f, set_D)) + + + .def("set_TABLE", + &siso_combined_f::set_TABLE, + py::arg("table"), + D(siso_combined_f, set_TABLE)) + + + .def("set_TYPE", + &siso_combined_f::set_TYPE, + py::arg("type"), + D(siso_combined_f, set_TYPE)) + + ; +} diff --git a/gr-trellis/python/trellis/bindings/siso_f_python.cc b/gr-trellis/python/trellis/bindings/siso_f_python.cc new file mode 100644 index 0000000000..b6b14df996 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/siso_f_python.cc @@ -0,0 +1,95 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(siso_f.h) */ +/* BINDTOOL_HEADER_FILE_HASH(a6f43448cf34073f406aa5fc81522fab) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/siso_f.h> +// pydoc.h is automatically generated in the build directory +#include <siso_f_pydoc.h> + +void bind_siso_f(py::module& m) +{ + + using siso_f = ::gr::trellis::siso_f; + + + py::class_<siso_f, gr::block, gr::basic_block, std::shared_ptr<siso_f>>( + m, "siso_f", D(siso_f)) + + .def(py::init(&siso_f::make), + py::arg("FSM"), + py::arg("K"), + py::arg("S0"), + py::arg("SK"), + py::arg("POSTI"), + py::arg("POSTO"), + py::arg("d_SISO_TYPE"), + D(siso_f, make)) + + + .def("FSM", &siso_f::FSM, D(siso_f, FSM)) + + + .def("K", &siso_f::K, D(siso_f, K)) + + + .def("S0", &siso_f::S0, D(siso_f, S0)) + + + .def("SK", &siso_f::SK, D(siso_f, SK)) + + + .def("POSTI", &siso_f::POSTI, D(siso_f, POSTI)) + + + .def("POSTO", &siso_f::POSTO, D(siso_f, POSTO)) + + + .def("SISO_TYPE", &siso_f::SISO_TYPE, D(siso_f, SISO_TYPE)) + + + .def("set_FSM", &siso_f::set_FSM, py::arg("FSM"), D(siso_f, set_FSM)) + + + .def("set_K", &siso_f::set_K, py::arg("K"), D(siso_f, set_K)) + + + .def("set_S0", &siso_f::set_S0, py::arg("S0"), D(siso_f, set_S0)) + + + .def("set_SK", &siso_f::set_SK, py::arg("SK"), D(siso_f, set_SK)) + + + .def("set_POSTI", &siso_f::set_POSTI, py::arg("posti"), D(siso_f, set_POSTI)) + + + .def("set_POSTO", &siso_f::set_POSTO, py::arg("posto"), D(siso_f, set_POSTO)) + + + .def("set_SISO_TYPE", + &siso_f::set_SISO_TYPE, + py::arg("type"), + D(siso_f, set_SISO_TYPE)) + + ; +} diff --git a/gr-trellis/python/trellis/bindings/siso_type_python.cc b/gr-trellis/python/trellis/bindings/siso_type_python.cc new file mode 100644 index 0000000000..a4003efe9c --- /dev/null +++ b/gr-trellis/python/trellis/bindings/siso_type_python.cc @@ -0,0 +1,38 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(siso_type.h) */ +/* BINDTOOL_HEADER_FILE_HASH(9855f50a23fc6624c9ab52828baec66a) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/siso_type.h> +// pydoc.h is automatically generated in the build directory +#include <siso_type_pydoc.h> + +void bind_siso_type(py::module& m) +{ + + + py::enum_<::gr::trellis::siso_type_t>(m, "siso_type_t") + .value("TRELLIS_MIN_SUM", ::gr::trellis::TRELLIS_MIN_SUM) // 200 + .value("TRELLIS_SUM_PRODUCT", ::gr::trellis::TRELLIS_SUM_PRODUCT) // 201 + .export_values(); +} diff --git a/gr-trellis/python/trellis/bindings/viterbi_combined_python.cc b/gr-trellis/python/trellis/bindings/viterbi_combined_python.cc new file mode 100644 index 0000000000..589fabbb59 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/viterbi_combined_python.cc @@ -0,0 +1,30 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(viterbi_combined.h) */ +/* BINDTOOL_HEADER_FILE_HASH(42e9e8a3daa4ef03ff9d7110e4c37a62) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/viterbi_combined.h> +// pydoc.h is automatically generated in the build directory +#include <viterbi_combined_pydoc.h> + +void bind_viterbi_combined(py::module& m) {} diff --git a/gr-trellis/python/trellis/bindings/viterbi_python.cc b/gr-trellis/python/trellis/bindings/viterbi_python.cc new file mode 100644 index 0000000000..431a1fa692 --- /dev/null +++ b/gr-trellis/python/trellis/bindings/viterbi_python.cc @@ -0,0 +1,57 @@ +/* + * Copyright 2020 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +/***********************************************************************************/ +/* This file is automatically generated using bindtool and can be manually edited */ +/* The following lines can be configured to regenerate this file during cmake */ +/* If manual edits are made, the following tags should be modified accordingly. */ +/* BINDTOOL_GEN_AUTOMATIC(0) */ +/* BINDTOOL_USE_PYGCCXML(0) */ +/* BINDTOOL_HEADER_FILE(viterbi.h) */ +/* BINDTOOL_HEADER_FILE_HASH(3dddfa88ff00d9ca651bb0b942244465) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/trellis/viterbi.h> +// pydoc.h is automatically generated in the build directory +#include <viterbi_pydoc.h> + +template <typename T> +void bind_viterbi_template(py::module& m, const char* classname) +{ + using viterbi = gr::trellis::viterbi<T>; + + py::class_<viterbi, gr::block, gr::basic_block, std::shared_ptr<viterbi>>(m, + classname) + .def(py::init(&gr::trellis::viterbi<T>::make), + py::arg("FSM"), + py::arg("K"), + py::arg("S0"), + py::arg("SK")) + .def("FSM", &viterbi::FSM) + .def("K", &viterbi::K) + .def("S0", &viterbi::S0) + .def("SK", &viterbi::SK) + .def("set_FSM", &viterbi::set_FSM) + .def("set_K", &viterbi::set_K) + .def("set_S0", &viterbi::set_S0) + .def("set_SK", &viterbi::set_SK); +} + +void bind_viterbi(py::module& m) +{ + bind_viterbi_template<std::uint8_t>(m, "viterbi_b"); + bind_viterbi_template<std::int16_t>(m, "viterbi_s"); + bind_viterbi_template<std::int32_t>(m, "viterbi_i"); +} diff --git a/gr-trellis/python/trellis/qa_trellis.py b/gr-trellis/python/trellis/qa_trellis.py index 5ece27994a..a4e736e7b0 100644 --- a/gr-trellis/python/trellis/qa_trellis.py +++ b/gr-trellis/python/trellis/qa_trellis.py @@ -15,12 +15,12 @@ import os from gnuradio import gr, gr_unittest, trellis, digital, analog, blocks -fsm_args = {"awgn1o2_4": (2, 4, 4, - (0, 2, 0, 2, 1, 3, 1, 3), - (0, 3, 3, 0, 1, 2, 2, 1), - ), - "rep2": (2, 1, 4, (0, 0), (0, 3)), - "nothing": (2, 1, 2, (0, 0), (0, 1)), +fsm_args = {"awgn1o2_4": [2, 4, 4, + [0, 2, 0, 2, 1, 3, 1, 3], + [0, 3, 3, 0, 1, 2, 2, 1], + ], + "rep2": [2, 1, 4, [0, 0], [0, 3]], + "nothing": [2, 1, 2, [0, 0], [0, 1]], } constells = {2: digital.constellation_bpsk(), @@ -31,7 +31,7 @@ class test_trellis (gr_unittest.TestCase): def test_001_fsm (self): f = trellis.fsm(*fsm_args["awgn1o2_4"]) - self.assertEqual(fsm_args["awgn1o2_4"],(f.I(),f.S(),f.O(),f.NS(),f.OS())) + self.assertEqual(fsm_args["awgn1o2_4"],[f.I(),f.S(),f.O(),f.NS(),f.OS()]) def test_002_fsm (self): f = trellis.fsm(*fsm_args["awgn1o2_4"]) @@ -51,8 +51,8 @@ class test_trellis (gr_unittest.TestCase): def test_001_interleaver (self): K = 5 - IN = (1,2,3,4,0) - DIN = (4,0,1,2,3) + IN = [1,2,3,4,0] + DIN = [4,0,1,2,3] i = trellis.interleaver(K,IN) self.assertEqual((K,IN,DIN),(i.K(),i.INTER(),i.DEINTER())) |