panel.vtk Package


vtk Package


enums Module


synchronizable_deserializer Module

panel.pane.vtk.synchronizable_deserializer.capitalize(name)[source]

Upper the first letter letting the rest unchange


synchronizable_serializer Module

Inheritance diagram of panel.pane.vtk.synchronizable_serializer

vtk Module

Inheritance diagram of panel.pane.vtk.vtk

Defines a VTKPane which renders a vtk plot using VTKPlot bokeh model.

class panel.pane.vtk.vtk.AbstractVTK(object=None, **params)[source]

Bases: panel.pane.base.PaneBase

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: default_layout, object

axes = param.Dict(readonly=False)

Parameters of the axes to construct in the 3d view. Must contain at least xticker, yticker and zticker. A ticker is a dictionary which contains: - ticks (array of numbers) - required. Positions in the scene coordinates of the corresponding axis’ ticks. - labels (array of strings) - optional. Label displayed respectively to the ticks positions. If labels are not defined they are infered from the ticks array. - digits: number of decimal digits when ticks are converted to labels. - fontsize: size in pts of the ticks labels. - show_grid: boolean. If true (default) the axes grid is visible. - grid_opacity: float between 0-1. Defines the grid opacity. - axes_opacity: float between 0-1. Defines the axes lines opacity.

camera = param.Dict(readonly=False)

State of the rendered VTK camera.

color_mappers = param.List(readonly=False)

Color mapper of the actor in the scene

orientation_widget = param.Boolean(readonly=False)

Activate/Deactivate the orientation widget display.

interactive_orientation_widget = param.Boolean(readonly=False)

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

  • port (int (optional, default=0)) – Allows specifying a specific port

classmethod applies(obj)

Given the object return a boolean indicating whether the Pane can render the object. If the priority of the pane is set to None, this method may also be used to define a priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

params (Keyword arguments override the parameters on the clone.) –

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

Creates a set of widgets which allow manipulating the parameters on this instance. By default all parameters which support linking are exposed, but an explicit list of parameters can be provided.

Parameters
  • parameters (list(str)) – An explicit list of parameters to return controls for.

  • jslink (bool) – Whether to use jslinks instead of Python based links. This does not allow using all types of parameters.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.base.Row

embed(max_states=1000, max_opts=3, json=False, json_prefix='', save_path='./', load_path=None, progress=False, states={})

Renders a static version of a panel in a notebook by evaluating the set of states defined by the widgets in the model. Note this will only work well for simple apps with a relatively small state space.

Parameters
  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for JSON filename

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=False)) – Whether to report progress

  • states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

classmethod get_pane_type(obj, **kwargs)

Returns the applicable Pane type given an object by resolving the precedence of all types whose applies method declares that the object is supported.

Parameters

(object) (obj) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None, preprocess=True)

Returns the root model and applies pre-processing hooks

Parameters
  • doc (bokeh.Document) – Bokeh document the bokeh model will be attached to.

  • comm (pyviz_comms.Comm) – Optional pyviz_comms when working in notebook

  • preprocess (boolean (default=True)) – Whether to run preprocessing hooks

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

Allows defining a JS callback to be triggered when a property changes on the source object. The keyword arguments define the properties that trigger a callback and the JS code that gets executed.

Parameters
  • args (dict) – A mapping of objects to make available to the JS callback

  • **callbacks (dict) – A mapping between properties on the source model and the code to execute when that property changes

Returns

callback – The Callback which can be used to disable the callback.

Return type

Callback

Links properties on the source object to those on the target object in JS code. Supports two modes, either specify a mapping between the source and target model properties as keywords or provide a dictionary of JS code snippets which maps from the source parameter to a JS code snippet which is executed when the property changes.

Parameters
  • target (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

  • code (dict) – Custom code which will be executed when the widget value changes.

  • bidirectional (boolean) – Whether to link source and target bi-directionally

  • **links (dict) – A mapping between properties on the source model and the target model property to link it to.

Returns

link – The GenericLink which can be used unlink the widget and the target model.

Return type

GenericLink

Links the parameters on this object to attributes on another object in Python. Supports two modes, either specify a mapping between the source and target object parameters as keywords or provide a dictionary of callbacks which maps from the source parameter to a callback which is triggered when the parameter changes.

Parameters
  • target (object) – The target object of the link.

  • callbacks (dict) – Maps from a parameter in the source object to a callback.

  • bidirectional (boolean) – Whether to link source and target bi-directionally

  • **links (dict) – Maps between parameters on this object to the parameters on the supplied object.

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None, progress=True, embed_states={})

Saves Panel objects to file.

Parameters
  • filename (string or file-like object) – Filename to save the plot to

  • title (string) – Optional title for the plot

  • resources (bokeh resources) – One of the valid bokeh.resources (e.g. CDN or INLINE)

  • template – passed to underlying io.save

  • template_variables – passed to underlying io.save

  • embed (bool) – Whether the state space should be embedded in the saved file.

  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • embed_json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for the auto-generated json directory

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=True)) – Whether to report progress

  • embed_states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

select(selector=None)

Iterates over the Viewable and any potential children in the applying the Selector.

Parameters

selector (type or callable or None) – The selector allows selecting a subset of Viewables by declaring a type or callable function to filter by.

Returns

viewables

Return type

list(Viewable)

servable(title=None, location=True)

Serves the object if in a panel serve context and returns the Panel object to allow it to display itself in a notebook context. :param title: A string title to give the Document (if served as an app) :type title: str :param location: Whether to create a Location component to observe and

set the URL location.

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None, location=True)

Returns a serveable bokeh Document with the panel attached

Parameters
  • doc (bokeh.Document (optional)) – The bokeh Document to attach the panel to as a root, defaults to bokeh.io.curdoc()

  • title (str) – A string title to give the Document

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, address=None, websocket_origin=None, threaded=False, verbose=True, open=True, location=True, **kwargs)

Starts a Bokeh server and displays the Viewable in a new tab.

Parameters
  • title (str) – A string title to give the Document (if served as an app)

  • port (int (optional, default=0)) – Allows specifying a specific port

  • address (str) – The address the server should listen on for HTTP requests.

  • websocket_origin (str or list(str) (optional)) – A list of hosts that can connect to the websocket. This is typically required when embedding a server app in an external web site. If None, “localhost” is used.

  • threaded (boolean (optional, default=False)) – Whether to launch the Server on a separate thread, allowing interactive use.

  • verbose (boolean (optional, default=True)) – Whether to print the address and port

  • open (boolean (optional, default=True)) – Whether to open the server in a new browser tab

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns

server – Returns the Bokeh server instance or the thread the server was launched on (if threaded=True)

Return type

bokeh.server.Server or threading.Thread

class panel.pane.vtk.vtk.BaseVTKRenderWindow(object, **params)[source]

Bases: panel.pane.vtk.vtk.AbstractVTK

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: default_layout, object

panel.pane.vtk.vtk.AbstractVTK: axes, camera, color_mappers, orientation_widget, interactive_orientation_widget

enable_keybindings = param.Boolean(readonly=False)

Activate/Deactivate keys binding. Warning: These keys bind may not work as expected in a notebook context if they interact with already binded keys

serialize_on_instantiation = param.Boolean(readonly=False)

defines when the serialization of the vtkRenderWindow scene occurs. If set to True the scene object is serialized when the pane is created else (default) when the panel is displayed to the screen. This parameter is constant, once set it can’t be modified. Warning: when the serialization occurs at instantiation, the vtkRenderWindow and the view are not fully synchronized. The view displays the state of the scene captured when the panel was created, if elements where added or removed between the instantiation and the display these changes will not be reflected. Moreover when the pane object is updated (replaced or call to param.trigger(‘object’)), all the scene is rebuilt from scratch.

serialize_all_data_arrays = param.Boolean(readonly=False)

If true, enable the serialization of all data arrays of vtkDataSets (point data, cell data and field data). By default the value is False and only active scalars of each dataset are serialized and transfer to the javascript side. Enabling this option will increase memory and network transfer volume but results in more reactive visualizations by using some custom javascript functions.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

  • port (int (optional, default=0)) – Allows specifying a specific port

classmethod applies(obj, **kwargs)[source]

Given the object return a boolean indicating whether the Pane can render the object. If the priority of the pane is set to None, this method may also be used to define a priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

params (Keyword arguments override the parameters on the clone.) –

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

Creates a set of widgets which allow manipulating the parameters on this instance. By default all parameters which support linking are exposed, but an explicit list of parameters can be provided.

Parameters
  • parameters (list(str)) – An explicit list of parameters to return controls for.

  • jslink (bool) – Whether to use jslinks instead of Python based links. This does not allow using all types of parameters.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.base.Row

embed(max_states=1000, max_opts=3, json=False, json_prefix='', save_path='./', load_path=None, progress=False, states={})

Renders a static version of a panel in a notebook by evaluating the set of states defined by the widgets in the model. Note this will only work well for simple apps with a relatively small state space.

Parameters
  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for JSON filename

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=False)) – Whether to report progress

  • states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

classmethod get_pane_type(obj, **kwargs)

Returns the applicable Pane type given an object by resolving the precedence of all types whose applies method declares that the object is supported.

Parameters

(object) (obj) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_renderer()[source]

Get the vtk Renderer associated to this pane

get_root(doc=None, comm=None, preprocess=True)

Returns the root model and applies pre-processing hooks

Parameters
  • doc (bokeh.Document) – Bokeh document the bokeh model will be attached to.

  • comm (pyviz_comms.Comm) – Optional pyviz_comms when working in notebook

  • preprocess (boolean (default=True)) – Whether to run preprocessing hooks

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

Allows defining a JS callback to be triggered when a property changes on the source object. The keyword arguments define the properties that trigger a callback and the JS code that gets executed.

Parameters
  • args (dict) – A mapping of objects to make available to the JS callback

  • **callbacks (dict) – A mapping between properties on the source model and the code to execute when that property changes

Returns

callback – The Callback which can be used to disable the callback.

Return type

Callback

Links properties on the source object to those on the target object in JS code. Supports two modes, either specify a mapping between the source and target model properties as keywords or provide a dictionary of JS code snippets which maps from the source parameter to a JS code snippet which is executed when the property changes.

