Skip to content

WCS in Scopesim, off-by-one error, specifically image_plane_utils.header_from_list_of_xy #209

@oczoske

Description

@oczoske

The WCS treatment in header_from_list_of_xy highlights the misapplication of FITS conventions in Scopesim. This is just part of a larger problem that presumably leads to the long-standing "off-by-one" issue.
The FITS conventions counts pixels starting from 1, where (1, 1) is the centre of the bottom-left pixel in a 2D image. This convention is violated in lines 195/196. Since function pix2val also uses zero offset, this is not immediatly apparent, but it will become a problem when a header is interpreted with the astropy.wcs module (as any WCS of type other than LINEAR should be).
The centre of an image with (NAXIS1, NAXIS2) pixels is therefore at ((NAXIS1 + 1) / 2, (NAXIS2 + 1) / 2), this is violated in line 198.
Unfortunately, this cannot be fixed in isolation but should be fixed throughout Scopesim and be properly regression tested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions