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 PSF fitting defaults. #936

Closed
wants to merge 5 commits into from

Conversation

schlafly
Copy link
Collaborator

@schlafly schlafly commented Oct 12, 2023

This PR is intended to improve the PSF fitting accuracy of romancal.

It makes two changes:

  • It removes the "monochromatic" argument; in the blue filters especially, the PSF changes dramatically with wavelength (e.g., F087 has a blue cutoff at 760 nm and a red cutoff at 977 nm, leading to a ~30% change in FWHM).
  • It changes the default oversampling to an odd number (12 -> 11).

The second change doesn't have much in the way of knock-on effects. It turns out that the convolution over the pixel size done for even oversamplings isn't great, and picking an odd number just resolves this. See spacetelescope/webbpsf#754 .

The first change will make generating the PSF library ~10x more expensive. I think we should also consider reducing the number of PSFs evaluated on the grid to 4 from 16, which would buy back half of this; the PSF variation is less important than the monochromaticity in my experience. That would recover ~half of the performance loss. We eventually plan to store these as binary files rather than to compute them on the fly, which would allow us to do arbitrarily complicated things here.

With these two changes, plus an associated change to romanisim to correctly treat the orientation of the PSF, the ability to recover the positions of bright simulated stars in romanisim in F087 improves to 0.008 pix from something like 0.2 pix.

One thing we don't yet have is an IPC implementation in WebbPSF. This is in romanisim. We could investigate how important an effect that is on the remaining residuals, but 0.008 pix will meet spec for now.

Checklist

  • added entry in CHANGES.rst under the corresponding subsection
  • added relevant label(s)
  • ran regression tests, post a link to the Jenkins job below. How to run regression tests on a PR

@codecov
Copy link

codecov bot commented Oct 12, 2023

Codecov Report

All modified lines are covered by tests ✅

Files Coverage Δ
romancal/lib/psf.py 84.94% <ø> (-0.17%) ⬇️

... and 1 file with indirect coverage changes

📢 Thoughts on this report? Let us know!.

central_wavelength_meters = (
filter_central_wavelengths[f"WFI_Filter_{filt}_Center"] * 1e-6 * u.m
)
(filter_central_wavelengths[f"WFI_Filter_{filt}_Center"] * 1e-6 * u.m)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you mean to remove this line entirely?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't mean to touch that at all. That was something the pre-commit hook did to my PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, I see what you mean. Yeah, I left that as an unused variable, and I thought precommit had just trying to reformat it but it in fact it got rid of the definition and it's now weird. I'll delete it.

@bmorris3
Copy link
Collaborator

the PSF variation is less important than the monochromaticity in my experience.

This works for me.

We eventually plan to store these as binary files rather than to compute them on the fly, which would allow us to do arbitrarily complicated things here.

If and when a PSF library is maintained as planned, the user won't see any penalty. Let's make sure that's still on the radar for @nden and @tddesjardins.

One thing we don't yet have is an IPC implementation in WebbPSF. This is in romanisim. We could investigate how important an effect that is on the remaining residuals, but 0.008 pix will meet spec for now.

Sounds good.

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

Successfully merging this pull request may close these issues.

2 participants