sources#

One critical component of Monte Carlo radiative transfer are sources of photons to be propagated through the model. Sources are added by initializing a source object and adding it to the model using the add_sources method. For example:

from pinballrt import Model
from pinballrt.sources import BlackbodyStar

star = BlackbodyStar()

model = Model()
model.add_sources(star)

Multiple sources can be added in a single call by providing a list of sources: model.add_sources([star1, star2]). pinball-rt implements four different types of sources (and one special instance of those types), which are described in the following sections.

Classes Summary

SphericalSource(luminosity, frequency, intensity)

Sphercal sources, e.g. stars, emit photons from the surface of a sphere in a random outward direction.

BlackbodyStar([temperature, luminosity, x, ...])

A spherical blackbody star emitting photons isotropically from its surface.

ExternalSource(grid, intensity[, frequency])

An external isotropic radiation source surrounding the simulation grid.

DiffuseSource(grid, spectrum, density[, ...])

A diffuse source emitting photons from within the simulation grid.

EnergySource(grid, energy_density)

A diffuse energy source that directly injects energy into the grid based on a specified energy density, and then the grid reradiates that energy away based on the temperature and dust properties in the cell.

class pinballrt.sources.SphericalSource(luminosity, frequency, intensity, x=0.0, y=0.0, z=0.0)#

Bases: object

Sphercal sources, e.g. stars, emit photons from the surface of a sphere in a random outward direction. They can be created using the SphericalSource class, which takes the total luminosity of the source as well as the spectrum of the source as input. The spectrum must be specified with astropy units that can be converted to units of u.Jy / u.steradian. For example:

from pinballrt.sources import SphericalSource
import astropy.units as u
from astropy.modeling import models

frequency = np.logspace(9, 15, 100) * u.Hz
spectrum = models.BlackBody(temperature=5000*u.K)(frequency)

star = SphericalSource(luminosity=1.0e4*u.Lsun, frequency, spectrum)

The radius of the spherical source is determined by solving

\[L = 4 \pi^2 R^2 \int I_{\nu} d\nu\]

where \(L\) is the luminosity of the source, \(R\) is the radius of the source, and \(I_\nu\) is the specific intensity of the source at frequency \(\nu\), and is provided as the spectrum above.

Parameters:
luminosityastropy.units.Quantity

The total luminosity of the source.

frequencyastropy.units.Quantity

The frequency array over which the intensity is defined.

intensityastropy.units.Quantity or callable

The intensity as a function of frequency. If callable, it should take a frequency array as input and return the intensity at those frequencies in units that are compatible with Jy / steradian.

x, y, zfloat

The position of the center of the source in the simulation grid.

class pinballrt.sources.BlackbodyStar(temperature=<Quantity 4000. K>, luminosity=<Quantity 3.828e+26 W>, x=0.0, y=0.0, z=0.0, nu=<Quantity [3.16227766e+00, 3.20594418e+00, 3.25021367e+00, 3.29509445e+00, 3.34059498e+00, 3.38672380e+00, 3.43348960e+00, 3.48090116e+00, 3.52896741e+00, 3.57769739e+00, 3.62710025e+00, 3.67718530e+00, 3.72796195e+00, 3.77943976e+00, 3.83162840e+00, 3.88453769e+00, 3.93817758e+00, 3.99255816e+00, 4.04768966e+00, 4.10358244e+00, 4.16024703e+00, 4.21769407e+00, 4.27593437e+00, 4.33497889e+00, 4.39483873e+00, 4.45552514e+00, 4.51704955e+00, 4.57942352e+00, 4.64265879e+00, 4.70676725e+00, 4.77176095e+00, 4.83765212e+00, 4.90445315e+00, 4.97217661e+00, 5.04083524e+00, 5.11044194e+00, 5.18100981e+00, 5.25255212e+00, 5.32508233e+00, 5.39861407e+00, 5.47316118e+00, 5.54873769e+00, 5.62535779e+00, 5.70303591e+00, 5.78178665e+00, 5.86162483e+00, 5.94256545e+00, 6.02462376e+00, 6.10781516e+00, 6.19215533e+00, 6.27766011e+00, 6.36434558e+00, 6.45222806e+00, 6.54132407e+00, 6.63165037e+00, 6.72322395e+00, 6.81606202e+00, 6.91018206e+00, 7.00560175e+00, 7.10233906e+00, 7.20041217e+00, 7.29983953e+00, 7.40063984e+00, 7.50283206e+00, 7.60643540e+00, 7.71146936e+00, 7.81795368e+00, 7.92590840e+00, 8.03535382e+00, 8.14631053e+00, 8.25879939e+00, 8.37284156e+00, 8.48845848e+00, 8.60567191e+00, 8.72450389e+00, 8.84497677e+00, 8.96711321e+00, 9.09093617e+00, 9.21646896e+00, 9.34373517e+00, 9.47275874e+00, 9.60356394e+00, 9.73617538e+00, 9.87061799e+00, 1.00069171e+01, 1.01450982e+01, 1.02851875e+01, 1.04272112e+01, 1.05711960e+01, 1.07171690e+01, 1.08651577e+01, 1.10151900e+01, 1.11672939e+01, 1.13214983e+01, 1.14778319e+01, 1.16363243e+01, 1.17970052e+01, 1.19599049e+01, 1.21250541e+01, 1.22924837e+01, 1.24622252e+01, 1.26343107e+01, 1.28087724e+01, 1.29856431e+01, 1.31649562e+01, 1.33467454e+01, 1.35310448e+01, 1.37178891e+01, 1.39073135e+01, 1.40993535e+01, 1.42940453e+01, 1.44914256e+01, 1.46915314e+01, 1.48944003e+01, 1.51000706e+01, 1.53085809e+01, 1.55199705e+01, 1.57342790e+01, 1.59515468e+01, 1.61718148e+01, 1.63951243e+01, 1.66215175e+01, 1.68510368e+01, 1.70837254e+01, 1.73196272e+01, 1.75587863e+01, 1.78012480e+01, 1.80470577e+01, 1.82962616e+01, 1.85489068e+01, 1.88050406e+01, 1.90647112e+01, 1.93279675e+01, 1.95948590e+01, 1.98654359e+01, 2.01397490e+01, 2.04178501e+01, 2.06997913e+01, 2.09856257e+01, 2.12754070e+01, 2.15691899e+01, 2.18670294e+01, 2.21689817e+01, 2.24751036e+01, 2.27854525e+01, 2.31000869e+01, 2.34190659e+01, 2.37424496e+01, 2.40702988e+01, 2.44026751e+01, 2.47396410e+01, 2.50812599e+01, 2.54275962e+01, 2.57787148e+01, 2.61346818e+01, 2.64955643e+01, 2.68614300e+01, 2.72323478e+01, 2.76083874e+01, 2.79896197e+01, 2.83761161e+01, 2.87679496e+01, 2.91651937e+01, 2.95679232e+01, 2.99762137e+01, 3.03901422e+01, 3.08097865e+01, 3.12352254e+01, 3.16665391e+01, 3.21038085e+01, 3.25471161e+01, 3.29965450e+01, 3.34521800e+01, 3.39141066e+01, 3.43824117e+01, 3.48571835e+01, 3.53385111e+01, 3.58264853e+01, 3.63211976e+01, 3.68227412e+01, 3.73312105e+01, 3.78467009e+01, 3.83693095e+01, 3.88991346e+01, 3.94362759e+01, 3.99808342e+01, 4.05329122e+01, 4.10926135e+01, 4.16600436e+01, 4.22353090e+01, 4.28185180e+01, 4.34097803e+01, 4.40092070e+01, 4.46169110e+01, 4.52330066e+01, 4.58576095e+01, 4.64908372e+01, 4.71328090e+01, 4.77836454e+01, 4.84434690e+01, 4.91124038e+01, 4.97905756e+01, 5.04781120e+01, 5.11751423e+01, 5.18817976e+01, 5.25982108e+01, 5.33245166e+01, 5.40608516e+01, 5.48073544e+01, 5.55641653e+01, 5.63314267e+01, 5.71092829e+01, 5.78978801e+01, 5.86973668e+01, 5.95078932e+01, 6.03296118e+01, 6.11626771e+01, 6.20072459e+01, 6.28634770e+01, 6.37315314e+01, 6.46115724e+01, 6.55037655e+01, 6.64082785e+01, 6.73252815e+01, 6.82549471e+01, 6.91974499e+01, 7.01529674e+01, 7.11216792e+01, 7.21037675e+01, 7.30994171e+01, 7.41088152e+01, 7.51321515e+01, 7.61696187e+01, 7.72214119e+01, 7.82877288e+01, 7.93687699e+01, 8.04647388e+01, 8.15758413e+01, 8.27022866e+01, 8.38442865e+01, 8.50020558e+01, 8.61758122e+01, 8.73657765e+01, 8.85721725e+01, 8.97952271e+01, 9.10351703e+01, 9.22922354e+01, 9.35666587e+01, 9.48586800e+01, 9.61685423e+01, 9.74964918e+01, 9.88427785e+01, 1.00207655e+02, 1.01591379e+02, 1.02994210e+02, 1.04416413e+02, 1.05858254e+02, 1.07320004e+02, 1.08801939e+02, 1.10304338e+02, 1.11827483e+02, 1.13371660e+02, 1.14937160e+02, 1.16524277e+02, 1.18133310e+02, 1.19764561e+02, 1.21418338e+02, 1.23094951e+02, 1.24794716e+02, 1.26517952e+02, 1.28264983e+02, 1.30036138e+02, 1.31831751e+02, 1.33652158e+02, 1.35497703e+02, 1.37368732e+02, 1.39265597e+02, 1.41188655e+02, 1.43138267e+02, 1.45114801e+02, 1.47118629e+02, 1.49150126e+02, 1.51209675e+02, 1.53297663e+02, 1.55414484e+02, 1.57560535e+02, 1.59736220e+02, 1.61941948e+02, 1.64178134e+02, 1.66445198e+02, 1.68743568e+02, 1.71073674e+02, 1.73435956e+02, 1.75830858e+02, 1.78258830e+02, 1.80720328e+02, 1.83215817e+02, 1.85745764e+02, 1.88310647e+02, 1.90910947e+02, 1.93547153e+02, 1.96219761e+02, 1.98929274e+02, 2.01676202e+02, 2.04461061e+02, 2.07284375e+02, 2.10146675e+02, 2.13048499e+02, 2.15990393e+02, 2.18972910e+02, 2.21996612e+02, 2.25062067e+02, 2.28169851e+02, 2.31320549e+02, 2.34514754e+02, 2.37753066e+02, 2.41036095e+02, 2.44364457e+02, 2.47738780e+02, 2.51159697e+02, 2.54627852e+02, 2.58143897e+02, 2.61708494e+02, 2.65322312e+02, 2.68986033e+02, 2.72700344e+02, 2.76465944e+02, 2.80283542e+02, 2.84153856e+02, 2.88077613e+02, 2.92055551e+02, 2.96088419e+02, 3.00176975e+02, 3.04321989e+02, 3.08524239e+02, 3.12784516e+02, 3.17103621e+02, 3.21482367e+02, 3.25921577e+02, 3.30422086e+02, 3.34984741e+02, 3.39610400e+02, 3.44299932e+02, 3.49054220e+02, 3.53874158e+02, 3.58760652e+02, 3.63714622e+02, 3.68736999e+02, 3.73828728e+02, 3.78990766e+02, 3.84224085e+02, 3.89529668e+02, 3.94908514e+02, 4.00361633e+02, 4.05890053e+02, 4.11494812e+02, 4.17176965e+02, 4.22937580e+02, 4.28777741e+02, 4.34698547e+02, 4.40701110e+02, 4.46786560e+02, 4.52956041e+02, 4.59210714e+02, 4.65551755e+02, 4.71980356e+02, 4.78497728e+02, 4.85105095e+02, 4.91803700e+02, 4.98594803e+02, 5.05479682e+02, 5.12459631e+02, 5.19535963e+02, 5.26710009e+02, 5.33983119e+02, 5.41356659e+02, 5.48832018e+02, 5.56410601e+02, 5.64093832e+02, 5.71883159e+02, 5.79780045e+02, 5.87785975e+02, 5.95902456e+02, 6.04131014e+02, 6.12473196e+02, 6.20930572e+02, 6.29504732e+02, 6.38197289e+02, 6.47009878e+02, 6.55944156e+02, 6.65001803e+02, 6.74184524e+02, 6.83494044e+02, 6.92932116e+02, 7.02500514e+02, 7.12201038e+02, 7.22035513e+02, 7.32005787e+02, 7.42113737e+02, 7.52361262e+02, 7.62750292e+02, 7.73282779e+02, 7.83960704e+02, 7.94786076e+02, 8.05760932e+02, 8.16887334e+02, 8.28167376e+02, 8.39603179e+02, 8.51196894e+02, 8.62950701e+02, 8.74866812e+02, 8.86947467e+02, 8.99194939e+02, 9.11611531e+02, 9.24199578e+02, 9.36961448e+02, 9.49899541e+02, 9.63016290e+02, 9.76314163e+02, 9.89795661e+02, 1.00346332e+03, 1.01731971e+03, 1.03136743e+03, 1.04560914e+03, 1.06004750e+03, 1.07468523e+03, 1.08952509e+03, 1.10456987e+03, 1.11982240e+03, 1.13528554e+03, 1.15096220e+03, 1.16685534e+03, 1.18296793e+03, 1.19930302e+03, 1.21586368e+03, 1.23265301e+03, 1.24967418e+03, 1.26693039e+03, 1.28442488e+03, 1.30216094e+03, 1.32014192e+03, 1.33837118e+03, 1.35685217e+03, 1.37558835e+03, 1.39458325e+03, 1.41384044e+03, 1.43336355e+03, 1.45315624e+03, 1.47322225e+03, 1.49356533e+03, 1.51418933e+03, 1.53509811e+03, 1.55629561e+03, 1.57778582e+03, 1.59957278e+03, 1.62166058e+03, 1.64405339e+03, 1.66675540e+03, 1.68977090e+03, 1.71310422e+03, 1.73675973e+03, 1.76074189e+03, 1.78505520e+03, 1.80970426e+03, 1.83469367e+03, 1.86002816e+03, 1.88571248e+03, 1.91175146e+03, 1.93815001e+03, 1.96491308e+03, 1.99204571e+03, 2.01955300e+03, 2.04744013e+03, 2.07571234e+03, 2.10437495e+03, 2.13343335e+03, 2.16289300e+03, 2.19275945e+03, 2.22303831e+03, 2.25373528e+03, 2.28485613e+03, 2.31640671e+03, 2.34839297e+03, 2.38082090e+03, 2.41369662e+03, 2.44702631e+03, 2.48081623e+03, 2.51507274e+03, 2.54980229e+03, 2.58501140e+03, 2.62070670e+03, 2.65689490e+03, 2.69358280e+03, 2.73077731e+03, 2.76848543e+03, 2.80671424e+03, 2.84547094e+03, 2.88476281e+03, 2.92459724e+03, 2.96498173e+03, 3.00592388e+03, 3.04743137e+03, 3.08951202e+03, 3.13217375e+03, 3.17542458e+03, 3.21927263e+03, 3.26372617e+03, 3.30879354e+03, 3.35448323e+03, 3.40080383e+03, 3.44776405e+03, 3.49537273e+03, 3.54363881e+03, 3.59257138e+03, 3.64217963e+03, 3.69247291e+03, 3.74346066e+03, 3.79515248e+03, 3.84755809e+03, 3.90068734e+03, 3.95455024e+03, 4.00915690e+03, 4.06451761e+03, 4.12064276e+03, 4.17754292e+03, 4.23522880e+03, 4.29371123e+03, 4.35300122e+03, 4.41310992e+03, 4.47404863e+03, 4.53582883e+03, 4.59846211e+03, 4.66196028e+03, 4.72633526e+03, 4.79159916e+03, 4.85776427e+03, 4.92484303e+03, 4.99284804e+03, 5.06179211e+03, 5.13168819e+03, 5.20254944e+03, 5.27438918e+03, 5.34722093e+03, 5.42105838e+03, 5.49591541e+03, 5.57180612e+03, 5.64874477e+03, 5.72674583e+03, 5.80582397e+03, 5.88599406e+03, 5.96727120e+03, 6.04967065e+03, 6.13320792e+03, 6.21789872e+03, 6.30375898e+03, 6.39080484e+03, 6.47905269e+03, 6.56851911e+03, 6.65922093e+03, 6.75117521e+03, 6.84439925e+03, 6.93891059e+03, 7.03472698e+03, 7.13186647e+03, 7.23034731e+03, 7.33018803e+03, 7.43140741e+03, 7.53402448e+03, 7.63805855e+03, 7.74352917e+03, 7.85045620e+03, 7.95885973e+03, 8.06876017e+03, 8.18017817e+03, 8.29313469e+03, 8.40765098e+03, 8.52374857e+03, 8.64144931e+03, 8.76077532e+03, 8.88174906e+03, 9.00439326e+03, 9.12873101e+03, 9.25478569e+03, 9.38258100e+03, 9.51214098e+03, 9.64348999e+03, 9.77665275e+03, 9.91165430e+03, 1.00485200e+04, 1.01872757e+04, 1.03279473e+04, 1.04705615e+04, 1.06151449e+04, 1.07617248e+04, 1.09103288e+04, 1.10609848e+04, 1.12137211e+04, 1.13685665e+04, 1.15255501e+04, 1.16847014e+04, 1.18460503e+04, 1.20096273e+04, 1.21754630e+04, 1.23435887e+04, 1.25140359e+04, 1.26868368e+04, 1.28620238e+04, 1.30396299e+04, 1.32196885e+04, 1.34022334e+04, 1.35872990e+04, 1.37749201e+04, 1.39651320e+04, 1.41579704e+04, 1.43534717e+04, 1.45516725e+04, 1.47526102e+04, 1.49563226e+04, 1.51628480e+04, 1.53722251e+04, 1.55844935e+04, 1.57996930e+04, 1.60178641e+04, 1.62390478e+04, 1.64632858e+04, 1.66906201e+04, 1.69210936e+04, 1.71547496e+04, 1.73916321e+04, 1.76317856e+04, 1.78752553e+04, 1.81220869e+04, 1.83723269e+04, 1.86260224e+04, 1.88832210e+04, 1.91439712e+04, 1.94083220e+04, 1.96763230e+04, 1.99480248e+04, 2.02234784e+04, 2.05027356e+04, 2.07858490e+04, 2.10728717e+04, 2.13638579e+04, 2.16588621e+04, 2.19579399e+04, 2.22611475e+04, 2.25685420e+04, 2.28801812e+04, 2.31961237e+04, 2.35164288e+04, 2.38411570e+04, 2.41703691e+04, 2.45041273e+04, 2.48424941e+04, 2.51855333e+04, 2.55333094e+04, 2.58858877e+04, 2.62433347e+04, 2.66057175e+04, 2.69731043e+04, 2.73455641e+04, 2.77231671e+04, 2.81059843e+04, 2.84940876e+04, 2.88875500e+04, 2.92864456e+04, 2.96908494e+04, 3.01008375e+04, 3.05164868e+04, 3.09378757e+04, 3.13650834e+04, 3.17981902e+04, 3.22372776e+04, 3.26824281e+04, 3.31337255e+04, 3.35912547e+04, 3.40551017e+04, 3.45253538e+04, 3.50020994e+04, 3.54854282e+04, 3.59754310e+04, 3.64722001e+04, 3.69758288e+04, 3.74864120e+04, 3.80040455e+04, 3.85288269e+04, 3.90608547e+04, 3.96002290e+04, 4.01470514e+04, 4.07014245e+04, 4.12634528e+04, 4.18332419e+04, 4.24108989e+04, 4.29965326e+04, 4.35902530e+04, 4.41921718e+04, 4.48024023e+04, 4.54210592e+04, 4.60482588e+04, 4.66841192e+04, 4.73287599e+04, 4.79823021e+04, 4.86448689e+04, 4.93165847e+04, 4.99975760e+04, 5.06879707e+04, 5.13878989e+04, 5.20974920e+04, 5.28168836e+04, 5.35462090e+04, 5.42856053e+04, 5.50352116e+04, 5.57951689e+04, 5.65656201e+04, 5.73467102e+04, 5.81385859e+04, 5.89413964e+04, 5.97552925e+04, 6.05804273e+04, 6.14169561e+04, 6.22650361e+04, 6.31248269e+04, 6.39964902e+04, 6.48801899e+04, 6.57760922e+04, 6.66843656e+04, 6.76051810e+04, 6.85387116e+04, 6.94851328e+04, 7.04446228e+04, 7.14173619e+04, 7.24035332e+04, 7.34033221e+04, 7.44169166e+04, 7.54445075e+04, 7.64862878e+04, 7.75424537e+04, 7.86132037e+04, 7.96987393e+04, 8.07992645e+04, 8.19149864e+04, 8.30461148e+04, 8.41928625e+04, 8.53554451e+04, 8.65340813e+04, 8.77289928e+04, 8.89404043e+04, 9.01685436e+04, 9.14136418e+04, 9.26759330e+04, 9.39556547e+04, 9.52530474e+04, 9.65683553e+04, 9.79018257e+04, 9.92537094e+04, 1.00624261e+05, 1.02013737e+05, 1.03422401e+05, 1.04850516e+05, 1.06298351e+05, 1.07766178e+05, 1.09254275e+05, 1.10762919e+05, 1.12292396e+05, 1.13842993e+05, 1.15415002e+05, 1.17008717e+05, 1.18624440e+05, 1.20262473e+05, 1.21923125e+05, 1.23606709e+05, 1.25313540e+05, 1.27043940e+05, 1.28798234e+05, 1.30576753e+05, 1.32379831e+05, 1.34207806e+05, 1.36061024e+05, 1.37939831e+05, 1.39844582e+05, 1.41775635e+05, 1.43733353e+05, 1.45718105e+05, 1.47730262e+05, 1.49770205e+05, 1.51838317e+05, 1.53934986e+05, 1.56060608e+05, 1.58215581e+05, 1.60400311e+05, 1.62615209e+05, 1.64860691e+05, 1.67137181e+05, 1.69445106e+05, 1.71784899e+05, 1.74157002e+05, 1.76561861e+05, 1.78999927e+05, 1.81471659e+05, 1.83977522e+05, 1.86517987e+05, 1.89093533e+05, 1.91704644e+05, 1.94351810e+05, 1.97035529e+05, 1.99756307e+05, 2.02514655e+05, 2.05311092e+05, 2.08146143e+05, 2.11020343e+05, 2.13934231e+05, 2.16888356e+05, 2.19883273e+05, 2.22919545e+05, 2.25997744e+05, 2.29118449e+05, 2.32282246e+05, 2.35489730e+05, 2.38741505e+05, 2.42038183e+05, 2.45380383e+05, 2.48768734e+05, 2.52203873e+05, 2.55686447e+05, 2.59217110e+05, 2.62796526e+05, 2.66425369e+05, 2.70104321e+05, 2.73834074e+05, 2.77615329e+05, 2.81448799e+05, 2.85335203e+05, 2.89275272e+05, 2.93269749e+05, 2.97319383e+05, 3.01424937e+05, 3.05587183e+05, 3.09806904e+05, 3.14084892e+05, 3.18421954e+05, 3.22818904e+05, 3.27276570e+05, 3.31795790e+05, 3.36377413e+05, 3.41022303e+05, 3.45731331e+05, 3.50505385e+05, 3.55345361e+05, 3.60252171e+05, 3.65226736e+05, 3.70269994e+05, 3.75382891e+05, 3.80566390e+05, 3.85821466e+05, 3.91149106e+05, 3.96550314e+05, 4.02026105e+05, 4.07577509e+05, 4.13205569e+05, 4.18911345e+05, 4.24695910e+05, 4.30560351e+05, 4.36505771e+05, 4.42533289e+05, 4.48644039e+05, 4.54839169e+05, 4.61119846e+05, 4.67487249e+05, 4.73942577e+05, 4.80487044e+05, 4.87121881e+05, 4.93848335e+05, 5.00667671e+05, 5.07581174e+05, 5.14590141e+05, 5.21695893e+05, 5.28899764e+05, 5.36203111e+05, 5.43607306e+05, 5.51113743e+05, 5.58723833e+05, 5.66439007e+05, 5.74260717e+05, 5.82190434e+05, 5.90229648e+05, 5.98379873e+05, 6.06642640e+05, 6.15019504e+05, 6.23512041e+05, 6.32121848e+05, 6.40850543e+05, 6.49699770e+05, 6.58671191e+05, 6.67766495e+05, 6.76987392e+05, 6.86335616e+05, 6.95812926e+05, 7.05421104e+05, 7.15161957e+05, 7.25037318e+05, 7.35049043e+05, 7.45199015e+05, 7.55489144e+05, 7.65921365e+05, 7.76497640e+05, 7.87219958e+05, 7.98090336e+05, 8.09110818e+05, 8.20283478e+05, 8.31610415e+05, 8.43093762e+05, 8.54735677e+05, 8.66538350e+05, 8.78504001e+05, 8.90634881e+05, 9.02933270e+05, 9.15401483e+05, 9.28041864e+05, 9.40856790e+05, 9.53848672e+05, 9.67019954e+05, 9.80373111e+05, 9.93910657e+05, 1.00763514e+06, 1.02154913e+06, 1.03565526e+06, 1.04995617e+06, 1.06445456e+06, 1.07915315e+06, 1.09405471e+06, 1.10916203e+06, 1.12447797e+06, 1.14000540e+06, 1.15574723e+06, 1.17170645e+06, 1.18788603e+06, 1.20428903e+06, 1.22091853e+06, 1.23777767e+06, 1.25486960e+06, 1.27219755e+06, 1.28976477e+06, 1.30757457e+06, 1.32563030e+06, 1.34393535e+06, 1.36249317e+06, 1.38130725e+06, 1.40038112e+06, 1.41971837e+06, 1.43932264e+06, 1.45919762e+06, 1.47934705e+06, 1.49977471e+06, 1.52048445e+06, 1.54148015e+06, 1.56276578e+06, 1.58434534e+06, 1.60622287e+06, 1.62840250e+06, 1.65088841e+06, 1.67368481e+06, 1.69679599e+06, 1.72022631e+06, 1.74398017e+06, 1.76806203e+06, 1.79247643e+06, 1.81722796e+06, 1.84232127e+06, 1.86776108e+06, 1.89355218e+06, 1.91969942e+06, 1.94620771e+06, 1.97308205e+06, 2.00032748e+06, 2.02794913e+06, 2.05595220e+06, 2.08434195e+06, 2.11312372e+06, 2.14230293e+06, 2.17188505e+06, 2.20187567e+06, 2.23228041e+06, 2.26310500e+06, 2.29435524e+06, 2.32603699e+06, 2.35815622e+06, 2.39071897e+06, 2.42373137e+06, 2.45719963e+06, 2.49113003e+06, 2.52552896e+06, 2.56040289e+06, 2.59575838e+06, 2.63160208e+06, 2.66794072e+06, 2.70478116e+06, 2.74213030e+06, 2.77999519e+06, 2.81838293e+06] GHz>)#

Bases: SphericalSource

A spherical blackbody star emitting photons isotropically from its surface. BlackbodyStar is a special case of a SphericalSource where the intensity is given by the Planck function for a specified temperature. The radius of the star is determined by the luminosity and temperature as described in the SphericalSource() class, but using the known solution that

\[\int B_{\nu} d\nu = \sigma_{SB} T^4 / \pi.\]
Parameters:
temperatureastropy.units.Quantity

The temperature of the blackbody star.

luminosityastropy.units.Quantity

The total luminosity of the star.

x, y, zfloat

The position of the center of the star in the simulation grid.

nuastropy.units.Quantity

The frequency array over which the blackbody intensity is defined.

class pinballrt.sources.ExternalSource(grid, intensity, frequency=None)#

Bases: SphericalSource

An external isotropic radiation source surrounding the simulation grid. External sources emit photons inward from a sphere just beyond the outer boundary of the grid. It can be specified in terms of the specific intensity as a function of frequency, which can be expressed either as a function, e.g.

from astropy.modeling import models
from pinballrt.sources import ExternalSource
import astropy.units as u

source = ExternalSource(grid, intensity=models.BlackBody(temperature=10*u.K))

(where the models.BlackBody() class is callable and returns the intensity at the specified frequencies) or as an array of intensities at specified frequencies, e.g.

from astropy.modeling import models
from pinballrt.sources import ExternalSource
import astropy.units as u
import numpy as np

frequency = np.logspace(9, 15, 100) * u.Hz
intensity = models.BlackBody(temperature=10*u.K)(frequency)

source = ExternalSource(grid, intensity, frequency)
Parameters:
gridpinballrt.sources.Grid

The simulation grid.

intensityastropy.units.Quantity or callable

The intensity as a function of frequency. If callable, it should take a frequency array as input and return the intensity at those frequencies in units that are compatible with Jy / steradian.

frequencyastropy.units.Quantity, optional

The frequency array over which the intensity is defined. If not provided, it will be generated based on the grid’s dust properties.

class pinballrt.sources.DiffuseSource(grid, spectrum, density, frequency=None)#

Bases: object

A diffuse source emitting photons from within the simulation grid. Diffuse sources emit photons from random locations withing the grid, with a probability of emission from each cell proportional to the luminosity of that cell. The luminosity of each cell is determined by the product of the density, the spectrum, and the cell volume. The spectrum can be specified as a function or as an array of values at specified frequencies, similar to the ExternalSource class, and should be in units such that when multiplied by the density and cell volume, the result can be converted to ergs / s / Hz. For example, a uniform distribution of single-temperature blackbody stars could be created with:

