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

WATA preview images: improve scaling #1604

Open
stscijgbot-jwql opened this issue Jun 6, 2024 · 4 comments
Open

WATA preview images: improve scaling #1604

stscijgbot-jwql opened this issue Jun 6, 2024 · 4 comments

Comments

@stscijgbot-jwql
Copy link
Collaborator

Issue JWQL-244 was created on JIRA by Bryan Hilbert:

Sometimes with WATA data, the default scaling isn't very good. A couple of very low and/or very high signal pixels seem to be throwing off the scaling.

Example:
https://jwql.stsci.edu/NIRSpec/jw02784001001_02101_00001_nrs1/

Maybe we need to filter these pixels, or switch to a 99% scaling or something. (Although 99% of a 32x32 box means excluding only 9 pixels.

@stscijgbot-jwql
Copy link
Collaborator Author

Comment by Bryan Hilbert on JIRA:

I've been trying different options using the example file above. So far the two best results are from astropy ZScaleInterval when using a very low contrast (~0.01), and using astropy's MinMaxInterval. Those two results look very similar. I think the underlying problem is that the number of pixels with very low signal is larger than the number of pixels with very high signal. So doing a percentile clipping removes the pixels in the peak of the source, as well as some fraction of the low pixels. What's left is the wings of the PSF as well as the surrounding background pixels, all of which have fairly similar signal levels. That means the resulting image doesn't highlight the source very well. The background level is brought up into the upper range of the colorbar.

@stscijgbot-jwql
Copy link
Collaborator Author

Comment by Bryan Hilbert on JIRA:

ZScaleInterval with a contrast of 0.5, and a linear scaling seems best. This matches what Explore Image defaults to.

@stscijgbot-jwql
Copy link
Collaborator Author

Comment by Bryan Hilbert on JIRA:

Looks like Explore Image uses ZScaling with a contrast of 0.25

@stscijgbot-jwql
Copy link
Collaborator Author

Comment by Bryan Hilbert on JIRA:

For a future PR:
Here is how the data are scaled in Explore Image:

z = ZScaleInterval(contrast=self.contrast)

Then, in place of matplotlib.colors.LogNorm(), use matplotlib.colors.Normalize()
You shouldn't need to shift the data to make it all positive, either. Although for some reason, in my testing just now, using the unshifted data gave a different-looking image than when it was shifted. Probably just a mistake on my part.

Emily Wislowski, let me know if the NIRSpec team would rather switch to a preview image that matches the image in the default Explore Image, such as:
https://jwql.stsci.edu/NIRSpec/jw01118001001_02101_00001-seg001_nrs1_rate/explore_image/
https://jwql.stsci.edu/NIRSpec/jw02784001001_02101_00001_nrs1_rate/explore_image/
https://jwql.stsci.edu/NIRSpec/jw01647001001_02101_00001-seg001_nrs1_rate/explore_image/

In these cases, the background is much better separated from the PSF. However, the scaling is such that you can't see what's going on inside the PSF, because it's all above the top of the pixel range.

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

No branches or pull requests

1 participant