Hi,(adsbygoogle = window.adsbygoogle || []).push({});

My aim is to get a series of images in 2D space that run over different timestamps and put them through a 3D Fourier Transform. So my 3D FT has 2 spatial axes and one temporal axis. However I have never done anything like this before, and I have a very basic knowledge of Python.

So far, I can do the FFT for a list (or 1D array) of point sources as follows:

##

# Import libs

import matplotlib.pyplot as plt

import numpy as np

# create point sources

tmp = range(100)

source = [0 for x in tmp]

source.insert(50,1)

source.insert(5,1)

source.insert(60,0.5)

# make t useable later

t = np.array(source)

# equations for later

f = np.fft.fft(t)

g = np.sqrt(np.abs(f)**2)

# set up plot

fig = plt.figure()

# add sources to plot

ax1 = fig.add_subplot(211)

plt.plot(source)

ax1.set_title('Source')

ax1.xaxis.set_visible(False)

# add FT of sources to plot

ax2 = fig.add_subplot(212)

plt.plot(f)

ax2.set_title('Fourier Transform')

ax2.xaxis.set_visible(False)

# show plot

plt.show()

##

Now I would like to turn my 1D image into a 2D image, and I just can't work out how to do this. I've tried by doing something like this for my point sources:

##

# Array of 3 source lists

# Create list of lists - seems dodgy

tmp_array = range(3)

array_list = []

# create source lists to go in array

tmp = range(10)

source1 = [0 for x in tmp]

source1.insert(5,1)

source2 = [0 for x in tmp]

source2.insert(4,1)

source3 = [0 for x in tmp]

source3.insert(2,1)

# put lists in array

array_list.insert(1,source1)

array_list.insert(2,source2)

array_list.insert(3,source3)

##

Though calling it "source" instead of "array_list" would fit better with previous code.

However it is not working and I cannot figure out why.

I was also wandering if I need to bother with getting the 2D FT working before trying the 3D, or if I can just jump forward? Not that I have any idea how to do that yet.

Thank you for your help

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Python ND Fourier Transform in Python

**Physics Forums | Science Articles, Homework Help, Discussion**