Getting Started

The core of speXtra is the Spextrum which is a wrapper of the synphot.SourceSpectrum with added functionalities.

For example to load a S0 galaxy templates from the The Kinney-Calzetti Spectral Atlas of Galaxies (kc96) just type

from spextra import Spextrum
sp = Spextrum("kc96/s0")

The last statement will create a plot of the spectrum for a quick visualization

All operations available in synphot.SourceSpectrum are possible:

sp1 = Spextrum("kc96/s0")
sp2 = Spextrum("agn/qso")
sp = sp1 + 0.3*sp2
updating/loading 'libraries/agn/index.yml'
updating/loading 'libraries/agn/qso.fits'

Adding emission lines

It is possible to add emission lines, either individually or as a list. Parameters are center, flux and fwhm astropy.Units are allowed. If units are not specified it defaults to Angstroms for wavelengths (center and fwhm) and ergs/s/AA/cm^2 (FLAM) for flux.

import astropy.units as u

sp3 = sp1.add_emi_lines(center=4000,flux=4e-13, fwhm=5*u.AA)

Scaling to a magnitude

sp1 = Spextrum("kc96/s0")
sp2 = sp1.scale_to_magnitude(amplitude=13 * u.ABmag, filter_curve="g")

Obtaining magnitudes from spectra

\[13.034556 \; \mathrm{mag}$$\mathrm{\left( \mathrm{AB} \right)}\]

Redshifting the spectra

It is possible to specify a redshift z ir a velocity vel (negative velocities are allowed)

sp3 = sp2.redshift(z=1)

import astropy.units as u

vel = -1000 * / u.s
sp2 = sp1.redshift(vel=vel)

Smooth the spectral

Spectra can be smoothed with a kernel with a size in velocities (default km/s)

sp1 = Spextrum("nebulae/pn")

sigma = 500*( / u.s)
sp2 = sp1.smooth(sigma=sigma)
updating/loading 'libraries/nebulae/index.yml'
updating/loading 'libraries/nebulae/pn.fits'
1000.0 11000.0 0.5