Datasets
Datasets define the geometry and gas properties of a simulation. Select one via dataset_type and add a matching top-level section in the YAML.
Detailed guides cover analytical models and TNG-Cluster file selection and loading. For application examples using these inputs, see the Cookbook.
Overview
dataset_type |
Geometry | Typical use |
|---|---|---|
shellmodel |
Spherical shell | Idealized outflows / Neufeld tests |
powerlaw_shellmodel |
Power‑law shell | Radial density / velocity gradients |
unigrid |
Uniform Cartesian grid | General 3D grids, Gadget snapshots |
octree |
Adaptive Cartesian cells | RAMSES gas and native H/He ionization |
infiniteslab |
Infinite slab (1D in z) | Classic slab benchmarks |
pointcloud_voronoi |
Voronoi from particles | Gadget point clouds (experimental) |
See also: Configuration Reference for global options.
Subgrid clouds add prescribed cloud and background phases to a filled sphere or infinite slab, using an explicit catalogue or reproducible procedural placement.
RAMSES (octree)
RAMSES gas loads from an output_NNNNN directory. Dimensionless descriptor fields
(passive_scalar_N, xHII, xHeII, xHeIII) are available as lazy recipes.
Use field_aliases.gas to assign physical names; verify them for your simulation.
dataset_type: octree
octree:
loader: ramses
snapshot_dir: /path/to/output_00070
field_aliases:
gas:
Metallicity: passive_scalar_2
xHII: passive_scalar_3
xHeII: passive_scalar_4
xHeIII: passive_scalar_5
native_ionization:
enabled: true
hydrogen_mass_fraction: 0.76
helium_mass_fraction: 0.24
fields: [Density, Temperature, HIdensity, MeanMolecularWeight]
THOR converts RAMSES density, pressure, and velocity from snapshot code units to
CGS before storing them in its octree fields. Aliases use the values returned by
their target field without additional conversion; the original names remain available.
For example, a field mapped to Metallicity must already store the metal mass fraction.
Native chemistry requires all three ion fractions relative to their element and
explicit H/He mass fractions, normally from info_rt_NNNNN.txt. It supplies H I,
mean molecular weight and thermal-pressure temperature. Enable native_ionization
to use these fractions; aliases alone do not select this model. Providing
Metallicity can change Cloudy's results because it changes the input metallicity.
The atomic H/He EOS excludes molecules/metals and subtracts no pressure floor;
check the simulation's conventions before interpreting temperature. To preserve
temperatures below 1 K, set raytracer.temperature_floor: 0.0
(see raytracer parameters).
Octree cutout bounds (octree)
octree.zoom_box gives three [min, max] pairs in normalized source-domain
coordinates. With zoom_remap: true (the default), the cutout must be cubic;
external positions then use the cutout's [0, 1]³ frame. Validation allows
floating-point roundoff relative to the endpoint coordinates, capped at a
relative width spread of 1e-5 (0.001%). Both normalized and physical widths must
pass: positions scale per axis, while distances use the x-axis width. Supplied
bounds remain unchanged. A small offset cube that exceeds this limit in FP32
requires FP64 or zoom_remap: false.
When generating a cube from a center and a shared half-width, serialize the
endpoints at full floating-point precision. Independently rounding each endpoint
to a fixed number of decimal places can introduce genuine width differences.
For a rectangular cutout, zoom_remap: false retains the full-box coordinate frame.
Spherical Shell (shellmodel)
Spherically symmetric shell centered in the unit cube, with inner/outer radius in box units.
dataset_type: 'shellmodel'
shellmodel:
boxsize: 3.086e21 # cm (physical box size)
inner_radius: 0.0 # 0.0–0.5, in box units
outer_radius: 0.1 # 0.0–0.5, in box units
temperature: 20000.0 # K
density: 0.078098 # cm^-3 (optional, see below)
outflow_velocity: 0.0 # cm/s, value at r = outer_radius
density_fluff: 0.0 # cm^-3, background beyond outer_radius; default 0
temperature_fluff: 0.0 # K, must be positive for nonzero background density
Key points:
inner_radius,outer_radiusare fractions of the box size, limited to[0, 0.5]and must satisfyinner_radius < outer_radius.density_fluffandtemperature_fluffset stationary background gas beyondouter_radius, within the simulation box. Both default to zero. The central cavity belowinner_radiusremains empty. Both values must be finite and nonnegative; nonzero background density requires a positive temperature.-
Gas density can be set in three equivalent ways (pick exactly one):
density(volume density in cm⁻³),column_density(cm⁻²) together withboxsize,log_NHI(log10of column density in cm⁻²).
-
Temperature can be given directly via
temperatureor derived from an effective cross‑section using:sigma(line‑center cross‑section; requires the emission line from the driver).
-
Use top-level
dust: {model: constant, k_dust_value: ...}withinteractor: ResonantWithDustInteractorfor uniform dust inside the shell. The coefficient is in cm⁻¹; the cavity and exterior remain dust-free.shellmodel.density_dustandshellmodel.column_density_dustare rejected.
Power‑Law Shell (powerlaw_shellmodel)
Shell with power‑law profiles for density and velocity, building on the same basic parameters as shellmodel.
dataset_type: 'powerlaw_shellmodel'
powerlaw_shellmodel:
boxsize: 3.086e21
inner_radius: 0.01
outer_radius: 0.1
temperature: 20000.0
density: 0.078098 # interpreted as mean density
# Velocity profile v(r) ∝ r^powerlaw_index_velocity
outflow_velocity: 200e5 # cm/s at r = outer_radius (simple case)
powerlaw_index_velocity: 1.0
# Density profile ρ(r) ∝ r^powerlaw_index_density
powerlaw_index_density: -2.0
conserve_column_density: true # renormalize density to match shell column
Key points:
- All
shellmodeldensity/temperature options are available and interpreted as averages before applying the power law. powerlaw_index_velocityandpowerlaw_index_densitycontrol the radial scalings.- If
conserve_column_density: true, the code rescalesdensityso that the line‑of‑sight column matches the corresponding uniform shell. - Advanced velocity options:
velocity_ratio: ratio between maximum and minimum velocity; used to infer an effective inner radius (see code comments).outflow_velocity_*average: alternative ways to specify the velocity scale; only one of these (oroutflow_velocityfrom the shell) should be used.
Uniform Grid (unigrid)
Cartesian grid with optional domain decomposition and several initialization “loaders”.
dataset_type: 'unigrid'
unigrid:
ngrid: 64 # cells per dimension (global)
loader: sphere # 'sphere', 'gadget' or 'hdf5'; other analytic loaders are also available
boxsize: 3.086e21 # cm, required if not implied by the loader
# Optional: domain decomposition (see configuration.md)
# domain: [[0.0, 1.0], [0.0, 1.0], [0.0, 1.0]]
# local_domain_pad: 0.03
Loader: sphere
unigrid:
ngrid: 64
loader: sphere
sphere:
radius: 0.1 # in box units by default
density: 0.078098 # cm^-3
temperature: 20000.0 # K
velocity: [1.0e5, 0.0, 0.0] # optional: uniform velocity [vx, vy, vz] in cm/s
relative_distances: true # if false, radius is interpreted in physical units
An optional sphere.hole section cuts a cone, or two opposite cones, out of
the sphere. The cones start at the sphere's center. Cell centers inside the
opening receive background_density and background_temperature, with zero
emissivity and velocity. Set the background density to zero for an empty
opening. Omitting hole preserves the full sphere. [AI-Codex]
unigrid:
loader: sphere
sphere:
radius: 0.4
density: 1.0e-3
temperature: 6000.0
background_density: 0.0
background_temperature: 6000.0
hole:
half_opening_angle_deg: 45.0 # angle from the cone axis; required, 0 < angle < 90
axis: [0.0, 0.0, 1.0] # default; any finite, nonzero vector is normalized
bipolar: true # default: both +axis and -axis; false: +axis only
The opening is assigned by cell centers, so its surface is approximated by
grid cells. For two cones of half-angle 45 degrees, the analytic empty solid
angle fraction is 1 - cos(45 degrees) = 0.292893.
Loader: gadget
Interpolates a Gadget snapshot onto the grid.
Only nearest-grid-point (ngp) deposition is supported. The unfinished sph
interpolator and the cylinder and gadget_strongscaling_test loaders have been
retired; configurations selecting them are rejected. The gadget_weakscaling_test
loader and pregridded Gadget input remain available.
unigrid:
ngrid: 64
loader: gadget
gadget:
path: "./snapdir_099" # Gadget snapshot root
interpolator: "ngp" # nearest-grid-point deposition (default)
boxsize: 1.0e23 # cm, optional override of Gadget header
pregridded_path: "" # optional: read pre‑gridded HDF5 instead
domain_consistency_check: true
Additional options:
fields: list of field names to load (case‑insensitive, defaults to density/temperature/velocity for MCRT).- When
pregridded_pathis non‑empty, the code loads data from that HDF5 file instead of performing interpolation. - Distributed runs use
domainandlocal_domain_padfrom the dataset section, andpbcfrom the driver, via the common dataset interface.
Loader: hdf5
Reads the grid from 3D HDF5 datasets of shape [ngrid, ngrid, ngrid]
([x, y, z], z fastest). Each MPI rank reads only its padded box, wrapping
periodically at the edges.
unigrid:
ngrid: 256
loader: hdf5
boxsize: 1.0
fields: [Density]
hdf5:
path: "./grid.h5"
datasets: [rho] # optional; default: the pregridded field names
Infinite Slab (infiniteslab)
One-dimensional slab along the z-axis, infinite in x and y. It fills the full
domain thickness boxsize; photons escape through the two z faces.
dataset_type: 'infiniteslab'
infiniteslab:
boxsize: 3.086e21 # cm
temperature: 20000.0 # K
# choose exactly one of:
density: 0.078098 # cm^-3
# tau: 1.0 # optical depth (requires emission line)
# dust (optional)
tau_dust: 0.0 # effective dust optical depth across half the slab
Key points:
- Exactly one of
densityortaumust be specified (the helper enforces a single choice amongdensity,column_density,tau; for slabscolumn_densityis currently not supported and will error if > 0). - If
tauis used, the code derivesdensityfrom the line cross‑section andboxsize(requires a valid emission line in the driver). tau_dustsets a constant dust absorption coefficient inside the slab.
Phase-space sheet (pss)
PSS normalizes particle positions by the source's box_size. That raw scale is
separate from the physical length represented by the normalized box. Set the
latter explicitly in centimeters:
Without length_unit, TetProjector can still produce maps in source units and
warns about their units. Operations that need a physical length, including MCRT
and physical aperture sizes, require a finite positive length_unit. Source
particle masses retain their source units; specifying a length does not convert
those masses to grams.
Point Cloud (pointcloud_voronoi and variants)
Voronoi tessellation of particles, typically from a Gadget simulation.
dataset_type: 'pointcloud_voronoi'
pointcloud_voronoi:
hilbert_bits: 8 # 1–10, controls spatial indexing resolution
loader: "gadget"
gadget:
path: "./snapdir_099" # Gadget snapshot root
catalog_path: "./groups_099" # FOF/subfind catalog (required for zoom_target)
fields: ["PositionX", "PositionY", "PositionZ", "Temperature", "Density"]
zoom_target:
hid: 0 # Zero-based global Group row
rvir: 2.5 # Cutout half-width in multiples of R_200c
# zoom_box: [[xmin, xmax], [ymin, ymax], [zmin, zmax]] # alternative to zoom_target
# Optional: Cloudy ionization/emission tables
cloudy:
enabled: true
emission_table_path: "/path/to/grid_emissivities.hdf5"
ion_table_path: "/path/to/grid_ions.hdf5"
redshift_interp: true
interpolation_order: 1
redshift_tolerance: 0.05 # max |z_table - z_dataset| when snapping to a slice
interpolate_redshift: false # blend the two bracketing slices instead of snapping
Key points:
-
Supported variants (same YAML structure, different interpolator under the hood):
pointcloud_voronoi(default, experimental)pointcloud_voronoi_tree(tree‑accelerated, do not use)pointcloud_voronoi_approx(approximate Voronoi, do not use)pointcloud_sph(SPH‑style interpolation; used bydriver_type: sphprojectorfor stellar-particle projection across all eight AGORA codes — see Stellar Particle Loading)
-
hilbert_bitscontrols the resolution of the Hilbert grid used to accelerate neighbor lookups (must be between 1 and 10). hilbert_sort(defaulttrue) shuffles all particles into Hilbert space-filling-curve order at load time; the KNN lookup grid requires it.pointcloud_sphdatasets build the KNN, and sort, only when they derive a missingMaxDistwithsmoothing_length.mode: knn; otherwise they keep the loader's particle order. As a consequence, THOR's internal particle order (and any mesh cache written from it) is not snapshot order. Mesh caches record a per-row identity column to map back.- Loaders:
gadget(HDF5 / Gadget-family snapshots, including AREPO and TNG),tipsy(CHANGA/PKDGRAV binary format), andsphere(synthetic uniform-sphere generator). Selected viapointcloud_voronoi.loader. - Snapshots whose HDF5 header lacks unit or cosmology attributes (e.g. GADGET-4, which writes them only to
param.txt) can supplyUnitLength_in_cm,UnitMass_in_g,UnitVelocity_in_cm_per_s,Omega0,OmegaLambda, andHubbleParamdirectly in thegadget:subsection — see Unit Normalization. - For
pointcloud_sphdatasets, three additional loaders source stellar particles from AMR snapshots:ramses_stars,enzo_stars, andart_stars. See Stellar Particle Loading below. cell_volumesets the volume THOR assigns to each cell (VolumeCode, andVolumewhen requested). See Cell volumes.- Voronoi construction-specific options are configured under a
construction:subsection and documented in detail here. CGAL remains the production default;construction.voronoi_backendcan opt in to the host-only Voro++ backend or the experimental SYCL-native (Ray et al. 2018) backend.
Cell volumes
Ionizing radiative transfer and dataset-sampled sources divide by each cell's
volume. cell_volume selects that volume:
| Value | Volume | Use for |
|---|---|---|
mass_over_density (default) |
Particle mass over density from the loader | Moving-mesh snapshots (AREPO), where this is the cell volume |
tessellation |
Volume of the particle's Voronoi cell | SPH snapshots (GADGET, EAGLE, GIZMO) |
pointcloud_voronoi:
loader: gadget
cell_volume: tessellation
gadget:
path: ./cutout.hdf5
fields: [PositionX, PositionY, PositionZ, Temperature, Density, Masses, VolumeCode]
SPH densities are kernel averages over neighboring particles, so mass over
density does not match the Voronoi cells that photons cross. In an optically
thin ionizing run on an EAGLE cutout, this raised per-cell photoionization
rates by 13 per cent on average and by about 50 per cent near
n_H = 10⁻² cm⁻³. With tessellation, densities stay as loaded; the total mass
seen by transport then differs from the particle mass by the ratio that the
setup log reports.
tessellation requires pointcloud_voronoi and a single MPI rank. It runs a
second host tessellation with the mesh's boundary and ghost-shell settings,
which takes roughly as long as building the mesh.
Gadget Loader Options
| Parameter | Type | Description |
|---|---|---|
path |
string | Path to Gadget snapshot directory or file |
catalog_path |
string | Path to FOF/subfind catalog (required for zoom_target) |
fields |
list or string | Field names to load, or all for scalar snapshot datasets |
file_ids |
list | Subset of chunk file IDs to load (e.g. [0, 1, 2]). If omitted, all chunks are loaded |
loading_mode |
int | 1: one reader per file distributes particles to MPI ranks; 0 (default): every rank reads and filters locally |
legacy_mode |
bool | Use legacy Gadget loading format |
load_workers |
int or auto |
Helper processes that read snapshot files ahead of the loader (default auto; 0: off) |
HDF5 decompresses one dataset at a time per process. Loader workers are helper
processes that read the file headers concurrently and then read and decompress
the next files while the loader works on the current one; values are identical
to in-process reads. The loader reads its first file itself and times it. With
load_workers: auto it then starts workers only if reading the remaining files
in-process would take more than a few seconds: about the ratio of reading to
other processing time plus one, up to a third of the OpenMP threads and at most
16. One file's read time cannot tell how well the file system serves several
readers at once, so auto mode then re-checks every 8 files (after the first 8,
while the workers start): while the loader
waits for the workers more than a fifth of the time, it adds workers by the
same ratio, measured with the workers running (at most doubling per step), and
stops adding once more workers no longer read files faster. If it started no
workers, it times the next 8 files and decides again. Header helpers start
from 64 files on (a fixed count caps them); with several MPI ranks, each rank
reads the headers of every N-th file and the counts are exchanged, so each
file header is opened once in total. An integer fixes the count; 0
reads everything in-process. Each worker holds up to two files of requested
datasets as doubles in shared memory, and with loading_mode: 1 every reading
rank starts its own workers. On a 128-file compressed snapshot on GPFS, 6
workers cut the file loop of a 36-thread run from 183 s to 43 s; on a
448-file uncompressed one, 12 workers cut the whole run from 624 s to 118 s.
Workers run thor-load-worker, a small HDF5-only program built and installed
next to thor (the environment variable THOR_GADGET_LOAD_WORKER can name
another path). It reads compressed snapshots through the same HDF5 filter
plugins (HDF5_PLUGIN_PATH). If it is missing, or from a different build,
thor starts copies of itself as workers instead, which work the same but
each carry thor's own startup memory (several hundred MB).
fields: all loads raw scalar datasets for the selected particle type, plus
THOR's required fields. Vector components and derived quantities are loaded
through recipes when requested or required.
Positions are always loaded. Gas line transfer and ray tracing also require
Temperature and VelocityX/Y/Z. Gadget SPH projections infer inputs from the
projection, weighting and populate settings, even with an omitted or empty
fields list. The default weighted mean requires Masses. List extra inputs
explicitly.
Projecting MaxDist uses the configured smoothing lengths. Listing it under
Gadget fields instead selects the snapshot recipe and overrides generation.
Mode 1 reads one file per rank concurrently, then exchanges particles after each round. It preserves mode-0 particle order and global cell IDs. Each reader stages one file; performance depends on storage, memory bandwidth, and MPI exchange.
Zoom Configuration
The Gadget loader supports two mutually exclusive ways to define a spatial cutout. You must use exactly one — specifying both will produce an error.
Option A: zoom_target — halo-centric cutout (requires catalog_path):
| Parameter | Type | Description |
|---|---|---|
hid |
int | Zero-based global row in the catalog's Group datasets |
rvir |
float | Cutout half-width as a multiple of Group_R_Crit200 |
Rows are counted across catalog files in numeric file-ID order. Snapshot file_ids
do not change this numbering. Row 0 is the first group; THOR does not sort groups by mass.
Rank 0 reads the selected GroupPos and Group_R_Crit200 row and broadcasts it so
every MPI rank uses the same target. The resulting zoom_box is centered on that
position, with half-width rvir * Group_R_Crit200, and clipped to the snapshot box.
Option B: zoom_box — explicit bounding box in normalized coordinates [0, 1]:
zoom_box can be placed either under the gadget: subsection or at the dataset level.
Frame.
zoom_boxis in full-box normalized coordinates ([0, 1]³), matching the simulation's native frame (comoving for cosmological runs). Particles that survive the filter are remapped to[0, 1]³inside the zoomed dataset, so downstream code sees a unit cube even when only a tiny sub-region was loaded.
Derived Field Cache (field_cache)
Point-cloud datasets can persist expensive derived particle fields for reuse.
Configure field_cache at the dataset level, as a sibling of the loader
subsection:
pointcloud_sph:
field_cache:
mode: auto
path: /scratch/.../frame_0307.fields.hdf5
request_fingerprint: <source-sha256-plus-recipe-config>
fields: [MaxDist]
gadget:
path: ...
particle_type: PartType4
smoothing_length: {mode: knn, knn_k: 32}
| Parameter | Type | Default | Description |
|---|---|---|---|
mode |
string | disabled |
One of disabled, load, save, or auto; see the mode semantics below |
path |
string | none | Cache HDF5 path; required when caching is enabled |
request_fingerprint |
string | none | Required caller-supplied identity for the source data and derivation request |
particle_type |
string | gadget.particle_type |
Particle group whose IDs and fields are cached; an explicit value must match gadget.particle_type in v1 |
fields |
list | none | Required nonempty list of scalar field names to cache, such as [MaxDist]; positions are not supported |
The modes have deliberately distinct failure and overwrite behavior:
disabledbypasses the cache and performs no cache I/O.loadrequires an existing compatible cache. A missing file, fingerprint mismatch, particle mismatch, or missing requested field is an error.savecomputes the requested fields through the normal loader and field recipes, then atomically replacespath; it does not reuse an existing cache.autoloads a compatible cache when present. A missing file or metadata mismatch causes it to compute the fields and attempt an atomic replacement. A malformed cache or an inexact particle-ID join is an error. If only the replacement write fails, the run continues with the computed fields.
Cache rows retain Gadget ParticleIDs as exact HDF5 uint64 values. IDs are
handled as integers rather than passing through a floating-point field type, so
large 64-bit IDs do not lose precision. On load, fields are joined by ID and
must cover every selected particle exactly; missing or duplicate IDs abort the
run. Cached fields are scalar values in THOR's canonical, post-conversion
representation. A loaded value is injected as already canonical and is not
unit-converted a second time.
Caching MaxDist is useful for stellar SPH projections: the first run performs
the configured smoothing-length derivation (for example, the kNN calculation),
while later load runs or auto cache hits reuse it instead of deriving the
smoothing lengths again.
request_fingerprint is opaque to THOR and is compared exactly; THOR does not
hash the source snapshot or recipe configuration for you. The config author is
responsible for constructing it from the source identity and every setting that
can affect particle selection or field values, including recipe and
smoothing-length configuration. Change the fingerprint whenever any of those
inputs change; keeping the same fingerprint incorrectly declares the old cache
valid.
Automatic fingerprints for SPH smoothing lengths
For Gadget SPH datasets, use thor-tools to set up smoothing-length caching
without choosing a fingerprint yourself. Run these commands before each
projection, from your usual THOR working directory:
thor-tools common field-cache prepare config.yaml \
--cache-path ./cache/stars-maxdist.hdf5 \
--precision fp32-i32 \
--executable /path/to/thor_fp32_i32 > config.cached.yaml
ACPP_VISIBILITY_MASK=cuda /path/to/thor_fp32_i32 config.cached.yaml
The first run saves the smoothing lengths; later runs reuse them when the inputs and settings match. Changing the camera does not require recomputing them.
Match --precision to your THOR executable, keep the cache outside the snapshot
directory, and write the prepared configuration to a different file from the
original. If your setup uses additional recipe or table files, include each with
--dependency /path/to/file.
File changes are detected by size and modification time, not by contents. If your
workflow preserves both when replacing files, supply your own content-based
request_fingerprint instead of using this helper.
The v1 field-cache path supports single-rank Gadget point-cloud loads only. Writers publish through an atomic rename, so another run observes either the previous complete cache or the new complete cache, not a partially written file.
This cache is a THOR-managed, regenerable optimization. In contrast,
gadget.aux_fields imports externally produced, authoritative data and joins it
by ParticleIDs; THOR neither derives nor writes those auxiliary values.
Auxiliary Fields (aux_fields)
Load externally-computed per-particle fields from a companion HDF5, joined to
the loaded particles by ParticleIDs — the snapshot itself is untouched. The
typical use is projecting a derived quantity through the SPHProjector, e.g. the
per-star attenuated luminosity from a source_points obscuration run.
pointcloud_sph:
gadget:
path: snap.hdf5
particle_type: PartType4
zoom_box: [[...], [...], [...]]
aux_fields:
path: ./stars_atten.hdf5 # companion file; snapshot untouched
min_coverage: 0.999 # error if fewer loaded particles match a sidecar ID
# missing_value: 0.0 # value for loaded particles absent from the sidecar
# validate_zoom_box: true # error if /Meta.zoom_box != this run's zoom_box
# group: PartType4 # sidecar HDF5 group (defaults to particle_type)
Sidecar layout (a single file, keyed by ParticleIDs):
stars_atten.hdf5
/Meta attrs: zoom_box (3×2), snapshot, thor_ref (optional)
/PartType4/ParticleIDs uint64[N] # the join key
/PartType4/AttenuatedLuminosity float64[N] # projectable field(s)
/PartType4/<other> float64[N]
Every dataset except ParticleIDs is injected as a field of the same name;
select it in a projector's fields: list. The join happens before THOR's
internal Hilbert reordering, so the values stay aligned with their particles.
If fewer than min_coverage of the loaded particles match a sidecar ID — or the
/Meta.zoom_box stamp disagrees with the run — the reader aborts rather than
project a stale sidecar. The matching key is the ParticleIDs that
source_points writes (tracers/source_particle_ids).
Cloudy Tables
When cloudy.enabled: true, Thor loads pre-computed Cloudy ionization and emission grids to derive line emissivities and absorption coefficients from the gas properties.
For snapshot datasets, THOR validates the table metadata at initialization and reads each requested ion or emission line on first use. Only the selected redshift slice (or the two bracketing slices when interpolating) is read. Repeated field requests reuse the cached table; the table files must remain available while new fields are being evaluated.
| Parameter | Type | Description |
|---|---|---|
enabled |
bool | Enable Cloudy table lookups |
emission_table_path |
string | Path to Cloudy emission grid HDF5 |
ion_table_path |
string | Path to Cloudy ionization grid HDF5 |
redshift_interp |
bool | Load the redshift-resolved (4D) tables. The dataset redshift is snapped to the nearest slice, not interpolated |
interpolation_order |
int | Interpolation order (only 1 = linear is supported) |
redshift_tolerance |
float | Max |z_table − z_dataset| when snapping; the load aborts beyond it. Default 0.05 |
interpolate_redshift |
bool | Blend the two bracketing redshift slices (linearly in the stored log10 values) instead of snapping to the nearest. The shipped tables are spaced dz = 0.5, so a dataset at an arbitrary epoch can sit 0.25 from a slice — and because the snap jumps at the midpoint, a sweep across redshift inherits a dz = 0.5 sawtooth in every Cloudy-derived quantity. A dataset that sits on a slice is unaffected. Default false (preserves snapping) |
Each tabulated line provides cloudyemission_<line> (emissivity, \(\mathrm{erg\,s^{-1}\,cm^{-3}}\)) and
cloudyemission_<line>_times_volume (luminosity, \(10^{42}\,\mathrm{erg\,s^{-1}}\)), where <line> is the
abbreviation if one exists. OVI and OVI_2 are the 1032 and 1038 Å lines. When the table has
both, cloudyemission_OVI_doublet and cloudyemission_OVI_doublet_times_volume give their sum, the
source for a doublet MCRT run. MgII is already Cloudy's blend of both components.
For DatasetSource emission, load cloudyemission_<line>_source and populate
Emissivity from it. This recipe converts CGS emissivity to
\(10^{42}\,\mathrm{erg\,s^{-1}\,Mpc^{-3}}\) in host double precision before
storage in the configured simulation precision. It also supports doublet sums,
such as cloudyemission_OVI_doublet_source. In FP32, request VolumeCode
instead of physical Volume to avoid overflowing cubic centimeters. Raw CGS
and _times_volume recipes retain their existing units; values outside the
normal storage range still raise an error.
When storing Cloudy ion number densities in FP32, positive values below the smallest normal FP32 value (about \(1.175\times10^{-38}\,\mathrm{cm^{-3}}\)) become zero. Normal values, including \(10^{-20}\,\mathrm{cm^{-3}}\), use ordinary FP32 rounding. Negative, nonfinite, and overflowing values remain errors. This storage policy follows density aliases, filters, and field-cache metadata; double-precision recipe values and other fields retain their existing behavior.
Element abundances. The tables assume the GASS10 solar abundance pattern.
cloudydensity_<ion> and cloudyemission_<line> both take the emitting
element's mass fraction from GFM_Metals_<X>. Emission of a metal line is the
table value times X / X⊙, so opacity and emission follow the same
element abundance. Hydrogen lines are not rescaled. Snapshots that store only a
total metallicity Z use X = (Z / Z⊙) X⊙, with
Z⊙ = 0.0127, which keeps the solar pattern.
GIZMO snapshots (FIRE, Simba) store Metallicity with several values per
particle. THOR recognizes this layout from the number of values per particle
(at least 11) and needs no configuration. Column 0 is the total metallicity Z,
and columns 1–10 are He, C, N, O, Ne, Mg, Si, S, Ca and Fe. Further columns,
such as the four r-process tracers in FIRE-2, are ignored. Hydrogen is
1 − Z − Y. Other elements use the solar-scaled total metallicity. The load
fails if column 1 is not a plausible helium fraction or if columns 2–10 do not
make up most of Z, which catches codes that share the column count but not the
order. Any count from 2 to 10 values per particle is rejected. TNG's
GFM_Metals (H, He, C, N, O, Ne, Mg, Si, Fe and all other metals) must have
exactly 10 values per particle.
AtomDB Tables
AtomDB tables provide low-density collisional-ionization-equilibrium (CIE)
ion fractions and line emission. The Gadget loader supports them for
pointcloud_voronoi datasets:
pointcloud_voronoi:
loader: gadget
atomdb:
table_path: cluster-cie.h5
lines: [FeXXV_w]
ions: [FeXXV]
temperature_bounds: {below: zero, above: error}
Select the derived fields in gadget.fields or use them in field recipes.
MCRT can request an ion density directly with
line.density_field, without a Cloudy field alias:
| Field | Units |
|---|---|
atomdbdensity_<ion> |
Ion number density, cm⁻³ |
atomdbemission_<line> |
Emissivity, 1042 erg s⁻¹ Mpc⁻³ |
atomdbemission_<line>_times_volume |
Cell luminosity, 1042 erg s⁻¹ |
| Parameter | Description |
|---|---|
table_path |
Path to an exported AtomDB HDF5 table |
lines, ions |
Aliases or maps of labels to atomic identities |
atomdb_version |
Optional check against the version stored in the table |
temperature_bounds |
below and above: error (default), clamp, or zero |
mass_fraction_fields |
Optional map from atomic number to a gas mass-fraction field |
AtomDB 3.1.3 aliases are FeXXV_w, FeXXV_x, FeXXV_y, FeXXV_z,
FeXXV_HeBeta, and the ion FeXXV. For a custom label or transition:
lines:
resonance: FeXXV_w
custom: {atomic_number: 26, ion_charge: 24, upper_level: 5, lower_level: 1}
Emission uses gas temperature, electron density, and elemental mass fractions;
ion density uses temperature and elemental mass density. Dedicated elemental
fractions take precedence over solar-scaled total metallicity. Explicit
mass_fraction_fields entries must name existing mass fractions.
Values interpolate linearly in log₁₀(T/K). clamp uses the nearest endpoint;
zero removes tabulated emission and ion opacity outside the temperature range
without changing the gas temperature. Use zero only where those contributions
are negligible. Continuum is stored in the table but has no dataset recipe yet.
See table preparation and the Fe XXV example for a complete simulation.
Stellar Particle Loading
Stellar particles project through pointcloud_sph + driver_type: sphprojector for all eight AGORA codes. Two routes:
Gadget-family HDF5 snapshots (AREPO, GADGET-3, GIZMO, GEAR) — use the existing loader: gadget with one extra knob:
dataset_type: pointcloud_sph
pointcloud_sph:
loader: gadget
gadget:
path: ./input/snap.hdf5
particle_type: PartType4 # PartType4 = stars (AREPO/Gadget3/GIZMO);
# PartType1 = stars in GEAR; default PartType0 = gas
fields: [Masses, Metallicity, StellarAge]
zoom_box: [[xmin,xmax], [ymin,ymax], [zmin,zmax]]
smoothing_length: # see "Smoothing Length" below
mode: knn
knn_k: 32
clamp_percentile: 95.0
In TNG, GFM_StellarFormationTime <= 0 marks wind particles. Their rows are
preserved, with StellarAge = NaN and zero emission from the stellar Lyα and
BPASS recipes.
ChaNGa Tipsy uses loader: tipsy with particle_type: stars. AMR codes (RAMSES / ENZO / ART) use dedicated loaders that bypass the octree path entirely and feed the per-format star catalog reader straight into a pointcloud_sph dataset:
| Loader | YAML key | Path argument | Source data |
|---|---|---|---|
loader: ramses_stars |
ramses_stars: |
snapshot_dir (or path) |
part_<isnap>.out* Fortran-binary star particles |
loader: enzo_stars |
enzo_stars: |
parameter_file (or path) |
RD####.cpu#### HDF5 star particles, ptype==2 |
loader: art_stars |
art_stars: |
snapshot_dir (or path) |
stars_<isnap>.dat (records 3,4,5 = pw,pw0,tbirth; 6,7 = zstII,zstIa) |
All three accept the same zoom_box and smoothing_length subsections as the gadget loader.
Projection normalization
driver_type: sphprojector turns the per-particle kernel splat into a pixel value
according to operators.projections.normalization:
normalization |
Result per pixel | Use for |
|---|---|---|
mean (default) |
kernel-weighted average Σ qᵢ wᵢ W / Σ wᵢ W, weighted by the weight: field (default Masses) |
intensive fields (temperature, metallicity) |
column_integral |
line-of-sight integral ∫q dz (× boxsize_cm); matches the ray tracer's unweighted projection |
column densities ∫n dz, comparison vs the ray tracer |
mass_projection |
mass-conserving surface density (÷ boxsize_cm²) so ∫result dA = Σ qᵢ |
extensive per-particle quantities, e.g. stellar surface density Σ★ (q = mass) |
In mean mode the weight: field chooses the weighting: any field name (default
Masses) gives a field-weighted average, while weight: none gives an unweighted
average Σ qᵢ W / Σ W (each particle counted only by kernel coverage; the Masses
field is not required). weight: is ignored by the two sum-modes.
sphprojector:
operators:
projections:
fields: [Masses]
normalization: mass_projection # Σ★ surface density in g/cm²
The older use_weighting/perform_averaging booleans are still accepted (deprecated):
use_weighting: true, perform_averaging: true → mean;
use_weighting: false, perform_averaging: true → mean + weight: none (unweighted average);
use_weighting: false, perform_averaging: false → mass_projection.
Metallicity convention. Each AMR star reader returns per-particle metallicity as a mass fraction Z = M_metals / M_total (dimensionless, typical range 0 – a few percent). RAMSES reads record 20 of part_*.out directly. ENZO reads the metallicity_fraction HDF5 dataset. ART sums the SNII and SNIa metal mass fractions (zstII + zstIa from records 6 and 7 of stars_*.dat). Downstream recipes that expect Z/Z☉ must divide by Z_sun ≈ 0.0134 themselves.
Smoothing Length
Stars don't carry an SPH MaxDist field natively, so the pointcloud_sph loaders compute one. Configure under <loader>.smoothing_length:
| Parameter | Type | Default | Description |
|---|---|---|---|
mode |
string | knn |
knn (per-particle k-th NN distance) or constant (fixed default_boxunits) |
knn_k |
int | 32 |
Number of nearest neighbors. Range [2, 32]. Smaller k → more granular per-star kernels; larger k → smoother. Auto-clamped to N-1 if N < knn_k. |
clamp_percentile |
float | 99.0 |
Caps the upper tail of the kNN distribution at this percentile (suppresses peripheral-star outliers with sparse neighborhoods). Set <0 to disable. |
max_boxunits |
float | -1.0 |
Hard absolute cap on h. The tighter of clamp_percentile and max_boxunits wins. -1 disables. |
default_boxunits |
float | 1e-3 |
Used only when mode: constant. |
mode: knn is the default and is auto-invoked at the end of init_gadget for SPH datasets (or any dataset that supplies a smoothing_length: subsection). It runs only when MaxDist is still unset. A MaxDist listed under the gadget fields is filled while loading, from the gas recipe (the volume-equivalent cell radius, (3 Masses / (4π Density))^(1/3)) or a raw dataset. smoothing_length is then ignored, with a warning. For VORONOI datasets compiled with use_hilbert_knn_for_voronoi=ON, only mode: constant works (HilbertGridKNN supports K=1 queries only).