Skip to content

Output Formats

Lazy.jl can output results as FITS (default), HDF5, or both. The format is controlled by the output_file extension or the output_format parameter.

FITS Output

The output is a multi-extension FITS file.

SUMMARY Extension

The primary results table. Always present.

Core columns:

ColumnTypeDescription
IDIntObject identifiers from input catalog
z_bestFloatBest-fit redshift (minimum chi-squared)
chi2FloatBest-fit chi-squared value
z_l95FloatLower 95% confidence bound (2.5th percentile of P(z))
z_l68FloatLower 68% confidence bound (16th percentile)
z_medFloatMedian redshift (50th percentile of P(z))
z_u68FloatUpper 68% confidence bound (84th percentile)
z_u95FloatUpper 95% confidence bound (97.5th percentile)
coeffsFloat arrayBest-fit template coefficients (length = number of templates)

Per-band photometry: One column per filter with the best-fit model flux (e.g., f606w, f115w).

P(z) summary statistics:

ColumnTypeDescription
SzFloatCenter of the unit-width redshift bin containing the most P(z)
Pz_cenFloatIntegrated P(z) within 0.15(1+z) of z_best
Pz_zgtrzb2FloatIntegrated P(z > z_best - 2)
pz_gt{Z}FloatP(z > Z) for each integer Z in the grid (e.g., pz_gt3, pz_gt5)
Pz{n}FloatIntegrated P(z) in integer-centered unit bins

Conditional columns (depending on configuration):

ColumnPresent whenDescription
z_specuse_zspec = trueInput spectroscopic redshift
M_UV, M_U, M_V, M_Joutput_restframe_mags = trueRest-frame absolute magnitudes
z_best_lowzoutput_forced_lowz = trueBest-fit redshift from forced low-z fit
chi2_lowzoutput_forced_lowz = trueChi-squared from forced low-z fit
delta_chi2output_forced_lowz = truechi2_lowz - chi2_best
z_l95_lowz ... z_u95_lowzoutput_forced_lowz = trueLow-z P(z) quantiles
coeffs_lowzoutput_forced_lowz = trueLow-z template coefficients

PZ Extension

Present when output_pz = true. Contains the full redshift probability distribution for each object.

ColumnTypeDescription
IDIntObject ID (-1 for the first row, which stores the redshift grid)
PzFloat arrayP(z) values (first row contains the redshift grid values)

The first row is a sentinel with ID = -1 and Pz = the redshift grid. Subsequent rows contain the P(z) for each object.

TEMPL Extension

Present when output_templates = true. Contains the IGM-attenuated template SEDs at each redshift, enabling full SED reconstruction.

ColumnTypeDescription
zFloatRedshift grid (-1 for the first row, which stores the wavelength grid)
{template_name}Float arrayTemplate flux at each redshift (first row contains the common wavelength grid in Angstroms)

Reconstructing Best-Fit SEDs

With both output_templates = true and the SUMMARY coefficients, you can reconstruct the best-fit SED for any object:

python
from astropy.io import fits
import numpy as np

ID = 1
lazy_file = 'results.fits'

# Load results
lazy_summary = fits.getdata(lazy_file, ext=1)
i = np.where(lazy_summary['ID'] == ID)[0][0]
z_best = lazy_summary['z_best'][i]
coeffs = lazy_summary['coeffs'][i]

# Load templates
lazy_templ = fits.getdata(lazy_file, ext=3)
izbest = np.argmin(np.abs(z_best - lazy_templ['z']))
template_names = [n for n in lazy_templ.dtype.names if n != 'z']
templates = np.array([lazy_templ[t][izbest] for t in template_names])

# Reconstruct SED
wavelength = lazy_templ[template_names[0]][0] * (1 + z_best)  # Observed wavelength
fnu = np.dot(templates.T, coeffs)

HDF5 Output

When the output file ends in .h5 or .hdf5, or when output_format = 'hdf5':

results.h5
├── metadata/           # Run parameters and configuration
├── results/            # Main fitting results (zbest, chi2, coeffs, quantiles, ...)
├── photometry/         # Best-fit model photometry per band
├── pz/                 # P(z) distributions (if output_pz = true)
│   ├── chi2grid         # Chi-squared at each redshift (nz x nobj)
│   └── pz               # Normalized P(z) (nz x nobj)
└── templates/          # Template SEDs (if output_templates = true)

HDF5 output uses compression and chunking for efficient storage of large datasets. It is also the format used internally for chunked processing work files.