From 3e9da9aae51c2cf937c72833ce2a5ce2b08d370b Mon Sep 17 00:00:00 2001 From: "Dorofeeva Elizaveta (EXT)" Date: Mon, 30 Jun 2025 13:47:44 +0200 Subject: [PATCH] Bug fix in streak finder; Mark frames with streaks as a hit --- dap/algos/streakfind.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dap/algos/streakfind.py b/dap/algos/streakfind.py index 9b66bfb..757a40e 100644 --- a/dap/algos/streakfind.py +++ b/dap/algos/streakfind.py @@ -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})