Data Analysis Plugins#

The Specviz2D data analysis plugins are meant to aid quick-look analysis of 2D spectroscopic data. All plugins are accessed via the plugin icon in the upper right corner of the Specviz2d application.

Metadata Viewer#

See also

Metadata Viewer

Imviz documentation on using the metadata viewer.

Plot Options#

See also

Plot Options

Specviz documentation on the plot options plugin.

Subset Tools#

See also

Subset Tools

Imviz documentation describing the concept of subsets in Jdaviz.

Markers#

See also

Markers

Imviz documentation describing the markers plugin.

Spectral Extraction#

The Spectral Extraction plugin exposes specreduce methods for tracing, background subtraction, and spectral extraction from 2D spectra.

To interact with the plugin via the API in a notebook, access the plugin object via:

sp_ext = specviz2d.plugins['Spectral Extraction']

Trace#

The first section of the plugin allows for creating and visualizing specreduce.tracing.Trace objects.

Once you interact with any of the inputs in the extract step or hover over that area of the plugin, the live visualization will change to show the trace as a solid line in the 2D spectrum viewer.

To create a new trace in the plugin, choose the desired “Trace Type” and edit any input arguments. A preview of the trace will update in real time in the 2D spectrum viewer.

To export the trace as a data object into the 2D spectrum viewer (to access via the API or to adjust plotting options), open the “Export Trace” panel, choose a label for the new data entry, and click “Create”. Note that this step is not required to create an extraction with simple workflows.

Suppose you have 2D spectra of an extended source, and you have already created a trace that follows the bright central region of the source. It is possible to create a new trace, with the same 2D shape as the trace of the central region, but offset in the spatial direction. This might be useful for extracting spectra from the faint outer regions of the extended source, while using a trace computed from the brighter inner region. You can create a new trace based on the existing trace by clicking the “Trace” dropdown and selecting the existing trace. Then, offset it in the spatial direction by clicking or entering the spatial offset, and save it by creating a new trace or overwriting the existing trace entry.

From the API#

Trace parameters can be set from the notebook by accessing the plugin.

sp_ext.trace_type = 'Polynomial'
sp_ext.trace_order = 2
sp_ext.trace_window = 10
sp_ext.trace_peak_method = 'Gaussian'

To export and access the specreduce Trace object defined in the plugin, call export_trace():

trace = sp_ext.export_trace()

Trace objects created outside of jdaviz can be loaded into the app via load_trace():

specviz2d.load_trace(my_trace, data_label="my trace")

or directly into the plugin as

sp_ext.import_trace(my_trace)

Background#

The background step of the plugin allows for creating background and background-subtracted images via specreduce.background.

Once you interact with any of the inputs in the background step or hover over that area of the plugin, the live visualization in the 2D spectrum viewer will change to show the center (dotted line) and edges (solid lines) of the background region(s). The 1D representation of the background will also be visualized in the 1D spectrum viewer (thin, solid line).

Backgrounds can either be created around the trace defined in the earlier Trace section or around a new, flat trace by selecting “Manual” in the Background Type dropdown.

To visualize the resulting background or background-subtracted image, click on the respective panel, and choose a label for the new data entry. The exported images will now appear in the data dropdown menu in the 2D spectrum viewer. To refine the trace based on the background-subtracted image, return to the Trace step and select the exported background-subtracted image as input.

From the API#

Background parameters can be set from the notebook by accessing the plugin.

sp_ext.bg_type = 'TwoSided'
sp_ext.bg_separation = 8
sp_ext.bg_width = 6

To export and access the specreduce Background object defined in the plugin, call export_bg():

bg = sp_ext.export_bg()

To access the background image, background spectrum, or background-subtracted image as a Spectrum1D object, call export_bg_img(), export_bg_spectrum(), or export_bg_sub(), respectively.

To import the parameters from a specreduce Background object into the plugin, whether it’s new or was exported and modified in the notebook, call import_bg():

sp_ext.import_bg(bg)

Extract#

The extraction step of the plugin extracts a 1D spectrum from an input 2D spectrum via specreduce.extract.

Once you interact with any of the inputs in the extract step or hover over that area of the plugin, the live visualization will change to show the center (dotted line) and edges (solid lines) of the extraction region.

The input 2D spectrum defaults to “From Plugin”, which will use the settings defined in the Background step to create a background-subtracted image without needing to export it into the app itself. To use a different 2D spectrum loaded in the app (or exported from the Background step), choose that from the dropdown instead. To skip background subtraction, choose the original 2D spectrum as input.

To visualize or export the resulting 2D spectrum, provide a data label and click “Extract”. The resulting spectrum object can be accessed from the API in the same way as any other data product in the spectrum viewer.

From the API#

Extraction parameters can be set from the notebook by accessing the plugin.

sp_ext.ext_type = 'Boxcar'
sp_ext.ext_width = 8

To export and access the specreduce extraction object defined in the plugin, call export_extract():

ext = sp_ext.export_extract()

To access the extracted spectrum as a Spectrum1D object, call export_extract_spectrum().

To import the parameters from a specreduce extraction object (either a new object, or an exported one modified in the notebook) into the plugin, call import_extract():

sp_ext.import_extract(ext)

Note

Horne extraction uses uncertainties on the input 2D spectrum. If the spectrum uncertainties are not explicitly assigned a type, they are assumed to be standard deviation uncertainties. If no uncertainty is provided, it is assumed to be an array of ones.

Gaussian Smooth#

See also

Gaussian Smooth

Specviz documentation on Gaussian Smooth.

Model Fitting#

See also

Model Fitting

Specviz documentation on Model Fitting.

Unit Conversion#

See also

Unit Conversion

Specviz documentation on Unit Conversion.

Line Lists#

Note

The line lists plugin is currently disabled if the 1D spectrum’s x-axis is in pixels.

See also

Line Lists

Specviz documentation on Line Lists.

Line Analysis#

Note

The line analysis plugin is currently disabled if the 1D spectrum’s x-axis is in pixels.

See also

Line Analysis

Specviz documentation on Line Analysis.

Export#

This plugin allows exporting the plot in a given viewer to various image formats.