Changeset 866


Ignore:
Timestamp:
Mar 19, 2013 3:12:46 PM (9 years ago)
Author:
vondreele
Message:

fix derivative errors for crystallite size & eliminate floor on X & Y profile coeff. Stops anomalous behavior if negative.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstruct.py

    r864 r866  
    17281728            if Inst[item][2]:
    17291729                insVary.append(insName)
    1730         instDict[pfx+'X'] = max(instDict[pfx+'X'],0.001)
    1731         instDict[pfx+'Y'] = max(instDict[pfx+'Y'],0.001)
     1730#        instDict[pfx+'X'] = max(instDict[pfx+'X'],0.001)
     1731#        instDict[pfx+'Y'] = max(instDict[pfx+'Y'],0.001)
    17321732        instDict[pfx+'SH/L'] = max(instDict[pfx+'SH/L'],0.0005)
    17331733        return dataType,instDict,insVary
     
    27872787    if calcControls[phfx+'SizeType'] == 'isotropic':
    27882788        Sgam = 1.8*wave/(np.pi*parmDict[phfx+'Size;i']*costh)
    2789         gamDict[phfx+'Size;i'] = -900.*wave*parmDict[phfx+'Size;mx']/(np.pi*costh)
    2790         sigDict[phfx+'Size;i'] = -1800.*Sgam*wave*(1.-parmDict[phfx+'Size;mx'])**2/(np.pi*costh*ateln2)
     2789        gamDict[phfx+'Size;i'] = -1.8*wave*parmDict[phfx+'Size;mx']/(np.pi*costh)
     2790        sigDict[phfx+'Size;i'] = -3.6*Sgam*wave*(1.-parmDict[phfx+'Size;mx'])**2/(np.pi*costh*ateln2)
    27912791    elif calcControls[phfx+'SizeType'] == 'uniaxial':
    27922792        H = np.array(refl[:3])
     
    29762976            hfx = ':%d:'%(hId)
    29772977            Limits = calcControls[hfx+'Limits']
    2978             shl = max(parmDict[hfx+'SH/L'],0.002)
     2978            shl = max(parmDict[hfx+'SH/L'],0.0005)
    29792979            Ka2 = False
    29802980            kRatio = 0.0
  • trunk/testGSASIIstruct.py

    r762 r866  
    3434    data = Histogram['Data']
    3535    xdata = data[0]
     36    xB = np.searchsorted(xdata,limits[0])
     37    xF = np.searchsorted(xdata,limits[1])
    3638    fplot = plotter.add('function test').gca()
    37     yc,yb = G2st.getPowderProfile(parmDict,xdata,varylist,Histogram,Phases,calcControls,pawleyLookup)
    38     fplot.plot(xdata,yc+yb,'r')
     39    yc,yb = G2st.getPowderProfile(parmDict,xdata[xB:xF],varylist,Histogram,Phases,calcControls,pawleyLookup)
     40    fplot.plot(xdata[xB:xF],yc+yb,'r')
    3941
    4042def test2(name,delt):
     
    4446    data = Histogram['Data']
    4547    xdata = data[0]
     48    xB = np.searchsorted(xdata,limits[0])
     49    xF = np.searchsorted(xdata,limits[1])
    4650    hplot = plotter.add('derivatives test for '+name).gca()
    47     ya = G2st.getPowderProfileDerv(parmDict,xdata,varyList,Histogram,Phases,calcControls,pawleyLookup)[0]
    48     hplot.plot(xdata,ya)
     51    ya = G2st.getPowderProfileDerv(parmDict,xdata[xB:xF],varyList,Histogram,Phases,calcControls,pawleyLookup)[0]
     52    hplot.plot(xdata[xB:xF],ya,'b')
    4953    if 'dA' in name:
    5054        name = ''.join(name.split('d'))
    5155        varyList = [name,]
    5256    parmDict[name] -= delt
    53     y0,yb = G2st.getPowderProfile(parmDict,xdata,varyList,Histogram,Phases,calcControls,pawleyLookup)
     57    y0,yb = G2st.getPowderProfile(parmDict,xdata[xB:xF],varyList,Histogram,Phases,calcControls,pawleyLookup)
    5458    y0 += yb
    5559    parmDict[name] += 2.*delt
    56     y1,yb = G2st.getPowderProfile(parmDict,xdata,varyList,Histogram,Phases,calcControls,pawleyLookup)
     60    y1,yb = G2st.getPowderProfile(parmDict,xdata[xB:xF],varyList,Histogram,Phases,calcControls,pawleyLookup)
    5761    y1 += yb
    5862    yn = (y1-y0)/(2.*delt)
    59     hplot.plot(xdata,yn,'r+')
    60     hplot.plot(xdata,ya-yn)
     63    hplot.plot(xdata[xB:xF],yn,'r+')
     64    hplot.plot(xdata[xB:xF],ya-yn,'g')
    6165   
    6266if __name__ == '__main__':
     
    7175        print name,parmDict[name]
    7276    names = [
    73         ['0:0:Size:mx',0.001],
    74         ['0:0:Mustrain:mx',0.001],
    75         ['0:0:Size:i',0.001],
    76         ['0:0:Mustrain:i',0.1],
     77        ['0:0:Size;i',0.01],
     78        ['0:0:Mustrain:0',0.001],
     79        ['0:0:Mustrain:1',0.001],
    7780        ]
    7881    for [name,delt] in names:
Note: See TracChangeset for help on using the changeset viewer.