VoidRender API
VoidRender for VoidFinder
load_galaxy_data
- vast.voidfinder.viz.load_galaxy_data(infilename)[source]
Load a table of galaxies for use in VoidRender
- Parameters
- infilenamestring
path to desired data file intended to be an astropy table output from VoidFinder with columns ‘ra’, ‘dec’, ‘redshift’, and possibly ‘Rgal’
- Returns
- galaxy_data_xyznumpy.ndarray shape (N,3)
xyz coordinates of galaxies from the data table
load_void_data
- vast.voidfinder.viz.load_void_data(infilename)[source]
Load voids as formatted for VoidFinder
- Parameters
- infilenamestring
path to desired data file
- Returns
- holes_xyznumpy.ndarray shape (N,3)
the xyz centers of the holes
- holes_radiinumpy.ndarray shape (N,)
the radii of the holes
- hole_flagsnumpy.ndarray shape (N,)
the VoidFinder ‘flag’ output representing which void group a hole belongs to
VoidRender
- vast.voidfinder.viz.VoidRender.__init__(self, holes_xyz=None, holes_radii=None, holes_group_IDs=None, galaxy_xyz=None, galaxy_display_radius=2.0, wall_galaxy_xyz=None, wall_distance=3.5, remove_void_intersects=1, filter_for_degenerate=True, canvas_size=(800, 600), title='VoidFinder Results', camera_start_location=None, camera_start_orientation=None, start_translation_sensitivity=1.0, start_rotation_sensitivity=1.0, galaxy_color=array([1., 0., 0., 1.], dtype=float32), wall_galaxy_color=array([0., 0., 0., 1.], dtype=float32), void_hole_color=array([0., 0., 1., 0.95], dtype=float32), SPHERE_TRIANGULARIZATION_DEPTH=3, verbose=False)
Main class for initializing the visualization.
- Parameters
- holes_xyz(N,3) numpy.ndarray
xyz coordinates of the hole centers
- holes_radii(N,) numpy.ndarray
length of the hole radii in xyz coordinates
- holes_group_IDs(N,) numpy.ndarray of integers
Void group to which a given hole belongs according to VoidFinder
- galaxy_xyz(M,3) numpy.ndarray
xyz coordinates of the galaxy locations
- galaxy_display_radiusfloat
using a constant radius to display galaxy points since they should all be small compared to the void holes, and they don’t have corresponding radii
- wall_galaxy_xyz(K,3) numpy.ndarray
xyz coordinates of the wall galaxy locations
- wall_distancefloat
xyz distance at which to connect two wall galaxies with a web visualization. This should be set to the isolated galaxy distance limit calculated in VoidFinder (and printed to the terminal).
- remove_void_intersectsint, default 1
0 - turn off 1 - remove all intersections 2 - remove intersections only within predefined Void Groups based on hole_group_IDs turn on (True) or off (False) the clipping of display triangles for void interiors. When true, removes all the triangles of a void hole sphere which are fully contained inside another void hole, which essentially creates a surface union of void holes which overlap. Note that for smaller sphere density values, the edge artifacts along the seams where void holes intersect will be more visually apparent
- filter_for_degeneratebool, default True
if true, filter the holes_xyz and holes_radii for any holes which are completely contained within another hole and remove them
- canvas_size2-tuple
(width, height) in pixels for the output visualization
- titlestr
value to display at top of the window
- camera_start_locationndarray of shape (3,) dtype float32
starting location for the camera. Remember to multiply by -1.0 to go from data coordinates to camera coordinates example: np.zeros(3, dtype=np.float32)
- camera_start_orientationndarray of shape (3,3) dtype float32
rotation matrix describing initial camera orientation example: np.eye(3, dtype=np.float32)
- start_translation_sensitivityfloat
starting sensitivity for translation keys - wasdrf
- start_rotation_sensitivityfloat
starting sensitivity for rotation keys - qeijkl
- galaxy_colorndarray shape (4,) dtype float32
values from 0.0-1.0 representing RGB and Alpha for the galaxy points
- wall_galaxy_colorndarray shape (4,) dtype float32
values from 0.0-1.0 representing RBG and Alpha for the wall galaxy points
- void_hole_colorndarray shape (4,) or (num_void,4) dtype float32
values from 0.0-1.0 representing RGB and Alpha for the voids
- void_highlight_colorndarray shape (4,) dtype float32
values from 0.0-1.0 representing RGB and Alpha for the void highlight, when the camera enters a void hole it turns the hole this color so you know you are inside IF enable_void_interior_highlight == True
- SPHERE_TRIANGULARIZATION_DEPTHinteger, default 3
number of subdivisions in the icosahedron sphere triangularization to make. Total vertices will be num_voids * 20 * 3 * 4^SPHERE_TRIANGULARIZATION_DEPTH so be careful increasing this value above 3. Default of 3 results in 3840 vertices (1280 triangles) per sphere
Notes
Controls:
w - translate forward s - translate backward a - translate left d - translate right r - elevate up f - elevate down
q - roll left e - roll right i - pitch up k - pitch down j - yaw left k - yaw right
z - increase translation sensitivity x - decrease translation sensitivity
m - start/stop video recording NOTE: MAY TAKE A LOT OF RAM 0 - screenshot
Left mouse click - pitch & yaw Right mouse click - translate forward & backward Mouse Wheel - increase & decrease galaxy size
Examples
from vast.voidfinder.viz import VoidRender, load_void_data, load_galaxy_data
holes_xyz, holes_radii, holes_flags = load_void_data(“vollim_dr7_cbp_102709_holes.txt”)
galaxy_data = load_galaxy_data(“vollim_dr7_cbp_102709.dat”)
- viz = VoidFinderCanvas(holes_xyz,
holes_radii, galaxy_data, canvas_size=(1600,1200))
viz.run()
VoidRender for V2
load_galaxy_data
- vast.vsquared.viz.load_galaxy_data(infilename)[source]
Load a table of galaxies for use in VoidRender
- Parameters
- infilenamestring
path to desired data file intended to be a fits table with columns ‘ra’, ‘dec’, and ‘z’
- Returns
- galaxy_data_xyznumpy.ndarray shape (N,3)
xyz coordinates of galaxies from the data table
load_void_data
- vast.vsquared.viz.load_void_data(infilename1, infilename2)[source]
Load voids as formatted for Vsquared
- Parameters
- infilename1string
path to desired _triangles.dat data file
- infilename2string
path to desired _galviz.dat data file
- Returns
- voids_tri_x, _y, _znumpy.ndarrays shape (N,3)
the xyz coordinates of the the vertices of triangles making up void edges
- voids_normnumpy.ndarray shape (N,3)
the xyz coordinates of each triangle’s unit normal vector
- voids_idnumpy.ndarray shape (N,)
the void ID of each triangle
- gal_viznumpy.ndarray shape (N,)
the void ID of each galaxy
- gal_oppnumpy.ndarray shape (N,)
the void ID of each galaxy’s nearest neighbor
VoidRender
- vast.vsquared.viz.VoidRender.__init__(self, voids_tri_x=None, voids_tri_y=None, voids_tri_z=None, voids_norm=None, voids_id=None, galaxy_xyz=None, galaxy_display_radius=2.0, gal_viz=None, gal_opp=None, canvas_size=(800, 600), title='V2 Results', camera_start_location=None, camera_start_orientation=None, start_translation_sensitivity=1.0, start_rotation_sensitivity=1.0, galaxy_color=array([1., 0., 0., 1.], dtype=float32), void_color=array([0., 0., 1., 0.95], dtype=float32))
Main class for initializing the visualization.
- Parameters
- voids_tri_x, _y, _znumpy.ndarrays shape (N,3)
the xyz coordinates of the the vertices of triangles making up void edges
- voids_normnumpy.ndarray shape (N,3)
the xyz coordinates of each triangle’s unit normal vector
- voids_idnumpy.ndarray shape (N,)
the void ID of each triangle
- galaxy_xyz(N,3) numpy.ndarray
xyz coordinates of the galaxy locations
- galaxy_display_radiusfloat
using a constant radius to display galaxy points since they should all be small compared to the void holes, and they don’t have corresponding radii
- gal_viznumpy.ndarray shape (N,)
the void ID of each galaxy
- gal_oppnumpy.ndarray shape (N,)
the void ID of each galaxy’s nearest neighbor
- canvas_size2-tuple
(width, height) in pixels for the output visualization
- titlestr
value to display at top of the window
- camera_start_locationndarray of shape (3,) dtype float32
starting location for the camera. Remember to multiply by -1.0 to go from data coordinates to camera coordinates example: np.zeros(3, dtype=np.float32)
- camera_start_orientationndarray of shape (3,3) dtype float32
rotation matrix describing initial camera orientation example: np.eye(3, dtype=np.float32)
- start_translation_sensitivityfloat
starting sensitivity for translation keys - wasdrf
- start_rotation_sensitivityfloat
starting sensitivity for rotation keys - qeijkl
- galaxy_colorndarray shape (4,) dtype float32
values from 0.0-1.0 representing RGB and Alpha for the galaxy points
- void_colorndarray shape (4,) or (num_void,4) dtype float32
values from 0.0-1.0 representing RGB and Alpha for the voids
Notes
Controls: w - translate forward s - translate backward a - translate left d - translate right r - elevate up f - elevate down
q - roll left e - roll right i - pitch up k - pitch down j - yaw left k - yaw right
z - increase translation sensitivity x - decrease translation sensitivity
m - start/stop video recording NOTE: MAY TAKE A LOT OF RAM 0 - screenshot
Left mouse click - pitch & yaw Right mouse click - translate forward & backward Mouse Wheel - increase & decrease galaxy size
Examples
from vast.vsquared.viz import VoidRender, load_void_data, load_galaxy_data
voids_tri_x, voids_tri_y, voids_tri_z, voids_norm, voids_id, gal_viz, gal_opp = load_void_data(“DR7_triangles.dat”, “DR7_galviz.dat”)
galaxy_data = load_galaxy_data(“vollim_dr7_cbp_102709.fits”)
- viz = VoidFinderCanvas(voids_tri_x, voids_tri_y, voids_tri_z,
voids_norm, voids_id, galaxy_data, gal_viz, gal_opp, canvas_size=(1600,1200))
viz.run()