tardis.montecarlo.packet_source module¶
- class tardis.montecarlo.packet_source.BasePacketSource(base_seed=None, legacy_second_seed=None)[source]¶
Bases:
ABC
Abstract base packet source
- Parameters
- base_seedint
Base Seed for random number generator
- legacy_secondary_seedint
Secondary seed for global numpy rng (Deprecated: Legacy reasons only)
- MAX_SEED_VAL = 4294967295¶
- class tardis.montecarlo.packet_source.BlackBodySimpleSource(radius=None, temperature=None, **kwargs)[source]¶
Bases:
BasePacketSource
Simple packet source that generates Blackbody packets for the Montecarlo part.
- Parameters
- radiusastropy.units.Quantity
Initial packet radius
- temperatureastropy.units.Quantity
Absolute Temperature.
- base_seedint
Base Seed for random number generator
- legacy_secondary_seedint
Secondary seed for global numpy rng (Deprecated: Legacy reasons only)
- create_packet_energies(no_of_packets)[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 packets
numpy.ndarray
- create_packet_mus(no_of_packets)[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
- Returns
- Directions for packets
numpy.ndarray
- create_packet_nus(no_of_packets, 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 .. math:
\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 .. math:
x = -\ln{(\xi_1\xi_2\xi_3\xi_4)}/l_{\rm min}\;.
where \(x=h\nu/kT\)
- Parameters
- no_of_packetsint
- l_samplesint
number of l_samples needed in the algorithm
- Returns
- array of frequencies
numpy.ndarray
- create_packet_radii(no_of_packets)[source]¶
Create packet radii
- Parameters
- no_of_packetsint
number of packets to be created
- Returns
- Radii for packets
numpy.ndarray
- class tardis.montecarlo.packet_source.BlackBodySimpleSourceRelativistic(time_explosion=None, **kwargs)[source]¶
Bases:
BlackBodySimpleSource
Simple packet source that generates Blackbody packets for the Montecarlo part.
- Parameters
- time_explosionastropy.units.Quantity
Time elapsed since explosion
- radiusastropy.units.Quantity
Initial packet radius
- temperatureastropy.units.Quantity
Absolute Temperature.
- base_seedint
Base Seed for random number generator
- legacy_secondary_seedint
Secondary seed for global numpy rng (Deprecated: Legacy reasons only)
- create_packet_energies(no_of_packets)[source]¶
Uniformly distribute energy in arbitrary units where the ensemble of packets has energy of 1 multiplied by relativistic correction factors.
- Parameters
- no_of_packetsint
number of packets
- Returns
- energies for packets
numpy.ndarray
- create_packet_mus(no_of_packets)[source]¶
Create zero-limb-darkening packet \(\mu^\prime\) distributed according to \(\mu^\prime=2 \frac{\mu^\prime + \beta}{2 \beta + 1}\). The complicated distribution is due to the fact that the inner boundary on which the packets are initialized is not comoving with the material.
- Parameters
- no_of_packetsint
number of packets to be created
- Returns
- Directions for packets
numpy.ndarray