Skip to content

Commit eb0198e

Browse files
committed
more for #252 (load pixel mask); explain background peaks for scripting
1 parent 16559e2 commit eb0198e

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

GSASII/GSASIIimgGUI.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2044,10 +2044,12 @@ def OnLoadPixelMask(event):
20442044
# was loaded rather than a search
20452045
data['SpotMask']['spotMask'] = maskImage > 0
20462046
nmasked = sum(data['SpotMask']['spotMask'].flatten())
2047-
frac = nmasked/data['SpotMask']['spotMask'].size
2047+
frac = 100*nmasked/data['SpotMask']['spotMask'].size
20482048
G2G.G2MessageBox(G2frame,
20492049
f'Mask removes {nmasked} pixels ({frac:.3f}%)',
20502050
'Mask loaded')
2051+
wx.CallAfter(UpdateMasks,G2frame,data)
2052+
wx.CallAfter(G2plt.PlotExposedImage,G2frame,event=event)
20512053

20522054
def OnFindPixelMask(event):
20532055
'''Do auto search for pixels to mask

GSASII/GSASIIscriptable.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3494,12 +3494,25 @@ def Background(self):
34943494
def add_back_peak(self,pos,int,sig,gam,refflags=[]):
34953495
'''Adds a background peak to the Background parameters
34963496
3497+
Background in diffraction patterns is usually fit
3498+
with a slowly varying smooth function, such as a Chebyschev
3499+
polynomial, but when the background contains broad peaks
3500+
(for example from a Kapton sample container) those peaks
3501+
are usually better fit by adding extra peaks to the
3502+
smooth background function rather that providing enough
3503+
parameters to the smooth function in order fit the
3504+
peak(s). Note that background peaks are typically treated
3505+
as Gaussian only (``gam``=0) with very large ``sig``
3506+
values (>1000). Normally one should refine ``int`` and
3507+
then ``sig`` and only after the background peak is well
3508+
fit can one refine the ``pos`` value.
3509+
34973510
:param float pos: position of peak, a 2theta or TOF value
34983511
:param float int: integrated intensity of background peak, usually large
34993512
:param float sig: Gaussian width of background peak, usually large
3500-
:param float gam: Lorentzian width of background peak, usually unused (small)
3513+
:param float gam: Lorentzian width of background peak, usually not used (small)
35013514
:param list refflags: a list of 1 to 4 boolean refinement flags for
3502-
pos,int,sig & gam, respectively (use [0,1] to refine int only).
3515+
pos,int,sig & gam, respectively (e.g. use [0,1] to refine int only).
35033516
Defaults to [] which means nothing is refined.
35043517
'''
35053518
if 'peaksList' not in self.Background[1]:

0 commit comments

Comments
 (0)