diff options
-rw-r--r-- | host/lib/types/filters_python.hpp | 49 | ||||
-rw-r--r-- | host/python/uhd/filters.py | 2 |
2 files changed, 46 insertions, 5 deletions
diff --git a/host/lib/types/filters_python.hpp b/host/lib/types/filters_python.hpp index 7210faa21..15fea5f50 100644 --- a/host/lib/types/filters_python.hpp +++ b/host/lib/types/filters_python.hpp @@ -12,10 +12,12 @@ void export_filters(py::module& m) { - using filter_info_base = uhd::filter_info_base; - using filter_info_type = filter_info_base::filter_type; - using analog_filter_base = uhd::analog_filter_base; - using analog_filter_lp = uhd::analog_filter_lp; + using filter_info_base = uhd::filter_info_base; + using filter_info_type = filter_info_base::filter_type; + using analog_filter_base = uhd::analog_filter_base; + using analog_filter_lp = uhd::analog_filter_lp; + using digital_filter_base_i16 = uhd::digital_filter_base<int16_t>; + using digital_filter_fir_i16 = uhd::digital_filter_fir<int16_t>; py::enum_<filter_info_type>(m, "filter_type") .value("analog_low_pass", filter_info_base::ANALOG_LOW_PASS) @@ -38,7 +40,8 @@ void export_filters(py::module& m) // Methods .def("get_analog_type", &analog_filter_base::get_analog_type); - py::class_<analog_filter_lp, analog_filter_base, std::shared_ptr<analog_filter_lp>>(m, "analog_filter_lp") + py::class_<analog_filter_lp, analog_filter_base, std::shared_ptr<analog_filter_lp>>( + m, "analog_filter_lp") .def( py::init<filter_info_type, bool, size_t, const std::string, double, double>()) @@ -46,6 +49,42 @@ void export_filters(py::module& m) .def("get_cutoff", &analog_filter_lp::get_cutoff) .def("get_rolloff", &analog_filter_lp::get_rolloff) .def("set_cutoff", &analog_filter_lp::set_cutoff); + + py::class_<digital_filter_base_i16, filter_info_base, digital_filter_base_i16::sptr>( + m, "digital_filter_base_i16") + .def(py::init<filter_info_type, + bool, + size_t, + double, + size_t, + size_t, + double, + size_t, + std::vector<int16_t>>()) + + // Methods + .def("get_output_rate", &digital_filter_base_i16::get_output_rate) + .def("get_input_rate", &digital_filter_base_i16::get_input_rate) + .def("get_interpolation", &digital_filter_base_i16::get_interpolation) + .def("get_decimation", &digital_filter_base_i16::get_decimation) + .def("get_tap_full_scale", &digital_filter_base_i16::get_tap_full_scale) + .def("get_taps", &digital_filter_base_i16::get_taps); + + py::class_<digital_filter_fir_i16, + digital_filter_base_i16, + std::shared_ptr<digital_filter_fir_i16>>(m, "digital_filter_fir_i16") + .def(py::init<filter_info_type, + bool, + size_t, + double, + size_t, + size_t, + size_t, + size_t, + std::vector<int16_t>>()) + + // Methods + .def("set_taps", &digital_filter_fir_i16::set_taps); } #endif /* INCLUDED_UHD_FILTERS_PYTHON_HPP */ diff --git a/host/python/uhd/filters.py b/host/python/uhd/filters.py index 8479b56e1..2862e2945 100644 --- a/host/python/uhd/filters.py +++ b/host/python/uhd/filters.py @@ -14,3 +14,5 @@ FilterType = lib.filters.filter_type FilterInfoBase = lib.filters.filter_info_base AnalogFilterBase = lib.filters.analog_filter_base AnalogFilterLP = lib.filters.analog_filter_lp +DigitalFilterBaseI16 = lib.filters.digital_filter_base_i16 +DigitalFilterFIRI16 = lib.filters.digital_filter_fir_i16 |