Skip to content

Commit 51666af

Browse files
dsarruttbaudier
authored andcommitted
make test executable
1 parent de92812 commit 51666af

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

opengate/tests/src/test097_pileup.py

100644100755
File mode changed.

opengate/tests/src/test097_pileup_helpers.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,18 @@ def pileup(singles_before_pileup: pd.DataFrame, time_window: float):
2222
times = group["GlobalTime"].values
2323

2424
current = 0 # index of a single that opens the current time window
25-
next = 1
26-
while next < len(times):
25+
next_single = 1
26+
while next_single < len(times):
2727
# Increment next until it points to the single that opens the next time window.
28-
while next < len(times) and times[next] <= times[current] + time_window:
29-
next += 1
30-
if next > current + 1:
28+
while (
29+
next_single < len(times)
30+
and times[next_single] <= times[current] + time_window
31+
):
32+
next_single += 1
33+
if next_single > current + 1:
3134
# We have found a group of at least two singles in the same time window.
3235
# Find the single with the highest TotalEnergyDeposit in the time window.
33-
group_slice = group.iloc[current:next]
36+
group_slice = group.iloc[current:next_single]
3437
max_energy_idx = group_slice["TotalEnergyDeposit"].idxmax()
3538
# Create a single with the attribute values from the max energy single,
3639
# except for the TotalEnergyDeposit, take the sum over all singles in the time window.
@@ -41,8 +44,8 @@ def pileup(singles_before_pileup: pd.DataFrame, time_window: float):
4144
# Add the combined single to the output.
4245
singles_after_pileup.setdefault(volume_id, []).append(pileup_row)
4346
# Update current and next for the next time window.
44-
current = next
45-
next = current + 1
47+
current = next_single
48+
next_single = current + 1
4649
else:
4750
# The time window opened by current contains only contains one event.
4851
# Add the original single to the output unchanged.
@@ -51,7 +54,7 @@ def pileup(singles_before_pileup: pd.DataFrame, time_window: float):
5154
)
5255
# Update current and next for the next time window.
5356
current += 1
54-
next += 1
57+
next_single += 1
5558
# If there is only one single left, add it to the output unchanged.
5659
if current == len(times) - 1:
5760
singles_after_pileup.setdefault(volume_id, []).append(

0 commit comments

Comments
 (0)