Back to godoc.org
gonum.org/v1/gonum / dsp / window

# Package window

v0.7.0
Latest Go to latest
Published: Feb 26, 2020 | License: | Module:

## Overview ¶

Package window provides a set of functions to perform the transformation of sequence by different window functions.

Window functions can be used to control spectral leakage parameters when performing a Fourier transform on a signal of limited length. See https://en.wikipedia.org/wiki/Window_function for more details.

### Spectral leakage parameters¶

Application of window functions to an input will result in changes to the frequency content of the signal in an effect called spectral leakage. See https://en.wikipedia.org/wiki/Spectral_leakage.

The characteristic changes associated with each window function may be described using a set of spectral leakage parameters; β, ΔF_0, ΔF_0.5, K and ɣ_max.

The β, attenuation, coefficient of a window is the ratio of the constant component of the spectrum resulting from use of the window compared to that produced using the rectangular window, expressed in a logarithmic scale.

```β_w = 20 log10(A_w / A_rect) dB
```

The ΔF_0 parameter describes the normalized width of the main lobe of the frequency spectrum at zero amplitude.

The ΔF_0.5 parameter describes the normalized width of the main lobe of the frequency spectrum at -3 dB (half maximum amplitude).

The K parameter describes the relative width of the main lobe of the frequency spectrum produced by the window compared with the rectangular window. The rectangular window has the lowest ΔF_0 at a value of 2.

```K_w = ΔF_0_w/ΔF_0_rect.
```

The value of K divides windows into high resolution windows (K≤3) and low resolution windows (K>3).

The ɣ_max parameter is the maximum level of the side lobes of the normalized spectrum, in decibels.

### Window interval¶

The window intervals used in the window functions are offset by a half to ensure that the window extends to exclude the flanking zeros.

Example

Code:

```src := make([]float64, 20)
k := 5 * math.Pi / float64(len(src)-1)
for i := range src {
src[i] = math.Sin(k * float64(i))
}

fft := fourier.NewFFT(len(src))
coeff := fft.Coefficients(nil, src)

fmt.Println("Rectangular window (or no window):")
for i, c := range coeff {
fmt.Printf("freq=%.4f\tcycles/period, magnitude=%.4f,\tphase=%.4f\n",
fft.Freq(i), cmplx.Abs(c), cmplx.Phase(c))
}

fft = fourier.NewFFT(len(src))
coeff = fft.Coefficients(nil, window.Hamming(src))

fmt.Println("Hamming window:")

amplifier := math.Pow(10, 5.37/20.0)
for i, c := range coeff {
fmt.Printf("freq=%.4f\tcycles/period, magnitude=%.4f,\tphase=%.4f\n",
fft.Freq(i), amplifier*cmplx.Abs(c), cmplx.Phase(c))
}
```
```
Rectangular window (or no window):
freq=0.0000	cycles/period, magnitude=2.2798,	phase=0.0000
freq=0.0500	cycles/period, magnitude=2.6542,	phase=0.1571
freq=0.1000	cycles/period, magnitude=5.3115,	phase=0.3142
freq=0.1500	cycles/period, magnitude=7.3247,	phase=-2.6704
freq=0.2000	cycles/period, magnitude=1.6163,	phase=-2.5133
freq=0.2500	cycles/period, magnitude=0.7681,	phase=-2.3562
freq=0.3000	cycles/period, magnitude=0.4385,	phase=-2.1991
freq=0.3500	cycles/period, magnitude=0.2640,	phase=-2.0420
freq=0.4000	cycles/period, magnitude=0.1530,	phase=-1.8850
freq=0.4500	cycles/period, magnitude=0.0707,	phase=-1.7279
freq=0.5000	cycles/period, magnitude=0.0000,	phase=0.0000
Hamming window:
freq=0.0000	cycles/period, magnitude=0.0506,	phase=0.0000
freq=0.0500	cycles/period, magnitude=0.5386,	phase=-2.9845
freq=0.1000	cycles/period, magnitude=7.3350,	phase=0.3142
freq=0.1500	cycles/period, magnitude=8.9523,	phase=-2.6704
freq=0.2000	cycles/period, magnitude=1.7979,	phase=0.6283
freq=0.2500	cycles/period, magnitude=0.0957,	phase=0.7854
freq=0.3000	cycles/period, magnitude=0.0050,	phase=-2.1991
freq=0.3500	cycles/period, magnitude=0.0158,	phase=-2.0420
freq=0.4000	cycles/period, magnitude=0.0125,	phase=-1.8850
freq=0.4500	cycles/period, magnitude=0.0065,	phase=-1.7279
freq=0.5000	cycles/period, magnitude=0.0000,	phase=0.0000
```

