HEASARC / cfitsio

C and Fortran library for reading and writing FITS files
19 stars 7 forks source link

cfitsio producing non fits standard compliant files #19

Closed RononDex closed 2 months ago

RononDex commented 3 months ago

I found a bug with cfitsio (or software that uses cfitsio: EKOS / Kstars). Any fit file created consistently has a leading chunk of null bytes after the last 2880 byte block. According to the speficitions, a fits file should comprise of 2880 bytes blocks, meaning the produced fits file has a length that is a multiple of 2880 bytes.

This not only makes the fits file non compliant with the fits standard (see validator here: https://fits.gsfc.nasa.gov/fits_verify.html) but also can throw off fit file parsers.

*** Error:   File has extra byte(s) after last HDU at byte 32803200.

I stumbled on this issue since I am currently writing my own Fits file library in C# and used some of the fits files produced by Kstars / EKOS for testing (which in return uses cfitsio to write / create the fits files).

c181gordon commented 2 months ago

That does sound like a bug, but can you verify that it is originating with CFITSIO calls? We're not able to reproduce this behavior and haven't received reports of it till now. I'm not familiar with the Kstars package, but I looked at the tar file distribution and noticed that CFITSIO isn't distributed with it and is only an optional dependency. Does it rely solely on CFITSIO for all of its fits file I/O?

It may be helpful to also contact the Kstars/EKOS developers (if you haven't already). To narrow this down and reproduce it, we'd really need to know how Kstars is calling CFITSIO to create and modify these particular files.

RononDex commented 2 months ago

Thanks, it appears that this was indeed an issue in INDI Lib: https://indilib.org/forum/development/14597-produced-fits-files-by-ekos-kstars-do-not-follow-the-fits-file-specification.html

esabol commented 2 months ago

@RononDex : Could you close this issue then?