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

BUG: Specviz2d to load both s2d and x1d when both provided separately #1717

Merged
merged 3 commits into from
Oct 12, 2022

Conversation

pllim
Copy link
Contributor

@pllim pllim commented Oct 11, 2022

Description

This pull request is to fix #1711 .

Screenshot 2022-10-10 205721

I don't know if we want to backport this or not. Feel free to change the milestone if we need to backport this.

Change log entry

  • Is a change log needed? If yes, is it added to CHANGES.rst? If you want to avoid merge conflicts,
    list the proposed change log here for review and add to CHANGES.rst before merge. If no, maintainer
    should add a no-changelog-entry-needed label.

Checklist for package maintainer(s)

This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.

  • Are two approvals required? Branch protection rule does not check for the second approval. If a second approval is not necessary, please apply the trivial label.
  • Do the proposed changes actually accomplish desired goals? Also manually run the affected example notebooks, if necessary.
  • Do the proposed changes follow the STScI Style Guides?
  • Are tests added/updated as required? If so, do they follow the STScI Style Guides?
  • Are docs added/updated as required? If so, do they follow the STScI Style Guides?
  • Did the CI pass? If not, are the failures related?
  • Is a milestone set?
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)?

when both provided separately.
@pllim pllim added the bug Something isn't working label Oct 11, 2022
@pllim pllim added this to the 3.1 milestone Oct 11, 2022
@codecov
Copy link

codecov bot commented Oct 11, 2022

Codecov Report

Base: 87.19% // Head: 87.27% // Increases project coverage by +0.08% 🎉

Coverage data is based on head (c6c28db) compared to base (ac58644).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1717      +/-   ##
==========================================
+ Coverage   87.19%   87.27%   +0.08%     
==========================================
  Files          95       95              
  Lines       10049    10097      +48     
==========================================
+ Hits         8762     8812      +50     
+ Misses       1287     1285       -2     
Impacted Files Coverage Δ
jdaviz/configs/specviz2d/helper.py 86.00% <100.00%> (+0.89%) ⬆️
jdaviz/configs/specviz2d/plugins/parsers.py 33.33% <0.00%> (-2.16%) ⬇️
jdaviz/configs/specviz/plugins/parsers.py 89.02% <0.00%> (-0.27%) ⬇️
jdaviz/configs/imviz/helper.py 96.68% <0.00%> (ø)
jdaviz/configs/imviz/plugins/parsers.py 100.00% <0.00%> (ø)
jdaviz/configs/cubeviz/plugins/parsers.py 63.31% <0.00%> (ø)
...igs/default/plugins/model_fitting/model_fitting.py 82.07% <0.00%> (+0.04%) ⬆️
jdaviz/app.py 94.05% <0.00%> (+0.99%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@pllim pllim requested a review from havok2063 October 11, 2022 14:15
Copy link
Collaborator

@havok2063 havok2063 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR works as expected. I tried loading Specviz2d with an s2d/x1d pair, with only an s2d file, and with only a x1d file.

Comment on lines 203 to +204
else:
load_1d = True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you set load_1d = True here on the else condition for line 156, i.e. when spectrum_2d is provided? Everything works as expected. Just trying to understand the flow here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line only gets run when spectrum_2d is not provided (None). So I expect you will see the 1D loaded but nothing shown for the 2D viewer. Unless I have misunderstood the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you mean, line 201? That is to load your separate x1d file. Without it, you see the issue that you reported in the first place. Or did I misunderstood your question?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant the load_1d at line 204. And yeah I think I see what you mean now. It allows the use case when only the 1d is provided but not the 2d. But would this cause an error at line 207, for the case when neither 2d nor 1d file is provided? In that case, looks like load_1d gets set to true, the 1d spectrum tries to load but spectrum_1d is None?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why would someone try to load_data without providing the data?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch on the logic though. I added a check above. Does that look good to you?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

who knows why some people do the things they do. I'm always of the opinion that someone somewhere will try the thing you think no one will try, and thus best safeguard against it. Haha. But this all looks good to me!

Comment on lines 203 to +204
else:
load_1d = True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

who knows why some people do the things they do. I'm always of the opinion that someone somewhere will try the thing you think no one will try, and thus best safeguard against it. Haha. But this all looks good to me!

Copy link
Member

@kecnry kecnry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems simple enough, thanks! If you think this qualifies for the bugfix release, feel free to move it before merge (I don't see any reason to hold it back even if its not something that we make use of in official example notebooks).

@pllim
Copy link
Contributor Author

pllim commented Oct 12, 2022

@havok2063 , how soon do you need this fix? 😬

@havok2063
Copy link
Collaborator

@pllim I don't consider this a critical fix, so I'm fine with this getting merged in on whatever schedule y'all feel is right. We still have to do testing for our update to 3.0.1, and aren't in a rush yet to push to prod. If this gets in a 3.0.2 release, I can easily update our existing PR to bump to the new version.

@pllim pllim merged commit 1cc352b into spacetelescope:main Oct 12, 2022
@pllim pllim deleted the specviz2d-unbreak-my-parser branch October 12, 2022 22:28
@pllim
Copy link
Contributor Author

pllim commented Oct 12, 2022

Thanks, all! Okay, not backporting then. But I created a merge commit, so if we ever change our minds, it is not hard to backport.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Specviz2d does not load pair s2d/x1d
3 participants