jwql
jwql copied to clipboard
Scaling tweaks for preview images/thumbnails
This PR makes a small change to the scaling algorithm for the creation of preview images and thumbnails. Previously the code looked for the PIXELDQ extension in order to retrieve a DQ map and find the NON_SCIENCE pixels. However PIXELDQ wil only exist in intermediate files saved in calwebb_detector1. Once the rate files are saved at the end of that pipeline, the extension name is changed to DQ. So this update has the code look for the DQ extension, as JWQL never sees files between uncal and rate.
Also, note that MIRI does not populate NON_SCIENCE flags until the flat field step in calwebb_image2, so this method of retrieving NON_SCIENCE pixels does not work for MIRI rate files. It also does not work for any instruments' uncal files, as there are no DQ-related extensions in those files.
Hello @bhilbert4, Thank you for updating !
- In the file
jwql/jwql_monitors/generate_preview_images.py
:
Line 542:5: E303 too many blank lines (2) Line 545:5: E303 too many blank lines (2)
- In the file
jwql/tests/test_preview_image.py
:
Line 52:21: E231 missing whitespace after ',' Line 52:25: E231 missing whitespace after ',' Line 53:11: E231 missing whitespace after ','
- In the file
jwql/utils/preview_image.py
:
Line 51:1: E402 module level import not at top of file Line 52:1: E402 module level import not at top of file Line 53:1: E402 module level import not at top of file Line 61:1: E265 block comment should start with '# ' Line 304:33: E265 block comment should start with '# ' Line 305:33: E265 block comment should start with '# ' Line 709:22: E203 whitespace before ':' Line 709:48: E203 whitespace before ':' Line 741:37: E203 whitespace before ':' Line 743:45: E203 whitespace before ':' Line 750:40: E203 whitespace before ':' Line 752:54: E203 whitespace before ':'
- In the file
jwql/website/apps/jwql/data_containers.py
:
Line 53:34: E126 continuation line over-indented for hanging indent Line 217:64: E226 missing whitespace around arithmetic operator Line 1092:17: W503 line break before binary operator Line 1093:17: W503 line break before binary operator Line 1094:17: W503 line break before binary operator Line 1095:17: W503 line break before binary operator Line 1515:9: E722 do not use bare 'except'
Comment last updated at 2022-08-25 14:48:47 UTC
@mfixstsci @BradleySappington I think this is finally ready for review. I've run it on the test server on all program numbers > 2000 and the results look good. There may be some small tweaks that can be made to improve some of the higher level products, but I don't see any preview images any more that are badly scaled such that targets aren't visible.
I ended up having to add files containing maps of non-science pixels. Uncal, i2d, and MIRI rate files don't contain DQ extensions, and so previously for those files, JWQL did not know which pixels to omit when scaling the preview image. So now for these files, an external file is read in and used as the DQ array.
Once this is reviewed, I think we may finally be ready to make a big push and regenerate all the preview images for existing data.