Skip to content

Table unicode sandwich follow-up: allow Table FITS reader to return bytestrings #6122

Closed

Description

@taldcroft

Currently in Py3 one gets unicode character arrays when reading string data from a FITS file. This translation is done in the the machinery within io.fits that lazily auto-converts any string column to U-type for cols that can be decoded to ASCII. See also here.

After #5700 there is the opportunity to have Table.read('file.fits') return a Table with 'S'-type columns, thus saving a factor of 4 in memory.

However, without implementing the unicode sandwich directly in io.fits (as @embray has prototyped), we have to be careful that direct use of HDU columns still returns unicode in Py3 while when used for reading a Table it would return bytes. It isn't immediately obvious to me how to implement this dual-behavior (in terms of API), but I haven't looked too hard.

There is also the question of whether this should be the default or requires opt-ing in.

cc: @saimn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions