py21cmemu.outputs

Module whose functionality is to organise the emulator output.

Output Quantities and Units

All output quantities are returned as astropy Quantities with units attached.

Linear quantities (returned in physical units): - Tb : Brightness temperature [mK] - xHI : Neutral hydrogen fraction [dimensionless, 0-1] - Ts : Spin temperature [K] - Tr : Radio temperature [K] (radio emulator only) - tau : Optical depth to reionization [dimensionless] - PS : 21-cm power spectrum Δ² [mK²] in LINEAR units - PS_2D : 2D power spectrum [mK²] in LINEAR units (MH emulator only) - PS_2D_samples : 2D PS samples [mK²] in LINEAR units

Logarithmic quantities (returned in dex units): - UVLFs : UV luminosity functions [dex(Mpc^-3 mag^-1)] = log10(φ)

To convert log quantities to linear, use .physical:

output.UVLFs.physical  # returns Mpc^-3 mag^-1

Coordinate axes (returned with units): - redshifts : Redshift values [dimensionless] - kperp, kpar, k : Wavenumbers [Mpc^-1] - Muv : UV magnitude [mag]

Error Statistics

Error statistics are available via properties like output.PS_err.

IMPORTANT: PS is ALWAYS returned in LINEAR mK² units. Internally, PS values are normalized and trained in log10 space, but they are converted to linear units before being returned to the user. If you need log10(PS), use np.log10(output.PS).

Error types: - PS_err: Median fractional error (FE%) computed on log10(PS) values - PS_2D_err: Median FE% on 2D PS log10 values - PS_2D_var: Variance of FE% across test set - PS_2D_cov: Covariance matrix of FE% between pixels

Fractional error is defined as:

FE% = |log10(true) - log10(predicted)| / |log10(true)| × 100

Interpretation: A 5% FE on log10(PS) corresponds to ~12% error on linear PS, because a 5% error in the log10 exponent multiplies the result by 10^0.05 ≈ 1.12.

See MHEmulatorProperties for detailed documentation of all error statistics.

Note: The RawEmulatorOutput classes store raw numpy arrays without units. The EmulatorOutput classes (returned by emulator.predict()) automatically attach units to all quantities.

Classes

ACGEmulatorErrors(PS_err, Tb_err, xHI_err, ...)

Error statistics for the ACG/Default (v1) emulator.

ACGEmulatorOutput(Tb, xHI, Ts, PS, tau, UVLFs)

Output from the ACG (v1) emulator.

ACGRawEmulatorOutput(output)

A simple sub data-class that makes it easier to access the raw emulator output.

EmulatorErrors()

Base class for emulator error statistics.

EmulatorOutput()

Base class for emulator output with automatic unit handling.

MCGEmulatorErrors(PS_err, Tb_err, xHI_err, ...)

Error statistics for the MCG (v3) emulator with proper astropy units.

MCGEmulatorOutput(Tb, xHI, Ts, tau, UVLFs, ...)

Output from the MH/MCG (v3) emulator.

MCGRawEmulatorOutput(output)

A data class that wraps raw v3 emulator outputs.

RadioEmulatorErrors(PS_err, Tb_err, xHI_err, ...)

Error statistics for the Radio Background (v2) emulator.

RadioEmulatorOutput(Tb, xHI, Tr, PS, tau)

Output from the Radio (v2) emulator.

RadioRawEmulatorOutput(output)

A simple sub data-class that makes it easier to access the raw emulator output.

RawEmulatorOutput(output)

A super data-class that makes it easier to access the raw emulator output.