## Index ¶

### func BartlettHann¶

`func BartlettHann(seq []float64) []float64`

BartlettHann modifies seq in place by the Bartlett-Hann window and returns result. See https://en.wikipedia.org/wiki/Window_function#Bartlett%E2%80%93Hann_window and https://www.recordingblogs.com/wiki/bartlett-hann-window for details.

The Bartlett-Hann window is a high-resolution window.

The sequence weights are

```w[k] = 0.62 - 0.48*|(k+1/2)/N-0.5| - 0.38*cos(2*π*(k+1/2)/N),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 4, ΔF_0.5 = 1.45, K = 2, ɣ_max = -35.9, β = -6.

### func BartlettHannComplex¶

`func BartlettHannComplex(seq []complex128) []complex128`

BartlettHannComplex modifies seq in place by the Bartlett-Hann window and returns result. See https://en.wikipedia.org/wiki/Window_function#Bartlett%E2%80%93Hann_window and https://www.recordingblogs.com/wiki/bartlett-hann-window for details.

The Bartlett-Hann window is a high-resolution window.

The sequence weights are

```w[k] = 0.62 - 0.48*|(k+1/2)/N-0.5| - 0.38*cos(2*π*(k+1/2)/N),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 4, ΔF_0.5 = 1.45, K = 2, ɣ_max = -35.9, β = -6.

### func Blackman¶

`func Blackman(seq []float64) []float64`

Blackman modifies seq in place by the Blackman window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Blackman_window and https://www.recordingblogs.com/wiki/blackman-window for details.

The Blackman window is a high-resolution window.

The sequence weights are

```w[k] = 0.42 - 0.5*cos(2*π*(k+1/2)/N) + 0.08*cos(4*π*(k+1/2)/N),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 6, ΔF_0.5 = 1.7, K = 3, ɣ_max = -58, β = -7.54.

### func BlackmanComplex¶

`func BlackmanComplex(seq []complex128) []complex128`

BlackmanComplex modifies seq in place by the Blackman window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Blackman_window and https://www.recordingblogs.com/wiki/blackman-window for details.

The Blackman window is a high-resolution window.

The sequence weights are

```w[k] = 0.42 - 0.5*cos(2*π*(k+1/2)/N) + 0.08*cos(4*π*(k+1/2)/N),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 6, ΔF_0.5 = 1.7, K = 3, ɣ_max = -58, β = -7.54.

### func BlackmanHarris¶

`func BlackmanHarris(seq []float64) []float64`

BlackmanHarris modifies seq in place by the Blackman-Harris window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Blackman%E2%80%93Harris_window and https://www.recordingblogs.com/wiki/blackman-harris-window for details.

The Blackman-Harris window is a low-resolution window.

The sequence weights are

```w[k] = 0.35875 - 0.48829*cos(2*π*(k+1/2)/N) +
0.14128*cos(4*π*(k+1/2)/N) - 0.01168*cos(6*π*(k+1/2)/N),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 8, ΔF_0.5 = 1.97, K = 4, ɣ_max = -92, β = -8.91.

### func BlackmanHarrisComplex¶

`func BlackmanHarrisComplex(seq []complex128) []complex128`

BlackmanHarrisComplex modifies seq in place by the Blackman-Harris window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Blackman%E2%80%93Harris_window and https://www.recordingblogs.com/wiki/blackman-harris-window for details.

The Blackman-Harris window is a low-resolution window.

The sequence weights are

```w[k] = 0.35875 - 0.48829*cos(2*π*(k+1/2)/N) +
0.14128*cos(4*π*(k+1/2)/N) - 0.01168*cos(6*π*(k+1/2)/N),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 8, ΔF_0.5 = 1.97, K = 4, ɣ_max = -92, β = -8.91.

### func BlackmanNuttall¶

`func BlackmanNuttall(seq []float64) []float64`

BlackmanNuttall modifies seq in place by the Blackman-Nuttall window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Blackman%E2%80%93Nuttall_window and https://www.recordingblogs.com/wiki/blackman-nuttall-window for details.

The Blackman-Nuttall window is a low-resolution window.

The sequence weights are

```w[k] = 0.3635819 - 0.4891775*cos(2*π*(k+1/2)/N) + 0.1365995*cos(4*π*(k+1/2)/N) -
0.0106411*cos(6*π*(k+1/2)/N),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 8, ΔF_0.5 = 1.94, K = 4, ɣ_max = -98, β = -8.8.

### func BlackmanNuttallComplex¶

`func BlackmanNuttallComplex(seq []complex128) []complex128`

BlackmanNuttallComplex modifies seq in place by the Blackman-Nuttall window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Blackman%E2%80%93Nuttall_window and https://www.recordingblogs.com/wiki/blackman-nuttall-window for details.

The Blackman-Nuttall window is a low-resolution window.

The sequence weights are

```w[k] = 0.3635819 - 0.4891775*cos(2*π*(k+1/2)/N) + 0.1365995*cos(4*π*(k+1/2)/N) -
0.0106411*cos(6*π*(k+1/2)/N),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 8, ΔF_0.5 = 1.94, K = 4, ɣ_max = -98, β = -8.8.

### func FlatTop¶

`func FlatTop(seq []float64) []float64`

FlatTop modifies seq in place by the Flat Top window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Flat_top_window and https://www.recordingblogs.com/wiki/flat-top-window for details.

The Flat Top window is a low-resolution window.

The sequence weights are

```w[k] = 0.21557895 - 0.41663158*cos(2*π*(k+1/2)/(N-1)) +
0.277263158*cos(4*π*(k+1/2)/N) - 0.083578947*cos(6*π*(k+1/2)/N) +
0.006947368*cos(4*π*(k+1/2)/N),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 10, ΔF_0.5 = 3.72, K = 5, ɣ_max = -93.0, β = -13.34.

### func FlatTopComplex¶

`func FlatTopComplex(seq []complex128) []complex128`

FlatTopComplex modifies seq in place by the Flat Top window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Flat_top_window and https://www.recordingblogs.com/wiki/flat-top-window for details.

The Flat Top window is a low-resolution window.

The sequence weights are

```w[k] = 0.21557895 - 0.41663158*cos(2*π*(k+1/2)/(N-1)) +
0.277263158*cos(4*π*(k+1/2)/N) - 0.083578947*cos(6*π*(k+1/2)/N) +
0.006947368*cos(4*π*(k+1/2)/N),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 10, ΔF_0.5 = 3.72, K = 5, ɣ_max = -93.0, β = -13.34.

### func Hamming¶

`func Hamming(seq []float64) []float64`

Hamming modifies seq in place by the Hamming window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Hann_and_Hamming_windows and https://www.recordingblogs.com/wiki/hamming-window for details.

The Hamming window is a high-resolution window. Among K=2 windows it has the highest ɣ_max.

The sequence weights are

```w[k] = 25/46 - 21/46 * cos(2*π*(k+1/2)/N),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 4, ΔF_0.5 = 1.33, K = 2, ɣ_max = -42, β = -5.37.

Example

Code:

```src := []float64{1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1}

srcCpy := append([]float64(nil), src...)

dst := window.Hamming(srcCpy)

fmt.Printf("src:    %f\n", src)

fmt.Printf("srcCpy: %f\n", srcCpy)

fmt.Printf("dst:    %f\n", dst)
```
```
src:    [1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000]
srcCpy: [0.092577 0.136714 0.220669 0.336222 0.472063 0.614894 0.750735 0.866288 0.950242 0.994379 0.994379 0.950242 0.866288 0.750735 0.614894 0.472063 0.336222 0.220669 0.136714 0.092577]
dst:    [0.092577 0.136714 0.220669 0.336222 0.472063 0.614894 0.750735 0.866288 0.950242 0.994379 0.994379 0.950242 0.866288 0.750735 0.614894 0.472063 0.336222 0.220669 0.136714 0.092577]
```

### func HammingComplex¶

`func HammingComplex(seq []complex128) []complex128`

HammingComplex modifies seq in place by the Hamming window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Hann_and_Hamming_windows and https://www.recordingblogs.com/wiki/hamming-window for details.

The Hamming window is a high-resolution window. Among K=2 windows it has the highest ɣ_max.

The sequence weights are

```w[k] = 25/46 - 21/46 * cos(2*π*(k+1/2)/N),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 4, ΔF_0.5 = 1.33, K = 2, ɣ_max = -42, β = -5.37.

### func Hann¶

`func Hann(seq []float64) []float64`

Hann modifies seq in place by the Hann window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Hann_and_Hamming_windows and https://www.recordingblogs.com/wiki/hann-window for details.

The Hann window is a high-resolution window.

The sequence weights are

```w[k] = 0.5*(1 - cos(2*π*(k+1/2)/N)),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 4, ΔF_0.5 = 1.5, K = 2, ɣ_max = -31.5, β = -6.

### func HannComplex¶

`func HannComplex(seq []complex128) []complex128`

HannComplex modifies seq in place by the Hann window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Hann_and_Hamming_windows and https://www.recordingblogs.com/wiki/hann-window for details.

The Hann window is a high-resolution window.

The sequence weights are

```w[k] = 0.5*(1 - cos(2*π*(k+1/2)/N)),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 4, ΔF_0.5 = 1.5, K = 2, ɣ_max = -31.5, β = -6.

### func Lanczos¶

`func Lanczos(seq []float64) []float64`

Lanczos modifies seq in place by the Lanczos window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Lanczos_window and https://www.recordingblogs.com/wiki/lanczos-window for details.

The Lanczos window is a high-resolution window.

The sequence weights are

```w[k] = sinc(2*(k+1/2)/N - 1),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 3.24, ΔF_0.5 = 1.3, K = 1.62, ɣ_max = -26.4, β = -4.6.

### func LanczosComplex¶

`func LanczosComplex(seq []complex128) []complex128`

LanczosComplex modifies seq in place by the Lanczos window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Lanczos_window and https://www.recordingblogs.com/wiki/lanczos-window for details.

The Lanczos window is a high-resolution window.

The sequence weights are

```w[k] = sinc(2*(k+1/2)/N - 1),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 3.24, ΔF_0.5 = 1.3, K = 1.62, ɣ_max = -26.4, β = -4.6.

### func Nuttall¶

`func Nuttall(seq []float64) []float64`

Nuttall modifies seq in place by the Nuttall window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Nuttall_window,_continuous_first_derivative and https://www.recordingblogs.com/wiki/nuttall-window for details.

The Nuttall window is a low-resolution window.

The sequence weights are

```w[k] = 0.355768 - 0.487396*cos(2*π*(k+1/2)/N) + 0.144232*cos(4*π*(k+1/2)/N) -
0.012604*cos(6*π*(k+1/2)/N),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 8, ΔF_0.5 = 1.98, K = 4, ɣ_max = -93, β = -9.

### func NuttallComplex¶

`func NuttallComplex(seq []complex128) []complex128`

NuttallComplex modifies seq in place by the Nuttall window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Nuttall_window,_continuous_first_derivative and https://www.recordingblogs.com/wiki/nuttall-window for details.

The Nuttall window is a low-resolution window.

The sequence weights are

```w[k] = 0.355768 - 0.487396*cos(2*π*(k+1/2)/N) + 0.144232*cos(4*π*(k+1/2)/N) -
0.012604*cos(6*π*(k+1/2)/N),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 8, ΔF_0.5 = 1.98, K = 4, ɣ_max = -93, β = -9.

### func Rectangular¶

`func Rectangular(seq []float64) []float64`

Rectangular modifies seq in place by the Rectangular window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Rectangular_window and https://www.recordingblogs.com/wiki/rectangular-window for details.

The rectangular window has the lowest width of the main lobe and largest level of the side lobes. The result corresponds to a selection of limited length sequence of values without any modification.

The sequence weights are

```w[k] = 1,
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 2, ΔF_0.5 = 0.89, K = 1, ɣ_max = -13, β = 0.

### func RectangularComplex¶

`func RectangularComplex(seq []complex128) []complex128`

Rectangular modifies seq in place by the Rectangular window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Rectangular_window and https://www.recordingblogs.com/wiki/rectangular-window for details.

The rectangular window has the lowest width of the main lobe and largest level of the side lobes. The result corresponds to a selection of limited length sequence of values without any modification.

The sequence weights are

```w[k] = 1,
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 2, ΔF_0.5 = 0.89, K = 1, ɣ_max = -13, β = 0.

### func Sine¶

`func Sine(seq []float64) []float64`

Sine modifies seq in place by the Sine window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Sine_window and https://www.recordingblogs.com/wiki/sine-window for details.

Sine window is a high-resolution window.

The sequence weights are

```w[k] = sin(π*(k+1/2)/N),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 3, ΔF_0.5 = 1.23, K = 1.5, ɣ_max = -23, β = -3.93.

### func SineComplex¶

`func SineComplex(seq []complex128) []complex128`

SineComplex modifies seq in place by the Sine window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Sine_window and https://www.recordingblogs.com/wiki/sine-window for details.

Sine window is a high-resolution window.

The sequence weights are

```w[k] = sin(π*(k+1/2)/N),
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 3, ΔF_0.5 = 1.23, K = 1.5, ɣ_max = -23, β = -3.93.

### func Triangular¶

`func Triangular(seq []float64) []float64`

Triangular modifies seq in place by the Triangular window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Triangular_window and https://www.recordingblogs.com/wiki/triangular-window for details.

The Triangular window is a high-resolution window.

The sequence weights are

```w[k] = 1 - |(k + 1/2 - N/2)/(N/2)|,
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 4, ΔF_0.5 = 1.33, K = 2, ɣ_max = -26.5, β = -6.

### func TriangularComplex¶

`func TriangularComplex(seq []complex128) []complex128`

TriangularComplex modifies seq in place by the Triangular window and returns the result. See https://en.wikipedia.org/wiki/Window_function#Triangular_window and https://www.recordingblogs.com/wiki/triangular-window for details.

The Triangular window is a high-resolution window.

The sequence weights are

```w[k] = 1 - |(k + 1/2 - N/2)/(N/2)|,
```

for k=0,1,...,N-1 where N is the length of the window.

Spectral leakage parameters: ΔF_0 = 4, ΔF_0.5 = 1.33, K = 2, ɣ_max = -26.5, β = -6.

### type Gaussian¶

```type Gaussian struct {
Sigma float64
}```

Gaussian can modify a sequence by the Gaussian window and return the result. See https://en.wikipedia.org/wiki/Window_function#Gaussian_window and https://www.recordingblogs.com/wiki/gaussian-window for details.

The Gaussian window is an adjustable window.

The sequence weights are

```w[k] = exp(-0.5 * ((k + 1/2 - M)/(σ*M))² ), M = N/2,
```

for k=0,1,...,N-1 where N is the length of the window.

The properties of the window depend on the value of σ (sigma). It can be used as high or low resolution window, depending of the σ value.

Spectral leakage parameters are summarized in the table:

```       |  σ=0.3  |  σ=0.5 |  σ=1.2 |
-------|---------------------------|
ΔF_0   |   8     |   3.4  |   2.2  |
ΔF_0.5 |   1.82  |   1.2  |   0.94 |
K      |   4     |   1.7  |   1.1  |
ɣ_max  | -65     | -31.5  | -15.5  |
β      |  -8.52  |  -4.48 |  -0.96 |
```

### func (Gaussian) Transform¶

`func (g Gaussian) Transform(seq []float64) []float64`

Transform applies the Gaussian transformation to seq in place, using the value of the receiver as the sigma parameter, and returning the result.

### type GaussianComplex¶

```type GaussianComplex struct {
Sigma float64
}```

GaussianComplex can modify a sequence by the Gaussian window and return the result. See https://en.wikipedia.org/wiki/Window_function#Gaussian_window and https://www.recordingblogs.com/wiki/gaussian-window for details.

The Gaussian window is an adjustable window.

The sequence weights are

```w[k] = exp(-0.5 * ((k + 1/2 - M)/(σ*M))² ), M = N/2,
```

for k=0,1,...,N-1 where N is the length of the window.

The properties of the window depend on the value of σ (sigma). It can be used as high or low resolution window, depending of the σ value.

Spectral leakage parameters are summarized in the table:

```       |  σ=0.3  |  σ=0.5 |  σ=1.2 |
-------|---------------------------|
ΔF_0   |   8     |   3.4  |   2.2  |
ΔF_0.5 |   1.82  |   1.2  |   0.94 |
K      |   4     |   1.7  |   1.1  |
ɣ_max  | -65     | -31.5  | -15.5  |
β      |  -8.52  |  -4.48 |  -0.96 |
```

### func (GaussianComplex) Transform¶

`func (g GaussianComplex) Transform(seq []complex128) []complex128`

Transform applies the Gaussian transformation to seq in place, using the value of the receiver as the sigma parameter, and returning the result.

### type Values¶

`type Values []float64`

Values is an arbitrary real window function.

Example

Code:

```src := []float64{1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1}

sine := window.NewValues(window.Sine, len(src))

fmt.Printf("dst: %f\n", sine.Transform(src))
```
```
dst: [0.078459 0.233445 0.382683 0.522499 0.649448 0.760406 0.852640 0.923880 0.972370 0.996917 0.996917 0.972370 0.923880 0.852640 0.760406 0.649448 0.522499 0.382683 0.233445 0.078459]
```

### func NewValues¶

`func NewValues(window func([]float64) []float64, n int) Values`

NewValues returns a Values of length n with weights corresponding to the provided window function.

### func (Values) Transform¶

`func (v Values) Transform(seq []float64) []float64`

Transform applies the weights in the receiver to seq in place, returning the result. If v is nil, Transform is a no-op, otherwise the length of v must match the length of seq.

### type ValuesComplex¶

`type ValuesComplex []complex128`

ValuesComplex is an arbitrary complex window function.

### func NewValuesComplex¶

`func NewValuesComplex(window func([]complex128) []complex128, n int) ValuesComplex`

NewValuesComplex returns a ValuesComplex of length n with weights corresponding to the provided window function.

### func (ValuesComplex) Transform¶

`func (v ValuesComplex) Transform(seq []complex128) []complex128`

Transform applies the weights in the receiver to seq in place, returning the result. If v is nil, Transform is a no-op, otherwise the length of v must match the length of seq.

Documentation was rendered with GOOS=linux and GOARCH=amd64.