Skip to content

astropy.io.fits.Header totextfile and Header.__init__ disagree on 'endcard' convention #339

Closed

Description

@keflavich

astropy.io.fits.Header.totextfile creates a header with endcard=False, but Header.__init__ enforces endcard=True (fromfile is modifiable, and fromtextfile defaults to endcard=False, so at least those are not a problem).

Activity

  1. embray commented on Aug 10, 2012

    @embray
    Member

    I'm not entirely sure what Header.__init__ has to do with this. It's txtfile argument is deprecated anyways. For to/fromtextfile it might at least be worth making this optional.

  2. keflavich commented on Aug 10, 2012

    @keflavich
    ContributorAuthor

    I didn't realize the txtfile keyword was deprecated; that is the source of the problem. It caused astropy.io.fits to break code that worked with pyfits - I think the endcard keyword was not always used? Anyway, I guess since it's deprecated, there's no reason to fix it.

  3. embray commented on Aug 13, 2012

    @embray
    Member

    Well, even though it's deprecated doesn't mean it shouldn't work.... Though I suppose it not working is a good motivation for people to not use it :) But really that's what fromtextfile is for. I think adding support for the endcard argument to to/fromtextfile might be worthwhile. What do you think?

  4. keflavich commented on Aug 13, 2012

    @keflavich
    ContributorAuthor

    Absolutely. If the endcard keyword is supported in both input & output, it's easier to make code self consistent (i.e., will always be able to read what it writes).

  5. ghost assigned on Aug 13, 2012
  6. embray commented on Oct 2, 2012

    @embray
    Member

    I finally got around to fixing this in PyFITS: https://trac.assembla.com/pyfits/ticket/176 Should be included in the next merge from PyFITS.

  7. embray commented on Nov 26, 2012

    @embray
    Member

    This was auto-closed by a commit in a branch that I didn't mean to push to the main repository.

  8. reopened this on Nov 26, 2012
  9. embray commented on Dec 5, 2012

    @embray
    Member

    This is fixed by #495.

  10. added a commit that references this issue on Oct 9, 2013
    00b4769
  11. added a commit that references this issue on Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions