forcepho.postprocess#

Classes and methods in the forcepho.postprocess module are used to manipulate and view the results of optimization and sampling.

class forcepho.postprocess.Residuals(filename)#

Structure for reading and storing residual data for a single patch from HDF5 files generated by forcepho.utils.write_residuals. Includes convenience methods for plotting residuals or placing them within larger original images.

fill_images(images={}, headers={}, fill_type='residual', metastore=None, imshape=(2048, 2048))#

Add the stored pixel data to the images in the supplied images dictionary.

class forcepho.postprocess.Samples(filename)#

An alias for the forcepho.fitting.Result class

forcepho.postprocess.chain_pdf(samples, fn='./chain.pdf', dh=1.0)#

Make a PDF of the posterior chains for every object in a patch

Parameters:

samples (forcepho.reconstruction.Samples instance) – The posterior samples object for a given patch with chain information.

forcepho.postprocess.postop_catalog(root, bands=None, catname=None)#

Make an input catalog from the post-optimization catalog. This catalog will be suitable for use as the inital catalog for a sampling run

Also attemps to make a catalog of flux uncertainties in the 2nd extension. These are based on precision matrices if available.

Parameters:
  • root (string) – Name of the directory containing the optimization results

  • bands (list of strings) – Name of the bands to include in the postop catalog.

  • catname (string) – Name of the output catalog

forcepho.postprocess.postsample_catalog(root, catname=None, patches=None)#

Make a catalog of posterior samples for each parameter, combining all patches in a given run.

Parameters:
  • root (string) – Name of the directory containing the optimization results

  • patches (list of ints)

Returns:

cat – A structured array of posterior samples, of shape (n_source,). Each row corresponds to a different input source, and has fields for the parameters of that source each with shape (n_sample,)

Return type:

structured ndarray

forcepho.postprocess.write_images(root, subdir='image', metafile=None, show_model=False, show_chi=False)#

Make data, residual, and optionally model images for the last iteration of the chain.