to display a fairly large amount of data .
Not certain how long this will take on your machine , you might want to
change the number of samples from 64 to 32 .
This runs okay with python 2.7.x.x .
Code: Select all
#
# fftc3d.py
#
# (c) 2017 , edmont , sciwiseg@gmail.com
#
#
# Three dimensional plot of centered 3d fft .
#
#
#
import numpy as np
from mayavi.mlab import *
n=64
a = np.zeros((n, n, n))
#
# Spacial domain 3d data , this represents a cube .
#
for i in range(0 , n/6):
for j in range(0,n/4):
for k in range(0,n/2):
a[i,j,k] = 1
b = np.fft.fftn(a)
c = np.abs(b)
c = np.fft.fftshift(c)
#
# Frequency domain 3d data .
#
# With a more complicated result use a lower number of contours .
#
#
obj = contour3d(c, contours=40, transparent=True,opacity=0.5)
from mayavi import mlab
mlab.show()