Parameters
  • target (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

  • code (dict) – Custom code which will be executed when the widget value changes.

  • bidirectional (boolean) – Whether to link source and target bi-directionally

  • **links (dict) – A mapping between properties on the source model and the target model property to link it to.

Returns

link – The GenericLink which can be used unlink the widget and the target model.

Return type

GenericLink

Links the parameters on this object to attributes on another object in Python. Supports two modes, either specify a mapping between the source and target object parameters as keywords or provide a dictionary of callbacks which maps from the source parameter to a callback which is triggered when the parameter changes.

Parameters
  • target (object) – The target object of the link.

  • callbacks (dict) – Maps from a parameter in the source object to a callback.

  • bidirectional (boolean) – Whether to link source and target bi-directionally

  • **links (dict) – Maps between parameters on this object to the parameters on the supplied object.

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None, progress=True, embed_states={})

Saves Panel objects to file.

Parameters
  • filename (string or file-like object) – Filename to save the plot to

  • title (string) – Optional title for the plot

  • resources (bokeh resources) – One of the valid bokeh.resources (e.g. CDN or INLINE)

  • template – passed to underlying io.save

  • template_variables – passed to underlying io.save

  • embed (bool) – Whether the state space should be embedded in the saved file.

  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • embed_json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for the auto-generated json directory

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=True)) – Whether to report progress

  • embed_states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

select(selector=None)

Iterates over the Viewable and any potential children in the applying the Selector.

Parameters

selector (type or callable or None) – The selector allows selecting a subset of Viewables by declaring a type or callable function to filter by.

Returns

viewables

Return type

list(Viewable)

servable(title=None, location=True)

Serves the object if in a panel serve context and returns the Panel object to allow it to display itself in a notebook context. :param title: A string title to give the Document (if served as an app) :type title: str :param location: Whether to create a Location component to observe and

set the URL location.

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None, location=True)

Returns a serveable bokeh Document with the panel attached

Parameters
  • doc (bokeh.Document (optional)) – The bokeh Document to attach the panel to as a root, defaults to bokeh.io.curdoc()

  • title (str) – A string title to give the Document

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, address=None, websocket_origin=None, threaded=False, verbose=True, open=True, location=True, **kwargs)

Starts a Bokeh server and displays the Viewable in a new tab.

Parameters
  • title (str) – A string title to give the Document (if served as an app)

  • port (int (optional, default=0)) – Allows specifying a specific port

  • address (str) – The address the server should listen on for HTTP requests.

  • websocket_origin (str or list(str) (optional)) – A list of hosts that can connect to the websocket. This is typically required when embedding a server app in an external web site. If None, “localhost” is used.

  • threaded (boolean (optional, default=False)) – Whether to launch the Server on a separate thread, allowing interactive use.

  • verbose (boolean (optional, default=True)) – Whether to print the address and port

  • open (boolean (optional, default=True)) – Whether to open the server in a new browser tab

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns

server – Returns the Bokeh server instance or the thread the server was launched on (if threaded=True)

Return type

bokeh.server.Server or threading.Thread

class panel.pane.vtk.vtk.SyncHelpers[source]

Bases: object

Class containing helpers functions to update vtkRenderingWindow

add_actors(actors)[source]

Add a list of actors to the VTK renderer if reset_camera is True, the current camera and it’s clipping will be reset.

remove_actors(actors)[source]

Add a list of actors to the VTK renderer if reset_camera is True, the current camera and it’s clipping will be reset.

abstract reset_camera()[source]

Reset the camera

abstract synchronize()[source]

function to synchronize the renderer with the view

class panel.pane.vtk.vtk.VTK(obj, **params)[source]

Bases: object

Class factory: allows to switch between VTKJS, VTKRenderWindow, and VTKRenderWindowSynchronized pane in function of the object type and when the serialisation of the vtkRenderWindow occurs. Once a pane is returned by this class (inst = VTK(object)), one can use pn.help(inst) to see parameters available for the current pane

class panel.pane.vtk.vtk.VTKJS(object=None, **params)[source]

Bases: panel.pane.vtk.vtk.AbstractVTK

VTK panes allow rendering vtk scene stored in a vtkjs.

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: default_layout, object

panel.pane.vtk.vtk.AbstractVTK: axes, camera, color_mappers, orientation_widget, interactive_orientation_widget

enable_keybindings = param.Boolean(readonly=False)

Activate/Deactivate keys binding. Warning: These keybindings may not work as expected in a notebook context if they interact with already bound keys.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

  • port (int (optional, default=0)) – Allows specifying a specific port

classmethod applies(obj)[source]

Given the object return a boolean indicating whether the Pane can render the object. If the priority of the pane is set to None, this method may also be used to define a priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

params (Keyword arguments override the parameters on the clone.) –

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

Creates a set of widgets which allow manipulating the parameters on this instance. By default all parameters which support linking are exposed, but an explicit list of parameters can be provided.

Parameters
  • parameters (list(str)) – An explicit list of parameters to return controls for.

  • jslink (bool) – Whether to use jslinks instead of Python based links. This does not allow using all types of parameters.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.base.Row

embed(max_states=1000, max_opts=3, json=False, json_prefix='', save_path='./', load_path=None, progress=False, states={})

Renders a static version of a panel in a notebook by evaluating the set of states defined by the widgets in the model. Note this will only work well for simple apps with a relatively small state space.

Parameters
  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for JSON filename

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=False)) – Whether to report progress

  • states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

classmethod get_pane_type(obj, **kwargs)

Returns the applicable Pane type given an object by resolving the precedence of all types whose applies method declares that the object is supported.

Parameters

(object) (obj) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None, preprocess=True)

Returns the root model and applies pre-processing hooks

Parameters
  • doc (bokeh.Document) – Bokeh document the bokeh model will be attached to.

  • comm (pyviz_comms.Comm) – Optional pyviz_comms when working in notebook

  • preprocess (boolean (default=True)) – Whether to run preprocessing hooks

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

Allows defining a JS callback to be triggered when a property changes on the source object. The keyword arguments define the properties that trigger a callback and the JS code that gets executed.

Parameters
  • args (dict) – A mapping of objects to make available to the JS callback

  • **callbacks (dict) – A mapping between properties on the source model and the code to execute when that property changes

Returns

callback – The Callback which can be used to disable the callback.

Return type

Callback

Links properties on the source object to those on the target object in JS code. Supports two modes, either specify a mapping between the source and target model properties as keywords or provide a dictionary of JS code snippets which maps from the source parameter to a JS code snippet which is executed when the property changes.

Parameters
  • target (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

  • code (dict) – Custom code which will be executed when the widget value changes.

  • bidirectional (boolean) – Whether to link source and target bi-directionally

  • **links (dict) – A mapping between properties on the source model and the target model property to link it to.

Returns

link – The GenericLink which can be used unlink the widget and the target model.

Return type

GenericLink

Links the parameters on this object to attributes on another object in Python. Supports two modes, either specify a mapping between the source and target object parameters as keywords or provide a dictionary of callbacks which maps from the source parameter to a callback which is triggered when the parameter changes.

Parameters
  • target (object) – The target object of the link.

  • callbacks (dict) – Maps from a parameter in the source object to a callback.

  • bidirectional (boolean) – Whether to link source and target bi-directionally

  • **links (dict) – Maps between parameters on this object to the parameters on the supplied object.

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None, progress=True, embed_states={})

Saves Panel objects to file.

Parameters
  • filename (string or file-like object) – Filename to save the plot to

  • title (string) – Optional title for the plot

  • resources (bokeh resources) – One of the valid bokeh.resources (e.g. CDN or INLINE)

  • template – passed to underlying io.save

  • template_variables – passed to underlying io.save

  • embed (bool) – Whether the state space should be embedded in the saved file.

  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • embed_json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for the auto-generated json directory

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=True)) – Whether to report progress

  • embed_states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

select(selector=None)

Iterates over the Viewable and any potential children in the applying the Selector.

Parameters

selector (type or callable or None) – The selector allows selecting a subset of Viewables by declaring a type or callable function to filter by.

Returns

viewables

Return type

list(Viewable)

servable(title=None, location=True)

Serves the object if in a panel serve context and returns the Panel object to allow it to display itself in a notebook context. :param title: A string title to give the Document (if served as an app) :type title: str :param location: Whether to create a Location component to observe and

set the URL location.

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None, location=True)

Returns a serveable bokeh Document with the panel attached

Parameters
  • doc (bokeh.Document (optional)) – The bokeh Document to attach the panel to as a root, defaults to bokeh.io.curdoc()

  • title (str) – A string title to give the Document

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, address=None, websocket_origin=None, threaded=False, verbose=True, open=True, location=True, **kwargs)

Starts a Bokeh server and displays the Viewable in a new tab.

Parameters
  • title (str) – A string title to give the Document (if served as an app)

  • port (int (optional, default=0)) – Allows specifying a specific port

  • address (str) – The address the server should listen on for HTTP requests.

  • websocket_origin (str or list(str) (optional)) – A list of hosts that can connect to the websocket. This is typically required when embedding a server app in an external web site. If None, “localhost” is used.

  • threaded (boolean (optional, default=False)) – Whether to launch the Server on a separate thread, allowing interactive use.

  • verbose (boolean (optional, default=True)) – Whether to print the address and port

  • open (boolean (optional, default=True)) – Whether to open the server in a new browser tab

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns

server – Returns the Bokeh server instance or the thread the server was launched on (if threaded=True)

Return type

bokeh.server.Server or threading.Thread

class panel.pane.vtk.vtk.VTKRenderWindow(object=None, **params)[source]

Bases: panel.pane.vtk.vtk.BaseVTKRenderWindow

VTK panes allow rendering vtkRenderWindow objects. Capture the scene of the vtkRenderWindow passed at instantiation To update the display a new vtkRenderWindow must be passed as object

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: default_layout, object

panel.pane.vtk.vtk.AbstractVTK: axes, camera, color_mappers, orientation_widget, interactive_orientation_widget

panel.pane.vtk.vtk.BaseVTKRenderWindow: enable_keybindings, serialize_on_instantiation, serialize_all_data_arrays

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

  • port (int (optional, default=0)) – Allows specifying a specific port

classmethod applies(obj, **kwargs)[source]

Given the object return a boolean indicating whether the Pane can render the object. If the priority of the pane is set to None, this method may also be used to define a priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

params (Keyword arguments override the parameters on the clone.) –

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

Creates a set of widgets which allow manipulating the parameters on this instance. By default all parameters which support linking are exposed, but an explicit list of parameters can be provided.

Parameters
  • parameters (list(str)) – An explicit list of parameters to return controls for.

  • jslink (bool) – Whether to use jslinks instead of Python based links. This does not allow using all types of parameters.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.base.Row

embed(max_states=1000, max_opts=3, json=False, json_prefix='', save_path='./', load_path=None, progress=False, states={})

