src.superphot_plus.file_utils

Methods for reading and writing input, intermediate, and output files.

Module Contents

Functions

get_posterior_filename(lc_name[, fits_dir, sampler])

Get the file name for equal weight posterior samples from a lightcurve fit.

get_posterior_samples(lc_name[, fits_dir, sampler])

Get all EQUAL WEIGHT posterior samples from a lightcurve fit.

get_multiple_posterior_samples(lc_names, fits_dir[, ...])

Reads all EQUAL WEIGHT posterior samples for a set of lightcurve fits.

has_posterior_samples(lc_name[, fits_dir, sampler])

Determine if we already have some posterior sample data for the lightcurve.

get_posterior_filename(lc_name, fits_dir='.', sampler=None)[source]

Get the file name for equal weight posterior samples from a lightcurve fit.

Parameters:
  • lc_name (str) – Lightcurve name.

  • fits_dir (str, optional) – Output directory path. Defaults to FITS_DIR.

  • sampler (str, optional) – Variety of sampler. Can be included in the sample file name.

Returns:

File name for numpy array file containing the posterior samples.

Return type:

str

get_posterior_samples(lc_name, fits_dir=None, sampler=None)[source]

Get all EQUAL WEIGHT posterior samples from a lightcurve fit.

Parameters:
  • lc_name (str) – Lightcurve name.

  • fits_dir (str, optional) – Output directory path. Defaults to FITS_DIR.

  • sampler (str, optional) – Variety of sampler. Can be included in the sample file name.

Returns:

Numpy array containing the posterior samples.

Return type:

np.ndarray

get_multiple_posterior_samples(lc_names, fits_dir, sampler=None)[source]

Reads all EQUAL WEIGHT posterior samples for a set of lightcurve fits.

Parameters:
  • lc_names (str) – Lightcurve names.

  • fits_dir (str, optional) – Output directory path. Defaults to FITS_DIR.

  • sampler (str, optional) – Variety of sampler. Can be included in the sample file name.

Returns:

Dictionary mapping the posterior samples to the light curves specified.

Return type:

dict of np.ndarray

has_posterior_samples(lc_name, fits_dir=None, sampler=None)[source]

Determine if we already have some posterior sample data for the lightcurve.

Parameters:
  • lc_name (str) – Lightcurve name.

  • fits_dir (str, optional) – Output directory path. Defaults to FITS_DIR.

  • sampler (str, optional) – Variety of sampler. Can be included in the sample file name.

Returns:

Does a file already exist for the lightcurve fit

Return type:

boolean