Skip to content

Commit d517b2d

Browse files
committed
changes for microED dynamical scattering correction
1 parent 2cd1020 commit d517b2d

File tree

5 files changed

+31
-24
lines changed

5 files changed

+31
-24
lines changed

GSASII/GSASIIdataGUI.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8056,12 +8056,12 @@ def OnPlotAll3DHKL(event):
80568056

80578057
def OnPlotFoVsFc(event):
80588058
''' Plots Fo-Fc vs Fc for single crystal data '''
8059-
Name = G2frame.GPXtree.GetItemText(G2frame.PatternId)
80608059
refList = data[1]['RefList']
8061-
XY = np.sqrt(np.abs(refList.T[8+Super:10+Super]))
8060+
XY = np.array([xy[8+Super:10+Super] for xy in refList if xy[3+Super]>0])
8061+
XY = np.sqrt(np.abs(XY)).T
80628062
FcMax = np.max(XY[1])
80638063
G2plt.PlotXY(G2frame,[[XY[1],XY[0]-XY[1]],],XY2=[[[0.,FcMax],[0.,0.]],],labelX='|Fc|',labelY='|Fo|-|Fc|',newPlot=False,
8064-
Title='|Fo|-|Fc| vs |Fc| for %s'%Name,lines=False)
8064+
Title='|Fo|-|Fc| vs |Fc|',lines=False)
80658065

80668066
def OnMergeHKL(event):
80678067
'''Merge HKLF data sets to unique set according to Laue symmetry'''

GSASII/GSASIIddataGUI.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -577,15 +577,15 @@ def OnExtRef(event):
577577
Obj = event.GetEventObject()
578578
UseList[G2frame.hist]['Extinction'][1] = Obj.GetValue()
579579

580-
def ExtVal(Ekey,valSizer):
580+
def ExtVal(Ekey,valSizer,fmt,lim):
581581
for ekey in Ekey:
582582
Eref = wx.CheckBox(DData,wx.ID_ANY,label=ekey+' : ')
583583
Eref.SetValue(UseList[G2frame.hist]['Extinction'][2][ekey][1])
584584
Indx[Eref.GetId()] = [G2frame.hist,ekey]
585585
Eref.Bind(wx.EVT_CHECKBOX, OnEref)
586586
valSizer.Add(Eref,0,WACV|wx.LEFT,5)
587-
Eval = G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist]['Extinction'][2][ekey],0,
588-
xmin=0.,nDig=(10,3,'g'),typeHint=float)
587+
Eval = G2G.ValidatedTxtCtrl(DData,UseList[G2frame.hist]['Extinction'][2][ekey],0,xmax=lim[1],
588+
xmin=lim[0],nDig=(10,4,fmt),typeHint=float)
589589
valSizer.Add(Eval,0,WACV)
590590
return valSizer
591591

@@ -630,16 +630,11 @@ def ExtVal(Ekey,valSizer):
630630
Ekey = ['Eg',]
631631
else:
632632
Ekey = ['Eg','Es']
633-
extSizer.Add(ExtVal(Ekey,val2Sizer),0)
634-
#if UseList[G2frame.hist]['Type'] == 'SEC': #Should be only for microED data, but Type is wrong = 'SXC'
635-
if 'Ma' not in UseList[G2frame.hist]['Extinction'][2]:
636-
UseList[G2frame.hist]['Extinction'][2].update({'Ma':[0.0,False]})
637-
if 'Mb' not in UseList[G2frame.hist]['Extinction'][2]:
638-
UseList[G2frame.hist]['Extinction'][2].update({'Mb':[1.0,False]})
633+
extSizer.Add(ExtVal(Ekey,val2Sizer,'g',[0.,1.]),0)
639634
extSizer.Add(wx.StaticText(DData,label=' Small F dynamical scattering correction:'))
640635
val3Sizer =wx.BoxSizer(wx.HORIZONTAL)
641636
Ekey = ['Ma','Mb']
642-
extSizer.Add(ExtVal(Ekey,val3Sizer),0)
637+
extSizer.Add(ExtVal(Ekey,val3Sizer,'f',[-100.,100.]),0,)
643638
else: #PWDR
644639
extSizer = wx.BoxSizer(wx.HORIZONTAL)
645640
extRef = wx.CheckBox(DData,wx.ID_ANY,label=' Extinction: ')
@@ -937,6 +932,9 @@ def OnFixVals(event):
937932
UseList[G2frame.hist]['Twins'] = [[np.array([[1,0,0],[0,1,0],[0,0,1]]),[1.0,False]],]
938933
if 'Layer Disp' not in UseList[G2frame.hist]:
939934
UseList[G2frame.hist]['Layer Disp'] = [0.0,False]
935+
if 'Ma' not in UseList[G2frame.hist]['Extinction'][2]:
936+
UseList[G2frame.hist]['Extinction'][2].update({'Ma':[1.0,False]})
937+
UseList[G2frame.hist]['Extinction'][2].update({'Mb':[0.0,False]})
940938
#end patch
941939
ifkeV = 'E' in UseList[G2frame.hist].get('Type','')
942940
offMsg = ''

GSASII/GSASIIobj.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
# Note that documentation for GSASIIobj.py has been moved
77
# to file docs/source/GSASIIobj.rst
88

9-
from __future__ import division, print_function
10-
import platform
119
import re
1210
import random as ran
1311
import sys
@@ -654,6 +652,8 @@ def CompileVarDesc():
654652
'Ep$' : 'Primary extinction',
655653
'Es$' : 'Secondary type II extinction',
656654
'Eg$' : 'Secondary type I extinction',
655+
'Ma$' : 'Low F dynamic scattering scale',
656+
'Mb$' : 'Low F dynamic scattering exponent',
657657
'Flack' : 'Flack parameter',
658658
'TwinFr' : 'Twin fraction',
659659
'Layer Disp' : 'Layer displacement along beam',

GSASII/GSASIIstrIO.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
This file should not contain any wxpython references as this
88
must be used in non-GUI settings.
99
'''
10-
from __future__ import division, print_function
1110
import re
1211
import os
1312
import os.path as ospath
@@ -3143,15 +3142,21 @@ def PrintBabinet(hapData):
31433142
hapDict[pfx+'Scale'] = hapData['Scale'][0]
31443143
if hapData['Scale'][1]:
31453144
hapVary.append(pfx+'Scale')
3145+
3146+
#patch
3147+
if 'Ma' not in hapData['Extinction'][2]:
3148+
hapData['Extinction'][2].update({'Ma':[1.0,False]})
3149+
hapData['Extinction'][2].update({'Mb':[0.0,False]})
3150+
#end patch
31463151

31473152
extApprox,extType,extParms = hapData['Extinction']
31483153
controlDict[pfx+'EType'] = extType
31493154
controlDict[pfx+'EApprox'] = extApprox
31503155
if 'C' in inst['Type'][0]:
31513156
controlDict[pfx+'Tbar'] = extParms['Tbar']
31523157
controlDict[pfx+'Cos2TM'] = extParms['Cos2TM']
3153-
if 'Primary' in extType:
3154-
Ekey = ['Ep',]
3158+
if 'Primary' in extType: #makes no sense to have dynamical effects with anything but primary
3159+
Ekey = ['Ep','Ma','Mb']
31553160
elif 'I & II' in extType:
31563161
Ekey = ['Eg','Es']
31573162
elif 'Secondary Type II' == extType:
@@ -3497,7 +3502,7 @@ def PrintTwinsAndSig(pfx,twinData,TwinSig):
34973502
hapData[item][0] = parmDict[pfx+item]
34983503
if pfx+item in sigDict:
34993504
ScalExtSig[pfx+item] = sigDict[pfx+item]
3500-
for item in ['Ep','Eg','Es']:
3505+
for item in ['Ep','Eg','Es','Ma','Mb']:
35013506
if parmDict.get(pfx+item):
35023507
hapData['Extinction'][2][item][0] = parmDict[pfx+item]
35033508
if pfx+item in sigDict:

GSASII/GSASIIstrMath.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2748,15 +2748,17 @@ def SCExtinction(ref,im,phfx,hfx,pfx,calcControls,parmDict,varyList):
27482748
PL = np.sqrt(1.0-cos2T**2)/parmDict[hfx+'Lam']
27492749
PLZ = AV*ref[9+im]*parmDict[hfx+'Lam']**2
27502750

2751+
DScorr = 1.0
27512752
if 'Primary' in calcControls[phfx+'EType']:
27522753
PLZ *= 1.5
2754+
DScorr = parmDict[phfx+'Ma']*np.exp(-np.sqrt(ref[9+im])*parmDict[phfx+'Mb'])+1.0
27532755
else:
27542756
if 'C' in parmDict[hfx+'Type']:
27552757
PLZ *= calcControls[phfx+'Tbar']
27562758
else: #'T'
27572759
PLZ *= ref[13+im] #t-bar
27582760
if 'Primary' in calcControls[phfx+'EType']:
2759-
PLZ *= 1.5
2761+
PLZ *= 1.5 #why?
27602762
PSIG = parmDict[phfx+'Ep']
27612763
elif 'I & II' in calcControls[phfx+'EType']:
27622764
PSIG = parmDict[phfx+'Eg']/np.sqrt(1.+(parmDict[phfx+'Es']*PL/parmDict[phfx+'Eg'])**2)
@@ -2785,8 +2787,10 @@ def SCExtinction(ref,im,phfx,hfx,pfx,calcControls,parmDict,varyList):
27852787
PF3 = 0.5*(CL+2.*AL*PF/(1.+BL*PF)-AL*PF**2*BL/(1.+BL*PF)**2)/(PF4*extCor)
27862788

27872789
dervCor = (1.+PF)*PF3 #extinction corr for other derivatives
2788-
if 'Primary' in calcControls[phfx+'EType'] and phfx+'Ep' in varyList:
2789-
dervDict[phfx+'Ep'] = -ref[7+im]*PLZ*PF3
2790+
if 'Primary' in calcControls[phfx+'EType']:
2791+
extCor *= DScorr
2792+
if phfx+'Ep' in varyList:
2793+
dervDict[phfx+'Ep'] = -ref[7+im]*PLZ*PF3
27902794
if 'II' in calcControls[phfx+'EType'] and phfx+'Es' in varyList:
27912795
dervDict[phfx+'Es'] = -ref[7+im]*PLZ*PF3*(PSIG/parmDict[phfx+'Es'])**3
27922796
if 'I' in calcControls[phfx+'EType'] and phfx+'Eg' in varyList:
@@ -4591,7 +4595,7 @@ def dervHKLF(Histogram,Phase,calcControls,varylist,parmDict,rigidbodyDict):
45914595
dMdvh[varylist.index(phfx+'Scale')][iref] = w*ref[7+im]*ref[11+im]/parmDict[phfx+'Scale'] #OK
45924596
elif phfx+'Scale' in dependentVars:
45934597
depDerivDict[phfx+'Scale'][iref] = w*ref[7+im]*ref[11+im]/parmDict[phfx+'Scale'] #OK
4594-
for item in ['Ep','Es','Eg']:
4598+
for item in ['Ep','Es','Eg','Ma','Mb']:
45954599
if phfx+item in varylist and phfx+item in dervDict:
45964600
dMdvh[varylist.index(phfx+item)][iref] = w*dervDict[phfx+item]/ref[11+im] #OK
45974601
elif phfx+item in dependentVars and phfx+item in dervDict:
@@ -4620,7 +4624,7 @@ def dervHKLF(Histogram,Phase,calcControls,varylist,parmDict,rigidbodyDict):
46204624
dMdvh[varylist.index(phfx+'Scale')][iref] = w*ref[7+im]*ref[11+im]/parmDict[phfx+'Scale'] #OK
46214625
elif phfx+'Scale' in dependentVars:
46224626
depDerivDict[phfx+'Scale'][iref] = w*ref[7+im]*ref[11+im]/parmDict[phfx+'Scale'] #OK
4623-
for item in ['Ep','Es','Eg']: #OK!
4627+
for item in ['Ep','Es','Eg','Ma','Mb']: #OK!
46244628
if phfx+item in varylist and phfx+item in dervDict:
46254629
dMdvh[varylist.index(phfx+item)][iref] = w*dervDict[phfx+item]/ref[11+im]
46264630
elif phfx+item in dependentVars and phfx+item in dervDict:

0 commit comments

Comments
 (0)