Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed RPacketCollection Class to RPacketTracker #1861

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tardis/montecarlo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def __init__(
self.virt_packet_initial_rs = np.ones(2) * -1.0
self.virt_packet_initial_mus = np.ones(2) * -1.0

# Setting up the Tracking array for RPacketCollection
# Setting up the Tracking array for storing all the RPacketTracker instances
self.rpacket_tracker = None

# set up logger based on config
Expand Down
20 changes: 10 additions & 10 deletions tardis/montecarlo/montecarlo_numba/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from tardis.montecarlo.montecarlo_numba.numba_interface import (
PacketCollection,
VPacketCollection,
RPacketCollection,
RPacketTracker,
NumbaModel,
numba_plasma_initialize,
Estimators,
Expand Down Expand Up @@ -78,7 +78,7 @@ def montecarlo_radial1d(
virt_packet_last_interaction_type,
virt_packet_last_line_interaction_in_id,
virt_packet_last_line_interaction_out_id,
tracked_rpackets,
rpacket_trackers,
) = montecarlo_main_loop(
packet_collection,
numba_model,
Expand Down Expand Up @@ -129,7 +129,7 @@ def montecarlo_radial1d(

# Condition for Checking if RPacket Tracking is enabled
if montecarlo_configuration.RPACKET_TRACKING:
runner.rpacket_tracker = tracked_rpackets
runner.rpacket_tracker = rpacket_trackers


@njit(**njit_dict)
Expand Down Expand Up @@ -196,9 +196,9 @@ def montecarlo_main_loop(
)

# Configuring the Tracking for R_Packets
tracked_rpackets = List()
rpacket_trackers = List()
for i in range(len(output_nus)):
tracked_rpackets.append(RPacketCollection())
rpacket_trackers.append(RPacketTracker())
wkerzendorf marked this conversation as resolved.
Show resolved Hide resolved

# Arrays for vpacket logging
virt_packet_nus = []
Expand Down Expand Up @@ -236,15 +236,15 @@ def montecarlo_main_loop(
i,
)
vpacket_collection = vpacket_collections[i]
rpacket_collection = tracked_rpackets[i]
tracked_rpacket = rpacket_trackers[i]

single_packet_loop(
r_packet,
numba_model,
numba_plasma,
estimators,
vpacket_collection,
rpacket_collection,
tracked_rpacket,
)

output_nus[i] = r_packet.nu
Expand Down Expand Up @@ -331,8 +331,8 @@ def montecarlo_main_loop(
)

if montecarlo_configuration.RPACKET_TRACKING:
for rpacket_collection in tracked_rpackets:
rpacket_collection.finalize_array()
for rpacket_tracker in rpacket_trackers:
rpacket_tracker.finalize_array()

packet_collection.packets_output_energy[:] = output_energies[:]
packet_collection.packets_output_nu[:] = output_nus[:]
Expand All @@ -351,5 +351,5 @@ def montecarlo_main_loop(
virt_packet_last_interaction_type,
virt_packet_last_line_interaction_in_id,
virt_packet_last_line_interaction_out_id,
tracked_rpackets,
rpacket_trackers,
)
2 changes: 1 addition & 1 deletion tardis/montecarlo/montecarlo_numba/numba_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def set_properties(


@jitclass(rpacket_collection_spec)
class RPacketCollection(object):
class RPacketTracker(object):
"""
Numba JITCLASS for storing the information for each interaction a RPacket instance undergoes.

Expand Down
6 changes: 3 additions & 3 deletions tardis/montecarlo/tests/test_montecarlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
import tardis.montecarlo.montecarlo_numba.utils as utils
import tardis.montecarlo.montecarlo_configuration as mc
from tardis import constants as const
from tardis.montecarlo.montecarlo_numba.numba_interface import Estimators
from tardis.montecarlo.montecarlo_numba.numba_interface import RPacketCollection
from tardis.montecarlo.montecarlo_numba.numba_interface import Estimators, RPacketTracker
from tardis.montecarlo.montecarlo_numba.numba_interface import RPacketTracker
from tardis.montecarlo.montecarlo_numba import macro_atom

from tardis.montecarlo.montecarlo_numba.frame_transformations import (
Expand Down Expand Up @@ -839,7 +839,7 @@ def test_rpacket_tracking(index, seed, r, nu, mu, energy):
# Setup Montecarlo_Configuration.INITIAL_TRACKING_ARRAY_LENGTH
mc.INITIAL_TRACKING_ARRAY_LENGTH = 10

tracked_rpacket_properties = RPacketCollection()
tracked_rpacket_properties = RPacketTracker()
test_rpacket = r_packet.RPacket(
index=index,
seed=seed,
Expand Down