Renders a static version of a panel in a notebook by evaluating the set of states defined by the widgets in the model. Note this will only work well for simple apps with a relatively small state space.

Parameters
  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for JSON filename

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=False)) – Whether to report progress

  • states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

classmethod get_pane_type(obj, **kwargs)

Returns the applicable Pane type given an object by resolving the precedence of all types whose applies method declares that the object is supported.

Parameters

(object) (obj) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_renderer()

Get the vtk Renderer associated to this pane

get_root(doc=None, comm=None, preprocess=True)

Returns the root model and applies pre-processing hooks

Parameters
  • doc (bokeh.Document) – Bokeh document the bokeh model will be attached to.

  • comm (pyviz_comms.Comm) – Optional pyviz_comms when working in notebook

  • preprocess (boolean (default=True)) – Whether to run preprocessing hooks

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

Allows defining a JS callback to be triggered when a property changes on the source object. The keyword arguments define the properties that trigger a callback and the JS code that gets executed.

Parameters
  • args (dict) – A mapping of objects to make available to the JS callback

  • **callbacks (dict) – A mapping between properties on the source model and the code to execute when that property changes

Returns

callback – The Callback which can be used to disable the callback.

Return type

Callback

Links properties on the source object to those on the target object in JS code. Supports two modes, either specify a mapping between the source and target model properties as keywords or provide a dictionary of JS code snippets which maps from the source parameter to a JS code snippet which is executed when the property changes.

Parameters
  • target (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

  • code (dict) – Custom code which will be executed when the widget value changes.

  • bidirectional (boolean) – Whether to link source and target bi-directionally

  • **links (dict) – A mapping between properties on the source model and the target model property to link it to.

Returns

link – The GenericLink which can be used unlink the widget and the target model.

Return type

GenericLink

Links the parameters on this object to attributes on another object in Python. Supports two modes, either specify a mapping between the source and target object parameters as keywords or provide a dictionary of callbacks which maps from the source parameter to a callback which is triggered when the parameter changes.

Parameters
  • target (object) – The target object of the link.

  • callbacks (dict) – Maps from a parameter in the source object to a callback.

  • bidirectional (boolean) – Whether to link source and target bi-directionally

  • **links (dict) – Maps between parameters on this object to the parameters on the supplied object.

pprint()

Prints a compositional repr of the class.

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None, progress=True, embed_states={})

Saves Panel objects to file.

Parameters
  • filename (string or file-like object) – Filename to save the plot to

  • title (string) – Optional title for the plot

  • resources (bokeh resources) – One of the valid bokeh.resources (e.g. CDN or INLINE)

  • template – passed to underlying io.save

  • template_variables – passed to underlying io.save

  • embed (bool) – Whether the state space should be embedded in the saved file.

  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • embed_json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for the auto-generated json directory

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=True)) – Whether to report progress

  • embed_states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

select(selector=None)

Iterates over the Viewable and any potential children in the applying the Selector.

Parameters

selector (type or callable or None) – The selector allows selecting a subset of Viewables by declaring a type or callable function to filter by.

Returns

viewables

Return type

list(Viewable)

servable(title=None, location=True)

Serves the object if in a panel serve context and returns the Panel object to allow it to display itself in a notebook context. :param title: A string title to give the Document (if served as an app) :type title: str :param location: Whether to create a Location component to observe and

set the URL location.

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None, location=True)

Returns a serveable bokeh Document with the panel attached

Parameters
  • doc (bokeh.Document (optional)) – The bokeh Document to attach the panel to as a root, defaults to bokeh.io.curdoc()

  • title (str) – A string title to give the Document

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, address=None, websocket_origin=None, threaded=False, verbose=True, open=True, location=True, **kwargs)

Starts a Bokeh server and displays the Viewable in a new tab.

Parameters
  • title (str) – A string title to give the Document (if served as an app)

  • port (int (optional, default=0)) – Allows specifying a specific port

  • address (str) – The address the server should listen on for HTTP requests.

  • websocket_origin (str or list(str) (optional)) – A list of hosts that can connect to the websocket. This is typically required when embedding a server app in an external web site. If None, “localhost” is used.

  • threaded (boolean (optional, default=False)) – Whether to launch the Server on a separate thread, allowing interactive use.

  • verbose (boolean (optional, default=True)) – Whether to print the address and port

  • open (boolean (optional, default=True)) – Whether to open the server in a new browser tab

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns

server – Returns the Bokeh server instance or the thread the server was launched on (if threaded=True)

Return type

bokeh.server.Server or threading.Thread

class panel.pane.vtk.vtk.VTKRenderWindowSynchronized(object=None, **params)[source]

Bases: panel.pane.vtk.vtk.BaseVTKRenderWindow, panel.pane.vtk.vtk.SyncHelpers

VTK panes allow rendering VTK objects. Synchronize a vtkRenderWindow constructs on python side with a custom bokeh model on javascript side

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: default_layout, object

panel.pane.vtk.vtk.AbstractVTK: axes, camera, color_mappers, orientation_widget

panel.pane.vtk.vtk.BaseVTKRenderWindow: enable_keybindings, serialize_on_instantiation, serialize_all_data_arrays

interactive_orientation_widget = param.Boolean(readonly=False)

_one_time_reset = param.Boolean(readonly=False)

add_actors(actors)

Add a list of actors to the VTK renderer if reset_camera is True, the current camera and it’s clipping will be reset.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

  • port (int (optional, default=0)) – Allows specifying a specific port

