Skip to content

Commit

Permalink
Merge branch 'first' of https://github.com/1e9abhi1e10/tardis into first
Browse files Browse the repository at this point in the history
  • Loading branch information
1e9abhi1e10 committed Jan 25, 2023
2 parents 40be88e + 7084e12 commit 43071b0
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tardis/montecarlo/packet_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def create_blackbody_packet_nus(
temperature, no_of_packets, rng, l_samples=1000
):
"""
<<<<<<< HEAD
Create packet :math:`\\nu` distributed using the algorithm described in
Bjorkman & Wood 2001 (page 4) which references
Carter & Cashwell 1975:
Expand All @@ -81,6 +82,38 @@ def create_blackbody_packet_nus(
Returns
-------
array of frequencies: numpy.ndarray
=======
Create packet :math:`\\nu` distributed using the algorithm described in
Bjorkman & Wood 2001 (page 4) which references
Carter & Cashwell 1975:
First, generate a uniform random number, :math:`\\xi_0 \\in [0, 1]` and
determine the minimum value of
:math:`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) :math:`\\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 :math:`x=h\\nu/kT`
Parameters
----------
temperature : float
Absolute Temperature.
no_of_packets : int
l_samples : int
number of l_samples needed in the algorithm
Returns
-------
array of frequencies: numpy.ndarray
>>>>>>> 7084e1277d195935e5469bf3d0c2b4482d8f3424
"""
l_samples = l_samples
l_array = np.cumsum(np.arange(1, l_samples, dtype=np.float64) ** -4)
Expand Down

0 comments on commit 43071b0

Please sign in to comment.