From f416a95618d603c21f9521c1142c08977790be28 Mon Sep 17 00:00:00 2001
From: Danilo Ferreira de Lima <danilo.enoque.ferreira.de.lima@xfel.de>
Date: Thu, 16 Feb 2023 18:40:47 +0100
Subject: [PATCH] Convolving in the correct axis.

---
 pes_to_spec/model.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pes_to_spec/model.py b/pes_to_spec/model.py
index 0e038dd..af76147 100644
--- a/pes_to_spec/model.py
+++ b/pes_to_spec/model.py
@@ -444,9 +444,9 @@ class SelectRelevantLowResolution(TransformerMixin, BaseEstimator):
         #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=1, keepdims=True)
+        gaussian /= np.sum(gaussian, axis=0, keepdims=True)
         # apply it to the data
-        smoothened = fftconvolve(sum_low_res, gaussian, mode="same", axes=1)
+        smoothened = fftconvolve(sum_low_res, gaussian, mode="same", axes=0)
         peak_idx = [np.argmax(smoothened)]
         if len(peak_idx) < 1:
             raise PromptNotFoundError()
-- 
GitLab