-
Notifications
You must be signed in to change notification settings - Fork 153
Spectral Analysis
This section of the wiki is intended to be a repository of discussion concerning spectral analysis and how glue would fit into tools for spectral analysis. The intent is to provide some scenarios to work with and to discuss how to best adapt/enhance the glue core to support apps built upon the glue core.
- Big picture thoughts
- Dirt simple scenario
- Existing implementations as examples of functionality:
- Specview.
- IRAF's splot
- Glue Model Fitter
I (jde) believe Chris already has thoughts on this; fix the following as necessary.
From a "high-level" vantage point, a spectrum data viewer would be created. In this viewer, one would be able to specify a set of tools (plugins?) that would allow for various operations, such as fitting (models), spectral math, navigation, over-plotting, etc.
One approach involves using the already existing spectrum/PV slice extraction tools. Instead of simply being a tool, implement one of these as a full-fledged data viewer and make the "options" individual tools in and of themselves.
Right now I'm wresting with how this tool integrates with the rest of Glue. Most of Glue's UI right now focuses on selection / linked brushing. That doesn't seem directly relevant to the required functionality for a spectral analysis tool (aside from the fact that Glue would be useful for finding the region in a 3D cube to extract spectra from, and for examining the results of, say, subtracting a spectral model out of a full cube).
One obvious area of overlap is the generic task of building MPL-based GUIs. There's a lot of code in Glue to implement pieces of the functionality needed here. We could refactor those pieces as needed, so that they can be extracted and used for a different purpose (spectral extraction). Some examples:
- The echo and widget properties modules make it easy to wrap the state of GUIs inside python properties, and to attach callback functions to these properties
- There are functions in https://github.com/glue-viz/glue/blob/master/glue/qt/mouse_mode.py that enable different drawing operations on plots. Right now lots of these are coupled to defining ROIs for selection, but we could generalize them to perform drawing operations, and then use them to make it easier to aid in line ID
- There's a first attempt at spectral analysis in glue described at http://www.glueviz.org/en/latest/spectrum.html
As I write this, I think the best way forward is to build a spectral line fitter prototype that uses Glue code where possible, but that doesn't initially try to fit into the main Glue UI per-se. I suspect that once something like that exists, we could nudge it into something that could become a Glue plugin tool or data viewer.
We've come to very much similar conclusions! There are two aspects I see where the multi-object viewing and data linking may come into play down the line. One is the manipulation of models in and of themselves, i.e. independent of "real" data. The thought is that one can have a model, or composite of models, in one viewer, and one or more spectra in other viewers, linked together. Thus manipulations of a model can be made that would then be applied to the spectra, using ROI's to determine fit ranges, etc.
The other aspect is similar to the case you have presented, extracted spectra from their source 2D image, but with a slight twist: mapping of objects in an image to their respective spectra. This is particularly relevant for THE NIRSpec MSA mode: using the mapping of the MSA between an image and resulting spectra, one could visualize, using ROI's, that relationship.
Neither of these additional scenarios may fit the current GUI design, but using various individual aspects already developed for glue would go a long way to app development to handle these situations. The starting point would definitely be a simple 1D data viewer.