Python Magnitude of FFT Signal

287 Views Asked by At

I want to calculate First HPF and then FFT of an acceleration data for which I use the following code.

# Make Function
def filter(s):
    # Signal after HPF
    fc = 0.1
    b = 0.08
    N = int(np.ceil((4 / b)))
    if not N % 2: N += 1
    n = np.arange(N)

    sinc_func = np.sinc(2 * fc * (n - (N - 1) / 2.))
    window = np.blackman(N)
    sinc_func = sinc_func * window
    sinc_func = sinc_func / np.sum(sinc_func)

    # reverse function
    sinc_func = -sinc_func
    sinc_func[int((N - 1) / 2)] += 1

    #s = list(df[' acc.y'])
    new_signal = np.convolve(s, sinc_func)
    a=np.fft.fft(new_signal)
    return a

The question is this returns an array now I want to calculate the single-valued Magnitude of this Numpy ie I need the Magnitude for the signal whose FFT i calculate

0

There are 0 best solutions below