gcfit.analysis.RunCollection#
- class gcfit.analysis.RunCollection(runs, *, sort=True)#
Analysis and visualization of an collection of multiple runs.
Provides a number of flexible plotting, output and summary methods useful for the analysis of distributions, relationships and correlations between the results of multiple runs at once. This class is meant to enable the analysis of a larger population of fits of different clusters at once, and explore the relationships in cluster parameters and make comparisons with results from the literature. Multiple different runs of fitting on the same cluster may also be given, though care should be taken that each has it’s own .name to avoid confusion.
- Parameters:
- runs, *, sort=True
- runslist of _SingleRunAnalysis
List of run objects which will make up this collection. In theory, MCMC and Nested sampling runs can both be used interchangeably.
- sortbool, optional
If True (default), the given list of runs will be sorted by their .name attributes. Sorting decides the positioning of the runs in some plot functions.
Methods
__init__(runs, *[, sort])add_residuals(ax, y1, y2, e1, e2[, clrs, ...])Append an extra axis to ax for plotting residuals.
filter_runs(pattern[, sort_by, sort])Filter all runs based on names and return a new object with them.
from_dir(directory[, pattern, strict, ...])Initialize a run collection based on run files found in a directory.
from_files(file_list[, strict, sampler, ...])Initialize a run collection based on a list of run files.
get_CImodels([N, Nprocesses, add_errors, ...])Return a CI ModelCollection instance corresponding to these runs.
get_models(**kwargs)Return a ModelCollection instance corresponding to these runs.
get_run(name)Return the a single run from this collection with a given name.
iter_plots(plot_func[, yield_run])Iterator yielding a call to plot_func for each run.
output_summary([outfile, params, style, ...])Output a table of the median and 1σ param values for all runs.
plot_a3_FeH([fig, ax, show_kroupa])Special case of plot_relation with "a3" and "FeH".
plot_lit_comp(param, truths[, e_truths, ...])Plot comparison between parameter values and "truths".
plot_lit_dist(param, truths[, e_truths, ...])Plot hist of the fractional difference between param and "truths".
plot_lit_relation(param, lit[, e_lit, ...])Plot comparison between parameter values and arbitrary data.
plot_param_bar(param[, fig, ax, clr_param, ...])Plot the mean and 1σ values of param along all runs as a bar chart.
plot_param_corner([params, fig, ...])Plot a "corner plot" showing relationship between parameters.
plot_param_hist(param[, fig, ax, kde, ...])Plot a histogram representing the sum of all distributions of param.
plot_param_means(param[, fig, ax, ...])Plot the mean and 1σ values of param along all runs.
plot_param_violins(param[, fig, ax, ...])Plot a violin plot showing the parameter distributions for all runs.
plot_relation(param1, param2[, fig, ax, ...])Plot relationship between two parameters across all runs.
save_plots(plot_func[, fn_pattern, save_kw, ...])Iterate over calls to plot_func on each run and save the figures.
summary_dataframe(*[, params, include_FeH, ...])Return a Dataframe with the median and 1σ param values for all runs.
Attributes
- add_residuals(ax, y1, y2, e1, e2, clrs=None, res_ax=None, loc='bottom', size='15%', pad=0.1)#
Append an extra axis to ax for plotting residuals.
Automatically appends a new axis to the the bottom of the given ax, and plots the residuals between the two given quantities (and their errors) on it, as a percentage.
- Parameters:
- axmatplotlib.axes.Axes
An axes instance on which to plot this observational data.
- y1, y2np.ndarray
Arrays of data values to plot the residual between. Residuals are of (y2 - y1) / y1.
- e1, e2np.ndarray
Arrays of errors on each datapoint.
- clrscolor, optional
Colour used for all datapoints, passed to errorbar and scatter.
- res_axmatplotlib.axes.Axes, optional
Optionally provide an already created axis to plot residuals on. This is useful for overplotting multiple residuals (i.e. for multiple datasets).
- loc{“left”, “right”, “bottom”, “top”}, optional
Where the new axes is positioned relative to the main axes.
- sizestr or float, optional
The size of the appended residuals axes, with respect to the primary axes. See mpl_toolkits.axes_grid1.axes_divider.AxesDivider.append_axes for more information. Defaults to “15%”.
- padfloat, optional
Padding between the axes. Defaults to 0.1.
- Returns:
- matplotlib.axes.Axes
The created axes instance containing the residuals plot.
- filter_runs(pattern, sort_by=None, sort=True, **kwargs)#
Filter all runs based on names and return a new object with them.
Based on a given string pattern, filters out all runs within this collection matching this pattern (as based on fnmatch.filter) and returns a new RunCollection instance with only those filtered runs.
- Parameters:
- patternstr or list of str
A pattern used to filter all run names, using the glob rules provided by fnmatch. Also allowed is a list of cluster names, which will filter on the matching runs. A list of names will not use pattern matching, and the given names must match exactly.
- sort_by{‘old’, ‘new’, None}, optional
Sort runs in new collection by either the order in this collection or the list of names (if it is a list, otherwise does None). If None (default), simply passes sort to the new collection init and sorting is handled there, by name. This argument is only used if sort is True.
- sortbool, optional
Whether or not to sort this run. If sort_by is None, this argument is passed to the new run collection init.
- **kwargsdict
All other arguments are passed to the new RunCollection object.
- Returns:
- RunCollection
A new run collection instance based on the filtered out runs.
- classmethod from_dir(directory, pattern='**/*hdf', strict=False, *args, sampler='nested', run_kwargs=None, **kwargs)#
Initialize a run collection based on run files found in a directory.
Search for run output files (as created by the relevant fitting functions) in a given directory and create a new RunCollection instance based on the run objects created from them.
NestedRun or MCMCRun instances will be created for found file. Which class is used must be consistent over all runs, and specified a priori.
- Parameters:
- directorystr or pathlib.Path
Path to the directory to search for files within.
- patternstr, optional
The glob pattern used to find all files within the given directory. Should be tuned in order to only return valid run files. Default is to search (recursively) for all HDF files within the directory.
- strictbool, optional
If True, will raise an RuntimeError if any discovered file fails when creating a run class.
- sampler{‘nested’, ‘mcmc’}, optional
Whether to initialize each run as either a NestedRun or MCMCRun.
- run_kwargsdict, optional
Optional arguments passed to all individual run initialization.
- *args, **kwargs
All other arguments are passed to the new RunCollection object.
- classmethod from_files(file_list, strict=False, *args, sampler='nested', run_kwargs=None, **kwargs)#
Initialize a run collection based on a list of run files.
Given a list of paths to a number of run output files (as created by the relevant fitting functions), creates a new RunCollection instance based on the run objects created from them.
NestedRun or MCMCRun instances will be created for found file. Which class is used must be consistent over all runs, and specified a priori.
- Parameters:
- file_listlist of str
A list of paths to valid run output files.
- strictbool, optional
If True, will raise an RuntimeError if any discovered file fails when creating a run class.
- sampler{‘nested’, ‘mcmc’}, optional
Whether to initialize each run as either a NestedRun or MCMCRun.
- run_kwargsdict, optional
Optional arguments passed to all individual run initialization.
- *args, **kwargs
All other arguments are passed to the new RunCollection object.
- get_CImodels(N=100, Nprocesses=1, add_errors=False, shuffle=True, load=True)#
Return a CI ModelCollection instance corresponding to these runs.
The visualizer collection is initialized through the ModelCollection.from_chains classmethod, with the chains from each run in this collection and using N samples, if load is False, otherwise will attempt to use the ModelCollection.load classmethod, assuming a CI model has already been created and saved to this same file, under the model group, in each run.
- Parameters:
- Nint, optional
The number of samples to use in computing the confidence intervals.
- Nprocessesint, optional
The number of processes to use in a multiprocessing.Pool passed to the CI model initializer. Defaults to only 1 cpu.
- add_errorsbool, optional
Optionally add the statistical and sampling errors, not normally accounted for, to the chain of samples used. Only relevant to nested sampling runs.
- shufflebool, optional
Optionally shuffle the chains before passing on. Useful when N is smaller than the full sample size, to avoid biasing the resulting CIs.
- loadbool, optional
If True, will attempt to load CI models, rather than creating a new one.
- Returns:
- CIModelVisualizer
The created model visualization (with confidence intervals) object.
- get_models(**kwargs)#
Return a ModelCollection instance corresponding to these runs.
The visualizer collection is initialized through the ModelCollection.from_chains classmethod, with the chains from each run in this collection, and based on the single average model.
- Parameters:
- **kwargsdict
All arguments are passed to the from_chains classmethod, with ci=False.
- Returns:
- ModelCollection
The created model collection visualization object.
- get_run(name)#
Return the a single run from this collection with a given name.
- iter_plots(plot_func, yield_run=False, *args, **kwargs)#
Iterator yielding a call to plot_func for each run.
- output_summary(outfile=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, params='all', style='latex', *, include_FeH=False, include_BH=False, math_labels=False, substack_errors=False, **kwargs)#
Output a table of the median and 1σ param values for all runs.
Constructs and writes out a table of the median and 1σ values of all included parameters, with each row representing a run.
- Parameters:
- outfilefile, optional
Output file handler to write the summary to. Defaults to printing to “stdout”.
- paramslist of str, optional
The list of parameters to include in the outputted table. If not given, defaults to the typical 13 free model parameters, and any included by the include_* arguments.
- style{‘table’, ‘latex’, ‘hdf’, ‘csv’, ‘html’}, optional
Type of output file to create. Defaults to ‘latex’. Most formats use the corresponding to_* method on a pandas.Dataframe.
- include_FeHbool, optional
If True, the metallicity FeH is included in the default params.
- include_BHbool, optional
If True, the black hole related parameters (BH_mass, BH_num, f_BH, f_rem) are included in the default params.
- math_labelsbool, optional
If True, the column names will be labelled with latex math. See _get_latex_labels for more information.
- substack_errorsbool, optional
If True, and the given style is latex, the errors will be written, not as a separate column, but within a “substack” on each value.
- **kwargsdict
All other arguments are passed to the corresponding to_* method on a pandas.Dataframe.
- Returns:
- pandas.Dataframe
The dataframe used to write the output file.
- plot_a3_FeH(fig=None, ax=None, show_kroupa=False, *args, **kwargs)#
Special case of plot_relation with “a3” and “FeH”.
- plot_lit_comp(param, truths, e_truths=None, src_truths='', fig=None, ax=None, *, annotate=False, annotate_kwargs=None, clr_param=None, clr_kwargs=None, residuals=False, diagonal=True, force_model=False, label=None, marker='o', **kwargs)#
Plot comparison between parameter values and “truths”.
Plots a scatter plot (with errorbars) of param by the values provided in the truths array, using the median and 1σ error values from each run in this collection.
This is meant to compare one-to-one the results of fits against “true” values, representing the same parameter, from the literature.
- Parameters:
- paramstr
Name of the parameter to plot.
- truthsnp.ndarray[Nruns]
Array of “truth” values, to plot on the y-axis.
- e_truthsnp.ndarray[Nruns], optional
Array of uncertainties on the “truth” values.
- src_truthsstr, optional
The source of the “truths”, included in the y-axis label.
- figNone or matplotlib.figure.Figure, optional
Figure to place the ax on. If None (default), a new figure will be created, otherwise the given figure should be empty, or already have the correct number of axes. See _RunAnalysis._setup_artist for more details.
- axNone or matplotlib.axes.Axes, optional
An axes instance on which to plot this relation. Should be a part of the given fig.
- annotatebool, optional
Optionally create a hook to this figure allowing the interactive annotating of selected cluster names. See _Annotator for more details.
- annotate_kwargsdict, optional
Optional arguments passed to the _Annotator instance.
- clr_paramstr, optional
Defines the colour of the plotted points. If the name of a parameter, will colour each point by the respective value of that parameter in each run, otherwise will accept a single colour, or array of colours for each run.
- clr_kwargsdict, optional
Optional arguments passed to the _add_colours function.
- residualsbool, optional
Add an ax to the bottom of the figure showing the residuals between the run results and the “truths”.
- diagonalbool, optional
Include a background one-to-one line along the diagonal.
- force_modelbool, optional
Force these parameter values to be taken from model quantities. Can be useful when some parameter names overlap (e.g. “ra”).
- labelstr, optional
Set a label that will be displayed in the legend.
- markerstr, optional
The marker style. See matplotlib.markers for more information.
- **kwargsdict
All other arguments are passed to ax.errorbar and ax.scatter.
- Returns:
- matplotlib.figure.Figure
The corresponding figure, containing all axes and plot artists.
- plot_lit_dist(param, truths, e_truths=None, src_truths='', fig=None, ax=None, *, kde=True, show_normal=True, kde_color='tab:blue', show_FWHM=True, annotate=False, annotate_kwargs=None, residuals=False, force_model=False, **kwargs)#
Plot hist of the fractional difference between param and “truths”.
Plots a scatter plot (with errorbars) of param by the values provided in the truths array, using the median and 1σ error values from each run in this collection.
This is meant to compare one-to-one the results of fits against “true” values, representing the same parameter, from the literature.
Plots a histogram (or smoothed KDE) of the fractional difference distribution between the run parameters values “true” values of the same parameter, from the literature.
The fractional difference is given by (param - truths) / sqrt(e_param^2 + e_truths^2) which, if in perfect agreement, should resemble a Gaussian centred on 0 with a width of 1.
- Parameters:
- paramstr
Name of the parameter to plot.
- truthsnp.ndarray[Nruns]
Array of “truth” values.
- e_truthsnp.ndarray[Nruns], optional
Array of uncertainties on the “truth” values. If None, will be taken as all 0.
- src_truthsstr, optional
The source of the “truths”, included in the y-axis label.
- figNone or matplotlib.figure.Figure, optional
Figure to place the ax on. If None (default), a new figure will be created, otherwise the given figure should be empty, or already have the correct number of axes. See _RunAnalysis._setup_artist for more details.
- axNone or matplotlib.axes.Axes, optional
An axes instance on which to plot this relation. Should be a part of the given fig.
- kdebool, optional
Whether to plot a smooth Gaussian KDE, or a simple histogram.
- show_normalbool, optional
Optionally overplot a Gaussian centred at 0 with a width of 1, representing perfect agreement.
- kde_colorstr, optional
The colour of the filled KDE.
- show_FWHMbool, optional
If show_normal is True, also place in a text box the difference in the FWHM between the KDE and the normal plot.
- annotatebool, optional
Optionally create a hook to this figure allowing the interactive annotating of selected cluster names. See _Annotator for more details.
- annotate_kwargsdict, optional
Optional arguments passed to the _Annotator instance.
- residualsbool, optional
Add an ax to the bottom of the figure showing the residuals between the run results and the “truths”.
- force_modelbool, optional
Force these parameter values to be taken from model quantities. Can be useful when some parameter names overlap (e.g. “ra”).
- **kwargsdict
All other arguments are passed to ax.fill_between.
- Returns:
- matplotlib.figure.Figure
The corresponding figure, containing all axes and plot artists.
- plot_lit_relation(param, lit, e_lit=None, param_lit='', src_lit='', fig=None, ax=None, *, lit_on_x=False, clr_param=None, clr_kwargs=None, residuals=False, annotate=False, annotate_kwargs=None, force_model=False, label=None, marker='o', **kwargs)#
Plot comparison between parameter values and arbitrary data.
Plots a scatter plot (with errorbars) of param by the values provided in the lit array, using the median and 1σ error values from each run in this collection.
This is meant to showcase relationships between the parameter results and other external parameter values, ostensibly from the literature.
- Parameters:
- paramstr
Name of the parameter to plot.
- litnp.ndarray[Nruns]
Array of external data values, to plot on the y-axis.
- e_litnp.ndarray[Nruns], optional
Array of uncertainties on the lit values.
- param_litstr, optional
The name of the parameter represented in the lit values, included in the y-axis label.
- src_litstr, optional
The source of the lit, included in the y-axis label.
- figNone or matplotlib.figure.Figure, optional
Figure to place the ax on. If None (default), a new figure will be created, otherwise the given figure should be empty, or already have the correct number of axes. See _RunAnalysis._setup_artist for more details.
- axNone or matplotlib.axes.Axes, optional
An axes instance on which to plot this relation. Should be a part of the given fig.
- lit_on_xbool, optional
Optionally flip the axes, plotting the lit values on the x-axis and the runs on the y-axis.
- clr_paramstr, optional
Defines the colour of the plotted points. If the name of a parameter, will colour each point by the respective value of that parameter in each run, otherwise will accept a single colour, or array of colours for each run.
- clr_kwargsdict, optional
Optional arguments passed to the _add_colours function.
- residualsbool, optional
Add an ax to the bottom of the figure showing the residuals between the run results and the “truths”.
- annotatebool, optional
Optionally create a hook to this figure allowing the interactive annotating of selected cluster names. See _Annotator for more details.
- annotate_kwargsdict, optional
Optional arguments passed to the _Annotator instance.
- force_modelbool, optional
Force these parameter values to be taken from model quantities. Can be useful when some parameter names overlap (e.g. “ra”).
- labelstr, optional
Set a label that will be displayed in the legend.
- markerstr, optional
The marker style. See matplotlib.markers for more information.
- **kwargsdict
All other arguments are passed to ax.errorbar and ax.scatter.
- Returns:
- matplotlib.figure.Figure
The corresponding figure, containing all axes and plot artists.
- plot_param_bar(param, fig=None, ax=None, clr_param=None, clr_kwargs=None, force_model=False, **kwargs)#
Plot the mean and 1σ values of param along all runs as a bar chart.
Plots, with error bars, the mean values of the given parameter for each run as a bar chart beginning at 0.0, spaced equally along the x-axis, sorted by run name.
- Parameters:
- paramstr
Name of the parameter to plot.
- figNone or matplotlib.figure.Figure, optional
Figure to place the ax on. If None (default), a new figure will be created, otherwise the given figure should be empty, or already have the correct number of axes. See _RunAnalysis._setup_artist for more details.
- axNone or matplotlib.axes.Axes, optional
An axes instance on which to plot this parameter. Should be a part of the given fig.
- clr_paramstr, optional
Defines the colour of the plotted points. If the name of a parameter, will colour each point by the respective value of that parameter in each run, otherwise will accept a single colour, or array of colours for each run.
- clr_kwargsdict, optional
Optional arguments passed to the _add_colours function.
- force_modelbool, optional
Force these parameter values to be taken from model quantities. Can be useful when some parameter names overlap (e.g. “ra”).
- **kwargsdict
All other arguments are passed to ax.bar.
- Returns:
- matplotlib.figure.Figure
The corresponding figure, containing all axes and plot artists.
- plot_param_corner(params=None, fig=None, *, include_FeH=True, include_BH=False, include_rt=False, log_radii=False, force_model=False, **kwargs)#
Plot a “corner plot” showing relationship between parameters.
Plots a Nparam-Nparam lower-triangular “corner” plot showing the mean and 1σ values for all parameters for all runs.
- Parameters:
- paramslist of str, optional
The list of parameters to plot. If not given, defaults to the typical 13 free model parameters, and any included by the include_* arguments.
- figNone or matplotlib.figure.Figure, optional
Figure to place all axes on. If None (default), a new figure will be created, otherwise the given figure should be empty, or already have the correct number of axes. See _RunAnalysis._setup_multi_artist for more details.
- include_FeHbool, optional
If True, the metallicity FeH is included in the default params.
- include_BHbool, optional
If True, the black hole mass BH_mass is included in the default params.
- include_rtbool, optional
If True, the tidal radius rt is included in the default params.
- log_radiibool, optional
If True, the radii included in the default params are logged.
- force_modelbool, optional
Force these parameter values to be taken from model quantities. Can be useful when some parameter names overlap (e.g. “ra”).
- **kwargsdict
All other arguments are passed to plot_relation.
- Returns:
- matplotlib.figure.Figure
The corresponding figure, containing all axes and plot artists.
- plot_param_hist(param, fig=None, ax=None, kde=False, force_model=False, **kwargs)#
Plot a histogram representing the sum of all distributions of param.
Plots a histogram (or smoothed Gaussian KDE) representing the sum (or convolution) of the distributions of this parameter over all runs.
- Parameters:
- paramstr
Name of the parameter to plot.
- figNone or matplotlib.figure.Figure, optional
Figure to place the ax on. If None (default), a new figure will be created, otherwise the given figure should be empty, or already have the correct number of axes. See _RunAnalysis._setup_artist for more details.
- axNone or matplotlib.axes.Axes, optional
An axes instance on which to plot this parameter. Should be a part of the given fig.
- kdebool, optional
Whether to plot a smooth Gaussian KDE, or a simple histogram.
- force_modelbool, optional
Force these parameter values to be taken from model quantities. Can be useful when some parameter names overlap (e.g. “ra”).
- **kwargsdict
All other arguments are passed to ax.fill_between or ax.hist.
- Returns:
- matplotlib.figure.Figure
The corresponding figure, containing all axes and plot artists.
- plot_param_means(param, fig=None, ax=None, clr_param=None, clr_kwargs=None, force_model=False, **kwargs)#
Plot the mean and 1σ values of param along all runs.
Plots, with error bars, the mean values of the given parameter for each run, spaced equally along the x-axis, sorted by run name.
- Parameters:
- paramstr
Name of the parameter to plot.
- figNone or matplotlib.figure.Figure, optional
Figure to place the ax on. If None (default), a new figure will be created, otherwise the given figure should be empty, or already have the correct number of axes. See _RunAnalysis._setup_artist for more details.
- axNone or matplotlib.axes.Axes, optional
An axes instance on which to plot this parameter. Should be a part of the given fig.
- clr_paramstr, optional
Defines the colour of the plotted points. If the name of a parameter, will colour each point by the respective value of that parameter in each run, otherwise will accept a single colour, or array of colours for each run.
- clr_kwargsdict, optional
Optional arguments passed to the _add_colours function.
- force_modelbool, optional
Force these parameter values to be taken from model quantities. Can be useful when some parameter names overlap (e.g. “ra”).
- **kwargsdict
All other arguments are passed to ax.errorbar and ax.scatter.
- Returns:
- matplotlib.figure.Figure
The corresponding figure, containing all axes and plot artists.
- plot_param_violins(param, fig=None, ax=None, clr_param=None, clr_kwargs=None, color=None, alpha=0.3, edgecolor='k', edgewidth=1.0, quantiles=[0.9772, 0.8413, 0.5, 0.1587, 0.0228], force_model=False, **kwargs)#
Plot a violin plot showing the parameter distributions for all runs.
Plots a violin plot with the full posterior distributions of a parameter for each run, spaced equally along the x-axis, sorted by run name.
- Parameters:
- paramstr
Name of the parameter to plot.
- figNone or matplotlib.figure.Figure, optional
Figure to place the ax on. If None (default), a new figure will be created, otherwise the given figure should be empty, or already have the correct number of axes. See _RunAnalysis._setup_artist for more details.
- axNone or matplotlib.axes.Axes, optional
An axes instance on which to plot this parameter. Should be a part of the given fig.
- clr_paramstr, optional
Defines the colour of the plotted points. If the name of a parameter, will colour each point by the respective value of that parameter in each run, otherwise will accept a single colour, or array of colours for each run.
- clr_kwargsdict, optional
Optional arguments passed to the _add_colours function.
- colorstr, optional
Fallback default (single) colour for all distributions. clr_param has precedence over this.
- alphafloat, optional
Transparency value applied to all distributions.
- edgecolorstr, optional
The color of the border placed around each distribution.
- edgewidthfloat, optional
The width of the border placed around each distribution.
- quantileslist of float, optional
The quantiles shown as ticks on the central errorbars inside the distributions.
- force_modelbool, optional
Force these parameter values to be taken from model quantities. Can be useful when some parameter names overlap (e.g. “ra”).
- **kwargsdict
All other arguments are passed to ax.violinplot.
- Returns:
- matplotlib.figure.Figure
The corresponding figure, containing all axes and plot artists.
- plot_relation(param1, param2, fig=None, ax=None, *, show_pearsonr=False, force_model=False, annotate=False, annotate_kwargs=None, clr_param=None, clr_kwargs=None, label=None, marker='o', **kwargs)#
Plot relationship between two parameters across all runs.
Plots a scatter plot (with errorbars) of param1 by param2 using the median and 1σ error values from each run in this collection.
- Parameters:
- param1str
Name of the parameter to plot on the x-axis.
- param2str
Name of the parameter to plot on the y-axis.
- figNone or matplotlib.figure.Figure, optional
Figure to place the ax on. If None (default), a new figure will be created, otherwise the given figure should be empty, or already have the correct number of axes. See _RunAnalysis._setup_artist for more details.
- axNone or matplotlib.axes.Axes, optional
An axes instance on which to plot this relation. Should be a part of the given fig.
- show_pearsonrbool, optional
Optionally compute the “Pearson-r” statistic for this data and place it in a text box in the bottom right of the ax.
- force_modelbool, optional
Force these parameter values to be taken from model quantities. Can be useful when some parameter names overlap (e.g. “ra”).
- annotatebool, optional
Optionally create a hook to this figure allowing the interactive annotating of selected cluster names. See _Annotator for more details.
- annotate_kwargsdict, optional
Optional arguments passed to the _Annotator instance.
- clr_paramstr, optional
Defines the colour of the plotted points. If the name of a parameter, will colour each point by the respective value of that parameter in each run, otherwise will accept a single colour, or array of colours for each run.
- clr_kwargsdict, optional
Optional arguments passed to the _add_colours function.
- labelstr, optional
Set a label that will be displayed in the legend.
- markerstr, optional
The marker style. See matplotlib.markers for more information.
- **kwargsdict
All other arguments are passed to ax.errorbar and ax.scatter.
- Returns:
- matplotlib.figure.Figure
The corresponding figure, containing all axes and plot artists.
- save_plots(plot_func, fn_pattern=None, save_kw=None, size=None, remove_name=True, *args, **kwargs)#
Iterate over calls to plot_func on each run and save the figures.
Iterates over the iter_plots function and saves all individual figures to separate files, under a custom iterative file naming schema.
- Parameters:
- plot_funcstr
The name of the plotting function called on each run.
- fn_patternstr, optional
A format string, which is passed the argument “cluster” representing each run’s name, and is used to create the filename each figure is saved under. Defaults to f’./{cluster}_{plot_func[5:]}’.
- save_kwdict, optional
Optional arguments are passed to the fig.savefig function.
- size2-tuple of float, optional
Optional resizing of the figure, using fig.set_size_inches.
- remove_namebool, optional
Remove the sometimes present cluster name placed into the figure’s suptitle.
- *args, **kwargs
All other arguments are passed to iter_plots.
- summary_dataframe(*, params='all', include_FeH=True, include_BH=False, math_labels=False)#
Return a Dataframe with the median and 1σ param values for all runs.
Constructs and returns a table (in the form of a pandas.Dataframe) of the median and 1σ values of all included parameters, with each row representing a run.
- Parameters:
- paramslist of str, optional
The list of parameters to include in the returned table. If not given, defaults to the typical 13 free model parameters, and any included by the include_* arguments.
- include_FeHbool, optional
If True, the metallicity FeH is included in the default params.
- include_BHbool, optional
If True, the black hole related parameters (BH_mass, BH_num, f_BH, f_rem) are included in the default params.
- math_labelsbool, optional
If True, the column names will be labelled with latex math. See _get_latex_labels for more information.
- Returns:
- pandas.Dataframe
The full table of parameter values.