redback.result.MultiMessengerResult

class redback.result.MultiMessengerResult(*args: Any, **kwargs: Any)[source]

Bases: RedbackResult

Result class for joint multi-messenger analyses.

This preserves the standard bilby/RedbackResult posterior, evidence, and corner-plot behaviour while intentionally disabling helpers that require a single reconstructable transient.

__init__(label: str = 'no_label', outdir: str = '.', sampler: str = None, search_parameter_keys: list = None, fixed_parameter_keys: list = None, constraint_parameter_keys: list = None, priors: dict | bilby.core.prior.PriorDict = None, sampler_kwargs: dict = None, injection_parameters: dict = None, meta_data: dict = None, posterior: DataFrame = None, samples: DataFrame = None, nested_samples: DataFrame = None, log_evidence: float = nan, log_evidence_err: float = nan, information_gain: float = nan, log_noise_evidence: float = nan, log_bayes_factor: float = nan, log_likelihood_evaluations: ndarray = None, log_prior_evaluations: int = None, sampling_time: float = None, nburn: int = None, num_likelihood_evaluations: int = None, walkers: int = None, max_autocorrelation_time: float = None, use_ratio: bool = None, parameter_labels: list = None, parameter_labels_with_unit: list = None, version: str = None) None

Constructor for an extension of the regular bilby Result. This result adds the capability of utilising the plotting methods of the Transient such as plot_lightcurve. The class does this by reconstructing the Transient object that was used during the run by saving the required information in meta_data.

Parameters:
  • label (str, optional) – Labels of files produced by this class.

  • outdir (str, optional) – Output directory of the result. Default is the current directory.

  • sampler (str, optional) – The sampler used during the run.

  • search_parameter_keys (list, optional) – The parameters that were sampled in.

  • fixed_parameter_keys (list, optional) – Parameters that had a DeltaFunction prior

  • constraint_parameter_keys (list, optional) – Parameters that had a Constraint prior

  • priors (Union[dict, bilby.core.prior.PriorDict]) – Dictionary of priors.

  • sampler_kwargs (dict, optional) – Any keyword arguments passed to the sampling package.

  • injection_parameters (dict, optional) – True parameters if the dataset is simulated.

  • meta_data (dict, optional) – Additional dictionary. Contains the data used during the run and is used to reconstruct the Transient object used during the run.

  • posterior (pd.Dataframe, optional) – Posterior samples with log likelihood and log prior values.

  • samples (np.ndarray, optional) – An array of the output posterior samples.

  • nested_samples (np.ndarray, optional) – An array of the unweighted samples

  • log_evidence (float, optional) – The log evidence value if provided.

  • log_evidence_err (float, optional) – The log evidence error value if provided

  • information_gain (float, optional) – The information gain calculated.

  • log_noise_evidence (float, optional) – The log noise evidence.

  • log_bayes_factor (float, optional) – The log Bayes factor if we sampled using the likelihood ratio.

  • log_likelihood_evaluations (np.ndarray, optional) – The evaluations of the likelihood for each sample point

  • log_prior_evaluations (int, optional) – Number of log prior evaluations.

  • sampling_time (float, optional) – The time taken to complete the sampling in seconds.

  • nburn (int, optional) – The number of burn-in steps discarded for MCMC samplers

  • num_likelihood_evaluations (int, optional) – Number of total likelihood evaluations.

  • walkers (array_like, optional) – The samplers taken by an ensemble MCMC samplers.

  • max_autocorrelation_time (float, optional) – The estimated maximum autocorrelation time for MCMC samplers.

  • use_ratio (bool, optional) – A boolean stating whether the likelihood ratio, as opposed to the likelihood was used during sampling.

  • parameter_labels (list, optional) – List of the latex-formatted parameter labels.

  • parameter_labels_with_unit (list, optional) – List of the latex-formatted parameter labels with units.

  • version (str) – Version information for software used to generate the result. Note, this information is generated when the result object is initialized.

__call__(*args: Any, **kwargs: Any) Any

Call self as a function.

Methods

__init__([label, outdir, sampler, ...])

Constructor for an extension of the regular bilby Result.

plot_corner([parameters, priors, titles, ...])

