/custom-spec-loaders

A collection of my specutils loaders.

Primary LanguagePythonMIT LicenseMIT

Custom Spec Loaders

A collection of custom specutils loaders.

Python Python Python

License: MIT CI

Installation

The easiest way to install the loaders is to simply download the .py files containing the loaders to the ~.specutils folder. (See section on Available Loaders for list of available loaders with their file names.)

Usage

Once the loaders are installed in the ~.specutils directory, the normal specutils reader can be used to load a spectrum.

Example:

from specutils import Spectrum1D

spectrum = Spectrum1D.read("filename.dat", format="devred")

The devred and larionov loaders have the additional parameter force_increasing, which is False by default. If set to true, the spectrum will be flipped (if necessary) so that the spectral axis is increasing. This is useful for spectra that are stored in decreasing order.

Example:

from specutils import Spectrum1D

spectrum = Spectrum1D.read("filename.dat", format="devred", force_increasing=True)

Available Loaders

All loader files are located in the ./src/specloaders folder.

name Description file
devred Load a spectrum from a file produced by my devred program. devred_loader.py
larionov Load a spectrum from a file produced by an IDL program written by Valeri M. Larionov. larionov_loader.py

devred

Use this loader to load a spectrum form a file produced by my devred program.

This is basicaly a .dat file with two columns. The first column is the wavelength in Angstroms and the second column is the flux in units of $\mathrm{erg} ~ \mathrm{s}^{-1} ~ \mathrm{cm}^{-1} ~ \mathring A^{-1}$. Note that the flux is converted to units of $10^{-15} ~ \mathrm{erg} ~ \mathrm{s}^{-1} ~ \mathrm{cm}^{-1} ~ \mathring A^{-1}$ when loaded.

Warning

This loader assumes that the first line of the file is the header. If your file does not contain a header, the first line of the file will be ignored.

larionov

Use this loader to load a spectrum from a file produced by an IDL program written by Valeri M. Larionov.

This is basicaly a .dat file with two columns. The first column is the wavelength in Angstroms and the second column is the flux in units of $\mathrm{erg} ~ \mathrm{s}^{-1} ~ \mathrm{cm}^{-1} ~ \mathring A^{-1}$. Note that the flux is converted to units of $10^{-15} ~ \mathrm{erg} ~ \mathrm{s}^{-1} ~ \mathrm{cm}^{-1} ~ \mathring A^{-1}$ when loaded.