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

li=1i4π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
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 μ distributed according to μ=z,z\isin[0,1]

Parameters
no_of_packetsint

number of packets to be created

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