Skip to content

Serendipitous discovery of multi-layered PSF bug #911

@teutoburg

Description

@teutoburg

While working on #908 I ran into test_ConstPSF.TestGetKernel.test_kernel_is_scale_properly_if_cdelts_differ(), which was failing on that branch in one of three parameter combinations, because the resulting kernel was only a single pixel, which got squeezed into a scalar. This led me to investigate what's going on with that test in general, with slightly worrying results:

No rescaling

The baseline case of factor = 1 produces the kind of image you'd expect:

Image

Scaling up

With factor = 1/3, the FOV's pixel scale is reduced, thus the PSF kernel is interpolated to a larger image. Here's where it starts getting weird, the center of the PSF is shifted:

Image

Scaling down

The final case of factor = 5, which should scale the PSF down to a smaller image, produces the most interesting result, which unfortunately cannot be plotted, as the kernel array becomes just array([[nan]]). To be fair, scaling the PSF down to a single pixel is somewhat nonsensical, but then I'd expect an error and not a silent NaN.

For now, I'm adding an additional check to that test case in #908, verifying that the index of the maximum value in the resulting kernel is in the center pixel, which makes the 1/3 case now xfail, while the 5 case xfails because the single-element 2D array becomes a scalar.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions