Postprocessing#
- lightning.postprocessing.postprocess_catalog(res_filenames, model_filenames, solver_mode='mcmc', model_mode='json', names=None, catalog_name='postprocessed_catalog.hdf5')#
Given lists of result files and model files, merge the results into a postprocessed catalog.
This script uses h5py to produce an output file in HDF5 format. We’ve made this choice to easily allow for non-homogeneous model setups, e.g. different numbers of bandpasses and parameters per source. The structure and content of the HDF5 file is as follows (for each source):
└──sourcename ├── mcmc │ ├── logprob_samples (Nsamples) │ └── samples (Nsamples, Nparams) ├── parameters │ ├── modelname │ │ └── parametername │ │ ├── best () │ │ ├── hi () │ │ ├── lo () │ │ └── med () └── properties ├── filter_labels (Nfilters) ├── lnu (Nfilters) ├── lnu_unc (Nfilters) ├── lumdist () ├── mstar │ ├── best () │ ├── hi () │ ├── lo () │ └── med () ├── redshift () └── pvalue ()The “modelname” and “parametername” groups under the “parameters” group repeat for every model and parameter. For piecewise-constant SFHs the “properties” group also contains the age bin edges for the SFH. Quantiles (”/lo” and “/hi”) are computed at the 16 and 84th percentile.
For solver_mode=’mcmc’, the chains are also expected to be in HDF5 format, with the following structure:
mcmc ├── logprob_samples (Nsamples) ├── samples (Nsamples, Nparams) └── autocorr (Nparams)
Whereas for solver_mode=’mle’, the results are expected to be formated as:
res ├── bestfit (Nparams) └── chi2_best ()
I’ll provide a function to make such HDF5 result files soon if I haven’t already.
- Parameters:
- res_filenamesarray-like, str
A list of filenames pointing to the result files.
- model_filenamesarray-like, str
A list of filenames poitning to the model files (either json or pickles).
- model_modestr
Method for model serialization, either “json” or “pickle”. (Default: “json”)
- namesarray-like, str
Names for each of the galaxies. If None (default), we’ll just guess based on the filenames of the chains assuming that they’re named something like [NAME]_chain.h5.
- catalog_namestr
(Default: “postprocessed_catalog.hdf5”)
- Returns:
- None
Notes
TODO:
Allow user-supplied quantiles.
Add additional properties; allow user specification of properties? That might be a whole chore.