Skip to content

Commit 68f23a4

Browse files
authored
Merge pull request #2468 from EdgarGF93/fakedata_background
Fakedata background
2 parents c18d2d6 + 29ee396 commit 68f23a4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/pyFAI/calibrant.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -667,13 +667,14 @@ def get_peaks(self, unit: str="2th_deg"):
667667

668668
return values * scale
669669

670-
def fake_calibration_image(self, ai, shape=None, Imax=1.0,
671-
U=0, V=0, W=0.0001) -> numpy.ndarray:
670+
def fake_calibration_image(self, ai, shape=None, Imax=1.0, Imin=0.0,
671+
U=0, V=0, W=0.0001,
672+
) -> numpy.ndarray:
672673
"""
673674
Generates a fake calibration image from an azimuthal integrator.
674-
675675
:param ai: azimuthal integrator
676676
:param Imax: maximum intensity of rings
677+
:param Imin: minimum intensity of the signal (background)
677678
:param U, V, W: width of the peak from Caglioti's law (FWHM^2 = Utan(th)^2 + Vtan(th) + W)
678679
"""
679680
if shape is None:
@@ -709,8 +710,11 @@ def fake_calibration_image(self, ai, shape=None, Imax=1.0,
709710
break
710711
else:
711712
signal += Imax * numpy.exp(-(tth_1d - t) ** 2 / (2.0 * sigma2))
713+
signal = (Imax - Imin) * signal + Imin
714+
712715
res = ai.calcfrom1d(tth_1d, signal, shape=shape, mask=ai.mask,
713716
dim1_unit='2th_rad', correctSolidAngle=True)
717+
714718
return res
715719

716720
def __getnewargs_ex__(self):

0 commit comments

Comments
 (0)