diff --git a/src/toolbox_scs/detectors/hrixs.py b/src/toolbox_scs/detectors/hrixs.py index c143833a0954cc8eee03d49625c67ba73dc4f987..ae983c36bc252ae94df3d9192d66f0c30acc9890 100644 --- a/src/toolbox_scs/detectors/hrixs.py +++ b/src/toolbox_scs/detectors/hrixs.py @@ -246,10 +246,6 @@ RANGE = [300, 400] BINS = abs(np.subtract(*RANGE)) * FACTOR -def parabola(x, a, b, c=0): - return (a * x + b) * x + c - - class hRIXS: """The hRIXS analysis, especially curvature correction @@ -449,6 +445,9 @@ class hRIXS: * self.ENERGY_SLOPE + self.ENERGY_INTERCEPT) return data.assign(spectrum=(("trainId", "energy"), ret)) + def parabola(self, x): + return (self.CURVE_B * x + self.CURVE_A) * x + def integrate(self, data): """calculate a spectrum by integration @@ -479,7 +478,7 @@ class hRIXS: image = image.values[self.X_RANGE, self.Y_RANGE].T x = np.arange(image.shape[1])[None, :] y = np.arange(image.shape[0])[:, None] - ys = (y - parabola(x, self.CURVE_B, self.CURVE_A)) + ys = y - self.parabola(x) ysf = np.floor(ys) rang = (10, bins + 10) lhy, lhx = np.histogram(ysf.ravel(), bins=bins, range=rang,