import numpy as np
import scipy
from matplotlib import pyplot as plt

def main():
    # Design some filter coefficients
    n_taps = 33
    cutoff = 1 / 2
    filt_coeffs = scipy.signal.firwin(n_taps, cutoff)
    nfft = 1024
    filt_resp = np.fft.fft(filt_coeffs, nfft)
    filt_resp = np.fft.fftshift(filt_resp)

    freq_axis = (np.arange(nfft) - (nfft/2)) / nfft

    plt.figure()
    plt.plot(freq_axis, 20*np.log10(np.abs(filt_resp)))
    plt.ylabel('dB')
    plt.xlabel('Normalized Frequency')
    plt.title('Filter Response')
    plt.grid()
    plt.show()

if __name__ == '__main__':

    main()
