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 to read SI pixelscales directly from pysiaf #626

Merged
merged 2 commits into from
Jun 5, 2023

Conversation

mperrin
Copy link
Collaborator

@mperrin mperrin commented Dec 16, 2022

A small improvement in precision: use the measured pixel scale values from on orbit when computing PSFs. This should (slightly) improve the computed PSFs.

  • Read pixel scales directly from pysiaf for each instrument and detector. Removes having "default" pixel scales of each SI hardcoded in the Python; instead it reads from the SIAF values during init.
  • Update pixel scale when you switch to a different SIAF aperture (in particular, if you switch NIRCam detectors it will change the aperture to the one for that detector, which will update the pixel scale).
  • Update unit tests correspondingly to still work with the above.

Note, this still retains the idealized assumptions of (a) square pixels, same scale in X and Y, and (b) all of NRC, FGS, NIS detectors are precisely unrotated with respect to the OTE V frame. The non-ideal departures from that, as recorded in pysiaf, continue to be handled in the rotation step and distortion model used to make the OVERDIST and DET_DIST extensions 3 and 4.

This also retains the ability to override the pixel scale with a custom value. If the user does this, then that custom value will be retained afterwards even if you switch apertures (i.e. setting a custom pixelscale disables the behavior for auto updating the pixelscale).

@mperrin mperrin requested a review from obi-wan76 May 9, 2023 21:16
@mperrin
Copy link
Collaborator Author

mperrin commented May 9, 2023

@obi-wan76 FYI this is a PR that I submitted in December, a simple bite-size standalone minor improvement.

@mperrin
Copy link
Collaborator Author

mperrin commented May 9, 2023

Huh, this was working in December. Something seems to have broken in the rebase onto current develop. I'll investigate.

@mperrin
Copy link
Collaborator Author

mperrin commented Jun 1, 2023

Updated and improved. This now works as intended to automatically read pixelscales from SIAF, per each aperture, but also to retain the ability for a user to set a custom pixelscale (and have that custom pixelscale not be overwritten by SIAF values).

This is now ready for review @obi-wan76

Example:

Screen Shot 2023-06-01 at 2 55 49 PM

@mperrin mperrin added enhancement New feature or request JWST Affects JWST models in WebbPSF labels Jun 1, 2023
@mperrin mperrin self-assigned this Jun 1, 2023
@codecov
Copy link

codecov bot commented Jun 1, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.07 🎉

Comparison is base (26ba1b4) 55.21% compared to head (fb5ca14) 55.28%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #626      +/-   ##
===========================================
+ Coverage    55.21%   55.28%   +0.07%     
===========================================
  Files           14       14              
  Lines         6122     6132      +10     
===========================================
+ Hits          3380     3390      +10     
  Misses        2742     2742              
Impacted Files Coverage Δ
webbpsf/webbpsf_core.py 73.91% <100.00%> (+0.21%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Collaborator

@obi-wan76 obi-wan76 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, I was able to run the example code and some other apertures.

@obi-wan76 obi-wan76 merged commit d793d67 into spacetelescope:develop Jun 5, 2023
@mperrin mperrin deleted the pixelscales_from_pysiaf branch June 10, 2023 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request JWST Affects JWST models in WebbPSF
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants