species.plot package#

Submodules#

species.plot.plot_color module#

Module with functions for creating plots of color-magnitude color-color diagrams.

species.plot.plot_color.plot_color_color(boxes: list, objects: List[Tuple[str, Tuple[str, str], Tuple[str, str]]] | List[Tuple[str, Tuple[str, str], Tuple[str, str], dict | None, dict | None]] | None = None, mass_labels: Dict[str, List[Tuple[float, str]]] | None = None, teff_labels: Dict[str, List[Tuple[float, str]]] | None = None, companion_labels: bool = False, reddening: List[Tuple[Tuple[str, str], Tuple[str, str], Tuple[str, float], str, float, Tuple[float, float]]] | None = None, field_range: Tuple[str, str] | None = None, label_x: str = 'Color', label_y: str = 'Color', xlim: Tuple[float, float] | None = None, ylim: Tuple[float, float] | None = None, offset: Tuple[float, float] | None = None, legend: str | dict | Tuple[float, float] | None = 'upper left', figsize: Tuple[float, float] | None = (4.0, 4.3), output: str | None = None) Figure[source]#

Function for creating a color-color diagram.

Parameters:
  • boxes (list(species.core.box.ColorColorBox, species.core.box.IsochroneBox)) – Boxes with the color-color from photometric libraries, spectral libraries, isochrones, and/or atmospheric models.

  • objects (tuple(tuple(str, tuple(str, str), tuple(str, str))),) – tuple(tuple(str, tuple(str, str), tuple(str, str), dict, dict)), None Tuple with individual objects. The objects require a tuple with their database tag, the two filter names for the first color, and the two filter names for the second color. Optionally, a dictionary with keyword arguments can be provided for the object’s marker and label, respectively. For example, {'marker': 'o', 'ms': 10} for the marker and {'ha': 'left', 'va': 'bottom', 'xytext': (5, 5)}) for the label. The parameter is not used if set to None.

  • mass_labels (dict(str, list(tuple(float, str))), None) – Plot labels with masses next to the isochrone data. The argument is a dictionary. The keys are the isochrone tags and the values are lists of tuples. Each tuple contains the mass in \(M_\mathrm{J}\) and the position of the label (‘left’ or ‘right), for example {'sonora+0.5': [(10., 'left'), (20., 'right')]}. No labels will be shown if the argument is set to None or if an isochrone tag is not included in the dictionary. The tags are stored as the iso_tag attribute of each ColorColorBox.

  • teff_labels (dict(str, list(tuple(float, str))), None) – Plot labels with temperatures (K) next to the isochrones. The argument is a dictionary with the names of the models and a list with tuples that contain the effective temperatures and ‘left’ or ‘right’ to indicate the position of the label (so similar to the use of mass_labels``). For example, {'planck': [(1000., 'left'), (1200., 'right')]. No labels are shown if the argument is set to None.

  • companion_labels (bool) – Plot labels with the names of the directly imaged companions.

  • reddening (list(tuple(tuple(str, str), tuple(str, str),) – tuple(str, float), str, float, tuple(float, float)), None Include reddening arrows by providing a list with tuples. Each tuple contains the filter names for the color, the filter name for the magnitude, the particle radius (um), and the start position (color, mag) of the arrow in the plot, so (filter_color_1, filter_color_2, filter_mag, composition, radius, (x_pos, y_pos)). The composition can be either ‘Fe’ or ‘MgSiO3’ (both with crystalline structure). The parameter is not used if set to None.

  • field_range (tuple(str, str), None) – Range of spectral types for which the field objects will be plotted and labeled at the discrete colorbar. The tuple should contain the lower and upper value of either the classes, for example (‘K’, ‘T’), or as subclasses by including early/late, for example (‘late K’, ‘early T’). The range is set to the default of ‘early M’ to ‘early Y’ if the argument is set to None.

  • label_x (str) – Label for the x-axis.

  • label_y (str) – Label for the y-axis.

  • xlim (tuple(float, float)) – Limits for the x-axis.

  • ylim (tuple(float, float)) – Limits for the y-axis.

  • offset (tuple(float, float), None) – Offset of the x- and y-axis label.

  • legend (str, tuple(float, float), dict, None) – Legend position or dictionary with keyword arguments. No legend is shown if the argument is set to None.

  • figsize (tuple(float, float)) – Figure size.

  • output (str, None) – Output filename for the plot. The plot is shown in an interface window if the argument is set to None.

Returns:

The Figure object that can be used for further customization of the plot.

Return type:

matplotlib.figure.Figure

species.plot.plot_color.plot_color_magnitude(boxes: list, objects: List[Tuple[str, str, str, str]] | List[Tuple[str, str, str, str, dict | None, dict | None]] | None = None, mass_labels: Dict[str, List[Tuple[float, str]]] | None = None, teff_labels: Dict[str, List[Tuple[float, str]]] | None = None, companion_labels: bool = False, accretion: bool = False, reddening: List[Tuple[Tuple[str, str], Tuple[str, float], str, float, Tuple[float, float]]] | None = None, ism_red: List[Tuple[Tuple[str, str], str, float, Tuple[float, float]]] | None = None, field_range: Tuple[str, str] | None = None, label_x: str = 'Color', label_y: str = 'Absolute magnitude', xlim: Tuple[float, float] | None = None, ylim: Tuple[float, float] | None = None, offset: Tuple[float, float] | None = None, legend: str | dict | Tuple[float, float] | None = 'upper left', figsize: Tuple[float, float] | None = (4.0, 4.8), output: str | None = None) Figure[source]#

Function for creating a color-magnitude diagram.

Parameters:
  • boxes (list(species.core.box.ColorMagBox, species.core.box.IsochroneBox)) – Boxes with the color-magnitude and isochrone data from photometric libraries, spectral libraries, and/or atmospheric models. The synthetic data have to be created with get_color_magnitude(). These boxes contain synthetic colors and magnitudes for a given age and a range of masses.

  • objects (list(tuple(str, str, str, str)),) – list(tuple(str, str, str, str, dict, dict)), None Tuple with individual objects. The objects require a tuple with their database tag, the two filter names for the color, and the filter name for the absolute magnitude. Optionally, a dictionary with keyword arguments can be provided for the object’s marker and label, respectively. For example, {'marker': 'o', 'ms': 10} for the marker and {'ha': 'left', 'va': 'bottom', 'xytext': (5, 5)}) for the label. The parameter is not used if set to None.

  • mass_labels (dict(str, list(tuple(float, str))), None) – Plot labels with masses next to the isochrone data. The argument is a dictionary. The keys are the isochrone tags and the values are lists of tuples. Each tuple contains the mass in \(M_\mathrm{J}\) and the position of the label (‘left’ or ‘right), for example {'sonora+0.5': [(10., 'left'), (20., 'right')]}. No labels will be shown if the argument is set to None or if an isochrone tag is not included in the dictionary. The tags are stored as the iso_tag attribute of each ColorColorBox.

  • teff_labels (dict(str, list(tuple(float, str))), None) – Plot labels with temperatures (K) next to the isochrones. The argument is a dictionary with the names of the models and a list with tuples that contain the effective temperatures and ‘left’ or ‘right’ to indicate the position of the label (so similar to the use of mass_labels``). For example, {'planck': [(1000., 'left'), (1200., 'right')]. No labels are shown if the argument is set to None.

  • companion_labels (bool) – Plot labels with the names of the directly imaged companions.

  • accretion (bool) – Plot accreting, directly imaged objects with a different symbol than the regular, directly imaged objects. The object names from objects will be compared with the data from data/companion_data/companion_data.json to check if a companion is accreting or not.

  • reddening (list(tuple(tuple(str, str), tuple(str, float),) – str, float, tuple(float, float))), None Include reddening arrows by providing a list with tuples. Each tuple contains the filter names for the color, the filter name and value of the magnitude, the mean particle radius (um), and the start position (color, mag) of the arrow in the plot, so ((filter_color_1, filter_color_2), (filter_mag, mag_value), composition, radius, (x_pos, y_pos)). The composition can be either 'Fe' or 'MgSiO3' (both with crystalline structure). A log-normal size distribution is used with the specified mean radius and the geometric standard deviation is fixed to 2. Both xlim and ylim need to be set for the correct rotation of the reddening label. The parameter is not used if set to None.

  • ism_red (list(tuple(tuple(str, str), str, float,) – tuple(float, float))), None List with reddening arrows for ISM extinction. Each item in the list is a tuple that itself contain a tuple with the filter names for the color, the filter name of the magnitude, the visual extinction, and the start position (color, mag) of the arrow in the plot, so ((filter_color_1, filter_color_2), filter_mag, A_V, (x_pos, y_pos)). The parameter is not used if the argument is set to None.

  • field_range (tuple(str, str), None) – Range of spectral types for which the field objects will be plotted and labeled at the discrete colorbar. The tuple should contain the lower and upper value of either the classes, for example (‘K’, ‘T’), or as subclasses by including early/late, for example (‘late K’, ‘early T’). The range is set to the default of ‘early M’ to ‘early Y’ if the argument is set to None.

  • label_x (str) – Label for the x-axis.

  • label_y (str) – Label for the y-axis.

  • xlim (tuple(float, float), None) – Limits for the x-axis. Not used if set to None.

  • ylim (tuple(float, float), None) – Limits for the y-axis. Not used if set to None.

  • offset (tuple(float, float), None) – Offset of the x- and y-axis label.

  • legend (str, tuple(float, float), dict, None) – Legend position or keyword arguments. No legend is shown if set to None.

  • figsize (tuple(float, float)) – Figure size.

  • output (str, None) – Output filename for the plot. The plot is shown in an interface window if the argument is set to None.

Returns:

The Figure object that can be used for further customization of the plot.

Return type:

matplotlib.figure.Figure

species.plot.plot_comparison module#

Module with functions for plotting results from a spectral analysis that compares data with a library of empirical spectra or a grid of model spectra.

species.plot.plot_comparison.plot_empirical_spectra(tag: str, n_spectra: int | None = None, flux_offset: float | None = None, label_pos: Tuple[float, float] | None = None, xlim: Tuple[float, float] | None = None, ylim: Tuple[float, float] | None = None, title: str | None = None, offset: Tuple[float, float] | None = None, figsize: Tuple[float, float] | None = (4.0, 2.5), output: str | None = None) Figure[source]#

Function for plotting the results from the empirical spectrum comparison.

Parameters:
  • tag (str) – Database tag where the results from the empirical comparison with spectral_type are stored.

  • n_spectra (int, None) – The number of spectra with the lowest goodness-of-fit statistic that will be plotted in comparison with the data. All spectra are selected if the argument is set to None.

  • label_pos (tuple(float, float), None) – Position for the name labels. Should be provided as (x, y) for the lowest spectrum. The flux_offset will be applied to the remaining spectra. The labels are only plotted if the argument of both label_pos and flux_offset are not None.

  • flux_offset (float, None) – Offset to be applied such that the spectra do not overlap. No offset is applied if the argument is set to None.

  • xlim (tuple(float, float)) – Limits of the spectral type axis.

  • ylim (tuple(float, float)) – Limits of the goodness-of-fit axis.

  • title (str) – Plot title.

  • offset (tuple(float, float)) – Offset for the label of the x- and y-axis.

  • figsize (tuple(float, float)) – Figure size.

  • output (str, None) – Output filename for the plot. The plot is shown in an interface window if the argument is set to None.

Returns:

The Figure object that can be used for further customization of the plot.

Return type:

matplotlib.figure.Figure

species.plot.plot_comparison.plot_grid_statistic(tag: str, upsample: bool = False, xlim: Tuple[float, float] | None = None, ylim: Tuple[float, float] | None = None, title: str | None = None, offset: Tuple[float, float] | None = None, figsize: Tuple[float, float] | None = (4.0, 2.5), output: str | None = None, extra_param: str | None = None, nlevels_main: int = 20, nlevels_extra: int = 10) Figure[source]#

Function for plotting the results from the comparison with a grid of empirical or model spectra

Parameters:
  • tag (str) – Database tag where the results from the comparison with CompareSpectra are stored.

  • upsample (bool) – Upsample the goodness-of-fit grid to a higher resolution for a smoother appearance.

  • xlim (tuple(float, float), None) – Limits of the x-axis (spectral type or effective temperature).

  • ylim (tuple(float, float), None) – Limits of the y-axis.

  • title (str, None) – Title that is shown above the plot.

  • offset (tuple(float, float), None) – Offset for the label for the x- and y-axis.

  • figsize (tuple(float, float), None) – Figure size.

  • output (str, None) – Output filename for the plot. The plot is shown in an interface window if the argument is set to None.

  • extra_param (str, None) – Extra parameter to be overplotted with contours. The argument can be set to any of the atmospheric parameters that were used for the comparison, for example, ‘teff’, ‘logg’, ‘feh’, or ‘radius’. Optionally, the argument can be set to ‘ism_ext’ in case the av_points parameter of the compare_model() method was used. Extra contours are not plotted if the argument is set to None.

  • nlevels_main (int) – Number of contour levels for the main plot.

  • nlevels_extra (int) – Number of contour levels for the optional extra parameter.

Returns:

The Figure object that can be used for further customization of the plot.

Return type:

matplotlib.figure.Figure

species.plot.plot_comparison.plot_model_spectra(tag: str, n_spectra: int | None = None, flux_offset: float | None = None, label_pos: Tuple[float, float] | None = None, xlim: Tuple[float, float] | None = None, ylim: Tuple[float, float] | None = None, title: str | None = None, offset: Tuple[float, float] | None = None, figsize: Tuple[float, float] | None = (4.0, 2.5), output: str | None = None, leg_param: List[str] | None = None) Figure[source]#

Function for plotting the results from comparing a spectrum with a grid of model spectra.

Parameters:
  • tag (str) – Database tag where the results from the model comparison with compare_model() are stored.

  • n_spectra (int, None) – The number of spectra with the lowest goodness-of-fit statistic that will be plotted in comparison with the data. All spectra are selected if the argument is set to None.

  • label_pos (tuple(float, float), None) – Position for the name labels. Should be provided as (x, y) for the lowest spectrum. The flux_offset will be applied to the remaining spectra. The labels are only plotted if the argument of both label_pos and flux_offset are not None.

  • flux_offset (float, None) – Offset to be applied such that the spectra do not overlap. No offset is applied if the argument is set to None.

  • xlim (tuple(float, float), None) – Limits of the wavelength axis.

  • ylim (tuple(float, float), None) – Limits of the flux axis.

  • title (str) – Plot title.

  • offset (tuple(float, float)) – Offset for the label of the x- and y-axis.

  • figsize (tuple(float, float)) – Figure size.

  • output (str, None) – Output filename for the plot. The plot is shown in an interface window if the argument is set to None.

  • leg_param (list(str), None) – List with the parameters to include in the legend of the model spectra. Apart from atmospheric parameters (e.g. ‘teff’, ‘logg’, ‘radius’) also parameters such as ‘mass’ and ‘luminosity’ can be included. The default atmospheric parameters are included in the legend if the argument is set to None.

Returns:

The Figure object that can be used for further customization of the plot.

Return type:

matplotlib.figure.Figure

species.plot.plot_comparison.plot_statistic(tag: str, xlim: Tuple[float, float] | None = None, ylim: Tuple[float, float] | None = None, title: str | None = None, offset: Tuple[float, float] | None = None, figsize: Tuple[float, float] | None = (4.0, 2.5), output: str | None = None) Figure[source]#

Function for plotting the goodness-of-fit statistic from a comparison with an empirical spectral library with spectral_type that enables a determination of the spectral type

Parameters:
  • tag (str) – Database tag where the results from the empirical comparison with spectral_type are stored.

  • xlim (tuple(float, float)) – Limits of the spectral type axis in numbers (i.e. 0=M0, 5=M5, 10=L0, etc.).

  • ylim (tuple(float, float)) – Limits of the goodness-of-fit axis.

  • title (str) – Plot title.

  • offset (tuple(float, float)) – Offset for the label of the x- and y-axis.

  • figsize (tuple(float, float)) – Figure size.

  • output (str, None) – Output filename for the plot. The plot is shown in an interface window if the argument is set to None.

Returns:

None

Return type:

NoneType

species.plot.plot_evolution module#

Module with functions for plotting the results obtained with the FitEvolution class.

species.plot.plot_evolution.plot_cooling(tag: str, n_samples: int = 50, cooling_param: str = 'luminosity', xlim: Tuple[float, float] | None = None, ylim: Tuple[float, float] | None = None, xscale: str | None = 'linear', yscale: str | None = 'linear', title: str | None = None, offset: Tuple[float, float] | None = None, figsize: Tuple[float, float] | None = (4.0, 2.5), output: str | None = None) Tuple[Figure, List[List[ndarray]], ndarray][source]#

Function for plotting samples of cooling curves that are randomly drawn from the posterior distributions of the age and mass parameters that have been estimated with FitEvolution.

Parameters:
  • tag (str) – Database tag where the samples are stored

  • n_samples (int) – Number of randomly drawn cooling curves that will be plotted.

  • cooling_param (str) – Type of cooling parameter that will be plotted (‘luminosity’ or ‘radius’).

  • xlim (tuple(float, float), None) – Limits of the wavelength axis. Automatic limits are used if the argument is set to None.

  • ylim (tuple(float, float), None) – Limits of the flux axis. Automatic limits are used if the argument is set to None.

  • xscale (str, None) – Scale of the x axis (‘linear’ or ‘log’). The scale is set to 'linear' if the argument is set to None.

  • yscale (str, None) – Scale of the x axis (‘linear’ or ‘log’). The scale is set to 'linear' if the argument is set to None.

  • title (str) – Title to show at the top of the plot.

  • offset (tuple(float, float)) – Offset for the label of the x- and y-axis.

  • figsize (tuple(float, float)) – Figure size.

  • output (str, None) – Output filename for the plot. The plot is shown in an interface window if the argument is set to None.

Returns:

  • matplotlib.figure.Figure – The Figure object that can be used for further customization of the plot.

  • np.ndarray – Array with the cooling curves. The array contains \(L/L_\odot\) or radius as function of time for each companion and sample, so the shape is (n_companions, n_samples, n_ages).

  • np.ndarray – Array with the random indices that have been sampled from the posterior distribution.

species.plot.plot_evolution.plot_isochrones(tag: str, n_samples: int = 50, xlim: Tuple[float, float] | None = None, ylim: Tuple[float, float] | None = None, xscale: str | None = 'linear', yscale: str | None = 'linear', title: str | None = None, offset: Tuple[float, float] | None = None, figsize: Tuple[float, float] | None = (4.0, 2.5), output: str | None = None) Tuple[Figure, List[List[ndarray]], ndarray][source]#

Function for plotting samples of isochrones that are randomly drawn from the posterior distributions of the age and mass parameters that have been estimated with FitEvolution. For each isochrone, the parameters from a single posterior sample are used.

Parameters:
  • tag (str) – Database tag where the samples are stored

  • n_samples (int) – Number of randomly drawn cooling curves that will be plotted.

  • xlim (tuple(float, float), None) – Limits of the wavelength axis. Automatic limits are used if the argument is set to None.

  • ylim (tuple(float, float), None) – Limits of the flux axis. Automatic limits are used if the argument is set to None.

  • xscale (str, None) – Scale of the x axis (‘linear’ or ‘log’). The scale is set to 'linear' if the argument is set to None.

  • yscale (str, None) – Scale of the x axis (‘linear’ or ‘log’). The scale is set to 'linear' if the argument is set to None.

  • title (str) – Title to show at the top of the plot.

  • offset (tuple(float, float)) – Offset for the label of the x- and y-axis.

  • figsize (tuple(float, float)) – Figure size.

  • output (str, None) – Output filename for the plot. The plot is shown in an interface window if the argument is set to None.

Returns:

  • matplotlib.figure.Figure – The Figure object that can be used for further customization of the plot.

  • np.ndarray – Array with the isochrones. The array contains \(L/L_\odot\) as function of time for each companions and sample, so the shape is (n_companions, n_samples, n_masses).

  • np.ndarray – Array with the random indices that have been sampled from the posterior distribution.

species.plot.plot_mcmc module#

Module for plotting MCMC results.

species.plot.plot_mcmc.plot_extinction(tag: str, burnin: int | None = None, random: int | None = None, wavel_range: Tuple[float, float] | None = None, xlim: Tuple[float, float] | None = None, ylim: Tuple[float, float] | None = None, offset: Tuple[float, float] | None = None, output: str | None = None) Figure[source]#

Function to plot random samples of the extinction, either from fitting a size distribution of enstatite grains (dust_radius, dust_sigma, and dust_ext), or from fitting ISM extinction (ism_ext and optionally ism_red).

Parameters:
  • tag (str) – Database tag with the samples.

  • burnin (int, None) – Number of burnin steps to exclude. All samples are used if the argument is set to None. Only required after running MCMC with run_mcmc().

  • random (int, None) – Number of randomly selected samples. All samples are used if the argument is set to None.

  • wavel_range (tuple(float, float), None) – Wavelength range (um) for the extinction. The default wavelength range (0.4, 10.) is used if the argument is set to None.

  • xlim (tuple(float, float), None) – Limits of the wavelength axis. The range is set automatically if the argument is set to None.

  • ylim (tuple(float, float)) – Limits of the extinction axis. The range is set automatically if the argument is set to None.

  • offset (tuple(float, float), None) – Offset of the x- and y-axis label. Default values are used if the argument is set to None.

  • output (str, None) – Output filename for the plot. The plot is shown in an interface window if the argument is set to None.

Returns:

The Figure object that can be used for further customization of the plot.

Return type:

matplotlib.figure.Figure

species.plot.plot_mcmc.plot_mag_posterior(tag: str, filter_name: str, burnin: int | None = None, xlim: Tuple[float, float] | None = None, output: str | None = None) Tuple[ndarray, Figure][source]#

Function to plot the posterior distribution of the synthetic magnitudes. The posterior samples are also returned.

Parameters:
  • tag (str) – Database tag with the posterior samples.

  • filter_name (str) – Filter name.

  • burnin (int, None) – Number of burnin steps to exclude. All samples are used if the argument is set to None.

  • xlim (tuple(float, float), None) – Axis limits. Automatically set if the argument is set to None.

  • output (str, None) – Output filename for the plot. The plot is shown in an interface window if the argument is set to None.

Returns:

  • np.ndarray – Array with the posterior samples of the magnitude.

  • matplotlib.figure.Figure – The Figure object that can be used for further customization of the plot.

species.plot.plot_mcmc.plot_posterior(tag: str, burnin: int | None = None, title: str | None = None, offset: Tuple[float, float] | None = None, title_fmt: str | List[str] = '.2f', limits: List[Tuple[float, float]] | None = None, max_prob: bool = False, vmr: bool = False, inc_luminosity: bool = False, inc_mass: bool = False, inc_log_mass: bool = False, inc_pt_param: bool = False, inc_loglike: bool = False, inc_abund: bool = True, output: str | None = None, object_type: str = 'planet', param_inc: List[str] | None = None, show_priors: bool = False) Figure[source]#

Function to plot the posterior distribution of the fitted parameters.

Parameters:
  • tag (str) – Database tag with the samples.

  • burnin (int, None) – Number of burnin steps to exclude. All samples are used if the argument is set to None.

  • title (str, None) – Plot title. No title is shown if the arguments is set to None.

  • offset (tuple(float, float), None) – Offset of the x- and y-axis label. Default values are used if the arguments is set to None.

  • title_fmt (str, list(str)) – Format of the titles above the 1D distributions. Either a single string, which will be used for all parameters, or a list with the title format for each parameter separately (in the order as shown in the corner plot).

  • limits (list(tuple(float, float), ), None) – Axis limits of all parameters. Automatically set if the argument is set to None.

  • max_prob (bool) – Plot the position of the sample with the maximum posterior probability.

  • vmr (bool) – Plot the volume mixing ratios (i.e. number fractions) instead of the mass fractions of the retrieved species with AtmosphericRetrieval.

  • inc_luminosity (bool) – Include the log10 of the luminosity in the posterior plot as calculated from the effective temperature and radius.

  • inc_mass (bool) – Include the mass in the posterior plot as calculated from the surface gravity and radius.

  • inc_log_mass (bool) – Include the logarithm of the mass, \(\log10{M}\), in the posterior plot, as calculated from the surface gravity and radius.

  • inc_pt_param (bool) – Include the parameters of the pressure-temperature profile. Only used if the tag contains samples obtained with AtmosphericRetrieval.

  • inc_loglike (bool) – Include the log10 of the likelihood as additional parameter in the corner plot.

  • inc_abund (bool) – Include the abundances when retrieving free abundances with AtmosphericRetrieval.

  • output (str, None) – Output filename for the plot. The plot is shown in an interface window if the argument is set to None.

  • object_type (str) – Object type (‘planet’ or ‘star’). With ‘planet’, the radius and mass are expressed in Jupiter units. With ‘star’, the radius and mass are expressed in solar units.

  • param_inc (list(str), None) – List with subset of parameters that will be included in the posterior plot. This parameter can also be used to change the order of the parameters in the posterior plot. All parameters will be included if the argument is set to None.

  • show_priors (bool) – Plot the normal priors in the diagonal panels together with the 1D marginalized posterior distributions. This will only show the priors that had a normal distribution, so those that were set with the normal_prior parameter in FitModel and setup_retrieval.

Returns:

The Figure object that can be used for further customization of the plot.

Return type:

matplotlib.figure.Figure

species.plot.plot_mcmc.plot_size_distributions(tag: str, burnin: int | None = None, random: int | None = None, offset: Tuple[float, float] | None = None, output: str | None = None) Figure[source]#

Function to plot random samples of the log-normal or power-law size distributions.

Parameters:
  • tag (str) – Database tag with the samples.

  • burnin (int, None) – Number of burnin steps to exclude. All samples are used if the argument is set to None. Only required after running MCMC with run_mcmc().

  • random (int, None) – Number of randomly selected samples. All samples are used if the argument set to None.

  • offset (tuple(float, float), None) – Offset of the x- and y-axis label. Default values are used if the argument set to None.

  • output (str, None) – Output filename for the plot. The plot is shown in an interface window if the argument is set to None.

Returns:

The Figure object that can be used for further customization of the plot.

Return type:

matplotlib.figure.Figure

species.plot.plot_mcmc.plot_walkers(tag: str, nsteps: int | None = None, offset: Tuple[float, float] | None = None, output: str | None = None) Figure[source]#

Function to plot the step history of the walkers.

Parameters:
  • tag (str) – Database tag with the samples.

  • nsteps (int, None) – Number of steps that are plotted. All steps are plotted if the argument is set to None.

  • offset (tuple(float, float), None) – Offset of the x- and y-axis label. Default values are used if the arguments is set to None.

  • output (str, None) – Output filename for the plot. The plot is shown in an interface window if the argument is set to None.

Returns:

The Figure object that can be used for further customization of the plot.

Return type:

matplotlib.figure.Figure

species.plot.plot_retrieval module#

Module for plotting atmospheric retrieval results.

species.plot.plot_retrieval.plot_abundances(tag: str, xlim: Tuple[float, float] | None = None, ylim: Tuple[float, float] | None = None, offset: Tuple[float, float] | None = None, output: str | None = None, legend: dict | None = None, radtrans: ReadRadtrans | None = None) Figure[source]#

Function to plotting the retrieved abundance profiles.

Parameters:
  • tag (str) – Database tag with the posterior samples.

  • xlim (tuple(float, float), None) – Limits of the temperature axis. Default values are used if set to None.

  • ylim (tuple(float, float), None) – Limits of the pressure axis. Default values are used if set to None.

  • offset (tuple(float, float), None) – Offset of the x- and y-axis label. Default values are used if the argument set to None.

  • output (str, None) – Output filename for the plot. The plot is shown in an interface window if the argument is set to None.

  • legend (dict, None) – Dictionary with legend properties. Default values will be used if the argument is set to None.

  • radtrans (ReadRadtrans, None) – Instance of ReadRadtrans. The parameter is not used if the argument is set to None.

Returns:

The Figure object that can be used for further customization of the plot.

Return type:

matplotlib.figure.Figure

species.plot.plot_retrieval.plot_clouds(tag: str, offset: Tuple[float, float] | None = None, output: str | None = None, radtrans: ReadRadtrans | None = None, composition: str = 'MgSiO3') Figure[source]#

Function to plot the size distributions for a given cloud composition as function as pressure. The size distributions are calculated for the median sample by using the radius_g (as function of pressure) and sigma_g.

Parameters:
  • tag (str) – Database tag with the posterior samples.

  • offset (tuple(float, float), None) – Offset of the x- and y-axis label. Default values are used if the argument set to None.

  • output (str, None) – Output filename for the plot. The plot is shown in an interface window if the argument is set to None.

  • radtrans (ReadRadtrans, None) – Instance of ReadRadtrans. The parameter is not used if the argument is set to None.

  • composition (str) – Cloud composition (e.g. ‘MgSiO3’, ‘Fe’, ‘Al2O3’, ‘Na2S’, ‘KCl’).

Returns:

The Figure object that can be used for further customization of the plot.

Return type:

matplotlib.figure.Figure

species.plot.plot_retrieval.plot_opacities(tag: str, radtrans: ReadRadtrans, offset: Tuple[float, float] | None = None, output: str | None = None) Figure[source]#

Function to plot the line and continuum opacity structure of the atmosphere by using the median parameters from posterior samples.

Parameters:
  • tag (str) – Database tag with the posterior samples.

  • radtrans (ReadRadtrans) – Instance of ReadRadtrans. The parameter is not used if the argument is set to None.

  • offset (tuple(float, float), None) – Offset of the x- and y-axis label. Default values are used if the argument is set to None.

  • output (str, None) – Output filename for the plot. The plot is shown in an interface window if the argument is set to None.

Returns:

The Figure object that can be used for further customization of the plot.

Return type:

matplotlib.figure.Figure

species.plot.plot_retrieval.plot_pt_profile(tag: str, random: int | None = 100, envelope: bool = False, xlim: Tuple[float, float] | None = None, ylim: Tuple[float, float] | None = None, offset: Tuple[float, float] | None = None, output: str | None = None, radtrans: ReadRadtrans | None = None, extra_axis: str | None = None, rad_conv_bound: bool = False) Figure[source]#

Function to plot the posterior distribution.

Parameters:
  • tag (str) – Database tag with the posterior samples.

  • random (int, None) – Number of randomly selected samples from the posterior. All samples are selected if the argument is set to None.

  • envelope (bool) – Plot an envelope instead of the individual samples. The envelopes show the 68 and 99.7 percent confidence intervals, so \(1\sigma\) and \(3\sigma\) in case of Gaussian distributions.

  • xlim (tuple(float, float), None) – Limits of the temperature axis. Default values are used if set to None.

  • ylim (tuple(float, float), None) – Limits of the pressure axis. Default values are used if set to None.

  • offset (tuple(float, float), None) – Offset of the x- and y-axis label. Default values are used if set to None.

  • output (str, None) – Output filename for the plot. The plot is shown in an interface window if the argument is set to None.

  • radtrans (ReadRadtrans, None) – Instance of ReadRadtrans. Not used if set to None.

  • extra_axis (str, None) – The quantify that is plotted at the top axis (‘photosphere’, ‘grains’). The top axis is not used if the argument is set to None.

  • rad_conv_bound (bool) – Plot the range of pressures (\(\pm 1\sigma\)) of the radiative-convective boundary.

Returns:

The Figure object that can be used for further customization of the plot.

Return type:

matplotlib.figure.Figure

species.plot.plot_spectrum module#

Module with a function for plotting a spectral energy distribution that includes photometric and/or spectral data and/or models.

species.plot.plot_spectrum.plot_spectrum(boxes: list, filters: List[str] | None = None, residuals: ResidualsBox | None = None, plot_kwargs: List[dict | None] | None = None, envelope: bool = False, xlim: Tuple[float, float] | None = None, ylim: Tuple[float, float] | None = None, ylim_res: Tuple[float, float] | None = None, scale: Tuple[str, str] | None = None, title: str | None = None, offset: Tuple[float, float] | None = None, legend: str | dict | Tuple[float, float] | List[str | dict | Tuple[float, float] | None] | None = None, figsize: Tuple[float, float] | None = (6.0, 3.0), object_type: str = 'planet', quantity: str = 'flux density', output: str | None = None, leg_param: List[str] | None = None, param_fmt: Dict[str, str] | None = None, grid_hspace: float = 0.1, inc_model_name: bool = False, units: Tuple[str, str] = ('um', 'W m-2 um-1')) Figure[source]#

Function for plotting a spectral energy distribution and combining various data such as spectra, photometric fluxes, model spectra, synthetic photometry, fit residuals, and filter profiles.

Parameters:
  • boxes (list(species.core.box)) – Boxes with data that will be included in the plot.

  • filters (list(str), None) – Filter names for which the transmission profile is plotted. Not plotted if set to None.

  • residuals (species.core.box.ResidualsBox, None) – Box with residuals of a fit. Not plotted if set to None.

  • plot_kwargs (list(dict), None) –

    List with dictionaries of keyword arguments for each box. For example, if the boxes are a ModelBox and ObjectBox:

    plot_kwargs=[{'ls': '-', 'lw': 1., 'color': 'black'},
                 {'spectrum_1': {'marker': 'o', 'ms': 3., 'color': 'tab:brown', 'ls': 'none'},
                  'spectrum_2': {'marker': 'o', 'ms': 3., 'color': 'tab:blue', 'ls': 'none'},
                  'Paranal/SPHERE.IRDIS_D_H23_3': {'marker': 's', 'ms': 4., 'color': 'tab:cyan', 'ls': 'none'},
                  'Paranal/SPHERE.IRDIS_D_K12_1': [{'marker': 's', 'ms': 4., 'color': 'tab:orange', 'ls': 'none'},
                                                   {'marker': 's', 'ms': 4., 'color': 'tab:red', 'ls': 'none'}],
                  'Paranal/NACO.Lp': {'marker': 's', 'ms': 4., 'color': 'tab:green', 'ls': 'none'},
                  'Paranal/NACO.Mp': {'marker': 's', 'ms': 4., 'color': 'tab:green', 'ls': 'none'}}]
    

    For an ObjectBox, the dictionary contains items for the different spectrum and filter names stored with add_object(). In case both and ObjectBox and a SynphotBox are provided, then the latter can be set to None in order to use the same (but open) symbols as the data from the ObjectBox. Note that if a filter name is duplicated in an ObjectBox (Paranal/SPHERE.IRDIS_D_K12_1 in the example) then a list with two dictionaries should be provided. Colors are automatically chosen if plot_kwargs is set to None.

  • envelope (bool) – Plot an envelope instead of the individual samples in case the list of boxes contains a list with ModelBox objects from get_mcmc_spectra() or get_retrieval_spectra(). The envelopes show the 68 and 99.7 percent confidence intervals, so \(1\sigma\) and \(3\sigma\) in case of Gaussian distributions.

  • xlim (tuple(float, float)) – Limits of the wavelength axis.

  • ylim (tuple(float, float)) – Limits of the flux axis.

  • ylim_res (tuple(float, float), None) – Limits of the residuals axis. Automatically chosen (based on the minimum and maximum residual value) if set to None.

  • scale (tuple(str, str), None) – Scale of the x and y axes (‘linear’ or ‘log’). The scale is set to ('linear', 'linear') if set to None.

  • title (str) – Title.

  • offset (tuple(float, float), None) – Offset for the label of the x- and y-axis. Default offset is used when the argument is set to None.

  • legend (str, tuple, dict, list(dict, dict), None) – Location of the legend (str or tuple(float, float)) or a dictionary with the **kwargs of matplotlib.pyplot.legend, for example {'loc': 'upper left', 'fontsize: 12.}. Alternatively, a list with two values can be provided to separate the model and data handles in two legends. Each of these two elements can be set to None. For example, [None, {'loc': 'upper left', 'fontsize: 12.}], if only the data points should be included in a legend.

  • figsize (tuple(float, float)) – Figure size.

  • object_type (str) – Object type (‘planet’ or ‘star’). With ‘planet’, the radius and mass are expressed in Jupiter units. With ‘star’, the radius and mass are expressed in solar units.

  • quantity (str) – The quantity of the y-axis (‘flux density’, ‘flux’, or ‘magnitude’).

  • output (str, None) – Output filename for the plot. The plot is shown in an interface window if the argument is set to None.

  • leg_param (list(str), None) – List with the parameters to include in the legend of the model spectra. Apart from atmospheric parameters (e.g. ‘teff’, ‘logg’, ‘radius’) also parameters such as ‘mass’ and ‘luminosity’ can be included. The default atmospheric parameters are included in the legend if the argument is set to None.

  • param_fmt (dict(str, str), None) – Dictionary with formats that will be used for the model parameter. The parameters are included in the legend when plotting the model spectra. Default formats are used if the argument of param_fmt is set to None. Formats should provided for example as ‘.2f’ for two decimals, ‘.0f’ for zero decimals, and ‘.1e’ for exponential notation with one decimal.

  • grid_hspace (float) – The relative height spacing between subplots, expressed as a fraction of the average axis height. The default value is set to 0.1.

  • inc_model_name (bool) – Include the model name in the legend of any ModelBox.

  • units (tuple(str, str), None) – Tuple with the wavelength and flux units. Supported units can be found in the docstring of convert_units().

Returns:

The Figure object that can be used for further customization of the plot.

Return type:

matplotlib.figure.Figure

Module contents#