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 969ac8ffcf - Show all commits

View File

@@ -19,7 +19,8 @@ def calc_streakfinder_analysis(results, data, pf_pixel_mask):
do_streakfinder_analysis = results.get("do_streakfinder_analysis", False)
if not do_snr and not do_streakfinder_analysis:
return data
# Shift to min=0
data = data - np.min(data)
try:
cryst_data = _generate_cryst_data(results, data, pf_pixel_mask)
except Exception as error: # Broad exception - we don't want to break anything here
@@ -127,6 +128,11 @@ def _calc_streakfinder_analysis(results, cryst_data: CrystData):
for mask_roi in mask_rois:
cryst_data = cryst_data.mask_region(mask_roi)
crop_roi = results.get("sf_crop_roi", None) # [y_min, y_max, x_min, x_max]
if crop_roi is not None:
cryst_data = cryst_data.crop(crop_roi)
peaks_structure = Structure2D(peak_structure_radius, peak_structure_rank)
streaks_structure = Structure2D(streak_structure_radius, streak_structure_rank)
@@ -148,7 +154,7 @@ def _calc_streakfinder_analysis(results, cryst_data: CrystData):
return
streaks = det_obj.to_streaks(detected)
detected_streaks = np.asarray(list(detected.streaks.values()))
detected_streaks = np.asarray(detected.streaks)
streak_lines = streaks.lines
if x_center is not None and y_center is not None: