Skip to content

Commit a9ef726

Browse files
committed
single crystal importers default Extc = 1 (not 0)
checks on negative Fo (not Sig) for HKLF in various places
1 parent 4f95c38 commit a9ef726

File tree

7 files changed

+31
-29
lines changed

7 files changed

+31
-29
lines changed

GSASII/GSASIIdataGUI.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8280,7 +8280,7 @@ def OnErrorAnalysis(event):
82808280
Should be straight line of slope 1 - never is'''
82818281
def OnPlotFoFcVsFc():
82828282
''' Extinction check, plots Fo-Fc & 1/ExtC vs Fo for single crystal data '''
8283-
test = lambda xy:(xy[iFlg+Super]>0 and (xy[iFc+Super]>0 or xy[iFo+Super]>0))
8283+
test = lambda xy:(xy[iFlg+Super]>0 and xy[iFo+Super]>0)
82848284
iFlg,iFo,iSig,iFc,iFcT,iExt = 3,5,6,7,9,11
82858285
refList = data[1]['RefList']
82868286
wtFctr = data[0]['wtFactor']
@@ -8290,6 +8290,7 @@ def OnPlotFoFcVsFc():
82908290
Sig = np.array([xy[iSig+Super] for xy in refList if test(xy)])/wtFctr #sig(fo^2)/wtFactor (1/GOF)
82918291
XE = [[xy[iFcT+Super],xy[iExt+Super]] for xy in refList if test(xy)]
82928292
XE = np.array([[np.sqrt(xe[0]),xe[1]] for xe in XE]).T
8293+
XE[1] = np.where(XE[1]>0.,XE[1],1.0)
82938294
G2plt.PlotXY(G2frame,[[FcT,2.*Fo*(Fo-Fc)/Sig],],XY2=[XE,],labelX='Fc',labelY=GkDelta+'F/sig, ExtC',newPlot=False,
82948295
Title='Extinction check',lines=False,points2=True,names=[GkDelta+'F/sig',],names2=['ExtC',])
82958296

GSASII/GSASIIddataGUI.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,7 @@ def OnFixVals(event):
955955
useData.Bind(wx.EVT_CHECKBOX, OnUseData)
956956
useData.SetValue(UseList[G2frame.hist]['Use'])
957957
useBox.Add(useData,0,WACV)
958-
Htype = UseList[G2frame.hist]['Type']
958+
Htype = UseList[G2frame.hist].get('Type','SXC')
959959
useBox.Add(wx.StaticText(DData,label=' Histogram type: '+Htype))
960960
if not generalData['doPawley'] and 'PWDR' in G2frame.hist[:4]:
961961
lbLabel = 'Start Le Bail extraction? '

GSASII/GSASIIobj.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,8 +652,9 @@ def CompileVarDesc():
652652
'Ep$' : 'Primary extinction',
653653
'Es$' : 'Secondary type II extinction',
654654
'Eg$' : 'Secondary type I extinction',
655-
'Ma$' : 'Low F dynamic scattering scale',
656-
'Mb$' : 'Low F dynamic scattering exponent',
655+
'Ma$' : 'microED dynamic scattering coeff A',
656+
'Mb$' : 'microED dynamic scattering coeff B',
657+
'Mc$' : 'microED dynamic scattering coeff C',
657658
'Flack' : 'Flack parameter',
658659
'TwinFr' : 'Twin fraction',
659660
'Layer Disp' : 'Layer displacement along beam',

GSASII/GSASIIplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1892,7 +1892,7 @@ def PlotDeltSig(G2frame,kind,PatternName=None):
18921892
sumWdelt = 0.0
18931893
Nobs = 0
18941894
for ref in refl:
1895-
if ref[6+im] > 0.:
1895+
if ref[5+im] > 0.:
18961896
if ref[3+im] > 0:
18971897
Nobs += 1
18981898
w2 = 1./ref[6+im]

GSASII/GSASIIstrMath.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2723,11 +2723,10 @@ def SStructureFactorDervTw(refDict,im,G,hfx,pfx,SGData,SSGData,calcControls,parm
27232723
return dFdvDict
27242724

27252725
def SCExtinction(ref,im,phfx,hfx,pfx,calcControls,parmDict,varyList):
2726-
''' Single crystal extinction function; returns extinction & derivative
2726+
''' Single crystal extinction function; returns extinction & derivatives
27272727
'''
27282728
extCor = 1.0
27292729
dervDict = {}
2730-
dervCor = 1.0
27312730
if 'microED' in calcControls[phfx+'EType']:
27322731
FPone = np.sqrt(ref[9+im])
27332732
PA = np.exp(-parmDict[phfx+'Ma']*FPone)
@@ -2737,7 +2736,7 @@ def SCExtinction(ref,im,phfx,hfx,pfx,calcControls,parmDict,varyList):
27372736
dervDict[phfx+'Ma'] = -PA*FPone/3.
27382737
dervDict[phfx+'Mb'] = -PB*FPone**2/3.
27392738
dervDict[phfx+'Mc'] = -PC*FPone**3/3.
2740-
return extCor,dervDict,dervCor
2739+
return extCor,dervDict
27412740