Wrapper around bilby's plot_corner that applies smart title formatting.

plot_data(*args, **kwargs)

Reconstructs the transient and calls the specific plot_data method.

plot_lightcurve(*args, **kwargs)

Reconstructs the transient and calls the specific plot_lightcurve method. Detailed documentation appears below by running print(plot_lightcurve.__doc__) :param model: The model used to plot the lightcurve. :param filename: The output filename. Otherwise, use default which starts with the name attribute and ends with *lightcurve.png. :param axes: Axes to plot in if given. :param save: Whether to save the plot. :param show: Whether to show the plot. :param random_models: Number of random posterior samples plotted faintly. (Default value = 100) :param posterior: Posterior distribution to which to draw samples from. Is optional but must be given. :param outdir: Out directory in which to save the plot. Default is the current working directory. :param model_kwargs: Additional keyword arguments to be passed into the model. :param kwargs: Additional keyword arguments to pass in the Plotter methods. Available in the online documentation under at redback.plotting.Plotter.

plot_multiband(*args, **kwargs)

Reconstructs the transient and calls the specific plot_multiband method. Detailed documentation appears below by running print(plot_multiband.__doc__) :param figure: Figure can be given if defaults are not satisfying. :param axes: Axes can be given if defaults are not satisfying. :param filename: Name of the file to be plotted in. :param outdir: The directory in which to save the file in. :param save: Whether to save the plot. (Default value = True) :param show: Whether to show the plot. (Default value = True) :param ncols: Number of columns to use on the plot. Default is 2. :param nrows: Number of rows to use on the plot. If None are given this will be inferred from ncols and the number of filters. :param figsize: Size of the figure. A default based on ncols and nrows will be used if None is given. :param filters: Which bands to plot. Will use default filters if None is given. :param kwargs: Additional keyword arguments passed to the Plotter. All KwargsAccessorWithDefault attributes on redback.plotting.Plotter are accepted. Run redback.plotting.get_plotter_kwargs_docs() to see all options and defaults. :return: The axes.

plot_multiband_lightcurve(*args, **kwargs)

Reconstructs the transient and calls the specific plot_multiband_lightcurve method. Detailed documentation appears below by running print(plot_multiband_lightcurve.__doc__) :param model: The model used to plot the lightcurve. :param filename: The output filename. Otherwise, use default which starts with the name attribute and ends with *lightcurve.png. :param figure: Figure can be given if defaults are not satisfying. :param axes: Axes to plot in if given. :param save: Whether to save the plot. :param show: Whether to show the plot. :param random_models: Number of random posterior samples plotted faintly. (Default value = 100) :param posterior: Posterior distribution to which to draw samples from. Is optional but must be given. :param outdir: Out directory in which to save the plot. Default is the current working directory. :param model_kwargs: Additional keyword arguments to be passed into the model. :param kwargs: Additional keyword arguments to pass in the Plotter methods. Available in the online documentation under at redback.plotting.Plotter.

plot_residual(*args, **kwargs)

Reconstructs the transient and calls the specific plot_residual method. Detailed documentation appears below by running print(plot_residual.__doc__) :param model: The model used to plot the lightcurve. :param filename: The output filename. Otherwise, use default which starts with the name attribute and ends with *lightcurve.png. :param axes: Axes to plot in if given. :param save: Whether to save the plot. :param show: Whether to show the plot. :param posterior: Posterior distribution to which to draw samples from. Is optional but must be given. :param outdir: Out directory in which to save the plot. Default is the current working directory. :param model_kwargs: Additional keyword arguments to be passed into the model. :param kwargs: Additional keyword arguments to pass in the Plotter methods. Available in the online documentation under at redback.plotting.Plotter.

plot_spectrum(*args, **kwargs)

Reconstructs the transient and calls the specific plot_spectrum method. Detailed documentation appears below by running print(plot_spectrum.__doc__) :param model: The model used to plot the lightcurve. :param filename: The output filename. Otherwise, use default which starts with the name attribute and ends with *lightcurve.png. :param axes: Axes to plot in if given. :param save: Whether to save the plot. :param show: Whether to show the plot. :param random_models: Number of random posterior samples plotted faintly. (Default value = 100) :param posterior: Posterior distribution to which to draw samples from. Is optional but must be given. :param outdir: Out directory in which to save the plot. Default is the current working directory. :param model_kwargs: Additional keyword arguments to be passed into the model. :param kwargs: Additional keyword arguments to pass in the Plotter methods. Available in the online documentation under at redback.plotting.Plotter. print(Transient.plot_lightcurve.__doc__) to see all options! :return: The axes.

Attributes

transient

Reconstruct the transient used during sampling time using the metadata information.

plot_corner(parameters=None, priors=None, titles=True, save=True, filename=None, dpi=300, **kwargs)

Wrapper around bilby’s plot_corner that applies smart title formatting.

Titles are formatted in scientific notation when the median or uncertainties span many orders of magnitude (e.g. ek ~ 1e51 erg), and pick enough decimal places so that uncertainties are never displayed as 0.00.

All extra keyword arguments are forwarded to corner.corner via bilby. Useful ones:

Selecting and labelling parameters

Parameters:
  • parameters – List of parameter names to plot, or a dict mapping name -> label. e.g. parameters=['mej', 'vej'] or parameters={'mej': r'$M_{\rm ej}~(M_\odot)$', 'vej': r'$v_{\rm ej}$'}

  • labels – List of LaTeX labels, one per parameter (overrides names on axes). e.g. labels=[r'$M_{\rm ej}~(M_\odot)$', r'$f_{\rm Ni}$', ...]

  • priors – bilby PriorDict to overplot prior distributions on the 1-D marginals.

Font sizes

Parameters:
  • title_kwargs – Dict of kwargs passed to ax.set_title. e.g. title_kwargs={'fontsize': 20} (default fontsize is 16).

  • label_kwargs – Dict of kwargs passed to the axis label setters. e.g. label_kwargs={'fontsize': 20}

Smoothing and appearance

Parameters:
  • smooth – Gaussian smoothing sigma applied to the 2-D histograms. e.g. smooth=1.8 (no smoothing by default).

  • smooth1d – Gaussian smoothing sigma for the 1-D marginals.

  • bins – Number of histogram bins (default 50).

  • color – Colour of the contours and histograms. e.g. color='steelblue'

  • quantiles – Quantiles to mark on 1-D marginals, default [0.16, 0.84]. Pass quantiles=None to suppress vertical quantile lines and titles.

  • levels – Contour levels for 2-D panels, e.g. levels=[0.5, 0.9].

  • fill_contours – Whether to fill the 2-D contours (default True).

  • plot_datapoints – Whether to scatter raw samples (default False).

  • show_titles – Passed to corner; redback overrides this to apply smart formatting.

Saving

Parameters:
  • save – Whether to save the figure to disk (default True).

  • filename – Output filename. Defaults to <outdir>/<label>_corner.png.

  • dpi – Figure resolution (default 300).

Example:

result.plot_corner(
    parameters=['mej', 'f_nickel', 'kappa', 'vej', 'av_host'],
    labels=[r'$M_{\rm ej}~(M_\odot)$', r'$f_{\rm Ni}$',
            r'$\kappa$ (cm$^2$/g)', r'$v_{\rm ej}$ (km/s)',
            r'$A_{\rm v, host}$'],
    filename='my_corner.png',
    smooth=1.8,
    title_kwargs={'fontsize': 20},
    label_kwargs={'fontsize': 20},
)
plot_data(*args, **kwargs)[source]

Reconstructs the transient and calls the specific plot_data method. Detailed documentation appears below by running print(plot_data.__doc__) Plots the Transient data and returns Axes.

Parameters:
  • axes – Matplotlib axes to plot the lightcurve into. Useful for user specific modifications to the plot.

  • filename – Name of the file to be plotted in.

  • outdir – The directory in which to save the file in.

  • save – Whether to save the plot. (Default value = True)

  • show – Whether to show the plot. (Default value = True)

  • plot_others – Whether to plot inactive bands. (Default value = True)

  • color – Color of the data.

  • kwargs – Additional keyword arguments passed to the Plotter. All KwargsAccessorWithDefault attributes on redback.plotting.Plotter are accepted. Run redback.plotting.get_plotter_kwargs_docs() to see all options and defaults.

Returns:

The axes with the plot.

plot_lightcurve(*args, **kwargs)[source]

Reconstructs the transient and calls the specific plot_lightcurve method. Detailed documentation appears below by running print(plot_lightcurve.__doc__) :param model: The model used to plot the lightcurve. :param filename: The output filename. Otherwise, use default which starts with the name

attribute and ends with *lightcurve.png.

Parameters:
  • axes – Axes to plot in if given.

  • save – Whether to save the plot.

  • show – Whether to show the plot.

  • random_models – Number of random posterior samples plotted faintly. (Default value = 100)

  • posterior – Posterior distribution to which to draw samples from. Is optional but must be given.

  • outdir – Out directory in which to save the plot. Default is the current working directory.

  • model_kwargs – Additional keyword arguments to be passed into the model.

  • kwargs – Additional keyword arguments to pass in the Plotter methods.

Available in the online documentation under at redback.plotting.Plotter.

Keyword Arguments:
  • capsize – Same as matplotlib capsize.

  • bands_to_plot – List of bands to plot in plot lightcurve and multiband lightcurve. Default is active bands.

  • legend_location – Same as matplotlib legend location.

  • legend_cols – Same as matplotlib legend columns.

  • color – Color of the data points.

  • band_colors – A dictionary with the colors of the bands.

  • band_labels – List with the names of the bands.

  • band_scaling – Dict with the scaling for each band. First entry should be {type: ‘+’ or ‘x’} for different types.

  • dpi – Same as matplotlib dpi.

  • elinewidth – same as matplotlib elinewidth

  • errorbar_fmt – ‘fmt’ argument of ax.errorbar.

  • model – str or callable, the model to plot.

  • ms – Same as matplotlib markersize.

  • axis_tick_params_padpad argument in calls to ax.tick_params when setting the axes.

  • max_likelihood_alphaalpha argument, i.e. transparency, when plotting the max likelihood curve.

  • random_sample_alphaalpha argument, i.e. transparency, when plotting random sample curves.

  • uncertainty_band_alphaalpha argument, i.e. transparency, when plotting a credible band.

  • max_likelihood_color – Color of the maximum likelihood curve.

  • random_sample_color – Color of the random sample curves.

  • bbox_inches – Setting for saving plots. Default is ‘tight’.

  • linewidth – Same as matplotlib linewidth

  • zorder – Same as matplotlib zorder

  • xy – For `ax.annotate’ x and y coordinates of the point to annotate.

  • xycoords – The coordinate system xy is given in. Default is ‘axes fraction’

  • horizontalalignment – Horizontal alignment of the annotation. Default is ‘right’

  • annotation_sizesize argument of of ax.annotate.

  • fontsize_axes – Font size of the x and y labels.

  • fontsize_legend – Font size of the legend.

  • fontsize_figure – Font size of the figure. Relevant for multiband plots. Used on supxlabel and supylabel.

  • fontsize_ticks – Font size of the axis ticks.

  • hspace – Argument for subplots_adjust, sets horizontal spacing between panels.

  • wspace – Argument for subplots_adjust, sets horizontal spacing between panels.

  • plot_others – Whether to plot additional bands in the data plot, all in the same colors

  • random_models – Number of random draws to use to calculate credible bands or to plot.

  • uncertainty_mode – ‘random_models’: Plot random draws from the available parameter sets. ‘credible_intervals’: Plot a credible interval that is calculated based on the available parameter sets.

  • reference_mjd_date – Date to use as reference point for the x axis. Default is the first date in the data.

  • credible_interval_level – 0.9: Plot the 90% credible interval.

  • plot_max_likelihood – Plots the draw corresponding to the maximum likelihood. Default is ‘True’.

  • set_same_color_per_subplot – Sets the lightcurve to be the same color as the data per subplot. Default is ‘True’.

  • xlim_high_multiplier – Adjust the maximum xlim based on available x values.

  • xlim_low_multiplier – Adjust the minimum xlim based on available x values.

  • ylim_high_multiplier – Adjust the maximum ylim based on available x values.

  • ylim_low_multiplier – Adjust the minimum ylim based on available x values.

  • show_grid – Whether to show grid lines. Default is False.

  • grid_alpha – Transparency of grid lines. Default is 0.3.

  • grid_color – Color of grid lines. Default is ‘gray’.

  • grid_linestyle – Line style of grid lines. Default is ‘–‘.

  • grid_linewidth – Line width of grid lines. Default is 0.5.

  • save_format – Format for saving plots (e.g., ‘png’, ‘pdf’, ‘svg’, ‘eps’). Default is ‘png’.

  • transparent – Whether to save plots with transparent background. Default is False.

  • xscale – X-axis scale (‘linear’, ‘log’, ‘symlog’, ‘logit’). Default is None (auto-determined).

  • yscale – Y-axis scale (‘linear’, ‘log’, ‘symlog’, ‘logit’). Default is None (auto-determined).

  • title – Title for the plot. Default is None (no title).

  • title_fontsize – Font size for the title. Default is 20.

  • linestyle – Line style for model curves. Default is ‘-‘.

  • max_likelihood_linestyle – Line style for max likelihood curve. Default is ‘-‘.

  • random_sample_linestyle – Line style for random sample curves. Default is ‘-‘.

  • markerfillstyle – Fill style for markers (‘full’, ‘left’, ‘right’, ‘bottom’, ‘top’, ‘none’). Default is ‘full’.

  • markeredgecolor – Edge color for markers. Default is None (same as face color).

  • markeredgewidth – Edge width for markers. Default is 1.0.

  • legend_frameon – Whether to draw a frame around the legend. Default is True.

  • legend_shadow – Whether to draw a shadow behind the legend. Default is False.

  • legend_fancybox – Whether to use rounded corners for legend frame. Default is True.

  • legend_framealpha – Transparency of legend frame. Default is 0.8.

  • tick_direction – Direction of tick marks (‘in’, ‘out’, ‘inout’). Default is ‘in’.

  • tick_length – Length of tick marks. Default is None (matplotlib default).

  • tick_width – Width of tick marks. Default is None (matplotlib default).

  • show_spines – Whether to show plot spines (borders). Default is True.

  • spine_linewidth – Width of plot spines. Default is None (matplotlib default).

Returns:

The axes.

plot_multiband(*args, **kwargs)[source]

Reconstructs the transient and calls the specific plot_multiband method. Detailed documentation appears below by running print(plot_multiband.__doc__) :param figure: Figure can be given if defaults are not satisfying. :param axes: Axes can be given if defaults are not satisfying. :param filename: Name of the file to be plotted in. :param outdir: The directory in which to save the file in. :param save: Whether to save the plot. (Default value = True) :param show: Whether to show the plot. (Default value = True) :param ncols: Number of columns to use on the plot. Default is 2. :param nrows: Number of rows to use on the plot. If None are given this will

be inferred from ncols and the number of filters.

Parameters:
  • figsize – Size of the figure. A default based on ncols and nrows will be used if None is given.

  • filters – Which bands to plot. Will use default filters if None is given.

  • kwargs – Additional keyword arguments passed to the Plotter. All KwargsAccessorWithDefault attributes on redback.plotting.Plotter are accepted. Run redback.plotting.get_plotter_kwargs_docs() to see all options and defaults.

Returns:

The axes.

plot_multiband_lightcurve(*args, **kwargs)[source]

Reconstructs the transient and calls the specific plot_multiband_lightcurve method. Detailed documentation appears below by running print(plot_multiband_lightcurve.__doc__) :param model: The model used to plot the lightcurve. :param filename: The output filename. Otherwise, use default which starts with the name

attribute and ends with *lightcurve.png.

Parameters:
  • figure – Figure can be given if defaults are not satisfying.

  • axes – Axes to plot in if given.

  • save – Whether to save the plot.

  • show – Whether to show the plot.

  • random_models – Number of random posterior samples plotted faintly. (Default value = 100)

  • posterior – Posterior distribution to which to draw samples from. Is optional but must be given.

  • outdir – Out directory in which to save the plot. Default is the current working directory.

  • model_kwargs – Additional keyword arguments to be passed into the model.

  • kwargs – Additional keyword arguments to pass in the Plotter methods.

Available in the online documentation under at redback.plotting.Plotter.

Keyword Arguments:
  • capsize – Same as matplotlib capsize.

  • bands_to_plot – List of bands to plot in plot lightcurve and multiband lightcurve. Default is active bands.

  • legend_location – Same as matplotlib legend location.

  • legend_cols – Same as matplotlib legend columns.

  • color – Color of the data points.

  • band_colors – A dictionary with the colors of the bands.

  • band_labels – List with the names of the bands.

  • band_scaling – Dict with the scaling for each band. First entry should be {type: ‘+’ or ‘x’} for different types.

  • dpi – Same as matplotlib dpi.

  • elinewidth – same as matplotlib elinewidth

  • errorbar_fmt – ‘fmt’ argument of ax.errorbar.

  • model – str or callable, the model to plot.

  • ms – Same as matplotlib markersize.

  • axis_tick_params_padpad argument in calls to ax.tick_params when setting the axes.

  • max_likelihood_alphaalpha argument, i.e. transparency, when plotting the max likelihood curve.

  • random_sample_alphaalpha argument, i.e. transparency, when plotting random sample curves.

  • uncertainty_band_alphaalpha argument, i.e. transparency, when plotting a credible band.

  • max_likelihood_color – Color of the maximum likelihood curve.

  • random_sample_color – Color of the random sample curves.

  • bbox_inches – Setting for saving plots. Default is ‘tight’.

  • linewidth – Same as matplotlib linewidth

  • zorder – Same as matplotlib zorder

  • xy – For `ax.annotate’ x and y coordinates of the point to annotate.

  • xycoords – The coordinate system xy is given in. Default is ‘axes fraction’

  • horizontalalignment – Horizontal alignment of the annotation. Default is ‘right’

  • annotation_sizesize argument of of ax.annotate.

  • fontsize_axes – Font size of the x and y labels.

  • fontsize_legend – Font size of the legend.

  • fontsize_figure – Font size of the figure. Relevant for multiband plots. Used on supxlabel and supylabel.

  • fontsize_ticks – Font size of the axis ticks.

  • hspace – Argument for subplots_adjust, sets horizontal spacing between panels.

  • wspace – Argument for subplots_adjust, sets horizontal spacing between panels.

  • plot_others – Whether to plot additional bands in the data plot, all in the same colors

  • random_models – Number of random draws to use to calculate credible bands or to plot.

  • uncertainty_mode – ‘random_models’: Plot random draws from the available parameter sets. ‘credible_intervals’: Plot a credible interval that is calculated based on the available parameter sets.

  • reference_mjd_date – Date to use as reference point for the x axis. Default is the first date in the data.

  • credible_interval_level – 0.9: Plot the 90% credible interval.

  • plot_max_likelihood – Plots the draw corresponding to the maximum likelihood. Default is ‘True’.

  • set_same_color_per_subplot – Sets the lightcurve to be the same color as the data per subplot. Default is ‘True’.

  • xlim_high_multiplier – Adjust the maximum xlim based on available x values.

  • xlim_low_multiplier – Adjust the minimum xlim based on available x values.

  • ylim_high_multiplier – Adjust the maximum ylim based on available x values.

  • ylim_low_multiplier – Adjust the minimum ylim based on available x values.

  • show_grid – Whether to show grid lines. Default is False.

  • grid_alpha – Transparency of grid lines. Default is 0.3.

  • grid_color – Color of grid lines. Default is ‘gray’.

  • grid_linestyle – Line style of grid lines. Default is ‘–‘.

  • grid_linewidth – Line width of grid lines. Default is 0.5.

  • save_format – Format for saving plots (e.g., ‘png’, ‘pdf’, ‘svg’, ‘eps’). Default is ‘png’.

  • transparent – Whether to save plots with transparent background. Default is False.

  • xscale – X-axis scale (‘linear’, ‘log’, ‘symlog’, ‘logit’). Default is None (auto-determined).

  • yscale – Y-axis scale (‘linear’, ‘log’, ‘symlog’, ‘logit’). Default is None (auto-determined).

  • title – Title for the plot. Default is None (no title).

  • title_fontsize – Font size for the title. Default is 20.

  • linestyle – Line style for model curves. Default is ‘-‘.

  • max_likelihood_linestyle – Line style for max likelihood curve. Default is ‘-‘.

  • random_sample_linestyle – Line style for random sample curves. Default is ‘-‘.

  • markerfillstyle – Fill style for markers (‘full’, ‘left’, ‘right’, ‘bottom’, ‘top’, ‘none’). Default is ‘full’.

  • markeredgecolor – Edge color for markers. Default is None (same as face color).

  • markeredgewidth – Edge width for markers. Default is 1.0.

  • legend_frameon – Whether to draw a frame around the legend. Default is True.

  • legend_shadow – Whether to draw a shadow behind the legend. Default is False.

  • legend_fancybox – Whether to use rounded corners for legend frame. Default is True.

  • legend_framealpha – Transparency of legend frame. Default is 0.8.

  • tick_direction – Direction of tick marks (‘in’, ‘out’, ‘inout’). Default is ‘in’.

  • tick_length – Length of tick marks. Default is None (matplotlib default).

  • tick_width – Width of tick marks. Default is None (matplotlib default).

  • show_spines – Whether to show plot spines (borders). Default is True.

  • spine_linewidth – Width of plot spines. Default is None (matplotlib default).

