diff options
author | Josh Morman <mormjb@gmail.com> | 2020-04-23 08:07:28 -0400 |
---|---|---|
committer | Josh Morman <mormjb@gmail.com> | 2020-06-04 10:05:47 -0400 |
commit | ef1594876dea5da9c4920d59d38aa2583307bc2d (patch) | |
tree | f6e734bddf3aa71addfca439510665c3db06388f | |
parent | 8714e249cdfeb1da4405c35ecc8ab718e4e7dcc6 (diff) |
channels: add pybind11 bindings
20 files changed, 1132 insertions, 9 deletions
diff --git a/gr-channels/python/channels/CMakeLists.txt b/gr-channels/python/channels/CMakeLists.txt index 44131c36c3..d05901b944 100644 --- a/gr-channels/python/channels/CMakeLists.txt +++ b/gr-channels/python/channels/CMakeLists.txt @@ -32,12 +32,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-blocks/swig - ${CMAKE_BINARY_DIR}/gr-fft/swig - ${CMAKE_BINARY_DIR}/gr-filter/swig - ${CMAKE_BINARY_DIR}/gr-analog/swig - ${CMAKE_BINARY_DIR}/gr-channels/swig ) include(GrTest) @@ -47,3 +41,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-channels/python/channels/__init__.py b/gr-channels/python/channels/__init__.py index 0b0bcbe21b..daeba0e3e2 100644 --- a/gr-channels/python/channels/__init__.py +++ b/gr-channels/python/channels/__init__.py @@ -16,11 +16,11 @@ from __future__ import unicode_literals import os try: - from .channels_swig import channels_swig + from .channels_python import channels_python except ImportError: dirname, filename = os.path.split(os.path.abspath(__file__)) - __path__.append(os.path.join(dirname, "..", "..", "swig")) - from .channels_swig import * + __path__.append(os.path.join(dirname, "bindings")) + from .channels_python import * # Blocks for Hardware Impairments from .amp_bal import amp_bal diff --git a/gr-channels/python/channels/bindings/CMakeLists.txt b/gr-channels/python/channels/bindings/CMakeLists.txt new file mode 100644 index 0000000000..c4d6840026 --- /dev/null +++ b/gr-channels/python/channels/bindings/CMakeLists.txt @@ -0,0 +1,23 @@ +include(GrPybind) + +######################################################################## +# Python Bindings +######################################################################## + +list(APPEND channels_python_files + cfo_model_python.cc + channel_model_python.cc + channel_model2_python.cc + dynamic_channel_model_python.cc + fading_model_python.cc + selective_fading_model_python.cc + selective_fading_model2_python.cc + sro_model_python.cc + python_bindings.cc) + +GR_PYBIND_MAKE(channels + ../../.. + gr::channels + "${channels_python_files}") + +install(TARGETS channels_python DESTINATION ${GR_PYTHON_DIR}/gnuradio/channels COMPONENT pythonapi) diff --git a/gr-channels/python/channels/bindings/cfo_model_python.cc b/gr-channels/python/channels/bindings/cfo_model_python.cc new file mode 100644 index 0000000000..3da6b12ec4 --- /dev/null +++ b/gr-channels/python/channels/bindings/cfo_model_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 */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/channels/cfo_model.h> +// pydoc.h is automatically generated in the build directory +#include <cfo_model_pydoc.h> + +void bind_cfo_model(py::module& m) +{ + + using cfo_model = ::gr::channels::cfo_model; + + + py::class_<cfo_model, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<cfo_model>>(m, "cfo_model", D(cfo_model)) + + .def(py::init(&cfo_model::make), + py::arg("sample_rate_hz"), + py::arg("std_dev_hz"), + py::arg("max_dev_hz"), + py::arg("noise_seed") = 0, + D(cfo_model, make)) + + + .def("set_std_dev", + &cfo_model::set_std_dev, + py::arg("_dev"), + D(cfo_model, set_std_dev)) + + + .def("set_max_dev", + &cfo_model::set_max_dev, + py::arg("_dev"), + D(cfo_model, set_max_dev)) + + + .def("set_samp_rate", + &cfo_model::set_samp_rate, + py::arg("_rate"), + D(cfo_model, set_samp_rate)) + + + .def("std_dev", &cfo_model::std_dev, D(cfo_model, std_dev)) + + + .def("max_dev", &cfo_model::max_dev, D(cfo_model, max_dev)) + + + .def("samp_rate", &cfo_model::samp_rate, D(cfo_model, samp_rate)) + + ; +} diff --git a/gr-channels/python/channels/bindings/channel_model2_python.cc b/gr-channels/python/channels/bindings/channel_model2_python.cc new file mode 100644 index 0000000000..d95f235c25 --- /dev/null +++ b/gr-channels/python/channels/bindings/channel_model2_python.cc @@ -0,0 +1,73 @@ +/* + * 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 */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/channels/channel_model2.h> +// pydoc.h is automatically generated in the build directory +#include <channel_model2_pydoc.h> + +void bind_channel_model2(py::module& m) +{ + + using channel_model2 = ::gr::channels::channel_model2; + + + py::class_<channel_model2, + gr::hier_block2, + gr::basic_block, + std::shared_ptr<channel_model2>>(m, "channel_model2", D(channel_model2)) + + .def(py::init(&channel_model2::make), + py::arg("noise_voltage") = 0., + py::arg("epsilon") = 1., + py::arg("taps") = std::vector<gr_complex>(1, 1), + py::arg("noise_seed") = 0, + py::arg("block_tags") = false, + D(channel_model2, make)) + + + .def("set_noise_voltage", + &channel_model2::set_noise_voltage, + py::arg("noise_voltage"), + D(channel_model2, set_noise_voltage)) + + + .def("set_taps", + &channel_model2::set_taps, + py::arg("taps"), + D(channel_model2, set_taps)) + + + .def("set_timing_offset", + &channel_model2::set_timing_offset, + py::arg("epsilon"), + D(channel_model2, set_timing_offset)) + + + .def("noise_voltage", + &channel_model2::noise_voltage, + D(channel_model2, noise_voltage)) + + + .def("taps", &channel_model2::taps, D(channel_model2, taps)) + + + .def("timing_offset", + &channel_model2::timing_offset, + D(channel_model2, timing_offset)) + + ; +} diff --git a/gr-channels/python/channels/bindings/channel_model_python.cc b/gr-channels/python/channels/bindings/channel_model_python.cc new file mode 100644 index 0000000000..29fdb38a7a --- /dev/null +++ b/gr-channels/python/channels/bindings/channel_model_python.cc @@ -0,0 +1,85 @@ +/* + * 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 */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/channels/channel_model.h> +// pydoc.h is automatically generated in the build directory +#include <channel_model_pydoc.h> + +void bind_channel_model(py::module& m) +{ + + using channel_model = ::gr::channels::channel_model; + + + py::class_<channel_model, + gr::hier_block2, + gr::basic_block, + std::shared_ptr<channel_model>>(m, "channel_model", D(channel_model)) + + .def(py::init(&channel_model::make), + py::arg("noise_voltage") = 0., + py::arg("frequency_offset") = 0., + py::arg("epsilon") = 1., + py::arg("taps") = std::vector<gr_complex>(1, 1), + py::arg("noise_seed") = 0, + py::arg("block_tags") = false, + D(channel_model, make)) + + + .def("set_noise_voltage", + &channel_model::set_noise_voltage, + py::arg("noise_voltage"), + D(channel_model, set_noise_voltage)) + + + .def("set_frequency_offset", + &channel_model::set_frequency_offset, + py::arg("frequency_offset"), + D(channel_model, set_frequency_offset)) + + + .def("set_taps", + &channel_model::set_taps, + py::arg("taps"), + D(channel_model, set_taps)) + + + .def("set_timing_offset", + &channel_model::set_timing_offset, + py::arg("epsilon"), + D(channel_model, set_timing_offset)) + + + .def("noise_voltage", + &channel_model::noise_voltage, + D(channel_model, noise_voltage)) + + + .def("frequency_offset", + &channel_model::frequency_offset, + D(channel_model, frequency_offset)) + + + .def("taps", &channel_model::taps, D(channel_model, taps)) + + + .def("timing_offset", + &channel_model::timing_offset, + D(channel_model, timing_offset)) + + ; +} diff --git a/gr-channels/python/channels/bindings/docstrings/cfo_model_pydoc_template.h b/gr-channels/python/channels/bindings/docstrings/cfo_model_pydoc_template.h new file mode 100644 index 0000000000..1fc153e930 --- /dev/null +++ b/gr-channels/python/channels/bindings/docstrings/cfo_model_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, channels, __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_channels_cfo_model = R"doc()doc"; + + +static const char* __doc_gr_channels_cfo_model_cfo_model_0 = R"doc()doc"; + + +static const char* __doc_gr_channels_cfo_model_cfo_model_1 = R"doc()doc"; + + +static const char* __doc_gr_channels_cfo_model_make = R"doc()doc"; + + +static const char* __doc_gr_channels_cfo_model_set_std_dev = R"doc()doc"; + + +static const char* __doc_gr_channels_cfo_model_set_max_dev = R"doc()doc"; + + +static const char* __doc_gr_channels_cfo_model_set_samp_rate = R"doc()doc"; + + +static const char* __doc_gr_channels_cfo_model_std_dev = R"doc()doc"; + + +static const char* __doc_gr_channels_cfo_model_max_dev = R"doc()doc"; + + +static const char* __doc_gr_channels_cfo_model_samp_rate = R"doc()doc"; diff --git a/gr-channels/python/channels/bindings/docstrings/channel_model2_pydoc_template.h b/gr-channels/python/channels/bindings/docstrings/channel_model2_pydoc_template.h new file mode 100644 index 0000000000..5eff291f27 --- /dev/null +++ b/gr-channels/python/channels/bindings/docstrings/channel_model2_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, channels, __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_channels_channel_model2 = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model2_channel_model2_0 = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model2_channel_model2_1 = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model2_make = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model2_set_noise_voltage = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model2_set_taps = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model2_set_timing_offset = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model2_noise_voltage = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model2_taps = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model2_timing_offset = R"doc()doc"; diff --git a/gr-channels/python/channels/bindings/docstrings/channel_model_pydoc_template.h b/gr-channels/python/channels/bindings/docstrings/channel_model_pydoc_template.h new file mode 100644 index 0000000000..f151707ecf --- /dev/null +++ b/gr-channels/python/channels/bindings/docstrings/channel_model_pydoc_template.h @@ -0,0 +1,51 @@ +/* + * 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, channels, __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_channels_channel_model = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model_channel_model_0 = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model_channel_model_1 = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model_make = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model_set_noise_voltage = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model_set_frequency_offset = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model_set_taps = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model_set_timing_offset = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model_noise_voltage = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model_frequency_offset = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model_taps = R"doc()doc"; + + +static const char* __doc_gr_channels_channel_model_timing_offset = R"doc()doc"; diff --git a/gr-channels/python/channels/bindings/docstrings/dynamic_channel_model_pydoc_template.h b/gr-channels/python/channels/bindings/docstrings/dynamic_channel_model_pydoc_template.h new file mode 100644 index 0000000000..09fa3ff5fb --- /dev/null +++ b/gr-channels/python/channels/bindings/docstrings/dynamic_channel_model_pydoc_template.h @@ -0,0 +1,77 @@ +/* + * 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, channels, __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_channels_dynamic_channel_model = R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_dynamic_channel_model_0 = + R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_dynamic_channel_model_1 = + R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_make = R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_samp_rate = R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_sro_dev_std = R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_sro_dev_max = R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_cfo_dev_std = R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_cfo_dev_max = R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_noise_amp = R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_doppler_freq = R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_K = R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_set_samp_rate = R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_set_sro_dev_std = R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_set_sro_dev_max = R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_set_cfo_dev_std = R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_set_cfo_dev_max = R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_set_noise_amp = R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_set_doppler_freq = R"doc()doc"; + + +static const char* __doc_gr_channels_dynamic_channel_model_set_K = R"doc()doc"; diff --git a/gr-channels/python/channels/bindings/docstrings/fading_model_pydoc_template.h b/gr-channels/python/channels/bindings/docstrings/fading_model_pydoc_template.h new file mode 100644 index 0000000000..3abcfe7a3f --- /dev/null +++ b/gr-channels/python/channels/bindings/docstrings/fading_model_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, channels, __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_channels_fading_model = R"doc()doc"; + + +static const char* __doc_gr_channels_fading_model_fading_model_0 = R"doc()doc"; + + +static const char* __doc_gr_channels_fading_model_fading_model_1 = R"doc()doc"; + + +static const char* __doc_gr_channels_fading_model_make = R"doc()doc"; + + +static const char* __doc_gr_channels_fading_model_fDTs = R"doc()doc"; + + +static const char* __doc_gr_channels_fading_model_K = R"doc()doc"; + + +static const char* __doc_gr_channels_fading_model_step = R"doc()doc"; + + +static const char* __doc_gr_channels_fading_model_set_fDTs = R"doc()doc"; + + +static const char* __doc_gr_channels_fading_model_set_K = R"doc()doc"; + + +static const char* __doc_gr_channels_fading_model_set_step = R"doc()doc"; diff --git a/gr-channels/python/channels/bindings/docstrings/selective_fading_model2_pydoc_template.h b/gr-channels/python/channels/bindings/docstrings/selective_fading_model2_pydoc_template.h new file mode 100644 index 0000000000..8d48ebea8b --- /dev/null +++ b/gr-channels/python/channels/bindings/docstrings/selective_fading_model2_pydoc_template.h @@ -0,0 +1,47 @@ +/* + * 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, channels, __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_channels_selective_fading_model2 = R"doc()doc"; + + +static const char* __doc_gr_channels_selective_fading_model2_selective_fading_model2_0 = + R"doc()doc"; + + +static const char* __doc_gr_channels_selective_fading_model2_selective_fading_model2_1 = + R"doc()doc"; + + +static const char* __doc_gr_channels_selective_fading_model2_make = R"doc()doc"; + + +static const char* __doc_gr_channels_selective_fading_model2_fDTs = R"doc()doc"; + + +static const char* __doc_gr_channels_selective_fading_model2_K = R"doc()doc"; + + +static const char* __doc_gr_channels_selective_fading_model2_step = R"doc()doc"; + + +static const char* __doc_gr_channels_selective_fading_model2_set_fDTs = R"doc()doc"; + + +static const char* __doc_gr_channels_selective_fading_model2_set_K = R"doc()doc"; + + +static const char* __doc_gr_channels_selective_fading_model2_set_step = R"doc()doc"; diff --git a/gr-channels/python/channels/bindings/docstrings/selective_fading_model_pydoc_template.h b/gr-channels/python/channels/bindings/docstrings/selective_fading_model_pydoc_template.h new file mode 100644 index 0000000000..a193c2b51d --- /dev/null +++ b/gr-channels/python/channels/bindings/docstrings/selective_fading_model_pydoc_template.h @@ -0,0 +1,47 @@ +/* + * 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, channels, __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_channels_selective_fading_model = R"doc()doc"; + + +static const char* __doc_gr_channels_selective_fading_model_selective_fading_model_0 = + R"doc()doc"; + + +static const char* __doc_gr_channels_selective_fading_model_selective_fading_model_1 = + R"doc()doc"; + + +static const char* __doc_gr_channels_selective_fading_model_make = R"doc()doc"; + + +static const char* __doc_gr_channels_selective_fading_model_fDTs = R"doc()doc"; + + +static const char* __doc_gr_channels_selective_fading_model_K = R"doc()doc"; + + +static const char* __doc_gr_channels_selective_fading_model_step = R"doc()doc"; + + +static const char* __doc_gr_channels_selective_fading_model_set_fDTs = R"doc()doc"; + + +static const char* __doc_gr_channels_selective_fading_model_set_K = R"doc()doc"; + + +static const char* __doc_gr_channels_selective_fading_model_set_step = R"doc()doc"; diff --git a/gr-channels/python/channels/bindings/docstrings/sro_model_pydoc_template.h b/gr-channels/python/channels/bindings/docstrings/sro_model_pydoc_template.h new file mode 100644 index 0000000000..5ba1c6a272 --- /dev/null +++ b/gr-channels/python/channels/bindings/docstrings/sro_model_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, channels, __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_channels_sro_model = R"doc()doc"; + + +static const char* __doc_gr_channels_sro_model_sro_model_0 = R"doc()doc"; + + +static const char* __doc_gr_channels_sro_model_sro_model_1 = R"doc()doc"; + + +static const char* __doc_gr_channels_sro_model_make = R"doc()doc"; + + +static const char* __doc_gr_channels_sro_model_set_std_dev = R"doc()doc"; + + +static const char* __doc_gr_channels_sro_model_set_max_dev = R"doc()doc"; + + +static const char* __doc_gr_channels_sro_model_set_samp_rate = R"doc()doc"; + + +static const char* __doc_gr_channels_sro_model_std_dev = R"doc()doc"; + + +static const char* __doc_gr_channels_sro_model_max_dev = R"doc()doc"; + + +static const char* __doc_gr_channels_sro_model_samp_rate = R"doc()doc"; diff --git a/gr-channels/python/channels/bindings/dynamic_channel_model_python.cc b/gr-channels/python/channels/bindings/dynamic_channel_model_python.cc new file mode 100644 index 0000000000..bab18cb6d5 --- /dev/null +++ b/gr-channels/python/channels/bindings/dynamic_channel_model_python.cc @@ -0,0 +1,138 @@ +/* + * 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 */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/channels/dynamic_channel_model.h> +// pydoc.h is automatically generated in the build directory +#include <dynamic_channel_model_pydoc.h> + +void bind_dynamic_channel_model(py::module& m) +{ + + using dynamic_channel_model = ::gr::channels::dynamic_channel_model; + + + py::class_<dynamic_channel_model, + gr::hier_block2, + gr::basic_block, + std::shared_ptr<dynamic_channel_model>>( + m, "dynamic_channel_model", D(dynamic_channel_model)) + + .def(py::init(&dynamic_channel_model::make), + py::arg("samp_rate"), + py::arg("sro_std_dev"), + py::arg("sro_max_dev"), + py::arg("cfo_std_dev"), + py::arg("cfo_max_dev"), + py::arg("N"), + py::arg("doppler_freq"), + py::arg("LOS_model"), + py::arg("K"), + py::arg("delays"), + py::arg("mags"), + py::arg("ntaps_mpath"), + py::arg("noise_amp"), + py::arg("noise_seed"), + D(dynamic_channel_model, make)) + + + .def("samp_rate", + &dynamic_channel_model::samp_rate, + D(dynamic_channel_model, samp_rate)) + + + .def("sro_dev_std", + &dynamic_channel_model::sro_dev_std, + D(dynamic_channel_model, sro_dev_std)) + + + .def("sro_dev_max", + &dynamic_channel_model::sro_dev_max, + D(dynamic_channel_model, sro_dev_max)) + + + .def("cfo_dev_std", + &dynamic_channel_model::cfo_dev_std, + D(dynamic_channel_model, cfo_dev_std)) + + + .def("cfo_dev_max", + &dynamic_channel_model::cfo_dev_max, + D(dynamic_channel_model, cfo_dev_max)) + + + .def("noise_amp", + &dynamic_channel_model::noise_amp, + D(dynamic_channel_model, noise_amp)) + + + .def("doppler_freq", + &dynamic_channel_model::doppler_freq, + D(dynamic_channel_model, doppler_freq)) + + + .def("K", &dynamic_channel_model::K, D(dynamic_channel_model, K)) + + + .def("set_samp_rate", + &dynamic_channel_model::set_samp_rate, + py::arg("arg0"), + D(dynamic_channel_model, set_samp_rate)) + + + .def("set_sro_dev_std", + &dynamic_channel_model::set_sro_dev_std, + py::arg("arg0"), + D(dynamic_channel_model, set_sro_dev_std)) + + + .def("set_sro_dev_max", + &dynamic_channel_model::set_sro_dev_max, + py::arg("arg0"), + D(dynamic_channel_model, set_sro_dev_max)) + + + .def("set_cfo_dev_std", + &dynamic_channel_model::set_cfo_dev_std, + py::arg("arg0"), + D(dynamic_channel_model, set_cfo_dev_std)) + + + .def("set_cfo_dev_max", + &dynamic_channel_model::set_cfo_dev_max, + py::arg("arg0"), + D(dynamic_channel_model, set_cfo_dev_max)) + + + .def("set_noise_amp", + &dynamic_channel_model::set_noise_amp, + py::arg("arg0"), + D(dynamic_channel_model, set_noise_amp)) + + + .def("set_doppler_freq", + &dynamic_channel_model::set_doppler_freq, + py::arg("arg0"), + D(dynamic_channel_model, set_doppler_freq)) + + + .def("set_K", + &dynamic_channel_model::set_K, + py::arg("arg0"), + D(dynamic_channel_model, set_K)) + + ; +} diff --git a/gr-channels/python/channels/bindings/fading_model_python.cc b/gr-channels/python/channels/bindings/fading_model_python.cc new file mode 100644 index 0000000000..9872a6818c --- /dev/null +++ b/gr-channels/python/channels/bindings/fading_model_python.cc @@ -0,0 +1,67 @@ +/* + * 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 */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/channels/fading_model.h> +// pydoc.h is automatically generated in the build directory +#include <fading_model_pydoc.h> + +void bind_fading_model(py::module& m) +{ + + using fading_model = ::gr::channels::fading_model; + + + py::class_<fading_model, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<fading_model>>(m, "fading_model", D(fading_model)) + + .def(py::init(&fading_model::make), + py::arg("N"), + py::arg("fDTs") = 0.00999999977F, + py::arg("LOS") = true, + py::arg("K") = 4, + py::arg("seed") = 0, + D(fading_model, make)) + + + .def("fDTs", &fading_model::fDTs, D(fading_model, fDTs)) + + + .def("K", &fading_model::K, D(fading_model, K)) + + + .def("step", &fading_model::step, D(fading_model, step)) + + + .def("set_fDTs", + &fading_model::set_fDTs, + py::arg("fDTs"), + D(fading_model, set_fDTs)) + + + .def("set_K", &fading_model::set_K, py::arg("K"), D(fading_model, set_K)) + + + .def("set_step", + &fading_model::set_step, + py::arg("step"), + D(fading_model, set_step)) + + ; +} diff --git a/gr-channels/python/channels/bindings/python_bindings.cc b/gr-channels/python/channels/bindings/python_bindings.cc new file mode 100644 index 0000000000..eac7e53f38 --- /dev/null +++ b/gr-channels/python/channels/bindings/python_bindings.cc @@ -0,0 +1,54 @@ + +/* + * 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_cfo_model(py::module&); +void bind_channel_model(py::module&); +void bind_channel_model2(py::module&); +void bind_dynamic_channel_model(py::module&); +void bind_fading_model(py::module&); +void bind_selective_fading_model(py::module&); +void bind_selective_fading_model2(py::module&); +void bind_sro_model(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(channels_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_cfo_model(m); + bind_channel_model(m); + bind_channel_model2(m); + bind_dynamic_channel_model(m); + bind_fading_model(m); + bind_selective_fading_model(m); + bind_selective_fading_model2(m); + bind_sro_model(m); +} diff --git a/gr-channels/python/channels/bindings/selective_fading_model2_python.cc b/gr-channels/python/channels/bindings/selective_fading_model2_python.cc new file mode 100644 index 0000000000..2f26e2f70f --- /dev/null +++ b/gr-channels/python/channels/bindings/selective_fading_model2_python.cc @@ -0,0 +1,76 @@ +/* + * 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 */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/channels/selective_fading_model2.h> +// pydoc.h is automatically generated in the build directory +#include <selective_fading_model2_pydoc.h> + +void bind_selective_fading_model2(py::module& m) +{ + + using selective_fading_model2 = ::gr::channels::selective_fading_model2; + + + py::class_<selective_fading_model2, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<selective_fading_model2>>( + m, "selective_fading_model2", D(selective_fading_model2)) + + .def(py::init(&selective_fading_model2::make), + py::arg("N"), + py::arg("fDTs"), + py::arg("LOS"), + py::arg("K"), + py::arg("seed"), + py::arg("delays"), + py::arg("delays_std"), + py::arg("delays_maxdev"), + py::arg("mags"), + py::arg("ntaps"), + D(selective_fading_model2, make)) + + + .def("fDTs", &selective_fading_model2::fDTs, D(selective_fading_model2, fDTs)) + + + .def("K", &selective_fading_model2::K, D(selective_fading_model2, K)) + + + .def("step", &selective_fading_model2::step, D(selective_fading_model2, step)) + + + .def("set_fDTs", + &selective_fading_model2::set_fDTs, + py::arg("fDTs"), + D(selective_fading_model2, set_fDTs)) + + + .def("set_K", + &selective_fading_model2::set_K, + py::arg("K"), + D(selective_fading_model2, set_K)) + + + .def("set_step", + &selective_fading_model2::set_step, + py::arg("step"), + D(selective_fading_model2, set_step)) + + ; +} diff --git a/gr-channels/python/channels/bindings/selective_fading_model_python.cc b/gr-channels/python/channels/bindings/selective_fading_model_python.cc new file mode 100644 index 0000000000..9d79aa883d --- /dev/null +++ b/gr-channels/python/channels/bindings/selective_fading_model_python.cc @@ -0,0 +1,74 @@ +/* + * 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 */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/channels/selective_fading_model.h> +// pydoc.h is automatically generated in the build directory +#include <selective_fading_model_pydoc.h> + +void bind_selective_fading_model(py::module& m) +{ + + using selective_fading_model = ::gr::channels::selective_fading_model; + + + py::class_<selective_fading_model, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<selective_fading_model>>( + m, "selective_fading_model", D(selective_fading_model)) + + .def(py::init(&selective_fading_model::make), + py::arg("N"), + py::arg("fDTs"), + py::arg("LOS"), + py::arg("K"), + py::arg("seed"), + py::arg("delays"), + py::arg("mags"), + py::arg("ntaps"), + D(selective_fading_model, make)) + + + .def("fDTs", &selective_fading_model::fDTs, D(selective_fading_model, fDTs)) + + + .def("K", &selective_fading_model::K, D(selective_fading_model, K)) + + + .def("step", &selective_fading_model::step, D(selective_fading_model, step)) + + + .def("set_fDTs", + &selective_fading_model::set_fDTs, + py::arg("fDTs"), + D(selective_fading_model, set_fDTs)) + + + .def("set_K", + &selective_fading_model::set_K, + py::arg("K"), + D(selective_fading_model, set_K)) + + + .def("set_step", + &selective_fading_model::set_step, + py::arg("step"), + D(selective_fading_model, set_step)) + + ; +} diff --git a/gr-channels/python/channels/bindings/sro_model_python.cc b/gr-channels/python/channels/bindings/sro_model_python.cc new file mode 100644 index 0000000000..9d77d7756f --- /dev/null +++ b/gr-channels/python/channels/bindings/sro_model_python.cc @@ -0,0 +1,66 @@ +/* + * 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 */ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/channels/sro_model.h> +// pydoc.h is automatically generated in the build directory +#include <sro_model_pydoc.h> + +void bind_sro_model(py::module& m) +{ + + using sro_model = ::gr::channels::sro_model; + + + py::class_<sro_model, gr::block, gr::basic_block, std::shared_ptr<sro_model>>( + m, "sro_model", D(sro_model)) + + .def(py::init(&sro_model::make), + py::arg("sample_rate_hz"), + py::arg("std_dev_hz"), + py::arg("max_dev_hz"), + py::arg("noise_seed") = 0, + D(sro_model, make)) + + + .def("set_std_dev", + &sro_model::set_std_dev, + py::arg("_dev"), + D(sro_model, set_std_dev)) + + + .def("set_max_dev", + &sro_model::set_max_dev, + py::arg("_dev"), + D(sro_model, set_max_dev)) + + + .def("set_samp_rate", + &sro_model::set_samp_rate, + py::arg("_rate"), + D(sro_model, set_samp_rate)) + + + .def("std_dev", &sro_model::std_dev, D(sro_model, std_dev)) + + + .def("max_dev", &sro_model::max_dev, D(sro_model, max_dev)) + + + .def("samp_rate", &sro_model::samp_rate, D(sro_model, samp_rate)) + + ; +} |