tardis.montecarlo.packet_source module¶
- class tardis.montecarlo.packet_source.BasePacketSource(seed)[source]¶
Bases:
abc.ABC
- static create_blackbody_packet_nus(T, no_of_packets, rng, l_samples=1000)[source]¶
Create packet \(\nu\) distributed using the algorithm described in Bjorkman & Wood 2001 (page 4) which references Carter & Cashwell 1975: First, generate a uniform random number, \(\xi_0 \in [0, 1]\) and determine the minimum value of \(l, l_{\rm min}\), that satisfies the condition
\[\sum_{i=1}^{l} i^{-4} \ge {{\pi^4}\over{90}} m_0 \;.\]Next obtain four additional uniform random numbers (in the range 0 to 1) \(\xi_1, \xi_2, \xi_3, {\rm and } \xi_4\). Finally, the packet frequency is given by
\[x = -\ln{(\xi_1\xi_2\xi_3\xi_4)}/l_{\rm min}\;.\]where \(x=h\nu/kT\)
- Parameters
- Tfloat
temperature
- no_of_packetsint
- l_samplesint
number of l_samples needed in the algorithm
- Returns
- array of frequencies: numpy.ndarray
- class tardis.montecarlo.packet_source.BlackBodySimpleSource(seed)[source]¶
Bases:
tardis.montecarlo.packet_source.BasePacketSource
Simple packet source that generates Blackbody packets for the Montecarlo part.
- create_packets(T, no_of_packets, rng, radius)[source]¶
Generate black-body packet properties as arrays
- Parameters
- Tfloat64
Temperature
- no_of_packetsint
Number of packets
- rngnumpy random number generator
- radiusfloat64
Initial packet radius
- Returns
- array
Packet radii
- array
Packet frequencies
- array
Packet directions
- array
Packet energies