Plain Text

Text files should be of the form:

wavelength flux err
3637.390 0.314 0.000
3638.227 0.717 0.000
3639.065 1.482 0.000

where there ‘err’ column is optional but the others are not. The most basic spectrum file allowed would have no header and two columns, e.g.:

1  0.5
2  1.5
3  0.1

If the X-axis is not monotonic, the data will be sorted so that the X-axis is in ascending order.


Routines for reading in ASCII format spectra. If is not installed, will use a very simple routine for reading in the data.

pyspeckit.spectrum.readers.txt_reader.open_1d_txt(filename, xaxcol=0, datacol=1, errorcol=2, text_reader='simple', format=None, **kwargs)[source] [github] [bitbucket]

Attempt to read a 1D spectrum from a text file assuming wavelength as the first column, data as the second, and (optionally) error as the third.

Reading can be done either with or a ‘simple’ reader. If you have an IPAC, CDS, or formally formatted table, you’ll want to use and specify a format.

If you have a simply formatted file of the form, e.g. # name name # unit unit data data data data

kwargs are passed to

pyspeckit.spectrum.readers.txt_reader.simple_txt(filename, xaxcol=0, datacol=1, errorcol=2, skiplines=0, **kwargs)[source] [github] [bitbucket]

Very simple method for reading columns from ASCII file.

[edit this page on github]

[edit this page on bitbucket]