LiveViewer

class photonforge.live_viewer.LiveViewer(port=0, start=True, auto_refresh=True, auto_refresh_delay=0.1)[source]

Live viewer for PhotonForge components and layout files.

Parameters:
  • port (int) – Port number used by the viewer server.

  • start (bool) – If True, the viewer server is automatically started.

  • auto_refresh (bool) – If True, automatically refresh the most recently displayed component after successful IPython cell executions. This option has no effect outside IPython/Jupyter.

  • auto_refresh_delay (float) – Seconds to wait for another cell execution before rebuilding the displayed component.

Example

>>> from photonforge.live_viewer import LiveViewer
>>> viewer = LiveViewer()
>>> component = pf.parametric.straight(port_spec="Strip", length=3)
>>> viewer(component)

Methods

display(item)

Display a component or an existing GDSII/OASIS path.

generate()

set_status(text, *[, scene_transition_done])

Show a live status line in the browser's loading overlay.

start()

Start the server.

stop()

Stop the server.

Attributes

scene_generation

Generation of the currently published native scene.

display(item)[source]

Display a component or an existing GDSII/OASIS path.

Parameters:

item (_T)

Return type:

_T

property scene_generation: int

Generation of the currently published native scene.

set_status(text, *, scene_transition_done=False)[source]

Show a live status line in the browser’s loading overlay.

Parameters:
  • text (str)

  • scene_transition_done (bool)

Return type:

None

start()[source]

Start the server.

Return type:

LiveViewer

stop()[source]

Stop the server.

Return type:

None