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'))
783576416.2276517 MJy

Observe the source through a low-resolution spectrometer:

>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> wave = np.logspace(0.5, 1.5, 100) * u.um
>>> fluxd = B.observe(wave, unit='MJy')
>>> plt.plot(wave, fluxd, ls='steps-mid', label=str(B.T))
>>> plt.setp(plt.gca(), xlabel='Wavelength (μm)', ylabel='$F_ν$ (MJy)')

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


Developers’ Notes

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


sbpy Spectroscopy Sources Module

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

Requires synphot.



Blackbody sphere.

Class Inheritance Diagram

Inheritance diagram of sbpy.spectroscopy.sources.BlackbodySource