Hello I am trying to do a Fourier transform on some data using Python, but I have difficulty understanding much of the mathematics & code behind it. From my limited understanding, I know a Fourier transform is essentially another way to look at a function. It's the sum of several sin waves that come together to make another representation of the original function.
I have an x & y list each with data from a text file. The x data represents time in years, and the y data represents data from tree rings over that course of time. How do I go about doing the fft using the data from my x & y lists? Every example I see creates random points to do an fft, but I don't think I need to do this if I already have the data? Any assistance would be appreciated. I've attached what my code looks like as well as a photo of the graph from my data.
from scipy import stats
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import linregress
# Define Empty List for data
x = [] # Years from 1906 - 2005
y = [] # Tree Ring Data 1906 - 2005
# Load Data & Append to Empty Lists
for num in np.loadtxt('Years_Observed.txt'):
x.append(num)
for num in np.loadtxt('Flow_Observed.txt'):
y.append(num)
# Adjust Size and dpi of Graph
fig = plt.figure(figsize=(15,6), dpi=100)
# Graph Title
plt.title("Tree Ring Data From 1906 to 2005")
# X & Y Axis Labels
plt.xlabel("Year")
plt.ylabel("Streamflow of Colorado River (Millions Acre/ft)")
plt.scatter(x, y, label = 'Tree Ring Data')
plt.legend()
plt.show()
What I'm working with: