ConfigHelper

class jdaviz.core.helpers.ConfigHelper(app=None, verbosity='warning', history_verbosity='info')[source] [edit on github]

Bases: HubListener

The Base Helper Class. Provides shared abstracted helper methods to the user.

Subclasses should set _default_configuration if they are meant to be used with a specific configuration.

Parameters:
appApplication or None

The application object, or if None, creates a new one based on the default configuration for this helper.

verbosity{‘debug’, ‘info’, ‘warning’, ‘error’}

Verbosity of the popup messages in the application.

history_verbosity{‘debug’, ‘info’, ‘warning’, ‘error’}

Verbosity of the history logger in the application.

Attributes Summary

fitted_models

Returns the fitted models.

plugins

Access API objects for plugins in the plugin tray.

Methods Summary

batch_load()

Context manager to delay linking and loading data into viewers

get_data([data_label, cls])

Returns data with name equal to data_label of type cls.

get_model_parameters([models, model_label, x, y])

Convert each parameter of model inside models into a coordinate that maps the model name and parameter name to a astropy.units.Quantity object.

get_models([models, model_label, x, y])

Loop through all models and output models of the label model_label.

load_data(data[, data_label, parser_reference])

show([loc, title, height])

Display the Jdaviz application.

show_in_new_tab([title])

Preserved for backwards compatibility Shows Jdaviz in a sidecar in a new tab to the right

show_in_sidecar([anchor, title])

Preserved for backwards compatibility Shows Jdaviz in a sidecar with the default anchor: right

Attributes Documentation

fitted_models

Returns the fitted models.

Returns:
parametersdict

dict of astropy.modeling.Model objects, or None.

plugins

Access API objects for plugins in the plugin tray.

Returns:
pluginsdict

dict of plugin objects

Methods Documentation

batch_load()[source] [edit on github]

Context manager to delay linking and loading data into viewers

get_data(data_label=None, cls=None)[source] [edit on github]

Returns data with name equal to data_label of type cls.

Parameters:
data_labelstr, optional

Provide a label to retrieve a specific data set from data_collection.

clsSpectrum1D, CCDData, optional

The type that data will be returned as.

Returns:
datacls

Data is returned as type cls.

get_model_parameters(models=None, model_label=None, x=None, y=None)[source] [edit on github]

Convert each parameter of model inside models into a coordinate that maps the model name and parameter name to a astropy.units.Quantity object.

Parameters:
modelsdict

A dictionary where the key is a model name and the value is an astropy.modeling.CompoundModel object.

model_labelstr

Get model parameters for a particular model by inputting its label.

xint

The x coordinate of the model spaxels that will be returned from get_models.

yint

The y coordinate of the model spaxels that will be returned from get_models.

Returns:
dict:

a dictionary of the form {model name: {parameter name: [[astropy.units.Quantity]]}} for 3d models or {model name: {parameter name: astropy.units.Quantity}} where the Quantity object represents the parameter value and unit of one of spaxel models or the 1d models, respectively.

get_models(models=None, model_label=None, x=None, y=None)[source] [edit on github]

Loop through all models and output models of the label model_label. If x or y is set, return model_labels of those (x, y) coordinates. If x and y are None, print all models regardless of coordinates.

Parameters:
modelsdict

A dict of models, with the key being the label name and the value being an astropy.modeling.CompoundModel object. Defaults to fitted_models if no parameter is provided.

model_labelstr

The name of the model that will be found and returned. If it equals default, every model present will be returned.

xint

The x coordinate of the model spaxels that will be returned.

yint

The y coordinate of the model spaxels that will be returned.

Returns:
selected_modelsdict

Dictionary of the selected models.

load_data(data, data_label=None, parser_reference=None, **kwargs)[source] [edit on github]
show(loc='inline', title=None, height=None)[source] [edit on github]

Display the Jdaviz application.

Parameters:
locstr

The display location determines where to present the viz app. Supported locations:

“inline”: Display the Jdaviz application inline in a notebook. Note this is functionally equivalent to displaying the cell viz.app in the notebook.

“sidecar”: Display the Jdaviz application in a separate JupyterLab window from the notebook, the location of which is decided by the ‘anchor.’ right is the default

Other anchors:

  • sidecar:right (The default, opens a tab to the right of display)

  • sidecar:tab-before (Full-width tab before the current notebook)

  • sidecar:tab-after (Full-width tab after the current notebook)

  • sidecar:split-right (Split-tab in the same window right of the notebook)

  • sidecar:split-left (Split-tab in the same window left of the notebook)

  • sidecar:split-top (Split-tab in the same window above the notebook)

  • sidecar:split-bottom (Split-tab in the same window below the notebook)

See jupyterlab-sidecar for the most up-to-date options.

“popout”: Display the Jdaviz application in a detached display. By default, a new window will open. Browser popup permissions required.

Other anchors:

  • popout:window (The default, opens Jdaviz in a new, detached popout)

  • popout:tab (Opens Jdaviz in a new, detached tab in your browser)

titlestr, optional

The title of the sidecar tab. Defaults to the name of the application; e.g., “specviz”.

NOTE: Only applicable to a “sidecar” display.

height: int, optional

The height of the top-level application widget, in pixels. Applies to all instances of the same application in the notebook.

Notes

If “sidecar” is requested in the “classic” Jupyter notebook, the app will appear inline, as only JupyterLab has a mechanism to have multiple tabs.

show_in_new_tab(title=None)[source] [edit on github]

Preserved for backwards compatibility Shows Jdaviz in a sidecar in a new tab to the right

show_in_sidecar(anchor=None, title=None)[source] [edit on github]

Preserved for backwards compatibility Shows Jdaviz in a sidecar with the default anchor: right