mperrin / webbpsf

James Webb Space Telescope PSF simulation tool - NOTE THIS VERSION OF REPO IS SUPERCEDED BY spacetelescope/webbpsf
BSD 3-Clause "New" or "Revised" License
16 stars 15 forks source link

wfirst CGI #154

Closed neilzim closed 7 years ago

neilzim commented 7 years ago

CGI with static, unaberrated shaped pupil coronagraph (SPC) modes for characterization and debris disk imaging.

mperrin commented 7 years ago

I'm working to get this branch operable on Travis. Make a new version of the minimal data files which includes CGI. Next hurdle is, annoyingly, poppy appears to be case sensitive about the WAVEUNIT keyword, for the code branch which doesn't use pysynphot (which is what is used on Travis) - see https://travis-ci.org/mperrin/webbpsf/jobs/183416935 . Right now you have "ANGSTROM" but only "Angstrom" or "angstrom" are acceptable. I'm happy to call this a poppy bug, but still I think we'll want to fix the data files so they work both with pysynphot and with our simpler workaround code for users without pysynphot.

neilzim commented 7 years ago

I've just replaced the filter FITS files on the central store in webbpsf-data-source/ - the header entries are now "angstrom".

mperrin commented 7 years ago

OK, I finally got around to fixing the minimal-webbpsf.tar.gz , and things are semi working on Travis again. There is an issue with the CGI test, but it's an issue in the test function itself rather than in the CGI code. (change the mode from 'CHARSPC' to e.g. 'CHARSPC_F660'). I fixed that in my local copy of the test branch, and the test "passes", but it's a cheap pass because it doesn't include any assertions on the test output, just that the calculation runs without crashing.

Yet when I look at the test outputs, I'm not getting any valid output. The final PSF is all NaNs.

charspc_calc_psf_issue

@neilzim any ideas? Can you help me diagnose what's wrong here, ASAP? I'll be able to putter with this intermittently today from here.

mperrin commented 7 years ago

Partial excerpt from a calculation with poppy.conf.enable_flux_tests=True and webbpsf.setup_logging('debug'):

[  poppy] Calculating PSF with 1 wavelengths
[  poppy]  Propagating wavelength = 6.6e-07 m meters using Matrix FTs
[  poppy] Creating input wavefront with wavelength=6.6e-07 m, npix=256, pixel scale=0.00937 meters/pixel
[  poppy]   Wavefront and optic WFIRST Entrance Pupil already at same plane type, no propagation needed.
[  poppy]   Multiplied WF by phasor for Pupil plane: WFIRST Entrance Pupil
[  poppy] normalizing at first plane (entrance pupil) to 1.0 total intensity
[  poppy]   Flux === 1.0
[  poppy]   Propagating wavefront to Coordinate Inversion in y axis.
[  poppy] conf.use_fftw is True
[  poppy]   Flux === 1.0
[  poppy]   Wavefront and optic CHARSPC already at same plane type, no propagation needed.
[  poppy] Pixelscales: wave 0.009375 m / pix, optic 0.0092578125 m / pix
[  poppy] resampled optic to match wavefront via spline interpolation by a zoom factor of 0.988
[  poppy] resampled optic shape: (253, 253)   wavefront shape: (256, 256)
[  poppy] Optic(253, 253) is smaller than input wavefront[256, 256], will attempt to zero-pad the rescaled array
[  poppy] padded an optic with a 2 x 2 border to optic to match the wavefront
[  poppy]   Multiplied WF by phasor for Pupil plane: CHARSPC
[  poppy]   Flux === nan

Looks like the issue may be that the input wavefront is set up with different sampling than the shaped pupil optic? I expect that's not intentional, or is it? Regardless I would have expected that interpolation to work without failing, but apparently there's a bug somewhere. Will keep digging.

neilzim commented 7 years ago

I think the pupil scale disparity has to do with the 2.4 m versus 2.37 m aperture diameter assumption. I set the PUPLSCAL in my optics based on 2.37 m to be consistent with the IPAC parameters.

mperrin commented 7 years ago

2.37 is more correct for the actual diameter, that's right. But why is a 2.4 m value used in the AFTA_CGI_C5_Pupil_onax_256px.fits file then?

neilzim commented 7 years ago

Might be an older version. I'll update the data tarball (webbpsf-data-0.6.0.rc2.tar.gz) on central store.

mperrin commented 7 years ago

What really needs to be updated is /itar/jwst/tel/share/webbpsf/webbpsf-data-source/AFTA_CGI_C5_Pupil_onax_256px.fits

neilzim commented 7 years ago

done.

mperrin commented 7 years ago

Superb, thanks. Tests are now passing on Travis it looks like. I'll wait for the last few jobs to complete and then merge this to master.