Skip to content

cube.output_first_header is missing several comments #21

@altuson

Description

@altuson

cube.output_first_header is missing comments for several keywords. One way to fix this is to update line 39 of fits.py. Instead of

header_dict = {
        k: fits.Card(
            k,
            hdu.data[k][0]
            if isinstance(hdu.data[k][0], str)
            else np.nanmedian(hdu.data[k]),
            c,
        )
        if (k in hdu.data.columns.names)
        else fits.Card(k, hdr[k], c)
        for k, c in zip(hdr.keys(), hdr.comments)
        if (
            (k not in delete_kwds)
            and (not k.startswith("TTYPE") and (not k.startswith("TFORM")))
        )
    }

use this instead

header_dict = {
        k: fits.Card(
            k,
            hdu.data[k][0]
            if isinstance(hdu.data[k][0], str)
            else np.nanmedian(hdu.data[k]),
            c if c != "" else hdr[k],
        )
        if (k in hdu.data.columns.names)
        else fits.Card(k, hdr[k], c)
        for k, c in zip(hdr.keys(), hdr.comments)
        if (
            (k not in delete_kwds)
            and (not k.startswith("TTYPE") and (not k.startswith("TFORM")))
        )
    }

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