From 6758f3cc6d8e7914c6f7c5e5bc3dae10fda66551 Mon Sep 17 00:00:00 2001 From: Alexander Steppke Date: Sat, 18 Jan 2025 20:26:35 +0100 Subject: [PATCH] Thresholding and sum part 2 --- src/cristallina/analysis.py | 8 +++++++- src/cristallina/channels.py | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/cristallina/analysis.py b/src/cristallina/analysis.py index 3219940..3a773b8 100644 --- a/src/cristallina/analysis.py +++ b/src/cristallina/analysis.py @@ -10,7 +10,6 @@ import lmfit from sfdata import SFDataFiles, sfdatafile, SFScanInfo -import joblib from joblib import Memory from . import utils @@ -68,6 +67,7 @@ def perform_image_calculations( roi: Optional[ROI] = None, preview=False, operations=["sum"], + lower_cutoff_threshold=None, ): """ Performs one or more calculations ("sum", "mean" or "std") for a given region of interest (roi) @@ -112,6 +112,10 @@ def perform_image_calculations( else: im_ROI = im[:, roi.rows, roi.cols] + # use cutoff to set values to 0 below + if lower_cutoff_threshold is not None: + im_ROI = np.where(im_ROI < lower_cutoff_threshold, 0, im_ROI) + # iterate over all operations for op in operations: label, func = possible_operations[op] @@ -134,6 +138,7 @@ def sum_images( batch_size=10, roi: Optional[ROI] = None, preview=False, + lower_cutoff_threshold=None, ): """ Sums a given region of interest (roi) for an image channel from a @@ -157,6 +162,7 @@ def sum_images( roi=roi, preview=preview, operations=["sum"], + lower_cutoff_threshold=lower_cutoff_threshold, ) diff --git a/src/cristallina/channels.py b/src/cristallina/channels.py index 413cd1e..01ce4fb 100644 --- a/src/cristallina/channels.py +++ b/src/cristallina/channels.py @@ -11,6 +11,10 @@ JF = 'JF16T03V01' # Jungfrau 8M detector JF_8M = "JF17T16V01" +# JF I0 monitor and stripcell detector +JF_I0 = 'JF20T01V01' +JF_strip = 'JF05T01V01' + # PSSS PSSS_X = 'SARFE10-PSSS059:SPECTRUM_X' PSSS_Y = 'SARFE10-PSSS059:SPECTRUM_Y' @@ -24,3 +28,5 @@ PBPS053_intensity = "SARFE10-PBPS053:INTENSITY" # X-ray eye XEYE = "SARES30-CAMS156-XE:FPICTURE" + +