V3D - Volumetric 3D Modeling

 

Summary

The v3d routines, v3d.sl (version 1.2.1) provide a way to define and visualize 3D cubes of scalar values, with application to volume-filling geometries. The v3d routines described here are basic building blocks and can be used in a variety of contexts. The routines are written in S-Lang and can be added to S-Lang-based systems, e.g., ISIS, with the usual commands: require("v3d") or ()=evalfile("v3d.sl").

Docmentation on the routines is available in this v3d Command Reference document as well as in the comments in the source file v3d.sl. At the command line ``v3d_help;'' will list a brief summary of the available routines; typing a routine's name without arguments will generally give a very brief usage message.

Applications

In an astrophysical modeling context, the scalar values in the 3D array can represent a local physical quantity that gives rise to observed emission. As an example, for thermal X-rays the product n_e*n_i fulfills this role at the local level and is related to the overall ``emission measure'' or ``norm'' of the model. In this way, the v3d routines are used to defined the geometric properties of model components as part of the X-ray-focussed modeling and analysis system:

Other smaller and more custom examples of using v3d routines are (i) as a front-end for Chandra's MARX simulator, and (ii) as part of a custom isis model:

These example also shows how the use of S-Lang allows for convenient user customization and extension.

The remainder of this page provides examples of the v3d routines and their capabilities.



An Astrophysical Geometry Example

The 20-year-old supernova remnant, SNR 1987A, is made up of several geometric components as shown here in solid cross-section (left) and projected on the sky (right.) These include: the expanding SN ejecta (purple), the dense ``inner ring'' with protrusions (red), the torus-like HII region around the ring (green) and an expanding blastwave out of the equatorial plane (blue). The images were created with the commands in:

87A-sliced
v3d_view, uses volview()
87A-projected
v3d_project, uses imdisplay()


Monte Carlo ``events'' with Doppler Effects

Routines are provided to generate Monte Carlo (MC) samples from a v3d volume array with the probability of the event proportional to the values of the array cell. The set of 3D locations, ``points'', created can be used as input to a ray-trace code. A routine is provided to calculate Line-of-sight Doppler shifts (photon energy factors) based on a velocity field for the points.

The v3d routines also provide a primative event-imaging capapility which can show the events color-coded by the Doppler velocity. The simple examples below were made with the commands in v3dex_mc_vels.sl.
V3D_demo/v3dex_mcvels_view.png
Solid 3D view
V3D_demo/v3dex_mcvels_evtimg.png
MC events on sky
V3D_demo/v3dex_mcvels_vtype0.png
vtype=0
const*r_hat
V3D_demo/v3dex_mcvels_vtype1.png
vtype=1
const*r_vec
V3D_demo/v3dex_mcvels_vtype2.png
vtype=2
rigid rotation
|v| ~ r
V3D_demo/v3dex_mcvels_vtype3.png
vtype=3
Kepler rotation
|v| ~ 1/sqrt(r)


Some other examples...

Some other example images and the files used to create them are given here:
V3D_demo/v3dex_HydraA_project.png
Hydra A model
v3dex_HydraA.sl
V3D_demo/v3dex_myst06_view.png
Mystery object
v3dex_myst06.sl
V3D_demo/v3dex_e0102_evtimg.png
SNR E0102, Ne X
v3dex_e0102.sl
V3D_demo/jed3d_random_view.png
A complex shape
jed3d.sl : j , E , d




Basic V3D Routines

Below are examples of some basic shapes available in the v3d.sl routines; these examples were made with the code-snippets indicated and given in full in v3d_shape_demo.sl .
v3d_sphere
v3d_sphere (20.0, 40.0, [20.,40.,20.]) +
v3d_sphere (0.0, 20.0, [0.,0.,-50.0])
v3d_sphere_view v3d_sphere_project

v3d_spheroid
v3d_spheroid (40.0, 50.0, 1.8, ,[-20.0,70.]) v3d_spheroid_view v3d_spheroid_project

v3d_cylinder
v3d_cylinder (10.0,20.0, 0.0,80.0, , [290.0,0.0]) +
v3d_cylinder (40.0, 90.0, -10.0, 10.0, ,[-55.0, -30.0])
v3d_cylinder_view v3d_cylinder_project

