diff --git a/pes_to_spec/model.py b/pes_to_spec/model.py index 389c0827bc759812fbdc28049f6301b37fc2dcd1..911ddd462b1a797475afb757d562334d7304fec2 100644 --- a/pes_to_spec/model.py +++ b/pes_to_spec/model.py @@ -337,13 +337,14 @@ class SelectRelevantLowResolution(TransformerMixin, BaseEstimator): """ # reduce on channel and on train ID 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) #widths = np.arange(10, 50, step=5) #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.sum(gaussian, axis=0, keepdims=True) # 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)] if len(peak_idx) < 1: raise PromptNotFoundError()