-
-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Restructure Trackers * Remove ENABLE_RPACKET_TRACKING global variable from montecarlo_main_loop * Import Numba List * Import trackers * Make RPacketLastInteractionTracker Compatible with RPacketTracker * Fix Typo * Numba loop to pure python approach * Rebase * Resolving conflicts * Resolving conflicts * Rebase * Remove Unused import * Black * Import numba.typed.List * Rename function name * Fix montecarlo_main_loop benchmark * Remove code * Add docstring * Add tests for the tracker utility functions * Black * Fix Typo * update benchmark * Update benchmark * Fix Typo * Checking if there is circular imports * Update Benchmark * Fix Typo * Add benchmark for the utility functions
- Loading branch information
1 parent
5e7a23b
commit 7231707
Showing
8 changed files
with
141 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import pytest | ||
import numpy as np | ||
from numba import typeof | ||
|
||
from tardis.transport.montecarlo.packet_trackers import ( | ||
RPacketTracker, | ||
RPacketLastInteractionTracker, | ||
generate_rpacket_tracker_list, | ||
generate_rpacket_last_interaction_tracker_list, | ||
) | ||
|
||
|
||
def test_generate_rpacket_tracker_list(): | ||
no_of_packets = 10 | ||
length = 10 | ||
random_index = np.random.randint(0, no_of_packets) | ||
|
||
rpacket_tracker_list = generate_rpacket_tracker_list(no_of_packets, length) | ||
|
||
assert len(rpacket_tracker_list) == no_of_packets | ||
assert len(rpacket_tracker_list[random_index].shell_id) == length | ||
assert typeof(rpacket_tracker_list[random_index]) == typeof( | ||
RPacketTracker(length) | ||
) | ||
|
||
|
||
def test_generate_rpacket_last_interaction_tracker_list(): | ||
no_of_packets = 50 | ||
random_index = np.random.randint(0, no_of_packets) | ||
|
||
rpacket_last_interaction_tracker_list = ( | ||
generate_rpacket_last_interaction_tracker_list(no_of_packets) | ||
) | ||
|
||
assert len(rpacket_last_interaction_tracker_list) == no_of_packets | ||
assert typeof( | ||
rpacket_last_interaction_tracker_list[random_index] | ||
) == typeof(RPacketLastInteractionTracker()) |