Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 10 Dec 2017, 20:46
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Engineering/Science/Simulation
Mayavi2 3d example
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [1 Post]  
Author Message
edmont

Joined: 19 Nov 2012
Posts: 41

PostPosted: Thu 07 Dec 2017, 12:58    Post subject:  Mayavi2 3d example
Subject description: 3d frequency shown .
 

This is a non trivial example of how to use Mayavi2 , from a python script ,
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:


#
#        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()




Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [1 Post]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Engineering/Science/Simulation
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0249s ][ Queries: 14 (0.0055s) ][ GZIP on ]