Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Imviz parser #541

Merged
merged 8 commits into from
Apr 28, 2021
Merged

Imviz parser #541

merged 8 commits into from
Apr 28, 2021

Conversation

pllim
Copy link
Contributor

@pllim pllim commented Apr 16, 2021

Fix #510

I cannot test this until #540 is resolved because jwst is not compatible with Windows.

Reference: https://github.com/glue-viz/glue/blob/master/glue/core/data_factories/fits.py

Proof-of-concept

Successfully loaded the following locally in notebook:

# JWST/NIRCAM ASDF-in-FITS
imviz.load_data('/path/to/jw1069001001_01203_00002_nrca1_level2_cal.fits')  # SCI
imviz.load_data('/path/to/jw1069001001_01203_00002_nrca1_level2_cal.fits[DQ,1]')
imviz.load_data('/path/to/jw1069001001_01203_00002_nrca1_level2_cal.fits[VAR_POISSON]')

# HST/ACS Drizzled FITS
imviz.load_data('/path/to/jbt7a3020_drz.fits')  # SCI
imviz.load_data('/path/to/jbt7a3020_drz.fits[WHT,1]')
imviz.load_data('/path/to/jbt7a3020_drz.fits[CTX]')

As you can see, JWST filenames are a little long, so I need to scroll to get the full screenshot(s).

Screenshot 2021-04-20 155340

Screenshot 2021-04-20 155354

TODO

@pllim pllim added the imviz label Apr 16, 2021
@pllim pllim added this to the Imviz 1.0 milestone Apr 16, 2021
@pllim
Copy link
Contributor Author

pllim commented Apr 19, 2021

I don't have anything official to test with, so using one from my own stash: https://stsci.box.com/s/hwrc5reqygmmv2rl3yvvz90l7ryjac6h (jw1069001001_01203_00002_nrca1_level2_cal.fits)

@astrofrog
Copy link
Collaborator

Do we need test in CI? How?

If you want a shortcut, the easiest would be to actually call parse_data with app being a MagicMock and then passing an HDUList for the file object - that way you can check that add_data and so on are called correctly and you can check that the data object seems ok.

jdaviz/app.py Outdated Show resolved Hide resolved
@pllim pllim requested a review from astrofrog April 21, 2021 20:52
@eteq
Copy link
Contributor

eteq commented Apr 21, 2021

Re: which images to treat as acceptance criteria - @pllim, I think you hit the two main items at the outset! I.e.

  1. A JWST level 2 image
  2. A drizzled HST image (if you really want we could also do in flt with the distortions and all, but not mandatory)

I think ideally we check both of those in CI following @astrofrog's suggestion in #541 (comment).

That leaves open the question where to get the images. I think the answer for now is to try to pick a file for 1 that we're already using in some notebook (like maybe https://data.science.stsci.edu/redirect/JWST/jwst-data_analysis_tools/stellar_photometry/jw01072001001_01101_00001_nrcb1_cal.fits ? although I'm not 100% sure that's level 2, so might have to find another one) and for 2 get some convenient drz file on MAST - for example https://mast.stsci.edu/api/v0.1/Download/file?bundle_name=MAST_2021-04-21T1828.sh&uri=mast:HST/product/jclj01010_drz.fits would do just fine.

Copy link
Collaborator

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

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

Looks good to me so far! Just a couple small comments below

jdaviz/configs/imviz/plugins/parsers.py Outdated Show resolved Hide resolved
jdaviz/configs/imviz/plugins/parsers.py Outdated Show resolved Hide resolved
@pllim pllim force-pushed the load-all-the-things branch from 4a60a4a to 42f6bc3 Compare April 23, 2021 21:03
@@ -2,15 +2,13 @@
"cells": [
{
"cell_type": "markdown",
"id": "handed-person",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have no idea how these got into the original notebook from Tom R. But when I update it, these are removed by jupyter. 🤷

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe a jupyter version difference? Fine to remove though :)

@pllim pllim force-pushed the load-all-the-things branch from 2091492 to 436ae00 Compare April 26, 2021 19:34
@pllim
Copy link
Contributor Author

pllim commented Apr 26, 2021

The two test files given by Erik are not exactly small; hopefully not enough to trigger quota limits. 😬 🤞

  • jw01072001001_01101_00001_nrcb1_cal.fits 113 MB
  • jclj01010_drz.fits 208 MB

@pllim pllim marked this pull request as ready for review April 26, 2021 19:50
@pllim
Copy link
Contributor Author

pllim commented Apr 26, 2021

After this is merged, if no further changes, @duytnguyendtn needs to update branch protection rules for CI, since I changed the job name a little. FYI.

@pllim
Copy link
Contributor Author

pllim commented Apr 26, 2021

FWIW, the new tests passed locally...

Copy link
Collaborator

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks for adding the tests 😀

@pllim
Copy link
Contributor Author

pllim commented Apr 26, 2021

Great! @duytnguyendtn , any other approval needed for merge?

@pllim

This comment has been minimized.

@pllim pllim force-pushed the load-all-the-things branch from e81d372 to 063f1ef Compare April 27, 2021 15:26
@pllim
Copy link
Contributor Author

pllim commented Apr 27, 2021

OK, bug fixed. Should be ready ready now.

Copy link
Collaborator

@rosteen rosteen left a comment

Choose a reason for hiding this comment

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

Looks good to me. I did some testing from the notebook (including loading the JWST file) as well as running the tests locally. I hadn't looked at the Imviz example notebook lately, Imviz is looking good so far!

Is there an issue open for the CI branch protection rule change you mentioned @pllim , or was that already addressed?

@pllim
Copy link
Contributor Author

pllim commented Apr 27, 2021

I can't really open issue about branch protection until this is merged.

Screenshot 2021-04-27 140755

@rosteen
Copy link
Collaborator

rosteen commented Apr 27, 2021

Wait, that last test needs to pass before I can merge this. But that test can't pass until @duytnguyendtn updates the branch protection rules for CI before the test will run? Is that right?

@pllim
Copy link
Contributor Author

pllim commented Apr 27, 2021

No, it is now called "Python 3.8 with coverage checking, all deps, and remote data" but only after this PR is merged. We're stuck with chicken and egg situation.

@duytnguyendtn duytnguyendtn merged commit 376725c into spacetelescope:main Apr 28, 2021
@pllim pllim deleted the load-all-the-things branch April 28, 2021 15:24
@duytnguyendtn
Copy link
Collaborator

Updated the test name. Thanks for your patience!

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

Successfully merging this pull request may close these issues.

JDAT-1390: Load common image formats (FITS, ASDF), including JWST
5 participants