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

NIRCam coronagraphy fails with mask=None #157

Closed JarronL closed 6 years ago

JarronL commented 7 years ago

When performing coronagraphic simulations with NIRCam, if the mask is omitted (but the Lyot pupil is in place), then an image plane is no longer inserted at the mask location. This causes an indexing issue later down the road. It appears that line 1010 of webbpsf_core.py #optsys.add_image(poppy.ScalarTransmission(name='No Image Mask Selected!'), index=1) was commented out at some point. Uncommenting this line and changing index=2 fixes the issue for me.

mperrin commented 7 years ago

Hmm, what's the use case for this? I think my reasoning for commenting it out was that it would make the propagation faster to avoid two propagation transforms that end up being a null operation. That would imply that a better fix would be to fix the indexing issue instead. Do you actually care about the existence of that empty image plane, or do you just want to be able to calculate Lyot pupil PSFs w/out a mask? (For those I've been actually calculating off-axis PSFs myself, but I can see the benefit of taking the shortcut of mask=None)

JarronL commented 7 years ago

Sorry,I thought that I had responded to this, but apparently not(?).

I would like to calculate a PSF by setting mask=None and pupil='CIRCLYOT' (for instance) and don't have any restrictions on how this is accomplished in the propagation (either by my suggestion above or fixing the root of the index issue). I generally use this method for quickly creating a background PSF with a small footprint for quick saturation and bg sensitivity calculations. For these purposes, I found that calculating an off-axis PSF to be a little clunky and preferred the mask=None method (it's also computationally faster that dealing with the coronagraphic mask).

mperrin commented 6 years ago

This was fixed at some point in the past. I don't recall in which commit. But I just double checked now and it is working as desired.