Returns:

The axes.

plot_residual(*args, **kwargs)[source]

Reconstructs the transient and calls the specific plot_residual method. Detailed documentation appears below by running print(plot_residual.__doc__) :param model: The model used to plot the lightcurve. :param filename: The output filename. Otherwise, use default which starts with the name

attribute and ends with *lightcurve.png.

Parameters:
  • axes – Axes to plot in if given.

  • save – Whether to save the plot.

  • show – Whether to show the plot.

  • posterior – Posterior distribution to which to draw samples from. Is optional but must be given.

  • outdir – Out directory in which to save the plot. Default is the current working directory.

  • model_kwargs – Additional keyword arguments to be passed into the model.

  • kwargs – Additional keyword arguments to pass in the Plotter methods.

Available in the online documentation under at redback.plotting.Plotter.

Keyword Arguments:
  • capsize – Same as matplotlib capsize.

  • bands_to_plot – List of bands to plot in plot lightcurve and multiband lightcurve. Default is active bands.

  • legend_location – Same as matplotlib legend location.

  • legend_cols – Same as matplotlib legend columns.

  • color – Color of the data points.

  • band_colors – A dictionary with the colors of the bands.

  • band_labels – List with the names of the bands.

  • band_scaling – Dict with the scaling for each band. First entry should be {type: ‘+’ or ‘x’} for different types.

  • dpi – Same as matplotlib dpi.

  • elinewidth – same as matplotlib elinewidth

  • errorbar_fmt – ‘fmt’ argument of ax.errorbar.

  • model – str or callable, the model to plot.

  • ms – Same as matplotlib markersize.

  • axis_tick_params_padpad argument in calls to ax.tick_params when setting the axes.

  • max_likelihood_alphaalpha argument, i.e. transparency, when plotting the max likelihood curve.

  • random_sample_alphaalpha argument, i.e. transparency, when plotting random sample curves.

  • uncertainty_band_alphaalpha argument, i.e. transparency, when plotting a credible band.

  • max_likelihood_color – Color of the maximum likelihood curve.

  • random_sample_color – Color of the random sample curves.

  • bbox_inches – Setting for saving plots. Default is ‘tight’.

  • linewidth – Same as matplotlib linewidth

  • zorder – Same as matplotlib zorder

  • xy – For `ax.annotate’ x and y coordinates of the point to annotate.

  • xycoords – The coordinate system xy is given in. Default is ‘axes fraction’

  • horizontalalignment – Horizontal alignment of the annotation. Default is ‘right’

  • annotation_sizesize argument of of ax.annotate.

  • fontsize_axes – Font size of the x and y labels.

  • fontsize_legend – Font size of the legend.

  • fontsize_figure – Font size of the figure. Relevant for multiband plots. Used on supxlabel and supylabel.

  • fontsize_ticks – Font size of the axis ticks.

  • hspace – Argument for subplots_adjust, sets horizontal spacing between panels.

  • wspace – Argument for subplots_adjust, sets horizontal spacing between panels.

  • plot_others – Whether to plot additional bands in the data plot, all in the same colors

  • random_models – Number of random draws to use to calculate credible bands or to plot.

  • uncertainty_mode – ‘random_models’: Plot random draws from the available parameter sets. ‘credible_intervals’: Plot a credible interval that is calculated based on the available parameter sets.

  • reference_mjd_date – Date to use as reference point for the x axis. Default is the first date in the data.

  • credible_interval_level – 0.9: Plot the 90% credible interval.

  • plot_max_likelihood – Plots the draw corresponding to the maximum likelihood. Default is ‘True’.

  • set_same_color_per_subplot – Sets the lightcurve to be the same color as the data per subplot. Default is ‘True’.

  • xlim_high_multiplier – Adjust the maximum xlim based on available x values.

  • xlim_low_multiplier – Adjust the minimum xlim based on available x values.

  • ylim_high_multiplier – Adjust the maximum ylim based on available x values.

  • ylim_low_multiplier – Adjust the minimum ylim based on available x values.

  • show_grid – Whether to show grid lines. Default is False.

  • grid_alpha – Transparency of grid lines. Default is 0.3.

  • grid_color – Color of grid lines. Default is ‘gray’.

  • grid_linestyle – Line style of grid lines. Default is ‘–‘.

  • grid_linewidth – Line width of grid lines. Default is 0.5.

  • save_format – Format for saving plots (e.g., ‘png’, ‘pdf’, ‘svg’, ‘eps’). Default is ‘png’.

  • transparent – Whether to save plots with transparent background. Default is False.

  • xscale – X-axis scale (‘linear’, ‘log’, ‘symlog’, ‘logit’). Default is None (auto-determined).

  • yscale – Y-axis scale (‘linear’, ‘log’, ‘symlog’, ‘logit’). Default is None (auto-determined).

  • title – Title for the plot. Default is None (no title).

  • title_fontsize – Font size for the title. Default is 20.

  • linestyle – Line style for model curves. Default is ‘-‘.

  • max_likelihood_linestyle – Line style for max likelihood curve. Default is ‘-‘.

  • random_sample_linestyle – Line style for random sample curves. Default is ‘-‘.

  • markerfillstyle – Fill style for markers (‘full’, ‘left’, ‘right’, ‘bottom’, ‘top’, ‘none’). Default is ‘full’.

  • markeredgecolor – Edge color for markers. Default is None (same as face color).

  • markeredgewidth – Edge width for markers. Default is 1.0.

  • legend_frameon – Whether to draw a frame around the legend. Default is True.

  • legend_shadow – Whether to draw a shadow behind the legend. Default is False.

  • legend_fancybox – Whether to use rounded corners for legend frame. Default is True.

  • legend_framealpha – Transparency of legend frame. Default is 0.8.

  • tick_direction – Direction of tick marks (‘in’, ‘out’, ‘inout’). Default is ‘in’.

  • tick_length – Length of tick marks. Default is None (matplotlib default).

  • tick_width – Width of tick marks. Default is None (matplotlib default).

  • show_spines – Whether to show plot spines (borders). Default is True.

  • spine_linewidth – Width of plot spines. Default is None (matplotlib default).

Returns:

The axes.

plot_spectrum(*args, **kwargs)[source]

Reconstructs the transient and calls the specific plot_spectrum method. Detailed documentation appears below by running print(plot_spectrum.__doc__) :param model: The model used to plot the lightcurve. :param filename: The output filename. Otherwise, use default which starts with the name

attribute and ends with *lightcurve.png.

Parameters:
  • axes – Axes to plot in if given.

  • save – Whether to save the plot.

  • show – Whether to show the plot.

  • random_models – Number of random posterior samples plotted faintly. (Default value = 100)

  • posterior – Posterior distribution to which to draw samples from. Is optional but must be given.

  • outdir – Out directory in which to save the plot. Default is the current working directory.

  • model_kwargs – Additional keyword arguments to be passed into the model.

  • kwargs – Additional keyword arguments to pass in the Plotter methods.

Available in the online documentation under at redback.plotting.Plotter. print(Transient.plot_lightcurve.__doc__) to see all options! :return: The axes.

property transient

Reconstruct the transient used during sampling time using the metadata information.

Returns:

The reconstructed Transient.

Return type:

redback.transient.transient.Transient