Package: galspec
GalSpec packageThis package is intended to quickly and easily generate a galaxy spectrum with a blackbody continuum emission and emission lines. The lines in this package are:CO linesSIIISiIIOIII, OINIII, NIICII, CICode by Tom Bakx, packaging and addition of molecular lines and rescaling by Stefanie BrackenhoffFunctionalities & UsageA spectrum can be generated using thespectrum()function.It takes the following inputs:luminosityin units of log(L_fir [L_sol])redshiftzfLow, fHighminimum and maximum frequency that will be in the spectrum in units of GHznumFreqBinsamount of linearly spaced frequency bins at which the spectrum should be evaluatedlinewidthwidth of spectral lines in units of km/sCOlines'Kamenetzky'1or 'Rosenberg'2determines the amplitude of the CO lines, default is Kamenetzky.lines'Bonato'3or 'Spinoglio'4determines the amplitude of the remaining spectral lines, default is Bonatomollines'True' or 'False'. Toggles whether molecularlines are shown. Values estimated using5. Defaults as 'True'varianceadds uncertainty to the amplitude of the atomic lines. Defaults to 0. Variation in molecular lines not implemented in the current version.manualrescalesets whether the lines should be default ratios by Kamenetzky/Rosenberg and Bonato/Spinoglio, or set by user. Options:'False'default line amplitudes used'Absolute'numpy array of 37 line amplitudes in Jy additive to blackbody emission can be set in rescaleArray. Additional entries ignored if mollines is set to 'False'.'Relative'numpy array of 37 scalars can be set in rescaleArray. The default ratios from Kamenetzky/Rosenberg are multiplied by these scalars prior to addition to the blackbody spectrum. Additional entries ignored if mollines is set to 'False'.rescaleArrayrescales the emission lines according to setting in 'manualrescale'. Order of the lines can be found usinglinenames()And creates as output:freqArrayarray frequencies in units of GHzspectrumarray of the flux densities in the spectrum in units of JyThe spectrum can quickly be plotted using theplotspectrum()functionThis function takes the outputs ofspectrum()as an input and creates a plot with axis labelsThe names of the spectral lines and their order for therescaleArrayinspectrum()are outputted in a numpy array. Whether the names of molecular lines are shown can be toggled by setting the keyword mollines to 'False'.ExamplesSimple exampleimport galspec

luminosity = 13.7
z = 4.43
fLow = 90 #GHz
fHigh = 910 #GHz
numFreqBins = 1500
linewidth = 600
gal_freq, gal_flux = galspec.spectrum(luminosity, z, fLow, fHigh, numFreqBins, linewidth, mollines = 'False')

galspec.plotspectrum(gal_freq, gal_flux)Using the ratios by Rosenberg and Spinoglioimport galspec

luminosity = 13.7
z = 4.43
fLow = 90 #GHz
fHigh = 910 #GHz
numFreqBins = 1500
linewidth = 600
gal_freq, gal_flux = galspec.spectrum(luminosity, z, fLow, fHigh, numFreqBins, linewidth, 'Rosenberg', 'Spinoglio', mollines = 'False')

galspec.plotspectrum(gal_freq, gal_flux)Using manual ratios to only show CO linesimport galspec
import numpy as np

luminosity = 13.7
z = 4.43
fLow = 90 #GHz
fHigh = 910 #GHz
numFreqBins = 1500
linewidth = 600

names = galspec.linenames()
lines = np.zeros(len(names))
for i in range(len(names)):
    if names[i].startswith('CO'): lines[i]=1

gal_freq, gal_flux = galspec.spectrum(luminosity, z, fLow, fHigh, numFreqBins, linewidth, manualrescale = 'Relative', rescaleArray = lines, mollines = 'False')

galspec.plotspectrum(gal_freq, gal_flux)Including molecular linesimport galspec
import numpy as np

luminosity = 13.7
z = 4.43
fLow = 90 #GHz
fHigh = 910 #GHz
numFreqBins = 1500
linewidth = 600


gal_freq, gal_flux = galspec.spectrum(luminosity, z, fLow, fHigh, numFreqBins, linewidth)

galspec.plotspectrum(gal_freq, gal_flux)Installationpip install galspecRequired packagesNumpyastropymatplotlibscipy