Skip to content

Latest commit

 

History

History
256 lines (160 loc) · 9.08 KB

plugins.rst

File metadata and controls

256 lines (160 loc) · 9.08 KB

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 Specviz application.

Metadata Viewer

Metadata Viewer <imviz_metadata-viewer>

Imviz documentation on using the metadata viewer.

Plot Options

Plot Options <specviz-plot-options>

Specviz documentation on the plot options plugin.

Subset Tools

Subset Tools <imviz-subset-plugin>

Imviz documentation describing the concept of subsets in Jdaviz.

Markers

Markers <markers-plugin>

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 = viz.app.get_tray_item_from_name('spectral-extraction')

Trace

The first section of the plugin allows for creating and visualizing :pyspecreduce.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.

Trace objects created outside of jdaviz can be loaded into the app via :py~jdaviz.configs.specviz2d.helper.Specviz2d.load_trace:

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

and then added to the viewer through the data menu.

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.

To export and access the specreduce Trace object defined in the plugin, call :py~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.export_trace:

trace = sp_ext.export_trace()

To import the parameters from a specreduce Trace object, whether it's new or was exported and modified in the notebook, call :py~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.import_trace:

sp_ext.import_trace(trace)

Background

The background step of the plugin allows for creating background and background-subtracted images via :pyspecreduce.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, and can be exported into the notebook via the API <specviz2d-export-data-2d>. To refine the trace based on the background-subtracted image, return to the Trace step and select the exported background-subtracted image as input.

To export and access the specreduce Background object defined in the plugin, call :py~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.export_bg:

bg = sp_ext.export_bg()

To access the background image, background spectrum, or background-subtracted image as a ~specutils.Spectrum1D object, call :py~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.export_bg_img, :py~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.export_bg_spectrum, or :py~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.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 :py~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.import_bg:

sp_ext.import_bg(bg)

Extract

The extraction step of the plugin extracts a 1D spectrum from an input 2D spectrum via :pyspecreduce.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 <specviz2d-export-data-1d> in the same way as any other data product in the spectrum viewer.

To export and access the specreduce extraction object defined in the plugin, call :py~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.export_extract:

ext = sp_ext.export_extract()

To access the extracted spectrum as a ~specutils.Spectrum1D object, call :py~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.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 :py~jdaviz.configs.specviz2d.plugins.spectral_extraction.spectral_extraction.SpectralExtraction.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.

Gaussian Smooth

Gaussian Smooth <gaussian-smooth>

Specviz documentation on Gaussian Smooth.

Model Fitting

Model Fitting <specviz-model-fitting>

Specviz documentation on Model Fitting.

Unit Conversion

Unit Conversion <unit-conversion>

Specviz documentation on Unit Conversion.

Line Lists

Note

The line lists plugin is currently disabled if the 1D spectrum was automatically extracted and/or the 1D spectrum's x-axis is in pixels.

Line Lists <line-lists>

Specviz documentation on Line Lists.

Line Analysis

Note

The line analysis plugin is currently disabled if the 1D spectrum was automatically extracted and/or the 1D spectrum's x-axis is in pixels.

Line Analysis <line-analysis>

Specviz documentation on Line Analysis.

Export Plot

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