GUIBRUSHR.core.functions.plotting module¶
Plotting utility functions for GUIBRUSHR atmospheric retrieval.
This module contains visualization functions extracted from general_functions.py:
make_smooth_mono_cmap: Create a smooth monochromatic colormap.
plot_tp_profile: Plot the pressure-temperature (PT) profile for an atmosphere.
plot_corner_metallicity: Generate a corner plot for molecular abundance posteriors.
opacities_contribution_plot: Plot the contribution of different opacity sources.
plot_vmr: Plot volume mixing ratio (VMR) profiles for different chemical species groups.
- GUIBRUSHR.core.functions.plotting.make_smooth_mono_cmap(color: str, name: str = 'custom') LinearSegmentedColormap[source]¶
Create a smooth monochromatic colormap with 5 control points.
The colormap transitions from black through dark shade, saturated color, light shade, to white, creating a smooth gradient suitable for visualization.
- Parameters:
color (str) – Hex color code or named color for the saturated color point
name (str, optional) – Name for the colormap. Defaults to ‘custom’.
- Returns:
Matplotlib colormap object with 256 color levels
- Return type:
LinearSegmentedColormap
- GUIBRUSHR.core.functions.plotting.plot_tp_profile(range_min_pressures: float, range_max_pressures: float, n_layers: int, parameters_tp_profile: Any, gravity: float, format_temperature: str, path_imm: str | Path, err: Any, rng: Any, mcmc_chain: dict | None = None, plot_median_sample: bool = False) None[source]¶
Plot the pressure-temperature (PT) profile for an atmosphere and save the figure.
- Parameters:
range_min_pressures (float) – Log10 of the minimum pressure (bar).
range_max_pressures (float) – Log10 of the maximum pressure (bar).
n_layers (int) – Number of pressure layers.
parameters_tp_profile (Any) – Parameters for the temperature profile.
gravity (float) – Surface gravity.
format_temperature (str) – Name of the temperature profile method to use.
path_imm (Union[str, Path]) – Path to save the output image.
err (Any) – Error parameter for the temperature profile.
rng (Any) – Random number generator or seed for the temperature profile.
mcmc_chain (dict, optional) – Dictionary mapping parameter names to 1D arrays of MCMC posterior samples for percentile-based error bands.
plot_median_sample (bool, optional) – If True and an MCMC sample is available, also save
tp_profile_median_sample.jpg— identical to the base figure (same 1σ/2σ bands) but with the central curve set to the per-pressure median of the posterior temperature profiles instead of the best-fit profile. Defaults to False.
- Returns:
None
- GUIBRUSHR.core.functions.plotting.plot_corner_metallicity(array_molecules, names_molecules_corner, folder_retrieval, filename, title_figure)[source]¶
Generate and save a corner plot for molecular abundance posteriors.
- Parameters:
array_molecules (np.ndarray) – 2D array of posterior samples (n_samples x n_params).
names_molecules_corner (list) – Labels for each parameter axis.
folder_retrieval (str) – Path to the retrieval output folder.
filename (str) – Base filename for the saved plot.
title_figure (str) – Title displayed on the plot window.
- GUIBRUSHR.core.functions.plotting.opacities_contribution_plot(path_results: str | Path, opacities_contribution: Dict[str, Any], resolution: str, function: str = 'plot', wl_scale: str = 'log', invert_y_axis: int = 0, instruments_LR=None, offsetLR_arr=None, rp=None, rs=None, rad_mode: str = 'Transmission') None[source]¶
Plot and save the contribution of different opacity sources to the atmospheric model.
This function creates a visualization showing how different opacity sources (line species, gas continua, clouds, etc.) contribute to the total atmospheric opacity. The plot is saved as a high-resolution image in the specified output directory.
- Parameters:
path_results (Union[str, Path]) – Directory path where the output plot will be saved.
opacities_contribution (Dict[str, Any]) – Dictionary containing opacity contributions from different sources. Keys are source types (e.g., ‘line_species’, ‘cloud_species’), values are dictionaries mapping species names to their contribution data.
resolution (str) – Resolution identifier used in the plot title and filename.
function (str, optional) – Plotting function to use (‘plot’, ‘scatter’, etc.). Defaults to “plot”.
wl_scale (str, optional) – Scale for the wavelength axis (‘log’ or ‘linear’). Defaults to “log”.
invert_y_axis (int, optional) – Whether to invert the y-axis. Defaults to False.
instruments_LR – Dictionary containing the instruments and their LR values.
offsetLR_arr – Array containing the offset LR values.
rp – Radius of the planet.
rs – Radius of the star.
rad_mode – Radiative mode.
- Returns:
None
- GUIBRUSHR.core.functions.plotting.plot_vmr(pressures: ndarray, vmr_dict: Dict[str, ndarray], folder_plot: str | Path) None[source]¶
Plot volume mixing ratio (VMR) profiles for different chemical species groups.
This function creates a 2x3 grid of plots showing VMR profiles for: - All species - HCNO neutrals - Ions - Alkali metals - Metals - Metal oxides
- Parameters:
pressures (np.ndarray) – Pressure values (in bar)
vmr_dict (Dict[str, np.ndarray]) – Dictionary mapping species names to their VMR profiles
folder_plot (Union[str, Path]) – Directory where the plot will be saved