galapy.analysis.plot
Plotting utilities for the analysis of the results and to generate easily plots from GalaPy structures and functions.
Functions
|
Plot the triangle plot with the 2D posteriors of a sampling run and 1D marginals on the diagonal. |
|
|
|
Generates a visualisation of the photometric system bandpass transmissions. |
|
|
|
|
|
|
|
Plots the formatted SED flux from a galapy.sampling.Results instance. |
|
Produces/modifies a matplotlib.axes.Axes instance with the grid a labels for plotting SED fluxes. |
|
|
|
Plots the formatted residuals with respect to the best-fit model from a sampling run. |
|
Shows the default dictionary for the kwargs dictionary with name 'name'. |
- galapy.analysis.plot.show_default_dict(name=None)
Shows the default dictionary for the kwargs dictionary with name ‘name’.
- galapy.analysis.plot.sed_layout(redshift, frame, ax=None, **kwargs)
Produces/modifies a matplotlib.axes.Axes instance with the grid a labels for plotting SED fluxes.
- Parameters:
redshift (scalar) – the redshift of the observed frame
frame (str) – one among (‘obs’, ‘rest’, ‘both’), whether to scale the x-axis to the observed frame, the rest-frame or both. In the latter case a secondary x-axis will be added on top of the grid
ax (matplotlib.axes.Axes) – (Optional) an instance of matplotlib axes
kwargs (dictionary) – (Optional) the eventual keyword arguments to pass to the
`set`function of`ax`.
- Returns:
the generated axes
- Return type:
matplotlib.axes.Axes
- galapy.analysis.plot.sed_flux_res(res, model=None, observation=None, plot_observation=False, plot_components=False, plot_contours=True, frame='both', show_legend=True, legend_kwargs={}, ax=None, ax_kwargs={})
Plots the formatted SED flux from a galapy.sampling.Results instance. Optional specs that can be activated or de-activated are the observed points, 1- and 2-sigma contours around the mean of the sampled SEDs and the different physical components contributing to the total best-fit SED.
- Parameters:
res (Results instance) – A
Resultsinstance from a sampling run.model (GXY instance) – (Optional) A galaxy model or any class derived from
galapy.Galaxy.GXY.observation (Observation instance) – (Optional) an
Observationinstance. Note that ifplot_observation=Falseit will be ignored anyways.plot_observation (bool) – Whether to plot the observational data used in the sampling (dafault is
False).plot_components (bool) – Whether to plot the different components contributing to the best-fit SED (dafault is
False).plot_contours (bool) – Whether to plot the 1- and 2-sigma contours around the mean SED (dafault is
False).frame (string) – One among {
'rest','obs','both'}, choose the frame, observed- or rest-frame, to plot the wavelength-axis (default is'both')show_legend (bool) – (Optional)
legend_kwargs (dict) – (Optional)
ax (matplotlib.axes.Axes) – (Optional) an instance of matplotlib axes
ax_kwargs (dict) – (Optional) keyword arguments to pass to the function
sed_layout
- Returns:
An instance of
matplotlib.axes.Axeswith the plotted fluxes- Return type:
matplotlib.axes.Axes
- galapy.analysis.plot.sed_residuals_res(res, frame='both', plot_contours=False, plot_chi2=True, ax=None, text_kwargs={}, ax_kwargs={})
Plots the formatted residuals with respect to the best-fit model from a sampling run.
- Parameters:
res (Results instance) – A
Resultsinstance from a sampling run.frame (string) – One among {
'rest','obs','both'}, choose the frame, observed- or rest-frame, to plot the wavelength-axis (default is'both')plot_contours (bool) – Whether to plot the 1- and 2-sigma contours around the mean SED (dafault is
False).plot_chi2 (bool) – Whether to plot a text box with the best-fit value of the reduced chi2 (dafault is
True).ax (matplotlib.axes.Axes) – (Optional) an instance of matplotlib axes
text_kwargs (dict) – (Optional) keyword arguments to pass to the matplotlib.offsetbox.AnchoredText class (regulates shape and text-formatting of the text-box for the eventual chi2 plot)
ax_kwargs (dict) – (Optional) keyword arguments to pass to the function
sed_layout
- Returns:
An instance of
matplotlib.axes.Axeswith the plotted fluxes- Return type:
matplotlib.axes.Axes
- galapy.analysis.plot.photometric_system(obj, colors=None, ax=None, ax_kwargs={})
Generates a visualisation of the photometric system bandpass transmissions.
- Parameters:
obj (object) – An instance of
galapy.PhotometricSystem.PMSor any other object with apmsattribute which is an instance ofgalapy.PhotometricSystem.PMS(e.g.galapy.Galaxy.GXYorgalapy.Observation.OBS)colors (iterable) – (Optional) a list or iterable of valid colors. One color per bandpass is necessary
ax (matplotlib.axes.Axes) – (Optional) an instance of matplotlib axes
ax_kwargs (dictionary) – (Optional) the eventual keyword arguments to pass to the
setfunction ofax.
- Returns:
matplotlib.axes.Axes
an instance of matplotlib axes
- galapy.analysis.plot.corner_res(res, handler=None, which_params=None, getdist_settings=None, param_limits='auto', plot_titles=True, mark='bestfit', titles_kw={}, triangle_kw={}, marker_kw={})
Plot the triangle plot with the 2D posteriors of a sampling run and 1D marginals on the diagonal.
- Parameters:
res (Results instance) – A
Resultsinstance from a sampling run.handler (ModelParameters instance) – (Optional) The
ModelParameterscorresponding to the given sampling runwhich_params (str or sequence of str) – Either a single string or a sequence of strings. Name of the parameters to show on the triangle plot. Also accepts wildcards (e.g.
which_params = 'sfh*'will show all the parameters that contain the sub-stringsfh).getdist_settings (dict) – a dictionary of custom analysis settings to pass to the
getdist.MCSamplessettings argument (for further informations see the documentation ofgetdist) (to see defaults callgalapy.analysis.plots.show_default_dict('getdist_settings'))param_limits (str or sequence or dict) –
If a string is passed it has to be one among
’auto’ : set the axes limits automatically
’prior’ : set the axes to the limits of the prior
Otherwise it can be a
2D sequence (list or tuple) with dimensions (ndim, 2), where ndim is the number of free parameters of the sampling run. Each of the ndim couples will be assigned to the ordered list of free-parameters.
a dictionary where the keys are the names of the free parameters of the sampling run and the values are sequences of length = 2 with the limits for the corresponding free parameter.
plot_titles (bool) – Whether to plot titles above the diagonal marginal posteriors with summary statistics computed from the corresponding posteriors (default summary is the median with 68% uncertainty, to change this behaviour modify the argument
titles_kw)mark (str) – What position in the posteriors space to highlight with lines, default is the ‘bestfit’, other available positions are ‘mean’ and ‘median’.
titles_kw (dict) – dictionary to modify the titles above the diagonal marginal posteriors. It will be passed to function
galapy.analysis.funcs.get_parameters_summary_strings()(to see defaults callgalapy.analysis.plots.show_default_dict('titles_kw'))triangle_kw (dict) – Dictionary to modify the aspect of the triangle plot, these are the keyword arguments passed to
triangle_plot()function ofgetdist(to see defaults callgalapy.analysis.plots.show_default_dict('triangle_kw'))marker_kw (dict) – Dictionary to modify the aspect of the markers (color, linewidth, …) (to see defaults call
galapy.analysis.plots.show_default_dict('marker_kw'))
- Returns:
matplotlib.pyplot.Figure instance
matplotlib.axes.Axes instance