Integration mode hrixs.integrate() has weird background
Hi,
There is a weird background showing up in Integrated data when doing hrixs.integrate() in file ToolBox.src.toolbox_scs.detectors.hrixs.py.
MINIMAL WORKING EXAMPLE
proposal = 4476
h = hRIXS(proposal)
h.CURVE_A = -0.029872503864697142
h.CURVE_B = -3.9515172416875527e-07
h.ENERGY_SLOPE = 0.030240296494194192 # eV/pixel
h.ENERGY_INTERCEPT = 437.18682891634967
plt.figure()
for start in (350, 400, 500):
h.Y_RANGE = slice(start, start+400) # data must have 400 points
data = h.from_run(155)
data = h.integrate(data) # the background problem seems to be here
agg = h.aggregate(data)
print(len(agg.spectrum)) # data comes out with 380 points, which doesn't seem to be correct
x = np.arange(h.Y_RANGE.start+10, h.Y_RANGE.stop-10) # fixing x with 20 points less
y = agg.spectrum
plt.plot(x, y)
One can see that the start of the curves have a weird background that isn't real. For instance, if one set the curvature correction parameters to zero, then the wrong background goes away.
proposal = 4476
h = hRIXS(proposal)
h.CURVE_A = 0
h.CURVE_B = 0
h.ENERGY_SLOPE = 0.030240296494194192 # eV/pixel
h.ENERGY_INTERCEPT = 437.18682891634967
plt.figure()
for start in (350, 400, 500):
h.Y_RANGE = slice(start, start+400) # data must have 400 points
data = h.from_run(155)
data = h.integrate(data) # the background problem seems to be here
agg = h.aggregate(data)
print(len(agg.spectrum)) # data comes out with 380 points, which doesn't seem to be correct
x = np.arange(h.Y_RANGE.start+10, h.Y_RANGE.stop-10) # fixing x with 20 points less
y = agg.spectrum
plt.plot(x, y)