Skip to main content

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

Metadata

Release files for galspec 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for galspec 0.2.6
File Size Uploaded
galspec-0.2.6.tar.gz 10.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for galspec 0.2.6
File Interpreter ABI Platform
galspec-0.2.6-py3-none-any.whl Python 3 none any Details

Total release size: 21.5 kB

Release files / galspec-0.2.6.tar.gz

Download URL galspec-0.2.6.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
fad150416e7f454374e430a009157b81bdc3486021e59cc66429daedfe7e1b57
BLAKE2b-256 checksum
How to use checksums
ac6562175f8349c003da7e1df1425301b5e8babbdf9b8b6043eccdcf0edb939d
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / galspec-0.2.6-py3-none-any.whl

Download URL galspec-0.2.6-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cdcc7133ef87c486141b8e7586f57751ba222e3deedabffbc80c575433a2ad01
BLAKE2b-256 checksum
How to use checksums
e23442cb3cf11e4093966089a6c8e6c7bd3a0811dc063a57dfd0e41dd76f7ac7
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.2.6 This release

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

1 release file

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page