27422741
if calcControls[phfx+'EType'] != 'None':
27432742
SQ = 1/(4.*ref[4+im]**2)
@@ -2798,7 +2797,6 @@ def SCExtinction(ref,im,phfx,hfx,pfx,calcControls,parmDict,varyList):
27982797
extCor = np.sqrt(PF4)
27992798
PF3 = 0.5*(CL+2.*AL*PF/(1.+BL*PF)-AL*PF**2*BL/(1.+BL*PF)**2)/(PF4*extCor)
28002799

2801-
dervCor = (1.+PF)*PF3/DScorr #extinction corr for other derivatives
28022800
if 'Primary' in calcControls[phfx+'EType']:
28032801
if phfx+'Ep' in varyList:
28042802
dervDict[phfx+'Ep'] = -ref[7+im]*PLZ*PF3/DScorr
@@ -2808,7 +2806,7 @@ def SCExtinction(ref,im,phfx,hfx,pfx,calcControls,parmDict,varyList):
28082806
if 'I' in calcControls[phfx+'EType'] and phfx+'Eg' in varyList:
28092807
dervDict[phfx+'Eg'] = -ref[7+im]*PLZ*PF3*(PSIG/parmDict[phfx+'Eg'])**3*PL**2
28102808

2811-
return 1./extCor,dervDict,dervCor
2809+
return 1./extCor,dervDict
28122810