from pinballrt.sources import DiffuseSource
import astropy.units as u
import numpy as np

spectrum = lambda nu: 4*np.pi**2 * u.steradian * (0.035*u.R_sun)**2 * models.BlackBody(2000.*u.K)(nu)
density = u.g / u.cm**3

diffuse_source = DiffuseSource(model.grid, spectrum, density)

One could, of course, specify a more complex spectrum, for example a distribution of blackbody stars with some mass function would mathematically be:

\[I_{\nu} = \int 4 \pi^2 R(M)^2 B_{\nu}(T(M)) \frac{dN}{dM} dM\]
Parameters:
gridpinballrt.sources.Grid

The simulation grid.

spectrumastropy.units.Quantity or callable

The spectrum as a function of frequency. If callable, it should take a frequency array as input and return the spectrum at those frequencies in units such that when multiplied by the density and cell volume that are compatible with ergs / s / Hz.

densityastropy.units.Quantity

The density distribution of the diffuse source within the grid. It should be specified in units such that when the spectrum, density, and cell volume are multiplied, the result is in ergs / s / Hz.

frequencyastropy.units.Quantity, optional

The frequency array over which the spectrum is defined. If not provided, it will be generated based on the grid’s dust properties.

class pinballrt.sources.EnergySource(grid, energy_density)#

Bases: GridSource

A diffuse energy source that directly injects energy into the grid based on a specified energy density, and then the grid reradiates that energy away based on the temperature and dust properties in the cell. They should be specified in terms of the luminosity per volume that is being injected into the grid, in units convertible to ergs / s / cm^3. For example, a uniform energy density could be created with:

from pinballrt.sources import EnergySource
import astropy.units as u

energy_density = 1e-15 * u.erg / u.s / u.cm**3

energy_source = EnergySource(model.grid, energy_density)
Parameters:
gridpinballrt.sources.Grid

The simulation grid.

energy_densityastropy.units.Quantity

The energy density distribution of the source within the grid. It should be specified in units such that when multiplied by the cell volume, the result is compatible with ergs / s.