-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin: spectral extraction #1514
Merged
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
873e2e7
spectral extraction plugin - basic trace support
kecnry 55c2984
add support for offsetting/shifting an existing trace
kecnry cd199c1
improved layer icon/label support for traces
kecnry 208e069
remove plugin marks logic
kecnry 270ece4
changes entry
kecnry 2c138a8
minimal plugin test coverage
kecnry 8726bce
barebones specviz2d plugin docs
kecnry a9fd4ca
add traitlet/widget for extraction window width
kecnry e555d8b
simple vs advanced mode: don't require outputting at intermediate steps
kecnry 403fdc0
live-preview of trace/background/extraction regions
kecnry e8c92a1
hookup specreduce calls for background/extract steps
kecnry 9d93e90
fix trace-offsetting
kecnry cf77854
data menu multiselect: trace objects are excluded from radio logic
kecnry 8665e42
visual feedback of trace to silently ignore errors
kecnry 1015506
test and docs coverage for background/extract steps
kecnry d4d2c36
show live-preview of extracted spectrum
kecnry 4d2f370
use plugin for initial 1D spectrum (if not provided)
kecnry 1425774
add spectral-extraction plugin to API docs
kecnry 5c6fd37
use mouseover events to change active_step (controls visible marks)
kecnry 9c78b8e
specviz2d: do not allow unloading original reference data
kecnry a09fba2
background/subtracted-background: fix linking from plugin output
kecnry 0e6080c
simplify plugin logic
kecnry dfcd1d6
set correct spectral axis on extracted spectrum
kecnry 6d2f465
remove support for peak_method
kecnry fb284c1
extraction to expose/plot in pixels
kecnry 4f6eb1d
disable line lists and line analysis plugins when spectrum in pixels
kecnry 4cc451a
fix failing tests
kecnry c5cdfd2
consistent default for add_data in API methods
kecnry 10f9d63
API to display marks without having to manually open the plugin
kecnry 5cd693c
update changelog
kecnry ed1c396
remove support for importing/exporting trace
kecnry 0ac7c8b
fixed trace live-feedback updating when changing type
kecnry 6550135
Apply suggestions from code review
kecnry 31ff49e
remove white "shadows" from spectral extraction live-previews
kecnry 74766f9
change buttons from Background/Subtract to Export
kecnry c42f1af
improve comment language
kecnry ffe90ea
fix two-sided to actually be two-sided
kecnry File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.. image:: ../logos/specviz2d.svg | ||
:width: 400 | ||
|
||
.. _specviz2d: | ||
|
||
######### | ||
Specviz2D | ||
######### | ||
|
||
Specviz2d is a tool for visualization and quick-look analysis of 2D astronomical spectra. | ||
|
||
.. We do not want a real section here so navbar shows toc directly. | ||
|
||
**Using Specviz** | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
.. _specviz2d-plugins: | ||
|
||
********************* | ||
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 :guilabel:`plugin` | ||
icon in the upper right corner of the Specviz application. | ||
|
||
.. _specviz2d-metadata-viewer: | ||
|
||
Metadata Viewer | ||
=============== | ||
|
||
.. seealso:: | ||
|
||
:ref:`Metadata Viewer <imviz_metadata-viewer>` | ||
Imviz documentation on using the metadata viewer. | ||
|
||
.. _specviz2d-plot-options: | ||
|
||
Plot Options | ||
============ | ||
|
||
.. seealso:: | ||
|
||
:ref:`Spectral Plot Options <specviz-plot-settings>` | ||
Documentation on further details regarding the plot setting controls. | ||
|
||
.. _specviz2d-subset-plugin: | ||
|
||
Subset Tools | ||
============ | ||
|
||
.. seealso:: | ||
|
||
:ref:`Subset Tools <imviz-subset-plugin>` | ||
Imviz documentation describing the concept of subsets in Jdaviz. | ||
|
||
.. _specviz2d-spectral-extraction: | ||
|
||
Spectral Extraction | ||
=================== | ||
|
||
The Spectral Extraction plugin exposes `specreduce <https://specreduce.readthedocs.io>`_ | ||
methods for tracing, background subtraction, and spectral extraction from 2D spectra. | ||
|
||
Trace | ||
----- | ||
|
||
The first section of the plugin allows for creating and visualizing | ||
`specreduce Trace <https://specreduce.readthedocs.io/en/latest/#module-specreduce.tracing>`_ | ||
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. | ||
|
||
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:: | ||
|
||
viz.app.add_data(my_trace) | ||
|
||
and then added to the viewer through the data menu. | ||
|
||
Once trace objects are loaded into the app, they can be offset (in the cross-dispersion direction) | ||
by selecting the trace label, entering an offset, and overwriting the existing data entry (or | ||
creating a new one) with the modified trace. | ||
|
||
Background | ||
---------- | ||
|
||
The background step of the plugin allows for creating background and background-subtracted | ||
images via `specreduce.background <https://specreduce.readthedocs.io/en/latest/#module-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 will change to show the center (dotted line) and edges | ||
(solid lines) of the background region(s). Choose between creating the background | ||
around the trace defined in the Trace section, or around a "Manual" flat trace. | ||
|
||
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. | ||
|
||
Extract | ||
------- | ||
|
||
The extraction step of the plugin extracts a 1D spectrum from an input 2D spectrum via | ||
`specreduce.extract <https://specreduce.readthedocs.io/en/latest/#module-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. | ||
|
||
|
||
.. _specviz2d-gaussian-smooth: | ||
|
||
Gaussian Smooth | ||
=============== | ||
|
||
.. seealso:: | ||
|
||
:ref:`Gaussian Smooth <gaussian-smooth>` | ||
Specviz documentation on Gaussian Smooth. | ||
|
||
.. _specviz2d-model-fitting: | ||
|
||
Model Fitting | ||
============= | ||
|
||
.. seealso:: | ||
|
||
:ref:`Model Fitting <specviz-model-fitting>` | ||
Specviz documentation on Model Fitting. | ||
|
||
|
||
.. _specviz2d-unit-conversion: | ||
|
||
Unit Conversion | ||
=============== | ||
|
||
.. seealso:: | ||
|
||
:ref:`Unit Conversion <unit-conversion>` | ||
Specviz documentation on Unit Conversion. | ||
|
||
|
||
.. _specviz2d-line-lists: | ||
|
||
Line Lists | ||
========== | ||
|
||
.. seealso:: | ||
|
||
:ref:`Line Lists <line-lists>` | ||
Specviz documentation on Line Lists. | ||
|
||
|
||
.. _specviz2d-line-analysis: | ||
|
||
Line Analysis | ||
============= | ||
|
||
.. seealso:: | ||
|
||
:ref:`Line Analysis <line-analysis>` | ||
Specviz documentation on Line Analysis. | ||
|
||
.. _specviz2d-export-plot: | ||
|
||
Export Plot | ||
=========== | ||
|
||
This plugin allows exporting the plot in a given viewer to various image formats. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,15 +15,15 @@ | |
<template slot="selection" slot-scope="data"> | ||
<div class="single-line"> | ||
<span> | ||
<v-icon style='margin-right: 2px'>{{ data.item.icon }}</v-icon> | ||
<v-icon v-if="data.item.icon" style='margin-right: 2px'>{{ data.item.icon }}</v-icon> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this just makes the left of the entries with and without icons line up better. I also applied this across all other instances, even though not all dropdowns use "manual entries". |
||
{{ data.item.label }} | ||
</span> | ||
</div> | ||
</template> | ||
<template slot="item" slot-scope="data"> | ||
<div class="single-line"> | ||
<span> | ||
<v-icon style='margin-right: 2px'>{{ data.item.icon }}</v-icon> | ||
<v-icon v-if="data.item.icon" style='margin-right: 2px'>{{ data.item.icon }}</v-icon> | ||
{{ data.item.label }} | ||
</span> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add specviz2d stuff to API docs too?
Also add new Specviz2D section to change log template in the release instructions?
On GitHub itself, should I create a new Specviz2D label and add corresponding Issue and Bug templates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since specviz2d is currently used by MAST (which links to a non-existent RTD page), I think we should... and we can always merge with mosviz later if we decide to go that route. Full docs are out-of-scope for this PR, I think/hope, but I just put the bare minimum so that all the plugin links point somewhere appropriate.
I added a specviz2d label in GitHub already (for this PR) and added a custom section in the change log (but not the template). The helper was already in the docs, but I'll add this plugin as well, thanks for catching that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The book-keeping stuff (templates, release instructions) can be done after this is merged. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll let @rosteen decide if anything in JIRA needs updating to include specviz2d...