write_fits_spec

synphot.specio.write_fits_spec(filename, wavelengths, fluxes, pri_header={}, ext_header={}, overwrite=False, trim_zero=True, pad_zero_ends=True, precision=None, epsilon=0.00032, wave_col='WAVELENGTH', flux_col='FLUX', wave_unit=Unit('Angstrom'), flux_unit=Unit('FLAM'))[source]

Write FITS spectrum.

Warning

If data is being written out as single-precision but wavelengths are in double-precision, some rows may be omitted.

Parameters
filenamestr

Output spectrum filename.

wavelengths, fluxesarray-like or Quantity

Wavelength and flux of the spectrum.

pri_header, ext_headerdict

Metadata to be added to primary and given extension FITS header, respectively. Do not use this to define column names and units.

overwritebool

Overwrite existing file. Defaults to False.

trim_zerobool

Remove rows with zero-flux. Default is True.

pad_zero_endsbool

Pad each end of the spectrum with a row of zero flux like synphot.spectrum.BaseSpectrum.taper(). This is unnecessary if input is already tapered.

precision{None, ‘single’, ‘double’}

Precision of values in output file. Use native flux precision by default.

epsilonfloat

Single-precision \(\epsilon\) value, taken from IRAF SYNPHOT FAQ. This is the minimum separation in wavelengths necessary for SYNPHOT to read the entries as distinct single-precision numbers. This is only used if precision='single' but data are in double-precision. Default from the FAQ is 0.00032.

wave_col, flux_colstr

Wavelength and flux column names (case-insensitive).

wave_unit, flux_unitstr or Unit

Wavelength and flux units, which default to Angstrom and FLAM, respectively. These are only used if wavelengths and fluxes are not in astropy quantities.

Raises
synphot.exceptions.SynphotError

Wavelengths and fluxes have difference shapes or value precision is not supported.