|
| 1 | +# Lactea: Web-Based Spectrum-Preserving Multi-Resolution Visualization of the GAIA Star Catalog |
| 2 | +[](https://github.com/vccvisualization/lactea/actions/workflows/build.yml) |
| 3 | + |
| 4 | +[](https://www.youtube.com/watch?v=mR2bpCEupvk) |
| 5 | + |
| 6 | +This repository contains an open-source, web-based implementation of Lactea, a submitted paper to the EuroVis 2025 conference introducing a spectral visualization, multi-resolution technique for a large star catalog. This repository works with the European Space Agency (ESA)'s GAIA catalog, which contains the spectral information of almost 2 billion stars. |
| 7 | + |
| 8 | + |
| 9 | +## Download and Process Data |
| 10 | + |
| 11 | +[script](script) folder contains a Python script to download the 3rd release of GAIA. After making a virtual environment, install `gaiaxpy` as well as `numpy` and `pandas`. `gaiaxpy` is used to sample the continuous spectrum. |
| 12 | + |
| 13 | +Once the environment is set up, run the Python script to generate a folder with 3386 files. Lastly, merge them all into one big file before moving to the next step. |
| 14 | + |
| 15 | +An example bash script of all these steps is available at [script/download.sh](script/download.sh). |
| 16 | + |
| 17 | +## Data structure |
| 18 | + |
| 19 | +The [data structure](data_structure) building tool is written in C++. The core library is available at [data_structure/src/lactea_xp_merged](data_structure/src/lactea_xp_merged). Other scripts are also available to sort, sample, build, and chunk the tree. |
| 20 | + |
| 21 | +To build a WebGPU-friendly tree: |
| 22 | + |
| 23 | +### Sort |
| 24 | + |
| 25 | +Run [`raw_star_db_sorter_xp_merged.cpp`](data_structure/src/raw_star_db_sorter_xp_merged/raw_star_db_sorter_xp_merged.cpp) to sort the merged binary file based on the magnitude using [alveko's external_sort](https://github.com/alveko/external_sort) library. |
| 26 | + |
| 27 | +The script takes two arguments: |
| 28 | +* input file name: the name of the merged file obtained from the previous step (e.g., `/data/gdr3_gaia_source_xp_extinction.stars`) |
| 29 | +* output file name: the sorted filename (e.g., `/data/gdr3_gaia_source_xp_extinction_sorted.stars`) |
| 30 | + |
| 31 | +### [Optional] Create Random Subsets |
| 32 | + |
| 33 | +Make subsets of the data using [`raw_star_db_subset_writer_xp_merged.cpp`](data_structure/src/raw_star_db_subset_writer_xp_merged/raw_star_db_subset_writer_xp_merged.cpp). There are 3 input parameters: |
| 34 | +* the sorted file to sample (e.g., `/data/gdr3_gaia_source_xp_extinction_sorted.stars`) |
| 35 | +* output file name: (e.g. `/data/gdr3_gaia_source_xp_extinction_1M.stars`) |
| 36 | +* number of stars: how many star samples (e.g., `1000000`) |
| 37 | + |
| 38 | +### Build and Chunk the tree |
| 39 | + |
| 40 | +Once the data is sorted (and sampled if desired), build the tree and save it as chunks using [`sandbox.cpp`](data_structure/src/sandbox/sandbox.cpp). 4 arguments are required: |
| 41 | + |
| 42 | +* the sorted file: could be the whole database or a sampled database (e.g., `/data/gdr3_gaia_source_xp_extinction_1M.stars`) |
| 43 | +* the output tree file: This only saves the tree structure. (e.g., `/data/gdr3_gaia_source_xp_extinction_1M.str`) |
| 44 | +* the chunks output directory: the directory to save each node chunk for WebGPU visualization. (e.g., `/data/gdr3_gaia_source_xp_extinction_1M`) |
| 45 | +* The max number of stars per node: In the paper, `1000` stars per node is used. This generates chunks of size `5.6 MB`, which is suitable for fetching on the web |
| 46 | + |
| 47 | +It is also possible to divide this into two subtasks using [`star_tree_builder_xp_merged.cpp`](data_structure/src/star_tree_builder_xp_merged/star_tree_builder_xp_merged.cpp) and [`star_tree_chunker_xp_merged.cpp)`](data_structure/src/star_tree_chunker_xp_merged/star_tree_chunker_xp_merged.cpp) |
| 48 | + |
| 49 | + |
| 50 | +A sample of the chunked data folder is available in [web_visualizer/res/data](web_visualizer/res/data), using 10,000 samples due to GitHub's file size restriction. |
| 51 | + |
| 52 | + |
| 53 | +## Visualization |
| 54 | + |
| 55 | +[The visualization](web_visualizer) is implemented using WebGPU for accessibility. [lil-gui](https://lil-gui.georgealways.com/#), [chart js](https://www.chartjs.org/), [d3](https://d3js.org/) and [glmatrix](https://glmatrix.net/) were used. |
| 56 | + |
| 57 | +The shaders are available in [web_visualizer/res/shaders](web_visualizer/res/shaders), while the main JS code is in [web_visualizer/src](web_visualizer/src). |
| 58 | + |
| 59 | +A minimal JS implementation of the [C++ lactea library](data_structure/src/lactea_xp_merged) is in [web_visualizer/src/lactea](web_visualizer/src/lactea). Change line 10 of [web_visualizer/src/lactea/StarTree.js](web_visualizer/src/lactea/StarTree.js) to reflect your served data path. |
| 60 | + |
| 61 | +``` |
| 62 | + // TODO: put your own data folder |
| 63 | + this.path = "http://127.0.0.1:5501/gdr3_gaia_source_xp_extinction/" |
| 64 | +``` |
| 65 | + |
| 66 | +The components of the visualizer are: |
| 67 | +* [`LacteaInterface.js`](web_visualizer/src/visualizer/LacteaInterface.js): this class connects to lactea, builds the viewbounds based on the camera parameters, traverses the tree, and builds the star and patch queues. |
| 68 | +* [`LacteaCache.js`](web_visualizer/src/visualizer/LacteaCache.js): a lactea interface instance is created, as well as the star and node caches. `cacheLoad` function manages the queues, file loading, and the CPU and GPU caches. |
| 69 | +* [`PipelineStarCompute.js`](web_visualizer/src/visualizer/PipelineStarCompute.js): The star accumulation compute shader. |
| 70 | +* [`PipelineNodeCompute.js`](web_visualizer/src/visualizer/PipelineNodeCompute.js): Storing the patch ID into the spectral buffer pipeline |
| 71 | +* [`PipelineRender.js`](web_visualizer/src/visualizer/PipelineRender.js): rendering, tone mapping, and the different astronomical tasks pipeline. Once the spectral buffer is filled, any task, such as rendering, image processing, derivative computation or any other astronomical spectral processing task can be computed in a negligible time |
| 72 | +* [`LacteaVisualizer.js`](web_visualizer/src/visualizer/LacteaVisualizer.js): entry point of the visualizer |
| 73 | + |
| 74 | +## Citation |
| 75 | + |
| 76 | +To cite this work |
| 77 | + |
| 78 | +``` |
| 79 | +@article{alghamdi2025Lactea, |
| 80 | + title = {Lactea: Web-Based Spectrum-Preserving Multi-Resolution Visualization of the GAIA Star Catalog}, |
| 81 | + author = {Alghamdi, Reem and Hadwiger, Markus and Reina, Guido and Jaspe-Villanueva, Alberto}, |
| 82 | + journal = {Computer Graphics Forum (Proceedings of Eurographics Conference on Visualization 2025)}, |
| 83 | + year = {2025}, |
| 84 | + volume = {44}, |
| 85 | + number = {3}, |
| 86 | + pages = {to appear} |
| 87 | +} |
| 88 | +``` |
| 89 | + |
| 90 | +## Acknowledgement |
| 91 | + |
| 92 | +This work has made use of data from the European Space Agency (ESA) mission [Gaia](https://www.cosmos.esa.int/gaia), processed by the Gaia Data Processing and Analysis Consortium ([DPAC](https://www.cosmos.esa.int/web/gaia/dpac/consortium)). |
0 commit comments