leakage

command
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2024 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Overview

The leakage program provides summary characteristics and a plot of spectral response for window functions or csv input. It is intended to be used to verify window behaviour against foreign implementations. For example, the behavior of a NumPy window can be captured using this python code:

import matplotlib.pyplot as plt
import numpy as np
from numpy.fft import fft

window = np.blackman(20)
print("# beta = %f" % np.mean(window))

plt.figure()

A = fft(window, 1000)
mag = np.abs(A)
with np.errstate(divide='ignore', invalid='ignore'):
    mag = 20 * np.log10(mag)
mag -= max(mag)
freq = np.linspace(0, len(window)/2, len(A)/2)

for m in mag[:len(mag)/2]:
	print(m)

plt.plot(freq, mag[:len(mag)/2])
plt.title("Spectral leakage")
plt.ylabel("Amplitude (dB)")
plt.xlabel("DFT bin")

plt.show()

and then be exported to leakage and compared with the Gonum implementation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL