Refactoring of CompImageHDU (request for review/testing)

10 views
Skip to first unread message

Thomas Robitaille

unread,
Mar 12, 2024, 4:13:17 PMMar 12
to astropy-dev mailing list
Hi everyone,

TL;DR: if you work a with compressed FITS files, I would be grateful if you could test out PR 15474 to astropy core!

Background: I have been working over the last year on refactoring the CompImageHDU class in astropy.io.fits. In current versions of astropy, this class inherits from BinTableHDU, but this causes a lot of complexity in the code because at the same time we try to make it look like an ImageHDU class. The refactoring I have been working on is to make it so that CompImageHDU instead inherits from ImageHDU and contains a reference internally to a BinTableHDU object. In addition to reducing the number of lines of code and making the code simpler (note: simpler not simple - this is still astropy.io.fits!), this solves at least five known bugs with CompImageHDU.

API changes: the only meaningful API change is that isinstance(hdu, BinTableHDU) will now return False instead of True and isinstance(hdu, ImageHDU) will now return True instead of False if hdu is a CompImageHDU. Another change is that hdu._header will now no longer return the compressed HDU header, but that is private API, so not something we need to worry about. Because the isinstance() changes are a breaking change and it is not possible to go through a deprecation phase, the plan is to merge it at the start of the 7.0.x development cycle, but as it is a significant PR, I am trying to get the review cycle done as soon as possible so we are ready to merge once we do start 7.0.x.

Trying it out: the pull request is at https://github.com/astropy/astropy/pull/15474 - if you do have a chance to try it out, I would appreciate if you could let me know if you run into any issues/errors, or anything that looks like an API change not mentioned above. Please report issues directly on the PR discussion.

Thanks!
Tom
Reply all
Reply to author
Forward
0 new messages