RvSpectML/EchelleInstruments.jl

arguments should be made consistent between docstrings and functions

hematthi opened this issue · 0 comments

""" `read_header( fits_file )`
Read header from FITS file and return Dict with contents.
Optional inputs:
- hdu: Specifies which HDU to read from the FITS file. (Default: 1)
"""
function read_header(f::FITS; header_idx::Integer = 1)
@assert 1<=header_idx<=length(f)
#@assert read_key(f[header_idx],"SKY-OBJ")[1] == "Solar"
hdr = FITSIO.read_header(f[header_idx])
metadata = Dict(zip(map(k->Symbol(k),hdr.keys),hdr.values))
end
""" `read_header( filename )`
Read header from FITS file and return Dict with contents.
Optional inputs:
- hdu: Specifies which HDU to read from the FITS file. (Default: 1)
"""
function read_header(fn::String; header_idx::Integer = 1)
#println("# Reading: ",fn, " hdu= ",header_idx)
f = FITS(fn)
read_header(f, header_idx=header_idx)
end
""" `read_fits_header( filename )`
Read header from FITS file and return Dict with contents.
Optional inputs:
- hdu: Specifies which HDU to read from the FITS file. (Default: 1)
"""
function read_fits_header(fn::String; header_idx::Integer = 1)
read_header(fn,header_idx=header_idx)
end

fits_file or f
filename or fn
hdu or header_idx