forked from SciSharp/Numpy.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnp.window.gen.cs
More file actions
300 lines (291 loc) · 11.4 KB
/
np.window.gen.cs
File metadata and controls
300 lines (291 loc) · 11.4 KB
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp)
// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Python.Runtime;
using Numpy.Models;
#if PYTHON_INCLUDED
using Python.Included;
#endif
namespace Numpy
{
public static partial class np
{
/// <summary>
/// Return the Bartlett window.<br></br>
///
/// The Bartlett window is very similar to a triangular window, except
/// that the end points are at zero.<br></br>
/// It is often used in signal
/// processing for tapering a signal, without generating too much
/// ripple in the frequency domain.<br></br>
///
/// Notes
///
/// The Bartlett window is defined as
///
/// Most references to the Bartlett window come from the signal
/// processing literature, where it is used as one of many windowing
/// functions for smoothing values.<br></br>
/// Note that convolution with this
/// window produces linear interpolation.<br></br>
/// It is also known as an
/// apodization (which means”removing the foot”, i.e.<br></br>
/// smoothing
/// discontinuities at the beginning and end of the sampled signal) or
/// tapering function.<br></br>
/// The fourier transform of the Bartlett is the product
/// of two sinc functions.<br></br>
///
/// Note the excellent discussion in Kanasewich.<br></br>
///
/// References
/// </summary>
/// <param name="M">
/// Number of points in the output window.<br></br>
/// If zero or less, an
/// empty array is returned.
/// </param>
/// <returns>
/// The triangular window, with the maximum value normalized to one
/// (the value one appears only if the number of samples is odd), with
/// the first and last samples equal to zero.
/// </returns>
public static NDarray bartlett(int M)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
M,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("bartlett", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Return the Blackman window.<br></br>
///
/// The Blackman window is a taper formed by using the first three
/// terms of a summation of cosines.<br></br>
/// It was designed to have close to the
/// minimal leakage possible.<br></br>
/// It is close to optimal, only slightly worse
/// than a Kaiser window.<br></br>
///
/// Notes
///
/// The Blackman window is defined as
///
/// Most references to the Blackman window come from the signal processing
/// literature, where it is used as one of many windowing functions for
/// smoothing values.<br></br>
/// It is also known as an apodization (which means
/// “removing the foot”, i.e.<br></br>
/// smoothing discontinuities at the beginning
/// and end of the sampled signal) or tapering function.<br></br>
/// It is known as a
/// “near optimal” tapering function, almost as good (by some measures)
/// as the kaiser window.<br></br>
///
/// References
///
/// Blackman, R.B.<br></br>
/// and Tukey, J.W., (1958) The measurement of power spectra,
/// Dover Publications, New York.<br></br>
///
/// Oppenheim, A.V., and R.W.<br></br>
/// Schafer.<br></br>
/// Discrete-Time Signal Processing.<br></br>
///
/// Upper Saddle River, NJ: Prentice-Hall, 1999, pp.<br></br>
/// 468-471.
/// </summary>
/// <param name="M">
/// Number of points in the output window.<br></br>
/// If zero or less, an empty
/// array is returned.
/// </param>
/// <returns>
/// The window, with the maximum value normalized to one (the value one
/// appears only if the number of samples is odd).
/// </returns>
public static NDarray blackman(int M)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
M,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("blackman", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Return the Hamming window.<br></br>
///
/// The Hamming window is a taper formed by using a weighted cosine.<br></br>
///
/// Notes
///
/// The Hamming window is defined as
///
/// The Hamming was named for R.<br></br>
/// W.<br></br>
/// Hamming, an associate of J.<br></br>
/// W.<br></br>
/// Tukey
/// and is described in Blackman and Tukey.<br></br>
/// It was recommended for
/// smoothing the truncated autocovariance function in the time domain.<br></br>
///
/// Most references to the Hamming window come from the signal processing
/// literature, where it is used as one of many windowing functions for
/// smoothing values.<br></br>
/// It is also known as an apodization (which means
/// “removing the foot”, i.e.<br></br>
/// smoothing discontinuities at the beginning
/// and end of the sampled signal) or tapering function.<br></br>
///
/// References
/// </summary>
/// <param name="M">
/// Number of points in the output window.<br></br>
/// If zero or less, an
/// empty array is returned.
/// </param>
/// <returns>
/// The window, with the maximum value normalized to one (the value
/// one appears only if the number of samples is odd).
/// </returns>
public static NDarray hamming(int M)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
M,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("hamming", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Return the Hanning window.<br></br>
///
/// The Hanning window is a taper formed by using a weighted cosine.<br></br>
///
/// Notes
///
/// The Hanning window is defined as
///
/// The Hanning was named for Julius von Hann, an Austrian meteorologist.<br></br>
///
/// It is also known as the Cosine Bell.<br></br>
/// Some authors prefer that it be
/// called a Hann window, to help avoid confusion with the very similar
/// Hamming window.<br></br>
///
/// Most references to the Hanning window come from the signal processing
/// literature, where it is used as one of many windowing functions for
/// smoothing values.<br></br>
/// It is also known as an apodization (which means
/// “removing the foot”, i.e.<br></br>
/// smoothing discontinuities at the beginning
/// and end of the sampled signal) or tapering function.<br></br>
///
/// References
/// </summary>
/// <param name="M">
/// Number of points in the output window.<br></br>
/// If zero or less, an
/// empty array is returned.
/// </param>
/// <returns>
/// The window, with the maximum value normalized to one (the value
/// one appears only if M is odd).
/// </returns>
public static NDarray hanning(int M)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
M,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("hanning", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
/// <summary>
/// Return the Kaiser window.<br></br>
///
/// The Kaiser window is a taper formed by using a Bessel function.<br></br>
///
/// Notes
///
/// The Kaiser window is defined as
///
/// with
///
/// where is the modified zeroth-order Bessel function.<br></br>
///
/// The Kaiser was named for Jim Kaiser, who discovered a simple
/// approximation to the DPSS window based on Bessel functions.<br></br>
/// The Kaiser
/// window is a very good approximation to the Digital Prolate Spheroidal
/// Sequence, or Slepian window, which is the transform which maximizes the
/// energy in the main lobe of the window relative to total energy.<br></br>
///
/// The Kaiser can approximate many other windows by varying the beta
/// parameter.<br></br>
///
/// A beta value of 14 is probably a good starting point.<br></br>
/// Note that as beta
/// gets large, the window narrows, and so the number of samples needs to be
/// large enough to sample the increasingly narrow spike, otherwise NaNs will
/// get returned.<br></br>
///
/// Most references to the Kaiser window come from the signal processing
/// literature, where it is used as one of many windowing functions for
/// smoothing values.<br></br>
/// It is also known as an apodization (which means
/// “removing the foot”, i.e.<br></br>
/// smoothing discontinuities at the beginning
/// and end of the sampled signal) or tapering function.<br></br>
///
/// References
/// </summary>
/// <param name="M">
/// Number of points in the output window.<br></br>
/// If zero or less, an
/// empty array is returned.
/// </param>
/// <param name="beta">
/// Shape parameter for window.
/// </param>
/// <returns>
/// The window, with the maximum value normalized to one (the value
/// one appears only if the number of samples is odd).
/// </returns>
public static NDarray kaiser(int M, float beta)
{
//auto-generated code, do not change
var __self__=self;
var pyargs=ToTuple(new object[]
{
M,
beta,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("kaiser", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
}
}