Skip to content

Commit 1ce767c

Browse files
committed
An attempt at a simple smart merge for microED data.
1 parent bfaeefe commit 1ce767c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

GSASII/GSASIIdataGUI.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,12 @@ def __init__(self,parent,data):
129129
self.Trans = np.eye(4)
130130
else:
131131
self.Trans = np.eye(3)
132+
self.Type = data[0]['Type']
132133
self.Cent = 'noncentrosymmetric'
133134
self.Laue = '1'
134135
self.Class = 'triclinic'
135136
self.Common = 'abc'
137+
self.Smart = False
136138
self.Draw()
137139

138140
def Draw(self):
@@ -159,6 +161,9 @@ def OnCommon(event):
159161
self.Common = Obj.GetValue()
160162
self.Trans = commonTrans[self.Common]
161163
wx.CallAfter(self.Draw)
164+
165+
def OnSmart(event):
166+
self.Smart = not self.Smart
162167

163168
self.panel.Destroy()
164169
self.panel = wx.Panel(self)
@@ -215,6 +220,10 @@ def OnCommon(event):
215220
Laue.Bind(wx.EVT_COMBOBOX,OnLaue)
216221
mergeSizer.Add(Laue,0,WACV)
217222
mainSizer.Add(mergeSizer)
223+
if self.Type == 'SEC':
224+
Smart = wx.CheckBox(self.panel,label=' Do smart merge for microED?')
225+
Smart.Bind(wx.EVT_CHECKBOX,OnSmart)
226+
mainSizer.Add(Smart,0)
218227

219228
OkBtn = wx.Button(self.panel,-1,"Ok")
220229
OkBtn.Bind(wx.EVT_BUTTON, self.OnOk)
@@ -234,7 +243,7 @@ def OnCommon(event):
234243
self.Fit()
235244

236245
def GetSelection(self):
237-
return self.Trans,self.Cent,self.Laue
246+
return self.Trans,self.Cent,self.Laue,self.Smart
238247

239248
def OnOk(self,event):
240249
parent = self.GetParent()
@@ -8118,7 +8127,7 @@ def OnMergeHKL(event):
81188127
dlg = MergeDialog(G2frame,data)
81198128
try:
81208129
if dlg.ShowModal() == wx.ID_OK:
8121-
Trans,Cent,Laue = dlg.GetSelection()
8130+
Trans,Cent,Laue,Smart = dlg.GetSelection()
81228131
else:
81238132
return
81248133
finally:
@@ -8158,6 +8167,11 @@ def OnMergeHKL(event):
81588167
Fo = np.average(fos[:,2],weights=wFo)
81598168
std = np.std(fos[:,2])
81608169
sig = np.sqrt(np.mean(fos[:,3])**2+std**2)
8170+
if Smart:
8171+
fos[:,2] = np.where(np.abs(fos[:,2]-Fo)/std > 2.0,Fo,fos[:,2])
8172+
Fo = np.average(fos[:,2],weights=wFo)
8173+
std = np.std(fos[:,2])
8174+
sig = np.sqrt(np.mean(fos[:,3])**2+std**2)
81618175
sumFo += np.sum(fos[:,2])
81628176
sumDf += np.sum(np.abs(fos[:,2]-Fo))
81638177
dlg.Update(ih)

0 commit comments

Comments
 (0)