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
2 changed files with 5 additions and 4 deletions
Showing only changes of commit ff532af0d6 - Show all commits

View File

@@ -148,9 +148,9 @@ def _calc_streakfinder_analysis(results, cryst_data: CrystData):
streaks = det_obj.to_streaks(detected)
if x_center is not None and y_center is not None:
streaks = streaks.concentric_only(x_center, y_center)
streaks_mask = streaks.concentric_only(x_center, y_center)
streak_lines = streaks.lines
streak_lines = streaks.lines[streaks_mask]
streak_lengths = np.sqrt(
np.pow((streak_lines[..., 2] - streak_lines[..., 0]), 2) +
np.pow((streak_lines[..., 2] - streak_lines[..., 0]), 2)
@@ -161,7 +161,8 @@ def _calc_streakfinder_analysis(results, cryst_data: CrystData):
print(f"Found {number_of_streaks} streaks")
list_result = [line.tolist() for line in streak_lines] # arr(4, n_lines); 0coord x0, y0, x1, y1
bragg_counts = [streak.total_mass() for streak in detected.streaks.values()]
detected_streaks = np.asarray(detected.streaks.values())[streaks_mask]
bragg_counts = [streak.total_mass() for streak in detected_streaks]
results.update({"number_of_streaks": number_of_streaks})
results.update({"is_hit_frame": number_of_streaks > 0})

View File

@@ -121,7 +121,7 @@ def work(backend_address, accumulator_host, accumulator_port, visualisation_host
print(f"Applying whitefield correction")
calc_apply_whitefield_correction(results, image) # changes image in place
print(f"Searching streaks")
calc_streakfinder_analysis(results, image, pixel_mask_pf)
image = calc_streakfinder_analysis(results, image, pixel_mask_pf) # changes image in place is do_snr=True
print(f"Done\n{results=}")
image, aggregation_is_ready = calc_apply_aggregation(results, image, pixel_mask_pf, aggregator)