plot_catalogs.py

Note

Currently under construction!

setup_fig_single(fig_size, left, bottom, right, top)

Set up a single-panel figure using matplotlib.gridspec.GridSpec.

Parameters:
  • fig_size (tuple) – The figure size, e.g. (16,8).

  • left (float) – The left margin of the panel (between 0 and 1).

  • bottom (float) – The bottom margin of the panel (between 0 and 1).

  • right (float) – The right margin of the panel (between 0 and 1).

  • top (float) – The top margin of the panel (between 0 and 1).

Returns:

ax – The plotting axes for the figure.

Return type:

matplotlib.axes._subplots.AxesSubplot

plot_panel_counts_hist_simple(ax, x_sim, x_Kep, x_min=0, x_max=None, y_min=None, y_max=None, x_llim=None, x_ulim=None, normalize=False, N_sim_Kep_factor=1.0, log_y=False, c_sim=['k'], c_Kep=['k'], ls_sim=['-'], ms_Kep=['x'], lines_Kep=False, lw=1, labels_sim=['Simulated'], labels_Kep=['Kepler'], xticks_custom=None, xlabel_text='x', ylabel_text='Number', afs=20, tfs=20, lfs=16, legend=False, show_counts_sim=False, show_counts_Kep=False)

Plot histogram(s) of discrete integer values on a given panel.

Parameters:
  • ax (matplotlib.axes._subplots.AxesSubplot) – The axes to plot on.

  • x_sim (list[array[int]]) – A list with sample(s) of integers (e.g. simulated data).

  • x_Kep (list[array[int]]) – A list with sample(s) of integers (e.g. Kepler data).

  • x_min (float, default=0) – The minimum value to include.

  • x_max (float, optional) – The maximum value to include.

  • y_min (float, optional) – The lower y-axis limit.

  • y_max (float, optional) – The upper y-axis limit.

  • x_llim (float, optional) – The lower x-axis limit.

  • x_ulim (float, optional) – The upper x-axis limit.

  • normalize (bool, default=False) – Whether to normalize the histograms. If True, each histogram will sum to one.

  • N_sim_Kep_factor (float, default=1.) – The number of simulated targets divided by the number of Kepler targets. If normalize=False, will divide the bin counts for the simulated data (x_sim) by this value to provide an equivalent comparison to the Kepler counts.

  • log_y (bool, default=False) – Whether to plot the y-axis on a log-scale.

  • c_sim (list[str], default=['k']) – A list of plotting colors for the histograms of simulated data.

  • c_Kep (list[str], default=['k']) – A list of plotting colors for the histograms of Kepler data.

  • ls_sim (list[str], default=['-']) – A list of line styles for the histograms of simulated data.

  • ms_Kep (list[str], default=['x']) – A list of marker shapes for the histograms of Kepler data.

  • lines_Kep (bool, default=False) – Whether to also draw the histogram lines for the Kepler data. Default value (False) will just draw marker points (given by ms_Kep) for the Kepler counts in each bin.

  • lw (float, default=1) – The line width for the histograms.

  • labels_sim (list[str], default=['Simulated']) – A list of legend labels for the histograms of simulated data.

  • labels_Kep (list[str], default=['Kepler']) – A list of legend labels for the histograms of Kepler data.

  • xticks_custom (list or array[float], optional) – The x-values at which to plot ticks.

  • xlabel_text (str, default='x') – The x-axis label.

  • ylabel_text (str, default='Number') – The y-axis label.

  • afs (int, default=20) – The axes fontsize.

  • tfs (int, default=20) – The text fontsize.

  • lfs (int, default=16) – The legend fontsize.

  • legend (bool, default=False) – Whether to show the legend.

  • show_counts_sim (bool, default=False) – Whether to show the individual bin counts for the simulated data.

  • show_counts_Kep (bool, default=True) – Whether to show the individual bin counts for the Kepler data.

