Version 11 (modified by 10 years ago) ( diff ) | ,
---|
Under construction
Visualizing External Data in Shape
As 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.
Shape can read and visualize 3D simulations. However make sure that the columns in your ASCII file are converted to a 3D Cartesian coordinate system. You will need a minimum of 7 columns, of the form: px, py, pz, vx, vy, vz, n
. Where all pi
are the positions in (x, y, z)
, all vi
are the respective velocities, and n
is the density. One can also have a column for temperature T
, and pressure P
. Unlike VisIt, where you visualize the time evolution of a simulation frame-by-frame, Shape will only require one frame to be visualized. In Shape, you can rotate it and study the morphology at that instant. It may be best to visualize with VisIt first, pick your frame, and then convert it to ASCII. See the Before Starting section for more on this.
Remember that Shape's goal is to be a software that reduces restrictions on physical assumptions so that astronomers can make a realistic reconstruction of an astrophysical object's morphology. Thus the software is useful for defining 3D structural elements to create a model that can be optimized to fit an observation. Here, by importing external data, we are approaching from the opposite angle. We are using a code to generate a simulation of an object, or phenomena, that is comparable to actual astrophysical objects. In Shape we can then visualize, and compare these simulations more easily with observation. Expect the animations you make with Shape to not look as defined as those one could make in VisIt with the same simulation, as they are meant to look like emission maps.
Links
In this tutorial in visualizing external data in Shape, we will be visualizing a sphere generated by the following script:
Pseudo-Data Generator (python)
import random from math import pi,sin,cos #Creating Sphere Dataz def createSphere(r=5, N=100): lst = [] for phi in [(pi*i)/(N-1) for i in range(N)]: M = int(sin(phi)*(N-1))+1 for theta in [(2*pi*i)/M for i in range(M)]: x = r * sin(phi) * cos(theta) y = r * sin(phi) * sin(theta) z = r * cos(phi) lst.append((x, y, z)) return lst #Opens/creates new ascii file outfile = open("test_sphere_7col.dat", "w") #Writes the data to the file for x,y,z in createSphere(): rho = random.random()*1000000 vx = random.random()*10 vy = random.random()*100 vz = random.random() print("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}".format(x,y,z,vx,vy,vz,rho), file=outfile) #Closes the file outfile.close()
a 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.
Before Starting
- Make sure your simulation is in ASCII form. Hopefully you will find this guide on how to convert HDF5 to ASCII helpful.
- (Currently Subjected to Testing) The basic format you will want for your ASCII file is a series of 7 columns minimum. They will be of the form:
px,py,pz,vx,vy,vz,n
, the Cartesian coordinates of position, velocity and the density.
- Import the data into Excel. Take the averages of all of the columns. You can open the file in terminal and scroll to the bottom to determine how many lines there are. You will use these values later to center your data.
- Once you have looked at your data to see what format it is in (number of columns, delimiters), and gotten the averages for each column, you can open Shape.
- Create a new project: File → New.
- Click on the 3D Module, it looks like a 2x2x2 cube.
3D Module
Physics Module
Render Module
Attachments (39)
-
SHAPE00000.dat
(5.9 MB
) - added by 10 years ago.
ascii data — frame 0, initial conditions
-
SHAPE00022.dat
(647.3 KB
) - added by 10 years ago.
ascii data — frame 22
- Screen Shot 2015-06-16 at 11.47.22.png (111.1 KB ) - added by 10 years ago.
-
test_sphere_7col.dat
(804.1 KB
) - added by 10 years ago.
ascii data — a sphere
- Screen Shot 2015-06-16 at 13.20.02.png (133.0 KB ) - added by 10 years ago.
- Screen Shot 2015-06-16 at 13.20.28.png (254.6 KB ) - added by 10 years ago.
- Screen Shot 2015-06-16 at 13.20.57.png (245.5 KB ) - added by 10 years ago.
- Screen Shot 2015-06-16 at 13.23.32.png (72.5 KB ) - added by 10 years ago.
- Screen Shot 2015-06-16 at 13.23.50.png (242.8 KB ) - added by 10 years ago.
- Screen Shot 2015-06-16 at 13.24.19.png (250.8 KB ) - added by 10 years ago.
- Screen Shot 2015-06-16 at 13.24.31.png (82.6 KB ) - added by 10 years ago.
- Screen Shot 2015-06-16 at 13.24.45.png (10.4 KB ) - added by 10 years ago.
- Screen Shot 2015-06-16 at 13.25.03.png (82.8 KB ) - added by 10 years ago.
- Screen Shot 2015-06-16 at 13.25.24.png (39.0 KB ) - added by 10 years ago.
- Screen Shot 2015-06-16 at 13.26.17.png (39.3 KB ) - added by 10 years ago.
- Screen Shot 2015-06-16 at 13.26.28.png (36.6 KB ) - added by 10 years ago.
- Screen Shot 2015-06-16 at 13.26.42.png (22.9 KB ) - added by 10 years ago.
- Screen Shot 2015-06-16 at 13.28.58.png (308.5 KB ) - added by 10 years ago.
- Screen Shot 2015-07-13 at 14.57.28.png (99.5 KB ) - added by 10 years ago.
- Screen Shot 2015-06-16 at 13.26.56-new.png (27.4 KB ) - added by 10 years ago.
- Screen Shot 2015-07-13 at 15.02.22.png (160.3 KB ) - added by 10 years ago.
- Screen Shot 2015-06-16 at 13.28.02-new.png (249.5 KB ) - added by 10 years ago.
- Screen Shot 2015-07-13 at 15.09.42.png (249.8 KB ) - added by 10 years ago.
- Screen Shot 2015-07-13 at 15.10.06.png (23.6 KB ) - added by 10 years ago.
- Screen Shot 2015-07-13 at 15.10.18.png (24.0 KB ) - added by 10 years ago.
-
3d.png
(5.1 KB
) - added by 10 years ago.
3d module icon
-
physics.png
(5.0 KB
) - added by 10 years ago.
physics module icon
- render.png (4.2 KB ) - added by 10 years ago.
- Screen Shot 2015-07-13 at 16.40.11.png (230.1 KB ) - added by 10 years ago.
- Screen Shot 2015-07-13 at 16.43.06.png (120.4 KB ) - added by 10 years ago.
- Screen Shot 2015-07-13 at 17.28.25.png (36.5 KB ) - added by 10 years ago.
- Screen Shot 2015-07-13 at 17.28.40.png (35.9 KB ) - added by 10 years ago.
- Screen Shot 2015-07-13 at 17.28.53.png (28.3 KB ) - added by 10 years ago.
- Screen Shot 2015-07-13 at 17.29.02.png (23.6 KB ) - added by 10 years ago.
- Screen Shot 2015-07-13 at 17.29.10.png (34.1 KB ) - added by 10 years ago.
- Screen Shot 2015-07-13 at 17.29.37.png (22.8 KB ) - added by 10 years ago.
- Screen Shot 2015-07-13 at 17.29.45.png (24.7 KB ) - added by 10 years ago.
- Screen Shot 2015-07-13 at 17.29.54.png (6.6 KB ) - added by 10 years ago.
- Screen Shot 2015-07-13 at 17.30.03.png (153.5 KB ) - added by 10 years ago.