HDU Routines
The functions described in this section change the current HDU and to find their number and type. The following is a short example which shows how to use them:
num = fits_get_num_hdus(f)
println("Number of HDUs in the file: ", num)
for i = 1:num
hdu_type = fits_movabs_hdu(f, i)
println(i, ") hdu_type = ", hdu_type)
end
CFITSIO.fits_get_num_hdus
— Functionfits_get_num_hdus(f::FITSFile)
Return the number of HDUs in the file.
CFITSIO.fits_movabs_hdu
— Functionfits_movabs_hdu(f::FITSFile, hduNum::Integer)
Change the current HDU to the value specified by hduNum
, and return a symbol describing the type of the HDU.
Possible symbols are: image_hdu
, ascii_table
, or binary_table
. The value of hduNum
must range between 1 and the value returned by fits_get_num_hdus
.
CFITSIO.fits_movrel_hdu
— Functionfits_movrel_hdu(f::FITSFile, hduNum::Integer)
Change the current HDU by moving forward or backward by hduNum
HDUs (positive means forward), and return the same as fits_movabs_hdu
.
CFITSIO.fits_movnam_hdu
— Functionfits_movnam_hdu(f::FITSFile, extname::String, extver::Integer=0,
hdu_type_int::Integer=-1)
Change the current HDU by moving to the (first) HDU which has the specified extension type and EXTNAME and EXTVER keyword values (or HDUNAME and HDUVER keywords).
If extver
is 0 (the default) then the EXTVER keyword is ignored and the first HDU with a matching EXTNAME (or HDUNAME) keyword will be found. If hdu_type_int
is -1 (the default) only the extname and extver values will be used to locate the correct extension. If no matching HDU is found in the file, the current HDU will remain unchanged.
CFITSIO.fits_copy_file
— Functionfits_copy_file(fin::FITSFile, fout::FITSFile, previous::Bool, current::Bool, following::Bool)
Copy all or a part of the HDUs from the input file fin
, and append them to the output file fout
. The flags previous
, current
and following
specify which HDUs are to be copied.
- If
previous
is true, all the HDUs prior to the current input HDU are copied. - If
current
is true, the current input HDU is copied. - If
following
is true, all the HDUs following the current input HDU are copied.
These flags may be combined, so if all are set to true
then all the HDUs are copied from fin
to fout
.
On exit, the input is unchanged, and the last HDU in the output is set as the current HDU.
CFITSIO.fits_copy_hdu
— Functionfits_copy_hdu(fin::FITSFile, fout::FITSFile[, morekeys::Integer = 0])
Copy the current HDU from the input file fin
and append it to the output file fout
. Space may be reserved for morekeys
additional keywords in the output header.
CFITSIO.fits_copy_data
— Functionfits_copy_data(fin::FITSFile, fout::FITSFile)
Copy the data (not the header) from the current HDU in fin
to the current HDU in fout
. This will overwrite pre-existing data in the output HDU.
CFITSIO.fits_delete_hdu
— Functionfits_delete_hdu(f::FITSFile)
Delete the HDU from the FITS file and shift the following HDUs forward. If f
is the primary HDU in the file then it'll be replaced by a null primary HDU with no data and minimal header information.
Return a symbol to indicate the type of the new current HDU. Possible symbols are: image_hdu
, ascii_table
, or binary_table
. The value of hduNum
must range between 1 and the value returned by fits_get_num_hdus
.
CFITSIO.fits_write_chksum
— Functionfits_write_chksum(f::FITSFile)
Compute and write the DATASUM
and CHECKSUM
keyword values for the CHDU into the current header. If the keywords already exist, their values will be updated only if necessary (i.e., if the file has been modified since the original keyword values were computed).
CFITSIO.fits_update_chksum
— Functionfits_update_chksum(f::FITSFile)
Update the CHECKSUM
keyword value in the CHDU, assuming that the DATASUM
keyword exists and already has the correct value.
CFITSIO.fits_verify_chksum
— Functionfits_verify_chksum(f::FITSFile)
Verify if the checksum of the data and the HDU matches the stored values. Returns a tuple of CFITSIO.ChecksumVerificationStatus
values, indicating the status of the data and HDU checksums. For either value, a status of MISSING
indicates that the corresponding keyword is not present, while a status of MISMATCH
indicates that the keyword is present but the value is incorrect. Finally, a value of VERIFIED
indicates that the checksum was validated successfully.