GridKit File Format¶
A StarKit grid is an HDF5 file with four parts:
indexA pandas DataFrame, written with
to_hdf, with one row per model and a column for each grid parameter.fluxesA 2D array written with h5py, with one row per model in the order of
indexand one column per wavelength.wavelengthA pandas DataFrame whose first column holds the wavelength of each flux column.
metaThe grid metadata, a pandas Series written with
to_hdf.
load_grid reads these metadata entries:
parametersList of the
indexcolumns to interpolate in.grid_typeOnly
'log'is supported: wavelengths evenly spaced in the logarithm of the wavelength.RResolving power of the grid spectra.
R_samplingNumber of pixels per resolution element.
wavelength_unitAstropy unit of
wavelength.wavelength_type'air'or'vacuum'.flux_unitAstropy unit of
fluxes. For many grids this label is wrong; see Grid Flux Units.format_versionGrid format version, currently
'v1.0'.
The grids that StarKit builds also store bibtex and uuid.
The metadata can be stored in two ways. StarKit writes it as a Series of
Python objects, in which parameters is a list and R is a number.
Alternatively, every entry can be stored as JSON text, in a Series or in a
one-column DataFrame: parameters as '["teff", "logg"]' and
wavelength_type as '"vacuum"', for example. load_grid decodes the
metadata only when every entry is text, so text entries in the first layout,
such as a uuid, are read unchanged.
Inspecting a grid¶
inspect_grid reports a grid’s parameters and their sampling, the fraction
of the full parameter grid that has models, the wavelength range and sampling,
and the metadata, without reading the fluxes:
from starkit.gridkit.inspector import inspect_grid, format_inspection_summary
print(format_inspection_summary(inspect_grid("grid.h5")))
To check what the fluxes are, use check_flux_scale, described in
Grid Flux Units.