Skip to content

Commit 36e2a6c

Browse files
authored
Update ALS11012RSoXSLoader.py dark pedestal
Added proper dark subtraction code. Previous version had img = (img - darkimg + self.dark_pedestal)/corr, which permanently adds the value of the dark pedestal to your data. Corrected version adds the dark pedestal first, performs the subtraction and correction, and then takes the pedestal back out. Interestingly, I think that this code used to be correct.
1 parent caeb18e commit 36e2a6c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/PyHyperScattering/ALS11012RSoXSLoader.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ def loadSingleImage(self,filepath,coords=None,return_q=False,**kwargs):
166166
warnings.warn(f"Could not find a dark image with exposure time {headerdict['EXPOSURE']}. Using zeros.",stacklevel=2)
167167
darkimg = np.zeros_like(img)
168168

169-
img = (img-darkimg+self.dark_pedestal)/corr
169+
img += self.dark_pedestal
170+
img = (img - darkimg) / corr
171+
img -= self.dark_pedestal / corr
170172

171173
# now, match up the dims and coords
172174
if return_q:

0 commit comments

Comments
 (0)