Skip to content

re-importing modules breaks fresnel propagation #257

Description

@douglase

@mperrin, I found the bit of code that was breaking coronagraph sims during benchmarking.

This is an edge case, but running the following snippet to reload modules after importing causes optics to not be applied while calc_psf is called. The propagation occurs and wavefronts are multiplied by optics, but without rescaling the wavefront pixelscale, so the optic arrays are interpolated to zero size and no flux is observed at the output of the system.

Since the lens power is not applied, this can also change the number of FFTs performed, invalidating benchmark numbers.

This can be diagnosed from the debug statements, where there are no
"DEBUG:------ Optic: " statements. Otherwise the failure is silent.

import importlib
importlib.reload(poppy.fresnel)
importlib.reload(poppy.optics)
importlib.reload(poppy)

Under the new GPU selection paradigm, #250, this hack to set the _USE_CUDA etc.. keywords aren't needed to switch acceleration modes so this shouldn't be problem in practice but is being documented here in case it comes up again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions