hispecdrp.utils.notebook_display

Helpers for displaying large local HTML products inside Jupyter / VS Code notebooks.

Functions

_ensure_directory_server(directory)

Start (or reuse) a localhost static file server rooted at directory.

_pick_free_port()

display_html_file(path, *[, height, width])

Embed a local HTML file in a notebook output cell via a localhost iframe.

display_html_file(path, *, height=900, width='100%')[source]

Embed a local HTML file in a notebook output cell via a localhost iframe.

IPython.display.HTML(open(path).read()) does not work well for HISPEC stellar-RV previews: they are full HTML documents (often hundreds of MB with Plotly), and notebook frontends sanitize / drop nested <html> / <script> content. Serving the file over http://127.0.0.1 and embedding an iframe keeps scripts executable without stuffing the file into the notebook JSON.

Parameters:
  • path (str) – Absolute or relative path to a .html file on disk.

  • height (int, optional) – IFrame height in pixels. Default 900.

  • width (str or int, optional) – IFrame width (CSS). Default '100%'.

Returns:

IPython.display.IFrame – The display object (also sent to the notebook frontend via display).