diff options
Diffstat (limited to 'gr-wavelet/python/wavelet/bindings')
8 files changed, 279 insertions, 0 deletions
diff --git a/gr-wavelet/python/wavelet/bindings/CMakeLists.txt b/gr-wavelet/python/wavelet/bindings/CMakeLists.txt new file mode 100644 index 0000000000..ab65b0a09e --- /dev/null +++ b/gr-wavelet/python/wavelet/bindings/CMakeLists.txt @@ -0,0 +1,18 @@ +include(GrPybind) + +######################################################################## +# Python Bindings +######################################################################## + +list(APPEND wavelet_python_files + squash_ff_python.cc + wavelet_ff_python.cc + wvps_ff_python.cc + python_bindings.cc) + +GR_PYBIND_MAKE_CHECK_HASH(wavelet + ../../.. + gr::wavelet + "${wavelet_python_files}") + +install(TARGETS wavelet_python DESTINATION ${GR_PYTHON_DIR}/gnuradio/wavelet COMPONENT pythonapi) diff --git a/gr-wavelet/python/wavelet/bindings/docstrings/squash_ff_pydoc_template.h b/gr-wavelet/python/wavelet/bindings/docstrings/squash_ff_pydoc_template.h new file mode 100644 index 0000000000..91d631be43 --- /dev/null +++ b/gr-wavelet/python/wavelet/bindings/docstrings/squash_ff_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, wavelet, __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_wavelet_squash_ff = R"doc()doc"; + + +static const char* __doc_gr_wavelet_squash_ff_squash_ff = R"doc()doc"; + + +static const char* __doc_gr_wavelet_squash_ff_make = R"doc()doc"; diff --git a/gr-wavelet/python/wavelet/bindings/docstrings/wavelet_ff_pydoc_template.h b/gr-wavelet/python/wavelet/bindings/docstrings/wavelet_ff_pydoc_template.h new file mode 100644 index 0000000000..3d542abece --- /dev/null +++ b/gr-wavelet/python/wavelet/bindings/docstrings/wavelet_ff_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, wavelet, __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_wavelet_wavelet_ff = R"doc()doc"; + + +static const char* __doc_gr_wavelet_wavelet_ff_wavelet_ff = R"doc()doc"; + + +static const char* __doc_gr_wavelet_wavelet_ff_make = R"doc()doc"; diff --git a/gr-wavelet/python/wavelet/bindings/docstrings/wvps_ff_pydoc_template.h b/gr-wavelet/python/wavelet/bindings/docstrings/wvps_ff_pydoc_template.h new file mode 100644 index 0000000000..0389e60234 --- /dev/null +++ b/gr-wavelet/python/wavelet/bindings/docstrings/wvps_ff_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, wavelet, __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_wavelet_wvps_ff = R"doc()doc"; + + +static const char* __doc_gr_wavelet_wvps_ff_wvps_ff = R"doc()doc"; + + +static const char* __doc_gr_wavelet_wvps_ff_make = R"doc()doc"; diff --git a/gr-wavelet/python/wavelet/bindings/python_bindings.cc b/gr-wavelet/python/wavelet/bindings/python_bindings.cc new file mode 100644 index 0000000000..a94bc4405d --- /dev/null +++ b/gr-wavelet/python/wavelet/bindings/python_bindings.cc @@ -0,0 +1,44 @@ + +/* + * 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_squash_ff(py::module&); +void bind_wavelet_ff(py::module&); +void bind_wvps_ff(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(wavelet_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_squash_ff(m); + bind_wavelet_ff(m); + bind_wvps_ff(m); +} diff --git a/gr-wavelet/python/wavelet/bindings/squash_ff_python.cc b/gr-wavelet/python/wavelet/bindings/squash_ff_python.cc new file mode 100644 index 0000000000..a8c4eda05f --- /dev/null +++ b/gr-wavelet/python/wavelet/bindings/squash_ff_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(squash_ff.h) */ +/* BINDTOOL_HEADER_FILE_HASH(ae6436fd366614924bbc336d562d99c3) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/wavelet/squash_ff.h> +// pydoc.h is automatically generated in the build directory +#include <squash_ff_pydoc.h> + +void bind_squash_ff(py::module& m) +{ + + using squash_ff = ::gr::wavelet::squash_ff; + + + py::class_<squash_ff, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<squash_ff>>(m, "squash_ff", D(squash_ff)) + + .def(py::init(&squash_ff::make), + py::arg("igrid"), + py::arg("ogrid"), + D(squash_ff, make)) + + + ; +} diff --git a/gr-wavelet/python/wavelet/bindings/wavelet_ff_python.cc b/gr-wavelet/python/wavelet/bindings/wavelet_ff_python.cc new file mode 100644 index 0000000000..77a77accb1 --- /dev/null +++ b/gr-wavelet/python/wavelet/bindings/wavelet_ff_python.cc @@ -0,0 +1,50 @@ +/* + * 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(wavelet_ff.h) */ +/* BINDTOOL_HEADER_FILE_HASH(1c5d9e25715e0553026d3aa1f16caa77) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/wavelet/wavelet_ff.h> +// pydoc.h is automatically generated in the build directory +#include <wavelet_ff_pydoc.h> + +void bind_wavelet_ff(py::module& m) +{ + + using wavelet_ff = ::gr::wavelet::wavelet_ff; + + + py::class_<wavelet_ff, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<wavelet_ff>>(m, "wavelet_ff", D(wavelet_ff)) + + .def(py::init(&wavelet_ff::make), + py::arg("size") = 1024, + py::arg("order") = 20, + py::arg("forward") = true, + D(wavelet_ff, make)) + + + ; +} diff --git a/gr-wavelet/python/wavelet/bindings/wvps_ff_python.cc b/gr-wavelet/python/wavelet/bindings/wvps_ff_python.cc new file mode 100644 index 0000000000..073be54f65 --- /dev/null +++ b/gr-wavelet/python/wavelet/bindings/wvps_ff_python.cc @@ -0,0 +1,46 @@ +/* + * 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(wvps_ff.h) */ +/* BINDTOOL_HEADER_FILE_HASH(1f4a9460066d197782a59a0fa164ae03) */ +/***********************************************************************************/ + +#include <pybind11/complex.h> +#include <pybind11/pybind11.h> +#include <pybind11/stl.h> + +namespace py = pybind11; + +#include <gnuradio/wavelet/wvps_ff.h> +// pydoc.h is automatically generated in the build directory +#include <wvps_ff_pydoc.h> + +void bind_wvps_ff(py::module& m) +{ + + using wvps_ff = ::gr::wavelet::wvps_ff; + + + py::class_<wvps_ff, + gr::sync_block, + gr::block, + gr::basic_block, + std::shared_ptr<wvps_ff>>(m, "wvps_ff", D(wvps_ff)) + + .def(py::init(&wvps_ff::make), py::arg("ilen"), D(wvps_ff, make)) + + + ; +} |