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
abstract create_packets(seed=None, **kwargs)[source]
static create_uniform_packet_energies(no_of_packets, rng)[source]

Uniformly distribute energy in arbitrary units where the ensemble of packets has energy of 1.

Parameters
no_of_packetsint

number of packets

Returns
energies for packetsnumpy.ndarray
static create_zero_limb_darkening_packet_mus(no_of_packets, rng)[source]

Create zero-limb-darkening packet \(\mu\) distributed according to \(\mu=\sqrt{z}, z \isin [0, 1]\)

Parameters
no_of_packetsint

number of packets to be created

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