Skip to content

Error in handling one-dimensional TDIM values in binary tables #44

Description

@jamesrafe

jw01571-c1071_t000_niriss_f115w-gr150r_c1d.fits.zip

FITS binary-table columns can use TDIM#n to describe the shape of one table cell. The one-dimensional column may have a header like

TFORM1 = '70D'
TDIM1  = '(70)'

Currently, FITSFiles parses the TDIM string using:

eval(Meta.parse("(70)"))

In Julia, (70) evaluates to the integer 70, not the one-element tuple (70,). BinaryField.dims expects Union{Tuple, Nothing}, so reading the table fails with:

MethodError: Cannot convert an object of type Int64 to an object of type Tuple

Multi-dimensional values such as "(5,14)" already evaluate to tuples, which is why the issue mainly appears for one-dimensional TDIM values.
I encountered this while reading vector-valued columns in JWST x1d and c1d products.

Attached is one of the c1d FITS files that caused the failure.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions