Barak 0.3.2 documentation

barak.spec.Spectrum

«  barak.sed.qso_template_uv   ::   Contents   ::   barak.spec.Spectrum.multiply  »

barak.spec.Spectrum

class barak.spec.Spectrum(dw=None, dv=None, wstart=None, wend=None, npts=None, CRVAL=None, CRPIX=None, CDELT=None, wa=None, fl=None, er=None, co=None, fwhm=None, filename=None)[source]

A class to hold information about a spectrum.

Notes

If enough information is given, the wavelength scale will be generated. Note that there is no error check if you give conflicting wavelength scale information in the keywords! In this case certain combinations of keywords take precendence. See the code comments for details.

Notes for FITS header:

wstart = CRVAL - (CRPIX - 1.0) * CDELT,  dw = CDELT

Conversion between velocity width and log-linear pixel width:

dv / c_kms = 1 - 10**(-dw)

Examples

>>> sp = Spectrum(wstart=4000, dw=1, npts=500)
>>> sp = Spectrum(wstart=4000, dv=60, npts=500)
>>> sp = Spectrum(wstart=4000, wend=4400, npts=500)
>>> wa = np.linspace(4000, 5000, 500)
>>> fl = np.ones(len(wa))
>>> sp = Spectrum(wa=wa, fl=fl)
>>> sp = Spectrum(CRVAL=4000, CRPIX=1, CDELT=1, fl=np.ones(500))

Attributes

wa array of floats, shape(N,) Wavelength values (overrides all wavelength keywords)
fl array of floats, shape(N,) Flux.
er array of floats, shape(N,) Error.
co array of floats, shape(N,) Continuum.
dw float Wavelength difference between adjacent pixel centres.
dv float Velocity difference (km/s)
fwhm float Instrumental FWHM in km/s
filename str Filename of spectrum
__init__(dw=None, dv=None, wstart=None, wend=None, npts=None, CRVAL=None, CRPIX=None, CDELT=None, wa=None, fl=None, er=None, co=None, fwhm=None, filename=None)[source]

Create the wavelength scale and initialise attributes.

Methods

__init__([dw, dv, wstart, wend, npts, ...]) Create the wavelength scale and initialise attributes.
multiply(val) Multipy the flux, error and continuum by val.
plot([ax, show, yperc, alpha, linewidth, ...]) Plots a spectrum.
rebin(**kwargs) Class method version of spec.rebin()
rebin_simple(n) Class method version of spec.rebin_simple().
stats(wa1, wa2[, show]) Calculates statistics (mean, standard deviation (i.e.
write(filename[, header, overwrite]) Writes out a spectrum, as ascii - wavelength, flux, error, continuum.

«  barak.sed.qso_template_uv   ::   Contents   ::   barak.spec.Spectrum.multiply  »