Changeset 1391


Ignore:
Timestamp:
Jun 20, 2014 1:43:42 PM (9 years ago)
Author:
vondreele
Message:

remove stray prints
Breit-Wigner & Lynn & Seeger neutron anomalous form factors for CW data
Add 'Ext' to HKLF reflection lists
make sure wave & tbar are in TOF HKLF reflection lists
add '_refln_f_sigma' & '_refln_f_squared_sigma' to possible cif reflection columns

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r1390 r1391  
    735735                    rd.RefDict['FF'] = [{} for i in range(len(rd.RefDict['RefList']))]
    736736                Id = self.PatternTree.AppendItem(parent=self.root,text=HistName)
    737                 print rd.RefDict
    738737                self.PatternTree.SetItemPyData(Id,[valuesdict,rd.RefDict])
    739738                Sub = self.PatternTree.AppendItem(Id,text='Instrument Parameters')
  • trunk/GSASIIElem.py

    r1365 r1391  
    6868    atomTypes = General['AtomTypes']
    6969    BLtable = {}
    70     isotopes = General['Isotopes']
    7170    isotope = General['Isotope']
    7271    for El in atomTypes:
     
    9594        BLvals = []
    9695        for El in BLtables:
    97             BLvals.append(BLtables[El][1]['SL'][0])
     96            if 'BW-LS' in El:
     97                BLvals.append(BLtables[El][1]['BW-LS'][0])
     98            else:
     99                BLvals.append(BLtables[El][1]['SL'][0])
    98100    else:
    99101        BLvals = {}
    100102        for El in BLtables:
    101             BLvals[El] = BLtables[El][1]['SL'][0]
     103            if 'BW-LS' in El:
     104                BLvals[El] = BLtables[El][1]['BW-LS'][0]
     105            else:
     106                BLvals[El] = BLtables[El][1]['SL'][0]
    102107    return BLvals
    103108       
     
    301306    return np.sum(fa[:,np.newaxis]*np.exp(t)[:],axis=0)+El['fc']
    302307       
    303 def BlenRes(Elist,BLtables,wave):
    304     FP = np.zeros(len(Elist))
    305     FPP = np.zeros(len(Elist))
    306     Emev = 81.80703/wave**2
    307     for i,El in enumerate(Elist):
    308         BL = BLtables[El]
    309         if len(BL) >= 6:
     308def BlenResCW(Els,BLtables,wave):
     309    FP = np.zeros(len(Els))
     310    FPP = np.zeros(len(Els))
     311    for i,El in enumerate(Els):
     312        BL = BLtables[El][1]
     313        if 'BW-LS' in BL:
     314            Re,Im,E0,gam,A,E1,B,E2 = BL['BW-LS'][1:]
    310315            Emev = 81.80703/wave**2
    311             G2 = BL[5]**2
    312             T = [Emev-BL[4],0,0]
    313             D = [T**2+G2,0,0]
    314             fp = T/D
    315             fpp = 1.0/D
    316             if len(BL) == 8:
    317                 T = Emev-BL[7]
    318                 D = T**2+G2
    319                 fp += BL[6]*T/D
    320                 fpp += BL[6]/D
    321             if len(BL) == 10:
    322                 T = Emev-BL[9]
    323                 D = T**2+G2
    324                 fp += BL[8]*T/D
    325                 fpp += BL[8]/D
    326             FP[i] = (BL[2]*fp)
    327             FPP[i] = (-BL[3]*fpp)
     316            T0 = Emev-E0
     317            T1 = Emev-E1
     318            T2 = Emev-E2
     319            D0 = T0**2+gam**2
     320            D1 = T1**2+gam**2
     321            D2 = T2**2+gam**2
     322            FP[i] = Re*(T0/D0+A*T1/D1+B*T2/D2)
     323            FPP[i] = Im*(1/D0+A/D1+B/D2)
    328324        else:
    329             FP[i] = 0.0
    330             FPP[i] = 0.0
     325            FPP[i] = BL['SL'][1]    #for Li, B, etc.
    331326    return FP,FPP
    332327   
    333 #def BlenRes(BLdata,wave):
    334 #    FP = []
    335 #    FPP = []
    336 #    Emev = 81.80703/wave**2
    337 #    for BL in BLdata:
    338 #        if len(BL) >= 6:
    339 #            G2 = BL[5]**2
    340 #            T = [Emev-BL[4],0,0]
    341 #            D = [T**2+G2,0,0]
    342 #            fp = T/D
    343 #            fpp = 1.0/D
    344 #            if len(BL) == 8:
    345 #                T = Emev-BL[7]
    346 #                D = T**2+G2
    347 #                fp += BL[6]*T/D
    348 #                fpp += BL[6]/D
    349 #            if len(BL) == 10:
    350 #                T = Emev-BL[9]
    351 #                D = T**2+G2
    352 #                fp += BL[8]*T/D
    353 #                fpp += BL[8]/D
    354 #            FP.append(BL[2]*fp)
    355 #            FPP.append(-BL[3]*fpp)
    356 #        else:
    357 #            FP.append(0.0)
    358 #            FPP.append(0.0)
    359 #    return np.array(FP),np.array(FPP)
     328def BlenResTOF(El,BLtables,wave):
     329#    FP = np.zeros(len(wave))
     330    FPP = np.zeros(len(wave))
     331    BL = BLtables[El][1]
     332    print BL
     333    if 'BW-LS' in BL:
     334        Re,Im,E0,gam,A,E1,B,E2 = BL['BW-LS'][1:]
     335        Emev = 81.80703/wave**2
     336        T0 = Emev-E0
     337        T1 = Emev-E1
     338        T2 = Emev-E2
     339        D0 = T0**2+gam**2
     340        D1 = T1**2+gam**2
     341        D2 = T2**2+gam**2
     342        FP = Re*(T0/D0+A*T1/D1+B*T2/D2)
     343        FPP = Im*(1/D0+A/D1+B/D2)
     344    else:
     345        FPP = np.ones(len(wave))*BL['SL'][1]    #for Li, B, etc.
     346    return FP,FPP
    360347   
    361348def ComptonFac(El,SQ):
  • trunk/GSASIIpwdGUI.py

    r1380 r1391  
    23472347            Status = G2frame.dataFrame.CreateStatusBar()   
    23482348        G2frame.Bind(wx.EVT_MENU, OnSelectPhase, id=G2gd.wxID_SELECTPHASE)
    2349         G2frame.Bind(wx.EVT_MENU, OnPlotHKL, id=G2gd.wxID_PWDHKLPLOT)   #not work yet
     2349        G2frame.Bind(wx.EVT_MENU, OnPlotHKL, id=G2gd.wxID_PWDHKLPLOT)
    23502350        G2frame.dataFrame.SelectPhase.Enable(False)
    23512351        if len(data) > 1:
     
    23632363    for i in range(len(refs)): rowLabels.append(str(i))
    23642364    if HKLF:
    2365         colLabels = ['H','K','L','mul','d','Fosq','sig','Fcsq','FoTsq','FcTsq','phase',]
     2365        colLabels = ['H','K','L','mul','d','Fosq','sig','Fcsq','FoTsq','FcTsq','phase','Ext',]
    23662366    else:
    23672367        colLabels = ['H','K','L','mul','d','pos','sig','gam','Fosq','Fcsq','phase','I100',]
  • trunk/GSASIIstrMath.py

    r1365 r1391  
    531531   
    532532def StructureFactor(refDict,G,hfx,pfx,SGData,calcControls,parmDict):
    533     ''' Compute structure factors for all h,k,l for phase
     533    ''' Not Used: here only for comparison the StructureFactor2 - faster version
     534    Compute structure factors for all h,k,l for phase
    534535    puts the result, F^2, in each ref[8] in refList
    535536    input:
     
    557558    FF = np.zeros(len(Tdata))
    558559    if 'N' in calcControls[hfx+'histType']:
    559         FP,FPP = G2el.BlenRes(Tdata,BLtables,parmDict[hfx+'Lam'])
     560        FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam'])
    560561    else:
    561562        FP = np.array([FFtables[El][hfx+'FP'] for El in Tdata])
     
    632633    FF = np.zeros(len(Tdata))
    633634    if 'N' in calcControls[hfx+'histType']:
    634         FP,FPP = G2el.BlenRes(Tdata,BLtables,parmDict[hfx+'Lam'])
     635        FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam'])
    635636    else:
    636637        FP = np.array([FFtables[El][hfx+'FP'] for El in Tdata])
     
    704705    FF = np.zeros(len(Tdata))
    705706    if 'N' in calcControls[hfx+'histType']:
    706         FP,FPP = G2el.BlenRes(Tdata,BLtables,parmDict[hfx+'Lam'])
     707        FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam'])
    707708    else:
    708709        FP = np.array([FFtables[El][hfx+'FP'] for El in Tdata])
     
    788789   
    789790def SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varyList):
    790     ''' Single crystal extinction function; puts correction in ref[13] and returns
     791    ''' Single crystal extinction function; puts correction in ref[11] and returns
    791792    corrections needed for derivatives
    792793    '''
     
    17631764                for iref,ref in enumerate(refDict['RefList']):
    17641765                    if ref[6] > 0:
    1765                         dervCor,dervDict = SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist) #puts correction in refl[13]
     1766                        dervCor,dervDict = SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist) #puts correction in refl[11]
    17661767                        w = 1.0/ref[6]
    17671768                        if w*ref[5] >= calcControls['minF/sig']:
     
    17891790                for iref,ref in enumerate(refDict['RefList']):
    17901791                    if ref[5] > 0.:
    1791                         dervCor,dervDict = SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist) #puts correction in refl[13]
     1792                        dervCor,dervDict = SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist) #puts correction in refl[11]
    17921793                        Fo = np.sqrt(ref[5])
    17931794                        Fc = np.sqrt(ref[7])
     
    19041905                for iref,ref in enumerate(refDict['RefList']):
    19051906                    if ref[6] > 0:
    1906                         dervCor,dervDict = SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist) #puts correction in refl[13]
     1907                        dervCor,dervDict = SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist) #puts correction in refl[11]
    19071908                        w =  1.0/ref[6]
    19081909                        if w*ref[5] >= calcControls['minF/sig']:
     
    19311932                for iref,ref in enumerate(refDict['RefList']):
    19321933                    if ref[5] > 0.:
    1933                         dervCor,dervDict = SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist) #puts correction in refl[13]
     1934                        dervCor,dervDict = SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist) #puts correction in refl[11]
    19341935                        Fo = np.sqrt(ref[5])
    19351936                        Fc = np.sqrt(ref[7])
     
    20592060                for i,ref in enumerate(refDict['RefList']):
    20602061                    if ref[6] > 0:
    2061                         SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist) #puts correction in refl[13]
     2062                        SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist) #puts correction in refl[11]
    20622063                        w = 1.0/ref[6]
    20632064                        ref[7] = parmDict[phfx+'Scale']*ref[9]
     
    20772078                for i,ref in enumerate(refDict['RefList']):
    20782079                    if ref[5] > 0.:
    2079                         SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist) #puts correction in refl[13]
     2080                        SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist) #puts correction in refl[11]
    20802081                        ref[7] = parmDict[phfx+'Scale']*ref[9]
    20812082                        ref[7] *= ref[11]                       #correct Fc^2 for extinction
  • trunk/imports/G2sfact.py

    r1364 r1391  
    170170                else:
    171171                # h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,...
    172                     self.RefDict['RefList'].append([h,k,l,0,0,Fo,sigFo,0,Fo,0,0,0])
     172                    self.RefDict['RefList'].append([h,k,l,0,0,Fo,sigFo,0,Fo,0,0,0,wave,tbar])
    173173            if len(self.Banks):
    174174                self.UpdateParameters(Type='SNT',Wave=None) # histogram type
  • trunk/imports/G2sfact_CIF.py

    r1168 r1391  
    6868
    6969        Fsignames = ('_refln_f_meas_sigma','_refln.f_meas_sigma','_refln.f_meas_sigma_au',
     70                    '_refln_f_sigma',
    7071                      )
    7172       
    7273        F2signames = ('_refln_f_squared_meas_sigma','_refln.f_squared_meas_sigma',
     74                      '_refln_f_squared_sigma',
    7375                      )
    7476
     
    257259                        except:
    258260                            HKL.append('.')
    259                     #h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,...
     261                    #h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,Ext
    260262                    ref = HKL+[0,0,0,0,0, 0,0,0,0,0, 0]
    261263                    if F2dn:
     
    310312            self.RefDict['RefList'] = np.array(self.RefDict['RefList'])
    311313            self.errors = 'Error during reading of dataset parameters'
    312             self.UpdateControls(Type='Fosq',FcalcPresent=FcalcPresent) # set Fobs type & if Fcalc values are loaded
    313314            if blk.get('_diffrn_radiation_probe'):
    314315                if blk['_diffrn_radiation_probe'] == 'neutron':
Note: See TracChangeset for help on using the changeset viewer.