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 e3e701a4da - Show all commits

View File

@@ -15,17 +15,18 @@ DEFAULT_NUM_THREADS = 16
DEFAULT_MIN_HIT_STREAKS = 5
def _handle_negative_values(data, handler: str):
def _handle_negative_values(data, mask, handler: str):
if not handler or np.all(data>=0):
return
if handler == "shift":
# Shift to min=0
data -= np.min(data)
elif handler == "mask":
data[data<0] = np.nan
mask[data<0] = np.nan
elif handler == "zero":
data[data<0] = 0
def calc_streakfinder_analysis(results, data, pf_pixel_mask):
do_snr = results.get("do_snr", False)
do_streakfinder_analysis = results.get("do_streakfinder_analysis", False)
@@ -33,7 +34,7 @@ def calc_streakfinder_analysis(results, data, pf_pixel_mask):
return data
negative_val_handler = results.get("sf_negative_handler", "")
_handle_negative_values(data, negative_val_handler)
_handle_negative_values(data, pf_pixel_mask, negative_val_handler)
try:
cryst_data = _generate_cryst_data(results, data, pf_pixel_mask)