aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib
diff options
context:
space:
mode:
authormattprost <matt.prost@ni.com>2022-03-14 17:20:35 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2022-04-07 13:28:02 -0700
commit0cf8a60a4e88d55de04cde1feb85eaadfdcf15d7 (patch)
tree7bbf0fb63eacd97d77bc779872211561b2bc12f2 /host/lib
parent4bd20a9e2a2760c05bd27c5fb96b11668ff5c682 (diff)
downloaduhd-0cf8a60a4e88d55de04cde1feb85eaadfdcf15d7.tar.gz
uhd-0cf8a60a4e88d55de04cde1feb85eaadfdcf15d7.tar.bz2
uhd-0cf8a60a4e88d55de04cde1feb85eaadfdcf15d7.zip
types: filters: Add python support for digital filters
Signed-off-by: mattprost <matt.prost@ni.com>
Diffstat (limited to 'host/lib')
-rw-r--r--host/lib/types/filters_python.hpp49
1 files changed, 44 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 */