Skip to content
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

Specviz get_spectra() call does not return correctly with multiple spectra #1843

Closed
Jdaviz-Triage-Bot opened this issue Nov 15, 2022 · 6 comments · Fixed by #2087
Closed
Labels
bug Something isn't working specviz

Comments

@Jdaviz-Triage-Bot
Copy link

Reporter: Jesse Averbukh

This is first mentioned by Cami in JDAT-2594. To see the behavior, add two spectra to Specviz, then add multiple subsets. Then run specviz.get_spectra(). The output should imply that the subsets have a spectral axis that starts where the second spectra starts (assuming it is at a higher wavelength). The expected behavior is that the subset has a spectral axis that corresponds to the spectrum it is attached to.

A question for others, what is the expected output when a subset is attached to multiple spectra?


DISCLAIMER: This issue was autocreated by the Jdaviz Issue Creation Bot on behalf of the reporter. If any information is incorrect, please contact Duy Nguyen

@pllim pllim added bug Something isn't working specviz labels Nov 15, 2022
@pllim
Copy link
Contributor

pllim commented Nov 15, 2022

Definitely a bug. I think the Subset tied to the last loaded data overwrote all the previous ones. This is what is getting looped over for a use case with 2 spectra loaded and 1 subset:

for lyr in specviz.app._viewer_store['specviz-0'].layers:
    print(lyr)
BqplotProfileLayerArtist for myfile
BqplotProfileLayerArtist for Spectrum1D
BqplotProfileLayerArtist for Subset 1
BqplotProfileLayerArtist for Subset 1

Personally, I would expect get_spectra to return 4 entries, not 3:

  1. First spectrum
  2. Second spectrum
  3. Subset for first
  4. Subset for second

data[label] = layer_data

@kecnry
Copy link
Member

kecnry commented Nov 15, 2022

Ignoring the spectral-axis vs masking potential issue... options for supporting subsets attached to multiple spectra would either be to return nested dictionaries or to have the keys be data_label and data_label:subset_name.

@pllim
Copy link
Contributor

pllim commented Nov 16, 2022

Or do we want Subsets to be returned at all? Aren't Subsets turned into masks? So this should only return 2 entries right?

  1. First data with all the subsets turned into mask.
  2. Second data with all the subsets turned into mask.

@javerbukh
Copy link
Contributor

I think my current preference is the dictionary approach. It makes more sense to me for get_data_from_viewer("Subset 1") to return something (i.e. a dictionary with the subset mask applied to each data) rather than None.

@stscijgbot-jwql
Copy link

This issue is tracked on JIRA as JDAT-2925.

@stscijgbot-jwql
Copy link

Comment by Duy Nguyen on JIRA:

NOTICE: A corresponding GitHub issue was automatically created: #1843

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working specviz
Projects
None yet
5 participants