v3d_cone
v3d_cone (20.0, 30.0, 30.0, 80.0, , [-40.,-10.]) +
2.0* v3d_cone (0.0, 3.0, -200.0,200.0, , [50.0,60.0] )
v3d_cone_view v3d_cone_project

v3d_torus
( v3d_torus (30.0,70.0, [20.0,0.,0.],[-40.,10.0]) -
v3d_torus (45.0,55.0, [20.,0.,0.], [-40.,10.0]) ) +
v3d_torus (30.0,50.0, [-10.,0.,40.], [140.0,80.0])
v3d_torus_view v3d_torus_project

v3d_cube-slice
v3d_cube (100.0,[-70.,0.,-100.]) *
v3d_sphere (50.0,80.0)
v3d_cube-slice_view v3d_cube-slice_project

v3d_roche
v3d_roche (90., 0.333, 1.0, [-75.0,0.,.0],[0.0,0.0]) +
( v3d_roche (90., 3.0, 1.0, [15.0,0.,0.0],[180.0,0.0]) -
v3d_sphere (0.0, 20.0, [15.0,0.,0.0]) )
v3d_roche_view v3d_roche_project

v3d_sphere_ring
v3d_sphere_ring (70.0, 5.0, 17, , [260.0, -44.0]) v3d_sphere_ring_view v3d_sphere_ring_project

v3d_sphere_rlup
v3d_sphere_rlup (1.0,90.0, [0.0,3.0,10.0,30.0,100.0], [10.0,5.0,1.0,3.0,0.5]) v3d_sphere_rlup_view v3d_sphere_rlup_project

v3d_cyl_azlup
v3d_cyl_azlup (70.0, 90.0, -40.0, 40.0, , [-70.0,30.0], azlups,vlups)
with:
azlups = 9.0*[-10:20:1];
vlups = 0.3 + cos(5.0*azlups*PI/180.0)^2;
v3d_cyl_azlup_view v3d_cyl_azlup_project

v3d_2dto3d
v3d_2dto3d (arr2d, 20.0, 90.0, , [-20.0, 30.0])
with
arr2d = Float_Type [91,100];
% from 0 to 10 degrees: 1/5 radius:
arr2d[[0:9],[0:20]] = 1.0;
% from 10 to 45 degrees: 1/2 radius:
arr2d[[10:45],[0:49]] = 1.0;
% from 46 to 90 degrees: full radius:
arr2d[[46:90],*] = 1.0;
v3d_2dto3d_view v3d_2dto3d_project

v3d_2dto3d-RT-hydro
v3d_2dto3d (arrRT, 22.0, 90.0, , [90.0,80.0])
with:
arr2d = h5_read("wrbub_1026.h5");
...etc...
v3d_2dto3d-RT-hydro_view v3d_2dto3d-RT-hydro_project

v3d_r3dsq
10.0*(1./30.0^3)* exp(-1.0*v3d_r3dsq([0.,0.,0.]) /(30.0^2)) +
(1./10.^3)* exp(-1.0* v3d_r3dsq([60.,50.,30.]) /(10.0^2))
v3d_r3dsq_view v3d_r3dsq_project

v3d_f_generic
v3d_f_generic ("custom function", , [-25.0,15.0])

Here, values = (cos(3.0*azimuth))^2 * (sin(5.0*lattitude))^2 * exp(-1.0*rad3dsq/(40.0)^2);
v3d_f_generic_view v3d_f_generic_project

v3d_histxy
% v3d_histxy: bin x, y values into the central (z=0) x-y plane of the cube:
e0102_flat = v3d_histxy (e2d_data[15].dxs, e2d_data[15].dys);

The above line was executed after doing:
e2di=15;
e2d_load_data("../Data/obs_3828/evt2", "X", "Y", [4094.1,4166.1], [0,0], [0.5,5.0]);
v3d_setup(25.0, 27);
v3d_histxy_view v3d_histxy_project

v3d_reproject
% continuing from the e0102_flat array above,
% make it 3D by reprojecting it to a sphere:
e0102_sphere = v3d_reproject (e0102_flat, v3d_sphere(20.0,25.0));

v3d_reproject_view v3d_reproject_project