I need to create FITS files where the first HDU is empty (only containing a header). Given the structure of fits_create_img I did not find a way to do this (please let me know if I overlooked something!). So I extended the code with the following:
function fits_create_empty_hdu(f::FITSFile)
status = Ref{Cint}(0)
naxesr = C_NULL
N = 0
bitpix = bitpix_from_type(Int16)
ccall(
(:ffcrimll, libcfitsio),
Cint,
(Ptr{Cvoid}, Cint, Cint, Ptr{Int64}, Ref{Cint}),
f.ptr,
bitpix,
N,
naxesr,
status,
)
fits_assert_ok(status[])
end
function fits_create_img(f::FITSFile, a::Nothing)
status = fits_create_empty_hdu(f)
end
This appears to work ok but I am not sure whether this is superfluous. If it is useful, I'm happy to create a PR with this, but I must confess I am a tad uncertain about the logic of the runtests.jl
so if you have any hints on how to write a test conforming to the code preferences, I'd be happy to hear them!