Command-Line Utilities

I also include some IRAF-like command-line utilities for working with spectra that take advantage of the parsing functions included in the speccal module.

speccal

Calibrate spectra to photometry.

usage: speccal [-h] [--lc-format LC_FORMAT] [-f FILTERS [FILTERS ...]]
               [-o ORDER] [--subtract-percentile SUBTRACT_PERCENTILE]
               [--max-extrapolate MAX_EXTRAPOLATE] [--show]
               spectra [spectra ...] lc

Positional Arguments

spectra

filenames of spectra

lc

filename of photometry table (must have columns “MJD”, “filter”, “mag”/”flux”, and”dmag”/”dflux”)

Named Arguments

--lc-format

format of photometry table (passed to astropy.table.Table.read())

Default: “ascii”

-f, --filters

filters to use for calibration

-o, --order

polynomial order of correction function

Default: 0

--subtract-percentile

subtract continuum from spectrum before correcting

--max-extrapolate

assume constant flux in a filter for this many days after the last observed point

Default: 1.0

--show

Default: False

rspectext

Convert spectra from ASCII to FITS.

usage: rspectext [-h] [--bunit-out BUNIT_OUT] spectra [spectra ...]

Positional Arguments

spectra

filenames of spectra

Named Arguments

--bunit-out

output flux unit

Default: “1e-15 erg s-1 cm-2 angstrom-1”

wspectext

Convert spectra from FITS to ASCII.

usage: wspectext [-h] spectra [spectra ...]

Positional Arguments

spectra

filenames of spectra

scombine

Combine two spectra after matching scaling in the overlap region.

usage: scombine [-h] filename1 filename2 filename-out

Positional Arguments

filename1

filename of first spectrum (adopt this dispersion function)

filename2

filename of second spectrum

filename-out

filename of output spectrum

scopy

Copy a spectrum, possibly after trimming.

usage: scopy [-h] [--w1 W1] [--w2 W2] infile outfile

Positional Arguments

infile

filename of input spectrum

outfile

filename of output spectrum

Named Arguments

--w1

smaller wavelength before which to trim

Default: 0.0

--w2

larger wavelength after which to trim

Default: inf

splot

Quickly plot one or more spectra.

usage: splot [-h] [--separate] [--xscale {linear,log}] [--yscale {linear,log}]
             [--save]
             spectra [spectra ...]

Positional Arguments

spectra

filenames of spectra

Named Arguments

--separate

plot on separate figures

Default: False

--xscale

Possible choices: linear, log

scale for the x-axis

Default: “linear”

--yscale

Possible choices: linear, log

scale for the y-axis

Default: “linear”

--save

save the figure(s) as PDF

Default: False