ViSL3D
is a Python package that creates X3D and HTML files to visualize datacubes from astrophysics in 3D in an interactive way. We use X3D and x3dom to represent figures in 3D and to integrate them into an HTML. The models have been made taking the x3d-pathway (Vogt et al. 2016) as a starting point. The current code was made for radio data, although it can be used with other types of 3D data.
pip install visl3d
Examples of how to use the package are provided in the Jupyter notebook jupyter_example.ipynb.
The produced HTML file can be visualised in any standard browser.
-
Install a local HTTP Server. Visualisations produced by ViSL3D must be opened through a local server in order to be displayed. There are a few options:
- Apache is a popular HTTP server that can be installed in most operating systems.
- Python has a built-in HTTP server that can be used by running
python -m http.server
in the directory where the HTML and X3D files are located. - VS Code has a built-in HTTP server that can be used by installing the Live Preview extension.
-
Copy the x3dom folder into the server root directory. This should be the directory where the HTML and X3D files are located. By default, in Apache, it is
/var/www/html
in Linux,C:\Apache24\htdocs
in Windows and/usr/local/var/www
(or similar) in Mac. The DocumentRoot can be found and modified in thehttpd.config
file. -
Move the created X3D and HTML files into the Apache DocumentRoot directory and open the visualisation in a browser (most common browsers are supported) by typing the URL
localhost\example_file.html
.
- Plot any number of contour surfaces.
- Plot galaxies with labels.
- Add a 2D image in any wavelength in background.
- Change the scale of the velocity axis.
- Shift 2D image along velocity axis and display the value.
- Rotate, zoom and pan complete figure.
- Hide/Show different components of the figure.
- Change ax labels.
- Change viewpoints.
- Change the colormap
- Add markers
Vogt, Owen, Verdes-Montenegro & Borthakur, Advanced Data Visualization in Astrophysics: the X3D Pathway, ApJ 818, 115 (2016) (arxiv; ADS)