Skip to content

Commit

Permalink
Remove Line Interaction from this PR
Browse files Browse the repository at this point in the history
  • Loading branch information
Sumit112192 committed Jul 31, 2024
1 parent 618437d commit 1a6c053
Showing 1 changed file with 0 additions and 59 deletions.
59 changes: 0 additions & 59 deletions tardis/transport/montecarlo/packet_trackers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,9 @@
)


line_interaction_dtype = np.dtype(
[
("event_id", "int64"),
("shell_id", "int64"),
("r", "float64"),
("in_nu", "float64"),
("in_id", "int64"),
("out_id", "int64"),
]
)

rpacket_tracker_spec = [
("length", int64),
("boundary_interaction_array_length", int64),
("line_interaction_array_length", int64),
("seed", int64),
("index", int64),
("status", int64[:]),
Expand All @@ -39,10 +27,8 @@
("shell_id", int64[:]),
("interaction_type", int64[:]),
("boundary_interaction", from_dtype(boundary_interaction_dtype)[:]),
("line_interaction", from_dtype(line_interaction_dtype)[:]),
("num_interactions", int64),
("num_boundary_interactions", int64),
("num_line_interactions", int64),
("event_id", int64),
]

Expand Down Expand Up @@ -83,7 +69,6 @@ def __init__(self, length):
"""
self.length = length
self.boundary_interaction_array_length = length
self.line_interaction_array_length = length
self.seed = np.int64(0)
self.index = np.int64(0)
self.status = np.empty(self.length, dtype=np.int64)
Expand All @@ -97,13 +82,8 @@ def __init__(self, length):
self.boundary_interaction_array_length,
dtype=boundary_interaction_dtype,
)
self.line_interaction = np.empty(
self.line_interaction_array_length,
dtype=line_interaction_dtype,
)
self.num_interactions = 0
self.num_boundary_interactions = 0
self.num_line_interactions = 0
self.event_id = 1

def track(self, r_packet):
Expand Down Expand Up @@ -182,42 +162,6 @@ def track_boundary_interaction(self, current_shell_id, next_shell_id):
self.num_boundary_interactions += 1
self.event_id += 1

def track_line_interaction(self, r_packet):
"""
Track Line interaction Properties
"""
if self.num_line_interactions >= self.line_interaction_array_length:
temp_length = self.line_interaction_array_length * 2

temp_line_interaction = np.empty(
temp_length, dtype=line_interaction_dtype
)
temp_line_interaction[
: self.line_interaction_array_length
] = self.line_interaction

self.line_interaction = temp_line_interaction
self.line_interaction_array_length = temp_length

self.line_interaction[self.num_line_interactions][
"event_id"
] = self.event_id
self.line_interaction[self.num_line_interactions][
"shell_id"
] = r_packet.current_shell_id
self.line_interaction[self.num_line_interactions]["r"] = r_packet.r
self.line_interaction[self.num_line_interactions][
"in_nu"
] = r_packet.last_interaction_in_nu
self.line_interaction[self.num_line_interactions][
"in_id"
] = r_packet.last_line_interaction_in_id
self.line_interaction[self.num_line_interactions][
"out_id"
] = r_packet.last_line_interaction_out_id
self.num_line_interactions += 1
self.event_id += 1

def finalize_array(self):
"""
Change the size of the array from length ( or multiple of length ) to
Expand All @@ -233,9 +177,6 @@ def finalize_array(self):
self.boundary_interaction = self.boundary_interaction[
: self.num_boundary_interactions
]
self.line_interaction = self.line_interaction[
: self.num_line_interactions
]


def rpacket_trackers_to_dataframe(rpacket_trackers):
Expand Down

0 comments on commit 1a6c053

Please sign in to comment.