summarypublication
The summarypublication executable allows the user to generate plots that appear in the GWTC1 paper produced by the LIGO Virgo collaboration.
To see help for this executable please run:
$ summarypublication --help
usage: summarypublication [-h] [-w DIR] [-s SAMPLES [SAMPLES ...]]
[--labels LABELS [LABELS ...]]
[--plot {2d_contour,violin,spin_disk,population_scatter,population_scatter_error}]
[--parameters PARAMETERS [PARAMETERS ...]]
[--publication_kwargs PUBLICATION_KWARGS [PUBLICATION_KWARGS ...]]
[--colors COLORS [COLORS ...]] [--palette PALETTE]
[--linestyles LINESTYLES [LINESTYLES ...]]
[--levels LEVELS [LEVELS ...]]
This executable is used to generate publication quality plots given result
files
optional arguments:
-h, --help show this help message and exit
-w DIR, --webdir DIR make page and plots in DIR
-s SAMPLES [SAMPLES ...], --samples SAMPLES [SAMPLES ...]
Path to posterior samples file(s). See documentation
for allowed formats. If path is on a remote server,
add username and servername in the form
{username}@{servername}:{path}. If path is on a public
webpage, ensure the path starts with https://. You may
also pass a string such as posterior_samples*.dat and
all matching files will be used
--labels LABELS [LABELS ...]
labels used to distinguish runs
--plot {2d_contour,violin,spin_disk,population_scatter,population_scatter_error}
name of the publication plot you wish to produce
--parameters PARAMETERS [PARAMETERS ...]
parameters of the 2d contour plot you wish to make
--publication_kwargs PUBLICATION_KWARGS [PUBLICATION_KWARGS ...]
Optional kwargs for publication plots
--colors COLORS [COLORS ...]
Colors you wish to use to distinguish result files
--palette PALETTE Color palette to use to distinguish result files
--linestyles LINESTYLES [LINESTYLES ...]
Linestyles you wish to use to distinguish result files
--levels LEVELS [LEVELS ...]
Contour levels you wish to plot
Generating a population plot
PESummary has the ability to generate a scatter plot showing a population of runs. If requested, 90% confidence regions can be added. An example command line is below:
$ summarypublication --webdir ./ \
--samples GW150914_result.json GW151012_result.hdf5 \
--labels GW150914 GW151012 --parameters mass_1 mass_2 \
--plot population_scatter_error
Generating a 2d contour plot
PESummary has the ability to generate a 2d contour plot which contains bounded 2d KDEs for all result files passed (like Figure 4 in thr GWTC1 paper). The bounds for each parameter is hardcoded in the pesummary.core.plots.bounded_2d_kde module:
In order to ensure that the lines are distinguishable from one another, you can either choose a seaborn palette using the –palette command line argument or the –colors command line argument to pass a list of colors, one for each result file.
An example command line is below:
$ summarypublication --webdir ./ --samples GW150914_result.json \
--labels GW150914 --plot 2d_contour \
--parameters mass_1 mass_2
Generating a violin plot
PESummary has the ability to generate violin plots for a result files passed (like Figure 5 in the GWTC1 paper). An example command line is below:
$ summarypublication --webdir ./ --samples GW150914_result.json \
--labels GW150914 --plot violin --parameters chi_eff
Generating a spin disk plot
PESummary has the ability to generate a spin disk plot for a given result file (like figure 6 in the GWTC1 paper). An example command line is below:
$ summarypublication --webdir ./ --samples GW150914_result.json \
--labels GW150914 --plot spin_disk
pesummary.core.plots.population
- pesummary.core.plots.population.scatter_plot(parameters, sample_dict, latex_labels, colors=None, xerr=None, yerr=None)[source]
Produce a plot which shows a population of runs over a certain parameter space. If errors are given, then plot error bars.
- Parameters:
parameters (list) – names of the parameters that you wish to plot
sample_dict (dict) – nested dictionary storing the median values for each parameter for each run. For example: x = {‘one’: {‘m’: 10, ‘n’: 20}}
latex_labels (dictionary) – dictionary of latex labels
colors (list) – list of colors that you wish to use to distinguish the different runs
xerr (dict) – same structure as sample_dict, but dictionary storing error in x
yerr (dict) – same structure as sample_dict, but dictionary storing error in y
pesummary.gw.plots.publication
- pesummary.gw.plots.publication.chirp_mass_and_q_from_mass1_mass2(pts)[source]
Transform the component masses to chirp mass and mass ratio
- Parameters:
pts (numpy.array) – array containing the mass1 and mass2 samples
- pesummary.gw.plots.publication.reverse_triangle_plot(*args, parameters=[], **kwargs)[source]
Generate a triangular plot made of 3 axis. One central axis showing the 2d marginalized posterior and two smaller axes showing the marginalized 1d posterior distribution (below and to the left of central axis). Only two axes are plotted, each below the 1d marginalized posterior distribution
- Parameters:
*args (tuple) – all args passed to pesummary.core.plots.publication.reverse_triangle_plot
parameters (list) – list of parameters being plotted
kwargs (dict, optional) – all kwargs passed to pesummary.core.plots.publication.reverse_triangle_plot
- pesummary.gw.plots.publication.spin_distribution_plots(parameters, samples, label, color=None, cmap=None, annotate=False, show_label=True, colorbar=False, vmin=0.0, vmax=2.221384175190545)[source]
Generate spin distribution plots for a set of parameters and samples
- Parameters:
parameters (list) – list of parameters
samples (nd list) – list of samples for each spin component
label (str) – the label corresponding to the set of samples
color (str, optioanl) – color to use for plotting
cmap (str, optional) – cmap to use for plotting. cmap is preferentially chosen over color
annotate (Bool, optional) – if True, label the magnitude and tilt directions
show_label (Bool, optional) – if True, add labels indicating which side of the spin disk corresponds to which binary component
- pesummary.gw.plots.publication.triangle_plot(*args, parameters=[], **kwargs)[source]
Generate a triangular plot made of 3 axis. One central axis showing the 2d marginalized posterior and two smaller axes showing the marginalized 1d posterior distribution (above and to the right of central axis)
- Parameters:
*args (tuple) – all args passed to pesummary.core.plots.publication.triangle_plot
parameters (list) – list of parameters being plotted
kwargs (dict, optional) – all kwargs passed to pesummary.core.plots.publication.triangle_plot
- pesummary.gw.plots.publication.twod_contour_plots(parameters, samples, labels, latex_labels, colors=None, linestyles=None, return_ax=False, plot_datapoints=False, smooth=None, latex_friendly=False, levels=[0.9], legend_kwargs={'bbox_to_anchor': (0.0, 1.02, 1.0, 0.102), 'borderaxespad': 0.0, 'handleheight': 1.75, 'handlelength': 3, 'loc': 3, 'mode': 'expand'}, **kwargs)[source]
Generate 2d contour plots for a set of samples for given parameters
- Parameters:
parameters (list) – names of the parameters that you wish to plot
samples (nd list) – list of samples for each parameter
labels (list) – list of labels corresponding to each set of samples
latex_labels (dict) – dictionary of latex labels
- pesummary.gw.plots.publication.violin_plots(parameter, samples, labels, latex_labels, inj_values=None, cut=0, _default_kwargs={'inner': 'line', 'outer': 'percent: 90', 'palette': 'pastel'}, latex_friendly=True, **kwargs)[source]
Generate violin plots for a set of parameters and samples
- Parameters:
parameters (str) – the name of the parameter that you wish to plot
samples (nd list) – list of samples for each parameter
labels (list) – list of labels corresponding to each set of samples
latex_labels (dict) – dictionary of latex labels
inj_values (list) – list of injected values for each set of samples