plot_fig_counts_hist_simple(fig_size, x_sim, x_Kep, x_min=0, x_max=None, y_min=None, y_max=None, x_llim=None, x_ulim=None, normalize=False, N_sim_Kep_factor=1.0, log_y=False, c_sim=['k'], c_Kep=['k'], ls_sim=['-'], ms_Kep=['x'], lines_Kep=False, lw=1, labels_sim=['Simulated'], labels_Kep=['Kepler'], xticks_custom=None, xlabel_text='x', ylabel_text='Number', afs=20, tfs=20, lfs=16, legend=False, show_counts_sim=False, show_counts_Kep=False, fig_lbrt=[0.15, 0.2, 0.95, 0.925], save_name='no_name_fig.pdf', save_fig=False)

Plot a figure with histogram(s) of discrete integer values.

Wrapper for the function syssimpyplots.plot_catalogs.plot_panel_counts_hist_simple(). Includes all of the parameters of that function, with the following additional parameters:

Parameters:
  • fig_size (tuple) – The figure size, e.g. ‘(16,8)’.

  • fig_lbrt (list[float], default=[0.15, 0.2, 0.95, 0.925]) – The positions of the (left, bottom, right, and top) margins of the plotting panel (all values must be between 0 and 1).

  • save_name (str, default='no_name_fig.pdf') – The file name for saving the figure.

  • save_fig (bool, default=False) – Whether to save the figure. If True, will save the figure in the working directory with the file name given by save_name.

Returns:

ax – The plotting axes, if save_fig=False.

Return type:

matplotlib.axes._subplots.AxesSubplot

plot_panel_pdf_simple(ax, x_sim, x_Kep, x_min=None, x_max=None, y_min=None, y_max=None, n_bins=100, normalize=True, N_sim_Kep_factor=1.0, log_x=False, log_y=False, c_sim=['k'], c_Kep=['k'], ls_sim=['-'], ls_Kep=['-'], lw=1, alpha=0.2, labels_sim=['Simulated'], labels_Kep=['Kepler'], extra_text=None, xticks_custom=None, xlabel_text='x', ylabel_text='Fraction', afs=20, tfs=20, lfs=16, legend=False)

Plot histogram(s) of continuous distributions on a given panel.

Parameters:
  • ax (matplotlib.axes._subplots.AxesSubplot) – The axes to plot on.

  • x_sim (list[array[float]]) – A list with sample(s) of values (e.g. simulated data).

  • x_Kep (list[array[float]]) – A list with sample(s) of values (e.g. Kepler data).

  • x_min (float, optional) – The minimum value to include.

  • x_max (float, optional) – The maximum value to include.

  • y_min (float, optional) – The lower y-axis limit.

  • y_max (float, optional) – The upper y-axis limit.

  • n_bins (int, default=100) – The number of bins.

  • normalize (bool, default=True) – Whether to normalize the histograms. If True, each histogram will sum to one.

  • N_sim_Kep_factor (float, default=1.) – The number of simulated targets divided by the number of Kepler targets. If normalize=False, will divide the bin counts for the simulated data (x_sim) by this value to provide an equivalent comparison to the Kepler counts.

  • log_x (bool, default=False) – Whether to plot the x-axis on a log-scale and use log-uniform bins.

  • log_y (bool, default=False) – Whether to plot the y-axis on a log-scale.

  • c_sim (list[str], default=['k']) – A list of plotting colors for the histograms of simulated data.

  • c_Kep (list[str], default=['k']) – A list of plotting colors for the histograms of Kepler data.

  • ls_sim (list[str], default=['-']) – A list of line styles for the histograms of simulated data.

  • ls_Kep (list[str], default=['-']) – A list of line styles for the histograms of Kepler data.

  • lw (float, default=1) – The line width for the histograms.

  • alpha (float, default=0.2) – The transparency of the shading for the histograms of Kepler data (between 0 and 1).

  • labels_sim (list[str], default=['Simulated']) – A list of legend labels for the histograms of simulated data.

  • labels_Kep (list[str], default=['Kepler']) – A list of legend labels for the histograms of Kepler data.

  • extra_text (str, optional) – Extra text to be displayed on the figure.

  • xticks_custom (list or array[float], optional) – The x-values at which to plot ticks.

  • xlabel_text (str, default='x') – The x-axis label.

  • ylabel_text (str, default='Fraction') – The y-axis label.

  • afs (int, default=20) – The axes fontsize.

  • tfs (int, default=20) – The text fontsize.

  • lfs (int, default=16) – The legend fontsize.

  • legend (bool, default=False) – Whether to show the legend.

plot_fig_pdf_simple(fig_size, x_sim, x_Kep, x_min=None, x_max=None, y_min=None, y_max=None, n_bins=100, normalize=True, N_sim_Kep_factor=1.0, log_x=False, log_y=False, c_sim=['k'], c_Kep=['k'], ls_sim=['-'], ls_Kep=['-'], lw=1, alpha=0.2, labels_sim=['Simulated'], labels_Kep=['Kepler'], extra_text=None, xticks_custom=None, xlabel_text='x', ylabel_text='Fraction', afs=20, tfs=20, lfs=16, legend=False, fig_lbrt=[0.15, 0.2, 0.95, 0.925], save_name='no_name_fig.pdf', save_fig=False)

Plot a figure with histogram(s) of continuous distributions.

Wrapper for the function syssimpyplots.plot_catalogs.plot_panel_pdf_simple(). Includes all of the parameters of that function, with the following additional parameters:

Parameters:
  • fig_size (tuple) – The figure size, e.g. ‘(16,8)’.

  • fig_lbrt (list[float], default=[0.15, 0.2, 0.95, 0.925]) – The positions of the (left, bottom, right, and top) margins of the plotting panel (all values must be between 0 and 1).

  • save_name (str, default='no_name_fig.pdf') – The file name for saving the figure.

  • save_fig (bool, default=False) – Whether to save the figure. If True, will save the figure in the working directory with the file name given by save_name.

Returns:

ax – The plotting axes, if save_fig=False.

Return type:

matplotlib.axes._subplots.AxesSubplot

plot_panel_cdf_simple(ax, x_sim, x_Kep, x_min=None, x_max=None, y_min=0.0, y_max=1.0, log_x=False, c_sim=['k'], c_Kep=['k'], ls_sim=['-'], ls_Kep=['--'], lw=1, labels_sim=['Simulated'], labels_Kep=['Kepler'], extra_text=None, xticks_custom=None, xlabel_text='x', ylabel_text='CDF', one_minus=False, afs=20, tfs=20, lfs=16, legend=False, label_dist=False)

Plot cumulative distribution functions (CDFs) for continuous distributions on a given panel.

Parameters:
  • ax (matplotlib.axes._subplots.AxesSubplot) – The axes to plot on.

  • x_sim (list[array[float]]) – A list with sample(s) of values (e.g. simulated data).

  • x_Kep (list[array[float]]) – A list with sample(s) of values (e.g. Kepler data).

  • x_min (float, optional) – The minimum value to include.

  • x_max (float, optional) – The maximum value to include.

  • y_min (float, default=0.) – The lower y-axis limit.

  • y_max (float, default=1.) – The upper y-axis limit.

  • log_x (bool, default=False) – Whether to plot the x-axis on a log-scale.

  • c_sim (list[str], default=['k']) – A list of plotting colors for the CDFs of simulated data.

  • c_Kep (list[str], default=['k']) – A list of plotting colors for the CDFs of Kepler data.

  • ls_sim (list[str], default=['-']) – A list of line styles for the CDFs of simulated data.

  • ls_Kep (list[str], default=['--']) – A list of line styles for the CDFs of Kepler data.

  • lw (float, default=1) – The line width for the CDFs.

  • labels_sim (list[str], default=['Simulated']) – A list of legend labels for the CDFs of simulated data.

  • labels_Kep (list[str], default=['Kepler']) – A list of legend labels for the CDFs of Kepler data.

  • extra_text (str, optional) – Extra text to be displayed on the figure.

  • xticks_custom (list or array[float], optional) – The x-values at which to plot ticks.

  • xlabel_text (str, default='x') – The x-axis label.

  • ylabel_text (str, default='CDF') – The y-axis label.

  • one_minus (bool, default=False) – Whether to plot one minus the CDF.

  • afs (int, default=20) – The axes fontsize.

  • tfs (int, default=20) – The text fontsize.

  • lfs (int, default=16) – The legend fontsize.

  • legend (bool, default=False) – Whether to show the legend.

  • label_dist (bool, default=False) – Whether to compute and show the distances between the simulated and Kepler CDFs on the lower-right corner of the plot. If True, will compute the KS distance (using syssimpyplots.compare_kepler.KS_dist()) and the modified AD distance (using syssimpyplots.compare_kepler.AD_mod_dist()) between each pair of x_sim and x_Kep arrays.

plot_fig_cdf_simple(fig_size, x_sim, x_Kep, x_min=None, x_max=None, y_min=0.0, y_max=1.0, log_x=False, c_sim=['k'], c_Kep=['k'], ls_sim=['-'], ls_Kep=['--'], lw=1, labels_sim=['Simulated'], labels_Kep=['Kepler'], extra_text=None, xticks_custom=None, xlabel_text='x', ylabel_text='CDF', one_minus=False, afs=20, tfs=20, lfs=16, legend=False, label_dist=False, fig_lbrt=[0.15, 0.2, 0.95, 0.925], save_name='no_name_fig.pdf', save_fig=False)

Plot a figure with CDF(s) of continuous distributions.

Wrapper for the function syssimpyplots.plot_catalogs.plot_panel_cdf_simple(). Includes all of the parameters of that function, with the following additional parameters:

Parameters:
  • fig_size (tuple) – The figure size, e.g. ‘(16,8)’.

  • fig_lbrt (list[float], default=[0.15, 0.2, 0.95, 0.925]) – The positions of the (left, bottom, right, and top) margins of the plotting panel (all values must be between 0 and 1).

  • save_name (str, default='no_name_fig.pdf') – The file name for saving the figure.

  • save_fig (bool, default=False) – Whether to save the figure. If True, will save the figure in the working directory with the file name given by save_name.

Returns:

ax – The plotting axes, if save_fig=False.

Return type:

matplotlib.axes._subplots.AxesSubplot

plot_fig_mult_cdf_simple(fig_size, x_sim, x_Kep, x_min=1, x_max=None, y_min=0.0, y_max=1.0, c_sim=['k'], c_Kep=['k'], ls_sim=['-'], ls_Kep=['--'], lw=1, labels_sim=['Simulated'], labels_Kep=['Kepler'], xticks_custom=None, xlabel_text='x', ylabel_text='CDF', afs=20, tfs=20, lfs=16, legend=False, fig_lbrt=[0.15, 0.2, 0.95, 0.925], save_name='no_name_fig.pdf', save_fig=False)

Plot a figure with CDF(s) of discrete integer values.

Analogous to the function syssimpyplots.plot_catalogs.plot_fig_cdf_simple() but for integer values; uses almost all of the same parameters.

Plot a gallery of systems to visualize their architectures.

Parameters:
  • x_per_sys (array[float]) – The properties of the planets in each system to plot on the x-axis. This is a 2-d array (where each row is a separate system), typically of the orbital period (days).

  • s_per_sys (array[float]) – The properties of the planets in each system to plot as the sizes of the points (which will be proportional to the squared values of s_per_sys). This is a 2-d array (where each row is a separate system), typically of the planet radii (Earth radii).

  • x_min (float, default=2.) – The lower limit for the x-axis.

  • x_max (float, default=300.) – The upper limit for the x-axis.

  • log_x (bool, default=True) – Whether to plot the x-axis on a log-scale.

  • s_norm (float, default=2.) – The normalization for the sizes of the points.

  • color_by ({'k', 'size_order', 'custom'}) – A string indicating the way the points are colored. The options are: ‘k’ to color all points in black; ‘size_order’ to color the points by their size ordering; ‘custom’ to color the points by custom values given by colors_per_sys.

  • colors_per_sys (array[float], optional) – A 2-d array for coloring the planets in each system, used if color_by=’custom’.

  • det_per_sys (array[float], optional) – A 2-d array indicating which planets in each system are detected. If provided, will mark undetected planets with red outlines.

  • llabel_per_sys (array[float], optional) – A 1-d array for labeling each system.

  • llabel_text (str, optional) – The label for the labelings of each system.

  • llabel_fmt (str, optional) – The string formatting of the labels in llabel_per_sys.

  • xticks_custom (list or array[float], optional) – The x-values at which to plot ticks.

  • xlabel_text (str, default=r'Period $P$ (days)') – The x-axis label.

  • title (str, optional) – The title for the figures.

  • legend (bool, default=False) – Whether to plot a legend. Note that this will not make an actual legend object, but will simply plot an additional “system” at the top with several example planets of sizes given by s_examples.

  • s_examples (list or array[float], default=[1.,3.,10.]) – The example planet sizes to plot in the legend. Must have the same units as the values in s_per_sys.

  • s_units (str, default=r'$R_oplus$') – The text for displaying the units in the legend.

  • legend_fmt (str, default=r'${:.0f}$') – The string formatter for the example values in the legend.

  • afs (int, default=16) – The axes fontsize.

  • tfs (int, default=16) – The text fontsize.

  • lfs (int, default=8) – The labels fontsize.

  • sys_per_fig (int, default=100) – The number of systems to plot on each figure.

  • line_every (int, default=1) – The number of systems before a horizontal line is plotted.

  • max_figs (int, default=5) – The maximum number of figures to generate.

  • fig_size (tuple, default=(4,8)) – The figure size.

  • fig_lbrt (list[float], default=[0.1, 0.1, 0.9, 0.95]) – The positions of the (left, bottom, right, and top) margins of the plotting panel (all values must be between 0 and 1).

  • save_name_base (str, default='gallery') – The start of the file names for saving each figure.

  • save_fmt (str, default='png') – The file format for saving each figure (e.g., ‘png’, ‘pdf’, ‘eps’, ‘jpg’, etc.).

  • save_fig (bool, default=False) – Whether to save the figures. If True, will save each figure in the working directory with the file names given by save_name_base with an index appended.

