Skip to content

masked pixel leak in _iso_extract #26

@hgao-astro

Description

@hgao-astro

AutoProf can fail when the input image contains NaNs, even when they are covered by the supplied mask. The mask is read correctly and applied, but _iso_extract() can still return non-finite flux values.

The core issue appears to be in _iso_extract:

  • Flux is sampled/interpolated from the raw image first.
  • The mask is then evaluated only at the rounded sample coordinates.
  • With Lanczos/bicubic interpolation, the interpolation kernel can include nearby NaN pixels.
  • As a result, NaNs can enter downstream FFT, quantile, interpolation, and median calculations.

In principle, this should affect all call sites, e.g., center finding, initialization, isophote fitting, and profile extraction. The leak is not limited to NaN. Pixels that are supposed to be masked now enter the sample and bias the results. NaN happens to be the most catastrophic case and gets caught. My observed failure case was in the center finding step, where Center_HillClimb tried to convert NaN to an integer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions