@@ -56,6 +56,7 @@ class WeakPeak:
56
56
tof_fwhm : float
57
57
tof_bin_width : float
58
58
ipks_near : np .ndarray
59
+ kernel_shape : tuple
59
60
60
61
61
62
class ShoeboxResult :
@@ -400,7 +401,9 @@ def PyExec(self):
400
401
# look for possible strong peaks at any TOF in the window (won't know if strong until all pks integrated)
401
402
ipks_near , _ = find_ipks_in_window (ws , peaks , ispecs , ipk )
402
403
fwhm = fwhm if get_nbins_from_b2bexp_params else None # not calculated but not going to be used
403
- weak_peaks_list .append (WeakPeak (ipk , ispecs [ipos [0 ], ipos [1 ]], x [ipos [- 1 ]], fwhm , bin_width , ipks_near ))
404
+ weak_peaks_list .append (
405
+ WeakPeak (ipk , ispecs [ipos [0 ], ipos [1 ]], x [ipos [- 1 ]], fwhm , bin_width , ipks_near , (nrows , ncols , nbins ))
406
+ )
404
407
else :
405
408
if status == PEAK_STATUS .STRONG :
406
409
ipks_strong .append (ipk )
@@ -443,12 +446,43 @@ def PyExec(self):
443
446
peak , peak .getDetectorID (), bank_name , nshoebox * kernel .shape [0 ], nshoebox * kernel .shape [1 ], nrows_edge , ncols_edge
444
447
)
445
448
x , y , esq , ispecs = get_and_clip_data_arrays (ws , peak_data , pk_tof , kernel , nshoebox )
449
+
446
450
# integrate at previously found ipos
451
+ if weak_pk .ispec not in ispecs :
452
+ nrows = max (kernel .shape [0 ], weak_pk .kernel_shape [0 ])
453
+ ncols = max (kernel .shape [0 ], weak_pk .kernel_shape [0 ])
454
+ peak_data = array_converter .get_peak_data (
455
+ peak ,
456
+ peak .getDetectorID (),
457
+ bank_name ,
458
+ nshoebox * nrows ,
459
+ nshoebox * ncols ,
460
+ nrows_edge ,
461
+ ncols_edge ,
462
+ )
463
+ x , y , esq , ispecs = get_and_clip_data_arrays (ws , peak_data , pk_tof , kernel , nshoebox )
447
464
ipos = [* np .argwhere (ispecs == weak_pk .ispec )[0 ], np .argmin (abs (x - weak_pk .tof ))]
448
465
peaks_det_ids [ipk ] = peak_data .detids
449
466
450
467
det_edges = peak_data .det_edges if not integrate_on_edge else None
451
- intens , sigma , i_over_sig , status = integrate_shoebox_at_pos (y , esq , kernel , ipos , weak_peak_threshold , det_edges )
468
+ intens , sigma , i_over_sig , status , ipos , nrows , ncols , nbins = integrate_peak (
469
+ ws ,
470
+ peaks ,
471
+ ipk ,
472
+ kernel ,
473
+ nrows ,
474
+ ncols ,
475
+ nbins ,
476
+ x ,
477
+ y ,
478
+ esq ,
479
+ ispecs ,
480
+ ipos ,
481
+ det_edges ,
482
+ weak_peak_threshold ,
483
+ False ,
484
+ )
485
+
452
486
# scale summed intensity by bin width to get integrated area
453
487
intens = intens * weak_pk .tof_bin_width
454
488
sigma = sigma * weak_pk .tof_bin_width
0 commit comments