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
rescaleArrayinspectrum()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)
- 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)
- 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)
- 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)
Installation
pip install galspec
Required packages
Numpyastropymatplotlibscipy
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| galspec-0.2.6.tar.gz | 10.7 kB | Without provenance | Details for galspec-0.2.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| galspec-0.2.6-py3-none-any.whl | Python 3 | none | any | Details for galspec-0.2.6-py3-none-any.whl |
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
|
Security for galspec 0.2.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.