Changes between Version 10 and Version 11 of Shape/ExternalData


Ignore:
Timestamp:
06/16/15 13:10:41 (10 years ago)
Author:
madams
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Shape/ExternalData

    v10 v11  
    11> Under construction
    22= Visualizing External Data in Shape =
     3
     4[[PageOutline]]
    35
    46As we know very well, AstroBEAR generates simulations in HDF5 (Hierarchical Data Format), i.e. Chombo, files. As far as we know Shape has not yet been developed to import HDF5. Currently it accepts ASCII files. Therefore the simulations you want to visualize will need to be in ASCII form.
     
    1315
    1416* [https://www.youtube.com/watch?v=ckfQ2RBQ7NI Shape Developers' YouTube Tutorial on External Data Visualization]
     17
     18
     19----
     20
     21In this tutorial in visualizing external data in Shape, we will be visualizing a sphere generated by the following script:
     22
     23[[CollapsibleStart(Pseudo-Data Generator (python))]]
     24{{{
     25import random
     26from math import pi,sin,cos
     27
     28#Creating Sphere Dataz                                                                                                         
     29def createSphere(r=5, N=100):
     30    lst = []
     31    for phi in [(pi*i)/(N-1) for i in range(N)]:
     32        M = int(sin(phi)*(N-1))+1
     33        for theta in [(2*pi*i)/M for i in range(M)]:
     34            x = r * sin(phi) * cos(theta)
     35            y = r * sin(phi) * sin(theta)
     36            z = r * cos(phi)
     37            lst.append((x, y, z))
     38    return lst
     39
     40#Opens/creates new ascii file                                                                                                 
     41outfile = open("test_sphere_7col.dat", "w")
     42
     43#Writes the data to the file                                                                                                   
     44for x,y,z in createSphere():
     45    rho = random.random()*1000000
     46    vx = random.random()*10
     47    vy = random.random()*100
     48    vz = random.random()                                                                                                     
     49    print("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}".format(x,y,z,vx,vy,vz,rho), file=outfile)
     50
     51#Closes the file                                                                                                               
     52outfile.close()
     53}}}
     54[[CollapsibleEnd]]
     55
     56a file generated by the script can be found in the attachments, titled ''test_sphere_7col.dat''. In the following sections you'll observe how we come to visualize its "emission map." We suggest downloading the attachment and following along with the tutorial.
    1557
    1658== Before Starting ==