28132811
def Dict2Values(parmdict, varylist):
28142812
'''Use before call to leastsq to setup list of values for the parameters
@@ -4593,7 +4591,7 @@ def dervHKLF(Histogram,Phase,calcControls,varylist,parmDict,rigidbodyDict):
45934591
if calcControls['F**2']:
45944592
for iref,ref in enumerate(refDict['RefList']):
45954593
if ref[6+im] > 0:
4596-
dervDict,dervCor = SCExtinction(ref,im,phfx,hfx,pfx,calcControls,parmDict,varylist+dependentVars)[1:]
4594+
dervDict = SCExtinction(ref,im,phfx,hfx,pfx,calcControls,parmDict,varylist+dependentVars)[1]
45974595
w = 1.0/ref[6+im]
45984596
if ref[3+im] > 0:
45994597
wdf[iref] = w*(ref[5+im]-ref[7+im])
@@ -4607,7 +4605,7 @@ def dervHKLF(Histogram,Phase,calcControls,varylist,parmDict,rigidbodyDict):
46074605
dMdvh[varylist.index(phfx+'Scale')][iref] = w*ref[7+im]*ref[11+im]/parmDict[phfx+'Scale'] #OK
46084606
elif phfx+'Scale' in dependentVars:
46094607
depDerivDict[phfx+'Scale'][iref] = w*ref[7+im]*ref[11+im]/parmDict[phfx+'Scale'] #OK
4610-
for item in ['Ep','Es','Eg','Ma','Mb']:
4608+
for item in ['Ep','Es','Eg','Ma','Mb','Mc']:
46114609
if phfx+item in varylist and phfx+item in dervDict:
46124610
dMdvh[varylist.index(phfx+item)][iref] = w*dervDict[phfx+item]/ref[11+im] #OK
46134611
elif phfx+item in dependentVars and phfx+item in dervDict:
@@ -4620,7 +4618,7 @@ def dervHKLF(Histogram,Phase,calcControls,varylist,parmDict,rigidbodyDict):
46204618
else: #F refinement
46214619
for iref,ref in enumerate(refDict['RefList']):
46224620
if ref[5+im] > 0.:
4623-
dervDict,dervCor = SCExtinction(ref,im,phfx,hfx,pfx,calcControls,parmDict,varylist+dependentVars)[1:]
4621+
dervDict = SCExtinction(ref,im,phfx,hfx,pfx,calcControls,parmDict,varylist+dependentVars)[1]
46244622
Fo = np.sqrt(ref[5+im])
46254623
Fc = np.sqrt(ref[7+im])
46264624
w = 1.0/ref[6+im]
@@ -4636,7 +4634,7 @@ def dervHKLF(Histogram,Phase,calcControls,varylist,parmDict,rigidbodyDict):
46364634
dMdvh[varylist.index(phfx+'Scale')][iref] = w*ref[7+im]*ref[11+im]/parmDict[phfx+'Scale'] #OK
46374635
elif phfx+'Scale' in dependentVars:
46384636
depDerivDict[phfx+'Scale'][iref] = w*ref[7+im]*ref[11+im]/parmDict[phfx+'Scale'] #OK
4639-
for item in ['Ep','Es','Eg','Ma','Mb']: #OK!
4637+
for item in ['Ep','Es','Eg','Ma','Mb','Mc']: #OK!
46404638
if phfx+item in varylist and phfx+item in dervDict:
46414639
dMdvh[varylist.index(phfx+item)][iref] = w*dervDict[phfx+item]/ref[11+im]
46424640
elif phfx+item in dependentVars and phfx+item in dervDict:
@@ -4969,7 +4967,7 @@ def errRefine(values,HistoPhases,parmDict,histDict1,varylist,calcControls,pawley
49694967
maxH = 0
49704968
if calcControls['F**2']:
49714969
for i,ref in enumerate(refDict['RefList']):
4972-
if ref[6+im] > 0:
4970+
if ref[5+im] > 0:
49734971
ref[11+im] = SCExtinction(ref,im,phfx,hfx,pfx,calcControls,parmDict,varylist)[0]
49744972
w = wtFactor/ref[6+im] # 1/sig(F^2)
49754973
ref[7+im] *= parmDict[phfx+'Scale']*ref[11+im] #correct Fc^2 for extinction
@@ -4996,6 +4994,7 @@ def errRefine(values,HistoPhases,parmDict,histDict1,varylist,calcControls,pawley
49964994
SSnobs[ind] += 1
49974995
maxH = max(maxH,ind)
49984996
else:
4997+
ref[11+im] = 1.0
49994998
if ref[3+im]:
50004999
ref[3+im] = -abs(ref[3+im]) #mark as rejected
50015000
nrej += 1
@@ -5009,7 +5008,7 @@ def errRefine(values,HistoPhases,parmDict,histDict1,varylist,calcControls,pawley
50095008
ref[8+im] = ref[5+im]/(parmDict[phfx+'Scale']*ref[11+im])
50105009
Fo = np.sqrt(ref[5+im])
50115010
Fc = np.sqrt(ref[7+im])
5012-
w = 2.0*wtFactor*Fo/ref[6+im] # 1/sig(F)?
5011+
w = 2.0*wtFactor*Fo/ref[6+im]
50135012
if UserRejectHKL(ref,im,calcControls['UsrReject']) and ref[3+im]: #skip sp.gp. absences (mul=0)
50145013
ref[3+im] = abs(ref[3+im]) #mark as allowed
50155014
sumFo += Fo
@@ -5031,6 +5030,7 @@ def errRefine(values,HistoPhases,parmDict,histDict1,varylist,calcControls,pawley
50315030
SSnobs[ind] += 1
50325031
maxH = max(maxH,ind)
50335032
else:
5033+
ref[11+im] = 1.0
50345034
if ref[3+im]:
50355035
ref[3+im] = -abs(ref[3+im]) #mark as rejected
50365036
nrej += 1

GSASII/imports/G2sfact.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def Reader(self,filename, ParentFrame=None, **unused):
6262
Fo = float(Fo)
6363
sigFo = float(sigFo)
6464
# h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,...
65-
self.RefDict['RefList'].append([h,k,l,1,0,Fo**2,2.*Fo*sigFo,0,Fo**2,0,0,0])
65+
self.RefDict['RefList'].append([h,k,l,1,0,Fo**2,2.*Fo*sigFo,0,Fo**2,0,0,1])
6666
fp.close()
6767
self.errors = 'Error after reading reflections (unexpected!)'
6868
self.RefDict['RefList'] = np.array(self.RefDict['RefList'])
@@ -106,7 +106,7 @@ def Reader(self,filename, ParentFrame=None, **unused):
106106
if Fo < 1.0:
107107
sigFo2 = 1.0
108108
# h,k,l,m,tw,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,...
109-
self.RefDict['RefList'].append([h,k,l,m,1,0,Fo**2,sigFo2,0,Fo**2,0,0,0])
109+
self.RefDict['RefList'].append([h,k,l,m,1,0,Fo**2,sigFo2,0,Fo**2,0,0,1])
110110
fp.close()
111111
self.errors = 'Error after reading reflections (unexpected!)'
112112
self.RefDict['RefList'] = np.array(self.RefDict['RefList'])
@@ -158,7 +158,7 @@ def Reader(self,filename, ParentFrame=None, **unused):
158158
Fo = float(Fo)
159159
sigFo = float(sigFo)
160160
# h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,...
161-
self.RefDict['RefList'].append([h,k,l,1,0,Fo,sigFo,0,Fo,0,0,0])
161+
self.RefDict['RefList'].append([h,k,l,1,0,Fo,sigFo,0,Fo,0,0,1])
162162
#self.RefDict['FF'].append({}) # now done in OnImportSfact
163163
fp.close()
164164
self.errors = 'Error after reading reflections (unexpected!)'
@@ -252,9 +252,9 @@ def Reader(self,filename, ParentFrame=None, **unused):
252252
sigFo = float(sigFo)
253253
# h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,...
254254
if self.Super == 0:
255-
self.RefDict['RefList'].append([h,k,l,int(Tw),0,Fo,sigFo,0,Fo,0,0,0])
255+
self.RefDict['RefList'].append([h,k,l,int(Tw),0,Fo,sigFo,0,Fo,0,0,1])
256256
elif self.Super == 1:
257-
self.RefDict['RefList'].append([h,k,l,m1,int(Tw),0,Fo,sigFo,0,Fo,0,0,0])
257+
self.RefDict['RefList'].append([h,k,l,m1,int(Tw),0,Fo,sigFo,0,Fo,0,0,1])
258258
TwMax[0] = max(TwMax[0],TwId)
259259
fp.close()
260260
self.errors = 'Error after reading reflections (unexpected!)'
@@ -430,9 +430,9 @@ def Reader(self,filename,filepointer, ParentFrame=None, **unused):
430430
sigFo = float(sigFo)
431431
# h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,...
432432
if self.Super == 0:
433-
self.RefDict['RefList'].append([h,k,l,1,0,Fo,sigFo,0,Fo,0,0,0])
433+
self.RefDict['RefList'].append([h,k,l,1,0,Fo,sigFo,0,Fo,0,0,1])
434434
elif self.Super == 1:
435-
self.RefDict['RefList'].append([h,k,l,m1,1,0,Fo,sigFo,0,Fo,0,0,0])
435+
self.RefDict['RefList'].append([h,k,l,m1,1,0,Fo,sigFo,0,Fo,0,0,1])
436436
fp.close()
437437
self.errors = 'Error after reading reflections (unexpected!)'
438438
self.RefDict['RefList'] = np.array(self.RefDict['RefList'])
@@ -510,10 +510,10 @@ def Reader(self,filename, ParentFrame=None, **unused):
510510
wave = float(wave)
511511
tbar = float(tbar)
512512
if len(self.Banks):
513-
self.Banks[int(bN)-1]['RefDict']['RefList'].append([h,k,l,1,0,Fo,sigFo,0,Fo,0,0,0,wave,tbar])
513+
self.Banks[int(bN)-1]['RefDict']['RefList'].append([h,k,l,1,0,Fo,sigFo,0,Fo,0,0,1,wave,tbar])
514514
else:
515515
# h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,...
516-
self.RefDict['RefList'].append([h,k,l,1,0,Fo,sigFo,0,Fo,0,0,0,wave,tbar])
516+
self.RefDict['RefList'].append([h,k,l,1,0,Fo,sigFo,0,Fo,0,0,1,wave,tbar])
517517
fp.close()
518518
if len(self.Banks):
519519
self.UpdateParameters(Type='SNT',Wave=None) # histogram type
@@ -583,7 +583,7 @@ def Reader(self,filename,filepointer, ParentFrame=None, **unused):
583583
wave = float(wave)
584584
tbar = float(tbar)
585585
if len(self.Banks):
586-
self.Banks[int(bN)-1]['RefDict']['RefList'].append([h,k,l,1,0,Fo,sigFo,0,Fo,0,0,0,wave,tbar])
586+
self.Banks[int(bN)-1]['RefDict']['RefList'].append([h,k,l,1,0,Fo,sigFo,0,Fo,0,0,1,wave,tbar])
587587
else:
588588
# h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,...
589589
self.RefDict['RefList'].append([h,k,l,1,0,Fo,sigFo,0,Fo,0,0,0,wave,tbar])
@@ -646,7 +646,7 @@ def Reader(self,filename,filepointer, ParentFrame=None, **unused):
646646
Fo = float(Fo)
647647
sigFo = float(sigFo)
648648
# h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,...
649-
self.RefDict['RefList'].append([h,k,l,1,0,Fo,sigFo,0,Fo,0,0,0])
649+
self.RefDict['RefList'].append([h,k,l,1,0,Fo,sigFo,0,Fo,0,0,1])
650650
fp.close()
651651
self.RefDict['RefList'] = np.array(self.RefDict['RefList'])
652652
self.RefDict['Type'] = 'SNC'

GSASII/imports/G2sfact_CIF.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,9 @@ def Reader(self, filename, ParentFrame=None, **kwarg):
258258
HKL.append('.')
259259
#h,k,l,tw,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,Ext
260260
if im:
261-
ref = HKL+[1,0,0,0,1, 0,0,0,0,0, 0,0]
261+
ref = HKL+[1,0,0,0,1, 0,0,0,0,0, 0,0,1]
262262
else:
263-
ref = HKL+[1,0,0,1,0, 0,0,0,0,0, 0]
263+
ref = HKL+[1,0,0,1,0, 0,0,0,0,0, 0,1]
264264
if F2dn:
265265
F2 = item[itemkeys[F2dn]]
266266
if '(' in F2:

0 commit comments

Comments
 (0)