Application
- class jdaviz.app.Application(**kwargs: Any)[source] [edit on github]
Bases:
VuetifyTemplate
,HubListener
The main application object containing implementing the ipyvue/vuetify template instructions for composing the interface.
Public constructor
Attributes Summary
A trait for unicode strings.
Reference to the stored
DataCollection
instance, used to maintain the the data objects that been loaded into the application this session.Verbosity of the logger history, choose from
'debug'
,'info'
(default),'warning'
, or'error'
.Reference to the stored application handler
Hub
instance for the application.A boolean (True, False) trait.
A trait which allows any value.
Reference to the stored
Session
instance maintained by Glue for this application.A trait for unicode strings.
Verbosity of the application for popup snackbars, choose from
'debug'
,'info'
,'warning'
(default), or'error'
.Methods Summary
add_data
(data[, data_label, notify_done])Add data to the Glue
DataCollection
.add_data_to_viewer
(viewer_reference, data_path)Plots a data set from the data collection in the specific viewer.
get_configuration
([path, section])Returns a copy of the application configuration.
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_tray_item_from_name
(name)Return the instance of a tray item for a given name.
get_viewer
(viewer_reference)Return a
BqplotBaseView
viewer instance.get_viewer_by_id
(vid)Like
get_viewer()
but use ID instead of reference name.get_viewer_ids
([prefix])Return a list of available viewer IDs.
Return a list of available viewer reference names.
load_configuration
([path, config])Parses the provided input into a configuration dictionary 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_call_viewer_method
(event)vue_close_snackbar_message
(event)Callback to close a message in the snackbar when the "close" button is clicked.
vue_data_item_remove
(event)vue_data_item_selected
(event)Callback for selection events in the front-end data list.
vue_data_item_visibility
(event)Callback for when viewer area tabs are destroyed.
vue_relayout
(*args, **kwargs)Forces any rendered
Bqplot
instances to resize themselves.Attributes Documentation
- config
A trait for unicode strings.
- data_collection
Reference to the stored
DataCollection
instance, used to maintain the the data objects that been loaded into the application this session.
- history_verbosity
Verbosity of the logger history, choose from
'debug'
,'info'
(default),'warning'
, or'error'
.
- loading
A boolean (True, False) trait.
- popout_button
A trait which allows any value.
- state
- template_file = ('/home/docs/checkouts/readthedocs.org/user_builds/jdaviz/envs/v2.9.0/lib/python3.9/site-packages/jdaviz/app.py', 'app.vue')
- vdocs
A trait for unicode strings.
- verbosity
Verbosity of the application for popup snackbars, choose from
'debug'
,'info'
,'warning'
(default), or'error'
.
Methods Documentation
- add_data(data, data_label=None, notify_done=True)[source] [edit on github]
Add data to the Glue
DataCollection
.- Parameters
- dataany
Data to be stored in the
DataCollection
. This must either be aData
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, label is pulled from the input data (if
Data
) or a generic name is generated.- notify_done: bool
Flag controlling whether a snackbar message is set when the data is added to the app. Set to False to avoid overwhelming the user if lots of data is getting loaded at once.
- add_data_to_viewer(viewer_reference, data_path, clear_other_data=False, ext=None)[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_pathstr
Either the data filename or 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.
- ext: str
The data extension to access from a file. If data_path is a filename, ext is required.
- get_configuration(path=None, section=None)[source] [edit on github]
Returns a copy of the application configuration.
Returns a copy of the configuration specification. If path is not specified, returns the currently loaded configuration.
- Parameters
- pathstr, optional
path to the configuration file to be retrieved.
- sectionstr, optional
A section of the configuration to retrieve.
- Returns
- cfgdict
A configuration specification dictionary.
- 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'
, thedefault_class
attribute of the viewer referenced byviewer_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, subset_type=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.
- subset_typestr, optional
Optionally specify either “spectral” or “spatial” to return only subsets created in a profile (spectrum) viewer or image viewer, respectively.
- Returns
- datadict
A dict of the transformed Glue subset objects, with keys representing the subset name and values as astropy regions objects.
- get_tray_item_from_name(name)[source] [edit on github]
Return the instance of a tray item for a given name. This is useful for direct programmatic access to Jdaviz plugins registered under tray items.
- Parameters
- namestr
The name used when the plugin was registered to an internal
TrayRegistry
.
- Returns
- tray_itemobj
The instance of the plugin registered to tray items.
- Raises
- KeyError
Name not found.
- get_viewer(viewer_reference)[source] [edit on github]
Return a
BqplotBaseView
viewer instance. This is not anIPyWidget
. 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 coreIPyWidget
, 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.
- get_viewer_by_id(vid)[source] [edit on github]
Like
get_viewer()
but use ID instead of reference name. This is useful when reference name isNone
.
- get_viewer_ids(prefix=None)[source] [edit on github]
Return a list of available viewer IDs.
- get_viewer_reference_names()[source] [edit on github]
Return a list of available viewer reference names.
- load_configuration(path=None, config=None)[source] [edit on github]
Parses the provided input into a configuration dictionary and populates the appropriate state values with the results. Provided input can either be a configuration YAML file or a pre-made configuration dictionary.
- 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.- configdict, optional
A dictionary of configuration settings to be loaded. The dictionary contents should be the same as a YAML config file specification.
- 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_path, ext=None)[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_pathstr
Either the data filename or the Glue data label found in the
DataCollection
.- ext: str
The data extension to access from a file. If data_path is a filename, ext is required.
- vue_call_viewer_method(event)[source] [edit on github]
- vue_close_snackbar_message(event)[source] [edit on github]
Callback to close a message in the snackbar when the “close” button is clicked.
- vue_data_item_remove(event)[source] [edit on github]
- 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_data_item_visibility(event)[source] [edit on github]
- 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 viewer ID associated with the viewer item dictionary.
- vue_relayout(*args, **kwargs)[source] [edit on github]
Forces any rendered
Bqplot
instances to resize themselves.