Streak Finder algorithm for CBD experiment #2

Merged
augustin_s merged 46 commits from ext-dorofe_e/dap:chapman into main 2025-07-14 11:18:07 +02:00
Showing only changes of commit 3e9da9aae5 - Show all commits

View File

@@ -6,6 +6,7 @@ Requires Convergent beam streak finder package installed:
https://github.com/simply-nicky/streak_finder
(note g++ 11 required for building)
"""
import numpy as np
from math import sqrt, pow
from streak_finder import PatternStreakFinder
@@ -61,7 +62,7 @@ def calc_streakfinder_analysis(results, data, pixel_mask_sf):
for streak in streaks:
x0, y0, x1, y1 = streak
streak_lengths.append(sqrt(pow((x1 - x0), 2) + pow((y1 - y0), 2)))
bragg_counts.append(profile_line(data, (x0, y0), (x1, y1)))
bragg_counts.append(float(np.sum(profile_line(data, (x0, y0), (x1, y1)))))
streak_lines = streaks.T
_, number_of_streaks = streak_lines.shape
print(f"Found {number_of_streaks} streaks")
@@ -69,6 +70,7 @@ def calc_streakfinder_analysis(results, data, pixel_mask_sf):
for line in streak_lines: # arr(4, n_lines); 0coord x0, y0, x1, y1
list_result.append(line.tolist())
results.update({"number_of_streaks": number_of_streaks})
results.update({"is_hit_frame": number_of_streaks > 0})
results.update({"streaks": list_result})
results.update({"streak_lengths": streak_lengths})
results.update({"bragg_counts": bragg_counts})