classmethod applies(obj, **kwargs)[source]

Given the object return a boolean indicating whether the Pane can render the object. If the priority of the pane is set to None, this method may also be used to define a priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

params (Keyword arguments override the parameters on the clone.) –

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

Creates a set of widgets which allow manipulating the parameters on this instance. By default all parameters which support linking are exposed, but an explicit list of parameters can be provided.

Parameters
  • parameters (list(str)) – An explicit list of parameters to return controls for.

  • jslink (bool) – Whether to use jslinks instead of Python based links. This does not allow using all types of parameters.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.base.Row

embed(max_states=1000, max_opts=3, json=False, json_prefix='', save_path='./', load_path=None, progress=False, states={})

Renders a static version of a panel in a notebook by evaluating the set of states defined by the widgets in the model. Note this will only work well for simple apps with a relatively small state space.

Parameters
  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for JSON filename

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=False)) – Whether to report progress

  • states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

classmethod get_pane_type(obj, **kwargs)

Returns the applicable Pane type given an object by resolving the precedence of all types whose applies method declares that the object is supported.

Parameters

(object) (obj) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_renderer()

Get the vtk Renderer associated to this pane

get_root(doc=None, comm=None, preprocess=True)

Returns the root model and applies pre-processing hooks

Parameters
  • doc (bokeh.Document) – Bokeh document the bokeh model will be attached to.

  • comm (pyviz_comms.Comm) – Optional pyviz_comms when working in notebook

  • preprocess (boolean (default=True)) – Whether to run preprocessing hooks

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

Allows defining a JS callback to be triggered when a property changes on the source object. The keyword arguments define the properties that trigger a callback and the JS code that gets executed.

Parameters
  • args (dict) – A mapping of objects to make available to the JS callback

  • **callbacks (dict) – A mapping between properties on the source model and the code to execute when that property changes

Returns

callback – The Callback which can be used to disable the callback.

Return type

Callback

Links properties on the source object to those on the target object in JS code. Supports two modes, either specify a mapping between the source and target model properties as keywords or provide a dictionary of JS code snippets which maps from the source parameter to a JS code snippet which is executed when the property changes.

Parameters
  • target (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

  • code (dict) – Custom code which will be executed when the widget value changes.

  • bidirectional (boolean) – Whether to link source and target bi-directionally

  • **links (dict) – A mapping between properties on the source model and the target model property to link it to.

Returns

link – The GenericLink which can be used unlink the widget and the target model.

Return type

GenericLink

Links the parameters on this object to attributes on another object in Python. Supports two modes, either specify a mapping between the source and target object parameters as keywords or provide a dictionary of callbacks which maps from the source parameter to a callback which is triggered when the parameter changes.

Parameters
  • target (object) – The target object of the link.

  • callbacks (dict) – Maps from a parameter in the source object to a callback.

  • bidirectional (boolean) – Whether to link source and target bi-directionally

  • **links (dict) – Maps between parameters on this object to the parameters on the supplied object.

Associate the camera of an other VTKSynchronized pane to this renderer

pprint()

Prints a compositional repr of the class.

remove_actors(actors)

Add a list of actors to the VTK renderer if reset_camera is True, the current camera and it’s clipping will be reset.

reset_camera()[source]

Reset the camera

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None, progress=True, embed_states={})

Saves Panel objects to file.

Parameters
  • filename (string or file-like object) – Filename to save the plot to

  • title (string) – Optional title for the plot

  • resources (bokeh resources) – One of the valid bokeh.resources (e.g. CDN or INLINE)

  • template – passed to underlying io.save

  • template_variables – passed to underlying io.save

  • embed (bool) – Whether the state space should be embedded in the saved file.

  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • embed_json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for the auto-generated json directory

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=True)) – Whether to report progress

  • embed_states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

select(selector=None)

Iterates over the Viewable and any potential children in the applying the Selector.

Parameters

selector (type or callable or None) – The selector allows selecting a subset of Viewables by declaring a type or callable function to filter by.

Returns

viewables

Return type

list(Viewable)

servable(title=None, location=True)

Serves the object if in a panel serve context and returns the Panel object to allow it to display itself in a notebook context. :param title: A string title to give the Document (if served as an app) :type title: str :param location: Whether to create a Location component to observe and

set the URL location.

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None, location=True)

Returns a serveable bokeh Document with the panel attached

Parameters
  • doc (bokeh.Document (optional)) – The bokeh Document to attach the panel to as a root, defaults to bokeh.io.curdoc()

  • title (str) – A string title to give the Document

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, address=None, websocket_origin=None, threaded=False, verbose=True, open=True, location=True, **kwargs)

Starts a Bokeh server and displays the Viewable in a new tab.

Parameters
  • title (str) – A string title to give the Document (if served as an app)

  • port (int (optional, default=0)) – Allows specifying a specific port

  • address (str) – The address the server should listen on for HTTP requests.

  • websocket_origin (str or list(str) (optional)) – A list of hosts that can connect to the websocket. This is typically required when embedding a server app in an external web site. If None, “localhost” is used.

  • threaded (boolean (optional, default=False)) – Whether to launch the Server on a separate thread, allowing interactive use.

  • verbose (boolean (optional, default=True)) – Whether to print the address and port

  • open (boolean (optional, default=True)) – Whether to open the server in a new browser tab

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns

server – Returns the Bokeh server instance or the thread the server was launched on (if threaded=True)

Return type

bokeh.server.Server or threading.Thread

synchronize()[source]

function to synchronize the renderer with the view

Create a fresh vtkCamera instance and set it to the renderer

class panel.pane.vtk.vtk.VTKVolume(object=None, **params)[source]

Bases: panel.pane.vtk.vtk.AbstractVTK

Parameters inherited from:

panel.viewable.Layoutable: align, aspect_ratio, background, css_classes, width, height, min_width, min_height, max_width, max_height, margin, width_policy, height_policy, sizing_mode

panel.viewable.Viewable: loading

panel.pane.base.PaneBase: default_layout, object

panel.pane.vtk.vtk.AbstractVTK: axes, camera, color_mappers, orientation_widget, interactive_orientation_widget

ambient = param.Number(readonly=False)

Value to control the ambient lighting. It is the light an object gives even in the absence of strong light. It is constant in all directions.

controller_expanded = param.Boolean(readonly=False)

If True the volume controller panel options is expanded in the view

colormap = param.Selector(readonly=False)

Name of the colormap used to transform pixel value in color.

diffuse = param.Number(readonly=False)

Value to control the diffuse Lighting. It relies on both the light direction and the object surface normal.

display_volume = param.Boolean(readonly=False)

If set to True, the 3D respresentation of the volume is displayed using ray casting.

display_slices = param.Boolean(readonly=False)

If set to true, the orthgonal slices in the three (X, Y, Z) directions are displayed. Position of each slice can be controlled using slice_(i,j,k) parameters.

edge_gradient = param.Number(readonly=False)

Parameter to adjust the opacity of the volume based on the gradient between voxels.

interpolation = param.Selector(readonly=False)

interpolation type for sampling a volume. nearest interpolation will snap to the closest voxel, linear will perform trilinear interpolation to compute a scalar value from surrounding voxels. fast_linear under WebGL 1 will perform bilinear interpolation on X and Y but use nearest for Z. This is slightly faster than full linear at the cost of no Z axis linear interpolation.

mapper = param.Dict(readonly=False)

Lookup Table in format {low, high, palette}

max_data_size = param.Number(readonly=False)

Maximum data size transfert allowed without subsampling

origin = param.Tuple(readonly=False)

render_background = param.Color(readonly=False)

Allows to specify the background color of the 3D rendering. The value must be specified as an hexadecimal color string.

rescale = param.Boolean(readonly=False)

If set to True the colormap is rescaled beween min and max value of the non-transparent pixel, otherwise the full range of the pixel values are used.

shadow = param.Boolean(readonly=False)

If set to False, then the mapper for the volume will not perform shading computations, it is the same as setting ambient=1, diffuse=0, specular=0.

sampling = param.Number(readonly=False)

Parameter to adjust the distance between samples used for rendering. The lower the value is the more precise is the representation but it is more computationally intensive.

spacing = param.Tuple(readonly=False)

Distance between voxel in each direction

specular = param.Number(readonly=False)

Value to control specular lighting. It is the light reflects back toward the camera when hitting the object.

specular_power = param.Number(readonly=False)

Specular power refers to how much light is reflected in a mirror like fashion, rather than scattered randomly in a diffuse manner.

slice_i = param.Integer(readonly=False)

Integer parameter to control the position of the slice normal to the X direction.

slice_j = param.Integer(readonly=False)

Integer parameter to control the position of the slice normal to the Y direction.

slice_k = param.Integer(readonly=False)

Integer parameter to control the position of the slice normal to the Z direction.

add_periodic_callback(callback, period=500, count=None, timeout=None, start=True)

Schedules a periodic callback to be run at an interval set by the period. Returns a PeriodicCallback object with the option to stop and start the callback.

Parameters
  • callback (callable) – Callable function to be executed at periodic interval.

  • period (int) – Interval in milliseconds at which callback will be executed.

  • count (int) – Maximum number of times callback will be invoked.

  • timeout (int) – Timeout in seconds when the callback should be stopped.

  • start (boolean (default=True)) – Whether to start callback immediately.

Returns

Return type

Return a PeriodicCallback object with start and stop methods.

app(notebook_url='localhost:8888', port=0)

Displays a bokeh server app inline in the notebook.

Parameters
  • notebook_url (str) – URL to the notebook server

  • port (int (optional, default=0)) – Allows specifying a specific port

classmethod applies(obj)[source]

Given the object return a boolean indicating whether the Pane can render the object. If the priority of the pane is set to None, this method may also be used to define a priority depending on the object being rendered.

clone(object=None, **params)

Makes a copy of the Pane sharing the same parameters.

Parameters

params (Keyword arguments override the parameters on the clone.) –

Returns

Return type

Cloned Pane object

controls(parameters=[], jslink=True)

Creates a set of widgets which allow manipulating the parameters on this instance. By default all parameters which support linking are exposed, but an explicit list of parameters can be provided.

Parameters
  • parameters (list(str)) – An explicit list of parameters to return controls for.

  • jslink (bool) – Whether to use jslinks instead of Python based links. This does not allow using all types of parameters.

Returns

Return type

A layout of the controls

default_layout

alias of panel.layout.base.Row

embed(max_states=1000, max_opts=3, json=False, json_prefix='', save_path='./', load_path=None, progress=False, states={})

