Cockpit Plotter

class cockpit.CockpitPlotter(secondary_screen=False)[source]

Cockpit Plotter Class.

Initialize the cockpit plotter.

Parameters

secondary_screen (bool) – Whether to plot other experimental quantities on a secondary screen.

plot(source, show_plot=True, block=False, save_plot=False, savedir=None, savename='cockpit', savename_append=None, savefig_kwargs=None, show_log_iter=False, discard=None, plot_title=None, debug=False)[source]

Plot the cockpit for the current state of the log file.

Parameters
  • source (Cockpit or str) – Cockpit instance, or string containing the path to a .json log produced with Cockpit.write, where information will be fetched from.

  • show_plot (bool, optional) – Whether the plot should be shown on screen. Defaults to True.

  • block (bool, optional) – Whether the halt the computation after blocking or not. Defaults to False.

  • save_plot (bool, optional) – Whether the plot should be saved to disk. Defaults to False.

  • savedir (str, optional) – Directory where to save the plot.

  • savename (str, optional) – Filename of the saved plot.

  • savename_append (str, optional) – Optional appendix to the savefile name. Defaults to None.

  • savefig_kwargs (dict, optional) – Additional keyword arguments that are passed to fig.savefig such as fileformat or dpi.

  • show_log_iter (bool, optional) – Whether the instruments should use a log scale for the iterations. Defaults to False.

  • discard (int, optional) – Global step after which information should be discarded.

  • plot_title (str, optional) – Cockpit’s plot title. Defauts to None. In this case Cockpit tries to infer the optimizer/problem/etc. from the logpath and show it as the title. Which can be manually overwritten with by passing this string.

  • debug (bool, optional) – Enable debug mode.. Defaults to False.

Raises

ValueError – Raises ValueError if source is a Cockpit instance, but no savedir is given.