def find_freq(wvec, freq_val):
    """
        Helper function returns the nearest index to the frequency point (freq_val)
    """
    return min(range(len(wvec)), key=lambda i: abs(wvec[i]-freq_val))