User-Supplied Spectra

One of the features of the ETC is its ability handle a spectrum supplied by the user. In this version of the ETC this is accomplished by a direct upload from the machine where the user is running the web browser.

To use this option, you will need to:

  • Prepare your spectrum file
  • Specify your spectrum file in the ETC input form

The file will be uploaded when you click the “submit” button at the top or bottom of the form. If the file is large or the computer has a slow internet connection it will take extra time for the browser to send the file to the ETC server.

Prepare your file

Prepare your input spectrum file with 2 columns:

  • column 1: wavelength
  • column 2: flux density

Column 1 should be the wavelength in \AA and column 2 should be the flux density (in erg\cdot~cm^{-2}\cdot~sec^{-1}\cdot\AA^{-1} for point sources, and in erg\cdot~cm^{-2}\cdot~sec^{-1}\cdot\AA^{-1}\cdot~arcsec^{-2} for diffuse sources).

  • The wavelengths in the first column must be in increasing order, with no duplicates.
  • If your spectrum has zero or negative wavelength or flux values anywhere in the file, you will get a pysynphot error message.
  • If your spectrum has NaN values for the flux anywhere in the file, these NaNs will be identified as the brightest pixel value in spectroscopic modes. This is because NaNs are inherently not comparable and will register as both the max() and the min() value of the array. You may wish to remove any rows containing NaNs.

The user specified spectrum file should be in one of the following 2 file formats:

  • ASCII table with the extension .dat
  • FITS table with an extension .fits or .fit

Try to use a unique filename for this file, for example by using your last name as part of the filename.

Regardless of the file format used, your input spectrum file must meet the following requirements in order to be successfully uploaded:

  • wavelengths must be in increasing order
  • there must be no duplicate wavelengths
  • there must be no wavelengths with negative or zero values

Violating any of these requirements will cause the calculation to fail and produce a pysynphot error message.

You may use pysynphot locally to validate your file by using the following command:

>>> import pysynphot as psyn
>>> sp = psyn.FileSpectrum('myfile.dat')

(The same command will also work for a FITS file.) If this command succeeds, then your input spectrum file meets the necessary requirements.

Spectrum File Format


If the file is an ASCII file, it must contain the following 2 columns:

  • column 1: wavelength (in \AA)
  • column 2: flux density in erg \cdot cm^{-2} \cdot sec^{-1} \cdot \AA^{-1} for point sources, and in erg \cdot cm^{-2} \cdot sec^{-1} \cdot \AA^{-1} \cdot arcsec^{-2} for diffuse sources

These are the only units supported for ASCII files. Any comment lines in the file must start with # in order to avoid confusion when it is used in the calculation.


If the user supplied file is a FITS binary table, it should have two columns labeled “WAVELENGTH” and “FLUX”, with the units specified for each column. The header of the FITS table should have pysynphot compliant units in the TUNIT field of the extension 1 of the table. For example:

TBCOL1 = 1 /
TFORM1 = 'E15.7 ' /
TUNIT1 = 'angstroms' /
TDISP1 = 'G15.7 ' / %15.7g
TTYPE2 = 'FLUX ' /
TBCOL2 = 17 /
TFORM2 = 'E15.7 ' /
TUNIT2 = 'flam ' /
TDISP2 = 'G15.7 ' / %15.7g

The valid units for Wavelength and Flux are:

Wavelength Flux
angstrom, angstroms flam
hz fnu
nm photlam
micron, microns, um photnu
inversemicron, inversemicrons jy
um mjy
mm abmag
cm stmag
m, meter obmag
count, counts

Table 1: Accepted Wavelength and Flux Formats


The SDAS table file format is not portable to different machine architectures and so support for it has been discontinued. We recommend using the TTools command “tcopy” to convert all SDAS files to FITS format.

Specify your spectrum

In section 3 of the ETC input form, simply select the radio box next to “Upload Spectrum File”, click the “Choose File” button, and navigate through the local file system to the file containing the spectrum you wish to use.



Table Of Contents

Previous topic

Other Spectra

Next topic

E(B-V) and the Interstellar Extinction Curves

Return to the ETC