read_fits_spec

synphot.specio.read_fits_spec(filename, ext=1, wave_col='WAVELENGTH', flux_col='FLUX', wave_unit=Unit("Angstrom"), flux_unit=Unit("FLAM"))[source]

Read FITS spectrum.

Wavelength and flux units are extracted from TUNIT1 and TUNIT2 keywords, respectively, from data table (not primary) header. If these keywords are not present, units are taken from wave_unit and flux_unit instead.

Parameters:
filename : str or file pointer

Spectrum file name or pointer.

ext: int

FITS extension with table data. Default is 1.

wave_col, flux_col : str

Wavelength and flux column names (case-insensitive).

wave_unit, flux_unit : str or Unit

Wavelength and flux units, which default to Angstrom and FLAM, respectively. These are only used if TUNIT1 and TUNIT2 keywords are not present in table (not primary) header.

Returns:
header : dict

Primary header only. Extension header is discarded.

wavelengths, fluxes : Quantity

Wavelength and flux of the spectrum.