Skip to content

Commit

Permalink
Change terminology in examples to num_prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisThielemans committed Nov 4, 2023
1 parent f168903 commit 2f1673c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions cpp/prd_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,24 @@ main(int argc, char* argv[])

// Process events in batches of up to 100
float energy_1 = 0, energy_2 = 0;
std::size_t num_events = 0;
std::size_t num_prompts = 0;
float last_time = 0.F;
while (reader.ReadTimeBlocks(time_block))
{
last_time = time_block.id * header.scanner.listmode_time_block_duration;
num_prompts += time_block.prompt_events.size();

for (auto& event : time_block.prompt_events)
{
energy_1 += energy_mid_points[event.energy_1_idx];
energy_2 += energy_mid_points[event.energy_2_idx];
num_events++;
}
}

std::cout << "Last time block at " << last_time << " ms\n";
std::cout << "Number of events: " << num_events << std::endl;
std::cout << "Average energy_1: " << energy_1 / num_events << std::endl;
std::cout << "Average energy_2: " << energy_2 / num_events << std::endl;
std::cout << "Number of prompt events: " << num_prompts << std::endl;
std::cout << "Average energy_1: " << energy_1 / num_prompts << std::endl;
std::cout << "Average energy_2: " << energy_2 / num_prompts << std::endl;

return 0;
}
10 changes: 5 additions & 5 deletions python/prd_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
print(f"Energy mid points: {energy_mid_points}")

energy_1, energy_2 = 0.0, 0.0
num_events = 0
num_prompts = 0
last_time = 0
for time_block in reader.read_time_blocks():
last_time = time_block.id * header.scanner.listmode_time_block_duration
num_prompts += len(time_block.prompt_events)
for event in time_block.prompt_events:
energy_1 += energy_mid_points[event.energy_1_idx]
energy_2 += energy_mid_points[event.energy_2_idx]
num_events += 1

print(f"Last time block at {last_time} ms")
print(f"Number of events: {num_events}")
print(f"Average energy_1: {energy_1 / num_events}")
print(f"Average energy_2: {energy_2 / num_events}")
print(f"Number of prompt events: {num_prompts}")
print(f"Average energy_1: {energy_1 / num_prompts}")
print(f"Average energy_2: {energy_2 / num_prompts}")

0 comments on commit 2f1673c

Please sign in to comment.