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

Assign Row to NIRISS-parsed 1D Spectra #1836

Merged
merged 9 commits into from
Nov 14, 2022

Conversation

duytnguyendtn
Copy link
Collaborator

@duytnguyendtn duytnguyendtn commented Nov 10, 2022

Description

This PR adds a 1 line fix to the NIRISS parser to assign the mosviz_row meta to the 1D spectra.

Because this was such a quick fix, I also took the liberty of cleaning up the niriss and nirspec tests. This was so that I could add a test line to check for this bug in both our NIRISS and NIRspec tests

Fixes #1805

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? Set this to bugfix milestone if this is a bug fix and needs to be released ASAP; otherwise, set this to the next major release milestone.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)?

@duytnguyendtn duytnguyendtn added this to the 3.1.1 milestone Nov 10, 2022
@duytnguyendtn duytnguyendtn added the 💤backport-v3.1.x on-merge: backport to v3.1.x label Nov 10, 2022
@codecov
Copy link

codecov bot commented Nov 10, 2022

Codecov Report

Base: 88.15% // Head: 88.15% // Increases project coverage by +0.00% 🎉

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

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1836   +/-   ##
=======================================
  Coverage   88.15%   88.15%           
=======================================
  Files          95       95           
  Lines       10279    10280    +1     
=======================================
+ Hits         9061     9062    +1     
  Misses       1218     1218           
Impacted Files Coverage Δ
jdaviz/configs/mosviz/plugins/parsers.py 91.13% <100.00%> (+0.02%) ⬆️

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 added the bug Something isn't working label Nov 11, 2022
Copy link
Contributor

@pllim pllim left a comment

Choose a reason for hiding this comment

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

👍 for test clean-up. Thanks!

jdaviz/configs/mosviz/tests/test_parsers.py Outdated Show resolved Hide resolved
jdaviz/configs/mosviz/tests/test_parsers.py Outdated Show resolved Hide resolved
jdaviz/configs/mosviz/tests/test_parsers.py Outdated Show resolved Hide resolved
jdaviz/configs/mosviz/tests/test_parsers.py Outdated Show resolved Hide resolved
jdaviz/configs/mosviz/tests/test_parsers.py Show resolved Hide resolved
assert spec1d.label == f"1D Spectrum {i}"
spec2d = mosviz_helper.app.data_collection[i+11]
assert spec2d.label == f"2D Spectrum {i}"
assert int(spec1d.meta['SOURCEID']) == int(spec2d.meta['SOURCEID'])
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the int casting necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So the reasoning here was that I wanted to make sure to avoid situation of None == None . We know the source ids in this dataset are numbers, so I wanted to make sure we were getting back actual values rather than the same, nonsensical thing

Copy link
Contributor

@pllim pllim left a comment

Choose a reason for hiding this comment

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

Code LGTM. Thanks!

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.

Awesome, thanks!

@pllim pllim merged commit b28ad12 into spacetelescope:main Nov 14, 2022
@lumberbot-app
Copy link

lumberbot-app bot commented Nov 14, 2022

Oops, something went wrong applying the patch ... Please have a look at my logs.

@pllim
Copy link
Contributor

pllim commented Nov 14, 2022

Hmm, auto backport failed. Do we really need to backport this? If so, @duytnguyendtn will need to manually do it.

@pllim
Copy link
Contributor

pllim commented Nov 14, 2022

(I alerted the backport bot dev on how it is no longer applying follow-up label and proper manual backport message on failed backport.)

@duytnguyendtn
Copy link
Collaborator Author

I'm not particularly tied to this being backport @pllim. This bug has been in mosviz for quite some time (over a year) so I can't imagine anyone's desperate to get this fixed ASAP. It doesn't impact mosviz's core functionality.

What should we do with the existing milestones? How do we switch this back to 3.2 AFTER the merge? is it just as simple as changing the milestone and removing the backport label?

@pllim pllim modified the milestones: 3.1.1, 3.2 Nov 14, 2022
@pllim pllim removed Still Needs Manual Backport 💤backport-v3.1.x on-merge: backport to v3.1.x labels Nov 14, 2022
@pllim
Copy link
Contributor

pllim commented Nov 14, 2022

It is! I did that for you. 😸

@duytnguyendtn
Copy link
Collaborator Author

I guess we also need to move the changelog entry. Should I make a PR for that?

@@ -110,6 +110,8 @@ Mosviz

- Data unassigned a row is hidden under the subdropdown in the data dropdown. [#1798, #1808]

- Missing mosviz_row metadata in NIRISS-parsed 1D spectra now added. [#1836]
Copy link
Contributor

Choose a reason for hiding this comment

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

@duytnguyendtn , do you want to open a follow-up PR to move the change log to the 3.2 section instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will do!

@duytnguyendtn
Copy link
Collaborator Author

Thanks Pey-Lian! I'll have a followup PR ready soon!

@pllim
Copy link
Contributor

pllim commented Nov 28, 2022

Just testing the bot, please ignore.

@meeseeksdev backport to v3.1.x

@lumberbot-app
Copy link

lumberbot-app bot commented Nov 28, 2022

Oops, something went wrong applying the patch ... Please have a look at my logs.

@blink1073
Copy link

@meeseeksdev backport to v3.1.x

@lumberbot-app
Copy link

lumberbot-app bot commented Nov 28, 2022

Awww, sorry blink1073 you do not seem to be allowed to do that, please ask a repository maintainer.

@pllim
Copy link
Contributor

pllim commented Nov 29, 2022

Just testing the bot, please ignore. (Round 2)

@meeseeksdev backport to v3.1.x

@lumberbot-app
Copy link

lumberbot-app bot commented Nov 29, 2022

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout v3.1.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 b28ad12ed1a823a8579a03f4eb73ac19b250507a
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #1836: Assign Row to NIRISS-parsed 1D Spectra'
  1. Push to a named branch:
git push YOURFORK v3.1.x:auto-backport-of-pr-1836-on-v3.1.x
  1. Create a PR against branch v3.1.x, I would have named this PR:

"Backport PR #1836 on branch v3.1.x (Assign Row to NIRISS-parsed 1D Spectra)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

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.

NIRISS Parser does not assign rows in metadata of spec 1ds
4 participants