Spectroscopy Sources Module (sbpy.spectroscopy.sources)

sbpy uses the sources module for evaluation and binning of spectra and spectral models.

Blackbody spectra

The BlackbodySource encapsulates a blackbody spectral model. It represents the spectral flux density from a sphere, i.e., πB(T), where B is the Planck function.

Initialize from temperature:

>>> import astropy.units as u
>>> from sbpy.spectroscopy.sources import BlackbodySource
>>>
>>> B = BlackbodySource(T=278 * u.K)
>>> print(B)
<BlackbodySource: T=278.0 K>

Observe the source through a fictitious 10-μm filter:

>>> from synphot import SpectralElement, Box1D
>>> N = SpectralElement(Box1D, x_0=10.5 * u.um, width=1 * u.um)
>>> print(B.observe(N, unit='MJy'))  
783577717.2783749 MJy

Observe the source through a low-resolution spectrometer:

import numpy as np
import matplotlib.pyplot as plt
import astropy.units as u
from sbpy.spectroscopy.sources import BlackbodySource

B = BlackbodySource(T=278 * u.K)
wave = np.logspace(0.5, 1.5, 100) * u.um
fluxd = B.observe(wave, unit='MJy')

plt.plot(wave, fluxd, drawstyle='steps-mid', label=str(B.T))
plt.setp(plt.gca(), xlabel='Wavelength (μm)', ylabel='$F_ν$ (MJy)')

(Source code, png, hires.png, pdf)

../../_images/sources-1.png

Developers’ Notes

Developers wanting to use the spectrophotometric mechanics should create classes that inherit from sbpy.spectroscopy.sources.SpectralSource using BlackbodySource as an example.

Reference/API

sbpy Spectroscopy Sources Module

Spectrophotometric classes that encapsulate synphot.SpectralSource and synphot.Observation in order to generate sbpy spectra and photometry.

Requires synphot.

Classes

BlackbodySource([T])

Blackbody sphere.

Reddening(S)

Class to handle simple linear reddening.

Class Inheritance Diagram

Inheritance diagram of sbpy.spectroscopy.sources.BlackbodySource, sbpy.spectroscopy.sources.Reddening