spacetelescope / webbpsf

James Webb Space Telescope PSF simulation tool
https://webbpsf.readthedocs.io
BSD 3-Clause "New" or "Revised" License
115 stars 62 forks source link

Hardcoded pupil dimensions within JWST SI WFE models #161

Open mperrin opened 6 years ago

mperrin commented 6 years ago

Issue by josePhoenix Thursday Apr 06, 2017 at 17:59 GMT Originally opened as https://github.com/mperrin/webbpsf/issues/161


When I tried swapping in OSIM pupils and OPD maps, it became clear there's code expecting a 1024x1024 array (lots of IndexError: index 924 is out of bounds for axis 0 with size 162).

Minor, for people using the provided OPD and pupil maps. But worth thinking about how the models could be refactored to compute things on the right sampling "just in time" (using Wavefront.coordinates, probably).

mperrin commented 6 years ago

Comment by mperrin Thursday Apr 06, 2017 at 18:49 GMT


I'm not surprised. I put some thought into this when coding these but never fully tested this. At least some of the code should be using the input array sizes (see https://github.com/mperrin/webbpsf/blob/master/webbpsf/optics.py#L1064) but I'm not surprised that some other places slipped through the cracks.

Can you paste an error log or at least which line that's coming from? The MIRIFieldDependentAberrationAndObscuration class definitely has hard coded 1024s, and the main WebbFieldDependentAberration class only if the include_oversize option is set to True, which isn't the default.

mperrin commented 6 years ago

Comment by josePhoenix Thursday Apr 06, 2017 at 18:51 GMT


Yeah, it's the MIRI one. The constructor for that WFE element has include_oversize set to True by default, as well. Good to know it's not everywhere :)

mperrin commented 6 years ago

Comment by mperrin Thursday Apr 06, 2017 at 19:00 GMT


For the cross checks you're doing now, it would be a reasonable workaround to make a branch of the code that just invokes the regular WebbFieldDependentAberration instead of the special MIRI one. Trying to draw in the field dependent obscuration is irrelevant if you're patching in OSIM pupil maps anyway. So try just commenting out line 722 in webbpsf_core.py that invokes the MIRI aberration class.

mperrin commented 6 years ago

Comment by josePhoenix Thursday Apr 06, 2017 at 19:10 GMT


Is the obscuration really not relevant for OSIM? Or are you saying if the obscuration were in the beam at that field point, Randal's pupil shapes would already include it?

mperrin commented 6 years ago

Comment by mperrin Thursday Apr 06, 2017 at 19:15 GMT


The latter.

mperrin commented 6 years ago

Comment by josePhoenix Thursday Apr 06, 2017 at 19:24 GMT


Side note, no source edits needed (god bless Python):

miri._si_wfe_class = webbpsf.optics.WebbFieldDependentAberration
mperrin commented 6 years ago

Comment by mperrin Friday Apr 27, 2018 at 22:55 GMT


This is related to the 2048 squared pupils discussed as part of #204 . @obi-wan76, this issue points out a couple places with hard-coded 1024 sizes for some of the other SIs, in particular MIRI.