tardis.montecarlo.packet_source module¶
- class tardis.montecarlo.packet_source.BasePacketSource(seed)[source]¶
Bases:
ABC
- static create_blackbody_packet_nus(T, no_of_packets, rng, l_samples=1000)[source]¶
Create packet ν distributed using the algorithm described in Bjorkman & Wood 2001 (page 4) which references Carter & Cashwell 1975: First, generate a uniform random number, ξ0∈[0,1] and determine the minimum value of l,lmin, that satisfies the condition
l∑i=1i−4≥π490m0.Next obtain four additional uniform random numbers (in the range 0 to 1) ξ1,ξ2,ξ3,andξ4. Finally, the packet frequency is given by
x=−ln(ξ1ξ2ξ3ξ4)/lmin.where x=hν/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:
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