Skip to content
Snippets Groups Projects
Commit d0c9fa19 authored by Danilo Ferreira de Lima's avatar Danilo Ferreira de Lima
Browse files

Subtract PES pedestal when finding RoI.

parent a2b8e842
No related branches found
No related tags found
1 merge request!19Handle pedestal in PES and use GPU if available in BNN
...@@ -337,13 +337,14 @@ class SelectRelevantLowResolution(TransformerMixin, BaseEstimator): ...@@ -337,13 +337,14 @@ class SelectRelevantLowResolution(TransformerMixin, BaseEstimator):
""" """
# reduce on channel and on train ID # reduce on channel and on train ID
sum_low_res = - np.mean(sum(list(X.values())), axis=0) sum_low_res = - np.mean(sum(list(X.values())), axis=0)
zero_level = np.amin(sum_low_res)
axis = np.arange(0.0, sum_low_res.shape[0], 1.0) axis = np.arange(0.0, sum_low_res.shape[0], 1.0)
#widths = np.arange(10, 50, step=5) #widths = np.arange(10, 50, step=5)
#peak_idx = find_peaks_cwt(sum_low_res, widths) #peak_idx = find_peaks_cwt(sum_low_res, widths)
gaussian = np.exp(-0.5*(axis - sum_low_res.shape[0]//2)**2/20**2) gaussian = np.exp(-0.5*(axis - sum_low_res.shape[0]//2)**2/20**2)
gaussian /= np.sum(gaussian, axis=0, keepdims=True) gaussian /= np.sum(gaussian, axis=0, keepdims=True)
# apply it to the data # apply it to the data
smoothened = fftconvolve(sum_low_res, gaussian, mode="same", axes=0) smoothened = fftconvolve(sum_low_res - zero_level, gaussian, mode="same", axes=0)
peak_idx = [np.argmax(smoothened)] peak_idx = [np.argmax(smoothened)]
if len(peak_idx) < 1: if len(peak_idx) < 1:
raise PromptNotFoundError() raise PromptNotFoundError()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment