Skip to content

Commit 39cffed

Browse files
committed
Fix problem with assignment of SEC as histogram type
Add some statistics for merge
1 parent 1ce767c commit 39cffed

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

GSASII/GSASIIdataGUI.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8158,8 +8158,17 @@ def OnMergeHKL(event):
81588158
style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE)
81598159
sumDf = 0.
81608160
sumFo = 0.
8161+
Nmerge = {1:[0,0],}
8162+
MaxN = 1
81618163
for ih,hkl in enumerate(HKLdict):
81628164
HKL = HKLdict[hkl]
8165+
Nhkl = len(HKL[1])
8166+
if Nhkl not in Nmerge:
8167+
Nmerge.update({Nhkl:[1,0],})
8168+
MaxN = max(MaxN,Nhkl)
8169+
8170+
else:
8171+
Nmerge[Nhkl][0] += 1
81638172
newHKL = list(HKL[0])+list(HKL[1][0])
81648173
if len(HKL[1]) > 1:
81658174
fos = np.array(HKL[1])
@@ -8168,7 +8177,9 @@ def OnMergeHKL(event):
81688177
std = np.std(fos[:,2])
81698178
sig = np.sqrt(np.mean(fos[:,3])**2+std**2)
81708179
if Smart:
8171-
fos[:,2] = np.where(np.abs(fos[:,2]-Fo)/std > 2.0,Fo,fos[:,2])
8180+
test = np.abs(fos[:,2]-Fo)/std
8181+
Nmerge[Nhkl][1] += len(fos[:,2][test >2.0])
8182+
fos[:,2] = np.where(test > 2.0,Fo,fos[:,2])
81728183
Fo = np.average(fos[:,2],weights=wFo)
81738184
std = np.std(fos[:,2])
81748185
sig = np.sqrt(np.mean(fos[:,3])**2+std**2)
@@ -8181,6 +8192,12 @@ def OnMergeHKL(event):
81818192
if newHKL[5+Super] > 0.:
81828193
mergeRef.append(list(newHKL))
81838194
dlg.Destroy()
8195+
print(' Duplicate reflection statistics:')
8196+
for ihkl in range(MaxN):
8197+
try:
8198+
print('Ndup hkl:',ihkl+1,' Number: ',Nmerge[ihkl+1][0],' Rej:',Nmerge[ihkl+1][1])
8199+
except KeyError:
8200+
print('Ndup hkl:',ihkl+1,' Number: ',0)
81848201
if Super:
81858202
mergeRef = G2mth.sortArray(G2mth.sortArray(G2mth.sortArray(G2mth.sortArray(mergeRef,3),2),1),0)
81868203
else:

GSASII/GSASIIpwdGUI.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2910,6 +2910,7 @@ def OnLamPick(event):
29102910
insVal['Type'] = 'SEC' # in 3 places!
29112911
Pattern = G2frame.GPXtree.GetItemPyData(G2frame.PatternId)
29122912
Pattern[0]['Type'] = 'SEC'
2913+
Pattern[1]['Type'] = 'SEC' #Here, too!
29132914
updateData(insVal,insRef)
29142915
wx.CallAfter(UpdateInstrumentGrid,G2frame,data)
29152916

0 commit comments

Comments
 (0)