Plot a gallery of systems from an observed catalog.

Filters, samples, and sorts the systems before plotting them using the function syssimpyplots.plot_catalogs.plot_figs_systems_gallery().

Parameters:
  • ss_per_sys (dict) – The dictionary containing the planetary and stellar properties for each system in an observed catalog (2-d and 1-d arrays). Can be a simulated catalog (i.e. returned by syssimpyplots.load_sims.compute_summary_stats_from_cat_obs()) or a Kepler catalog (i.e. returned by syssimpyplots.compare_kepler.compute_summary_stats_from_Kepler_catalog()).

  • sort_by ({'inner', 'multiplicity', 'stellar_mass'}, optional) – The property to sort the systems by. Default is None (no sorting).

  • n_min (int, default=3) – The minimum number of observed planets a system must have to be included.

  • n_max (int, default=20) – The maximum number of observed planets a system must have to be included.

  • llabel ({'multiplicity', 'stellar_mass'}, optional) – The property to left-label each system with. Default is None (no left-labels).

The remaining parameters are described in the documentation for the function syssimpyplots.plot_catalogs.plot_figs_systems_gallery().

Plot a gallery of systems from a physical catalog.

Filters, samples, and sorts the systems before plotting them using the function syssimpyplots.plot_catalogs.plot_figs_systems_gallery().

Parameters:
  • sssp_per_sys (dict) – The dictionary containing the planetary and stellar properties for each system in an physical catalog (2-d and 1-d arrays), such as one returned by syssimpyplots.load_sims.compute_summary_stats_from_cat_phys()).

  • sort_by ({'inner', 'multiplicity', 'stellar_mass'}, optional) – The property to sort the systems by. Default is None (no sorting).

  • n_min (int, default=3) – The minimum number of physical planets a system must have to be included.

  • n_max (int, default=20) – The maximum number of physical planets a system must have to be included.

  • n_det_min (int, default=1) – The minimum number of detected planets a system must have to be included.

  • n_det_max (int, default=10) – The maximum number of detected planets a system must have to be included.

  • color_by ({'k', 'size_order', 'cluster', 'mass', 'eccentricity', 'AMD'}) – The way in which the planets are colored.

  • llabel ({'multiplicity', 'stellar_mass'}, optional) – The property to left-label each system with.

  • mark_det (bool, default=True) – Whether to mark the detected and undetected planets separately.

The remaining parameters are described in the documentation for the function syssimpyplots.plot_catalogs.plot_figs_systems_gallery().

Note

The mark_det=True option requires the sssp_per_sys object to have been generated with load_full_tables=True and match_observed=True!