JupyterApplication#
- class glue_jupyter.app.JupyterApplication(data_collection=None, session=None, settings=None)[source]#
Bases:
Application
The main Glue application object for the Jupyter environment.
This is used as the primary way to interact with glue, including loading data, creating viewers, and adding links.
- Parameters:
- data_collection
DataCollection
A preexisting data collection. By default, a new data collection is created.
- session
Session
A preexisting session object. By default, a new session object is created.
- settingsdict or None
Initial settings to override defaults
- data_collection
Attributes Summary
A list of viewers in this application - these are all viewers created that still have at least one reference to them even if not currently shown.
Methods Summary
add_link
(data1, attribute1, data2, attribute2)Add a simple identity link between two attributes.
add_widget
(widget[, label, tab])histogram1d
(*[, data, x, widget, color, ...])Open an interactive histogram viewer.
imshow
(*[, data, x, y, widget, show])Open an interactive image viewer.
link
(links)Parse and add links.
new_data_viewer
(*args, **kwargs)Create a new data viewer
profile1d
(*[, data, x, widget, show])Open an interactive 1d profile viewer.
scatter2d
(*[, data, x, y, widget, color, ...])Open an interactive 2d scatter plot viewer.
scatter3d
(*[, data, x, y, z, widget, show])Open an interactive 3d scatter plot viewer.
set_subset_mode
(mode)Set the current subset mode.
subset
(name, subset_state)Create a new selection/subset.
subset_lasso2d
(x_att, y_att, lasso_x, lasso_y)Create a subset from a programmatic 2d lasso selection.
subset_roi
(attributes, roi)Create a subset from a region of interest.
table
(*[, data, x, widget, viewer_state, ...])Open an interactive table viewer.
volshow
(*[, data, x, y, z, widget, show])Open an interactive volume viewer.
Attributes Documentation
- viewers[source]#
A list of viewers in this application - these are all viewers created that still have at least one reference to them even if not currently shown.
Methods Documentation
- add_link(data1, attribute1, data2, attribute2)[source]#
Add a simple identity link between two attributes.
- Parameters:
- data1
Data
The dataset containing the first attribute.
- attribute1str or
ComponentID
The first attribute to link.
- data2
Data
The dataset containing the first attribute.
- attribute2str or
ComponentID
The first attribute to link.
- data1
- histogram1d(*, data=None, x=None, widget='bqplot', color=None, x_min=None, x_max=None, n_bin=None, normalize=False, cumulative=False, random_subset=None, viewer_state=None, layer_state=None, show=True)[source]#
Open an interactive histogram viewer.
- Parameters:
- datastr or
Data
, optional The initial dataset to show in the viewer. Additional datasets can be added later using the
add_data
method on the viewer object.- xstr or
ComponentID
, optional The attribute to show on the x axis.
- widget{‘bqplot’, ‘matplotlib’}
Whether to use bqplot or Matplotlib as the front-end.
- colorstr or tuple, optional
The color to use for the data. Note that this will have the effect of setting the data color for all viewers.
- x_minfloat, optional
The lower value of the range to compute the histogram in.
- x_maxfloat, optional
The upper value of the range to compute the histogram in.
- n_binint, optional
The number of bins in the histogram.
- normalizebool, optional
Whether to normalize the histogram.
- cumulativebool, optional
Whether to show a cumulative histogram.
- random_subsetint, optional
The maximum number of elements to use when computing a histogram. If there are more than this number of data points, a random subset is used.
- viewer_state
ViewerState
The initial state for the viewer (advanced).
- layer_state
LayerState
The initial state for the data layer (advanced).
- showbool, optional
Whether to show the view immediately (
True
) or whether to only show it later if theshow()
method is called explicitly (False
).
- datastr or
- imshow(*, data=None, x=None, y=None, widget='bqplot', show=True)[source]#
Open an interactive image viewer.
- Parameters:
- datastr or
Data
, optional The initial dataset to show in the viewer. Additional datasets can be added later using the
add_data
method on the viewer object.- xstr or
ComponentID
, optional The attribute to show on the x axis. This should be one of the pixel axis attributes.
- ystr or
ComponentID
, optional The attribute to show on the y axis. This should be one of the pixel axis attributes.
- widget{‘bqplot’, ‘matplotlib’}
Whether to use bqplot or Matplotlib as the front-end.
- showbool, optional
Whether to show the view immediately (
True
) or whether to only show it later if theshow()
method is called explicitly (False
).
- datastr or
- new_data_viewer(*args, **kwargs)[source]#
Create a new data viewer
This function can be called directly with the name of a viewer as the first parameter for any viewer types registered in the viewer_registry. Thus if a plug-in defines a viewer class as:
from glue_jupyter.registries import viewer_registry @viewer_registry("pluginviewer") class PluginViewer(Viewer): ...
then this viewer can be created in a glue-jupyter app via:
s = app.new_data_viewer('pluginviewer')
This is the preferred way to call viewers defined in external plugins.
- profile1d(*, data=None, x=None, widget='bqplot', show=True)[source]#
Open an interactive 1d profile viewer.
- Parameters:
- datastr or
Data
, optional The initial dataset to show in the viewer. Additional datasets can be added later using the
add_data
method on the viewer object.- xstr or
ComponentID
, optional The attribute to show on the x axis. This should be a pixel or world coordinate
ComponentID
.- widget{‘bqplot’, ‘matplotlib’}
Whether to use bqplot or Matplotlib as the front-end.
- showbool, optional
Whether to show the view immediately (
True
) or whether to only show it later if theshow()
method is called explicitly (False
).
- datastr or
- scatter2d(*, data=None, x=None, y=None, widget='bqplot', color=None, size=None, viewer_state=None, layer_state=None, show=True)[source]#
Open an interactive 2d scatter plot viewer.
- Parameters:
- datastr or
Data
, optional The initial dataset to show in the viewer. Additional datasets can be added later using the
add_data
method on the viewer object.- xstr or
ComponentID
, optional The attribute to show on the x axis.
- ystr or
ComponentID
, optional The attribute to show on the y axis.
- widget{‘bqplot’, ‘matplotlib’}
Whether to use bqplot or Matplotlib as the front-end.
- colorstr or tuple, optional
The color to use for the markers. Note that this will have the effect of setting the data color for all viewers.
- sizeint or float
The size to use for the markers. Note that this will have the effect of setting the marker size for all viewers.
- viewer_state
ViewerState
The initial state for the viewer (advanced).
- layer_state
LayerState
The initial state for the data layer (advanced).
- showbool, optional
Whether to show the view immediately (
True
) or whether to only show it later if theshow()
method is called explicitly (False
).
- datastr or
- scatter3d(*, data=None, x=None, y=None, z=None, widget='ipyvolume', show=True)[source]#
Open an interactive 3d scatter plot viewer.
- Parameters:
- datastr or
Data
, optional The initial dataset to show in the viewer. Additional datasets can be added later using the
add_data
method on the viewer object.- xstr or
ComponentID
, optional The attribute to show on the x axis.
- ystr or
ComponentID
, optional The attribute to show on the y axis.
- zstr or
ComponentID
, optional The attribute to show on the z axis.
- widget{‘ipyvolume’, ‘vispy’}
Whether to use ipyvolume or VisPy as the front-end.
- showbool, optional
Whether to show the view immediately (
True
) or whether to only show it later if theshow()
method is called explicitly (False
).
- datastr or
- set_subset_mode(mode)[source]#
Set the current subset mode.
By default, selections in viewers update the current subset by replacing the previous selection with the new selection. However it is also possible to combine the current selection with previous selections using boolean operations.
- Parameters:
- mode{‘new’, ‘replace’, ‘and’, ‘or’, ‘xor’, ‘not’}
The selection mode to use.
- subset(name, subset_state)[source]#
Create a new selection/subset.
- Parameters:
- namestr
The name of the new subset.
- subset_state
SubsetState
The definition of the subset. See the documentation at http://docs.glueviz.org/en/stable/python_guide/data_tutorial.html#defining-new-subsets for more information about creating subsets programmatically.
- subset_lasso2d(x_att, y_att, lasso_x, lasso_y)[source]#
Create a subset from a programmatic 2d lasso selection.
- Parameters:
- x_att
ComponentID
The attribute corresponding to the x values being selected.
- y_att
ComponentID
The attribute corresponding to the x values being selected.
- lasso_xiterable
The x values of the lasso.
- lasso_yiterable
The y values of the lasso.
- x_att
- subset_roi(attributes, roi)[source]#
Create a subset from a region of interest.
- Parameters:
- attributesiterable
The attributes on the x and y axis
- roi
Roi
The region of interest to use to create the subset.
- table(*, data=None, x=None, widget='ipyvuetify', viewer_state=None, layer_state=None, show=True)[source]#
Open an interactive table viewer.
- Parameters:
- datastr or
Data
, optional The dataset to show in the viewer.
- widget{‘ipyvuetify’, ‘matplotlib’}
Whether to use ipyvuetify or … as table viewer
- viewer_state
ViewerState
The initial state for the viewer (advanced).
- layer_state
LayerState
The initial state for the data layer (advanced).
- showbool, optional
Whether to show the view immediately (
True
) or whether to only show it later if theshow()
method is called explicitly (False
).
- datastr or
- volshow(*, data=None, x=None, y=None, z=None, widget='ipyvolume', show=True)[source]#
Open an interactive volume viewer.
- Parameters:
- datastr or
Data
, optional The initial dataset to show in the viewer. Additional datasets can be added later using the
add_data
method on the viewer object.- xstr or
ComponentID
, optional The attribute to show on the x axis. This should be one of the pixel axis attributes.
- ystr or
ComponentID
, optional The attribute to show on the y axis. This should be one of the pixel axis attributes.
- zstr or
ComponentID
, optional The attribute to show on the z axis. This should be one of the pixel axis attributes.
- widget{‘ipyvolume’, ‘vispy’}
Whether to use ipyvolume or VisPy as the front-end.
- showbool, optional
Whether to show the view immediately (
True
) or whether to only show it later if theshow()
method is called explicitly (False
).
- datastr or