summaryrefslogtreecommitdiff
path: root/gr-fft/python/fft/bindings/window_python.cc
blob: f331ac339ccabc64f41ae5f4733faf3d4a442f55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/*
 * 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/fft/window.h>
// pydoc.h is automatically generated in the build directory
#include <window_pydoc.h>

void bind_window(py::module& m)
{
    using window = gr::fft::window;


    py::class_<window, std::shared_ptr<window>>(m, "window", D(window))


        .def_static("max_attenuation",
                    &window::max_attenuation,
                    py::arg("type"),
                    py::arg("beta") = 6.7599999999999998,
                    D(window, max_attenuation))


        .def_static("coswindow",
                    (std::vector<float>(*)(int, float, float, float)) & window::coswindow,
                    py::arg("ntaps"),
                    py::arg("c0"),
                    py::arg("c1"),
                    py::arg("c2"),
                    D(window, coswindow, 0))


        .def_static("coswindow",
                    (std::vector<float>(*)(int, float, float, float, float)) &
                        window::coswindow,
                    py::arg("ntaps"),
                    py::arg("c0"),
                    py::arg("c1"),
                    py::arg("c2"),
                    py::arg("c3"),
                    D(window, coswindow, 1))


        .def_static("coswindow",
                    (std::vector<float>(*)(int, float, float, float, float, float)) &
                        window::coswindow,
                    py::arg("ntaps"),
                    py::arg("c0"),
                    py::arg("c1"),
                    py::arg("c2"),
                    py::arg("c3"),
                    py::arg("c4"),
                    D(window, coswindow, 2))


        .def_static(
            "rectangular", &window::rectangular, py::arg("ntaps"), D(window, rectangular))


        .def_static("hamming", &window::hamming, py::arg("ntaps"), D(window, hamming))


        .def_static("hann", &window::hann, py::arg("ntaps"), D(window, hann))


        .def_static("hanning", &window::hanning, py::arg("ntaps"), D(window, hanning))


        .def_static("blackman", &window::blackman, py::arg("ntaps"), D(window, blackman))


        .def_static(
            "blackman2", &window::blackman2, py::arg("ntaps"), D(window, blackman2))


        .def_static(
            "blackman3", &window::blackman3, py::arg("ntaps"), D(window, blackman3))


        .def_static(
            "blackman4", &window::blackman4, py::arg("ntaps"), D(window, blackman4))


        .def_static("blackman_harris",
                    &window::blackman_harris,
                    py::arg("ntaps"),
                    py::arg("atten") = 92,
                    D(window, blackman_harris))


        .def_static("blackmanharris",
                    &window::blackmanharris,
                    py::arg("ntaps"),
                    py::arg("atten") = 92,
                    D(window, blackmanharris))


        .def_static("nuttall", &window::nuttall, py::arg("ntaps"), D(window, nuttall))


        .def_static("nuttal", &window::nuttal, py::arg("ntaps"), D(window, nuttal))


        .def_static("blackman_nuttall",
                    &window::blackman_nuttall,
                    py::arg("ntaps"),
                    D(window, blackman_nuttall))


        .def_static("blackman_nuttal",
                    &window::blackman_nuttal,
                    py::arg("ntaps"),
                    D(window, blackman_nuttal))


        .def_static(
            "nuttall_cfd", &window::nuttall_cfd, py::arg("ntaps"), D(window, nuttall_cfd))


        .def_static(
            "nuttal_cfd", &window::nuttal_cfd, py::arg("ntaps"), D(window, nuttal_cfd))


        .def_static("flattop", &window::flattop, py::arg("ntaps"), D(window, flattop))


        .def_static("kaiser",
                    &window::kaiser,
                    py::arg("ntaps"),
                    py::arg("beta"),
                    D(window, kaiser))


        .def_static("bartlett", &window::bartlett, py::arg("ntaps"), D(window, bartlett))


        .def_static("welch", &window::welch, py::arg("ntaps"), D(window, welch))


        .def_static("parzen", &window::parzen, py::arg("ntaps"), D(window, parzen))


        .def_static("exponential",
                    &window::exponential,
                    py::arg("ntaps"),
                    py::arg("d"),
                    D(window, exponential))


        .def_static("riemann", &window::riemann, py::arg("ntaps"), D(window, riemann))


        .def_static("build",
                    &window::build,
                    py::arg("type"),
                    py::arg("ntaps"),
                    py::arg("beta"),
                    D(window, build))

        ;


    py::enum_<gr::fft::window::win_type>(m, "win_type")
        .value("WIN_HAMMING", gr::fft::window::WIN_HAMMING)                 // 0
        .value("WIN_HANN", gr::fft::window::WIN_HANN)                       // 1
        .value("WIN_BLACKMAN", gr::fft::window::WIN_BLACKMAN)               // 2
        .value("WIN_RECTANGULAR", gr::fft::window::WIN_RECTANGULAR)         // 3
        .value("WIN_KAISER", gr::fft::window::WIN_KAISER)                   // 4
        .value("WIN_BLACKMAN_hARRIS", gr::fft::window::WIN_BLACKMAN_hARRIS) // 5
        .value("WIN_BLACKMAN_HARRIS", gr::fft::window::WIN_BLACKMAN_HARRIS) // 5
        .value("WIN_BARTLETT", gr::fft::window::WIN_BARTLETT)               // 6
        .value("WIN_FLATTOP", gr::fft::window::WIN_FLATTOP)                 // 7
        .export_values();
}