API Reference

Functions

notutils.display_url(target: str) None[source]

Display a URL in a Jupyter notebook to allow the user to click and check on information.

With thanks to Fernando Perez for putting together the implementation!

Parameters:

target (str) – The URL to display

notutils.iframe_url(target: str, width: int = 500, height: int = 400, scrolling: bool = True, border: int = 0, frameborder: int = 0) str[source]

Produce an iframe for displaying an item in HTML window.

Parameters:
  • target (str) – The target URL

  • width (int) – The width of the iframe (default 500)

  • height (int) – The height of the iframe (default 400)

  • scrolling (bool) – Whether or not to allow scrolling (default True)

  • border (int) – Width of the border

  • frameborder (int) – Width of the frameborder

Returns:

HTML iframe string

Return type:

str

notutils.display_iframe_url(target: str, **kwargs: Any) None[source]

Display the contents of a URL in an IPython notebook.

Parameters:

target (str) – The target URL

See also

iframe_url() for additional arguments.

notutils.display_google_book(id: str, page: int | str | None = None, width: int = 600, height: int = 450, **kwargs: Any) None[source]

Display an embedded version of a Google book.

Parameters:
  • id (str) – The ID of the Google book to display

  • page (str or int, optional) – The start page for the book

  • width (int) – The width of the embedded book (default 600)

  • height (int) – The height of the embedded book (default 450)

notutils.code_toggle(start_show: bool = False, message: str | None = None) None[source]

Toggle code visibility on and off in a notebook.

The tip that this idea is based on is from Damian Kao (http://blog.nextgenetics.net/?e=102).

Parameters:
  • start_show (bool) – Whether to display the code or not on first load (default False)

  • message (str, optional) – The message used to toggle display of the code

notutils.display_prediction(basis: Callable | Dict[str, Callable], num_basis: int = 4, wlim: Tuple[float, float] = (-1.0, 1.0), fig: Any | None = None, ax: Any | None = None, xlim: Tuple[float, float] | None = None, ylim: Tuple[float, float] | None = None, num_points: int = 1000, offset: float = 0.0, **kwargs: Any) None[source]

Interactive widget for displaying a prediction function based on summing separate basis functions.

Parameters:
  • basis (callable or dict) – A function handle that calls the basis functions

  • num_basis (int) – Number of basis functions to use (default 4)

  • wlim (tuple of float) – Limits for the basis function weights (default (-1.0, 1.0))

  • fig (matplotlib.figure.Figure, optional) – Matplotlib figure object (optional)

  • ax (matplotlib.axes.Axes, optional) – Matplotlib axes object (optional)

  • xlim (tuple of float, optional) – Limits of the x axis to use (optional)

  • ylim (tuple of float, optional) – Limits of the y axis to use (optional)

  • num_points (int) – Number of points to plot (default 1000)

  • offset (float) – Offset for the first basis function (default 0.0)

notutils.display_plots(filebase: str, directory: str | None = None, width: int = 600, height: int = 450, **kwargs: Any) None[source]

Display a series of plots controlled by sliders.

The function relies on Python string format functionality to index through a series of plots.

Parameters:
  • filebase (str) – Base filename with format placeholders for indexing

  • directory (str, optional) – Directory containing the plot files (optional)

  • width (int) – Width of the displayed plots (default 600)

  • height (int) – Height of the displayed plots (default 450)