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

Update Mosviz parser to load level 2 data #1835

Merged
merged 19 commits into from
Nov 30, 2022

Conversation

rosteen
Copy link
Collaborator

@rosteen rosteen commented Nov 10, 2022

Does what it says on the tin. In-progress, currently (mostly) working for NIRSpec level 2.

EDIT: ready for review, now also loads NIRCam data. I have NIRCam test data, I can upload that to Box (I trimmed a couple real files from ~1200 sources down to 20 to speed things up) and add a test.

@rosteen rosteen force-pushed the mosviz-load-level-2 branch 2 times, most recently from afc8112 to 8b09ea6 Compare November 15, 2022 20:09
@rosteen rosteen marked this pull request as ready for review November 16, 2022 19:59
@pllim pllim requested a review from eteq November 16, 2022 20:04
@pllim pllim added this to the 3.2 milestone Nov 16, 2022
@pllim
Copy link
Contributor

pllim commented Nov 16, 2022

Need a change log. Thanks!

@rosteen
Copy link
Collaborator Author

rosteen commented Nov 16, 2022

Need a change log. Thanks!

I know! I thought we agreed that can wait until after approvals in case the PR drags on with lots of changes and conflicts in the changelog happen 😅

@rosteen
Copy link
Collaborator Author

rosteen commented Nov 16, 2022

The NIRCam test data download link is here . Working on uploading the level 2 NIRSpec data I've been using to Box as well.

@codecov
Copy link

codecov bot commented Nov 16, 2022

Codecov Report

Base: 88.43% // Head: 88.46% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (30452e4) compared to base (e62105b).
Patch coverage: 89.89% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1835      +/-   ##
==========================================
+ Coverage   88.43%   88.46%   +0.02%     
==========================================
  Files          95       95              
  Lines       10487    10529      +42     
==========================================
+ Hits         9274     9314      +40     
- Misses       1213     1215       +2     
Impacted Files Coverage Δ
jdaviz/configs/mosviz/plugins/parsers.py 90.92% <89.36%> (-0.21%) ⬇️
jdaviz/configs/mosviz/helper.py 87.24% <100.00%> (-0.12%) ⬇️
jdaviz/app.py 94.57% <0.00%> (+0.42%) ⬆️

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.

@rosteen
Copy link
Collaborator Author

rosteen commented Nov 17, 2022

A sample NIRSpec level 2 dataset for testing is now on Box as well.

@rosteen rosteen force-pushed the mosviz-load-level-2 branch from 6e1b18a to 6432696 Compare November 17, 2022 21:04
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.

Just a general review.

jdaviz/configs/mosviz/helper.py Outdated Show resolved Hide resolved
jdaviz/configs/mosviz/helper.py Outdated Show resolved Hide resolved
jdaviz/configs/mosviz/helper.py Outdated Show resolved Hide resolved
jdaviz/configs/mosviz/helper.py Outdated Show resolved Hide resolved
jdaviz/configs/mosviz/helper.py Outdated Show resolved Hide resolved
jdaviz/configs/mosviz/plugins/parsers.py Outdated Show resolved Hide resolved
im_split = image_file.stem.split("_")[0]
pupil = fits.getheader(image_file, ext=0).get('PUPIL')
if "Direct Image" in files_by_labels:
print("Loading: Images")
Copy link
Contributor

Choose a reason for hiding this comment

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

I never liked printing stuff out to the notebook. While you are at this, should we move this to the snackbar info?

data_iter = get_image_data_iterator(app, temp, "Image", ext=None)
data_obj = [d[0] for d in data_iter] # We do not use the generated labels
image_data = data_obj[0] # Grab the first one.
# TODO: Error if multiple found?
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this TODO for this PR or future work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Great question - I think I should do it here (or alternatively at least think about it and decide it's not needed). I can do that after meetings today.

jdaviz/configs/mosviz/plugins/parsers.py Outdated Show resolved Hide resolved
jdaviz/configs/mosviz/tests/test_parsers.py Outdated Show resolved Hide resolved
@javerbukh
Copy link
Contributor

Was able to get NIRCAM and NIRSpec level 2 data to load, nice work!! I can approve once CI passes or if local CI passes (assuming that astropy CI bug is ongoing).

@pllim
Copy link
Contributor

pllim commented Nov 21, 2022

Nice try but change log is not astropy's fault. 😆

@rosteen
Copy link
Collaborator Author

rosteen commented Nov 21, 2022

Docs built locally:
Screen Shot 2022-11-21 at 3 36 28 PM

@pllim
Copy link
Contributor

pllim commented Nov 21, 2022

@rosteen , if you rebase again, doc should pass.

@rosteen rosteen force-pushed the mosviz-load-level-2 branch from 5df9b00 to c3b93ca Compare November 21, 2022 21:44
* JWST NIRISS
* JWST NIRCam
Copy link
Contributor

Choose a reason for hiding this comment

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

Why only NIRSpec has (levels 2 and 3) specified? What about NIRISS and NIRCam?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

NIRISS and NIRCam only have level 2 available from what I've been told, there is no level 3.

docs/mosviz/import_data.rst Outdated Show resolved Hide resolved
docs/mosviz/import_data.rst Outdated Show resolved Hide resolved
@@ -50,8 +67,6 @@ and for NIRISS:

jdaviz mosviz /path/to/my/data --instrument=niriss

If an instrument is not specified in either case, Mosviz will default to NIRSpec parsing.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we want to keep this sentence but tell the user now that it would throw an error.

mosviz_helper.load_data(directory=data_dir)

return
Copy link
Contributor

Choose a reason for hiding this comment

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

It feels unnatural to return in a test function. Maybe this is a sign that parametrize is not suitable for this test case anymore. You don't need remote data to prove that the function will throw an exception, right? Theoretically, you could give a dummy file name/object and it would still throw the same exception?

Anyways, if we want to chuck this in the technical debt bin, we can refactor in the future and leave this as-is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Into the bin!

@rosteen
Copy link
Collaborator Author

rosteen commented Nov 22, 2022

@javerbukh Tests passed, mind approving?

@rosteen rosteen force-pushed the mosviz-load-level-2 branch from 9ff3b46 to bb3951c Compare November 29, 2022 21:22
@pllim
Copy link
Contributor

pllim commented Nov 30, 2022

If you rebase, CI should be all green. FYI.

@rosteen rosteen force-pushed the mosviz-load-level-2 branch from bb3951c to 30452e4 Compare November 30, 2022 21:07
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 looks like code. Thanks!

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.

4 participants