Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
wkerzendorf committed Jul 21, 2023
1 parent 36144bb commit 7f25951
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
5 changes: 1 addition & 4 deletions tardis/model/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@
from tardis.io.util import HDFWriterMixin
from tardis.io.decay import IsotopeAbundances
from tardis.model.density import HomologousDensity
from tardis.montecarlo.packet_source import (
BlackBodySimpleSource,
convert_config_to_blackbody_packetsource,
)
from tardis.montecarlo.packet_source import BlackBodySimpleSource

logger = logging.getLogger(__name__)

Expand Down
22 changes: 10 additions & 12 deletions tardis/montecarlo/packet_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,16 @@ def create_packet_energies(self, no_of_packets):
"""
return np.ones(no_of_packets) / no_of_packets

def set_temperature_from_luminosity(self, luminosity):
def set_temperature_from_luminosity(self, luminosity: u.Quantity):
"""
Set blackbody packet source temperature from luminosity
Parameters
----------
luminosity : u.Quantity
"""
self.temperature = (
(luminosity / (4 * np.pi * self.radius**2 * const.sigma_sb))
** 0.25
Expand Down Expand Up @@ -351,14 +360,3 @@ def create_packet_energies(self, no_of_packets):
# Thus, we can absorb the factor gamma in the packet energies, which is
# more convenient.
return energies * static_inner_boundary2cmf_factor / gamma


def convert_config_to_blackbody_packetsource(config):
if config.plasma.initial_t_inner < 0.0 * u.K:
luminosity_requested = config.supernova.luminosity_requested
t_inner = None
else:
luminosity_requested = None
t_inner = config.plasma.initial_t_inner
radius = None
return BlackBodySimpleSource(radius, t_inner), luminosity_requested

0 comments on commit 7f25951

Please sign in to comment.