cleanup; logic also works correctly for number_of_spots == 0
This commit is contained in:
@ -8,6 +8,7 @@ from peakfinder8_extension import peakfinder_8
|
|||||||
def calc_peakfinder_analysis(results, data, pixel_mask_pf):
|
def calc_peakfinder_analysis(results, data, pixel_mask_pf):
|
||||||
x_beam = results["beam_center_x"] - 0.5 # to coordinates where position of first pixel/point is 0.5, 0.5
|
x_beam = results["beam_center_x"] - 0.5 # to coordinates where position of first pixel/point is 0.5, 0.5
|
||||||
y_beam = results["beam_center_y"] - 0.5 # to coordinates where position of first pixel/point is 0.5, 0.5
|
y_beam = results["beam_center_y"] - 0.5 # to coordinates where position of first pixel/point is 0.5, 0.5
|
||||||
|
|
||||||
hitfinder_min_snr = results["hitfinder_min_snr"]
|
hitfinder_min_snr = results["hitfinder_min_snr"]
|
||||||
hitfinder_min_pix_count = int(results["hitfinder_min_pix_count"])
|
hitfinder_min_pix_count = int(results["hitfinder_min_pix_count"])
|
||||||
hitfinder_adc_thresh = results["hitfinder_adc_thresh"]
|
hitfinder_adc_thresh = results["hitfinder_adc_thresh"]
|
||||||
@ -18,7 +19,7 @@ def calc_peakfinder_analysis(results, data, pixel_mask_pf):
|
|||||||
max_num_peaks = 10000
|
max_num_peaks = 10000
|
||||||
|
|
||||||
# usually don't need to change this value, rather robust
|
# usually don't need to change this value, rather robust
|
||||||
hitfinder_local_bg_radius= 20.
|
hitfinder_local_bg_radius = 20.
|
||||||
|
|
||||||
# in case of further modification with the mask, make a new one, independent from real mask
|
# in case of further modification with the mask, make a new one, independent from real mask
|
||||||
maskPr = np.copy(pixel_mask_pf)
|
maskPr = np.copy(pixel_mask_pf)
|
||||||
@ -42,17 +43,12 @@ def calc_peakfinder_analysis(results, data, pixel_mask_pf):
|
|||||||
|
|
||||||
number_of_spots = len(peak_list_x)
|
number_of_spots = len(peak_list_x)
|
||||||
results["number_of_spots"] = number_of_spots
|
results["number_of_spots"] = number_of_spots
|
||||||
if number_of_spots != 0:
|
results["spot_x"] = [-1.0] * number_of_spots
|
||||||
results["spot_x"] = [-1.0] * number_of_spots
|
results["spot_y"] = [-1.0] * number_of_spots
|
||||||
results["spot_y"] = [-1.0] * number_of_spots
|
results["spot_intensity"] = copy(peak_list_value)
|
||||||
results["spot_intensity"] = copy(peak_list_value)
|
for i in range(number_of_spots):
|
||||||
for i in range(number_of_spots):
|
results["spot_x"][i] = peak_list_x[i] + 0.5
|
||||||
results["spot_x"][i] = peak_list_x[i] + 0.5
|
results["spot_y"][i] = peak_list_y[i] + 0.5
|
||||||
results["spot_y"][i] = peak_list_y[i] + 0.5
|
|
||||||
else:
|
|
||||||
results["spot_x"] = []
|
|
||||||
results["spot_y"] = []
|
|
||||||
results["spot_intensity"] = []
|
|
||||||
|
|
||||||
npeaks_threshold_hit = results.get("npeaks_threshold_hit", 15)
|
npeaks_threshold_hit = results.get("npeaks_threshold_hit", 15)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user