Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sumit112192 committed Aug 2, 2024
1 parent 6ccf67d commit db5fc0e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tardis/transport/montecarlo/tests/test_rpacket_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,31 @@ def test_rpacket_tracker_properties(expected, obtained, request):
npt.assert_allclose(expected, obtained)


def test_boundary_interactions(rpacket_tracker, regression_data):
no_of_packets = len(rpacket_tracker)

# Hard coding the number of columns
# Based on the largest size of boundary_interaction array (61)
obtained_boundary_interaction = np.full(
(no_of_packets, 64, 3),
[-1, -1, -1],
dtype=rpacket_tracker[0].boundary_interaction.dtype,
)
print(rpacket_tracker[0].boundary_interaction, (2, 3))
for i, tracker in enumerate(rpacket_tracker):
for j in range(tracker.boundary_interaction.size):
obtained_boundary_interaction[i][j] = tracker.boundary_interaction[
j
]

expected_boundary_interaction = regression_data.sync_ndarray(
obtained_boundary_interaction
)
npt.assert_array_equal(
obtained_boundary_interaction, expected_boundary_interaction
)


def test_rpacket_trackers_to_dataframe(simulation_rpacket_tracking):
transport_state = simulation_rpacket_tracking.transport.transport_state
rtracker_df = rpacket_trackers_to_dataframe(transport_state.rpacket_tracker)
Expand Down

0 comments on commit db5fc0e

Please sign in to comment.