Renders a static version of a panel in a notebook by evaluating the set of states defined by the widgets in the model. Note this will only work well for simple apps with a relatively small state space.

Parameters
  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for JSON filename

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=False)) – Whether to report progress

  • states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

classmethod get_pane_type(obj, **kwargs)

Returns the applicable Pane type given an object by resolving the precedence of all types whose applies method declares that the object is supported.

Parameters

(object) (obj) –

Returns

Return type

The applicable Pane type with the highest precedence.

get_root(doc=None, comm=None, preprocess=True)

Returns the root model and applies pre-processing hooks

Parameters
  • doc (bokeh.Document) – Bokeh document the bokeh model will be attached to.

  • comm (pyviz_comms.Comm) – Optional pyviz_comms when working in notebook

  • preprocess (boolean (default=True)) – Whether to run preprocessing hooks

Returns

Return type

Returns the bokeh model corresponding to this panel object

jscallback(args={}, **callbacks)

Allows defining a JS callback to be triggered when a property changes on the source object. The keyword arguments define the properties that trigger a callback and the JS code that gets executed.

Parameters
  • args (dict) – A mapping of objects to make available to the JS callback

  • **callbacks (dict) – A mapping between properties on the source model and the code to execute when that property changes

Returns

callback – The Callback which can be used to disable the callback.

Return type

Callback

Links properties on the source object to those on the target object in JS code. Supports two modes, either specify a mapping between the source and target model properties as keywords or provide a dictionary of JS code snippets which maps from the source parameter to a JS code snippet which is executed when the property changes.

Parameters
  • target (HoloViews object or bokeh Model or panel Viewable) – The target to link the value to.

  • code (dict) – Custom code which will be executed when the widget value changes.

  • bidirectional (boolean) – Whether to link source and target bi-directionally

  • **links (dict) – A mapping between properties on the source model and the target model property to link it to.

Returns

link – The GenericLink which can be used unlink the widget and the target model.

Return type

GenericLink

Links the parameters on this object to attributes on another object in Python. Supports two modes, either specify a mapping between the source and target object parameters as keywords or provide a dictionary of callbacks which maps from the source parameter to a callback which is triggered when the parameter changes.

Parameters
  • target (object) – The target object of the link.

  • callbacks (dict) – Maps from a parameter in the source object to a callback.

  • bidirectional (boolean) – Whether to link source and target bi-directionally

  • **links (dict) – Maps between parameters on this object to the parameters on the supplied object.

pprint()

Prints a compositional repr of the class.

classmethod register_serializer(class_type, serializer)[source]

Register a seriliazer for a given type of class. A serializer is a function which take an instance of class_type (like a vtk.vtkImageData) as input and return a numpy array of the data

save(filename, title=None, resources=None, template=None, template_variables=None, embed=False, max_states=1000, max_opts=3, embed_json=False, json_prefix='', save_path='./', load_path=None, progress=True, embed_states={})

Saves Panel objects to file.

Parameters
  • filename (string or file-like object) – Filename to save the plot to

  • title (string) – Optional title for the plot

  • resources (bokeh resources) – One of the valid bokeh.resources (e.g. CDN or INLINE)

  • template – passed to underlying io.save

  • template_variables – passed to underlying io.save

  • embed (bool) – Whether the state space should be embedded in the saved file.

  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • embed_json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for the auto-generated json directory

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

  • progress (boolean (default=True)) – Whether to report progress

  • embed_states (dict (default={})) – A dictionary specifying the widget values to embed for each widget

select(selector=None)

Iterates over the Viewable and any potential children in the applying the Selector.

Parameters

selector (type or callable or None) – The selector allows selecting a subset of Viewables by declaring a type or callable function to filter by.

Returns

viewables

Return type

list(Viewable)

servable(title=None, location=True)

Serves the object if in a panel serve context and returns the Panel object to allow it to display itself in a notebook context. :param title: A string title to give the Document (if served as an app) :type title: str :param location: Whether to create a Location component to observe and

set the URL location.

Returns

Return type

The Panel object itself

server_doc(doc=None, title=None, location=True)

Returns a serveable bokeh Document with the panel attached

Parameters
  • doc (bokeh.Document (optional)) – The bokeh Document to attach the panel to as a root, defaults to bokeh.io.curdoc()

  • title (str) – A string title to give the Document

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns

doc – The bokeh document the panel was attached to

Return type

bokeh.Document

show(title=None, port=0, address=None, websocket_origin=None, threaded=False, verbose=True, open=True, location=True, **kwargs)

Starts a Bokeh server and displays the Viewable in a new tab.

Parameters
  • title (str) – A string title to give the Document (if served as an app)

  • port (int (optional, default=0)) – Allows specifying a specific port

  • address (str) – The address the server should listen on for HTTP requests.

  • websocket_origin (str or list(str) (optional)) – A list of hosts that can connect to the websocket. This is typically required when embedding a server app in an external web site. If None, “localhost” is used.

  • threaded (boolean (optional, default=False)) – Whether to launch the Server on a separate thread, allowing interactive use.

  • verbose (boolean (optional, default=True)) – Whether to print the address and port

  • open (boolean (optional, default=True)) – Whether to open the server in a new browser tab

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns

server – Returns the Bokeh server instance or the thread the server was launched on (if threaded=True)

Return type

bokeh.server.Server or threading.Thread