petitRADTRANS.retrieval.plotting
================================

.. py:module:: petitRADTRANS.retrieval.plotting


Classes
-------

.. autoapisummary::

   petitRADTRANS.retrieval.plotting.RetrievalPlotter


Module Contents
---------------

.. py:class:: RetrievalPlotter(retrieval, reference_data_name=None)

   Plotting companion for :class:`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_xlabel : str
           Label for the wavelength axis in spectrum plots.
       spec_ylabel : str
           Label for the flux axis in spectrum plots.
       y_axis_scaling : float
           Multiplicative scaling applied when plotting spectra and
           contribution-like outputs.
       xscale : str
           X-axis scaling used in spectral plots.
       yscale : str
           Y-axis scaling used in spectral plots.
       resolution : float
           Plotting resolution used when rebinned observational data are shown.
       nsample : int | float
           Default number of posterior samples used in sampled plotting
           utilities.
       temp_limits : list[float] | tuple[float, float] | None
           Optional x-axis limits for pressure-temperature plots.
       press_limits : list[float] | tuple[float, float] | None
           Optional y-axis limits for pressure-temperature plots.
       flux_lim : list[float] | tuple[float, float] | None
           Optional y-axis limits for spectral plots.
       wavelength_lim : list[float] | tuple[float, float] | None
           Optional x-axis limits for spectral plots.
       reference_data_name : str | 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``.


   .. py:attribute:: _local_attributes


   .. py:method:: __getattr__(name)


   .. py:method:: __setattr__(name, value)


   .. py:method:: get_reference_data_name()


   .. py:method:: get_reference_data()


   .. py:method:: get_reference_radtrans_name()


   .. py:method:: get_reference_radtrans_data()


   .. py:method:: _is_plotting_root()


   .. py:method:: _synchronize()


   .. py:method:: _get_clipped_contribution_output(auxiliary_outputs)
      :staticmethod:



   .. py:method:: 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_use : numpy.ndarray
              An array of the samples from the post_equal_weights file, used to find the best fit sample
          parameters_read : list
              A list of the free parameters as read from the output files.
          species_to_plot : list
              A list of which molecular species to include in the plot.
          contribution : bool
              If true, overplot the emission or transmission contribution function.
          prt_reference : str
              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.
          refresh : bool
              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.
          mode : str
              'bestfit' or 'median', indicating which set of values should be used for plotting the abundances.
          sample_posteriors : bool
              If true, sample the posterior distributions to calculate confidence intervals for the retrieved
              abundance profiles.
          volume_mixing_ratio : bool
              If true, plot in units of volume mixing ratio (number fraction) instead of mass fractions.

      Returns:
          fig : matplotlib.figure
              The matplotlib figure, containing the data, best fit spectrum and residuals.
          ax : matplotlib.axes
              The upper pane of the plot, containing the best fit spectrum and data.
          ax_r : matplotlib.axes
              The lower pane of the plot, containing the residuals between the fit and the data.



   .. py:method:: 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.



   .. py:method:: 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.



   .. py:method:: plot_corner(sample_dict, parameter_dict, parameters_read, plot_best_fit=True, true_values=None, **kwargs)

      Make the corner plots.



   .. py:method:: plot_data(yscale='linear')

      Plot the data used in the retrieval.



   .. py:method:: 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



   .. py:method:: 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.



   .. py:method:: 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.



