import streamlit as st
st.set_page_config(
page_title="CosmoBench",
initial_sidebar_state="auto",
)
st.markdown(
"""
""",
unsafe_allow_html=True
)
st.sidebar.markdown("# Cosmological datasets for geometric deep learning")
st.sidebar.write("\n\n")
FP = st.sidebar.button("Front page")
st.sidebar.write("\n\n")
st.sidebar.markdown("---")
st.sidebar.write("**Dataset description:**")
col1, col2 = st.sidebar.columns(2)
with col1:
PC = st.button("Point clouds")
with col2:
MT = st.button("Merger trees")
st.sidebar.markdown("---")
st.sidebar.write("**Data download:**")
col1, col2 = st.sidebar.columns(2)
with col1:
st.markdown(
"""
""",
unsafe_allow_html=True)
with col2:
st.markdown(
"""
""",
unsafe_allow_html=True)
st.sidebar.markdown("---")
col1, col2 = st.sidebar.columns(2)
with col1: glosary = st.button("Glossary")
with col2: team = st.button("Team")
# Show introduction only if no button is clicked
if not (PC or MT or glosary or team):
st.markdown("""
### Cosmological datasets for geometric deep learning
We provide two kind of cosmological datasets to train and benchmark models:
- **Point clouds**. These are collections of points representing galaxies or halos in different universes.
- **Merger trees**. These are graphs $G=(V,E)$ representing the past time evolution of a dark matter halo.
""")
st.image("src/main.png")
st.markdown("""
It is important to understand the difference between **dark matter halos** and **galaxies**.
""", unsafe_allow_html=True)
col1, col2 = st.columns([1, 2])
with col1:
st.image("src/halo.png", caption="Galaxies inside a halo", width=230)
with col2:
st.markdown("""
- **Dark matter halos** (or simply *halos*) are massive, invisible structures made of normal and dark matter.
- They act as the **gravitational wells** where galaxies are born and evolve.
- A single halo can host **one or more galaxies**, and their evolution is tightly connected.
- Computationally, it is easier to simulate dark matter halos than galaxies.
This distinction is fundamental for building accurate physical models.
""")
if PC:
st.title('Point clouds')
col1, col2 = st.columns([1, 2])
with col1:
st.image("src/point_cloud.png", width=230)
with col2:
st.markdown("""Point clouds are set of points, $\{x_i\}_{i=1}^N$ with $x_i\in\mathbb{R}^d$, representing dark matter halos or galaxies in different universes. These point clouds are generated by running state-of-the-art numerical cosmological simulations with different initial conditions and different compositions of the Universe.""")
st.markdown("""We provide three different types of points clouds:
- **Quijote**. These are dark matter halos from cosmological N-body simulations that only account for gravity. They sample a big volume and contain some of the largest halos in their respective universes. Each Quijote simulations contains around 100,000 dark matter halos.
- **CAMELS-SAM**. These are galaxies obtained by combining cosmological N-body simulations with semi-analytics models of galaxy formation. The sample a volume 1000x smaller than Quijote but their galaxies are quite representative of the standard galaxies observed in the universe.
- **CAMELS**. These are galaxies obtained from full cosmological hydrodynamic simulations. They sample a volume 64x smaller than CAMELS-SAM, but their galaxies are simulated with a model much sophisticated than those of CAMELS-SAM.
The figure below compares the sizes of the point clouds from the different datasets.
""")
st.image('src/Data.png', width=700)
if MT:
st.title('Merger trees')
st.markdown("""Marger trees are directed acyclic graphs, $(V,E)$, where
- Nodes represent individual dark matter halos (or subhalos) at a specific point in cosmic time (or redshift). $V=\{h_1, h_2, h_3,...h_n\}$. Typical node properties are mass, concetration, positions...etc.
- Edges represent progenitor-descendant relationships, pointing from a progenitor halo (earlier time) to its descendant halo (later time). $E=\{(h_i,h_j)|h_i\leftarrow h_j\}$.
The diagram below shows a merger tree from a CAMELS-SAM simulation. The left-most red point represents a dark matter halo at current time from a CAMELS-SAM simulation. From left to right we go further back in time. The sequence with the red dots is called the main branch. When two or more nodes join, it means that physically, two or several halos has merged to produce a bigger halo.""")
st.image("src/merger_tree.png", use_container_width=True)
if glosary:
st.markdown(""" # Glossary
**Cosmology**. The study of the universe as a whole — its origin, structure, evolution, and fate — using physics, astronomy, and mathematics. In data-driven cosmology, simulations and observations are used to model the large-scale structure of the universe.
**Dark Matter Halo**. A dark matter halo is a massive, invisible structure made mostly of dark matter that surrounds galaxies and galaxy clusters. Although it cannot be directly observed, its presence is inferred from its gravitational effects. Halos are the basic building blocks of cosmic structure.
**Merger Tree**. A data structure that represents the hierarchical growth of dark matter halos (and associated galaxies) over time. Each node is a halo, and branches show how smaller halos merged to form larger ones — analogous to a version-control tree of cosmic structure.
**Cosmological Simulations**. Cosmological simulations are large-scale computational models that simulate the evolution of the universe over billions of years. They use initial conditions based on physical laws and cosmological parameters to predict the formation of structures like galaxies, dark matter halos, and filaments.
**N-body Simulations**. A type of cosmological simulation that models the gravitational interaction of a large number of particles (typically representing dark matter). These simulations are computationally intensive and key to studying the growth of structure over time.
**Hydrodynamic Simulations**. Simulations that include both gravity and baryonic physics (e.g., gas dynamics, star formation, feedback). They model not only where galaxies form, but also how they evolve, and require solving coupled differential equations for both dark matter and fluid dynamics.
**Semi-Analytic Models (SAMs)**. A computationally efficient approach that uses analytic approximations applied to halo merger trees from N-body simulations to model galaxy formation. SAMs allow fast exploration of parameter space and are often used in combination with machine learning.
**Dark Matter**. Dark matter is a form of matter that does not emit or absorb light, making it invisible to telescopes. However, it makes up most of the universe's mass and is detectable via its gravitational influence on galaxies and cosmic structure. It is a central component in cosmological models and simulations.
**Large-Scale Structure**. The large-scale structure of the universe refers to the distribution of matter on scales of millions of light-years. It includes filaments, walls, voids, and galaxy clusters, forming a cosmic web. These patterns emerge naturally in simulations governed by gravity and initial density fluctuations.
**Cosmological parameters**. A set of key numerical values that define the properties of the universe in a cosmological model. They include quantities like the matter density, expansion rate, and initial conditions, and are used to run simulations or interpret observational data.
**$\Omega_m$**. The fraction of the total energy density of the universe made up of matter (including both dark matter and normal matter). If $\Omega_m$ₘis 1, the universe is matter-dominated and flat.
**$\Omega_b$**. The fraction of the universe’s energy density made up of baryons, i.e., normal (non-dark) matter like protons and neutrons. It’s a subset of $\Omega_m$.
**h**. The dimensionless Hubble parameter, which scales the current expansion rate of the universe ($H_0$). It allows distances and times to be expressed in normalized units. For example, $H_0$ = 70 km/s/Mpc corresponds to h=0.7.
**$n_s$**. The spectral index of the primordial power spectrum. It describes how the initial density fluctuations vary with scale — whether small or large fluctuations were more prominent in the early universe.
**$\sigma_8$**. A measure of how much matter has clumped together at a specific scale (8 megaparsecs). It quantifies the amplitude of matter fluctuations, and is critical for modeling the growth of structure (like galaxies and clusters).
""")
if team:
#st.title('Graphs4cosmo team')
#st.text('\n\n')
st.image('src/team.png')
#image_paths = ['photos/Teresa.jpeg', 'photos/Richard.jpg', 'photos/Jun-Young.jpeg',
# 'photos/Lucia.jpg', 'photos/Charles.png', 'photos/Adrian.jpg',
# 'photos/Lawrence.jpg', 'photos/Paco.png']
#captions = ['Ningyuan (Teresa) Huang (Flatiron)',
# 'Richard Stiskalek (Flatiron/Oxford)',
# 'Jun-Young Lee (Seoul)',
# 'Lucia Perez (Flatiron)',
# 'Charles Margossian (Flatiron)',
# 'Adrian Bayer (Princeton/Flatiron)',
# 'Lawrence Saul (Flatiron)',
# 'Francisco Villaescusa-Navarro (Flatiron)']
#for row in range(2):
# cols = st.columns(4)
# for col in range(4):
# idx = row * 4 + col
# with cols[col]:
# st.image(image_paths[idx], use_container_width=True)
# st.caption(captions[idx])