diff --git a/dap/algos/streakfind.py b/dap/algos/streakfind.py index 5676dd9..16af5cd 100644 --- a/dap/algos/streakfind.py +++ b/dap/algos/streakfind.py @@ -131,6 +131,7 @@ def _calc_streakfinder_analysis(results, cryst_data: CrystData): 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) @@ -159,10 +160,13 @@ def _calc_streakfinder_analysis(results, cryst_data: CrystData): # Adjust to crop region if crop_roi is not None: - shift = [crop_roi[0], crop_roi[2], crop_roi[0], crop_roi[2]] + shift = [crop_roi[2], crop_roi[0], crop_roi[0], crop_roi[2]] streak_lines = streak_lines + shift if x_center is not None and y_center is not None: + if crop_roi is not None: + x_center -= crop_roi[0] + y_center -= crop_roi[2] streaks_mask = streaks.concentric_only(x_center, y_center) streak_lines = streak_lines[streaks_mask] detected_streaks = detected_streaks[streaks_mask]