Skip to content

Commit

Permalink
Merge pull request tardis-sn#9 from sonachitchyan/continuum_process
Browse files Browse the repository at this point in the history
Full relativity fix
  • Loading branch information
Rodot- authored Jan 12, 2022
2 parents e9deeab + c688bda commit 1d16aa9
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 11 deletions.
5 changes: 3 additions & 2 deletions tardis/montecarlo/montecarlo_numba/calculate_distances.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
C_SPEED_OF_LIGHT,
MISS_DISTANCE,
SIGMA_THOMSON,
ENABLE_FULL_RELATIVITY,
CLOSE_LINE_THRESHOLD,
)
from tardis.montecarlo.montecarlo_configuration import full_relativity
ENABLE_FULL_RELATIVITY = full_relativity

from tardis.montecarlo.montecarlo_numba.utils import MonteCarloException

Expand Down Expand Up @@ -98,7 +99,7 @@ def calculate_distance_line(
if nu_diff >= 0:
distance = (nu_diff / nu) * C_SPEED_OF_LIGHT * time_explosion
else:
print(r_packet.nu, comov_nu, nu_line, nu_diff)
#print(r_packet.nu, comov_nu, nu_line, nu_diff)
print("WARNING: nu difference is less than 0.0")
raise MonteCarloException(
"nu difference is less than 0.0; for more"
Expand Down
6 changes: 3 additions & 3 deletions tardis/montecarlo/montecarlo_numba/estimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
calc_packet_energy_full_relativity,
)

from tardis.montecarlo.montecarlo_numba.numba_config import (
ENABLE_FULL_RELATIVITY,
from tardis.montecarlo.montecarlo_configuration import (
full_relativity
)


ENABLE_FULL_RELATIVITY = full_relativity
@njit(**njit_dict_no_parallel)
def set_estimators(r_packet, distance, numba_estimator, comov_nu, comov_energy):
"""
Expand Down
7 changes: 4 additions & 3 deletions tardis/montecarlo/montecarlo_numba/frame_transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
)

from tardis.montecarlo.montecarlo_numba.numba_config import (
C_SPEED_OF_LIGHT,
ENABLE_FULL_RELATIVITY,
C_SPEED_OF_LIGHT
)

from tardis.montecarlo.montecarlo_configuration import full_relativity
ENABLE_FULL_RELATIVITY = full_relativity

@njit(**njit_dict_no_parallel)
def get_doppler_factor(r, mu, time_explosion):
Expand Down Expand Up @@ -87,7 +88,7 @@ def angle_aberration_CMF_to_LF(r_packet, time_explosion, mu):
"""
ct = C_SPEED_OF_LIGHT * time_explosion
beta = r_packet.r / (ct)
return (r_packet.mu + beta) / (1.0 + beta * mu)
return (mu + beta) / (1.0 + beta * mu)


@njit(**njit_dict_no_parallel)
Expand Down
5 changes: 5 additions & 0 deletions tardis/montecarlo/montecarlo_numba/interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,11 @@ def thomson_scatter(r_packet, time_explosion):
r_packet.mu = angle_aberration_CMF_to_LF(
r_packet, time_explosion, r_packet.mu
)
temp_doppler_factor = get_doppler_factor(
r_packet.r, r_packet.mu, time_explosion
)
#print ((comov_nu-r_packet.nu*temp_doppler_factor)/comov_nu)


@njit(**njit_dict_no_parallel)
def line_scatter(r_packet, time_explosion,
Expand Down
4 changes: 2 additions & 2 deletions tardis/montecarlo/montecarlo_numba/r_packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
from tardis.montecarlo import montecarlo_configuration
from tardis.montecarlo.montecarlo_numba.numba_config import (
CLOSE_LINE_THRESHOLD,
ENABLE_FULL_RELATIVITY,
SIGMA_THOMSON,
)

from tardis.montecarlo.montecarlo_configuration import full_relativity
ENABLE_FULL_RELATIVITY = full_relativity

class InteractionType(IntEnum):
BOUNDARY = 1
Expand Down
2 changes: 1 addition & 1 deletion tardis/montecarlo/montecarlo_numba/single_packet_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def single_packet_loop(
r_packet, vpacket_collection, numba_model, numba_plasma, continuum
)
else:
print("OTHER")
#print("OTHER")
pass


Expand Down

0 comments on commit 1d16aa9

Please sign in to comment.