Application

class jdaviz.app.Application(**kwargs)[source] [edit on github]

Bases: ipyvuetify.VuetifyTemplate.VuetifyTemplate, glue.core.hub.HubListener

The main application object containing implementing the ipyvue/vuetify template instructions for composing the interface.

Public constructor

Attributes Summary

components

An instance of a Python dict.

data_collection

Reference to the stored data collection instance, used to maintain the the data objects that been loaded into the application this session.

hub

Reference to the stored application handler hub instance.

session

Reference to the stored session instance.

state

template

A trait for unicode strings.

Methods Summary

add_data(data, data_label)

Add data to the Glue DataCollection.

add_data_to_viewer(viewer_reference, data_label)

Plots a data set from the data collection in the specific viewer.

get_data_from_viewer(viewer_reference[, …])

Returns each data component currently rendered within a viewer instance.

get_subsets_from_viewer(viewer_reference[, …])

Returns the subsets of a specified viewer converted to astropy regions objects.

get_viewer(viewer_reference)

Return a BqplotBaseView viewer instance.

load_configuration([path])

Parses the provided configuration yaml file and populates the appropriate state values with the results.

load_data(file_obj[, parser_reference])

Provided a path to a data file, open and parse the data into the DataCollection for this session.

remove_data_from_viewer(viewer_reference, …)

Removes a data set from the specified viewer.

vue_data_item_selected(event)

Callback for selection events in the front-end data list.

vue_destroy_viewer_item(cid)

Callback for when viewer area tabs are destroyed.

vue_relayout(*args, **kwargs)

Forces any rendered Bqplot instances to resize themselves.

vue_save_figure(event)

Callback for save figure events in the front end viewer toolbars.

Attributes Documentation

components

An instance of a Python dict.

One or more traits can be passed to the constructor to validate the keys and/or values of the dict. If you need more detailed validation, you may use a custom validator method.

Changed in version 5.0: Added key_trait for validating dict keys.

Changed in version 5.0: Deprecated ambiguous trait, traits args in favor of value_trait, per_key_traits.

data_collection

Reference to the stored data collection instance, used to maintain the the data objects that been loaded into the application this session.

Returns
glue.core.DataCollection

The DataCollection instance for this application session.

hub

Reference to the stored application handler hub instance.

Returns
glue.core.Hub

The internal Hub instance for the application.

session

Reference to the stored session instance.

Returns
glue.core.Session

The Session instance maintained by Glue for this application.

state
template

A trait for unicode strings.

Methods Documentation

add_data(data, data_label)[source] [edit on github]

Add data to the Glue DataCollection.

Parameters
dataany

Data to be stored in the DataCollection. This must either be a Data instance, or an arbitrary data instance for which there exists data translation functions in the glue astronomy repository.

data_labelstr, optional

The name associated with this data. If none is given, a generic name is generated.

add_data_to_viewer(viewer_reference, data_label, clear_other_data=False)[source] [edit on github]

Plots a data set from the data collection in the specific viewer.

Parameters
viewer_referencestr

The reference to the viewer defined with the reference key in the yaml configuration file.

data_labelstr

The Glue data label found in the DataCollection.

clear_other_databool

Removes all other currently plotted data and only shows the newly defined data set.

get_data_from_viewer(viewer_reference, data_label=None, cls='default', include_subsets=True)[source] [edit on github]

Returns each data component currently rendered within a viewer instance. Viewers themselves store a default data type to which the Glue data components are transformed upon retrieval. This can be optionally overridden with the cls keyword.

Parameters
viewer_referencestr

The reference to the viewer defined with the reference key in the yaml configuration file.

data_labelstr, optional

Optionally provide a label to retrieve a specific data set from the viewer instance.

clsclass

The class definition the Glue data components get transformed to when retrieved. This requires that a working set of translation functions exist in the glue_astronomy package. See https://github.com/glue-viz/glue-astronomy for more info. If this is the special string 'default', the default_class attribute of the viewer referenced by viewer_reference is used.

include_subsetsbool

Whether to include subset layer data that exists in the viewer but has not been included in the core data collection object.

Returns
datadict

A dict of the transformed Glue data objects, indexed to corresponding viewer data labels.

Notes

This is only used in cases where the viewers have been pre-defined in the configuration file. Otherwise, viewers are not stored via reference.

get_subsets_from_viewer(viewer_reference, data_label=None)[source] [edit on github]

Returns the subsets of a specified viewer converted to astropy regions objects.

It should be noted that the subset translation machinery lives in the glue-astronomy repository. Currently, the machinery only works on 2D data for cases like range selection. For e.g. a profile viewer that is ostensibly just a view into a 3D data set, it is necessary to first reduce the dimensions of the data, then retrieve the subset information as a regions object. This means that the returned y extents in the region are not strictly representative of the subset range in y.

Parameters
viewer_referencestr

The reference to the viewer defined with the reference key in the yaml configuration file.

data_labelstr, optional

Optionally provide a label to retrieve a specific data set from the viewer instance.

Returns
datadict

A dict of the transformed Glue subset objects, with keys representing the subset name and values as astropy regions objects.

get_viewer(viewer_reference)[source] [edit on github]

Return a BqplotBaseView viewer instance. This is not an IPyWidget. This is stored here because the state of the viewer and data methods that allow add/removing data to the viewer exist in a wrapper around the core IPyWidget, which is needed to interact with the data rendered within a viewer.

Parameters
viewer_referencestr

The reference to the viewer defined with the reference key in the yaml configuration file.

Returns
BqplotBaseView

The viewer class instance.

Notes

This is only used in cases where the viewers have been pre-defined in the configuration file. Otherwise, viewers are not stored via reference.

load_configuration(path=None)[source] [edit on github]

Parses the provided configuration yaml file and populates the appropriate state values with the results.

Parameters
pathstr, optional

Path to the configuration file to be loaded. In the case where this is None, it loads the default configuration. Optionally, this can be provided as name reference. NOTE This optional way to define the configuration will be removed in future versions.

load_data(file_obj, parser_reference=None, **kwargs)[source] [edit on github]

Provided a path to a data file, open and parse the data into the DataCollection for this session. This also attempts to find WCS links that exist between data components. Extra key word arguments are passed to the parsing functions.

Parameters
file_objstr or file-like

File object for the data to be loaded.

remove_data_from_viewer(viewer_reference, data_label)[source] [edit on github]

Removes a data set from the specified viewer.

Parameters
viewer_referencestr

The reference to the viewer defined with the reference key in the yaml configuration file.

data_labelstr

The Glue data label found in the DataCollection.

vue_data_item_selected(event)[source] [edit on github]

Callback for selection events in the front-end data list. Selections mean that the checkbox associated with the list item has been toggled. When the checkbox is toggled off, remove the data from the viewer; when it is toggled on, add the data to the viewer.

Parameters
eventdict

Traitlet event provided the ‘old’ and ‘new’ values.

vue_destroy_viewer_item(cid)[source] [edit on github]

Callback for when viewer area tabs are destroyed. Finds the viewer item associated with the provided id and removes it from the stack_items list.

Parameters
cidstr

The UUID associated with the viewer item dictionary.

vue_relayout(*args, **kwargs)[source] [edit on github]

Forces any rendered Bqplot instances to resize themselves.

vue_save_figure(event)[source] [edit on github]

Callback for save figure events in the front end viewer toolbars. Uses the bqplot.Figure save methods.