Random Sightlines

postprocessing/los/rays_NNN.hdf5

We provide 150 random lines of sight for each THESAN-1 snapshot from 054 through 080. They start at random positions within the simulation box and follow random directions for 100 cMpc, using periodic boundary conditions to wrap around the box when necessary. On Globus, select rays_NNN.hdf5 in los. The production copy places the same random rays under los/random_origin/.

File Reference

The lines of sight for each snapshot are stored in a separate HDF5 file. General information is stored in the attributes of the Header group, including the length of each ray (RayLength_cMpc). The gas fields and segment lengths follow the traversal order of each ray.

Header Attributes
Attribute Dimensions Units Description
BoxSize 1 ckpc/h\text{ckpc} / h Spatial extent of the periodic box (in comoving units).
HubbleParam 1 - Little hh, defined as h=H0/(100km/s/Mpc)h = H_0 / (100 \text{km}/\text{s}/\text{Mpc})
MultipleOrigins 1 - Flag indicating that the LOS have different origins within the simulation box.
NumRays 1 - Number of LOS stored in the file.
Omega0 1 - The cosmological density parameter for matter.
OmegaBaryon 1 - The cosmological density parameter for baryons.
RayImpact 1 - Meaningless for the current configuration.
RayLength 1 ckpc/h\text{ckpc}/h Length of the LOS.
RayLength_cMpc 1 cMpc Length of the LOS in cMpc\text{cMpc}.
RaySphere 1 - Meaningless for the current configuration.
Redshift 1 - The redshift corresponding to the current snapshot.
UnitLength_in_cm 1 - Length unit used in the simulation, expressed in comoving cm.
UnitMass_in_g 1 - Mass unit used in the simulation, expressed in g.
UnitVelocity_in_cm_per_s 1 - Velocity unit used in the simulation, expressed in comoving cm / s.
Within each LOS file, the properties extracted along the LOS are saved in a number of groups, each one containing a dataset for each ray (named simply with a progressive number, starting from 0). These values are directly extracted from the simulation cell crossed by the ray, and saved as they are. This means that the units and considerations made for such fields (see Snapshots) apply directly to the ray fields. Additionally, LOS properties are saved in a mix of groups (with the same format just described) and datasets. Both are described in the table below. We distinguish groups from dataset in the dimensions column.
Datasets and Groups
Dataset Dim. Units Description
Density group 1010M⊙h2/ckpc310^{10} \text{M}_\odot h^2 / \text{ckpc}^3 Gas density in the Voronoi cell. Internal units.
ElectronAbundance group - Electron abundance, defined as ne/nHn_e / n_H, in each Voronoi cell.
GFM_DustMetallicity group - Dust-to-metal ratio in each Voronoi cell.
GFM_Metallicity group - Gas-phase metallicity in each Voronoi cell.
GFM_Metals group - For each ray, contains the mass fraction of nine species: H, He, C, N, O, Ne, Mg, Si, Fe (in this order). Each one is the dimensionless ratio of mass in that species to the total gas cell mass.
HI_Fraction group - HI fraction (i.e. nHI/nHn_{HI} / n_H ) in the cell.
HeI_Fraction group - HeI fraction (i.e. nHeI/nHn_{HeI} / n_H ) in the cell. Note: the denominator is nHn_H, rather than nHen_{He}.
HeII_Fraction group - HeII fraction (i.e. nHeII/nHn_{HeII} / n_H ) in the cell. Note: the denominator is nHn_H, rather than nHen_{He}.
InternalEnergy group (km/s)2(\text{km}/\text{s})^2 Internal energy of the gas in the Voronoi cell.
MagneticField group (h/a²) √UnitPressureThree-dimensional magnetic field.
PhotonDensity group 1063 photons / (ckpc/h)³ Photon number density in each of the three ionizing bands. In the sampled random-ray files the group’s to_cgs includes the inverse volume only. To obtain a physical density in cm⁻³, multiply the stored value by 1063 (h / [a × UnitLength_in_cm])³.
RayOrigins (Nlos,3) ckpc/h\text{ckpc}/h Starting point of the LOS.
RayEndings (Nlos,3) ckpc/h\text{ckpc}/h End point of the LOS. Note that this does not include the box wrapping due to PBC, so this value can nominally lie outside of the simulation box, although the rays include PBC..
RaySegments group ckpc/h\text{ckpc}/h Length of each segment composing the LOS. These segments are the intersection of the LOS with the Voronoi tesselation.
StarFormationRate group M⊙/yr\text{M}_\odot / \text{yr} Star Fromation Rate of the gas.
Velocity group kma/s\text{km} \sqrt{a} /\text{s} Spatial velocity. Multiply this value by a\sqrt{a} to obtain peculiar velocity.
Neutral hydrogen fraction at the midpoints of the first 512 gas segments along random sightline 0 at z = 7.02.
Neutral hydrogen fraction at the midpoints of the first 512 gas segments along random sightline 0 at z = 7.02. Profile (CSV)

The CSV contains the first 512 segments of ray 0. To reproduce the distance coordinate in cMpc, take np.cumsum(length) - 0.5 * length after converting segment lengths as shown below.

Measure the neutral fraction along a ray

Paths in this example are relative to Thesan-1/postprocessing/.

import h5py
import numpy as np

with h5py.File("los/rays_054.hdf5") as f:
    length = f["RaySegments/0"][:] / (1000 * f["Header"].attrs["HubbleParam"])
    x_hi = f["HI_Fraction/0"][:]
    print("length [cMpc]:", f"{length.sum():.5g}")
    print("path-weighted neutral fraction:", f"{np.average(x_hi, weights=length):.5g}")
Output from THESAN-1
length [cMpc]: 100
path-weighted neutral fraction: 0.26355