Skip to main content

Creates sample galaxy spectra in the GHz/THz range

Project description

GalSpec package

This 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 lines
  • SIII
  • SiII
  • OIII, OI
  • NIII, NII
  • CII, CI

Code by Tom Bakx, packaging and addition of molecular lines and rescaling by Stefanie Brackenhoff

Functionalities & Usage

  • A spectrum can be generated using the spectrum() function.

It takes the following inputs:

  • luminosity in units of log(L_fir [L_sol])
  • redshift z
  • fLow, fHigh minimum and maximum frequency that will be in the spectrum in units of GHz
  • numFreqBins amount of linearly spaced frequency bins at which the spectrum should be evaluated
  • linewidth width of spectral lines in units of km/s
  • COlines 'Kamenetzky' 1 or 'Rosenberg' 2 determines the amplitude of the CO lines, default is Kamenetzky.
  • lines 'Bonato' 3 or 'Spinoglio' 4 determines the amplitude of the remaining spectral lines, default is Bonato
  • mollines 'True' or 'False'. Toggles whether molecularlines are shown. Values estimated using 5. Defaults as 'True'
  • variance adds uncertainty to the amplitude of the atomic lines. Defaults to 0. Variation in molecular lines not implemented in the current version.
  • manualrescale sets 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'.
  • rescaleArray rescales the emission lines according to setting in 'manualrescale'. Order of the lines can be found using linenames()

And creates as output:

  • freqArray array frequencies in units of GHz
  • spectrum array of the flux densities in the spectrum in units of Jy
  • The spectrum can quickly be plotted using the plotspectrum() function

This function takes the outputs of spectrum() as an input and creates a plot with axis labels

  • The names of the spectral lines and their order for the rescaleArray in spectrum() are outputted in a numpy array. Whether the names of molecular lines are shown can be toggled by setting the keyword mollines to 'False'.

Examples

  • Simple example
import 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)

Example

  • Using the ratios by Rosenberg and Spinoglio
import 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)

Example2

  • Using manual ratios to only show CO lines
import 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)

Example3

  • Including molecular lines
import 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)

Example4

Installation

pip install galspec

Required packages

  • Numpy
  • astropy
  • matplotlib
  • scipy

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

galspec-0.2.6.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

galspec-0.2.6-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file galspec-0.2.6.tar.gz.

File metadata

  • Download URL: galspec-0.2.6.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.8.0 tqdm/4.50.2 CPython/3.8.6

File hashes

Hashes for galspec-0.2.6.tar.gz
Algorithm Hash digest
SHA256 fad150416e7f454374e430a009157b81bdc3486021e59cc66429daedfe7e1b57
MD5 712198fbc2cda70e9d08c0f9a08720c4
BLAKE2b-256 ac6562175f8349c003da7e1df1425301b5e8babbdf9b8b6043eccdcf0edb939d

See more details on using hashes here.

File details

Details for the file galspec-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: galspec-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.8.0 tqdm/4.50.2 CPython/3.8.6

File hashes

Hashes for galspec-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 cdcc7133ef87c486141b8e7586f57751ba222e3deedabffbc80c575433a2ad01
MD5 b00e6d18058cb320f027611e90688997
BLAKE2b-256 e23442cb3cf11e4093966089a6c8e6c7bd3a0811dc063a57dfd0e41dd76f7ac7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page