src.superphot_plus.plotting.sampling_results

This module contains scripts to plot sampling results.

Module Contents

Functions

plot_corner_plot_all(names, labels, fits_dir, save_dir)

Plot combined corner plot of all training set samples, excluding

plot_posterior_hist_numpyro_dict(posterior_samples, ...)

Plot histogram for a posterior parameter.

plot_sampling_trace_numpyro(posterior_samples[, ...])

Plot trace of all posterior samples.

compare_oversampling(names, labels, fits_dir, save_dir)

Compare plots of various oversampling methods.

plot_oversampling_1d(names, labels, fits_dir, save_dir)

Save all 1d oversampled histograms for each parameter, in one plot.

plot_combined_posterior_space(names, labels, fits_dir, ...)

Plot 2D scatterplots for each pair

plot_param_distributions(names, labels, fit_folder, ...)

Plot the parameter distributions to get better priors for fitting.

plot_feature_umap(psg, save_path)

Plot 2D UMAP of sampling features.

plot_feature_pacmap(psg, save_path)

Plot 2D PACMAP of sampling features.

Attributes

OVERSAMPLE_SIZE

OVERSAMPLE_SIZE = 4000[source]
plot_corner_plot_all(names, labels, fits_dir, save_dir, aux_bands=Survey.ZTF().priors.aux_bands)[source]

Plot combined corner plot of all training set samples, excluding the overall scaling A.

Parameters:
  • names (array-like) – List of object names.

  • labels (array-like) – Class labels associated the objects in names.

  • fits_dir (str) – Where object model fits are stored.

  • save_dir (str) – Path to save the combined corner plot.

  • aux_bands (array-like, optional) – The auxiliary bands of the fits (for plotting lables). Defaults to ZTF’s aux bands.

plot_posterior_hist_numpyro_dict(posterior_samples, parameter, output_dir=None)[source]

Plot histogram for a posterior parameter.

Parameters:
  • posterior_samples – Dictionary of posterior samples.

  • parameter – Posterior parameter for which to plot histogram.

  • output_dir – The directory where to store the plot.

plot_sampling_trace_numpyro(posterior_samples, output_dir=None)[source]

Plot trace of all posterior samples.

Parameters:
  • posterior_samples – The lightcurve samples given by MCMC.

  • output_dir – The directory where to store the plot.

compare_oversampling(names, labels, fits_dir, save_dir, allowed_types=SnClass.all_classes(), aux_bands=Survey.ZTF().priors.aux_bands, sampler=None, goal_per_class=1000)[source]

Compare plots of various oversampling methods.

Parameters:
  • input_csv (str) – Where supernova list is stored.

  • allowed_types (array-like) – Types to include in plot.

plot_oversampling_1d(names, labels, fits_dir, save_dir, priors=Survey.ZTF().priors, sampler='dynesty')[source]

Save all 1d oversampled histograms for each parameter, in one plot. Overlays prior distributions.

Parameters:
  • names (array-like) – List of all object names.

  • labels (array-like) – List of all labels associated with ‘names’.

  • fits_dir (str) – Directory where model fits are stored.

  • save_dir (str) – Where to save figure.

  • priors (MultibandPriors, optional) – Prior object to overlay prior distributions. Defaults to ZTF’s priors.

plot_combined_posterior_space(names, labels, fits_dir, save_dir, aux_bands=Survey.ZTF().priors.aux_bands)[source]

Plot 2D scatterplots for each pair of fit parameters, to identify clustering among different subclasses.

TODO: modify to plot different points for each type.

Parameters:
  • fits_fn (str) – File path for fit posteriors.

  • save_dir (str) – Where to save figure

plot_param_distributions(names, labels, fit_folder, save_dir, overlay_gaussians=True, aux_bands=Survey.ZTF().priors.aux_bands)[source]

Plot the parameter distributions to get better priors for fitting.

Parameters:
  • fit_folder (str) – Where the posterior fits are stored.

  • save_dir (str) – Where to save the output figures.

  • overlay_gaussians (boolean, optional) – Whether to overlay Gaussian estimate of distribution. Defaults to True.

plot_feature_umap(psg, save_path)[source]

Plot 2D UMAP of sampling features.

Parameters:
  • psg (PosteriorSamplesGroup) – The group of posteriors to map

  • save_path (str) – Where to save the resulting figure.

plot_feature_pacmap(psg, save_path)[source]

Plot 2D PACMAP of sampling features.

Parameters:
  • psg (PosteriorSamplesGroup) – The group of posteriors to map

  • save_path (str) – Where to save the resulting figure.