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

Roman Prism and Grism #416

Merged
merged 15 commits into from
Jul 15, 2021
Merged

Roman Prism and Grism #416

merged 15 commits into from
Jul 15, 2021

Conversation

robelgeda
Copy link
Contributor

@robelgeda robelgeda commented Feb 24, 2021

This PR introduces the Prism and Grism modes for the Roman WFI based on cycle 8 design. It also introduces the ability to user override the aberrations files used to construct detectors.

This PR means #382 can be closed (any time).

Updates

WebbPSF

  • New Grism and Prism filters:
    • GRISM_FILTER = 'G150'
    • PRISM_FILTER = 'P120'
  • Changing filters to G150 or P120 changes the mode of the WFI and the aberrations files (unless there is a user aberrations override)
  • New WFI._aberrations_files: Dictionary with all default aberrations files paths. Dictionary key is the WFI mode.
  • New WFI._load_detector_aberrations(path): Class function to load aberrations files at path
  • New WFI. _get_filter_mode (wfi_filter): given a filter (string), wfi_filter, return the WFI mode. WFI modes are:
    • Imaging
    • Grism
    • Prisim
  • New WFI.mode: Class property that returns the current mode of the WFI instance by passing the current filter to WFI. _get_filter_mode
  • New WFI.override_aberrations(aberrations_path): Overrides and locks the current aberrations with aberrations at aberrations_path. Lock means changing the filter/mode has no effect on the aberrations.
  • New WFI.reset_override_aberrations(): Releases WFI.override_aberrations lock and start using the default aberrations.
  • New Tests for mode and filter switching.
  • New Field point nearest point approximation (extrapolation).

WebbPSF Data

  • New wim_zernikes_cycle8_prism.csv and wim_zernikes_cycle8_grism.csv aberrations files.
  • Updated webbpsf-data/WFI/filters.tsv to add 'G150' and 'P120' (nlambda set to 20)
  • New Filter throughput files for G150 and P120 from Pandeia

Sample PSFs

Screen Shot 2021-03-01 at 2 37 33 PM

Screen Shot 2021-03-01 at 2 37 23 PM

@codecov
Copy link

codecov bot commented Feb 24, 2021

Codecov Report

Merging #416 (476c6b9) into develop (5cdd41e) will increase coverage by 0.41%.
The diff coverage is 94.28%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #416      +/-   ##
===========================================
+ Coverage    64.06%   64.47%   +0.41%     
===========================================
  Files           11       11              
  Lines         4352     4408      +56     
===========================================
+ Hits          2788     2842      +54     
- Misses        1564     1566       +2     
Impacted Files Coverage Δ
webbpsf/roman.py 90.72% <94.28%> (+0.72%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5cdd41e...476c6b9. Read the comment docs.

@robelgeda robelgeda added the Roman Affects Roman Space Telescope models in WebbPSF label Feb 27, 2021
@robelgeda robelgeda marked this pull request as ready for review March 1, 2021 19:44
@robelgeda robelgeda requested review from Skyhawk172 and mperrin March 1, 2021 19:44
Copy link
Collaborator

@mperrin mperrin 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 overall. See below for a few small requests for revisions but nothing big.

Note, I have not reviewed any of the data values within the new files, either for the aberration coefficients or the filter transmissions. I assume you have double checked those values are are they should be.

# Update Aberrations
# ------------------
# Check if _aberrations_files has been initiated (not empty) and if aberrations are locked by user
if self._aberrations_files and not self._is_custom_aberrations:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why the check for if the aberrations files are empty? Under what circumstances would that be the case?

Copy link
Contributor Author

@robelgeda robelgeda Mar 9, 2021

Choose a reason for hiding this comment

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

When the class is initialized, with super(WFI, self).__init__("WFI", pixelscale=pixelscale), the filter is set to a new value in that function. We can not fill in self._aberrations_files before the super.__init__ call because the self._datapath attribute is not yet initialized. So we have to initialize self._aberrations_files to be empty and check for when super.__init__ sets the filter, so the code does not crash.

If we define self._datapath before super.__init__, this will not be needed. But I thought this was the safest way forward.

@robelgeda
Copy link
Contributor Author

From @Skyhawk172 :

looking at the prism and grism spreadsheets, I noticed the “local_x” and “local_y” values are different than what we have in the “normal filter” spreadsheet.
For example, for our regular filters, these values range from -20.44 to +20.44, identically for all SCAs, whereas in the prism/grism spreadsheets they vary non-uniformally from SCA to SCA and go from about -25 to 17. The net effect of these differences is that the derived pixel value for some of these “local” coordinate values is negative and/or can be many tens of pixels from the edge of the detector, leading to an error “Could not get aberrations for input field point” when trying to get the aberration close to the edge of the detector.
This local-to-pixel conversion is done in _load_wfi_detector_aberrations.build_detector_from_table().
We make the assumption “to place (-20.44, -20.44) at (4, 4)“, but that means the prism/grism interpolator won’t cover all of the SCA pixels.

@robelgeda robelgeda requested a review from mperrin May 3, 2021 17:37
from . import webbpsf_core
from scipy.interpolate import griddata

from scipy.interpolate import griddata, RegularGridInterpolator
Copy link
Collaborator

Choose a reason for hiding this comment

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

RegularGridInterpolator is not needed anymore now that we've simplified the handling of the extrapolation case.

from astropy.io import fits
import astropy.units as u
import logging

from . import webbpsf_core
from .optics import _fix_zgrid_NaNs
Copy link
Collaborator

Choose a reason for hiding this comment

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

_fix_zgrid_NaNs is not needed anymore now that we've simplified the handling of the extrapolation case.

Copy link
Collaborator

@Skyhawk172 Skyhawk172 left a comment

Choose a reason for hiding this comment

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

I've done a series of tests and all my results indicate that the implementation is correct. We will be examining the results closer to understand some interesting features (e.g. FWHM), but it does appear those features are the result of the reference data provided to us by GSFC.

@robelgeda
Copy link
Contributor Author

Added data to v1.0.0rc2 and tests are passing

@ojustino ojustino mentioned this pull request Jun 24, 2021
14 tasks
@mperrin mperrin merged commit 9673b52 into spacetelescope:develop Jul 15, 2021
@robelgeda robelgeda mentioned this pull request Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Roman Affects Roman Space Telescope models in WebbPSF
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants