petitRADTRANS.retrieval.plotting#

Classes#

RetrievalPlotter

Plotting companion for Retrieval.

Module Contents#

class petitRADTRANS.retrieval.plotting.RetrievalPlotter(retrieval, reference_data_name=None)#

Plotting companion for Retrieval.

The plotter owns the plotting-related configuration that used to live in the retrieval configuration object. These attributes can be adjusted after construction through retrieval.plotter and are used by the plotting and model-evaluation helpers throughout the retrieval module.

Attributes:
spec_xlabelstr

Label for the wavelength axis in spectrum plots.

spec_ylabelstr

Label for the flux axis in spectrum plots.

y_axis_scalingfloat

Multiplicative scaling applied when plotting spectra and contribution-like outputs.

xscalestr

X-axis scaling used in spectral plots.

yscalestr

Y-axis scaling used in spectral plots.

resolutionfloat

Plotting resolution used when rebinned observational data are shown.

nsampleint | float

Default number of posterior samples used in sampled plotting utilities.

temp_limitslist[float] | tuple[float, float] | None

Optional x-axis limits for pressure-temperature plots.

press_limitslist[float] | tuple[float, float] | None

Optional y-axis limits for pressure-temperature plots.

flux_limlist[float] | tuple[float, float] | None

Optional y-axis limits for spectral plots.

wavelength_limlist[float] | tuple[float, float] | None

Optional x-axis limits for spectral plots.

reference_data_namestr | None

Name of the dataset used as the default plotting reference. If not provided at construction time, it defaults to the first key in retrieval.configuration.data.

_local_attributes#
__getattr__(name)#
__setattr__(name, value)#
get_reference_data_name()#
get_reference_data()#
get_reference_radtrans_name()#
get_reference_radtrans_data()#
_is_plotting_root()#
_synchronize()#
static _get_clipped_contribution_output(auxiliary_outputs)#
plot_abundances(samples_use, parameters_read, species_to_plot=None, contribution=False, refresh=True, model_generating_function=None, prt_reference=None, mode='bestfit', sample_posteriors=False, volume_mixing_ratio=False)#

Plot the abundance profiles in mass fractions or volume mixing ratios as a function of pressure.

Args:
samples_usenumpy.ndarray

An array of the samples from the post_equal_weights file, used to find the best fit sample

parameters_readlist

A list of the free parameters as read from the output files.

species_to_plotlist

A list of which molecular species to include in the plot.

contributionbool

If true, overplot the emission or transmission contribution function.

prt_referencestr

If specified, the pRT object of the data with name pRT_reference will be used for plotting, instead of generating a new pRT object at R = 1000.

model_generating_function(callable, optional):

A function that returns the wavelength and spectrum, and takes a Radtrans object and the current set of parameters stored in self.configuration.parameters. This should be the same model function used in the retrieval.

refreshbool

If True (default value) the .npy files in the evaluate_[retrieval_name] folder will be replaced by recalculating the best fit model. This is useful if plotting intermediate results from a retrieval that is still running. If False no new spectrum will be calculated and the plot will be generated from the .npy files in the evaluate_[retrieval_name] folder.

modestr

‘bestfit’ or ‘median’, indicating which set of values should be used for plotting the abundances.

sample_posteriorsbool

If true, sample the posterior distributions to calculate confidence intervals for the retrieved abundance profiles.

volume_mixing_ratiobool

If true, plot in units of volume mixing ratio (number fraction) instead of mass fractions.

Returns:
figmatplotlib.figure

The matplotlib figure, containing the data, best fit spectrum and residuals.

axmatplotlib.axes

The upper pane of the plot, containing the best fit spectrum and data.

ax_rmatplotlib.axes

The lower pane of the plot, containing the residuals between the fit and the data.

plot_all(output_directory=None, ret_names=None, contribution=False, model_generating_function=None, prt_reference=None, mode='bestfit')#

Produces plots for the best fit spectrum, a sample of 100 output spectra, the best fit PT profile and a corner plot for parameters specified in the run definition.

plot_contribution(samples_use, parameters_read, model_generating_function=None, prt_reference=None, log_scale_contribution=False, n_contour_levels=30, refresh=True, mode='bestfit')#

Plot the contribution function of the bestfit or median model from a retrieval.

plot_corner(sample_dict, parameter_dict, parameters_read, plot_best_fit=True, true_values=None, **kwargs)#

Make the corner plots.

plot_data(yscale='linear')#

Plot the data used in the retrieval.

plot_pt(sample_dict, parameters_read, contribution=False, refresh=False, model_generating_function=None, prt_reference=None, mode='bestfit')#

Plot the PT profile with error contours

plot_sampled(samples_use, parameters_read, downsample_factor=None, save_outputs=True, nsample=None, model_generating_function=None, prt_reference=None, refresh=True, figsize=(16, 10))#

Plot a set of randomly sampled output spectra for each dataset in the retrieval.

plot_spectra(samples_use, parameters_read, model_generating_function=None, prt_reference=None, refresh=True, mode='bestfit', marker_color_type=None, marker_cmap=None, marker_label='', only_save_best_fit_spectra=False, figsize=(16, 10))#

Plot the best fit spectrum, the data from each dataset and the residuals between the two.