Python numpy fft from data file - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: Python numpy fft from data file (/thread-24249.html) |
Python numpy fft from data file - magnet1 - Feb-06-2020 Hello, I'm new to Python and I'm not sure. trying to do a python fft with a data file. It cans plot the data file in the time domain like the code above. set a start time and end time in data.trim to display a plot. Error in numpy's fft function. No friendly explanation found on Google or on any site, Noted similar code but got many errors. Is code simple and is there a simple workaround? data file type is miniseed(mseed) file. from obspy import read, UTCDateTime from numpy as np def check_file(fname) : print("Check : ", fname) data = read(fname) myS = UTCDateTime("2020-01-06T00:30:00") myE = myS + 120 data.trim(myS, myE) ### time domain plot data.plot() ### test1. frequency domain plot. It is error #y = np.fft(data) #y.plot() ### test2. frequency domain plot. error 2 #fftdata = np.fft.fft(data) #frequ = np.fft.fftfreq(len(fftdata)) #plt.plot(frequ,fftdata) #plt.show() check_file('data file') RE: Python numpy fft from data file - magnet1 - Feb-06-2020 (Feb-06-2020, 01:37 AM)magnet1 Wrote: Hello, |