@@ -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 :
0 commit comments