tardis.transport.montecarlo.packet_source.black_body_weighted module

class tardis.transport.montecarlo.packet_source.black_body_weighted.BlackBodyWeightedSource(*args: Any, **kwargs: Any)[source]

Bases: BlackBodySimpleSource

Weighted blackbody packet source for Monte Carlo simulations.

This class generates blackbody packets with energies weighted according to their contribution to the Planck distribution, rather than uniform energy distribution.

Parameters:
radiusastropy.units.Quantity, optional

Initial packet radius. Default is None.

temperatureastropy.units.Quantity, optional

Absolute temperature. Default is None.

base_seedint, optional

Base seed for random number generator. Default is None.

legacy_secondary_seedint, optional

Secondary seed for global numpy rng (Deprecated: Legacy reasons only). Default is None.

**kwargsAny

Additional keyword arguments passed to parent class.

Attributes:
nusastropy.units.Quantity

Cached packet frequencies for energy weighting.

Initialize BlackBodyWeightedSource.

Parameters:
**kwargs

Additional keyword arguments passed to parent class.

create_packet_energies(no_of_packets)[source]

Create packet energies weighted by Planck distribution.

Set energy weight for each packet from the relative contribution to the Planck distribution, rather than uniform distribution.

Parameters:
no_of_packetsint

Number of packets to create.

Returns:
astropy.units.Quantity

Array of weighted packet energies in erg.

create_packet_nus(no_of_packets, l_samples=1000)[source]

Create packet frequencies distributed uniformly over blackbody bounds.

Creates frequencies uniformly distributed over the range of frequencies that would be generated by the base BlackBodySimpleSource distribution.

Parameters:
no_of_packetsint

Number of packets to create.

l_samplesint, optional

Number of l_samples needed for sampling from BlackBodySimpleSource. Default is 1000.

Returns:
astropy.units.Quantity

Array of packet frequencies.

hdf_name = 'black_body_weighted_source'
hdf_properties = ['radius', 'temperature', 'base_seed']