plot_catalogs.py

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(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_size=(8, 4), 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, default=(8,4)) – The figure size (width, height).

  • 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=0.0, 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_sim=[1], alpha_Kep=[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, default=0.) – 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 or list[float], default=1) – A list of line widths for the histograms (of simulated data).

  • alpha_sim (list[float], default=[1]) – A list of transparencies of the lines for the histograms of simulated data (between 0 and 1).

  • alpha_Kep (list[float], default=[0.2]) – A list of transparencies 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(x_sim, x_Kep, x_min=None, x_max=None, y_min=0.0, 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_sim=[1], alpha_Kep=[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_size=(8, 4), 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, default=(8,4)) – The figure size (width, height).

  • 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_credible(ax, x_sim_all, x_Kep, x_min=None, x_max=None, y_min=0.0, y_max=None, n_bins=100, step='mid', qtls=[0.16, 0.5, 0.84], plot_median=False, normalize=True, N_sim_Kep_factor=1.0, log_x=False, log_y=False, c_sim_all=['k'], c_Kep=['k'], ls_sim_all=['--'], ls_Kep=['-'], lw=1, alpha_all=[0.2], labels_sim_all=None, labels_Kep=['Kepler'], extra_text=None, xticks_custom=None, xlabel_text='x', ylabel_text='Fraction', afs=20, tfs=20, lfs=16, legend=False)

Plot credible regions for the histograms of continuous distributions on a given panel.

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

  • x_sim_all (list[list[array[float]]]) – The list of lists with sample(s) of values (e.g. simulated data). Each inner list is for a given model, and should contain enough samples (e.g. ~100) to compute reliable credible regions.

  • x_Kep (list[array[float]]) – A list with sample(s) of values (e.g. Kepler data). Each sample in this list will be plotted as a histogram.

  • x_min (float, optional) – The minimum value to include. All histograms will share this value for the minimum bin edge.

  • x_max (float, optional) – The maximum value to include. All histograms will share this value for the maximum bin edge.

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

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

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

  • step ({'mid', 'pre', 'post', None}) – The position to draw the steps for the credible regions of the histograms. Default is ‘mid’, but can also be set to ‘None’ if want to draw smooth curves.

  • qtls (list[float], default=[0.16,0.5,0.84]) – The quantiles for the credible regions of the histograms.

  • plot_median (bool, default=False) – Whether to plot the medians of the histograms in x_sim_all.

  • 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 each sample in x_sim_all 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_all (list[str], default=['k']) – A list of plotting colors for each set of lists in x_sim_all.

  • c_Kep (list[str], default=['k']) – A list of plotting colors for the histograms of each sample in x_Kep.

  • ls_sim_all (list[str], default=['--']) – A list of line styles for the median histograms of each set of lists in x_sim_all.

  • ls_Kep (list[str], default=['-']) – A list of line styles for the histograms of each sample in x_Kep.

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

  • alpha_all (list[float], default=[0.2]) – A list of transparency values (between 0 and 1) for the credible regions of each set of lists in x_sim_all.

  • labels_sim_all (list[str], optional) – A list of labels for each set of lists in x_sim_all.

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

  • 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_credible(x_sim_all, x_Kep, x_min=None, x_max=None, y_min=0.0, y_max=None, n_bins=100, step='mid', qtls=[0.16, 0.5, 0.84], plot_median=False, normalize=True, N_sim_Kep_factor=1.0, log_x=False, log_y=False, c_sim_all=['k'], c_Kep=['k'], ls_sim_all=['--'], ls_Kep=['-'], lw=1, alpha_all=[0.2], labels_sim_all=None, labels_Kep=['Kepler'], extra_text=None, xticks_custom=None, xlabel_text='x', ylabel_text='Fraction', afs=20, tfs=20, lfs=16, legend=False, fig_size=(8, 4), fig_lbrt=[0.15, 0.2, 0.95, 0.925], save_name='no_name_fig.pdf', save_fig=False)

Plot a figure with credible regions of the histograms of continuous distributions.

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

Parameters:
  • fig_size (tuple, default=(8,4)) – The figure size (width, height).

  • 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 lower x-axis limit.

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

  • 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(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_size=(8, 4), 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, default=(8,4)) – The figure size (width, height).

  • 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_credible(ax, x_sim_all, x_Kep, x_min=None, x_max=None, y_min=0.0, y_max=1.0, log_x=False, eval_cdf_all_points=False, n_bins_cdf=100, qtls=[0.16, 0.5, 0.84], plot_median=False, c_sim_all=['k'], c_Kep=['k'], ls_sim_all=['--'], ls_Kep=['-'], lw=1, alpha_all=[0.2], labels_sim_all=None, 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)

Compute and plot the credible region of multiple cumulative distribution functions (CDFs) for continuous distributions on a given panel.

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

  • x_sim_all (list[list[array[float]]]) – The list of lists with sample(s) of values (e.g. simulated data). Each inner list is for a given model, and should contain enough samples (e.g. ~100) to compute reliable credible regions.

  • x_Kep (list[array[float]]) – A list with sample(s) of values (e.g. Kepler data). Each sample in this list will be plotted as a CDF.

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

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

  • 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.

  • eval_cdf_all_points (bool, default=False) – Whether to evaluate the credible region of the CDFs at all points. If False, will just evaluate the credible region at a number of points (n_bins_cdf) on a linear/log-linear (for log_x = False/True) scale. WARNING: if True, will take a long time if there are many points in each sample (and this is likely overkill). The recommended option is to keep this False.

  • n_bins_cdf (int, default=100) – The number of points to evaluate the credible region of the CDFs at, if eval_cdf_all_points=False.

  • qtls (list[float], default=[0.16,0.5,0.84]) – The quantiles for the credible regions of the CDFs.

  • plot_median (bool, default=False) – Whether to plot the medians of the CDFs in x_sim_all.

  • c_sim_all (list[str], default=['k']) – A list of plotting colors for the credible region of each set of lists in x_sim_all.

  • c_Kep (list[str], default=['k']) – A list of plotting colors for the CDFs of each sample in x_Kep.

  • ls_sim_all (list[str], default=['--']) – The line styles for the median CDFs of each set of lists in x_sim_all.

  • ls_Kep (list[str], default=['-']) – A list of line styles for the CDFs of each sample in x_Kep.

  • lw (float, default=1) – The line width for the CDFs of each sample in x_Kep.

  • alpha_all (list[float], default=[0.2]) – A list of transparency values (between 0 and 1) for the credible regions of the CDFs for each set of lists in x_sim_all.

  • labels_sim_all (list[str], optional) – A list of labels for each set of lists in x_sim_all.

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

  • 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.

plot_fig_cdf_credible(x_sim_all, x_Kep, x_min=None, x_max=None, y_min=0.0, y_max=1.0, log_x=False, eval_cdf_all_points=False, n_bins_cdf=100, qtls=[0.16, 0.5, 0.84], plot_median=False, c_sim_all=['k'], c_Kep=['k'], ls_sim_all=['--'], ls_Kep=['-'], lw=1, alpha_all=[0.2], labels_sim_all=None, 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, fig_size=(8, 4), fig_lbrt=[0.15, 0.2, 0.95, 0.925], save_name='no_name_fig.pdf', save_fig=False)

Plot a figure with credible regions of the CDFs of continuous distributions.

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

Parameters:
  • fig_size (tuple, default=(8,4)) – The figure size (width, height).

  • 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(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_size=(8, 4), 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 (list[array[float]] or 2-d array[float]) – The properties of the planets in each system to plot on the x-axis. This can be a list of 1-d arrays, or a 2-d array (where each row is a separate system, potentially with padded values), typically of the orbital period (days).

  • s_per_sys (list[array[float]] or 2-d 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 can be a list of 1-d arrays, or a 2-d array (where each row is a separate system, potentially with padded values), 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.

  • alpha (float or list/array[float], optional) – The transparency of the points, between 0 (transparent) and 1 (opaque). Can be a 1-d list/array to assign a different alpha to each system.

  • 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 left-labeling each system.

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

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

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

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

  • rlabel_fmt (str, optional) – The string formatting of the right-labels in rlabel_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.

  • cmap (str or colormap, default='inferno') – The colormap to use for coloring the planets. Only used if color_by=’custom’ and colors_per_sys is provided.

  • vmin (float, optional) – The minimum value to map to the colormap. Only used if color_by=’custom’ and colors_per_sys is provided.

  • vmax (float, optional) – The maximum value to map to the colormap. Only used if color_by=’custom’ and colors_per_sys is provided.

  • cbar_label (str, default=r'Colorscale units') – The colorbar label. Only used if color_by=’custom’ and colors_per_sys is provided.

  • cbar_lbrt (list[float], default=[0.1, 0.95, 0.9, 0.98]) – The positions of the (left, bottom, right, and top) margins of the colorbar panel (all values must be between 0 and 1). Only used if color_by=’custom’ and colors_per_sys is provided; make sure this does not overlap with fig_lbrt!

  • 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). If a colorbar will also be shown, make sure this does not overlap with cbar_lbrt!

  • 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 a 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!

measure_and_plot_radius_valley_depth_using_global_bins(radii_sample, radius_valley_bounds=(1.8, 2.2), x_min=0.5, x_max=5.5, n_bins=100, fractional_depth=True, xlabel_text='Planet radius, $R_p$ [$R_\\oplus$]', verbose=False, plot_fig=False, save_name='no_name_fig.pdf', save_fig=False)

Create a histogram of a sample of planet radii and compute the “depth” of the radius valley.

The “depth” of the radius valley is defined as the difference between the minimum value of the bins within ‘radius_valley_bounds’ and the minimum of the maximum values of the bins on each side of the valley.

Parameters:
  • radii_sample (array[float]) – The sample of planet radii (in Earth radii).

  • radius_valley_bounds ((float,float), default=(1.8,2.2)) – The bounds for planet radii considered to be within the “radius valley” (in Earth radii).

  • x_min (float, default=0.5) – The minimum planet radius to include (in Earth radii).

  • x_max (float, default=5.5) – The maximum planet radius to include (in Earth radii).

  • n_bins (int, default=100) – The number of bins to use between x_min and x_max.

  • fractional_depth (bool, default=True) – Whether to compute the fractional depth (i.e. the depth as a fraction of the minimum of the maximum bins on either side; the max value of 1 means the valley drops to zero). Note that this can be negative if the “valley” is actually higher than one of peaks.

  • xlabel_text (str, default=r'Planet radius, $R_p$ [$R_oplus$]') – The text for the x-axis label.

  • verbose (bool, default=False) – Whether to print the computed values.

  • plot_fig (bool, default=False) – Whether to also plot the histogram and the depth of the radius valley. If True, will call syssimpyplots.plot_catalogs.plot_fig_pdf_simple().

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

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

Returns:

depth – The “depth” of the radius valley. This should be a positive value; if negative, it means that the radius “valley” is actually a peak (more precisely, it is higher than at least one of the peaks on the two sides)!

Return type:

float

measure_and_plot_radius_valley_depth_using_kde(radii_sample, radius_valley_bounds=(1.8, 2.2), x_min=0.5, x_max=5.5, n_bins=100, bw='Scotts', bw_scotts_factor=1.0, fractional_depth=True, xlabel_text='Planet radius, $R_p$ [$R_\\oplus$]', verbose=False, plot_fig=False, ax=None, legend=True, save_name='no_name_fig.pdf', save_fig=False)

Fit a KDE to a sample of planet radii and compute the “depth” of the radius valley.

Same as measure_and_plot_radius_valley_depth_using_global_bins() except the bins are replaced by a KDE.

Parameters:
  • radii_sample (array[float]) – The sample of planet radii (in Earth radii).

  • radius_valley_bounds ((float,float), default=(1.8,2.2)) – The bounds for planet radii considered to be within the “radius valley” (in Earth radii).

  • x_min (float, default=0.5) – The minimum planet radius to include (in Earth radii).

  • x_max (float, default=5.5) – The maximum planet radius to include (in Earth radii).

  • n_bins (int, default=100) – The number of bins to use between x_min and x_max, for plotting purposes.

  • bw ({float, 'Scotts'}, default='Scotts') – The bandwidth or method for computing the bandwidth. If ‘Scotts’, will compute the bandwidth using Scott’s rule, which is ‘n^(-1/5)’ where ‘n’ is the number of data points.

  • bw_scotts_factor (float, default=1.) – The factor to multiply the bandwidth from Scott’s rule. Only used if bw=’Scotts’.

  • fractional_depth (bool, default=True) – Whether to compute the fractional depth (i.e. the depth as a fraction of the minimum of the maximum on either side; the max value of 1 means the valley drops to zero). Note that this can be negative if the “valley” is actually higher than one of peaks.

  • xlabel_text (str, default=r'Planet radius, $R_p$ [$R_oplus$]') – The text for the x-axis label.

  • verbose (bool, default=False) – Whether to print the computed values.

  • plot_fig (bool, default=False) – Whether to also plot the histogram and the depth of the radius valley. If True, will call syssimpyplots.plot_catalogs.plot_fig_pdf_simple().

  • ax (matplotlib.axes._subplots.AxesSubplot, optional) – The plotting axes for the figure.

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

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

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

Returns:

depth – The “depth” of the radius valley. This should be a positive value; if negative, it means that the radius “valley” is actually a peak (more precisely, it is higher than at least one of the peaks on the two sides)!

Return type:

float

measure_and_plot_radius_valley_depth_using_two_kdes(radii_sample, radius_valley_bounds=(1.8, 2.2), x_min=0.5, x_max=5.5, n_bins=100, bw_low='Scotts', bw_high='Scotts', bw_low_scotts_factor=0.25, bw_high_scotts_factor=2.0, fractional_depth=True, xlabel_text='Planet radius, $R_p$ [$R_\\oplus$]', verbose=False, plot_fig=False, save_name='no_name_fig.pdf', save_fig=False)

Fit two KDEs (a low bandwith and a high bandwidth) to a sample of planet radii and compute the “depth” of the radius valley.

The “depth” of the radius valley is defined as the difference between the KDEs, at the location of the minimum of the KDE with the low bandwidth, within ‘radius_valley_bounds’.

Parameters:
  • radii_sample (array[float]) – The sample of planet radii (in Earth radii).

  • radius_valley_bounds ((float,float), default=(1.8,2.2)) – The bounds for planet radii considered to be within the “radius valley” (in Earth radii).

  • x_min (float, default=0.5) – The minimum planet radius to include (in Earth radii).

  • x_max (float, default=5.5) – The maximum planet radius to include (in Earth radii).

  • n_bins (int, default=100) – The number of bins to use between x_min and x_max, for plotting purposes.

  • bw_low ({float, 'Scotts'}, default='Scotts') – The bandwidth or method for computing the bandwidth, for the low-bandwidth KDE. If ‘Scotts’, will compute the bandwidth using Scott’s rule, which is ‘n^(-1/5)’ where ‘n’ is the number of data points.

  • bw_high ({float, 'Scotts'}, default='Scotts') – The bandwidth or method for computing the bandwidth, for the high-bandwidth KDE.

  • bw_low_scotts_factor (float, default=0.25) – The factor to multiply the bandwidth from Scott’s rule for the low-bandwidth KDE. Only used if bw_low=’Scotts’.

  • bw_high_scotts_factor (float, default=2.) – The factor to multiply the bandwidth from Scott’s rule for the high-bandwidth KDE. Only used if bw_high=’Scotts’.

  • fractional_depth (bool, default=True) – Whether to compute the fractional depth (i.e. the depth as a fraction of the minimum of the maximum on either side; the max value of 1 means the valley drops to zero). Note that this can be negative if the “valley” is actually higher than one of peaks.

  • xlabel_text (str, default=r'Planet radius, $R_p$ [$R_oplus$]') – The text for the x-axis label.

  • verbose (bool, default=False) – Whether to print the computed values.

  • plot_fig (bool, default=False) – Whether to also plot the histogram and the depth of the radius valley. If True, will call syssimpyplots.plot_catalogs.plot_fig_pdf_simple().

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

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

Returns:

depth – The “depth” of the radius valley. This should be a positive value; if negative, it means that the radius “valley” is actually a peak!

Return type:

float

Note

This method of measuring the depth does not work as well as using a single KDE; instead, the use of syssimpyplots.plot_catalogs.measure_and_plot_radius_valley_depth_using_kde() is recommended.

fit_and_plot_radius_cliff_using_kde(radii_sample, x_min=0.5, x_max=5.5, x_min_cliff=2.5, x_max_cliff=5.5, n_bins=100, bw='Scotts', bw_scotts_factor=1.0, xlabel_text='Planet radius, $R_p$ [$R_\\oplus$]', verbose=False, plot_fig=False, ax=None, legend=True, save_name='no_name_fig.pdf', save_fig=False)

Fit a line to the observed frequency of planets as a function of planet radius, within the bounds given for measuring the “radius cliff”. The observed frequency of planets is estimated by a KDE fit to the sample of planet radii (in log10 scale).

Parameters:
  • radii_sample (array[float]) – The sample of planet radii (in Earth radii).

  • radius_valley_bounds ((float,float), default=(1.8,2.2)) – The bounds for planet radii considered to be within the “radius valley” (in Earth radii).

  • x_min (float, default=0.5) – The minimum planet radius to plot (in Earth radii).

  • x_max (float, default=5.5) – The maximum planet radius to plot (in Earth radii).

  • x_min_cliff (float, default=2.5) – The minimum planet radius to include in the radius cliff (in Earth radii). Must be no less than x_min.

  • x_max_cliff (float, default=5.5) – The maximum planet radius to include in the radius cliff (in Earth radii). Must be no more than x_max.

  • n_bins (int, default=100) – The number of bins to use between x_min and x_max, for plotting purposes.

  • bw ({float, 'Scotts'}, default='Scotts') – The bandwidth or method for computing the bandwidth. If ‘Scotts’, will compute the bandwidth using Scott’s rule, which is ‘n^(-1/5)’ where ‘n’ is the number of data points.

  • bw_scotts_factor (float, default=1.) – The factor to multiply the bandwidth from Scott’s rule. Only used if bw=’Scotts’.

  • xlabel_text (str, default=r'Planet radius, $R_p$ [$R_oplus$]') – The text for the x-axis label.

  • verbose (bool, default=False) – Whether to print the computed values.

  • plot_fig (bool, default=False) – Whether to also plot the histogram and the depth of the radius valley. If True, will call syssimpyplots.plot_catalogs.plot_fig_pdf_simple().

  • ax (matplotlib.axes._subplots.AxesSubplot, optional) – The plotting axes for the figure.

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

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

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

Returns:

depth – The “depth” of the radius valley. This should be a positive value; if negative, it means that the radius “valley” is actually a peak (more precisely, it is higher than at least one of the peaks on the two sides)!

Return type:

float